Friday, November 28, 2008

OSX still less mature then BSD, Linux, Windows

There's something to be said about Windows being the most used OS on the planet even if it is not the best OS out there. While Unix and it's variants (BSD, Linux, etc.) are the most developer friendly OS, the sheer number of users for Windows mean that there are a lot of developer that write applications for it. This include programmer's editors which is a class of software that I've always been interested in.

When I started to use OSX, one of the first things I looked for is a good editor. On Windows, the sheer number of choices (and there are many good ones) can be overwhelming. The competition on the Windows world is fierce which has helped to weed out the weak. What I found on OSX was that the most mature editors were the result of Apple using the BSD kernel and thus able run Unix editors such as EMACS or VIM and when it came to advanced IDEs, they were ports from other platforms such as Eclipse.

There are some native-OSX editors such as TextMate (commercial), Smultron (open source) and BBEdit/TextWranger (commercial), but while its users tout how advance they are, they are still behind what is available to Windows programmers. Features such as pretty printing, snipplets, split-screen views of files, etc. are either non-existence or just starting to get introduced to the Mac world even though they've been there since the days of DOS. It can be argued that those feature aren't needed and I'll admit that a lot of features I only use once-in-a-while. However, the decades of work that has been put into them has allowed them to be part of editors without being intrusive and when I need them they are there.

As a Windows/DOS and Linux user, I've been spoiled by these features and it surprises me that Mac developers not only do not have these, but that they don't even know they exist.

For those interested:






    Eclipse (IDE)


I'm not sure yet... I'm going to give Smultron a try and I've been using TextMate on-and-off at work.

Eclipse IDE

Disable Font Smoothing in Firefox on OSX

On OSX, I disabled font-smoothing and switched to using the Tahoma font using TinkerTool because they look clearer to my eyes. In order for Firefox to follow the system setting, you have to set gfx.color_management.enabled to 'true' in about:config.

I think this setting is for Firefox's advance color management feature which means it will effect Firefox's performance a little bit when enabled.

Sunday, November 23, 2008

Desktop calendars

Previously, I talked how I put a calendar on my OSX desktop using GeekTool and the standard UNIX cal program. When my wife saw it, she wanted the same thing on her WinXP desktop and since I'm now starting to use Linux as a desktop I thought I'd do the same thing for it also.


Using, GeekTools, I simply had it make 2 shell command calls. The first one is to 'cal' which will return the current calendar month. Next, I had it call another shell command to a script I wrote that says:


nextmonth=`date '+%m'`
year=`date '+%Y'`
nextmonth=`echo $nextmonth|sed 's/^0*//'`
if [ $nextmonth -eq 12 ]; then
year=$((year + 1))
cal $((nextmonth += 1)) $year




To do the same thing on WinXP, you need Samurize and Cygwin. Samurize provides the ability to display output on the desktop like GeekTools and Cygwin will provide the cal program. When installing Cygwin, however, make sure to select the package linux-util because it is not installed by default.

A slight modification to the script is needed in order to run a shell script from outside of Cygwin (such as from the command prompt or "run" from the start menu):

nextmonth=`date '+%m'`
year=`date '+%Y'`
nextmonth=`echo $nextmonth|sed 's/^0*//'`
if [ $nextmonth -eq 12 ]; then
year=$((year + 1))
cal $((nextmonth += 1)) $year




On Linux, the program to use is Conky. Create the following .conkyrc file in your home directory:

# .conkyrc

text_buffer_size 512

update_interval 1.0

double_buffer yes
own_window yes
own_window_hints undecorated, sticky, below, skip_pager, skip_taskbar
own_window_transparent yes

use_xft yes
xftfont Bitstream Vera Sans:size=8

maximum_width 512
default_color white
alignment top_left
gap_x 10

uppercase no

${font monospace:size=8}${execi 8600 cal}
${font monospace:size=8}${execi 8600}


Wednesday, November 19, 2008

update VMWare kernel modules

Reminder to myself that when installing a new kernel version to run:

sudo /usr/bin/

so that the kernel modules are recompiled for the new version of the kernel.

Also noticed today that linva and 2 other repositories got merged into what is now called

Monday, November 17, 2008

Shortcut key to lock screen on MBP/OSX

In Windows, the ctrl-alt-delete key combo will lock the screen. I was surprised that OSX didn't have any key combination to do something similar. I guess Apple expected that people will only want to use a mouse...? Anyway, I find myself wanting to be able to quickly lock my screen when I move away so this is how I did it:

Create an run-only script with the Script Editor with the following:

