Follow us on Twitter
HomeMeTechnologySports

Roalt Dot Com

Roalt Dot Com upgrade underway

Because of the upgrade of the home-server, I'm also upgrading roalt.com to a newer version of the Joomla! CMS system. At this moment I'm still configuring the main page, so expect some limited functionaility until I'm completely done.

Review for Tcl/Tk book in 2011

I was asked- as an expert in Tcl/Tk programming- to write a review on a new book. The book is called Tcl/Tk programming Cookbook by Bert Wheeler. Until the review is available on amazon.com (within 48 hours), you can read in here as well.

 

Read more...

Asus HDP-R1 media player

Choosing a media player

I've just acquired the ASUS O!Play HDP-R1 media player for about 90 EUROs. Media players have become really cheap and there are a number of popular choices including the Western Digital WD TV Live, the Popcorn hour (C-200 or A-200), and the Xtreamer.

I didn't want an expensive one, just one to play my media files and one that could mount my network shares on my server. Further more, I have my Harmony 885 remote, so the remote should work with infrared so I could replace it (that knocked out the Popcorn C-200 that works on radio/frequency, except that it is too expensive for my need).

Valid options were the WD, the Asus, and the Xtreamer. I really wanted to play DVD media files that are stored as .iso and use the DVD menu functionality. Only the ASUS HDP-R1 supports this functionality which made my choice easy. The ASUS also has an ethernet connector (no wireless, therefore you need the Asus HDP-R3 one) and an e-SATA connector for a fast external hard-drive connection (next to the more commonly found USB connectors).

Connecting the ASUS O!Play HDP-R1 to your local (SAMBA) shares

It's quite simple to adjust the HDP-R1 to your needs because it runs linux. Of course, it's a scaled down version, based upon Venus linux, and you see this when you logon using telnet. Just use root as username name with no password.

The storage devices are mounted under /tmp/ramfs/volumes, and to add your own storage device, just create a mount point there and use mount:

# mkdir -p /tmp/ramfs/volumes/media
# mount -t cifs -o username=my_username,password='my_password' //my_server_ip_address/media /tmp/ramfs/volumes/media/

In this example, you have to replace my_username, my_password, and my_server_ip_address with the settings from your own server and network. And, of course, you have to replace media by the name of the share you use. Additional shares can be added just as easy.

After this effort, you will see your share appear in the list of Storage devices when playing movies or other media.

Keeping your shares active after a power-outage

The HDP-R1 does have a power button (via the remote), but does not have a physical switch. When turning it off, it only goes into a sleep mode, which has the advantage that after turning you device on again, your shares are still mounted. But when you remove the power cord from the wall and put it back in, you will see that your shares (and even your created mount-directory) will be removed.

To get your shares back after a power outage, we have to modify the boot process. The /etc/init.d directory is read-only, but you can add your own script at the end of the /usr/local/etc/rcS script:

 
echo 2 /tmp/hdd/volumes/HDD1/ > /sys/realtek_boards/misc_operations
# here end the regular rcS script


(. /usr/local/etc/mount_shares.sh ) &

I've created a separate shell-script that contains the above-mentioned mkdir&mount commands and stored it in  /usr/local/etc/mount_shares.sh

This files looks as follows:

echo "Start mount_shares.sh" >>/tmp/ramfs/mount_shares.log
date >>/tmp/ramfs/mount_shares.log
mkdir -p /tmp/ramfs/volumes/media
# first make sure Asus has right IP address
ifconfig >>/tmp/ramfs/mount_shares.log
ifconfig eth0 10.0.0.81 netmask 255.255.255.0
route add default gw 10.0.0.138
echo "modified IP address" >>/tmp/ramfs/mount_shares.log
ifconfig >>/tmp/ramfs/mount_shares.log
# After that make sure CIFS is mounted correctly
mount -t cifs -o username=my_username,password='my_password' my_server_ip_address/media /tmp/ramfs/date >>/tmp/ramfs/mount_shares.log                                               
echo "End mount_shares.sh" >>/tmp/ramfs/mount_shares.log

Note that my ip address for the device is configured for 10.0.0.81. This caused me a bit of a headache, because when you power-up the Asus device, it does not have this address until you first turn it off using the remote and then turn it on again. The strange thing is that after the reboot, the device (on the television) presents itself on this 10.0.0.81 address but it does not react to ping commands. I assume this is a bug in the device. To circumvent this, I set the IP address manually. 

So after this script, the media player mounts my SAMBA devices quickly and I can use it to watch my video collection, mp3 music and show my photos to friends. And as it is a linux-device, it will have a range of hacking opportunities for the future... 

Resize script for photo frame

Do you also have a digital photo frame that shows all your favorite pictures? And do you also store the full-sized photos on it (or on the SD card), while the photo frame only uses a lower resolution version of them? Use this script to make them just small enough so the quality stays the same, but you use the memory much more efficient!

As an example, on a photo frame with a resolution of 800x600, it uses 59MB instead of 1GB!

For landscape pictures, it resizes so it fits (and crops a bit of the side) so it fills your frame completely. For portrait it resizes so the height is rescaled to the photo frame height and adds black borders on the sides.

I've written the following script to resize all photos in a directory. Put this script in your directory with photos. Change the WIDTH and HEIGHT values according to your specs of your frame. It creates a new directory next to the original one with the resolution added to the directory name.

 

#!/bin/bash
WIDTH=480
HEIGHT=234
SOURCEDIR=`pwd`
DESTDIR="${SOURCEDIR} ${WIDTH}x${HEIGHT}"
mkdir -p "$DESTDIR"
cd "$SOURCEDIR"
IFS=$'\n'
rm -f "$DESTDIR"/*
for name in `ls *.jpg` `ls *.jpeg` `ls *.JPG` ; do
    W=`identify -format "%w" "$name"`
    H=`identify -format "%h" "$name"`
    test $W -gt $H
    if [ $? == 0 ] ; then
        convert "$name" -resize ${WIDTH}x${HEIGHT}^ -gravity center -extent ${WIDTH}x${HEIGHT} "$DESTDIR/$name"
    else
        convert "$name" -resize ${WIDTH}x${HEIGHT}\> "$DESTDIR/$name"
    fi
    echo "created: $DESTDIR/$name"
done

I'm using Ubuntu but it will work with other linux versions (and maybe Mac OS X as well) as long as you have ImageMagick 6.5.7-8 or one version close to it.