Thursday, May 29, 2008

Show me the money ? How do you define "financially free"?

Someone asked this question on Linkedin and I decided to share my two cents since it is a question I ask myself almost everyday. Below is what I answered.

This is the exact same question I ask myself every waking moment, especially since I'm nowhere near there. :(

To me, "financially free" or "financial freedom" or "financial independence" all refers to the state where you no longer need to "work to live" but rather you "live to work". i.e. You have a net worth that is enough to sustain your desired lifestyle from now till the very day you leave this world.

I believe most people will agree with me up to this point. The next logical question to ask is then "what should this net worth amount to in today's dollar?" and here is where it gets personal and subjective.

To the risk adverse, this magic number will probably be obscenely huge and requires you to work till you kick the bucket (or alternatively strike the lottery _a_few_times_) as they factor in high inflation rates, zero return on investment (i.e. spending the base amount and not investing it), providing for their kids, parents, grand parents, grand children, ... (you get the idea) and even throw in a few exceptions aka worst case scenarios (like accidents or suffering from critical illness although this should really have been taken care of by proper insurance planning) for good measure.

Likewise for the materialistic folks whose desired lifestyle includes a jet, Rolls or Zonda, an estate perched on a cliff overlooking the ocean, wardrobe decked out in Prada, LV and Gucci, this number will probably be something that only 1% of the population can really claim to have or your surname happens to be "Buffett" or "Gates". (ok, I'm exaggerating here)

To the easily contented and happy-go-lucky folks, this number can be reached well within their working lifetime. But bear in mind that this number will probably be a moving target (usually upwards) as your situation changes (desire for higher lifestyle, having more kids than expected, etc) and being influenced by this global economy (I attribute all these to capitalism being evil but lets not open that can of worms)

In short, "financial freedom" is really a state of mind for most people and all boils down to your expectations and the amount of risks you are willing to take and adjustments you are willing to make.

Of course, all this means zilch to the filthy rich who can truly afford to say that and never have to worry about it in the first place... Hmm... Hey Bill, are you by any chance looking for a godson? :)

Saturday, May 24, 2008

DD-WRT TX errors and v24 upgrade

Recently, my wireless router (running DD-WRT v24 RC6) had been experiencing a high number of TX errors (around 10 per sec!). And the weird thing is that I did not even have wireless clients active then. At first I thought it was due to the interference from a new neighborhood WAP that is running on the same channel. But even after I switched away to an unused channel, the TX errors did not go down.

So I pop over to the forums and did a quick search on this topic but unfortunately found nothing helpful. Seeing that the final release version for v24 is out (for just a couple of days actually), I took the plunge and did the upgrade hoping that this will solve the problem.

The process went well and was completed in under 10 mins from the time I started downloading the new firmware to my router back up and running on the new version. Even my old settings remained intact. I'm impressed.

However, the upgrade failed to solve my TX errors problem. The count did drop somewhat (its now happening at a rate of 1-2 errors per min) but it is still happening even when I have no active clients. If anyone has any idea where that is coming from, please drop me a clue. Thanks!

Monday, May 19, 2008

Xbox as a media ripper

When I first started out on the Xbox modding project, all I had in mind was to use it as a cheap media player that plays content (i.e. video, music, photos) from my media server cum NAS (i.e. my DNS-323) on my big screen TV in the living room.

This setup has been working well for the past couple of months but recently while researching into how to get my kids' Xbox games on to the upgraded hard disk so that they no longer need to mess with physical discs anymore (let a 4 year old handle the discs and I guarantee you that you will be buying replacements in a matter of weeks), I found a new trick; There is a wonderful little program called dvd2xbox (included in an AID installation) which can rip DVDs, audio CDs and Xbox games onto the local hard disk or even across the network (e.g. to my NAS!) via samba. Its extremely user-friendly (everything is just a few clicks away) and it will even look up freecddb to auto name your audio tracks!

So now, in addition to solving my "kids with discs" problem, I also have a painlessly way to quickly and effortlessly rip my audio CD and movie DVD collection right in the comfort of my living room! Excellent!

