Saturday, November 19, 2016

convert a project directory into new github repo

go to project directory and do following -

git init
git add .

create a repo in github

generate and add public ssh key to git user account under Settings -> SSH and GPG keys

if you get the error "Key already used", you might have used the key in some other github repo
Either you can remove it or create a new pair using following command (NOTE: Press ENTER if it asks for any input to choose default options)
ssh-keygen -t rsa -f ~/.ssh/id_rsa.home

copy contents of id_rsa.home.pub to github

Add the private key to ssh-agent
ssh-add ~/.ssh/id_rsa
If you have generated a new pair, you may need to add the private key (Source: Generate and Add new key)
git remote add origin git@github.com:gituser/myrepo.git
to see impact of above command
git remote -v

You must be ready by now to push to remote repo
git push origin master

Friday, November 18, 2016

Django vs PYTHONPATH and the not found error

a must read post for those who still struggle with the path gymnastics

http://musings.tinbrain.net/blog/2012/mar/15/django-vs-pythonpath/

remember - adding both project and app paths in PYTHONPATH is NOT the RIGHT solution

Must read post for newbies to postgresql setup

It is really frustrating that a well established database like postgresql doesn't work out of the box.
It can be a big turn off for a newbie.

Following post wrote exactly what a newbie will typically go through
http://theprogrammersdiary.blogspot.in/2013/02/nightmares-of-postgresql-with-django.html

start postgreql vs postgres start

To have launchd start postgresql now and restart at login:
  brew services start postgresql

Or, if you don't want/need a background service you can just run:
  pg_ctl -D /usr/local/var/postgres start

Saturday, November 12, 2016

MongoDB installation on Mac OS via brew

After installing MongoDB with Homebrew:

  • The databases are stored in the /usr/local/var/mongodb/ directory
  • The mongod.conf file is here: /usr/local/etc/mongod.conf
  • The mongo logs can be found at /usr/local/var/log/mongodb/
  • The mongo binaries are here: /usr/local/Cellar/mongodb/[version]/bin
Source: http://stackoverflow.com/questions/13827915/location-of-the-mongodb-database-on-mac

update database index for locate command on mac OS X

update database index for locate command on mac OS X

sudo /usr/libexec/locate.updatedb

Tuesday, September 6, 2016

When you change the world and no one notices


Big breakthroughs typically follow a seven-step path:
  1. First, no one's heard of you.
  2. Then they've heard of you but think you're nuts.
  3. Then they understand your product, but think it has no opportunity.
  4. Then they view your product as a toy.
  5. Then they see it as an amazing toy.
  6. Then they start using it.
  7. Then they couldn't imagine life without it.
Technology does not drive change. It is our collective response to the options and opportunities presented by technology that drives change.

Reverse Network Effects

Thursday, September 1, 2016

VimDiff Keyboard Shortcuts:

VIMDiff Keyboard Shortcuts:

do - Get changes from other window into the current window.

dp - Put the changes from current window into the other window.

]c - Jump to the next change.

[c - Jump to the previous change.

Ctrl W + Ctrl W - Switch to the other split window.

Thursday, March 3, 2016

Microservices Ending up as a Distributed Monolith


If a service cannot interact within a system unless all these libraries are available, then Christensen calls this a distributed monolith. Essentially all you have done is spread a monolith over the network paying all the cost of a distributed system but losing a lot of the benefits of the microservices architecture. Some of the benefits lost include the characteristic of polyglot, meaning that you loose the possibility of services adopting the best technologies to solve the specific problem, and organizational and technical decoupling, allowing for a team to evolve technically without first having to convince a central authority.

The alternative for Christensen is contracts and protocols, services should hide all their implementation details only exposing data contracts and network protocols. 

Tuesday, February 23, 2016

JavaScript variable names you shouldn’t use

JavaScript has keywords and reserved words that can't be used as identifiers, but there's also a number of host objects that exist and can be overridden without any warning.
  • self – I see this a lot when setting a pointer to the this object, such as: var self = this;. Oftentimes, this is how developers are keeping a reference to an object for use inside of a closure. The problem is that self is already in use as another pointer to thewindow object. Don't redefine self as something other than what it is as it could confuse others looking at your code.
  • top – This one is most often used in combination with a variable named left to determine or set element coordinates. Once again, the problem is that top is a host object, it points to the outermost window object and is most useful when used from within a frame.
  • location – I'm surprised, but I have seen variables with this name. This is a host object containing information about the page that is currently loaded.

Source: https://www.nczonline.net/blog/2007/06/03/javascript-variable-names-you-shouldn-t-use/

Monday, February 8, 2016

Angular JS: Common Pitfalls using scopes

http://thenittygritty.co/angularjs-pitfalls-using-scopes

Any amount of changes must be applied by calling $apply to invoke the digest cycle. However, you don't have to if it's not required.
Sometimes it might not be suited to apply the digest cycle after every single change since it could massively decrease performance.