Category / Development

Sandblast August 4, 2011 at 1:24 pm

I built an earth-toned color theme called SandBlast for Eclipse. It requires the Eclipse Color Theme plugin.

Emacs: File Size Threshold May 1, 2011 at 8:34 pm

I use Emacs to open up WAR files often. Since these files are often large, Emacs usually pops up a confirmation dialog which was cramping my style. Turns out Emacs maintains a threshold of file size for this. The default value is about 10 MB. The variable “large-file-warning-threshold” is customizable. Note that you shouldn’t set the file size threshold to be larger than buffer size.

I set mine to 100 MB.

;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(blink-cursor-mode nil)
'(inhibit-startup-screen t)
'(large-file-warning-threshold 100000000)
'(tool-bar-mode nil))

Emacs: Writable Directories August 22, 2009 at 11:53 pm

I recently discovered this nifty mode called “wdired” (writable dired). It gives “dired”, the simple directory management tool within Emacs, some editing functionalities.

In short you can “edit” contents in a directory. With it, you “edit” a directory like a file buffer. So instead of making changes one file at a time, this mode lets you leverage Emacs editing commands and batch up your changes in a buffer and then apply all of them when at one shot when you “save” the buffer.

This saves me a couple of minutes when I had to do some mass file manipulation last week. I was able to use query-string to selectively move large number of files and fix broken symbolic links.


NXML-Mode December 30, 2008 at 12:52 pm

One of the things I love about Emacs is its extensibility. It has all sorts of different edit modes for different file types. For example, SGML mode comes standard for editing XML & HTML. It’s a step up from normal text edit mode, it renders tags in color fonts. But it’s pretty plain vanilla editing– no syntax validation nor smart tag completion.

I started to use nxml-mode earlier this week and am liking it. Here’re some of the nice features:

  • Smarter rendering of tags
  • Real-time syntax checking
  • Tag completion
  • Support of folding
  • Link handling

You can download nxml-mode here. The latest file as of this writing is “nxml-mode-20041004.tar.gz”. Unzip the package into the standard emacs “site-lisp” directory (it’s /usr/share/emacs/site-lisp on my macbook).

Configure it to auto-load and bind to various file extension via the following configuration in your .emacs file:

(load “rng-auto.el”)
(add-to-list ‘auto-mode-alist
              (cons (concat “\\.” (regexp-opt ‘(“xml” “xsd” “sch” “rng” “xslt” “svg” “rss”) t) “\\'”)
(setq magic-mode-alist
      (cons ‘(“<???xml ” . nxml-mode)
(fset ‘xml-mode ‘nxml-mode)
(fset ‘html-mode ‘nxml-mode)

Multiple Emacs Shells July 22, 2008 at 8:41 am

Sometimes instead of running several sessions of SSH’s or putty’s, I run Emacs with multiple shells– this cuts down on the number of windows I have to deal with.

To run a shell in Emacs, you invoke the Lisp function “shell” via meta-x shell. This creates a buffer called *shell*. Running it the second time though doesn’t create a 2nd shell buffer as you might expect, instead it brings you back to the original shell buffer. The trick is to rename the original buffer to avoid name collision. The quickest way to do this is via “rename-uniquely" function via meta-x rename-uniquely. It renames the buffer to a similar but unique name like "*shell*<2>“. Now if you start another shell.

The better behavior is for Emacs to automatically create new buffer with unique name. Perhaps there’s a hook to configure this that somebody can point me to.

Ganymede Launch June 24, 2008 at 10:10 pm

Last week was the big launch of Firefox. This week, Eclipse Ganymede will be launched tomorrow.

Eclipse is a popular open source IDE. Each year, the Eclipse Foundation ships annual releases, so far around the summer. It’s a release vehicle where all major Eclipse projects release & synchronize their code. The Ganymede (all releases are named after Jupiter’s moons) release this year represents a simultaneous release of 24 eclipse projects– an incredible scheduling feat if you ask me.

I’ve been using several release candidates and so far so good. For an overview of the new features, check out this article. Coolest feature is probably muti-core CPU support.

So, go get the bits here.

A Week of Conferences April 25, 2008 at 7:24 am

This week has been full of conferences for me. First I attended Interwoven’s GearUp. It was fun in part that I got to hang out with my friend Bill (an Interwoven employee) for a few days. I haven’t seen much of Bill last few years. The keynotes were usually boring, but the highlight was Guy Kawasaki’s presentation: most lively and entertaining keynote I’ve ever attended. Big take-away from Guy: “it’s okay to ship crap!” 🙂

I also went to the Web 2.0’s Expo. It was bigger than I had imagine. Everything and everybody is working on something labeled web 2.0 I guess. There were booths from a lot of small companies I never heard of. Social networking and cloud computing seems to the major themes. I’m surprised that I didn’t see Facebook there. Yahoo’s booth was tiny at the corner.

The coolest demo was TellMe’s mobile app on Blackberry. You speak to it and it displays search results on the Blackberry. It’s basically search on voice recognition. Very useful…

Mozilla: 1998-2008 March 31, 2008 at 11:25 pm

Today marks the 10th anniversary of the launch of Mozilla project. I still was with Netscape that faithful day: March 31, 1998. I still remember the big engineering gathering announcing the move. Open source by a commercial software company was pretty much unheard of at the time. The decision to open source the browser code was both controversial. It was a difficult time for Netscape– Microsoft IE was cannibalizing Navigator’s market share and there was no light at the end of the tunnel. By some account, once mighty Navigator’s market share had perilously fallen to 20% at that time– an astounding decline no matter how one looked at it.

Giving away many man-years of commercial code seemed illogical even to me at that time. But an essay by Eric Raymond called “The Cathedral and the Bazaar” became very instrumental in the push toward open source. Raymond’s main point was that “given enough eyeballs, all bugs are shallow.” I remember, the client team had to spend months cleaning up the code. In particular, there were a lot of comments that the public might deem inappropriate. Many people expected the open source community will immediate embrace the code and push it to success. The reality was different. The move was a little too late in saving the company which got bought by AOL later that fall. The move was to salvage the browser. But when the open source community did not become an immediate driving force, some key folks like Jamie Zawinski began to leave the project. Underscoring complexity of the project, it took another 4 years before Mozilla 1.0 saw the light of day.

Ten years later, IE still dominates 80% of the browser market. Given Mozilla’s current market share at 17-18%, Mozilla barely recovers the market share lost it its lifetime. It speaks volume to Microsoft dominance and proves the difficulty of turning the tide. It took some time, Mozilla is emerging as a powerful, innovative and influential project. It relentlessly puts out version of Firefox with one innotive feature after another; by contrast IE has become stagnant. I for one can’t wait to see what the next 10 years Mozilla will bring to the users.

Alfred November 14, 2007 at 8:17 am

Every quarter, Yahoo! holds a hack day when engineers are given 24 hours to dream up an idea and build it out– it’s a way to promote innovation in the developer ranks. I’ve seen some very innovative stuffs in the past. So this past hack day, I worked with two of my co-workers David & Ahmed to build a chat or IM “robot”. Very geeky but also very cool…

A chat or IM bot is basically a piece of software that acts like a real chat buddy: you send it a message and it replies with a response to you. We called our bot Alfred, Batman’s confidante and assistant. The idea is that this is an all-knowing chat buddy. You send it a question like “How do I make a grilled cheese sandwich?” and it will return to you an answer by searching Yahoo! Answers database. In this case, the bot will send back a chat message with instructions on making the sandwich! You send it a command like “tell me about 2008 Olympics” and it will return you the popular links users have bookmarked about the 2008 Olympics.

I had a lot of fun hacking Alfred, probably the most satisfying piece of code I’ve written at Yahoo! Check out Sarah Bacon’s coverage of our hacks at the official Yahoo! Messenger blog, including a screen shot.

Explaining REST May 16, 2007 at 4:47 pm

Ryan Tomayko wrote this blog entry called “How I explained REST to my wife.” Cool…

I wonder how it would pan out if I try to engage my wife with this type of topic in this manner… I can guess the outcome already… 🙂

Yahoo! Pets May 10, 2007 at 11:21 am

Today, Yahoo! launches a completely redesign of In terms of content, it’s a relatively small site comparing to or, but still it isn’t a small task launching a site that scales to a thousand hits per second.

This is the first project where I’m part of from conception to launch, so I feel more involved. I was responsible for rolling out the launch, so last few weeks have been particularly frenzy. We were all feverishly testing last night but managed to roll out the site with an hour or two to spare. Woohoo…

Now, I can start having dinner with the wife & kids again. 😮

Emacs: Enabling Colors in Shell Mode February 7, 2007 at 1:40 pm

I customize my Bash shell with colorful prompts. But while, in a normal xterm, my prompt is displayed nicely, it looks like crap within Emacs. All the escaped color attributes get displayed as garbage characters. I finally got off my lazy butt and spent sometime looking into fixing it.

It turns out to be pretty straightforward, basically the way I fix it is to turn on ANSI colors in the shell. I add the following to my .emacs file to turn it on as part of a hook to the shell mode.

; enable ANSI color in shell mode
(add-hook ‘shell-mode-hook ‘ansi-color-for-comint-mode-on)

Yummy! November 2, 2006 at 2:34 pm

It’s only my 4th day as a new employee @ Yahoo and our team already launched a major site today: Yahoo! Food! What’d they do w/out me… 😉

It’s a very cool site, everything food-related: recipes from the likes of Martha Stewart’s prison, I mean kitchen, local restaurant reviews, articles & how-to videos. Just in time for your demanding family, this coming holiday season.

Are Software Patents Evil April 26, 2006 at 10:44 pm

Here’s Paul Graham’s thought-provoking essay discussing software patents.

Web 2.0 = Sliced Bread? January 26, 2006 at 9:08 pm

Given the increasing super-hype about Web 2.0, there’s lot of “noise” going on around the web. The way people are hyping it, you’d think it’s the best thing since sliced bread. Proponents like to use the term to describe the 2nd generation of web development. Is it just smoke of is it something of a new beckoning?

Many people credit Google Maps as one of the 1st Web 2.0 tool. As somebody who’s familiar with web development, it blew me away. It made mapping more interactive than other traditional mapping sites. Recently, I ran across Meebo. It’s basically a web-based instant messenger and another fine example of what AJAX can accomplish. Meebo feels like an application, not a traditional web site. You have collapsible and draggable window frames. It’s interactive & is an exemplary of a Web 2.0 application.

Like most developers, I was so ingrained with a static web, so it’s refreshing to see such thing possible. Interativity has always been the Archille’s heel of web development in term of usability. But for most users, it has all been promised before. DHTML, Flash & Shockwave to name a few. So why should this be any different? First and foremost, while these technologies are popular, they never made it down to the platform level and therefore never ubiquitous. What makes Web 2.0 promising is AJAX. This approach uses plain Javascript, HTML & XML which are supported cross browsers and operating systems. It’s encouraging to see the possiblity of the web as a platform to deliver application. It’s what Netscape promised over 10 years ago but never delivered.

My feeling is that all this is just evolutionary rather than revolutionary that some proponents trying to lead you to believe. The short of it is that Web 2.0 doesn’t represent new technology or breakthrough. Web developers are just getting better at what they’re doing, learning to apply existing technologies in more effective ways. No Intelligent Design here, we developers can evolve too! 😮