Sunday, May 18, 2008

BitTorrent client showdown - Transmission vs mldonkey

I'm giving up mldonkey for transmission+clutch for the following reasons:

  • Smaller memory footprint and less CPU intensive - this is especially important in a small embedded system like the DNS-323. For comparison sake, top reports 54% memory usage(sometimes growing to near 90%!) for mldonkey but only 7% for transmission (or 25% including lighttpd and php for clutch)
  • BitTorrent protocol only - since I only use bittorrent protocol, I do not need such a heavy weight client like mldonkey (which includes other protocols like file download aka HTTP/FTP, edonkey, overnet, gnutella and fasttrack).
  • Separation of UI from the core - unlike mldonkey (which offers telnet and http interface by default), the only built-in interface in transmission is the CLI (aka Command Line Interface) via transmission-remote. This again gives you the chance to reduce resource utilization by (1) not running the Clutch interface hence no web server required or (2) running Clutch in a shared web server on the box (unlike mldonkey which uses an exclusive built-in standalone web server)
  • Efficiency of the client - after 3 days with both clients turned on downloading the same files, it seems that transmission is more efficient than mldonkey by achieving better sustained speeds and yet using less connections.

Transmission and Clutch setup guide here.

Saturday, May 17, 2008

Friday, May 16, 2008

Enhanced transmission script for your DNS-323

I miss the ability to auto-stop/shutdown the bittorrent client after all downloads have completed hence I decided to port the old mldonkey script over. Here is a quick summary on what it does.
  • Improved the robustness of the startup, shutdown and restart sequence.
  • Added function to auto-stop transmission when there are no more active downloads.
  • Added function to auto-shutdown the box when there are no more active downloads.
  • Added function to configure the behavior when there are no more active downloads. Valid arguments are:
    • set_stop_when_done - stops transmission when there are no more active downloads;
    • set_off_when_done - shutdowns the box when there are no more active downloads;
    • set_donothing_when_done - let transmission continue to run when there are no active downloads (i.e. seeding);
  • Use the function softstop_status to check what is the current configuration option.

The default behavior is set_stop_when_done. Command syntax is . /ffp/start/ [cmd]. Here is the script below.


# author: Sidney Chong (bfg100k[at] #
# version: 0.1 #
# date: 15/05/2008 #
# #
# Version History #
# --------------- #
# v0.1 - expanded original startup script to be more robust and #
# include auto-stop or auto-shutdown the box when #
# downloads are completed. #
# #

if [ -z ${TRANSMISSION_HOME} ]; then
#setup the ENV variables if not found
#this can happen when running from crontab
echo "Environment variables not found, including default fun_plug profile."
. /ffp/etc/profile



#check if daemon is already running. if yes, do nothing
if transmission_status grep -q "is running"; then
echo "INFO: ${name} already running! Nothing to do."

if [ ! -d $TRANSMISSION_HOME ]; then
su $user -c "mkdir $TRANSMISSION_HOME"
echo "Starting ${name}..."
su $user -c "$command -f -v 2 1>$TRANSMISSION_HOME/$name.log 2>&1 &"
sleep 1
if [ -S $TRANSMISSION_HOME/daemon/socket ]; then
chmod 0777 $TRANSMISSION_HOME/daemon/socket
echo "Could not find Transmission socket"

#this step configures what to do if there are no more active downloads
#default (stop_when_done) is to stop transmission.
#change to off_when_done if you want to shutdown the box
#change to donothing_when_done if you want to let it run (e.g. for seeding)
_transmission_setup_softstop stop_when_done

echo "Transmission startup sequence completed. Check ${TRANSMISSION_HOME}/${name}.log for more details."

if transmission_status grep -q "is running"; then
echo -n "Stopping ${name}... "
if [ -x /ffp/bin/transmission-remote ]; then
/ffp/bin/transmission-remote -q
/bin/kill -9 $(pidof $command)
echo "done."
echo "INFO: ${name} not running! Nothing to stop."
echo "${name} stop sequence completed."

