Wednesday, December 09, 2009

Google Chrome BETA for Linux is OUT .... Finally !!!

The first thing I did after installing it on my linux desktop was to uninstall Google Chrome in my Windows VM.

I'm not sure why it took so long but if my experience on occasionally using it inside a windows VM is any indication, it's worth the wait.

Coinciding with the release of the Linux and Mac versions of the browser is the opening of the extensions gallery (think Firefox Add-Ons).

 I'm still looking but I haven't found anything like Mozilla Weave or Opera Sync yet.

Here's coverage from some of my favorite sites around the web :

Sunday, December 06, 2009

Karmic Koala, an epic fail ?

This review from AnandTech is probably one of the few reviews I've read that, to put it mildly, isn't all praises for Ubuntu.

I have always thought that it was just me that maybe I was too much of a geek to like Ubuntu but when I installed it for family members and they kept clamoring for me to bring back windows, I knew there was something wrong with the hype.

Of Web Charts and Public DNS

Google Public DNS

I've been using OpenDNS for quite some time now on the recommendation of a friend when I was complaining about slow name resolution on my ISP. That was about a year or 2 ago. Today Google announces it's own free public DNS service. I'm wondering which is better of the two and I may give it a try over the holidays. If you're wondering what this new service means for OpenDNS, you can read up on OpenDNS' CEO's reaction in a blog post.


There's a new kid on the blog with regards to charting on the web. As per the Ajaxian, this new javascript library is called HighCharts. Unlike, OpenFlash Charts and YUI Charts, this library boasts of generating charts from pure Javascript, no flash ! Looking forward to giving this baby a go one of these days.

Friday, June 05, 2009

A Naked T61

My laptop refused to boot early this week. It beeped and printed "Fan Error" on screen. The laptop has been with me for almost two years and after seeing the error it occurred to me that I have never opened it, not even once, and now I have to.

One thing I love about Thinkpads is how well documented they are. I was immediately able to obtain the hardware service manual from Lenovo's website and got to work stripping the bezels, keyboard and palm rest to get to the dirty fan.

For the voyeuristic pleasure of my fellow geeks, I took some pics of my naked T61, after I cleaned it up, of course. Enjoy !!





Saturday, May 30, 2009

ExtJS Tip : Dynamically change a button icon

This works for ExtJS 2 or higher. Oddly, there is no method in the button class that allows you to change the icon dynamically. This is useful if you want to reuse buttons in the toolbar for example.

I found an override from this forum post which worked for me after a few tweaks.

