博文

Git rewriting local history - update previous (but not the last) commit

Suppose you haven't done any merge or push, and there is no change in the stage. Now you realize you want to make some change in one of your previous commit you haven't pushed yet. 1. Start interactive rebase process with the last 3 commit, suppose the oldest 3th commit is the one you want to update. git rebase -i HEAD~3 2. Edit the rebase command in the poped editor. From: pick f7f3f6d changed my name a bit pick 310154e updated README formatting and added blame pick a5f4a0d added cat-file # Rebase 710f0f8..a5f4a0d onto 710f0f8 # # Commands: #  p, pick = use commit #  e, edit = use commit, but stop for amending #  s, squash = use commit, but meld into previous commit # # If you remove a line here THAT COMMIT WILL BE LOST. # However, if you remove everything, the rebase will be aborted. # To: edit f7f3f6d changed my name a bit pick 310154e updated README formatting and added blame pick a5f4a0d added cat-file # Rebase 710f0f8..a5f4a0d onto 71...

Install git on windows and use it in cygwin

You have two options when install git: Install mysisgit https://code.google.com/p/msysgit/downloads/list Install git from cygwin Recommendation is to use option 1, because by that you always get the latest git version.  After install mysisgit on your windows machine, you should add git_install_folder/bin/ to your path environment variable so that cygwin can find it. Add the following configuration settings from cygwin: git config --global core.askpass "git-gui–-askpass" git config --global credential.helper store git config --global core.eol lf git config --global core.autocrlf false git config --global core.filemode false // ignore file mode(chmod) change in git

Install Oracle Java 7 on Ubuntu 12.04

This tested to be working: http://www.liberiangeek.net/2012/04/install-oracle-java-jdk-7-in-ubuntu-12-04-precise-pangolin/

Escaping in JSP for JSP and JS

Escaping for JSP A JSP page will eventually rendered as HTML content in browser. In that case, lots of character like <, &, > need to be escaped before directly display them on the HTML page. This is when we need the escape for xml for html for JPS page. To escape, you could use this in JSP page <%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> ${fn:escapeXml(myString)} or <c:out value="${myString}"/> Escaping for Javascript Sometimes in JSP page we write Javascript code. The javascript code has its own understand of character like single quote ' and double quote ", this is when we need escape in JSP but for the javascript usage. The best way to do that is create a utility tag libary <?xml version="1.0" encoding="UTF-8" ?> <taglib xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation...

Make use of your logs with Logstash, ElasticSearch, Kibana and Redis

https://medium.com/what-i-learned-building/e855bc08975d

Javascript quick revisit

The new keyword http://htmldog.com/guides/javascript/advanced/oo/ http://stackoverflow.com/questions/1646698/what-is-the-new-keyword-in-javascript CDN - Content Delivery Networks <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"> </script> Browser Object Model (BOM) The window object is supported by all browsers. It represent the browser's window. All global JavaScript objects, functions, and variables automatically become members of the window object. Global variables are properties of the window object. Global functions are methods of the window object. Even the document object (of the HTML DOM) is a property of the window object: window.document.getElementById("header"); same as: document.getElementById("header"); RegEx Syntax var patt=new RegExp(pattern,modifiers); or more simply: var patt=/pattern/modifiers; Prototype property Prototype is a global constructor in J...

Is a programming language worth learning?

http://blog.smartbear.com/codereviewer/6-ways-to-determine-a-new-programming-language-is-a-turkey/