_pids=$(pidof $name)
if test -n "$_pids"; then
echo "$name is running"
echo "$name not running"

if crontab -l grep -q 'softstop_off';
echo "DNS-323 will shutdown when there are no active downloads."
if crontab -l grep -q 'softstop';
echo "${name} will stop when there are no active downloads."
echo "softstop has not been configured."

echo "Waiting for old instance to shutdown before starting new daemon..."
while transmission_status grep -q "is running"
sleep 5

# this routine checks to see if transmission is still alive
# and if there are any downloads active.
# if no downloads are active, it attempts to stop transmission.
# if "off_when_done" option is specified, it will attempt to
# shutdown the DNS-323 as well.
echo -n "`date`: Checking downloads... "
if /ffp/bin/transmission-remote -l grep -q 'downloading';
echo "downloads are still active!"
echo "no active downloads found!"
if [ "${1}" = "off_when_done" ]; then
echo "attempting to shutdown the DNS-323 now. Bye Bye!"
touch /tmp/shutdown

# this routine sets up softstop as a cron job that runs every half hour
# to ADD the cron job, pass "stop_when_done" into the routine,
# to ADD the cron job with shutdown option, pass "off_when_done",
# any other values (or no value) means REMOVE by default
echo "Setting up softstop on crontab... "
crontab -l > ${TMP_CRONTAB}
sed -i -e '/ softstop/d' ${TMP_CRONTAB}
case "$1" in
echo "INFO: This job will stop $name when all downloads are completed."
echo "INFO: This job will attempt to shutdown the DNS-323 when all downloads are completed."
echo -n "Removing job from crontab... "
if [ "${TMP_NAME}" != "" ]; then
# sanity check - do not allow adding any job if transmission is not already running
if transmission_status grep -q "is running"; then
echo -n "Adding cron job to run every half hour... "
echo -e "0,30 * * * * /ffp/start/ ${TMP_NAME} >> /ffp/log/${name}.cron.log 2>&1" >> ${TMP_CRONTAB}
sed -i -e '/^\s*$/d' ${TMP_CRONTAB}
echo "ERROR: ${name} is not running. NOT adding job to crontab."
crontab ${TMP_CRONTAB}
echo "done."

case "$1" in
_transmission_softstop off_when_done
_transmission_setup_softstop off_when_done
_transmission_setup_softstop stop_when_done
_transmission_setup_softstop donothing_when_done
echo "Usage: $0 startstoprestartstatusset_off_when_doneset_stop_when_doneset_donothing_when_donesoftstop_status"

Thursday, May 15, 2008

Second casualty of fever...

Fever has claimed its number two victim in my household. And boy, what a pitiful sight it was (see pics on top and right). The good news is that the fever wasn't exactly high and we can all see just how wonderful an actor Jordan will become when he grows up.

Wednesday, May 14, 2008

Setting up transmission and clutch

Setting up transmission+clutch is really simple if you have upgraded to fonz's fun_plug version 0.5. Here's a quick how-to.

Transmission (aka the core) setup

  1. Grab the transmission package transmission-1.20-ffp0.5.tgz.
  2. Grab the required package curl-7.18.1.tgz.
  3. Install both using funpkg -i . (FYI, funpkg is found in the /ffp/sbin folder in case this is not setup on your path. This usually happens when you telnet/ssh in as a normal user and then do a su to root)
  4. By default, transmission will create the directory /mnt/HD_a2/.transmission where it stores its working files and also your downloads. To change the location of this folder, edit the variable TRANSMISSION_HOME in the startup script /ffp/start/ To change the downloads folder, you will need to use the CLI or web interface (see below).
  5. Start transmission by using the command . /ffp/start/ start (note the dot in the beginning and the space immediately after).
  6. Make the script /ffp/start/ executable if you want it to auto start every time you boot. i.e. chmod a+x /ffp/start/

For controlling the core, you have two options.

(1) Using the CLI via transmission-remote

No installation is required as this is bundled together with the core transmission package. For help on how to use, just type in the command without any arguments. Using the CLI also means that you have to first telnet into the box.

