Tuesday, December 31, 2019

Free Coding Interview Preparation

Coding interview preparation can be overwhelming and stressful. I have been in your situation. I have experienced your pain first hand.
I can guide you in your coding interview preparation and create a customized action plan for your situation.
Sifting and sorting through an ocean of resources can be exhausting. You feel lost with no clear path to success. You are wondering how to use your time effectively. Should I be studying now? What should I be studying? Should I be practicing solving coding problems? Which problems should I be working on? and so on.
For more than 10 years I have coached hundreds of developers to improve their software development skills. Coaching them live resulted in a book: TDD in Ruby that is now published by Apress.
I want to help you and Coding Hotline Live Session can kickstart your coding interview preparation. It's you and me for 15 minutes. You tell me what you are struggling with and I will give you a customized top 3 action items for moving forward.
So if you are feeling frustrated and overwhelmed with coding interview preparation, sign up for FREE coaching herehttps://go.oncehub.com/BalaParanj for your session and we will figure it all out. Why is this free? Because I believe in Zig Ziglar's quote:
You can get everything in life you want if you will just help enough other people get what they want.

Friday, December 06, 2019

Process to Create Algorithmic Visualization


Storyboard Template
  1. Left page, upper section - Code that is currently executing
  2. Left page, lower section - Auxiliary data structure diagram
  3. Right page, upper section - Primary data structure Diagram  
  4. Right page, lower section - Explanation
Storyboard 
  1. Draw the diagrams with color pens on paper.
  2. Scan the diagram with color
  3. Embed the images into a document (duplicate the image as many times as desired)
  4. Print the document in color
  5. Draw the shot for each step with color
  6. Scan the document
The sequence of images in the scanned document will now show the visualization.


Sunday, June 16, 2019

First Principles Thinking

Practice of taking any idea, any concept and then stripping it back to basic, fundamental building blocks that are incontestable, free of subjective bias and can be universally accepted as facts.

You do this by questioning every assumption you think you know about a given problem or scenario and challenging current knowledge that is learned, but not essential and doing this over and over until you get to its most basic roots. You will be able to:

- Think inventively.
- Invent new solutions to old problems.
- Change trajectory of creating from iterating on existing thinking to one of genuine innovation.
- Retain and use knowledge effectively because they understand the fundamental building blocks.

Sunday, March 10, 2019

git error

error: src refspec master does not match any.

This can happen when the files are not committed.

Set the PATH for Ruby in Ubuntu

 cat ~/.bash_profile
export PATH=$PATH:/usr/local/bin

Upgrading Git to Latest Version on Ubuntu

sudo add-apt-repository ppa:git-core/ppa -y
sudo apt-get update
sudo apt-get install git -y
git --version

Tuesday, February 26, 2019

exec: \"/bin/bash\": stat /bin/bash: no such file or directory

docker: Error response from daemon: OCI runtime create failed: container_linux.go:344: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory": unknown.
ERRO[0000] error waiting for container: context canceled 

Resolution:

bash must be installed on the Docker image.

Friday, February 22, 2019

ArgumentError: Missing `secret_key_base` for 'production' environment

set this string with `rails credentials:edit`command, 

Install Ruby 2.6.1 using RVM

rvm get stable
rvm pkg install openssl
rvm install ruby-2.6.1 --with-openssl-dir=$HOME/.rvm/usr

cannot create directory ‘/var/www’

Resolution: create the directory on the server and provide permission to deploy user:
sudo chown deploy:deploy /var/www/

Don't know how to build task 'deploy:updated'

Resolution

In Capfile the require statement sequence matters:

require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/bundler'
require 'capistrano/rails'

Saturday, February 16, 2019

sqlite3 error in rails 5.2

Error loading the 'sqlite3' Active Record adapter. Missing a gem it depends on? can't activate sqlite3 (~> 1.3.6), already activated sqlite3-1.4.0. Make sure all dependencies are added to Gemfile. (LoadError)

uninstall sqlite3 and

Add:

gem 'sqlite3', '~> 1.3.6'

Monday, January 28, 2019

Forking Example

puts "Parent process id : #{Process.pid}"

TEST = 10
fork do
  puts TEST
  puts "---- Child process id : #{Process.pid}"  
  puts "---- Parent process id : #{Process.ppid}"