Ext.override(Ext.Button, {
setIcon: function(url){
if (this.rendered){
var btnEl = this.getEl().child(this.buttonSelector);
btnEl.setStyle('background-image', 'url(' +url+')');

Friday, May 29, 2009

An exercise in Metacognition ... computer for sale ads

A Facebook buddy posted this as his status ...

60K PHP for brand-new MB466,2.0 GHz, IntelCore2Duo,160GB DDR3 Memory, 160GB HD, NVIDIA GeForce 9400M graphics, stndrd kbrd, aluminum unibo

What went thru my mind during the first few seconds of reading ....
  1. 60K PHP ? Kinda expensive for a PC
  2. Is this a laptop or desktop ?
  3. MB466 ? must be the model number of something.
  4. 2.0 IntelCore2Duo ? really expensive PC, I could probably assemble an entry level Core i7 with 60K
  5. 160GB DDR3 Memory ? WOW must be a server or workstation.
  6. aluminum unibo ?! Great Scott ! It's a Mac !
What I learned about myself ....
  1. I immediately knew it was an ad for a computer.
  2. I focus too much on the price, so much so that it influences everything else about the ad, maybe that's why I don't have a Mac :-)
  3. I don't know the specs for a Mac when I see one.

Tuesday, May 19, 2009

Reusing Coffee Grounds

A couple of months ago I got myself a coffee press and started trying out different blends from my local Starbucks.

All this time I've been throwing away the coffee grounds when I could have been using them for something else.

According to the Natural Home Magazine article that this Lifehacker blog post points to, used coffee grounds can be used ...

  • as deodorizer for your refrigerator
  • dish washing pad
  • as fertilizer
  • as a facial mask
Uhm, I probably won't try that last one :-)

Tuesday, May 12, 2009

the Star Trek reboot

Firstly, I think it shouldn't be called a prequal. It's probably fashionable to make prequals after the "Star Wars" movies but this is by no means a prequal.

I would rather call it a retelling of sorts.

What if James Kirk grew up without a father ?
What if Spock is more emotional than logical ?

Star Trek : The Next Generation (TNG) was the series that turned me into a "trekkie". Prior to watching that series, I had no idea who Captain Kirk was, let alone Spock. Truth be told, I fell in love with the Star Trek of Capt. Jean Luc Picard in the 24th century because of the tech. I was fascinated by the comm badge, the hypospray, VISORS, dilithium crystal powered cores, holodecks, warp drive engines, force fields and the LCARS console.

Apparently, though, I'm not hard core enough a "trekkie" because I've been trying to get myself to watch reruns of The Original Star Trek series (TOS) but have failed miserably to finish a single episode.

I did not like the original TV series but I definitely liked watching this Star Trek movie. Yup, I liked it, in spite of the flaws in the story telling and the scientific inconsistencies.

Oddly, I liked it not for the same reasons that I liked watching TNG (the tech) , Heroes (super powers) or Fringe (mystery behind William Bell), nope I liked it because ...
  • James Kirk seems more complex and driven. He is motivated to live up to his parallel self in the other timeline.
  • Spock is not stubbornly logical and is giving in to his human side.
  • Bones' colorful rhetoric, specially when he's upset.
  • Chekov, Scotty and Sulu for the comic relief
This was my first time watching a movie on IMAX, btw. I can't say I liked it very much. I thought the screen was too close and too big for me to see all the action.

I DON'T want free laptops from Sony Ericsson

I got 3 forwarded e-mails urging me to forward the e-mail to 8 people for me to get a free Sony Ericsson laptop. As a bonus, if I send it to 20 people, I get a higher spec'd Sony Ericsson laptop.

I hate to break it to you folks but Sony Ericsson makes cellphones. Both the T18 and R320 are retired cellphone models from Sony Ericcson.

A quick google search got me to the following links, all of which says that this is a big hoax !!!
So please stop forwarding these e-mails because no one is getting a free laptop from this. It's not clear what the intent of the perpetrators are but one thing is for sure, you're exposing yourself and your contacts to people you do not know. Internet marketers are the least of your worries, there are spammers, hackers and worst of all identity thieves to contend with, so please think before you click "forward".

Monday, April 13, 2009

What Your Webmail Choice Reveals About You

I have accounts on all the free web mail services. You name it, I have it. It's partly because I work in web development but mostly because I love collecting e-mail addresses even if they get neglected every now and then.

However, my main web mail account is Gmail, it's been Gmail since 2004 and as the McDonald's ad goes," I'm Lovin It".

The Gmail personality description is so me :-) I wonder if they hired a psychologist for this article.

So which webmail service reflects your personality. Find out here.

Google Talk Group Chat on Pidgin

I'm not sure if it's just me but every time I am invited to a group chat on Gtalk I am given a link to log in to the gtalk web interface.

This has been somewhat annoying that Pidgin doesn't support group chats from Gtalk.

Apparently, I've been annoyed for nothing because Pidgin already supports group chats on gtalk.
I'm just not sure why pidgin doesn't automatically recognize that it's a group chat and just bring me into the conference like it does on Yahoo, MSN or the other IM services it supports.

When someone invites you to join a group chat, you get a message with some text that looks like and a link that launches your browser that leads you to a page that launches gtalk gadget. Note that "xxxxx" represents some random string that is most likely used to identify the group chat room.

So here's how to join a Gtalk group chat from Pidgin using the above information :

1. Click Buddies from the menu
2. Then click Join Chat
3. In the account drop down, make sure you use a Gtalk account.
4. For the Room textfield, paste private-chat-xxxxxxx
5. For the Server textfield, paste
6. Click JOIN

Saturday, April 11, 2009

Recursively add folders and files in CVS

One thing I really like about subversion is that an "svn add" on a folder recursively adds the folders and files inside that directory.

It's not the case with CVS, you can always do a "cvs import" but if you really need to use "cvs add", then you may find the following useful:

To recursively add directories inside a folder that is already under CVS :

find . -type d -print | grep -v CVS | xargs -n1 cvs add

To recursively add files inside a folder that is already under CVS :

find . -type f -print | grep -v CVS | xargs -n1 cvs add

ExtJS Tip : Recursively Opening Nodes in a TreePanel

There was one client who requested an improvement that stuck in the Ajax File Storage UI package that I developed.

This client wanted the user interface to open a particular folder based on the url. For example, should return a page that launches the UI and opens the folder with id 100.

This is a perfectly valid request but there were a few challenges, namely ;
  • the treepanel nodes are loaded using ajax
  • the nodes or folders to open could be several levels deep
The solution had a back-end and a front-end component.

The back-end component involved generating a list of folder_id's that led to the target folder_id. If the target folder is 3 levels deep, this folder list would have 3 folder_ids. Luckily this wasn't too hard to do in OpenACS as the heirarchy of folders in the file storage package is easy enough to get from the database.

The front-end solution is a javascript function that goes thru this list and opens each folder based on the id's on that list. Just in case it is useful to someone using the ExtJS treepanel, here's the code for that function.

    asyncExpand : function(x) {
var treepanel = Ext.getCmp('treepanel');
var node = treepanel.getNodeById(this.config.initOpenFolder);
if(!node) {
var x = x+1;
var nextnodeid = this.config.pathToFolder[x];
var nextnode = treepanel.getNodeById(nextnodeid);
nextnode.on("expand",this.asyncExpand.createDelegate(this,[x]), this, {single:true});
} else {

You will notice that it is an example of a recursive function or a function that calls itself. Allow me to break it down for you.

var treepanel = Ext.getCmp('treepanel');

Of course you need a treepanel, the one I use just happens to have the id "treepanel"

var node = treepanel.getNodeById(this.config.initOpenFolder);

this.config.initOpenFolder is the variable that holds the folder_id that the UI should open into by default. The script calls getNodeById in the hopes of getting a reference to that folder on the treepanel

if(!node) {
var x = x+1;
var nextnodeid = this.config.pathToFolder[x];
var nextnode = treepanel.getNodeById(nextnodeid);
nextnode.on("expand",this.asyncExpand.createDelegate(this,[x]), this, {single:true});
} else {

If the node does not exist on the first level of the tree, we presume that it maybe on succeeding levels. This is where we make use of the folder_id list that the back-end should create for you, this list should be a javascript array.

In this case it is this.config.pathTofolder. This part of the function ...
  • gets the next id on the list
  • gets a reference to the node with that id
  • assigns a function to the expand event of the node to call asyncExpand with the index of the next folder_id on the list.

When asyncExpand is called again, it will check to see if a node with a folder_id that matches this.config.initOpenFolder exists. If not, it will get a reference to, assign a listener to the expand event and call the expand function of the node with the given index (x) .

The process repeats until the folder with id equal to this.config.initOpenFolder is found.

Monday, April 06, 2009

Are you technically savvy enough to be a PC ?

Ok, so I can believe that Lauren is "not cool enough to be a mac person" because she's on a budget and there is no doubt in my mind that you can find a better deal with a PC just because there are a lot more PC retailers and manufacturers out there.

However, I am having a hard time believing that this guy Giampaolo is tech savvy. Maybe Lauren is a better actress ? ;-)

Saturday, April 04, 2009

Nograles slams OECD

I just had to react to a breaking news item on about Congressman and Speaker of the Philippine House of Representatives Prospero Nograles slamming the Organisation for Economic Co-operation and Development(OECD) for black listing the Philippines as "a non-cooperative tax haven".

The congressman deserves a round of applause, no, more than applause, a standing ovation for slamming this action of the OECD and further pointing out that it is, in fact, the members of the OECD who are directly or indirectly responsible for the economic crisis the world is experiencing now.

Among its members include the United States, the United Kingdom, Germany, Iceland and Spain all of whom have had financial institutions closed or bailed out of bankruptcy. A full listing of its members can be found here. I just wonder where the OECD was when the financial institutions of its own member nations were making bad choices and imprudent decisions when their economies were booming.

I am no economist but it doesn't take any financial expertise to see how well our local financial institutions have fared compared to the biggest most reknowned institutions abroad. This tells me that, at least in this regard, our government must have done something right.

I really thought crab mentality was a Filipino trait, apparently it's international.

Setting up OpenVPN with dd-wrt for unexpected road trips you don't want to miss

Somehow the words "web worker" and "vacation" don't seem to mix well together.

Web Working on Road Trips

I don't have any solid plans for the holy week but I certainly don't want to miss trips to Tagaytay, Bulacan or the nearby Ocean Park if anybody decides they want to go on a road trip.

Fortunately, finding an internet connection is easier now than ever before. Between Smart Bro, Globe Tatto, commercial and free Wi-Fi services, you're pretty much covered, specially if you won't be wandering too far away from Metro Manila.

You've got your trusty laptop and internet access is not a problem, so what's keeping you from going on that road trip ?

For me, it's secure access to my files and the virtual machines on my home network.

The internet may be more accessible here in the Philippines but it isn't necessarily more secure. In fact the data packets, be it from WiFi, 3G or HSDPA, are transmitted over the air. Anyone, with enough knowhow, the proper hardware and software could possibly capture the data as it is being transmitted.

What's a mobile web worker to do ? The solution, setting up a Virtual Private Network (VPN) .

Is a VPN Overkill ?

I know, it sounds overkill but "VPN" should not connote buying expensive Cisco hardware and VPN software. It's now possible to set up a VPN on your home network with relatively inexpensive hardware like the Linksys WRT54G router (which I happen to own) and free software like dd-wrt.

The first thing to do of course is to acquire a router that supports dd-wrt. This use to be easy as the Linksys WRT54G was the only router that was supported. Today, you have a lot more options from the likes of Buffalo, Asus and Netgear.

I won't discuss how to setup dd-wrt on your router as it's out of the scope of this article. You can find instructions from the dd-wrt wiki and do a search on google to read about how other people have fared in their attempts at installation. Note though that the process is not for the feint of heart. It's gotten easier with each release but there is still a possibility that you will "brick" (the term used to describe a router that has been rendered useless) your router.

dd-wrt has many builds. Make sure to install the vpn build.

What you need for your VPN

In addition to :
  • A supported router, I used a Linksys WRT54G v2.2 router.
  • dd-wrt vpn build, I installed v24-sp1
here are the other prerequisites for setting up the VPN :
  • A desktop or laptop computer with Linux , my desktop is running OpenSUSE v11
  • OpenVPN on the linux desktop, I installed this using the Yast software manager
  • A text editor like Kate or vi
Let me stress that this worked for me using the above hardware and software. If you are using a different router and/or a different version of dd-wrt, you might want to do some more research before attempting this.

You've been warned !!

The computer with OpenVPN is where we generate the certificate files needed to setup the OpenVPN server on dd-wrt. We will not be setting up OpenVPN on this computer.

It is also possible to use windows with the OpenVPN GUI installed instead of a linux desktop but I won't discuss how to do it here.

Step by Step Set Up

Let's get to it.

1. On your linux desktop, open a terminal and become root by using su.
su -
2. Go to /usr/share/openvpn/easy-rsa/2.0
cd /usr/share/openvpn/easy-rsa/2.0
3. Execute the following commands in the correct order
# sets some environment variables to make the succeeding scripts work
source vars

# cleans up any previously created keys if any

# create a certificate
# you will be asked to enter some information
# remember what you entered as you will need to use the same information
# to generate the server key

# create a server key
./build-key-server server

# create the Diffie-Hellman parameters needed by the server
4. The commands above will create a keys folder inside the current folder you are in with the files you need for the next step. Open the files using your chosen text editor.

5. Open a web browser and enter the IP address of your router. If you did not change the default, the IP should be This opens to the web administration interface for dd-wrt

6. Click Services, then under OpenVPN daemon click the "Enable" radio button. This should reveal additional textareas where you need to paste the contents of the files from the keys folder.
Public Server Cert > ca.crt

# note that you only need the portion of ca.crt that starts with
# and ends with
# ----- END CERTIFICATE -----.

Certificate Revoke List (CRL) > (blank)
Public Client Cert > server.crt
Private Client Key > server.key
DH PEM > dh1024.pem
OpenVPN Config > (see 7 below)
OpenVPN TLS Auth > (blank)
7. For the OpenVPN Config textarea, you will need to decide what IP address range you want to use for the private routing network that will be used by OpenVPN. In the sample configuration below, I decided to use as the private routing network. The push parameter should have the IP and subnet of your local area network.
push "route"
dev tun0
proto udp
keepalive 10 120
dh /tmp/openvpn/dh.pem
ca /tmp/openvpn/ca.crt
cert /tmp/openvpn/cert.pem
key /tmp/openvpn/key.pem

8. Once the textareas have been filled up, click "Apply Settings" and just to be sure, click "Reboot Router" to reboot the router.

Hopefully, the OpenVPN server on your router should be up and running. To verify, use ssh to log into your router and run
ps | grep openvpn
You should see an openvpn process running. If you don't, then you'll need to take the following steps to turn on logging and debug the problem.

Troubleshooting with Logs

To turn on logging, click the Services tab and click the "Enable" radio button under System Log. Leave "Remote Server" blank. Then add verb 5 to your OpenVPN config textarea. Click "Apply Settings". Then log into your router via ssh and execute.
tail -f /var/log/message
Connecting Clients

Now that you have your server up and running. The next thing we want to do is to setup a client computer to connect to the OpenVPN server. If you're on windows, you can download the OpenVPN GUI.

For Linux users, you can use the openvpn applet for the NetworkManager which comes installed by default on most Linux distributions.

Before anything else, you need to create the certificates that your client computers (in this case my laptop) will use to connect to the server.

Login to your linux desktop and go back to /usr/share/openvpn/easy-rsa/2.0, then execute
./build-key client1
where client1 is the name of the client computer you want to connect to. You can also leave it as client1 if you like.

The above will generate 3 files in the keys folder, a client1.crt, client1.csr and client1.key. You need to copy client1.crt and client1.key to the client computer that wants to connect to the server. You also need to copy ca.crt from the keys folder to the client computer.

Click on the NetworkManager applet icon on your linux desktop, then click "VPN Connections" -> "Configure VPN".

Click on the VPN tab, then click "Add", choose "OpenVPN" from the connection type drop down.

In the succeeding form, enter the following information :
Connection name : (enter whatever you like here)
Gateway : (for now enter the IP address of your router)
Type: Certificates (TLS)
User Certificate : point this to the location of client1.crt on the client computer
CA Certificate : point this to the ca.crt file
Private Key: point this to client1.key
You should now be able to use the NetworkManger to connect to your router's OpenVPN server.
We have tested so far that the VPN server works but for this to be actually useful, the OpenVPN server should be able to accept connections from the internet.

Dynamic DNS and the Router Firewall

In quickest way to do this is to sign up to a free dyanmic DNS service.

dd-wrt supports several free dynamic dns services here is a comprehensive how to from the dd-wrt wiki.

Once you have DDNS set up, you need to open port 1194 on the router's firewall in order to accept connections from the internet.

Go back to the dd-wrt web interface, click the Administration tab, then click Commands. Enter the following code and click the "Save Firewall" button.
# Replace 1194 with your OpenVPN port number:
iptables -I INPUT 1 -p tcp --dport 1194 -j ACCEPT
iptables -I INPUT 1 -p udp --dport 1194 -j ACCEPT

# change to the private routing network you chose earlier
iptables -I FORWARD 1 --source -j ACCEPT

You may want to click "Reboot Router" to reboot the router and make sure that openvpn is working with the new start up firewall script.

Connecting for real

The next step is to go on a road trip, find free WiFI and connect to the OpenVPN server.

Have a blessed holy week and advanced happy easter to everyone.

References :

Monday, March 30, 2009

I'm not cool enough to be a Mac person

Mike Abundo dissects Microsoft's new ad. I felt it is genuine and real. While price is not everything, I believe that one is more likely to find value for money with so many PC's (choices) on the market.

Just last week, a friend was shopping around at the SM Cyberzone, looking for a laptop. He was totally drooling over a macbook pro but accepts that he can't afford the Mac with the specs he needs. Lo and behold he found and bought a laptop for just P28,000 ($600). That laptop was a centrino core 2 duo with 2 GB of RAM and 160GB of HDD. When he told me, I couldn't believe it either. Note, though, that the price does not include the OS. He needed to shell out an extra P5,000 for Vista, he decided to save the P5,0000 and installed Ubuntu on it instead. ;-)

DISCLAIMER : I'm a PC ... a Linux PC :-)

Tuesday, March 17, 2009

Swappiness, virtualziation and a faster system

I've been know to keep my workstation up and running for at most a week before rebooting.

I find it necessary because I notice a significant slow down in the performance of my workstation after that period of time.

I haven't been able to figure out why until a few weeks ago.

My workstation has 2GB of internal memory and as per the rule of thumb, I have a 4GB swap partition allocated on a 250GB hard disk drive.

I really can't claim to know what's happening in the background but my hunch is that the stuff that the virtual machines and applications I keep open that are initially on internal memory are gradually being moved to the swap partition.

Swap is generally slower because it's on a disk drive.

I found this article from FOSSWire that suggests turning off swap to speed up your system.

Its working well for me so far :-)

Monday, March 02, 2009

5 Inspirational Workspaces

Simon Mackie over at Web Worker Daily lists 5 inspirational workspaces. My personal favorite on that list is the Rambling Renovator's Office Space primarily because of the lime green on the walls.

However, a single laptop will probably not suffice for me. I have found that I need 2 monitors to be productive and I am contemplating on getting a bigger 3rd one to get Aptana IDE to fit.

I would probably throw in a few elements of Stefan Didak's Home Office into it and it would be perfect :-)

Thursday, February 26, 2009

Google's Native Client Security Contest and Is this Google's verison of the Java browser plugin ?

So I was skimming thru my reading list today when I came across this blog post from the Google Code Update blog. It looks like Google is running a contest to find bugs, exploits and vulnerabilities on the Native Client.

The first thing I asked myself was, what's the Native Client ?

The google code page for the native client project looked straightforward but the possibilities of something like this is astounding.

Running Quake on your browser ? Are you kidding ? Get Outta here !!!

If you can run Quake on your browser, imagine being able to run other MMORPG's (World of Warcraft anyone ?) on the browser !

Monday, February 23, 2009

If I were going to build a new PC

Someone asked me, if I were going to build a high-end PC today, what parts would go into it and how much would it cost.

The first thing I asked was, what's it for ? He says it's going to be a windows box for graphics and multimedia with a little gaming on the side.

Here's my answer ....

14,000 : Core i7 920
16,500 : Msi Eclipse X58 SLI 1366
29,000 : Corsair 6gb (TR3X6G1333C9) XMS3 X 2 = 12GB
3.750 : Palit ATI HD 3850 Super 512mb (256bit) ddr3
13,000 : 1tb Caviar Black (WD1001FALS) 32mb dual processor X 2 = 2TB
7,800 : Cooler Master (RC-932) HAF 932 atx w/o psu black
7.000 : Cooler Master UCP 700W Ultimate 80PLUS Silver Certified
18,000 : 2693hm SAMSUNG 26"

Prices are from

So what do you think ? A little overkill for graphics and multimedia or should I have gone dual SLI or even a 4870 X2 graphics card ?

Facebook HowTo : Protect Your Privacy on Facebook

I found this rather informative video from CnetTV on how to protect your privacy on Facebook using the groups list feature. I've been spending so much time on Facebook accumulating friends that I think I'm going to need to do this soon :-)

Monday, February 16, 2009

An ingenious solution for handling Javascript popups in Watir

So I've been struggling to figure out how to elegantly and properly handle popups on Watir. I've read and tried all five solutions listed on but still couldn't find one that works well for the version of Ruby/Watir I am using.

I'm using Ruby 1.8.6 and Watir 1.6.2, BTW.

Then I came across a blog post that proposes to override the javascript alert and confirm functions. Read the whole thread from google groups here.

I was stoked !!! Even more so that it worked beautifully.

What I did was to encapsulate it into a def which accepts the IE instance created by watir.

def replace_js_popups(ie)
ie.document.parentWindow.execScript("window.confirm=function(){return true}");
ie.document.parentWindow.execScript("window.alert=function(){return true}");

Now, right after going to a page, I would call on "replace_js_popups" to override both confirm and alert, like so.

ie =

Of course, this is not a fool proof solution. By replacing the alert and confirm functions with a function that always returns true, you will need to always expect the popups to return a value of true in your automated tests.

Sunday, February 08, 2009

ExtJS Tip : Sortable Grid Rows via Drag and Drop

One particular challenge on a recent project is to have the ability to sort grid rows using drag and drop. With lots of help from the ExtJS forums, here's how I ended up doing it.

The code snippet below shows an Ext gridpanel with the added ability to allow users to sort rows using drag and drop. This is acheived by (1) setting the enableDragDrop configuration to true to allow dragging and dropping of rows and (2) creating a drop target that handles the drop event when a row is dropped.

Update 031609 : An anonymous comment mentioned having problems with sorting multiple rows. This tip only works with single select rows. I have added the code change below that forces the grid to use a single select row selection model.

var grid = new Ext.grid.GridPanel({
id: 'mygrid',
title: 'My Grid',
store: store, // define the data store in a separate variable
loadMask: true,
enableDragDrop: true, // enable drag and drop of grid rows
viewConfig: {
emptyText: 'No pages found',
sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
forceFit: true
}, columns: gridcolumns, // define grid columns in a separate variable
listeners: {
"render": {
scope: this,
fn: function(grid) {

// Enable sorting Rows via Drag & Drop
// this drop target listens for a row drop
// and handles rearranging the rows

var ddrow = new Ext.dd.DropTarget(grid.container, {
ddGroup : 'mygridDD',
notifyDrop : function(dd, e, data){

var ds =;

// NOTE:
// you may need to make an ajax call here
// to send the new order
// and then reload the store

// alternatively, you can handle the changes
// in the order of the row as demonstrated below

// ***************************************

var sm = grid.getSelectionModel();
var rows = sm.getSelections();
if(dd.getDragData(e)) {
var cindex=dd.getDragData(e).rowIndex;
if(typeof(cindex) != "undefined") {
for(i = 0; i < rows.length; i++) {


// ************************************

// load the grid store
// after the grid has been rendered


Sunday, February 01, 2009

How to live your life

I subscribe to Salve Duplito's blog over at Blogs for the personal finance articles.

Today, I got a special treat because today's blog post was definitely more than personal finance, it was about living.

Prof. Randy Pausch passed away last year of pancreatic cancer but not before speaking to about an audience of 400 at Carnegie Mellon University for the "Last Lecture" series. While watching the video I am always reminded that the speaker was going to die and that made it all the more powerful, I almost shed a tear too when he mentioned for whom his lecture was really for at the end.

Sad and inspiring at the same time.

Thursday, January 29, 2009

Jing for screencasts

So if a picture (of your desktop) is worth a thousand words, what's a screencast worth ?

I'll tell you what it's worth ... to a web developer struggling to communicate with a quality assurance engineer, it's ten or so e-mails, a hundred lines of instant messages and a couple of VOIP sessions.

Enter the Jing Project.

Jing is a free desktop application that allows you to create a screen shot or video of your desktop or a portion of your desktop. Dave was the one who recommended it a couple of years back and it's really been helpful as a tool to communicate with QA and even with clients.

So what do I like about Jing ....
  • It's relatively easy and straightforward to use. No complex settings and options.
  • You can capture your entire desktop or just a portion of your desktop
  • The option to easily upload to or to an FTP server
  • Captures sound as well so you can narrate and talk while creating your screencast
My only qualm about Jing is that there is no Linux version but I believe it's in the pipeline. Download Jing from

Wednesday, January 28, 2009

Git Tip : svn cleanup for git

With subversion, I execute "svn cleanup" on a working copy to make sure that my working copy is clean.

On git, the command seems to be :

git checkout -f master

Tuesday, January 27, 2009

Beginning adventures with Xen

I've been a fan of virtualiztion since VMware gave away VMware Server for free. I've upgraded the host OS on my desktop twice and I have been able to remain productive as all my work resides on a separate disk and in virtual machines.

However, since VMware Server 2.0 was released, I've been actively looking for alternatives. Coincidentally, our hosting provider will be implementing Xen soon for LAMP deployments and I thought this to be the perfect excuse to at least install and try it out.

Well, so far I'm stuck because I can't boot to X windows on the Xen Kernel because I'm using nvidia drivers. I'm sure there is a solution already somewhere but I'm going to stop for now and leave it as something to look forward to solving over the coming weekend ;-)

Build your own distro with Suse Studio

Countless are the times when I had wished that there was a linux distribution with exactly the stuff I need and none of the bloat. With the Alpha release of Suse Studio, that wish is about to be fulfilled.

Suse Studio allows you to customize OpenSUSE with just the software you need thru an easy to use web interface. The end result can be an ISO, Disk, VMware or Xen image.


Monday, January 12, 2009

ExtJS Tip : Select the first row when grid is loaded

Let's say that you have a grid called "mygrid" and you would like the first row of that grid to be selected when the grid data is loaded. The following snippet of code should work ...

Ext.getCmp('mygrid').store.on('load', function(){
var grid = Ext.getCmp('mygrid');
grid.fireEvent('rowclick', grid, 0)
}, this, {
single: true

More Watir ....

A few blog posts ago I narrated how I installed Ruby and Watir on Windows and posted my first test script.

Getting started is usually the hardest part of the learning experience. The reason being that you don't know where or how to get started. Luckily there is a plethora of resources and lots of good samaritans on the web sharing their experiences and solutions on forums and on their personal blogs.

Today I'm going to enumerate the resources I found on the web in the order that helped me get started with Watir.
For an overview of what Watir is and possibly how and why you need Watir
Before Watir, you must install Ruby.
This tutorial has everything you need to know on how to install Watir and its prerequisites. It also contains everything you need to know to get the basics down and start writing simple test scripts.

Pretty soon you'll need to learn more advanced stuff like objects and classes. The online book is a great resource for this.
At some point you may want to organize your test scripts. One framework I found that works is Rasta.
Some people may not like the restrictions imposed by Rasta and would like to setup their own framework with MS Excel. Ruby is perfectly capable of manipulating Excel. VB for application developers will feel at home with Ruby.

Wednesday, January 07, 2009

Pageant with your SSH Private Key added on Windows Startup

On Linux, I use Keychain to cache my private SSH key and passphrase so that I don't need to keep entering it when I access remote servers. On windows, the only real tool for that is Pageant which comes with Putty.

A problem that I've been having for a while now is that I find myself having to start up pageant and adding my keys everytime I log in to windows.

I found this solution on the net but unfortunately I don't have the resource bookmarked so who ever reads this and knows the original author, I would love to know and post a link to the site.

The solution was to create a shortcut to Pageant in your Startup folder and to modify the "Target Property" and feed putty the key you want to add when it loads up.

So here are the steps :
  1. Click Start, then click All Programs
  2. Right click on the PuttY menu item and then choose Explore from the context menu
  3. This will open a window with the contents of the PuttY menu
  4. Once again, do a right click but this time in the Startup menu item after clicking All Programs, then choose Explore
  5. Copy the Pageant shortcut from the first window that appeared to the window with the Startup folder
  6. Right click on the shortcut in the Startup folder and change the Target field to look like
    "C:\Program Files\PuTTY\pageant.exe" "C:\My Documents\private.ppk"
  7. The first part of the above line with pageant.exe should already be in the target field, what you need to do is add the location of the private key you generated using PuttyGen.
So now, every time you login to windows, Pageant will automatically startup and add your key. It will also challenge you to enter the pass phrase on log in.