Trying out Ubuntu 9.10

This post was imported from my old blog “Tux Wears Fedora” on 2010-09-28. Some stuff in this post may be broken, please leave a comment if you see any, then I will try to fix it.
I am using Ubuntu 9.10 right now, next to my laptop. The installation was easy, it only took up to 20 minutes to do first boot. But after that, I hit two problem.

First one, once again, NetworkManager, a bug. So I used pppoeconf to do the job. Commandline tool is more reliable. Second, my video driver, nVIdia 96 series. I guess this video card is really too old, GeForce4 MX. I had to manually setup a modeline, or my X would be stuck in 640480 (Correct one is 16801050), even worse than open source driver. These two are the problem I had had so far.

I actually had tried to resolve this resolution problem, but last time with 9.10 RC release. I enabled the restricted driver and ran nvidia-xconfig. I got Out-of-range message from my LCD monitor, I stuck. I think I was even trying to switch vc1, though I had no idea if there are virtual consoles available. I just quited. This time, I tried to get into runlevel 3. Well, I ended up with uninstalling gdm, no kidding! I tried to disable gdm from bringing up at booting with update-rc. However, it just didn't want to leave me, how sweet? (If you know how to correctly temporarily disable gdm or how to boot into so-called runlevel 3, please enlighten me!)

Anyway, un-installation did the trick. I fixed the resolution problem in console, then got into X and re-installed the gdm. The Visual Effect also works after I fixed the resolution.

I think I am going to use this new install for some of my daily routine until I get sick of it. I would be using it in a different way, I won't touch Terminal as much as I can, unfortunately, I already did. Work-out-of-box with GUI? In your dream only if you are lucky.

I have to give Ubuntu's graphical design a thumb up, the icons in notification area are simply elegant, same color scheme. And the notifying popup is already a well-known feature (I think it's been out for a least a year).

indicator

Its indicator-applet (the one with mail envelope icon) and indicator-session-applet (the one with your username on it) are quite interest, it can merge with some other program, e.g. Empathy. When I close Empathy, I tried to search for a new icon in notification area, but I couldn't find one. I thought I might accidentally end it because I wasn't familiar with it. But it actually is in the two applets. You can bring it back from indicator-applet and change your status to away from indicator-session-applet. That makes perfect sense, just need to get used to this new way.

empathy-in-applet

The login screen of gdm is definitely beautiful. But the entire Ubuntu scheme seems to be slightly dark. Wine rosy color. I wish it could be more cheerful. The sound effects are great, too. The logging sound and the popup/warning sounds are cute in my opinion.

Currently, it runs well. The memory usage is quite low, less than 200MB when I just boot it up and the boot time is about 45 seconds to the desktop without counting password typing time. I am satisfied with the performance and the result of install. You would be more happier with Ubuntu 9.10 if you have the better hardwares than I have.

Annchienta Fall Of Imiryn

This post was imported from my old blog “Tux Wears Fedora” on 2010-09-28. Some stuff in this post may be broken, please leave a comment if you see any, then I will try to fix it.
Fall Of Imiryn is the name of the RPG game and Annchienta is the game engine it uses. The game is written in Python and the engine is written in C++ with Python binding. It runs on Linux and Windows. The installation process is easy (I use Gentoo), you only need to follow the steps on the web pages. If you don't want to install the engine on your system, simply copy the shared library (src/_annchienta.so) and Python binding module (modules/annchienta.py) to Fall Of Imiryn's directory and run the game.

I knew this game via a post on Arch Linux forums, the poster has put it in AUR. It's not a long story game (rev903). I posted it because it's written in Python. Here is some screenshots:


 Story begins...

 
Scene Transition

 
Heal and save point

 
In-game small game

 
Alright, you caught me cheating!

The story is quite short (if you cheat). I don't think this game is near completion because you can not have any real settings to set, such music/sounds on/off. But it's definitely playable.