(2) Using the web interface by installing Clutch

Clutch is a web application that connects to the transmission core via the daemon socket file. As it is distributed as a web application package separately from transmission, you will need to go through some installation steps. Also, as it is just a web application package, you will need to install a web server (with PHP capabilities) on your box as a pre-requisite.

  1. Assuming you have ffp v0.5 already, you will have lighttpd (i.e. the web server) installed (but not running yet) by default. To get the PHP capabilities, download the package php-5.2.6-1.tgz and run the funpkg -i command to install it.
  2. Configure your web server by copying the configuration script from the examples directory. i.e. cp /ffp/etc/examples/lighttpd.conf-with-php lighttpd.conf
  3. The web server assumes that your web document root is at /mnt/HD_a2/www and you will need to create the necessary directories manually. i.e. mkdir -p /mnt/HD_a2/www/logs /mnt/HD_a2/www/pages
  4. Now that we got the pre-requisite setup completed, time to grab the clutch package Clutch-0.4.tar.gz.
  5. Note that this is not a ffp package and you do not use funpkg -i to install it. Instead, you simply untar it into your web document root directory. i.e. tar zxf Clutch-0.4.tar.gz -C /mnt/HD_a2/www/pages
  6. You may wish to change the path to the clutch package for URL easy access. i.e. mv /mnt/HD_a2/www/pages/Clutch-0.4 /mnt/HD_a2/www/pages/clutch
  7. And finally, to allow clutch to find your transmission core, create the file clutch/remote/data/socket.txt and store the path to the transmission socket file in there. i.e. echo /mnt/HD_a2/.transmission/daemon/socket > /mnt/HD_a2/www/pages/clutch/remote/data/socket.txt
  8. Once all the above setup is done, we are ready to start the web server. To do so run the command . /ffp/start/ start.
  9. Make the script /ffp/start/ executable if you want it to auto start every time you boot. i.e. chmod a+x /ffp/start/
  10. To access the web interface, point your browser to http://[ip_address_of_your_box]:8080/clutch. Note that Clutch does not support Internet Explorer so you have to use Firefox, Opera or Safari instead.
  11. Note that by default, anyone can access the BT client via the URL above. If you are paranoid over security or thinking of exposing it over the internet (so that you can control your BT downloads from office?), you may want to setup access control via directory ACL in lighttpd.

Tuesday, May 13, 2008

Jarrett having fever...

Here is our poor Jarrett running a high fever of 39 degrees Celsius plus the usual accompaniment of flu and cough. Doc says its a throat infection (so there! Its not because we brought him swimming two days back) and we have to watch him closely for the next couple of days for signs of worsening (e.g. vomiting).

As far back as I can recall, this is the first major illness he is going through and we can clearly see the effects it is having on him; tiredness (it was a first that he fell asleep all by himself on the couch last night!), the constant coughing and wheezing and even losing his little voice... a heart-breaking sight even for third time parents like us.

But our boy is one tough cookie. He did fuss alittle over the discomfort but most of the time, he is his usual self playing and interacting with us although with a lot less energy. Even when it comes to medication, he takes them like a little man and happily gulp down whatever we gave... including the aweful tasting antibiotics! Yes, I know its aweful because I tried it before! Well done soldier!

Monday, May 12, 2008

Upgrading to ffp 0.5

Since I'm in the mood to upgrade, I figured I might as well upgrade fonz's fun_plug to version 0.5. This can be considered a major upgrade as there are quite a few fundamental changes such as the directory structure, default shell and the default packages included. This means that all the addon packages you installed (or built) based on the older 0.4 version or below need to be reinstalled and/or reconfigured.

The upgrade from 0.4 to 0.5 is painless enough using the instructions found here. After the install, get rid of telnet and get ssh back up (note that the default ssh included is openssh, not dropbear). Instructions for this is here.

A couple of things to note:

First up, the new path to the fun_plug is now at /mnt/HD_a2/ffp. A symlink at /ffp allows you to move the binaries to say a USB flash to reduce disk access and also to allow a clean shutdown of the HD_a2 file system.