tell application "ScreenSaverEngine"
end tell

Set an Quicksilver trigger to run this script and map the shortcut key to what you like (I used ctrl-command-delete).

If you have set the screen saver to require a password, you now have an keyboard short cut to locking your screen.

Saturday, November 15, 2008

Macports + apache2

My install of Macports didn't update the path to the new /opt/... directories so I had to add that myself. I then tried to install apache2 but that failed on compiling until I installed macports' gmake and then did a 'sudo port clean sqlite3'.

This allowed me to complete getting apache2 installed on the MBP.

First experience with the MBP (late 2008)

This weekend I had a chance to sit down and do a little more with the new MBP. This is the late-2008 model with the unibody design. I got the 2.5GHz version, 4GB memory and 320GB 7200RPM HDD to replace my current 3GHz Pentium 4 desktop.

There were two things about the new MBP that I was worried about. First, the keyboard didn't feel as good as the previous MBP keyboard. However, since I don't plan on using the built-in keyboard most of the time (I use an external IBM Model-M keyboard) this isn't as big of a deal. When I do need to move around with the notebook, I can live with the keyboard.

The other concern was the glossy screen. I already had a glossy screen Vaio so I used that to see how would it bother me if I used a glossy screen all the time. After a few days, I didn't find myself too bothered by the reflectiveness of the Vaio, so I decided to go with the new MBP. Now, I'll just have to say that this screen is even more reflective then I expected. In the morning with the sun shining through the window behind me, I can use the screen to shave! Yet, I noticed that it didn't bother me (and my eyes are very sensitve) because choosing a different background will help reduce the problem. Also, I don't find myself working with the sun directly behind me most of the time and the positive of the screen outweighed the reflectiveness. The glossy screen looks very very good. The colors are sharp and vibrant. The whites are more white and black is more black. It's very obvious next to my matte LCD. Ultimately, both matte and glossy have their own pros-and-cons, but the glossy screen has become a non-issue for me.

I had complained about the blurriness with OSX 's handling of anti-alias fonts. On my work MBP, I installed TinkerTool to disable it for most font sizes and installed some Windows fonts to replace the default OSX fonts. I was going to do this also with my MBP, but the problem wasn't there! The fonts looked good on the new MBP. I initially thought maybe Apple did something, but once I move to a dual monitor setup I saw the fuzziness on the external matte LCD. So it seems that the same light diffusing property of a matte screen also is the contributor for making the font look fuzzier to me.

In the end, configuring everything was pretty easy. Most of the time was spent transferring data from the old machine to the new.

Sunday, November 9, 2008

Getting a Macbook Pro

I ordered a Macbook Pro (15-inch, Late 2008, MB471xx/A) this week after much deliberation. As much as it might surprise some people, this is not the first Apple computer that I've bought. I had previously bought one of the clam shelled candy colored one for my wife when she was in school, but I promptly sold it after she graduated. Apple machines and software was simply not interesting to me and the premium for their stuff was never something I was willing to pay. Even now, I wouldn't consider getting a Mac as a desktop system.

What made me initially consider getting a MBP wasn't because of the Apple name or its software. The software that I primarily use are all equal or better on Window or Linux. What got me interested was that it can run many open source Unix software on a laptop. Basically, the BSD component of OSX was what made a MBP even worth considering.

Still, it was a hefty price to pay a notebook for something that I mostly do on my Linux or Windows desktop and I would still have to keep my Windows machine around for the things that weren't available on OSX. The subsequent release of Bootcamp (update for SP3), Parallels and VMWare fusion suddenly made the possibility of reducing the physical machines I have by one by running Windows on the MBP natively or through a virtual machine. Add to the fact that my current machine is over 3 years old, it was starting to make more economic sense.

At work, I was given a MBP so I've been able to use it for a few months and see how I liked it. OSX is nice but has its annoyances like Windows does and as a desktop OS, I feel no urge to replace Windows with it. What I love is a good UNIX laptop that can also be a desktop replacement when needed.

In the end, I decided to go ahead and get the MBP. It gives me a new gadget to learn and play with. This process reminded me of the early days of Linux where the distros made it really easy to install Linux on an existing Windows machine and that helped ease adoption (well, a little opposite since its Window on Mac instead of Linux on Windows). It's just too bad that there isn't a more widely supported Linux notebook.

Tuesday, November 4, 2008

Installing PostgreSQL on Fedora

Thinkpad x300