Since it's written in Python, I believe it's easier to work on if you want to join the development. The default screen size is 400x300, but you can double it or more if you edit the source. I am not a gamer, so I couldn't give any comparisons. I have to disable the music and sounds, I am not used to listen to all RPG games' music. (for f in music/*.ogg ; do cp /path/to/blank.ogg $f ; done, if you wonder how I disable the music and sounds.)

Lastly, let me give you few memorable quotes (revealing by selecting):
Avril: What the fuck?!
March: Avril, language.

Avril: Yeah right, you fucking monster! You cannot treat Laustwan like that. If this is the way of the Fifth Guard, then it you can stick it right up your...
March: Avril, language.

Avril: What the fuck are you talking about?
March: Avril, language.

Add a Halloween tux to your page and Happy Halloween!

This post was imported from my old blog “Tux Wears Fedora” on 2010-09-28. Some stuff in this post may be broken, please leave a comment if you see any, then I will try to fix it.
I changed the background color and add a random scariest tux icon on this blog for Halloween. (Any for Tuz?)

If you like the icon, you can put on your website by adding:
<script src="http://sites.google.com/site/livibetter/blog-files/hallotux/hallotux.js?attredirects=0&d=1" type="text/javascript"></script>

Happy Halloween!

Note to myself: old background color code is #072a60.

Imaginatively Fly To The Infinite Possibilities

This post was imported from my old blog “Blogarbage” on 2010-09-28. Some stuff in this post may be broken, please leave a comment if you see any, then I will try to fix it.
Imaginatively Fly To The Infinite Possibilities

Just a photo if it is without an actual action when taken

Within our brain, we can imagine, create a fictional memory,

or revenge what someone did to you long time ago

In the end, nothing of them would be real

They would never come to this bloody world

Only remain inside, ridiculous dreams





Why so negative?

Because you forget to open the window (Ouch!), and

you also forget you can not really fly (Belief is not enough)

Unless... you were a superman!



:-)

pxss.py: Pure Python to access libXss via ctypes

This post was imported from my old blog “make YJL” on 2010-09-28. Some stuff in this post may be broken, please leave a comment if you see any, then I will try to fix it.
pxss.py is a replacement of PyXSS/src/__init__.py, but not entire PyXSS. You can have IdleTracker, XSSTracker, and get_info(), and that's all.

It accesses libXss.so via ctypes. You only need to put it with your script without installation or compilation.

A quick example of getting the idle time:
import pxss
print pxss.get_info().idle, 'ms'

The get_info() returns the same data as in PyXSS.

If you have another display, you should be able to pass it (after you open it) with other necessary variables to get_info():
def get_info(p_display=None, default_root_window=None, p_info=None):

and get the XScreenSaverInfo.

I made this is for my another helper script, its quality is very poor. If you are interested in ctypes, this script might give your some ideas. But this is only my second time to use ctypes. My first time was on Windows for accessing GDI+.

If Synaptics Touchpad auto-disable/enable udev rule fails

This post was imported from my old blog “Tux Wears Fedora” on 2010-09-28. Some stuff in this post may be broken, please leave a comment if you see any, then I will try to fix it.
I have been using a udev rule to detect external mouse's pluging/unpluging, then based on the information to disable/enable the touchpad. The manual command is:
$ synclient TouchpadOff=0 # or
$ synclient TouchpadOff=1

It didn't work for months, the message from udevd looks like:
[5486] util_run_program: '/usr/bin/synclient TouchpadOff=1'
[5486] util_run_program: '/usr/bin/synclient' (stderr) 'Failed to connect to X Server.'
[5486] util_run_program: '/usr/bin/synclient' returned with status 1

I finally decided to look into it. I didn't track synclient's updates, but I guess some time ago, it began to use device properties by default, instead of SHM.
$ synclient 
Usage: synclient [-s] [-m interval] [-h] [-l] [-V] [-?] [var1=value1 [var2=value2] ...]
-s Use SHM area instead of device properties.
[snip]

So, you need to use -s if you need to control the touchpad parameter from the user account other than the one runs X Window via SHM (You need SHMConfig to be enabled, read the post below via link), says root account if your udevd is run by root.

It's easy to fix your rule, just put -s on. I have two lines in /etc/udev/rules.d/99-synaptics.rules:
ACTION=="add", SUBSYSTEM=="input", ENV{ID_CLASS}="mouse", RUN+="/usr/bin/synclient -s TouchpadOff=1"
ACTION=="remove", SUBSYSTEM=="input", ENV{ID_CLASS}="mouse", RUN+="/usr/bin/synclient -s TouchpadOff=0"

Easy to fix, but it took me months to do it.

PS. If you are also interested in using HAL to set up touchpad parameters, please read my old post, Proper way to turn on SHMConfig in X Server 1.5 with input hotplugging.

Let It Snow!

This post was imported from my old blog “The B Thing” on 2010-09-28. Some stuff in this post may be broken, please leave a comment if you see any, then I will try to fix it.
Almost a year ago, I posted a post about how to add falling snow script on my another blog (I didn't create this blog yet).



This year, I pulled the time ahead for another month. I added four buttons that you can more easier to add on your Blogger blogs.

Choose one you like to put on your Blogger blogs.

Collecting Snow + Snowman


Collecting Snow + No Snowman


Non-Collecting Snow + Snowman


Non-Collecting Snow + No Snowman


You can read more about the scripts or the raw HTML code at that post.

Favorite Music of Blogger Profile

This post was imported from my old blog “The B Thing” on 2010-09-28. Some stuff in this post may be broken, please leave a comment if you see any, then I will try to fix it.
I have been wondering how I could edit my favorite music section in my Blogger Profile. One good way may be the Last.fm's top tracks feed.



It's an XML feed (e.g. my overall feed), you need to process it. An easy way is to use XSLT processor, xsltproc, you should be no big deal if you are a Linux user.

Linux User (Mac also?)

I have already written a Bash script and a template for use.

Please download lastfm-tracks.sh and lasfm-track.xslt.

Put them together and run the script, you will get something like:
$ ./lastfm-tracks.sh
Your Last.fm username: livibetter

Choose type of your tracks:
1 - Last 7 Days
2 - Last 3 Months
3 - Last 6 Months
4 - Last 12 Months
Other - Overall

Select?
--2009-10-24 16:24:37-- http://ws.audioscrobbler.com/2.0/user/livibetter/toptracks.xml
Resolving ws.audioscrobbler.com... 195.24.233.55
Connecting to ws.audioscrobbler.com|195.24.233.55|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/xml]
Saving to: lastfm-tracks.xml

[ <=> ] 37,546 33.3K/s in 1.1s

2009-10-24 16:24:40 (33.3 KB/s) - lastfm-tracks.xml saved [37546]

===== BEGIN =====
Lebe lauter, Fieber, Das Beste, Optimist, Ohne Dich, Meer sein, Misery Business, Nie genug, An Sommertagen, Augenblick am Tag, Mitten unterm Jahr, That's What You Get, Come to your senses, Ich wünsch dir was, Ich Lebe, Anders, Revolution, Stupid for You, Free Loop, Engel fliegen einsam, Spell, Umbrella, Traffic, Orchester in mir, Reine Nebensache, Seite Eins, Nie zu spät, Better Off Alone, Scherbenmeer, Geile Zeit, Warum, Wenn die anderen, Glücklich, Voice on the Radio, Regen und Meer, Nein danke, Dieses Leben, Ich verschwinde, Zu Weit, Sonne hinter dem Nebel, So Wie Jetzt, Das Ende vom Kreis, Say It Again, Unendlich, Unsere besten Tage, Um bei Dir zu sein, In Zeiten wie diesen, November, Unfold, Kurz vor der Sonne
====== END ======

You can also open the result text file lastfm-track-result.txt.

I don't know if Mac user have xsltproc or not, I believe it has. Mac has no problem with shell script, this should also work.

Windows User

Please follow the instructions in this page, Installing an XSLT processor. I didn't try it.

Once you install it, you should be able to use it. You need to manual download the feed from Last.fm and run this command with the XSLT template alongside:
xsltproc lastfm-tracks.xslt DOWNLOADED_FEED.xml

Final Note

If I wrote it in Python, there should not have much problem and could have a GUI, but I don't think it's worth. I want to make it fully automatic not just semi-automatic. But I also need Blogger API to support Profile update, unfortunately, it doesn't support that at this moment. I am not sure if it will in future. I don't want to trick Blogger, which means simulating your editing in that page.

There is also a other sections like movies and books, but I don't know any websites provide similar feed as Last.fm do for music.

Auto away in CenterIM in X Window

This post was imported from my old blog “Tux Wears Fedora” on 2010-09-28. Some stuff in this post may be broken, please leave a comment if you see any, then I will try to fix it.
If you already are a CIM user, you should know CIM support Auto away after some idling time. The setting looks like:

 Auto Presence 
Automatically set Away period (min) : 0
Automatically set N/A period (min) : 0
Automatically set N/A when screen is detached : no

However, you should also know, it only detects the activity within that terminal window/virtual consoles, your activity in X would not be detected.

My first thought is to use xautolock, but it only lets you run a program when idling time reach a threshold. If you move your mouse or type something, there is no way that xautolock runs another program after resuming activity. You have to manually set the status back to online or something else in CIM.

XSS binding

You need PyXSS or pxss.py

PyXSS

So, I thought I should tear the code and make it to do what I want. Thank God I didn't! Because I found a Python library, PyXSS. It's quite old, but it's operable. It relies on XScreenSaver extension, you need it with your X. The version I use is 2.1, there is problem with it. Its setup.py didn't work at some point.

Find this line:
setup(name='PyXSS', version=2.1,
And change to (make the version number to be string type)
setup(name='PyXSS', version='2.1',

python setup.py install should install PyXSS normally.

pxss.py

It has similar functionality to PyXSS but you don't need to install it, just put it with CIM_status_setter.py. It accomplishes same tasks using ctypes.

CIM_status_setter.py

So, I used PyXSS or pxss.py to write a Python script, CIM_status_setter.py. I have to say this not the best way, because if you write in C, it will use less memory.

I am not going to explain the Python code. I just tell you how to use it. Once you run it, it shows you:
Keys
h - Show help
* - Detect idling
o, _, a, d, n, c, f, i - Change status
[*][o] Online Welcome back!

Detect mode

If you press *, then it will be activated the detect mode, which is the whole point. It's turned on by default and the idling time is 300 seconds. Five minutes without activities, it will ask CIM to change the status to Away for MSN and Jabber protocols. You can see the protocols or idling you need in that script, no command-line options or configuration file, sorry!

If you move mouse or type something, it should be asking CIM to change to Online in a few seconds.

Note that the status only goes back and forth between Online and Away in Detect mode.

Fixed status mode

If you press o (Online), d (Do not disturb), etc., it sets status to what you want. The keys are the same you see in CIM's status menu.

Note that entering Fixed status mode disables Detect mode. You have to press * to go back to Detect mode.

GNU/Screen

I believe many of CIM users, run CIM within Screen to prevent accidentally terminal window closing. You can create a new configuration file for CIM and this Python script.

For example, a configuration file called ~/.screen_centerimrc:
source $HOME/.screenrc
screen centerim
screen CIM_status_setter.py
select 0
Make sure the script is in your PATH or use full path, it also sources your original Screen configuration.

I use FluxBox, so I have this command in my menu:
urxvtc -title centerim -e screen -c ~/.screen_centerimrc

urxvtc is a client program for URxvt daemon. You can use urxvt or the terminal emulator you use but you have to check man page for a equivalent -e option.

Final Notes

This script was written in rush. It is not perfect, feel free to tweak it. One more thing, CIM doesn't update it's screen if you just send a status change to it. You need to resize the window to force redraw screen (Ctrl+L doesn't work) to make sure you read correct statuses on top-right corner.

After I finished, I realized there is no need to use thread. But you know, I am lazy!

The new version does not use thread anymore and it updates your terminal's or screen's window title.

Updated on 2009-10-27: Added pxss.py information and the updates of script.

Calling Wendy

This post was imported from my old blog “Blogarbage” on 2010-09-28. Some stuff in this post may be broken, please leave a comment if you see any, then I will try to fix it.

I was listening to my music library, one song caught my ears, Falling from Broken Lullabies by Calling Wendy. The whole album is free for download on Last.fm, but I had only that song. I must have listened to that sometime ago on Last.fm and I downloaded. Sometimes, you dug out good stuff from things you already have.

They are from Canada and indie, I like their music style and the following tracks from the album:
  1. Tennessee
  2. Just For A While
  3. You Make Me Whole
  4. William
  5. Take A Look Around
  6. Falling
By the way, this album has six tracks. :-)

Consequence of forgetting to close your bedroom door

This post was imported from my old blog “Blogarbage” on 2010-09-28. Some stuff in this post may be broken, please leave a comment if you see any, then I will try to fix it.
What is the consequence of forgetting to close your bedroom door?

The answer is:
Hey! I got your pillow!

A cat lays prone or sits on your pillow! Not your bed!

Two more photos:
It's mine!

It's my pillow! haha!

He is good!

First time Gentoo profile upgrading

This post was imported from my old blog “Tux Wears Fedora” on 2010-09-28. Some stuff in this post may be broken, please leave a comment if you see any, then I will try to fix it.
I just synced my Portage database and wanted to upgrade packages, then I got a nice message about my /etc/make.profile  (was linked to /usr/portage/profiles/default/linux/amd64/2008.0) is deprecated.

!!! Your current profile is deprecated and not supported anymore.
!!! Please upgrade to the following profile if possible:
default/linux/amd64/10.0

To upgrade do the following steps:
# Check 'eselect profile list'.
# Find the number that corresponds with the default/linux/amd64/10.0 profile.
# Use 'eselect profile set <number>' to set a new /etc/make.profile symlink.
#
# Reference: http://www.gentoo.org/doc/en/gentoo-upgrading.xml
# See: "General instructions" in Section 3. "Profile updating instructions"#

So I checked up the document, and set to the new profile. And I think that's all.

Kind of boring... I was expecting something tough tasks to accomplish! Come on, break something! Just kidding! :-)

Blit cursor in Matplotlib

This post was imported from my old blog “make YJL” on 2010-09-28. Some stuff in this post may be broken, please leave a comment if you see any, then I will try to fix it.
I have been writing a program to show quotes from Yahoo Finance service. After a few searches I know Matplotlib has matplotlib.widgets.Cursor to do the task, here is the example code. It's not a the kind of cursor we want, the cursor in such program must to snap its horizontal line to the price in figure.

So this snap version example could fit the need. This cursor manually draw the cursor. It works fine if your figure only have one or two data lines. If you use something like matplotlib.finance.CandleSticks, which plot many things on your figure. You will see the lag of movement of your cursor.

The first example has a way to deal with that, it's called Blit, you can read more about it at this page. Basically, you save the rendered image, every time you need to draw your cursor, you restore that saved image, then you draw your cursor. That would save a lot of time. There is a another example code for Blit.

I wrote my own example, you can read it here. A quick screenshot:


<a name="Damn">Blogger Drives Me Crazy!</a>

This post was imported from my old blog “The B Thing” on 2010-09-28. Some stuff in this post may be broken, please leave a comment if you see any, then I will try to fix it.
If you know about HTML, you probably had use:
<a name="Damn">Blogger Drives Me Crazy!</a>
blah...
blah...
<a href="Damn">Go to Blogger Drives Me Crazy</a>
blah...
blah...

So the code above provides a in-page link. I tried to write a blog posting with that, Blogger's Compose mode made me crazy!

You have to enter the HTML code name="Damn" in HTML mode, that would be fine as long as you don't switch back to Compose mode. If you do, your code will be inserted with new attribution href and a link will be assigned to it. That wasn't the result you would like to see.

So basically, you must stay in HTML mode. However, sometimes, WYSIWYG is too convenient. Even you are a HTML nuts, you may accidentally switch to Compose mode. If your page is still Draft, God bless you! Your code has been messed up! Because of autosave.

So, I go back to Google Docs, I had been using it to write a while ago. The only problem with it is the images. I used to compose in it, then paste into Blogger's edit and inserted the photos.

Obviously, this will not be working this time.

So, I put image in Google Docs and modify the code to make it hotlink to Google Docs' server to serve images.

Here is the steps:
  1. Edit your document in Google Docs
  2. Copy HTML code from Edit/Edit HTML
  3. Use a editor can support regular expression replacement. I use Vim. After the HTML in VIm, type :%s_"File_"http://docs.google.com/File_g
  4. Paste the modified code to Blogger's editor. Don't switch to Compose mode.
This is terrible, just for name attribution. But I really don't know if there is a better way to do this. However there is a benefit of using Google Docs to do such task, it's easy to maintain those links (Bookmarks in Google Docs), you don't have to type those anchor names, you can choose from list. No typos any more.

What I Run

This post was imported from my old blog “Tux Wears Fedora” on 2010-09-28. Some stuff in this post may be broken, please leave a comment if you see any, then I will try to fix it.
(Updated on 2009-11-28)

This is a page lists programs I use in regular basis, quick introductions, and why I use them.

Download (BitTorrent) rTorrent

Many distributions has Transmission as default BitTorrent client, but I never like it. I guess using rTorrent with GNU/Screen or tmux to allow me to log out completely makes me like rTorrent more.

Download (General) wget

I don't have a download manager and sometimes I even copy links from Firefox if I need to download tarballs and, type wget and paste the links to download the files in terminal window. Some people might prefer cURL but I like wget better because you can type it with only your three fingers left hand if you can do blind typing. The keys of cURL span over three rows and needs two hands and four fingers. If you were not, then it didn't matter. This sounds like a funny reason, but it's true, I do like how I type the command.

File Manager Midnight Commander


Midnight Commander 4.7.0-pre1

When I turned into a CLIsm/TUIsm (alright, I just made up the word), I had tried to find a simple GUI file manager first to replace Nautilus. I had try PCManFM, Thunar (From Xfce), gentoo (Not to confuse with Gentoo Linux), emelFM2, and ROX-Filer, none of them I could be used to use. Nautilus is good file manager, I like the preview of media files. But I had a feel that I need to use something else. Finally, I tried Midnight Commander. I didn't like it at first, but soon I adapted. It's a two-pane design, you can customize either or just use one. After a while of use, I had been familiar the workflow, the keys, and configuration. I had written a paragraph about the use in my other post.

Image Editor GIMP

I am no graphical designer, actually, I have no artistic sense. I just need a program to do basic editing, and GIMP is the one.

Image Viewer Feh, Geeqie

I used to use Eye of GNOME or gThumb to view images. I now use Feh, it runs faster. A commenter recommended Geeqie (a fork of Gqview), so I tried it out and it works nice, I used it to view raw images.

Instant Messaging CenterIM, Pidgin



CenterIM 4.22.7-r1 in GNU/Screen

I had used Pidgin, aMSN, and few others. Pidgin is still the generally best choice for Linux if you need GUI. I am a fan of CLI/TUI, CenterIM is the only program I know. I have written about notification.

I still used Pidgin, but very rarely.

Last.FM Shell.FM, mpdscribble


Shell.FM 0.6

Shell.FM is a client for Last.FM, easy to use once you learn the keys. You can read my configurtaion file in this post.

I had written a C code, conky-shell-fm.c, to feed Conky for showing the current song information. mpdscribble is a scribbler for MPD, you run it and leave it. It will automatically submit your current playing song to Last.FM.

I also have a Bash script, mp-ctrl.sh, to control Shell.FM, you can use with your window manager's keybinding, it could also control MPD.

Media Player (General) MPlayer, SMPlayer


I use MPlayer to play media files, sometimes I would use front-end SMPlayer to play.

Music Player (General) MPD, ncmpcpp


ncmpcpp 0.3.5

I began with Rhythmbox (Because it's default on GNOME), then Amarok. I like Amarok and it's the only KDE app I had liked, but I prefer to have something running in terminal. So MPD + ncmpccpp came in place. MPD is a server and ncmpcpp is the client to help you operate. You can still use CLI, e.g. mpc, to run MPD. If you want to control MPD with your multimedia keys, such as Play/Stop, Next. I had made a Bash script, mp-ctrl.sh, to do so, it could also control Shell.FM. I also wrote another script, MPDisp, to show current song and does simple controls in a terminal window.

Office Suite OpenOffice.org


I doubt I need to talk more about this.

Operating System Arch Linux


I started to try Arch Linux since April 2008 and began to know of KISS (Keep It Simple, Stupid), it's really to easy. I used it to run many services, web, name server, even a HLDS. It was fun at that time, but I couldn't stand for the noise from its fan. Believe or not, it only have one fan for CPU, that one annoyed me a lot. I stopped to use it as server after months. I had lots of posts written and hosted on it using MoinMoin, but there were not available since it's no longer running.

Operating System Gentoo Linux


I have Gentoo on my laptop and it's my primary computer. Before I became Gentoo user, I had used Fedora (FC1 or FC2, then F6 to F10), Arch Linux (Since April 2008, I still have it), and Ubuntu (For about one or two months). I used Fedora and Arch Linux as primary systems, and even used them to host my HTTP/Name/game servers. When I was a rookie, I was impressed by it, then I was sure that's it, the best distribution for me. In order to keep reading posts on Gentoo Forum, I even created a feed for better reading.

Operating System Microsoft Windows XP Home

Yes, I do use Windows XP every weekday every week, I installed it on Mac Mini and I don't really use Mac OS X (I thought I would learn some about Mac, so I bought it, but it turned out I didn't use it). I have to run a program which is only running on windows and it's cooperated with Internet Explorer's certification part, it's a trading software. I also need to use smart card to authenticate on online banks to do some transactions, again, they rely on Internet Explorer. Let's why I bought another copy of Windows XP Home. I only need that. I had another copy came with my laptop but it's not allowed to use other than on my laptop.

Program Launcher BashPad


It's quite lightweight program running, it uses Bash plus a terminal emulator, I use URxvt. Some people like gmrun. With Bash, you can do tab-completion or history search as you do in normal shell. Here is my post about it.

PDF Viewer Xpdf

PDF is a popular format, so I need a viewer for it. Xpdf is small and fast.

Shell Bash

It's the only shell I have learned a bit about.

System Monitor Conky

Conky is very important part on my system, I don't have other system monitor program except htop. I need it to know the current date/time, weather, CPU/Memory/Disk/Network status. Also the Portage database's last update, volume, and current playing song in MPD or Shell.FM.

My configuration was generally simple, only show information in text, not images. It's fairly not a fancy one. Just enough to know what I want to know.

Terminal Emulator URxvt (rxvt-unicode)

It's a great terminal emulator. You can also run it in daemon mode, which reduce memory usage if you need multiple terminal windows at the same time. If I recall correctly, Aterm is the one use least memory, but you can't be possible to use only one terminal window. I used to have at least four with GNU/Screen at the same time. In that case, URxvt with daemon mode, it would be more efficient in memory usage.

URxvt supports Xft, you can render text in better way, thought all VTE-based (GNOME Terminal is one of them) support that, too. But VTE-based terminal has a a program, which is when you maximize VTE-based terminal, you could sense the slowness. URxvt has no such problem.

As for URL opening, URxvt has no problem with it (man urxvt and search for urlLauncher).

Terminal Window Manager Tmux GNU/Screen


If you use terminal for most of your time, then you should have already known about GNU/Screen. It helps you manage terminals in one window. You can customize the status bar to show some information like load or time.

The best part of it is even you close the window, you can still restore it. The programs are run with Screen will not be ended.

I have switched to tmux, the best of it is it supports splitting windows.

Text Editor Vim


Some people prefer Emacs, I seemed to run it once or twice after I have learned Vim, and I couldn't use to Emacs because I didn't use the way to control. At beginning of learning, it's not easy, I believe that is the case for every newbies, especially you are used to press Ctrl+C/V. But once you have learned Vim, you would be subconsciously using its way to use other softwares. I had tried to close Firefox few times by typing :q, then wonder why Firefox is still running.

Updates Checker clis



clis in action

clis is a my program, it's written in Python. I use it to be notified new mails in GMail, new entries in Google Reader, updates from whom I follow on Twitter, monitoring (searching) for some keywords on Twitter, updates from any feeds I need to know at real-time, updates on FriendFeed.

Web Browser Mozilla Firefox, Vimperator, Gecko Media Player


Mozilla Firefox is a common web browser. Nonetheless it really uses too many memory, I still couldn't switch to Chromium or Opera because the addons. Especially the Vimperator, it gives you a similar keybindings as you have in Vim. I have a cleaner browser window. There is another possible, uzbl, but I tried to customize it, I failed.

Web Browser Chromium

I have mainly used Chromium (Google Chrome) but I still have Firefox. It is clean and fast. But I still keep using the shortcut keys of Vimperator from time to time, subconsciously, hope there will be a port for Chromium soon.

Window Manager FluxBox

Except GNOME and KDE, I had used Enlightenment for a month or two. But later, I tried Fluxbox, it's lighter than Enlightenment.

Updates:
  • 2009-11-28: Removed GNUCash, added tmux, and removed the TOC.
  • 2009-12-25: Added Chromium.

XDM: This is an unsecure session

This post was imported from my old blog “Tux Wears Fedora” on 2010-09-28. Some stuff in this post may be broken, please leave a comment if you see any, then I will try to fix it.
I had been reading this message after my Xorg and XDM upgraded, This is an unsecure session. I didn't know how to do with it, I googled but got nothing really helpful. I checked the /var/log, somehow I only focused on Xorg.0.log and completely oblivious to xdm.log (I might have eying problem).

xdm.log has pointed out the problem very clear:
xdm error (pid 6186): cannot make authentication directory /var/lib/xdm/authdir: No such file or directory

I didn't have /var/lib/xdm directory, the message was gone after I created that directory.

New Improv Everywhere Musical, Grocery Store Musical

This post was imported from my old blog “Blogarbage” on 2010-09-28. Some stuff in this post may be broken, please leave a comment if you see any, then I will try to fix it.
Just got a entry in Google Reader, hooray! Improve Everywhere just released another musical, Grocery Store Musical. This one is well produced and planned, better sound (the previous one is good still).



And is that girl really pregnant? I didn't read the behind-the-scene post but just searched for that for an answer and I wasn't the only one believed she was, some shoppers even asked about the due date. She could do another IE mission on those shoppers.

But the my favorite one is their first (they only have two so far, please make more Improv Everywhere!), Food Court Musical. Because it's more dramatic and it has a twisted and funny ending.



I wish I can be seeing this kind of thing someday, it's better than winning a billion lottery, okay, maybe not. But it's an experience you could remember for whole life.

Now I am looping these two musicals on my screen.

Yes, We Can Give Them A Napkin!

Cleaning up Firefoxs data

This post was imported from my old blog “Get Ctrl Back” on 2010-09-28. Some stuff in this post may be broken, please leave a comment if you see any, then I will try to fix it.
My Firefox's profile data is really huge, I have two profiles, both are over 100MB. If I switch History tab on and try to search for something, it takes quite a time to get results.



Clear Data



Go to Tools/Clear History, I only choose Browser/Download History and Cache. Don't forget to choose time range to everything.



Delete urlclassifier*



Close all Firefox windows first. It's for blocking phishing sites. There are two files, urlclassifier3.sqlite and urlclassifierkey3.txt,

you can read more about it on MozillaZine Knowledge. (I didn't disable the features but deleted directly and didn't see any side effects.)



After you start Firefox, the file will be recreated but much smaller. However, it grows back quite fast.



Vacuum Databases



Close all Firefox windows first. If you use Linux, you can run the following command to do the job:

for fn in ~/.mozilla/firefox/*/*.sqlite ; do sqlite3 $fn vacuum ; done


Mozilla Link had a comparison before/after vacuum.

Notification in CenterIM

This post was imported from my old blog “Tux Wears Fedora” on 2010-09-28. Some stuff in this post may be broken, please leave a comment if you see any, then I will try to fix it.
You can simply enable sound notification in configuration ~/.centerim/sounds, but I found it's quite annoying when you are currently chatting with someone, and that person's messages also triggers notification sound playing.

I use external actions, ~/.centerim/external, to resolve my issue. Here is my configuration:
%action Notify When Online
event msg
proto all
status online
options stdin
%exec
msg=$(cat)
act_id=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)"| cut -d ' ' -f 5)
xprop -id $act_id | grep centerim &>/dev/null
if [[ $? > 0 ]]; then
aplay -qN /usr/share/centerim/msg.wav
notify-send "$msg"
fi

