Git: Cheat Sheet

July 2nd, 2009 by jeremychone | No Comments »

Branch

List local and remote branches

git branch -a

See also

Freemarker: XML Xpath Expression

June 30th, 2009 by jeremychone | No Comments »
[#list doc["book/chapter[title='Ch1']/para"] as p]
<p>${p}</p>
[/#list]

See XPath Freemarker doc for more info.

jQuery: Add an Element to an existing jQuery Object

June 29th, 2009 by jeremychone | No Comments »
var $first = $("#mySingleElement");
var $allLis = $("li");
//to add the $first to $allLis jQuery object
$allLis[$allLis.length++] = $first.get(0)

I know, kind of ugly, but did not find a better way.

See also: how-to-add-elements-to-a-jQuery-object-without-copying-it

Eclipse: Remove my Aptana welcome screen

June 29th, 2009 by jeremychone | No Comments »
  1. Go to Window –> Preferences –> Aptana –> My Aptana/Message Center
  2. Check “Never display after startup”

jQuery: Ajax Load HTML fragment

June 17th, 2009 by jeremychone | No Comments »
 $("#feeds").load("feeds.php", {limit: 25}, function(){
   alert("The last 25 entries in the feed have been loaded");
 });

jQuery Doc: Load

jQuery: HTML Encode Trick

June 17th, 2009 by jeremychone | No Comments »
$('<div/>').text('This is fun & stuff').html();

Source: debuggable.com

jQuery: Hover over out

June 17th, 2009 by jeremychone | No Comments »
  <ul>
    <li>Milk</li>
    <li>Bread</li>
    <li class='fade'>Chips</li>
    <li class='fade'>Socks</li>
  </ul>
$("li").hover(
      function () {
        $(this).append($(" ***"));
      },
      function () {
        $(this).find("span:last").remove();
      }
);

jQuery Hover Doc

Spring:Bean definition inheritance

June 8th, 2009 by jeremychone | No Comments »
<bean id="inheritedTestBean" abstract="true"
    class="org.springframework.beans.TestBean">
  <property name="name" value="parent"/>
  <property name="age" value="1"/>
</bean>

<bean id="inheritsWithDifferentClass"
      class="org.springframework.beans.DerivedTestBean"
      parent="inheritedTestBean" init-method="initialize">

  <property name="name" value="override"/>
  <!-- the age property value of 1 will be inherited from  parent -->

</bean>

See Spring Doc: Bean definition inheritance

MySQL: Force Drop Table with Foreign Keys

June 6th, 2009 by jeremychone | No Comments »

If you try to drop a table that has some foreign keys, you will get an exception.

mysql> SET foreign_key_checks = 0;
mysql> drop table ...
mysql> SET foreign_key_checks = 1;

Mobile: Google G2 / HTC-Magic cannot do 3G on ATTW :(

May 30th, 2009 by jeremychone | No Comments »

Basically, it is a 3G band issue. TMobile & AT&T Wireless do not use the same 3G bands (AT&T Wireless does not use use the conventional ones). G2/HTC-Magic was built for TMobile.

The G2/HTC-Magic 3G Network HSDPA 900 / 2100

AT&T Wireless uses 850mhz(the old TDMA band) and 1900mhz for 3G.

Here is a great post about the TMobile/ATTW 3G band issue.

Ho, well, it was too good to be true. Edge is still not that bad, at least for email/calendar and even Map.