fix himedia player to add nas files into media library

My HiMedia 910a player doesn’t support adding nas files (samba/nfs) into its media library. Browsing thru folders is quite tedious for media enjoy time. And 900 series players seem auto overwrite some system files when booting. Therefore customize your own firmware is the choice. Following is the solution after two days of search and configuration:

  1. Make sure you have squashfs-tools installed, if you are on Mac, then build yourself with this code from vasi.
  2. Download your device’s latest firmware, which is named as install.img but actually a tar file. Use tar to extract img’s contents files, in the “packageN” (N=5 or other number) folder, find squashfs1.img
  3. use unsquashfs to extract squashfs files, in the output folder rtk_rootfs/etc/init.d, modify file rcS to uncomment this line:


  4. in rtk_rootfs/user/local/, modify file rcS to add a line at the end:


  5. make sure it is executable: chmod +x rcS
  6. use mksquashfs to create back squashfs1.img file, and use tar to create back install.img
  7. upgrade this new created firmware, then will be auto called when booting
  8. Insert a sdcard or usbdisk to player, so that himedia system will allow add to media library button from these “local files”. I use a sdcard, so following location will be /tmp/usbmounts/mmcblkop1
  9. telnet into himedia, go to /tmp/usbmounts/mmcblkop1, mkdir a folder like “nasfiles”
  10. go to /usr/local/etc, vi to mount nfs share after sdcard is ready:


    sleep 35

    if [ -d /tmp/usbmounts/mmcblk0p1/nasfiles/ ]; then

    mount -t nfs -o ro,nolock 192.168.xx.xx:/folder/ /tmp/usbmounts/mmcblk0p1/nasfiles


  11. make sure is executable
  12. Now when himedia player is starting, it will auto mount remote nfs files into sdcard folder, then go to storage card’s nasfiles folder, the system will allow you to add nas folders or files to media library!
  13. However, sometime the system media library handling will not work properly. You can also manually fix the media library database when some folder or file is grayed out. Take the sdcard out and insert into your PC.
  14. Go to the sdcard root folder, go into “.Theatter” hidden folder, there’s stx.db file, which is in sqlite format. use sqlite3 to open it. Backup if you don’t want risk library corrupt.
  15. Mostly the ExtHddFolder table is your target, check full_folder_name to be correct; change folder_type to 3 will show the folder in “My Movies”; if you just want folders shown, delete all files item.
  16. Insert back, reboot and wait some time for network up and mount up, browse into My Movies, you have a neat and direct display of Nas folders and movie files!

Setup Test Analytics on GAE with Google Apps Account

Test Analytics is a quite good project from Google for testing analysis practice. It is open sourced at However the documentation is quite limited and not straight forward for configuration and setup.

Just spend quite a few hours to make it run on GAE with Google Apps account. Here is the  steps:

  1. Create target GAE application in GAE ( with your Google Apps account, select user authentication to Google Apps and set your apps domain (i.e.
  2. In your Google Apps Administrator Homepage (, add services with GAE application id set to the created one
  3. Download or git clone the test analytics project code
  4. In the pom.xml at project dir, add following lines into the maven-gae-plugin <plugin> element:


  5. also change gae.version to latest version in pom.xml


  6. In ~/.m2/settings.xml add: (make sure <id>value is equal to <serverId> of maven-gae-plugin in pom.xml)

    <username>google apps account</username>
    <password>google apps password</password>

  7. In the appengine-web.xml under src\main\resources, change:

    value of frontend.url to your GAE application url

    value of frontend.localdomain to your Google Apps Domain

    value of frontend.whitelisting to true

  8. in terminal, go to project folder, run “mvn gae:unpack” to install latest gae java sdk to maven repository
  9. run “mvn gae:deloy”
  10. now maven will download all required plugins, compile project and upload it to GAE
  11. check if it works successfully by login with your Google Apps Account, you can enable accessing accounts in GAE application’s  permission settings

add route and dns for VPN connection in Mac

VPN now becomes a ubiquitous way for climbing over GFW in China. However, once the Mac is connected with VPN and sends traffic thru it , VPN’s dns and route setting will take priority over the default network settings, which sometimes is quite inconvenient for fast accessing local sites and using other dedicated network like ipv6.

There’s a combination of configurations to work around the dns and route table of VPN:

1) when connected to the VPN, in Terminal, use the way described to find which VPN’s dns you want modify

2) in Terminal, sudo vi /etc/ppp/scutil_vpn.txt, add following lines, replace the GUID with your target GUID:

get State:/Network/Service/E6592FF4-8A4F-4C86-B1A2-F865D658D4FF/DNS
d.add ServerAddresses *
set State:/Network/Service/E6592FF4-8A4F-4C86-B1A2-F865D658D4FF/DNS

4) in Terminal, sudo vi /etc/ppp/ip-up,(make it executable), add following lines, and modify the TARGET_IPADDR and MASK of which network subnet you want to go thru the VPN:

/sbin/route add TARGET_IPADDR/MASK $5
/usr/sbin/scutil < /etc/ppp/scutil_vpn.txt

5) install and use dnsmasq to direct wildcard dns resolving for target server names to the VPN dns server

6) in the VPN settings, uncheck “Send All Traffic” box

7) done.

Now when you are connected with the target VPN, you will only go through the VPN to visit target domain names and ip you’ve set, with all other network like ipv6 unchanged. Of course,  the settings could be reversed to send most traffic thru VPN, leaving a few sites accessing locally.

Fix TimeMachine on Buffalo LS-CHLv1

Since Lion, the TimeMachine support on the Buffalo LinkStation LS-CHL v1.0 was broken because the new Netatalk protocol is now used in Lion TimeMachine backup process which is not compatible with the old NAS firmware’s atalk version. With such a long time passing, Buffalo only updates a few products’ firmware (including LS-CHL v2.0) to support Lion’s TimeMachine, and leaves a lot of old NAS model unsupported. And according to this thread, there WILL NOT be any official firmware updates for my LS-CHL v1.0 in the future.

However, as user boing in the previous forum thread suggested, it could be done by self installing new netatalk protocol to your old NAS device. After two days of configuring, now my old LS-CHL v1.0 could successfully backup my MBP now. Here’s the detail steps:

1) use acp_command to allow telnetd on the LinkStation device, logon to it under root user

2) ipkg update, ipkg upgrade, and then ipkg install netatalk protocol, which should be version 2.2.0-2

3) stop old default atalk service by: /etc/init.d/ stop, and killall cnid_dbd and cnid_metad service