%action Notify When Not Busy
event msg
proto all
# dnd na invisible
status away ffc
options stdin
%exec
msg=$(cat)
aplay -qN /usr/share/centerim/msg.wav
notify-send "$msg"

You can read the documentation about external actions to know how to write your own. My actions are simple, first one is for when my status is online and currently the activated window is CenterIM. If I am using CenterIM, then I will not hear a notification sound; if I am not using CenterIM say I am using Firefox, then I will hear notification sound.

If your terminal window's title does not contain "centerim," then it may have problem to detect if you are using CenterIM or not. For URxvt, you can run CenterIM using urxvt -title centerim -e centerim to make sure the window's title is set correctly.

I also set up a second action because it's obviously I am not using CenterIM but I want to be notified if someone sends a message to me.

Updated on 2009-10-21: Added option nowait, if without it, the message will wait until the sound being finished played. If you run aplay in background, it has no use because it will be interrupted before it started to play. I guess you have to use nohup to prevent it. nowait could resolve it but a text "No summary specified." is showed up every time, it messed screen a bit.

Updated on 2009-10-24: Use aplay -N, instead

Thoughts from 6-month-old Gentoo user

This post was imported from my old blog “Tux Wears Fedora” on 2010-09-28. Some stuff in this post may be broken, please leave a comment if you see any, then I will try to fix it.
Image Hosted by ImageShack.usI am a six-month-old Gentoo user now! Six month ago, I posted about being a newbie of Gentoo. Now I could say I am happy with my decision of switching from Fedora. Please note that Fedora is a great distribution, I personally think Fedora is better than most of distributionsUbuntu included.

