Posts

Showing posts from 2010

Using calibre-smtp to send emails

calibre-smtp -r smtp.gmail.com --username xxx@gmail.com --password xxx --port 587 xxx@gmail.com xxx@gmail.com Testing -s subject -a attachment

Provide command line arguments in Eclipse

From the main menu, Run -> Run Configuration. Look into the argument tab.

Google translate as proxy server

Type in: http://www.google.com/translate?langpair=en|en&u=www.forbiddensite.com Ref: http://oreilly.com/pub/h/4807

Saving the whole webpage together with links

Scapebook is the Firefox plugin you need to do this.

Display Chinese characters correctly in Kindle 3

To avoid monster characters when using Kindle 3 to read Chinese text, one can change the locale of the kindle as follows. When you are at HOME screen (by pressing the "home" button), type any character on the keyboard to start the search windows. Clear the previous text you typed previously, and then type in ";debugOn" and then hit ENTER. Type any character on the keyboard to start the search windows again. This time, type in "~changeLocale zh-HK.utf8" and then hit ENTER. From the HOME screen, press "Menu" and select "Settings". In the subsequent screen, press the "Menu" button again and select "Restart". You are now all set. P.S. To reverse the change, use "~changeLocale en" in step 2.

Calibre recipe for Ming Pao (明報)

Check here RSS feed for Ming Pao: Headlines: http://news.mingpao.com/RSS/webnews/ga.xml Local: http://news.mingpao.com/RSS/webnews/gb.xml Education: http://news.mingpao.com/RSS/webnews/gf.xml Editorial: http://news.mingpao.com/RSS/webnews/mr.xml Forum: http://news.mingpao.com/RSS/webnews/fa.xml China: http://news.mingpao.com/RSS/webnews/ca.xml World: http://news.mingpao.com/RSS/webnews/ta.xml Finance: http://news.mingpao.com/RSS/webnews/ea.xml Sports: http://news.mingpao.com/RSS/webnews/sp.xml Film/TV: http://news.mingpao.com/RSS/webnews/ma.xml Supplement: http://news.mingpao.com/RSS/webnews/ja.xml English: http://news.mingpao.com/RSS/webnews/em.xml

Download mms stream in Ubuntu

Try msdl introduced here . Example: msdl -s 10 -r 00:20:00-00:59:58 rtsp://59.188.18.228/rthk/201009/radio1/23/2010092322.ra msdl -s 10 -r 00:20:00-00:59:58 mms://202.177.192.111/rthk/radio1/20110901/2011090122.asf

Rotate both screen and touchpad at the same time

This seems to offer a complete solution.

Install JOGL on Ubuntu 10.04

Basically follow the instruction here . The Java install path is changed to /usr/lib/jvm/java-6-sun-1.6.0.20

JOGL and JNLP useful tips

To have JNLP apps using JOGL to work properly on all operating systems (Windows/Linux/MACOS/Solaris) and CPU architectures (Intel/AMD), one needs to offer the native libraries of all these possible combinations. An example is at here . To have the native libraries (offered in the form of jar files from the web) work on the computers, one has to sign all of them. And in the JNLP file, specify you want all permissions in the security attribute. A related reference is available here . In case you use all-permissions security setting, you need to move all the jar files to be downloaded into one single URL. See here . The use of native libraries in Java applet is not recommended. See here .

Play octoshape stream on windows with VLC player

Install windows octoshape plugin at http://www.octoshape.com/files/octosetup.exe Install VLC player at http://www.videolan.org/vlc/download-windows.html . Use the installer so later octoshape can pick it as the preferred player. (Updated 12/26/2010: A dirty way to make sure windows associate all media files to vlc player is to explicitly set in vlc's Tool -> Preferences -> Interface -> Set up associations, select all file types. Then in Octoshape Settings (right click on the Octoshape system tray icon and select Settings), select use "System player") Create a bat file named stream.bat. In Windows XP, type in the bat file. "C:\Documents and Settings\ [user]\Application Data\Octoshape\Octoshape Streaming Services\OctoshapeClient.exe" -url:[octostream] In Windows Vista/7 "C:\Users\[user] \AppData\Roaming\Octoshape\Octoshape Streaming Services\OctoshapeClient.exe" -url:[octostream] Replace [user] with your current user name, [octostream] w

Ubuntu 10.04 VNC Keymapping problem

You may find that if you connect to your Ubuntu 10.04 machine with VNC, the 's' key is incorrectly mapped to initiating the logout menu on the Desktop. The current best solution I can find so far is as follows, adopted from jarondl here . Rewrite ~/.vnc/xstartup as follows: ##!/bin/sh xrdb $HOME/.Xresources xsetroot -solid navy # Choose your color x-window-manager & { (gnome-panel 2> /dev/null &) } xterm &