The Lenovo Thinkpad x300 arrived this week for my wife which will replace her current desktop computer. It's a pretty impressive machine that carries on the Thinkpad reputation. I thought about taking some pictures and writing a review of the machine but there is already some detailed reviews out there. I found that I'm in agreement with a lot that was said here and he has a lot of pictures of the machine.

I knew that it was going to be very light, but I was still surprised when I held it in my hand. This machine is LIGHT, but at the same time felt very solid. The keyboard is the classical Thinkpad keyboard so it felt good to type on, but I do feel that the trackpad is a bit tiny even for me. After running it for a whole day burning back-up CDs, watching videos and basically continuous operation it remained very cool. No worries about burning the family jewels when you have it on your lap with this one.

The software offering for the x300 is a mixed bag. Thinkpads are definitely business oriented machine and I can appreciate heir approach to functionality. The applications' interface is not pretty but they work.

Along with the x300, I got the Lenovo enhanced USB port replicator to connect the ethernet, peripherals, speakers and monitor to. This worked initially, but the ethernet connection is flaky. After installing my own apps, the display driver seems to have gotten corrupted and whenever I tried to switch from expanded view to mirror view I would get the blue-screen-of-death. Removing, reinstalling, removing, updating new drivers all failed to solve the problem and it just was stuck on expand mode.

I ended up selecting the system restore function when the machine was booting and told it to put the machine back to it's original state when I got it. This was easy to do. Just hit F11 as it boot, select the option and let it do its thing. It deleted everything, reinstalled and went through the Windows setup. When it finally finished, it booted back into windows and I reinstalled the driver and things worked as expected.

Overall this is an awesome little machine that doesn't come with a lot of crapware preinstalled. The USB replicator's drivers are a little flaky, but the restore function worked like a charm.

Chinese Tea Eggs


Boil Eggs:

  • 8-12 eggs
  • 1 teaspoon salt

3 cups water
1 tablespoon light soy sauce
1 tablespoon dark soy sauce
1/4 teaspoon salt
4 piece star anise
1 piece cinnamon stick
black tea (usually just get a black tea bag)


Cover eggs with enough water to cover. Add salt and bring water to boil and simmer for 3 minutes.
Remove eggs, rinse under cold water and roll in towel to crack shells.
Return eggs to water, add tea, soy sauce, salt, cinnamon and star anise.
Simmer for 3+ hours.

Chinese Sticky Rice (油飯)

Classic comfort food from Taiwan.


3 cups of long grain sweet rice (sticky rice)
2 chinese (non-sweet) sausage
5 pc. dried mushrooms
1/2 cup dried shrimp
1/2 cup fried shallots
3 T light soy sauce
1 T brown sugar
2 T sesame/cooking oil


Soak mushroom in 1 cup hot water until soft.
Soak shrimp in 1/2 cup water.
Cook rice in rice cooker with 1.5 cup of water.
Chop mushroom into small strips.
Chop sausage into small pieces.
Mix soy sauce and brown sugar.


Stir fry shallot in oil briefly.
Add sausage.
Add mushroom without water to shallot (keep water for later).
Add dry shrimp without water.
Add water from mushroom and shrimp and bring to boil.
Add soy sauce and brown sugar.
Add sweet rice and mix together.

Saturday, November 1, 2008

VMWare Server 2.0

Having multiple computers used be almost an necessity for programmers especially for those who deal with the internet/web-based development that requires the product work on multiple browsers and operating systems. Putting multiple OSs on a single computer and booting between them only takes you so far. Because of his, I often found myself with 2-4 machines at any given time. However, with the advance in virtual machine software like VMWare, it doesn't make as much sense to have many physical machine especially if some aren't used that often. So this weekend, I decided to start reducing the number of machines I have by converting one of my windows xp boxes into a virtual machine running inside linux.

I went with VMWare Server since it allows me to create a new VM rather then having to use an pre-built image (and MS isn't going to allow XP images to be handed out). Setting it up on my Fedora Linux machine was as simple as installing the RPM package. Once I did, I just had to create a new VM and boot the XP cd. VMware Serve 2.0 now uses a web-based interface rather its own native stand-alone app. I'm not sure how I feel about this, but it worked okay mostly. Sometimes the web interface responds slowly and it doesn't seem to start up on server reboots correctly so I have to manually start it.

Setting up windows xp on in VMWare is like setting it up on any computer: put in the CD, start the VM and go through the normal install flow. Since Windows XP have product activation, configure the VM with the hardware configuration you want first (memory size, audio and hardware settings, etc) and then activate the installation. Since activation only check at the time of installation, you can copy the VM image and install different apps on it without having to re-activate.