If you know of Gentoo a little more, you should know that it's a source-based management, you install packages (applications) by compiling source code with Gentoo package management program, Portage. It sounds scary whether if you have experience to tar xf program-x.y.z.tar.gz && cd program* && ./configure && make && make install or not. Of course, you wouldn't have to run the command but just run emerge program to compile and to install it. The Gentoo developers have taken care of that for you.

However, at beginning, the effort of using Portage is not as easy as other binary package management distributions. You need to understand your system more and to configure how you want the package being compiled as you do manually. You need to set up /etc/make.conf, which has C(XX)FLAGS, etc. This leads a common discussion: Does -O3 helps in program execution speed? Go google it.

You would also need to edit /etc/portage/packages.*, because sometimes you need unstable packages or you need to specify per package USE flags.

Like other binary package management, you would encounter problems sometimes. Most of them are failure to compile, I had few times. Google gentoo bugs package_name version to see if it's already been reported and also check Gentoo Forums. Sometimes, you resync after, it will be resolved.

How about GCC upgrade? I had done twice and met no problems, one right after I installed Gentoo 4.1.X to 4.3.X, few days ago, 4.3.X to 4.3.4. You only need to follow the manual. If you want to do something, just google. The only drawback of Gentoo that I could think of is compiling time. The last GCC upgrade took me 21 hours to rebuild system + world. Well, it's a trade-off. If every six month to do whole system rebuild, I could accept that.

