Tuesday, February 26, 2008

MySQL on the DNS-323 possible? YES!

Finally! Someone took the effort to create a native compilation of mySQL for the DNS-323! See details here. Will give it a spin and file a field report next week when I'm back from my business trip in Auckland.

This is good news. Next up, Perl 5.8.3 support and we can then reposition the DNS-323 as a SOHO App/DB server! :)

Good food in Auckland - Tony's Lord Nelson Restaurant

If you are visiting Auckland, New Zealand, consider popping by Tony's Lord Nelson Restaurant for a meal or two. It's located along Victoria Street near the junction with Queen Street, barely a 5 mins walk from Crowne Plaza hotel where I'm putting up.

The restaurant occupies both levels of the shophouse and has an old traditional English interior; reminds me of an Irish pub. Although the seating arrangement is rather packed, you get lots of privacy due to the tall partitions between tables.

The menu offers quite a good spread for a steakhouse; It has poultry, lamb, venison, seafood and of course the usual gourmet beef. The advertorial out front (and even in the menu) proudly proclaims that it serves the best steak in the city so I just had to try it for myself. I ordered the Caper Steak which is a fillet with rich caper and blue cheese sauce. Yeah, cheese on beef. I wasn't entirely sure it was for me but well, there's a first time for everything.

It turned out fantastic and was extremely enjoyable when paired with the Hawke's Bay Cabernet Sauvignon Merlot. The beef came in a thick cut and was very juicy and tender. The serving of the sauce was generous and although the flavor of the cheese was clearly evident, it didn't destroy the taste of the underlying beef. I thoroughly enjoyed it.

I ordered the salad and potato for the sides. The salad was nothing to shout about but the potato was rather unique. I was expecting the usual baked potato with sour cream and bacon bits but was served a rather strange looking golden crusted "egg". Upon closer inspection, the "egg" turned out to be mashed potato molded in the shape of an egg and crusted with breadcrumb. Might I add that it tasted as good as it looked too.

In terms of pricing, the caper steak was NZ$30 which I find a tad pricey for the portion served. The great taste however more than make up for it. I will definitely drop by again the next time I am in Auckland!

Tony's Lord Nelson Restaurant
37 Victoria Street
Auckland, New Zealand
Tel: (09) 379 4564

Business hours:
Lunch - Monday to Friday 12pm - 2:30pm
Dinner - Everday 5pm - 10pm

Wednesday, February 20, 2008

Unicode support in XBMC

I managed to get my XBMC up and running for awhile now and so far it works great as my video, music and photo gallery player... Until I start browsing into my chinese collection that is. Apparently, the stock XBMC installation does not come with Unicode support. I'm guessing this is due to copyright issues with the font type involved?

Anyway, the fix is relatively straight-forward; simply replace the default arial.ttf font with the unicode version found in any Windows XP and up installation, then change the xbmc skin font to arial ttf. Detailed steps as follows:
  1. Locate the font arialuni.ttf in Windows XP c:\windows\fonts.
  2. FTP arialuni.ttf to e:\xbmc\media\fonts on the Xbox.
  3. rename e:\xbmc\media\fonts\arial.ttf to arial.ttf.bak.
  4. In same directory rename arialuni.ttf to arial.ttf.
  5. Exit FTP; launch XBMC
  6. Go to Settings --> Appearance --> change the skin fonts to arial ttf and you are done!

Monday, February 18, 2008

Enhanced mldonkey script for your DNS-323

I wasn't too happy with Andy's startup script because I found it alittle too simple and lacked robustness in the startup sequence as well as some of convenience functions like stopping and restarting the mldonkey processes.

I also wanted to incorporate a nifty feature (written by Bartik for his synology) that regularly checks mldonkey for active downloads. If not found, it stops mldonkey automatically. Along the same lines, I have expanded on this idea to optionally turn off the box when all the downloads are completed. To do that, start mldonkey normally and then run the command ./mlnet.sh set_off_when_done. If at anytime you change your mind, just run the command ./mlnet.sh set_stop_when_done to change back to the default behaviour (i.e. stop mldonkey only).

So here it is for the benefit of others. Note that the script assumes a setup identical to mine as documented here. You may need to make the necessary amendments if your setup is different.

You will definitely need to change the following in the script:
  • uid and gid of the account used to run mldonkey (currently not working)
  • password of the admin account used to access the mldonkey web interface


