git command line commit

Git has a “staging area” where files need to be added before being committed, you can read an explanation of it here. So if you make some change and commit directly, you get some message like: no changes added to commit (use “git add” and/or “git commit -a”) preview Before you add, you could have…

Install jdk 8 in Yosemite 10.10.2

While i was trying to downgrade JDK from 1.8.0._25 to 1.8.0_05 into the yosemite 10.10.2 so that i could use the DCEVM in my OSX.   I first remove the new version by just do a sudo mv jdk1.8.0_25.jdk ~/Desktop/ Next step is to install the 1.8.0_05 which is the current latest version that DCEVM supports.However, I got the…

get tomcat hot swap work with intellij

It usually takes a lot of time whenever you’re recompiling a Java web project. The IDE would usually recompile the entire project, package them into a war and have it redeployed on your  application server (i.e., Tomcat) then letting the server reinitialize itself. It takes a lot of time, and it just gets worse as your…

deploy nodejs angularjs mongodb expressjs application to openshift

In my previous post, I described how to upload file using nodejs and angularjs. Now we are to deploy this MEAN stack app to openshift which is a very good cloud service provider offering 3 application deployment for free. You can even deploy Java web application to it using Tomcat/Mysql, part of which i mentioned…

nodejs log to file for multiple modules

There are several projects provide the ability to log to file for nodejs like log4js, winston etc. I picked winston for no specific reason. init setup is pretty simple, just follow what is written in Github. To make it be able to be shared by multiple modules, we need some tweaks. First we need a…

Watch out the milliseconds in java Calendar

milliseconds  problem If you run the following test multiple times, you get different results: result : Time 1369454400208 Time 1369454400185 Time 1369454400926 When getting Instance of calendar it has been initialized with current time. And when setting year,month etc. MILLISECOND were taken from current date. What’s more if you get a calendar instance and  use…

html form submission type

When you make a POST request, you have to encode the data that forms the body of the request in some way. HTML forms provide three methods of encoding. application/x-www-form-urlencoded (the default) multipart/form-data text/plain Work is being done on adding application/json. The specifics of the formats don’t matter to most developers. The important points are:…

debug nodejs with nodemon and intellij

Noticed that if I run nodemon within intellij, I would not be able to debug any more inside intellij. Not sure what reason it is. If just run the nodejs, no problem. However once I add the ‘/usr/local/bin/nodemon’ into the Node parameters of the run config, the breakpoint would not work. solution To solve this…

Sort map by value

Setup Straight up Java Java 8 FROM HERE And some good discussion here

ignore certain fields from mongoose schema when return object to client

override the toJSON This will remove the password part in the target object. documented way The mongoose document is in the toOject() part toJson doc The mongoose document which is being converted ret The plain object representation which has been converted options The options in use (either schema options or the options passed inline) use…

window sessionStorage vs localStorage

They are almost the same. However if you want to store info beyond a tab, which means even after a tab is closed, then use localStorage Opening a page in a new tab or window will cause a new session to be initiated. That means that info stored in sessionStorage can’t share between tabs. more details could be…