For some really big package like OO.o or Chromium browser, you could emerge the binary package. Yes, Gentoo provides some binary package, try to append -bin after package name. When I first time to compile Firefox on Fedora, I thought it's a big app. Once you tried OO.o or Chromium, well, you will see what's really called "Big app."

About my environment, XDM > Fluxbox. I don't use GNOME or KDE months before I switched to Gentoo. The only few major GUI apps are Firefox, GIMP, GnuCash, VNCViewer, and OO.o. Firefox runs most of time on my system.


Current desktop

I use Midnight Command to manage files, MPD + ncmpcpp to play music, conky to monitor my system, VIM to edit files, BashPad to launch programs, xrandr to manage dual-monitor, and some self-made scripts to help myself.

I think one of major point of using Gentoo is USE flag, if you have compile a program, you would have known that ./configure --help tells about what kind of features that you can enable or disable. The binary management distributions would probably enable all because they have to meet all of users' needs, therefore, the compiled result would have lots of things you would never need to use or you have no idea there is a such feature. For example, the mplayer,
> emerge -pv mplayer

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild R ] media-video/mplayer-1.0_rc4_p20090919-r2 USE="X a52 aac alsa ass cddb cdio dirac dts dv dvd dvdnav enca encode faac faad gif gmplayer iconv jpeg live lzo mmx mp2 mp3 network opengl osdmenu png quicktime rar real rtc schroedinger sdl shm speex sse sse2 ssse3 theora tremor truetype unicode v4l v4l2 vorbis x264 xinerama xscreensaver xv xvid -3dnow -3dnowext -aalib (-altivec) -bidi -bindist -bl -cdparanoia -cpudetection -custom-cpuopts -debug -dga -directfb -doc -dvb -dxr3 -esd -fbcon -ftp -ggi -ipv6 -jack -joystick -ladspa -libcaca -lirc -mad -md5sum -mmxext -mng -nas -nut -openal -opencore-amr -oss -pnm -pulseaudio -pvr -radio -samba (-svga) -teletext -tga -vdpau (-vidix) (-win32codecs) -xanim -xvmc -zoran" VIDEO_CARDS="-mga -nvidia -s3virge -tdfx" 0 kB