end

fork do
  puts TEST
  puts "**** Child process id : #{Process.pid}"  
  puts "**** Parent process id : #{Process.ppid}"
end


puts TEST
puts "Waiting for child to exit"
Process.wait
puts "Done"


at_exit do
  puts "About to exit the program"  
end

Sunday, January 27, 2019

Vagrant Basics Presentation Notes

What is Vagrant?

Vagrant is a tool for building complete development environments, sandboxed in a virtual machine. Vagrant lowers development environment setup time, increases de‐ velopment/production parity, and brings the idea of disposable compute resources down to the desktop.

- Create a virtual machine 
- Modify RAM, number of cps etc of the virtual machine
- Setup shared folders
- Boot virtual machine
- Provision software on the machine via a shell script, Chef, Puppet etc

Manage Lifecycle of the Machine

- SSH into the machine
- Shut down the machine
- Destroy the machine (delete all virtual hard drive)
- Suspend or resume the machine
- Package the machine state and distribute it to other developers

Why Vagrant?

- Installations can be difficult
- Configuration is even more difficult
- Manual setups result in difference between development and production
- Multiple projects become very difficult (different configurations)
- Difficult to keep development environments in sync for everyone in the team

Vagrant encourages automation to setup the development environment. Vagrant puts your development environment into a virtual machine, working with multiple projects is easy, because each project just get its own virtual machine. Finally, working with a team is easier than ever, since you can share the virtual machine image. And bringing a new team member on board is as simple as telling them to build their Vagrant machine with a single command.

Setting up Vagrant

1. Install VirtualBox
2. Install Vagrant (Installers for various platforms)

First Vagrant Machine


vagrant up

vagrant ssh

vagrant destroy

The Vagrantfile

mkdir vagrant_ex
cd vagrant_ex


[Vagrantfile for Vagrant 2 goes here]

Boxes

Vagrant::Config.run do |config|
  config.vm.box = "precise64"
end

vagrant up

vagrant status

vagrant ssh

By default, Vagrant shares the project directory (the directory with the Vagrantfile) to /vagrant inside the virtual machine. After SSHing into the virtual machine, this can be verified by listing the files in that directory:

vagrant@precise64:~$ ls /vagrant/
    Vagrantfile
You can over-ride the shared folder:

config.vm.share_folder "v-root", "/foo", "."

First,anidentifierforthesharedfolder.Inthiscase,byspecifyingv-root,thedefault shared folder that Vagrant sets up is overridden.

Next,/fooisthepathwherethefolderwillexistintheguestmachine.Thispathwill be created if it doesn’t already exist. If it does already exist, the location will be replaced with the contents of the shared folder.

• Thethirdparameter,"."isthepathofthefoldertobesharedfromthehostmachine. This can be an absolute or relative path. If it is relative, like the example, it is relative to the project root. So in the example, it is sharing the project root.

vagrant reload

Restarts the machine with the new configuration

Basic Networking

config.vm.forward_port 80, 8080

vagrant reload

vagrant ssh
cd /vagrant
sudo python -m SimpleHTTPServer 80

vagrant suspend
vagrant status

vagrant up
vagrant halt

vagrant halt --force
vagrant up

vagrant destroy
vagrant status

vagrant destroy --force
vagrant up

Provisioning Vagrant VM

Create a provision.sh

#!/usr/bin/env bash
echo "Installing Apache and setting it up..."
apt-get update >/dev/null 2>&1
apt-get install -y apache2 >/dev/null 2>&1
rm -rf /var/www
ln -fs /vagrant /var/www

Add this line to Vagrantfile
    config.vm.provision "shell", path: "provision.sh"

Vagrant::Config.run do |config|
  config.vm.box = "precise64" config.vm.forward_port 80, 8080 config.vm.provision "shell", path: "provision.sh"
end

vagrant up

Boxes

Boxes are the base images upon which Vagrant environments are built. 

Boxes are an optimization so that Vagrant doesn’t have to install a complete operating system on every vagrant up. Installing an operating system from scratch generally takes up to 30 minutes on a good computer.

    $ vagrant box add precise64 http://files.vagrantup.com/precise64.box
$ vagrant box list
    $ vagrant box remove precise64 virtualbox