4) copy old /etc/atalk/*.* to /opt/etc/netatalk/, but don’t overwrite new installed uams folder (before copy, backup the new installed ones for reference if you wish)

5) remove .AppleDB .AppleDesktop .AppleDouble in the root folder under your time machine backup volume, the new cnid_dbd service will recreate these database upon the first access

6) modify file AppleVolumes.default, find the time machine backup volume line, append “options:tm” to it

7) modify AppleVolumes.default, afpd.conf, netatalk.conf to change MAC_CHINESE_SIMP to MAC_ROMAN if these ones contain such localization encoding before

7.5) because I use guest account to access NAS time machine volume, new in afpd.conf is added but not used and tested actually, try use old firmware’s uams if logon to your network volume fails

8) start /opt/sbin/cnid_metad , /opt/sbin/atalkd and /opt/sbin/afpd service, now TimeMachine on your mac should work to connect your old friend NAS backup volume. Try do a backup first, as the Lion will update the old backup sparsebundle a bit, and you could enter into the new Time Machine with all your old data out there!

9) if you want linkstation to have boot time new afp service, modify /etc/init.d/, copy or create symbolic link to use new installed atalk ones

10) if TimeMachine won’t connect but prompts you “must create new backups” dialog, try this method , it takes several hours but works.

It’s a bit tedious to figure out all the configure steps after trying with several different time machine failures, but it’s not so complicated after all, requiring no recompilation or coding. It’s a REAL SHAME for Buffalo to abandon its longtime users without giving any efforts and notice.

sunpinyin compile problem in Lion 10.7

Just encounter some build problem in 10.7 with latest sunpinyin git:

1)when compiling xib there’s a warning says TableViewColumns identifier expects NSString in 10.7, it could be fixed by manually set the TableViewColumn’s identifier to a string in Interface Builder. And note: manually set the english version xib, the zh_CN version will be auto generated

2)an build error suggest cp’s usage: in the build phrase, add quotation mark with the directory part, there could be space in the path

p.s. the diff file for the changes is here

Fix QSB Freeze with Lion

Google Quick Search Box will freeze in OS X Lion and alloc huge memory if you input long words in search box. Only forcing to kill the QSB process could free up the memory, which makes QSB almost unusable in Lion.

After a few trials and thoughts, I found that the issue seems related to spotlight integration, which is apparently upgraded in Lion. Try to deselect spotlight results and disable spotlight plugin in QSB preference to work around it.

Works for my QSB and freezes no more.

Lion Upgrade Issues

  1. Missing ~/Library folder in Finder: Use “chflags nohidden ~/Library” in terminal to show it back
  2. QSB huge memory alloc bug for more than 4 words input: NO FIX yet, disable spotlight plugin to work around
  3. XCode 4.1 launch crash: install standalone iTunes 10.4 after install XCode 4.1
  4. 3 finger swipe crash chrome/terminal/…: remove AirKeysInputManager.bundle from simbl, upgrade betterTouchTool to support customizable Lion multi-touches
  5. No Trim support for 3rd party ssd: Use Trim Enabler 1.2 to re-enable Trim support for SSD in Lion
  6. Alt+up/down doesn’t work any more to switch Spaces, now Mission Control only have left/right horizontal Desktops, which is ridiculous and lousy for switch more than 2 desktops; Workaround: arrange common applications to Desktop 2 so that only one left/right switch is needed for most used 3 desktops, alt+number to direct jump
  7. Time Machine backup with link station is BROKEN because Lion use new netatalk 2.2 and new security protocol. No quick fix seems to come from Buffalo 🙁 A firmware 1.53beta upgrade is provided by Buffalo to fix TimeMachine backup issue, but it’s only for LS-CHL-V2, the CHL revision 1 seems no quick fix before September! Wait Again!
  8. Preview constantly crashes upon launching if some folder in home folder is a symbolic link to external hard disk folder; remove the symbolic link, relaunch preview(won’t crash now), and relink the symbolic link, preview will work since then.
  9. Autojump broken in Terminal: Fix by replacing line 47 in autojump.bash with


  10. TextEdit also keeps crash upon launching: Same issue with Preview, remake downloads symlink will fix it.
  11. Full screen apps doesn’t support second display. Only the primary display could show the apps in full screen mode leaving other displaying only blank linen. And because the system menu bar is also on primary display, some functions are also hard to use for app maximized window on second display. Workaround: use this hack for opening another app in full screen as well as REMEMBER the keyboard shortcuts!
  12. VMWare Fusion 4 introduce its bluetooth and broke previously self-customized bluetooth broadcom driver, now only usable in client windows system booted when bluetooth is turned on OR check share bluetooth device with windows, otherwise,  even though device manager has one bluetooth device listed, the broadcom bluetooth software won’t recognize it either.

fix adium spotlight log search

For Adium 1.4.2, the chat transcript log doesn’t appear in spotlight search result even though the word is exactly in the chat logs. Yeah, it’s no big deal, but a bit annoyance, especially when Adium’s own transcript search won’t return good results.

After some research, a few tryouts were taken: Using mdimport to force spotlight reindex the logs folder seems not work. Followed instruction of this ticket to move the chat logs folder to user documents folder, still not work. Then, this ticket has the culprit bug revealed. The
GetMetadataForXMLLog function doesn’t handle the chatlog bundle correctly. Just appending the xml path before parsing the xml file and rebuilding the project will exactly fix the spotlight search issue.

Therefore the reverse steps are the final solution:
1) Get my bug fixed version of AdiumSpotlightImporter (or compile the bugfix version by yourself), unzip and copy to /Applications/, and make sure the importer is used by spotlight in “mdimport -L”
2) Move the adium chat log folder to your documents folder as the above ticket shows, so that spotlight will not exclude it under the system library folder
3) mdimport “your new adium chat log folder” to merge into the spotlight index
4) Search words in spotlight, the adium result now will show in search results under the mail category

Good luck, Adium users!

QSB 2.0.3789 services plugin

It’s quite sad that QSB (Google Quick Search Box) doesn’t update anymore, according to this thread, it goes to maintain mode. QSB is quite intuitive and allows mutlibyte/unicode text input that Quick Silver lacks, and if you have the services plugin to utilize OSX’s services, you can almost do anything with QSB in Mac like with QuickSilver’s plugins. Especially, you can add your custom services with automator and apple script! However, the promised 2.0.3789 compatible services.hgs plugin might not come in a foreseeable future.

Well, Do It Yourself.

Just spent some efforts last week in figuring out how to make the old mkhl plugin to work in QSB 2.0. Although not well documented, QSB service plugin works finally. Thanks to mkhl and qsb-mac’s good coding. You can now download the release version from my following link.  In order to avoid constantly read service info, this plugin load info upon start, therefore restart QSB to load service info if new service is installed.

If you find QSB useful, you may also contribute to it and provide bugfixes. Have fun for the updated services plugin on QSB 2.0.3789!

release version of service.hgs for QSB 2.0.3789

Rar archive in mac finder with automator

用Mac的一个重要麻烦就是zip archive经常在windows下乱码,由于mac采用unicode编码,中文文件名zip压缩文件之后,在采用ansi编码格式的windows上就是乱码,往往无法解压还原。用stuffit,finder自带的压缩,都避免不了这个问题。



for f in “[email protected]
pp=`dirname “$f”`
ff=`basename “$f”`
cd “$pp”
/usr/local/bin/rar a -m5 -ep1 -o+ Archive.rar “$ff”