Next the default env variables such as BINDIR, FUNPLUGDIR are all gone. So if you have any scripts that reference them, you will need to get them changed (e.g. and my nightly backup script)

The default installed packages can be found under /ffp/var/packages. Additional packages can be downloaded from here. To install them, follow the instructions here. (Note: substitute -u with -i for install and -r for remove).

Unrar will need to be installed again using this package.

mldonkey is not yet packaged for this version but moving it from the old is real easy; Just copy the file mlnet from /mnt/HD_a2/fun_plug.d/bin to /ffp/bin, copy the file from /mnt/HD_a2/fun_plug.d/start to /ffp/start and edit it for the path changes.

Well, that about sums up my experience with this upgrade. Now to try out the various packages that are built for this version!

Saturday, May 10, 2008

Jarrett goes swimming!

DNS-323 Firmware 1.05b28 is out!

The official 1.05 firmware for the DNS-323 is finally out over at the SG support website. The most significant change is the inclusion of a bittorrent client in the firmware! Not that it matters to me since I already use mldonkey but hey, its progress...

Anyways, the upgrade was uneventful (thank goodness for that!) and my data remains intact. It was a heart stopping ten minutes watching the progress bar inch towards completion as I had forgotten to pull out the backup drive from the device before I hit the enter key and a reformat would had been disastrous! (Note to self: time to get my remote backup going!)

Oh, one thing to note about flashing firmware, apparently, it will remove all your samba shares so you have to manually set them up all over again after the flash.

Wednesday, May 7, 2008

Introducing HTC Touch Diamond

A new HTC device has just been launched and boy this is one pretty gadget; Not just the outer appearance but also the new user interface named TouchFLO 3D. This is essentially an evolution of the original TouchFLO interface first seen on the HTC Touch. It features a new home page and expanded range of functions like contacts, weather, photos, music and web browsing all being presented in smooth flowing 3D motions and using only finger gestures. Finally a real rival to the iPhone's interface.

In terms of outer appearance, HTC went with an all black exterior. The front is encased in a full glass panel with four touch sensitive buttons and a scroll wheel at the bottom. Even the back panel is not your usual boring flat rectangular block but features many raised facets making it look like the surface of a diamond (hence the name I suppose). Overall, it is a very classy looking device that you won't feel embarrassed using at a gala type event.

And looks is not the only thing going for it. With tri-band, 3.5G, WiFi, bluetooth, GPS, 3.2MP Camera, VGA screen and plenty of memory built in (including a 4GB internal storage), this is a very capable and full featured device.

The only downside to this device is the lack of memory expansion slot (you are limited to the 4GB internal space only) and the possibly short battery life (900mAh only). The combination of these two means that you probably won't be able to use the device as a serious music or video player.

In terms of availability, HTC has announced that it will first launch in June 2008 in Europe followed by Asia and lastly the Americas. Hmm... I wonder if this is intentionally arranged to avoid a direct clash with iPhone?

Will I be getting it? Hmm... Obviously there are alot to like about this gadget but the battery life is a big issue for me as I hate having to charge the phone on a daily basis and that is provided that a single charge can last you through the day! Yes, you can obviously get a second battery as standby but again, that means having to keep the battery with/near you so that you can swap it when you need it. Not exactly that convenient is it? So most likely no... until HTC or a third party comes out with a 1300mAh battery pack :)

Anyway, view the video below for the launch presentation by HTC CEO Peter Chou.

Thursday, May 1, 2008

Introducing the Coxford Singlish Dictionary

For all the ang mor out there, this is the boh beh chow reference guide to Singlish and a die die must have if you intend to live or work in the sunny island of Singapore.

Published by Singapore's Premier Satirical Humour Website, this pow ka leow list contains a mind boggling 817 terms in total!

For the locals, you may also want to go look see look see and brush up abit. Next time can act lao cheow and show your kakis a thing or two with your newly found tok kong Singlish. But do agak tarek abit or else you will be labelled ya ya papaya or worse L-cube L-square! (like now hor? :P)