Posted by & filed under Life.

“An illustrated guide for programmers and other curious people”

Great read for anyone that wants a refresher on algorithms and for learning the fundamentals of programming.

Best part is, it isn’t boring, you feel like you want to read the entire book in one sitting!

 

Source: https://www.manning.com/books/grokking-algorithms

Posted by & filed under Projects.

New projects added with screenshots!

The Projects Menu Item has been updated with some latest projects with screenshots. Feel free to take a look, including 2 new iOS apps: Photo Album and Live Feed!

Enjoy 🙂

Posted by & filed under Projects, Web Development.

Deployed some apps to Heroku:

Will update these with feature list and their own dedicated page on my website soon. Stay tuned!

Posted by & filed under CheatSheets, Web Development.

Some deployment steps for Heroku:

To deploy static html/css project:
1) Create an index.php file with the following content: <?php include_once(“home.html”); ?>
2) Rename your main or index.html to home.html
3) Deploy app

To deploy node.js project:
1) Ensure package.json has a start script and deploy app.
e.g. “scripts”: {
“test”: “echo \”Error: no test specified\” && exit 1″,
“start”: “node app.js”
},

To deploy to Heroku:
1) Install Heroku toolbelt and login account
2) Run “heroku create” in a git project
3) Run “heroku apps:rename <newProjectName>” to rename your project (optional)
4) Run “git push heroku master” to push project to heroku

Posted by & filed under CheatSheets, Concepts, Web Development.

Mongo DB Commands

A table of some useful mongo commands. These were used and tested on Cloud 9.

Command Description
$ mkdir data
$ echo ‘mongod –bind_ip=$IP –dbpath=data –nojournal –rest “$@”‘ > mongod
$ chmod a+x mongod
Setup Mongo to use a dir “data”
./mongod Start mongo server
mongo Start mongo shell
show dbs Print a list of all databases on the server.
use <dbName> Switch current database to <db>. The mongo shell variable db is set to the current database.
show collections Print a list of all collections for current database.
db.collection.find() Find all documents in the collection and returns a cursor.
db.collection.insert() Insert a new document into the collection. e.g. db.dogs.insert({name: “Victory”})
db.collection.update() Update an existing document in the collection.
db.collection.save() Insert either a new document or update an existing document in the collection.
db.collection.remove() Delete documents from the collection.
db.collection.drop() Drops or removes completely the collection.
mongod –repair –repairpath <path> Repairs the mongo db if incorrectly shut down.
Other useful mongo Links:

Mongo command reference: https://docs.mongodb.com/manual/reference/mongo-shell/

Setup mongo on cloud 9: https://community.c9.io/t/setting-up-mongodb/1717

Posted by & filed under CheatSheets, Concepts, Web Development.

GIT Commands

A table of some useful git commands.

Command Description
git init Create a new local repository
git rm -rf .git Undo git init
git add <filename>
git add .
Add one or more files to staging (index)
git status List the files you’ve changed and those you still need to add or commit
git commit -m <message> Commit changes to head (but not yet to the remote repository)
git log Show commit history. CommitId is the leading characters of the changeset ID, up to 10.
git checkout <branch> Checkout an exisitng branch
git remote add origin <server> Adds remote server so that project can be pushed.
git push add origin master Push the branch to your remote master repository
git pull Fetch and merge changes on the remote server to your working directory
git revert –no-commit <commitID>..HEAD Reverts the head to the specified commitID. All changes would not be lost, but will exist as unsaved changes in project.
Other useful GIT Links:

How to push Cloud9 project to GitHub: http://lepidllama.net/blog/how-to-push-an-existing-cloud9-project-to-github/

Great GIT tutorials: https://www.atlassian.com/git/tutorials/what-is-version-control

Posted by & filed under CheatSheets, Concepts, Web Development.

RESTful Routes

A table of all 7 RESTful routes

Name Path HTTP Verb Purpose Mongoose Method
Index /dogs GET List all dogs Dog.find()
New /dogs/new GET Show new dog form N/A
Create /dogs POST Create a new dog, then redirect somewhere Dog.create()
Show /dogs/:id GET Show info about one specific dog Dog.findById()
Edit /dogs/:id/edit GET Show edit form for one dog Dog.findById()
Update /dogs/:id PUT Update particular dog, then redirect somewhere Dog.findByIdAndUpdate()
Destroy /dogs/:id DELETE Delete a particular dog, then redirect somewhere Dog.findByIdAndRemove()

Posted by & filed under Concepts, Software.

What is the difference between a Framework, a Toolkit and a Library? The most important difference, and in fact the defining difference between a library and a framework is Inversion of Control.

What does this mean? Well, it means that when you call a library, you are in control. But with a framework, the control is inverted: the framework calls you. (This is called the Hollywood Principle: Don’t call Us, We’ll call You.) This is pretty much the definition of a framework. If it doesn’t have Inversion of Control, it’s not a framework. (I’m looking at you, .NET!)

Basically, all the control flow is already in the framework, and there’s just a bunch of predefined white spots that you can fill out with your code.

A library on the other hand is a collection of functionality that you can call.

I don’t know if the term toolkit is really well defined. Just the word “kit” seems to suggest some kind of modularity, i.e. a set of independent libraries that you can pick and choose from. What, then, makes a toolkit different from just a bunch of independent libraries? Integration: if you just have a bunch of independent libraries, there is no guarantee that they will work well together, whereas the libraries in a toolkit have been designed to work well together – you just don’t have to use all of them.

But that’s really just my interpretation of the term. Unlike library and framework, which are well-defined, I don’t think that there is a widely accepted definition of toolkit.

Source: http://stackoverflow.com/questions/3057526/framework-vs-toolkit-vs-library