(If you want to know what the USE flags for, just run equery u mplayer.)

With Gentoo, you could turn off those that you don't need and have a cleaner version of programs and environment. This does reduce the flexibility, but you only take time to re-emerge with new USE flags and this kind of change rather happening. It is worth if you do have time.

The other good thing about Gentoo is its tools, for example, eselect, very powerful to customize some settings. Here is a sample of what it can do for you:
> eselect 
Usage: eselect

Global options:
--no-color,--no-colour Disable coloured output

Built-in modules:
help Display a help message
usage Display a usage message
version Display version information

Extra modules:
bashcomp Manage contributed bash-completion scripts
binutils Manage installed versions of sys-devel/binutils
blas Manage installed BLAS implementations
cblas Manage installed CBLAS implementations
ctags Manage /usr/bin/ctags implementations
editor Manage the EDITOR environment variable
env Manage environment variables set in /etc/env.d/
fontconfig Manage fontconfig /etc/fonts/conf.d/ symlinks
java-nsplugin Manage the Java plugin for Netscape-like Browsers
java-vm Manage the Java system and user VM
kernel Manage the /usr/src/linux symlink
lapack Manage installed LAPACK implementations
modules A module for querying modules. By default, it lists all available modules
news Read Gentoo ("GLEP 42") news items
oodict Manage the configuration of dictionaries for OpenOffice.Org.
opengl Manage the OpenGL implementation used by your system
pager Manage the PAGER environment variable
profile Manage the /etc/make.profile symlink
python Manage the /usr/bin/python and python.1 man symlinks.
rc Manage /etc/init.d scripts in runlevels
vi Manage /usr/bin/vi implementations
visual Manage the VISUAL environment variable

