If you see it

Live for passion

Deploy and Rename Heroku App

Deploy to heroku
$ heroku create 
$ git push heroku master
$ foreman start // locally running server after you have Procfile
$ git push origin master // your git account
$ git push heroku master // when you want to deploy
$ heroku ps:scale web=1
$ heroku logs 
$ heroku open
Rename heroku app:
$ git remote rm heroku
$ git remote add heroku git@heroku.com:XXXX.git

Install Learnyounode on Mac

$ brew update 
$ brew install node 
$ node --version
$ sudo npm install -g learnyounode

Create a Simple J2EE Web Project With IntelliJ and Tomcat

As it’s surprising hard to start from scratch to create a simple web project using jsp running on tomcat with IntelliJ, this post intends to leave a note for this boiler process.

Install Tomcat 7 on Mac (10.9.2)

Download: http://tomcat.apache.org/download-70.cgi#7.0.53


$ mv apache-tomcat-7.0.53 /usr/local/Cellar/
$ mv apache-tomcat-7.0.53 tomcat
$ cd tomcat/bin
$ sh startup.sh

Test it in http://localhost:8080/ to see if it works.

$ sh shutdown.sh

Edit $TOMCAT_DIR/conf/tomcat-users.xml to get admin access:

  <role rolename="manager-gui"/>
  <role rolename="admin"/>
  <user username="admin" password="admin" roles="admin,manager-gui"/>

And restart the tomcat to gain the access with new credential.

Roles: “You can find the role names in the web.xml file of the Manager web application. The available roles are:”

manager-gui — Access to the HTML interface.

manager-status — Access to the “Server Status” page only.

manager-script — Access to the tools-friendly plain text interface that is described in this document, and to the “Server Status” page.

manager-jmx — Access to JMX proxy interface and to the “Server Status” page.

Tomcat 7 manager-howto


Add tomcat7 to IntelliJ

Add this as tomcat home directory /usr/local/Cellar/tomcat/ or the your specific link form your settings.

Ubuntu Tooling

Terminal alternatives:

Guake Slide window, less configuation, switch tabs shortcut, transparent etc.

Terminator Multi windows


SEO 101


“”View Page Source” would not contain the word “octopus”. Similarly, if some of your content is created dynamically, the page source will not include all the content you will want the crawler to see.

In other words “View Page Source” is exactly what the crawler gets.

In current practice, “progressive enhancement” in the form of Hijax-links are often used

When creating your links, format them so they’ll offer a static link as well as calling a JavaScript function

foo 32

Note that the static link’s URL has a parameter (?foo=32) instead of a fragment (#foo=32), which is used by the AJAX code. This is important, as search engines understand URL parameters but often ignore fragments. Web developer Jeremy Keith labeled this technique as Hijax. Since you now offer static links, users and search engines can link to the exact content they want to share or reference.(Hijax)

<a href="ajax.htm?foo=32" onClick="navigate('ajax.html#foo=32'); return false">foo 32</a>

Google ajax crawling

Crawling simulator


Download, unzip, run

java -jar crawljax-web-3.5.jar

Snapshots tools


PhantomJS : lightweight, fast generation

Vagrant With Your Dev Vbox

To create a Ubuntu GUI Development VM (12.04 LTS i386)

Command line
$ vagrant init

$ vagrant box add JujuBox http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-i386-juju-vagrant-disk1.box

$ vagrant up

$ vagrant destroy

Reference: Using Juju with Vagrant List of vagrant boxes

$ vagrant halt //shut down VM 

$ vagrant reload // reload the box, may not fully work with VPN on
Adding existing box via Vagrant
vagrant init BOX_NAME
vagrant up

Fixing Maven and Upgrade It

If you are using a older version of maven on Linux with dpkg package manager:

Uninstall maven

$ dpkg --get--selections to list all dpkg packages.

$sudo apt-get remove maven2 to remove package

Git Branch

Browse all the branches: git branch --all or git branch -a

Browse only remote branches: git branch -r

Delete local branch: git brach -d BRANCH_NAME or git brach -D BRANCH_NAME if it states ‘error: The branch xxx is not fully merged’ and you really don’t care about what’s in that branch.

Note: git brach -d BRANCH_NAME_1 BRANCH_NAME_2 BRANCH_NAME_3 to delete multiple branches at the same time is ok.

Delete remote branch: git push origin :REMOTE_BRANCH_NAME or git branch -r -d origin/REMOTE_BRANCH_NAME

Note: if you see ‘error: unable to delete xxx: remote ref does not exist’, try to do git fetch -p origin to sync your local repo and origin master repo. -p will delete any tracking branches locally that no longer in remote.

Angular Try

My Rails App repo integrated with Augular followed RailsCast episode, Under the repo, there is a simple one page todo list demo which includes key words: ng-bind, ng-repeat, ng-model. Also includes a small usage of filter, directive.

You may start with try to under the example on the index page from Augular site

Strongly recommand video tutorials from : Egghead - Bite-sized web development training with AngularJS, short clips but very helpful.

Also, recommand two short screencasts from codeschool AugualrJS if you have suscription.


Adding new behavior to or transforming the DOM.

Wirtten with carmel cased names, invoked by translating to snake case with ‘-’ or ‘_’, optionally, prefix with x- or data- to make HTML validator compliant.

Can be used in element names, attributes, class names, comments.


data-ng-model : html5

ng-model ng-bind

directives: run in this order to modify: template-dom dom


Karma - end to end testing

Adding gem ‘angularjs-rails’

Application.js //= require angular //= require angular-resource


Angular extention for debugging in Chrome check here.