VIm alternative to the ESC key

August 5, 2009

It can be a pain reaching up to the ESC key everytime to exit insert mode in VIm. An alternative that’s built-in by default is Ctrl+[


Paste into VIm without screwing up formatting

August 5, 2009

Often pasting text into vim from an external source screws up the formatting (especially tabs). To prevent this, do:
:set paste

Keeping this setting on screws up auto indentation while in insert mode, though. So to turn off, use
:set nopaste

Piping command outputs into script arguments

August 5, 2009

command | ./myscript does not work as expected.
Use ./myscript $(command) instead

Wow, Abiword, just, wow…. (aka Abiword Sucks)

July 13, 2009

Forgive me for not being constructive and not submitting bugs to the devs and that sort of thing (I may later on…), but for now, I just have to let off some steam… and from the experience I’ve got using this application, I believe I have every right to!

So I was looking for Wordpad’s equivalent in Linux-world, and according to a post in the Ubuntu forums Abiword was it. So I apt-get install it, and try it out… (running Ubuntu 8.10)

1) I copy some text into the page… then I realize the font size is too big, so I Ctrl+A and highlight the “font size” box and replace the “12” with “10”… voila! the TEXT I selected gets replaced with “10” instead of the number in the “font size” field. Genius! So I guess I will just have to use the arrows to change font sizes…

2) Then I wanted to change the font. I look at the “font” bar, and there’s no way to type in it! I can’t even enter an ‘M’ to get to the fonts that start with ‘M’… I have to SCROLL through the 100 or so fonts on my system to find the one I want. This is not a bug per se, but c’mon!

3) Then I needed to paste in more text. I do so, then to look at the bottommost text I use my mousewheel to scroll all the way down. Good, its there. But… when I scroll back up, Abiword keeps slowly scrolling the screen down! I tried using my keyboard arrows and a bunch of other things to try to make it behave but it just wouldn’t quit. At this point I had no choice but to close the whole abomination.

Looks like I will just stick to the heavier OpenOffice for now. I am just in complete shock and awe that this software is in the Ubuntu repos and is classified as a “finished product”. It would be poor even if it was in beta. Lesson of the day: Beware of Abiword!

Why on earth doesn’t MS Word have zoom in or zoom out options?

December 13, 2008

Time for a rant.

I can’t be the only person on earth annoyed about how MS Word doesn’t have the options to (let alone have any keyboard shortcuts for) zooming in/out by a certain increment. If you use Adobe Reader/Photoshop you will know what I’m talking about. Open up a PDF -> “oh, looks kinda small”, you think -> “Ctrl+=” -> Done!

But on MS Word 2007, to do the same you have to move your mouse all the way to a tiny slider at the bottom right of the screen to zoom in/out, and there’s no keyboard shortcuts to do this! I tried customizing my keyboard shortcuts to do this, but, alas, there was no command to zoom in/out. There were only commands like “Zoom100”, “ViewZoomPageWidth”.

Granted, you probably won’t have to zoom in/out in MS Word as often as in Adobe Reader, but I’ve still found it annoying enough to write a blog post about it. What do you think?

EDIT: Found just what I needed: Still sad that there’s no default for this in Word though.

How to Change the My Music folder on right hand side of Vista or XP start menu to any other folder

December 7, 2008

OK, I haven’t been posted in a LONG time, and I’m back to share something which I think more people should know about. I’ve been trying to customize my Vista installation to work for me whenever I have the time to do so ever since I decided to use it as my main OS. Truly, Windows would benefit from being more customizable, and one of the main things people want to change is the shortcuts on the right hand side of the start menu. While there’s no option within the OS to do this, it can be accomplished through modifying the registry.

Some very nice people at WinVistaClub have written a VBScript which modifies the “My Music” folder shortcut in the start menu to another folder of your choosing. It even updates the icon shown at the top of the start menu when you mouse over! Here’s the link and instructions. I’ve also attached that script here just in case that link goes down (That’s actually a .vbs file. WordPress won’t let me upload that filetype, so make you choose “save link as…” and change its extension to .vbs before executing it).

Hope this helps someone!

Hide Root Node of XML Bound TreeView (ASP.NET)

June 28, 2008



Please visit instead

