Saturday, December 25, 2010

Free to distribute fonts from Google

Web fonts can be boring. There are much nicer fonts on your desktop operating system or application. But these fonts are not free and can be very costly to distribute. Fortunately, there are nice looking free fonts for free distribution, provided by Google:

http://code.google.com/webfonts

Saturday, October 30, 2010

Writing Testable Code

Check out Misko Hevery, the clean code talk guy's guide to writing testable code:

http://misko.hevery.com/code-reviewers-guide/

The page itself is a 5-minute read but download PDF for a more detailed explanation of the rationale for these guidelines, which are sort of a common realization among folks who have gone through the trials and tribulations of extensive unit testing.

There's also quite a bit of other interesting stuff on his blog, including: augular, a RAD platform for developing CRUD apps on the web with only HTML (no server-side, no SQL); and CoffeeScript, a terser way of writing JavaScript.

Saturday, June 19, 2010

Data recovery tutorial using Ubuntu Linux

I have an old hard disk with corrupt NTFS volumes and I want to recover the data. I'm not sure how the drives got corrupt but they cannot be fixed by chkdsk /f. Fortunately, there's a plethora of open source data recovery tools available. Two such tools are foremost and photorec which specialize in combing through hard drive partitions to recover files based on header information. They can even recover files after accidental reformatting.

Foremost is a tool originally developed by the U.S. Air Force and is available via sudo apt-get install foremost. It can recover common file types such as txt, jpg, avi, and etc.. Foremost was last updated in 2008 which means that its knowledge of file headers is, at best, two years dated.

Photorec is part of the testdisk suite and is available via sudo apt-get install testdisk. Testdisk is a tool that not only "tests your disk" but also rebuilds your partition table. This is the tool to use if your hard drive's master boot record or partition table is corrupt. Photorec, like testdisk, is a poorly named command-line tool. Like foremost, photorec recovers files (not just photos) based on file headers. In fact, photorec supports more file types and is more up-to-date than foremost, which is evident by the fact that I was able to recover more files with photorec than foremost.

The problem with both foremost and photorec is that they recover file content but not file names. So you end up with directories of randomly named files with only the file extension preserved. It's not ideal but it's still better than not having the data at all.

See also:
http://help.ubuntu.com/community/DataRecovery

Saturday, June 5, 2010

Towards a Universal VM

Alex Buckley talks the features and progress that should make the JVM the universal run-time environment for languages. Interesting discussion in the talk include:
  • the distinction between the roles of the byte-code compiler and JVM compiler.
  • a high-level overview of how the JVM does method inline optimizations.
  • the introduction of dynamicinvoke in the new JVM.
The talk is normally 1-2 steps lower level than what software developers deal with on a day-to-day basis but nevertheless very understandable and useful to know.

Sunday, February 28, 2010

Ubuntu Linux on a Syntax Olevia LT30HV

The Syntax Olevia LT30HV, like many off-brand low cost LCD HDTV, does not provide accurate EDID information which prevented me from running the LCD at the native resolution 1280x768. After extensive Googling, I finally found the necessary configuration to put in my /etc/X11/xorg.conf.

1. First, make sure you have the proper Modeline in your Monitor Section:
Section "Monitor"
        Identifier      "Default Monitor"
        HorizSync      31.5 - 80.0
        VertRefresh    56.0 - 75.0
        DisplaySize    722 406
        Modeline "1280x768" 79.464 1280 1360 1488 1664 768 771 778 798  -Hsync +Vsync
EndSection

 2. Make sure your Screen include the Option UseEDID and ExactModeTimingsDVI like so:
Section "Screen"
        Identifier      "Default Screen"
        DefaultDepth    24
        Monitor         "Default Monitor"
        Option         "UseEDID"        "false"
        Option         "ExactModeTimingsDVI"    "true"

        SubSection     "Display"
                Depth      24
                Modes      "1280x768"
        EndSubSection
EndSection
3. And of course, make sure you use the nvidia driver: 
Section "Device"
        Identifier      "Default Device"
        Driver  "nvidia"
        Option  "NoLogo"        "True"
EndSection
That's it.

Sunday, January 17, 2010

New features in Spring MVC 3.0

This webcast gives an overview the new features in Spring MVC 3.0. The data binding and validation has been improved dramatically. This talk is useful if you are using version 2.5 and also want a sense of good practices to follow.