Gentoo is easy to maintain if you are willing to pay time first to learn. I don't know if it's still easy if you use GNOME or KDE, but I am sure it is if you use other DE or just window manager because you would know your system and each configuration better. I can do everything and even more and know better. For example, I didn't know gmplayer had ceased development when I was using Fedora, but I knew it after I emerged mplayer with gmplayer USE flag. When you emerge something, you will get some good information, it might recommend you something else or some post-emerge actions. If you use Gentoo, you will learn to read messages.

I am not a very careful user I believe, maybe just above average? I know Gentoo is perfect for me, Fedora is great for me, Arch Linux is awesome for me. But I just could stop loving using Gentoo. It's simply fantastic because I have it and control it more. It's meant to be used by you, not like some are using you.

Hail Gentoo!

Dare to sleep next to this creature?

This post was imported from my old blog “Blogarbage” on 2010-09-28. Some stuff in this post may be broken, please leave a comment if you see any, then I will try to fix it.
I was going to post about this cats just announced that winter is cominghe knows, but I ended up with this edited photo:

Happy Catoween and Halloween!

I think I have done too much on this photo.

Happy Catoween and Halloween!

(though it's still nearly two weeks to it)

Flu Data Viewer

This post was imported from my old blog “make YJL” on 2010-09-28. Some stuff in this post may be broken, please leave a comment if you see any, then I will try to fix it.
I wrote this to get familiar with GTK, Glade and matplotlib. This post is not a walkthrough or tutorial of using either of them. I wanted to write down some notes. The Flu Data Viewer is an example or a code I could copy from for other coding (So this code is put in Public Domain), so it would unlikely be updated in the future. The flu data is from Google Flu Trends.

This program draws one or more countries' flu data in one figure. It downloads data from Google and saves data to fludata.csv in current directory. I was thinking to do some process, but I didn't know what I can do and I wasn't really interested in this.

Here is a screenshot:



You can download the code at Google Code.

Window.visible

When I first time use Glade to create the UI, I didn't know the window.visible is False by default, so you have to either set it in Glade or run window.show().

gtk.glade.XML(gladefile, windowname)

windowname must match window.name in Glade. It's obvious but I thought one Glade XML one window, I set it to something else, therefore my window never show up. One Glade XML could have many windows.

missing int type data in csv

loading using matplotlib.mlab.csv2rec

d = dict(zip(fields, [lambda value: int(value) if value != '' else nan]*len(fields)))
self.rec = mlab.csv2rec(CSV_FILENAME, converterd=d)

Where fields is a list of field names. If a data is missing, it will be an empty string '', I think using NaN (Not a Number, numpy.nan) may be a better idea to represent it than 0 (zero).

There is another way to deal with missing data by giving missingd to csv2rec, but the version of matplotlib on my computer doesn't have it. It should like converterd but with values which you want to assign when data is missing.

feeding to gtk.TreeView

If you set int type to gtk.ListStore, then it will not accept numpy.nan. So str type may be okay to use.

Multiselection mode in gtk.TreeView

treeview.get_selection().set_mode(gtk.SELECTION_MULTIPLE)

Don't forget NavigationToolbar*

Users still need a way to zoom in/out.
from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar

vbox.pack_start(canvas, True, True)
vbox.pack_start(NavigationToolbar(canvas, window), False, False)

I hope I could find a way to do data line tracing. It's hard to tell Y=? when X=123.

GAE Datastore Statistics API is not available for Development Server

This post was imported from my old blog “make YJL” on 2010-09-28. Some stuff in this post may be broken, please leave a comment if you see any, then I will try to fix it.
I just tried to add two entity counts to my app's statistics page. Then I found out, the statistics APIreleased on 10/13/2009, version 1.2.6is not available for development server.

You can run the following code without errors:
from google.appengine.ext.db import stats
global_stat = stats.GlobalStat.all().get()

But global_stat is always None.

So I ended up with a code as follows:
db_blog_count = memcache.get('db_blog_count')
if db_blog_count is None:
blog_stat = stats.KindStat.all().filter('kind_name =', 'Blog').get()
if blog_stat is None:
db_blog_count = 'Unavailable'
else:
db_blog_count = blog_stat.count
memcache.set('db_blog_count', db_blog_count, 3600)

The documentation didn't explicit mention whether if the statistics is available for development server or notmaybe I didn't read carefully, neither did Release Notes.

PS. I know the code is awful, str / int types mixed, terrible. But I am lazy to add and if clause in template file to check if db_blog_count is None or something like -1, or anything represents the data is not available.

PS2. The code should be just if blog_stat: (fourth line) and swap the next two statements if you know what I meant.

Adding Retweet button to Twitter webpage

This post was imported from my old blog “Get Ctrl Back” on 2010-09-28. Some stuff in this post may be broken, please leave a comment if you see any, then I will try to fix it.
(Updated 2009-11-11: This is no use anymore, Twitter has rolled out Retweet feature!)



I have been wanting for a Retweet button for a so long time on official Twitter webpage, but it never happened. Today, I spent an hour or two to make a simple script. One click on bookmarklet can add a button below the Favorite and Reply buttons. Check out the picture below, you should have a better idea.







The red arrow points at this new Retweet button. If you click on this new button, it will bring the retweeting tweet into status input box. This script should work on your Twitter home page, someone's profile page such as mine, @livibetter, tweet status page, or search results.



At home page, if you click on more button at bottom of page, then you only need to click on bookmarklet once more. That will add Retweet button to new tweets.



The following is the bookmarklet, drag and drop it onto your bookmark toolbar.



Retweet



If you are interested in the source code, you can view it at Google Code, the code is licensed under the modified BSD license.



Updated on 2009-10-20: Added button to tweet status page, such as http://twitter.com/twitter/status/1234567890.

Official LabelCloud (Labels) Gadget with Post Counts

This post was imported from my old blog “The B Thing” on 2010-09-28. Some stuff in this post may be broken, please leave a comment if you see any, then I will try to fix it.
The Label Cloud feature has been released for one and a half months, I just tried it out. The representation of cloud is fine, not as good as my LabelX (An external JavaScript to convert original Labels gadget into a label cloud representation). The benefit of using original official functionality is I don't need to add more JavaScript, which will slow a bit the page loading.

However, it doesn't show the post count when your mouse cursor stay on a label. I know you can show post count after label, but it's too ugly! The original partial XML code is as follows:
      <b:loop values="data:labels" var="label">
<b:if cond="data:blog.url == data:label.url">
<data:label.name></data:label.name>
<b:else>
<a expr:dir="data:blog.languageDirection" expr:href="data:label.url" href="/"><data:label.name></data:label.name></a>
</b:else>
<b:if cond="data:showFreqNumbers">
<span dir="ltr">(<data:label.count>)</data:label.count></span>
</b:if>
</b:if>
</b:loop>

I have modified this part code, the revised version is as follows:
      <b:loop values="data:labels" var="label">
<b:if cond="data:blog.url == data:label.url">
<b:if cond="data:label.count == 1">
<data:label.name></data:label.name>
<b:else>
<data:label.name></data:label.name>
</b:else>
<b:else>
<b:if cond="data:label.count == 1">
<a expr:dir="data:blog.languageDirection" expr:href="data:label.url" expr:title="data:label.count + &quot; post&quot;" href="/"><data:label.name></data:label.name></a>
<b:else>
<a expr:dir="data:blog.languageDirection" expr:href="data:label.url" expr:title="data:label.count + &quot; posts&quot;" href="/"><data:label.name></data:label.name></a>
</b:else>
</b:if>
<b:if cond="data:showFreqNumbers">
<span dir="ltr">(<data:label.count>)</data:label.count></span>
</b:if>
</b:else></b:if></b:if>
</b:loop>

Now it can show the post count, it's not really a necessary point to all blogger, but I want that. You can scroll down to bottom to check it out.