Persona and Silvermel/Charamel living together in Firefox 3.6

Starting from Firefox 3.6, the Persona addon is installed by default. However, instead of an extension, it is now a theme, sitting in parallel to Silvermel/Charamel. This means you can either use the Silvermel/Charamel theme, or the Persona theme. You can't use both together as when you use Firefox 3.5 or before. To fix the problem, you can first uninstall the Persona extension, and then reinstall it from Mozilla addon site (The most recent 1.5.2 version doesn't work, install some older version instead). Finishing these two simple steps, you can enjoy the benefit of both Silvermel/Charamel and Persona at the same time once again.

CImg with Linux

Image
To build applications using CImg library in Linux, you need to link the pthread and X11 library. Otherwise you'll get a bunch of link errors as follows: ./main.o: In function `cimg_library::CImgDisplay::screen_width()': /usr/include/CImg.h:6659: undefined reference to `XOpenDisplay' /usr/include/CImg.h:6663: undefined reference to `XCloseDisplay' ./main.o: In function `cimg_library::CImgDisplay::screen_height()': /usr/include/CImg.h:6678: undefined reference to `XOpenDisplay' /usr/include/CImg.h:6682: undefined reference to `XCloseDisplay' ./main.o: In function `cimg_library::CImgDisplay::_handle_events(_XEvent const*)': /usr/include/CImg.h:6717: undefined reference to `XUnmapWindow' ... To do this in Eclipse IDE (which automatically generates the makefile for your programming project), from the main menu, go to Project -> Properties . Then follow the screenshot below for the setting.

RTHK Octoshape Streams

NOTE: As at Aug 2015, the octoshape streams of RTHK have been shut down. Please visit  here for the replacement m3u8 streams instead. You need to specify the stream locators if you run the octoshape client separately. (For example, if you run Linux, you can't invoking the program from the RTHK live broadcast pop-up window in the corporate's web main page. You can only type in command line > ./OctoshapeClient - url: [stream_locators] Replace [stream_locators] with the media you want: RTHK Radio 1: rthk.ch1 RTHK Radio 2: rthk.ch2 RTHK Radio 3: rthk.ch3 RTHK Radio 4: rthk.ch4 RTHK Radio 5: rthk.ch5 RTHK PTH: rthk.ch6 RTHK Live TV: rthk.livetv RTHK DAB31: rthk.ch31 RTHK DAB33: rthk.ch33 RTHK DAB35: rthk.ch35 Remark on Mar 25, 2010: In Linux, if you start the octoshape client by the command line > ./OctoshapeClient Then webpages which has octoshape stream available in Flash (e.g. The RTHK Radio Live Player ) will be played properly. P.S. RTHK TV str

Can't switch input method of gcin in Ubuntu 9.10

If you would like to use cangjie (倉頡) input method but often don't know the full input codes for words, probably you will find gcin the best Chinese input method for Linux Desktop. First it supports * wildcards as in the counterpart in Microsoft Windows. Second it allows words so typed to turn to simplified Chinese automatically. However, in Ubuntu 9.10, the installed gcin may not allow you to switch between input methods. The solution that works with me is as follows: Remember to type sudo im-switch -s gcin so gcin starts when boot. Open the corresponding config file. One can do it in command prompt, by typing in sudo pico /usr/lib/gtk-2.0/2.10.0/immodule-files.d/gcin.immodules Change the line "gcin" "gcin Input Method" "gcin" "/usr/share/locale" "*" to "gcin" "gcin Input Method" "gcin" "/usr/share/locale" "" Reboot the machine More information about the problem and the solution c

Even better gnome customization for netbook

Image
Use Gnome Color Chooser . There you can Reduce the size of the icons in the application menu. So the menu space can fit in more applications. Change the font color of Desktop icon, so as to fit the color pattern of the background (for example, you may wish a black instead of the default white Desktop icon font to fit a white background).

Finally fitting gnome deskop on netbook small screen

Image
Finally I get a nice Gnome layout on my netbook of resolution 1024 x 600 by the use of Trebuchet MS font (require sudo apt-get install msttcorefonts ) size 9 extensively in System -> Preferences -> Appearance -> Fonts (this one still looks nicely even when it is as small as size 9). removing the default panel on the top (by right-clicking on the empty space of the top panel and selecting the appropriate option), putting icons and shortening the date/time display (also by right-clicking on the empty space of the panel to add back, move and customize elements) P.S. To get even better Tahoma fonts used in Microsoft Windows Standard Theme ( ref ), one can do the following: Install Wine In command prompt, type mkdir ~/.fonts Copy the fonts to user .fonts directory: cp /usr/share/wine/fonts/tahoma* ~/.fonts Change the font size to 8