You have a treeview with an XML file as a data source, but XML files by default must have a single root element, which shows up on your treeview. A lot of us don’t want it to show up, and there’s no obvious way to hide it. After an hour or so of searching for a solution, I found it here. This solution really needs to be more visible on the web!

Basically you just need to set the XMLDataSource XPath property as XPath = “/*/*”. I’m not entirely sure what this means, but you can read up more about it here.

Your Domain Name in XAMPP

May 4, 2008

This probably applies to many other things while working with XAMPP or any webserver on your machine, but I specifically used it when using AJAX. Just determine your LAN/local/internal ip address and use that ip address as your domain name. For example, if this is what you had on another webserver,

var myDomain = ""; //where your proxy file is placed
var proxy_name = "phpProxy.php";  //proxy's filename
var actualReq = "" //actual request
var url = "http://"+myDomain+proxy_name+"/?"+actualReq;

and your local ip for example is, replace


Also, when you call the file from your browser, instead of using “http://localhost/….”, use “….” instead.

Happy XAMPPing!

PHP Proxy for Cross-Domain Requests That Works!

May 3, 2008

So I’ve been working on some AJAX stuff, dealing with Yahoo! Weather, specifically, and I realized I needed some way to make cross domain xmlhttprequests. Using a PHP Proxy seemed for me to be the easiest way to go, so I first tried what was suggested by Yahoo! I then tried some similar methods from others here and here, both to no avail. I then did some asking around on forums and made the necessary changes to make Yahoo’s example work. Just thought I’d share that with those of you who have similar troubles.

This is the PHP Proxy that I used. Note that:

  1. Your webserver’s PHP needs to support cURL
  2. This code doesn’t support POST requests, only GET.
// PHP Proxy example for Yahoo! Web services.
// Responds to both HTTP GET and POST requests
// Author: Jason Levitt
// December 7th, 2005
//(Modified by Suan-Aik Yeo)
$url = $path;
// Open the Curl session
$session = curl_init($url);
// Don't return HTTP headers. Do return the contents of the call
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
// Make the call
$xml = curl_exec($session);
// The web service returns XML. Set the Content-Type appropriately
header("Content-Type: text/xml");
echo $xml;

When you’re using javascript to actually make the request, do something like this:

var proxy_name = "phpProxy.php";  //proxy's filename
var actualReq = ""; //actual request
var myDomain = ""; //where your proxy file is placed
var url = "http://"+myDomain+proxy_name+"/?"+actualReq;

//go on to do the usual httprequest steps...

Hope this helps!

Penang Malaysian Restaurant, Chinatown Chicago

April 6, 2008

Yesterday a few of us went up to Chicago just for fun, and for Malaysians, no trip to Chicago is complete without dinner or lunch at the PENANG Malaysian restaurant at the entrance of Chinatown. We ordered Nyonya Tofu, Assam fish (which we didn’t know cost > $20), kangkung belacan, and beef rendang, along with chicken rice rice 😉 Anyways, the food was pretty good, and I already kinda knew what to expect as it was probably my 3rd or 4th time there. Praveen, Winnie’s classmate who also drove us there, also ordered some stuff to go for his roommates.

When the bill came though, it was about $140 with about $20 gratuity on top of that. Why were we charged gratuity? There were only 4 of us! And we also shouldn’t be charged tips for to-go food…..So Praveen went up to the guy who handed us the bill, and eventually was sent to a lady manager. She then said to another waitress, “他们本来有六个人, 过后四个就走到后面的桌子去了。” (“they had 6 people at first, and later on 2 of them went to the table behind them”). Then, to her astonishment, Praveen replied in Chinese that that wasn’t the case (he’s singaporean, btw). They were pretty much forced to take away the gratuity at that point, and we ended up giving them barely more than 10% tips for our troubles.

Granted, there was a table of other people we knew sitting behind us, but only one of them came and sat with us (she didn’t order anything) and none of us went over to their table. And, the restaurant was pretty packed that night. Still, what annoyed me was how they came up with the “theory” that there were 6 of us and that 2 left….why not 5 to 2 instead? Makes me wonder if they always take advantage of such situations to charge gratuity. I also wonder if they try to charge gratuity for to-gos all the time. If anything, it DOES sound alot like a Malaysian “get what you can out of the customer” business attitude. They also could’ve been more apologetic.

Bottom line is, just remember to check through your receipt the next time you’re there.