# author: Sidney Chong (bfg100k[at]gmail[dot]com) #
# version: 0.2 #
# date: 18/02/2008 #
# #
# Version History #
# --------------- #
# v0.1 - expanded ShadowAndy(http://www.shadowandy.net) script #
# to be more robust on startup as well as added functions #
# to check status, stop, restart and auto-stop when #
# downloads are completed. #
# v0.2 - added option to shutdown the DNS-323 when downloads are #
# completed. By default, the script only stops the #
# mldonkey process when there are no more active downloads.#
# #

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

export MLDONKEY_DIR="/mnt/HD_a2/mldonkey"
export TMPDIR="/mnt/HD_a2/mldonkey/temp"


mlnet_start() {
echo "Starting mlnet startup sequence... "
#check if mlnet is already running. if yes, do nothing
if [ `mlnet_status` = "running" ]; then
echo "INFO: mldonkey already running! Nothing to do."
#check for inproper clean up from the past
if [ -e ${MLDONKEY_DIR}/mlnet.pid ]; then
rm ${MLDONKEY_DIR}/mlnet.pid

if [ -d "${MLDONKEY_DIR}" ]; then

echo "mldonkey directory (${MLDONKEY_DIR}) not found. Creating one..."
#change ownership of the folder to the user account we will use to run mlnet
#chown 504:703 ${MLDONKEY_DIR}
#chmod 664 ${MLDONKEY_DIR}/*
${MLNETBINDIR}/mlnet > ${MLNETLOG} 2>&1 &
#${MLNETBINDIR}/mlnet -run_as_useruid 504 > ${MLNETLOG} 2>&1 &
if [ -d "${MLDONKEY_DIR}/incoming" ]; then
chmod 777 ${MLDONKEY_DIR}/incoming/
chmod 777 ${MLDONKEY_DIR}/incoming/*
_mlnet_setup_softstop stop_when_done
echo "mlnet startup sequence completed. Check ${MLNETLOG} for more details."

mlnet_stop() {
echo "Stopping mlnet... "
if [ `mlnet_status` = "running" ]; then
echo -n "Killing mlnet process... "
if [ -e ${MLDONKEY_DIR}/mlnet.pid ]; then
cat ${MLDONKEY_DIR}/mlnet.pidxargs kill
pidof mlnet xargs kill
echo "done. All mlnet processes killed."
echo "INFO: mlnet not running! Nothing to kill."
echo "mlnet stop sequence completed."

# this routine checks to see if mlnet is still alive
# and if there are any downloads active.
# if no downloads are active, it attempts to stop mlnet.
# if "off_when_done" option is specified, it will attempt to
# shutdown the DNS-323 as well.
_mlnet_softstop() {
echo -n "`date`: Checking downloads... "
#touch ${TMP_DL_STATUS}
wget -O ${TMP_DL_STATUS} -q "http://admin:${ADMIN_PSWD}@"
if grep -q 'R' ${TMP_DL_STATUS}
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 "add" 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
_mlnet_setup_softstop() {
echo "Setting up softstop on crontab... "
crontab -l > ${TMP_CRONTAB}
sed -i -e '/mlnet.sh softstop/d' ${TMP_CRONTAB}
case "$1" in
echo "INFO: This job will stop mldonkey 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 mlnet is not already running
if [ `mlnet_status` = "running" ]; then
echo -n "Adding cron job to run every half hour... "
echo -e "0,30 * * * * /mnt/HD_a2/fun_plug.d/start/mlnet.sh ${TMP_NAME} >> /mnt/HD_a2/fun_plug.d/log/mlnet.log 2>&1" >> ${TMP_CRONTAB}
sed -i -e '/^\s*$/d' ${TMP_CRONTAB}
echo "ERROR: mlnet is not running. NOT adding job to crontab."
crontab ${TMP_CRONTAB}
echo "done."

mlnet_restart() {
echo "Waiting 10 secs before starting daemon..."
sleep 10

mlnet_status() {
if [ -n "$(pidof mlnet)" ]; then
echo "running"
echo "stopped"

case "$1" in
_mlnet_softstop off_when_done
_mlnet_setup_softstop off_when_done
_mlnet_setup_softstop stop_when_done
echo "Usage: $0 startstoprestartstatusset_off_when_doneset_stop_when_done"

Saturday, February 16, 2008

Give Windows a boost!

If you are running Windows Vista on old hardware, do consider investing in a USB flash drive to take advantage of the ReadyBoost feature.

I had been running Vista for close to a month on an old Pentium 4 2.4GHz with HT and 1GB of DDR400 RAM. Booting up alone took as much as 65% of my RAM (as shown on the resource meter sidebar gadget). Opening a couple of apps (e.g. Outlook, Word and Internet Explorer) and switching between them always take at least a couple of seconds and you can see the harddisk activity light going crazy during that time.

Upgrading the RAM is not an option in my case as the motherboard has only 2 DIMM slots and they are already filled with 2x 512MB in a dual channel configuration. Replacing them with 2x1GB modules will set me back at least S$140 based on today's market prices for PC3200 RAM modules. To me, that's not a cost effective solution since my hardware is more than 4 years old and any parts could fail anytime now.

So today I took the plunge, went out and got myself a 1GB Trek USB thumb drive from Giant for less than S$15. Came home, plugged it in, followed the two step popup prompt and you can start to feel the difference in performance; Windows is more responsive and task switching is quicker.

Before you rush out to get your USB stick, do take note that not all flash devices are ReadyBoost capable. Windows requires the device to have a minimum read and write speeds and it will automatically perform a quick test upon insertion of the device. Only if the device pass the test will you be shown the option to use it for ReadyBoost.

Hence to be safe, make sure you check the packaging for confirmation that ReadyBoost is supported before you buy!

Saturday, February 9, 2008

Live traffic view in your Vista Sidebar!

For the SG drivers out there, check out this nifty little gadget for Vista's sidebar. It basically shows you a live shot of a selected LTA webcam. The image is updated automatically as long as you are connected to the internet, or you can click on the tiny button on the bottom right to refresh manually.

You can see an enlarged view of the photo by clicking on it. You can also easily and quickly change the view via the same interface.

I would give it five stars if it had one more feature: auto rotate the view between the different webcams!

Friday, February 8, 2008


This is a photo showcasing the oldest and youngest member of the Chong family; Oldest being my granny at 83 years old and youngest being Jarrett at 7 months old! On the left most is his uncle (yes! uncle!) Ling Li and lastly we have the two China boys Jordan (on the left) and Joel (on the right).

Oh, and in case you are wondering, no we do not dress them like this normally... only on Chinese New Year (CNY)... really!

Tuesday, February 5, 2008

Getting Keyword substitution to work in SVN

If you have been a long time user of CVS, you will value the use of keyword substitution for identifying file versions, date when the file was last modified, by who and in which file location.

Having switched to SVN recently, I found out that although SVN uses the same keywords as CVS, this feature is not turned on by default!

To turn it on via TortoiseSVN, do the following.
  1. In Windows Explorer, select the root folder of your source files (you need to do this as the setting is not global).
  2. Right click and select "TortoiseSVN" > "Properties".
  3. In the pop-up dialog, click on the "New..." button.
  4. In the field "Property name:", select "svn:keywords" from the drop-down list.
  5. In the field "Property value:", type "URL Date Revision Author".
  6. Check the box "Apply property recursively".
  7. Click "OK" twice.
  8. You're done!

Saturday, February 2, 2008

Adding sources to XBMC

Ok, now that XBMC is up, its time to add in the sources. A source (or bookmark as known in previous incarnations of XBMC) is basically a location where your media files are located.

This can take the form of a local file directory, shared folder on your network, UPnP AV Media Servers on local network, and even internet feeds like online radio and video streams. Check the XBMC wiki for the types of media sources and how to add them.

For me, my primary source will be from my NAS via the smb protocol (aka network shared folder). Thought about using the UPnP media server software that runs off the NAS but am unsure of the advantages of it vs just smb. Will explore more in the future.

Other than LAN content, I was really keen in trying out the internet streams using the guide found here. I used the STRM approach which is rather tedious as each station (i.e. the URL) has to be in its own .strm file. Remember to put these files in a path where XBMC can find them; in my case, I created a new local folder where I ftp the files into and defined this folder as a source in the sources.xml file.

I had limited success with the stations I've selected; only a couple of radio stations worked and none of the video streams worked at all. I couldn't troubleshoot the problem as the status messages disappears from the screen rather quickly and I have no idea where to find the debug logs on the XBMC. Guess I have to do alittle more digging here.