Archive for June, 2009

Freemarker: XML Xpath Expression

Tuesday, June 30th, 2009
[#list doc["book/chapter[title='Ch1']/para"] as p]

See XPath Freemarker doc for more info.

jQuery: Add an Element to an existing jQuery Object

Monday, June 29th, 2009
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

Monday, June 29th, 2009
  1. Go to¬†Window –> Preferences –> Aptana –> My Aptana/Message Center
  2. Check “Never display after startup”

Or in some version go to: Preferences > Aptana > Startup Page (and check the “Never …”

jQuery: Ajax Load HTML fragment

Wednesday, June 17th, 2009
 $("#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

Wednesday, June 17th, 2009
$('<div/>').text('This is fun & stuff').html();


jQuery: Hover over out

Wednesday, June 17th, 2009
    <li class='fade'>Chips</li>
    <li class='fade'>Socks</li>
      function () {
        $(this).append($(" ***"));
      function () {

jQuery Hover Doc

Spring:Bean definition inheritance

Monday, June 8th, 2009
<bean id="inheritedTestBean" abstract="true"
  <property name="name" value="parent"/>
  <property name="age" value="1"/>

<bean id="inheritsWithDifferentClass"
      parent="inheritedTestBean" init-method="initialize">

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


See Spring Doc: Bean definition inheritance

MySQL: Force Drop Table with Foreign Keys

Saturday, June 6th, 2009

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;