Add Falling Hearts for Valentines Day

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 saw someone asked in discussion group, so I decided to write on my own. Here is all you need:
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript" src="http://yjl.googlecode.com/svn/trunk/JavaScript/falling_hearts.js"></script>

Put these two lines to an HTML/JavaScript gadget without setting the title of widget. You should now have falling hearts! <3

You can see them in this demo page. The code is released under the modified BSD.

There will be 40 hearts, flying around, fading at bottom, then starting falling over again. They also slightly change font size and change colors. Those hearts are text, actually just HTML entity &hearts;.

The script currently doesn't let you customize easily. If you want to, you need to download the script, change variables and upload to somewhere else.

Feel free to provide ideas if you need to fit your needs.

Hope you would <3 it!

middlemouse.contentLoadURL

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.
Since I started to use Firefox, there is one thing that kept bothering me. When you click with mouse's middle button on empty places, Firefox will try to open it as a URL. It seems to be very convienient when you copy a URL somewhere else, then you switch back to Firefox and press middle button. However, that is really rather used. Most of time, just Address Not Found.

So, open about:config, type middlemouse.contentLoadURL, then set it false.

Building Network Diagnostic Tester (NDT)

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 probably hear NDT from Google recently, I do. I didn't those servers has a page with Java applet, because I got error when I firstly accessed. So I decided to build from source 3.4.4a.The building is actually not so hard, but there are two place you need to modify janalyze/Makefile to be as read as follows:

Line 148: NDTGCJFLAGS = -cp external:src -d bin -source 5
Line 854:     $(NDTJAR) $(NDTJARFLAG) MANIFEST.MF JAnalyze.jar < classes.list

However, this analyzer I never used, actually I only need web100ctl. Anyway, once you build, you can run:

$cd Applet
$java -jar Tcpbw100.jar nms1.jp.apan.net

TCP/Web100 Network Diagnostic Tool v5.5.4a
click START to begin

** Starting test 1 of 1 **
Connected to: nms1.jp.apan.net  --  Using IPv4 address
Checking for Middleboxes . . . . . . . . . . . . . . . . . .  Done
checking for firewalls . . . . . . . . . . . . . . . . . . .  Done
running 10s outbound test (client-to-server [C2S]) . . . . . 143.0kb/s
running 10s inbound test (server-to-client [S2C]) . . . . . . 1.78Mb/s
Server unable to determine bottleneck link type.
Information: Other network traffic is congesting the link
 [S2C]: Packet queuing detected

click START to re-test

$cd src
$./web100clt -n nms1.jp.apan.net

Testing network path for configuration and performance problems  --  Using IPv4 address
Checking for Middleboxes . . . . . . . . . . . . . . . . . .  Done
checking for firewalls . . . . . . . . . . . . . . . . . . .  Done
running 10s outbound test (client to server) . . . . .  273.00 kb/s
running 10s inbound test (server to client) . . . . . . 910.93 kb/s
Server unable to determine bottleneck link type.
Information: Other network traffic is congesting the link
Information [C2S]: Packet queuing detected: 17.17% (local buffers)
Information [S2C]: Packet queuing detected: 95.70% (local buffers)
Server 'nms1.jp.apan.net' is probably behind a firewall. [Connection to the ephemeral port failed]
Client is probably behind a firewall. [Connection to the ephemeral port failed]
Information: Network Middlebox is modifying MSS variable (changed to 1412)
Server IP addresses are preserved End-to-End
Client IP addresses are preserved End-to-End

I can't use MLab's, I keep getting protocol error. These servers keep me waiting very long. So I searched and got one that no one in queue.

Rebuilding SRPM with rpmbuild on Fedora 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.
The goal is rebuilding SRPM (Source RPM) from official Fedora's SRPM. Why would I need to rebuild? First the new SRPM is different than original SRPM, I may modify the SPEC or bump with new version source tarball. Once I get the new SRPM, I then build it with mock.

Here is the steps, I use gcalctool as example:

Setting up the environment

This is easy, just
# as root
yum install rpmdevtools
# as you
rpmdev-setuptree

Then, you will have ~/.rpmmacros and ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}.

Installing SRPM as you

Run rpm -i gcalctool-5.24.3-1.fc10.src.rpm as you, you may see the following messages:
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
[snip]

Just ignore it, you should have files in ~/rpmbuild.

Modifying and building

Now, you can modify the SPEC or put on latest tarball. After you modify, run cd ~/rpmbuild/SPECS ; rpmbuild -bs gcalctool.spec.

Here we only build the SRPM, we then build RPM from it with mock, you can read Rebuilding RPM from SRPM with mock on Fedora.

Rebuilding RPM from SRPM with mock on Fedora 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.
There will be a short series of posts about RPM. My main goal is to optimizing my systems and my first step is re-compilation. For easing difficulties, I decided to rebuild official RPMs from SRPMs (Source RPMs) with modified SPEC or bumped source tarball to newer version by me.

Okay, step by step, in this post, I will show you how to rebuild RPM without any changes. The package I use to demonstrate is gcalctool-5.24.3-1.fc10, go download the SRPM.

When building a package is advised to not to use root account, therefore we will have the help from mock, which easily put the building process in chroot environment.

Installing mock

yum install mock

Preparing a build directory and rebuilding

I choose /home/username/var/rpm/mock, it's free to choose. Create the directory, then run
mock -r fedora-10-x86_64 \
--resultdir=/home/username/var/rpm/mock/"%(dist)s"/"%(target_arch)s"/ \
--no-clean --no-cleanup-after \
--rebuild gcalctool-5.24.3-1.fc10.src.rpm

First option tells mock what is chroot configuration, which points to a configuration file /etc/mock/fedora-10-x86_64, you can see this option as building target. For example, you can change it to fedora-10-i386 on x86_64 to build a 32-bit package.

Second option tells mock where to store built RPMs. It also categoried by distribution version and target architecture.

Third and fourth options tell mock don't clean files up before and after. The files are toolchains, dependent packages, etc.

Fifth and last options tell mock that we want to rebuild gcalctool package.

The following is a sample of output:
INFO: mock.py version 0.9.13 starting...
State Changed: init plugins
State Changed: start
INFO: Start(gcalctool-5.24.3-1.fc10.src.rpm)  Config(fedora-10-x86_64)
State Changed: lock buildroot
State Changed: clean
State Changed: init
State Changed: lock buildroot
INFO: enabled root cache
State Changed: unpacking root cache
INFO: enabled yum cache
State Changed: cleaning yum metadata
INFO: enabled ccache
State Changed: running yum
State Changed: setup
State Changed: build
INFO: Done(gcalctool-5.24.3-1.fc10.src.rpm) Config(fedora-10-x86_64) 3 minutes 23 seconds
INFO: Results and/or logs in: /home/livibetter/var/rpm/mock/fc10/x86_64/

Why is it so slow?

No, it's not like that. When you create a chroot for building package, it's not only just put the package's source in, not that simple. You also need to have system file/directory, toolchain, dependent packages. Most of time is to install dependent packages.

Be sure to ask mock to --no-clean --no-clenup-after.

Why does mock still ask me for root password?

Because it is still need to use yum to install dependent packages. Once it finishs, mock will bring up rpmbuild as your account.

Installing the built RPM

yum --nogpgcheck localinstall 

Since this package is built by our own, it is not signed, therefore we need that option to by pass.

How long? Ask len()!

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.
Today I ran into a funny situation. I was using sqlite3, this is my first time to use it. I was just to execute a very simple SQL statement, that looks like,
connection.execute('INSERT INTO table_name (column_name) VALUES (?)', 'column_value')

If you have run similar statement, you probably won't forget the result of above statement. I have to admit that I didn't read sqlite3 with much care. I got an error message saying the statement has 1 parameter but I pass 12 parameters to it.

Even you haven't run into this, you probably can guess what the problem is. sqlite3 do len('column_value') without knowing its type. I tried to use another way, tuple, then I found out that I didn't know one fact of tuple.

Now, here is a list, please answer by reading this script:
#!/usr/bin/python

quiz = [
[],
{},
(),
'12345',
[12345],
['12345'],
(12345),
('12345'),
('12345',),
]

for q in quiz:
print '%10s ->' % repr(q),
try:
print len(q)
except Exception, e:
print e

Answers (select them to read):
[] -> 0
{} -> 0
() -> 0
'12345' -> 5
[12345] -> 1
['12345'] -> 1
12345 -> object of type 'int' has no len()
'12345' -> 5
('12345',) -> 1

So here is right way to do:
connection.execute('INSERT INTO table_name (column_name) VALUES (?)', ('column_value',))

Customizing PostRanks Top Posts widget

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.
PostRank is a great service that gives you some good statistics of your blog posts. It provides a nice thematic widget for your top posts popular posts, of course, it also let you customize it. I have been using this thematic widget over my blogs for months. I didn't try customizing it which was due to my prejudice which consists of my experince of iframe. I believed that CSS can not be applied on iframe and the document in iframe, therefore I never tried. Earlier, I read on PostRank's GetSatisfaction, those questions and answers indicate that I was wrong. I tried and I am happy with the result.

If you choose the right-most option while customizing, you will see a partial code like:
var options = {
    "feed_hash": "cbfa4ed49ae77050fb48ccbb47a101bc",
    "num":        6 ,
    "theme":     "diy"
};
new PostRankWidget(options);

Note that "theme":     "diy".

Now check out the following screenshots, first one is the thematic, latter is customized:

 

Here is the CSS that I applied:
/* BEGIN: PostRank */
/*
ul.postrank-posts {
list-style-type:none;
padding-left:0;
}
*/
ul.postrank-posts li{
margin-bottom:0.1em;
}
a.postrank-value {
color:#000;
width:3em;
display:block;
float:right;
clear:both;
text-align:center;
}
table.postrank-options {
display:none;
}
/* END: PostRank */
I put the PostRank value on the right side because I couldn't make it perfectly on the left. However, the result it not bad at all. If you can make it on left, share with me.

One more thing to note, I only test on Firefox. 90% chance that I believe it will be broken on Internet Explorer since this blog already is.

You open, you close!

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.
Recently, I have a chance to use pylint, an analyzer of Python codes. Usually, you would use it's command-line program to generate analysis reports. However, we people I recently work with for a game development import pylint and generate in a script, then immediately parse the reports.

That cost me some time. I can't figure out why I open the report (pylint_global.txt), and get no content from it. Finally, I guess pylint doesn't close files, and it doesn't. Here is a simple program to show your:
#!/usr/bin/python


"""Find out how many files that pylint left opend"""

import __builtin__
import sys

from pylint import lint
import time

def main():
"""Main function"""

# Dirty job to close pylint left opened
original_open = __builtin__.open

f_handlers = []
def count_open(*args, **kwargs):
"""Counts how many file opened"""
f_handler = original_open(*args, **kwargs)
f_handlers.append(f_handler)
return f_handler

__builtin__.open = count_open

lint.Run(['-ftext', '--files-output=y', sys.argv[0]])
# Run lsof here
time.sleep(30)
# Restore the original file open
__builtin__.open = original_open

opened = len(f_handlers)
closed = sum([f_handler.closed for f_handler in f_handlers])
print 'Open: %d, unclosed %d.' % (opened, opened - closed)


if __name__ == '__main__':
main()

A sample output:
$ python pylint_open.py
No config file found, using default configuration
Open: 9, unclosed 9.

Here is related result from lsof:

python  32310 livibetter    3r   REG  253,0      870 4554767 /home/livibetter/tmp/pylint_open.py
python  32310 livibetter    4w   REG  253,0        0 4554764 /home/livibetter/tmp/pylint_pylint_open.txt
python  32310 livibetter    5r   REG  253,0      870 4554767 /home/livibetter/tmp/pylint_open.py
python  32310 livibetter    6r   REG  253,0      815 1221017 /usr/lib/python2.5/site-packages/pylint-0.15.2-py2.5.egg/pylint/__init__.py
python  32310 livibetter    7r   REG  253,0    38194 1221015 /usr/lib/python2.5/site-packages/pylint-0.15.2-py2.5.egg/pylint/lint.py
python  32310 livibetter    8r   REG  253,0    16986 1221710 /usr/lib/python2.5/site-packages/pylint-0.15.2-py2.5.egg/pylint/checkers/rpython.py
python  32310 livibetter    9r   REG  253,0        0 3768605 /home/livibetter/.pylint.d/pylint_open1.stats
python  32310 livibetter   10w   REG  253,0        0 4554766 /home/livibetter/tmp/pylint_global.txt
python  32310 livibetter   11w   REG  253,0        0 3768605 /home/livibetter/.pylint.d/pylint_open1.stats

You should look at *.txt. That means pylint doesn't close files after it finishes its job. I tried to report but I can't find a link to sign up or to file a report.

Stalled Internet connection is a torture

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'd like a shoot, instead. Somehow the Internet are completely stalled for connections of outside of my country, unfortunately, I don't visit websites nearby me much. They are still accessible, but only at speed like few KB/s.

Under this situation, people can be categorized into two types. First one is good, they will convert the whole thing into a positive pulse. They may be finishing reading a book, doing house cleaning, or playing with their lovely cats I have an excuse, my cat is sleeping. They choose to look thing upside down, when time goes bad. They are optimist. Second type is bad, they blame. Of course, they do not cause the situation, but they turn it into a victim. So they can hopefully cover their worse personality.

I am the latter type. I have few new books on shelf, my room is just !@#$%, some coding improvements can be done, and many other things that I don't even need the Internet. But I just sit still and stare at the screen. If idling counts, hey, I have been doing so well!

I miss kitten cams, now they are just kitten snapshots.

Compose/Dead Keys, iBus in Qt program within GNOME on Fedora 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.
A day ago, I downloaded Opera 9.63/10a to give them a try within GNOME Desktop Environment. I then found out Compose Key and iBus didn't work. Opera now still only ships Qt3 for x86_64, there is Qt4 Opera. iBus has no problems with Qt4 applications. If you have Qt3 programs, you need to run by
XMODIFIERS=@im=ibus QT_IM_MODULE=xim qt3_program

About Compose/Dead Keys, you need to run by
XMODIFIERS= QT_IM_MODULE= qt_program

In fact, if the program is Qt3, then you only need QT_IM_MODULE=.

There is one thing you should be careful to claim if Compose/Dead Keys works or not. If you want to get é,
  • In KDE, you can only compose as follows: [compose]+[']+[e]
  • In GNOME, not only the sequence above, but also: [compose]+[e]+[']
Make sure you use correct sequence to test Qt applications.

However, I can not make both worked together, either I have iBus or have Compose key. I could only have one working in both Qt3 and Qt4 programs.

PS. If you are not sure what version of Qt is using, just check up HelpAbout [Program's Name], that will tell you what version of Qt it is using.



ChangeLog
  • 2009-01-22 Fixed QT->Qt

LabelX now has colors!

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.
My LabelCloud/TagCloud script, LabelX, now can render with colors. Here is a screenshot:


If you have questions about LabelX, please post them to this newly created Discussion Group.

Big cats meow, too!

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 just saw this video and knew the facts, a cougar:



Clouded leopard:



Snow leopard (this one finally got my cat's attention!):



Lynx:



Cheetah:



Tiger:



Lion:



All babies are adorable, but once they have grown up...:

Trying out Windows 7 Beta

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.
I downloaded the Windows 7 Ultimate Beta from Microsoft. The hardwares of the machine I used, you can read it here. It's kind of old. I have an ATI Radeon X700 graphics card, but it seems to be broken, that is bad that I could not see the Aero theme. By the way, I have never used Vista, Windows XP is my last experience of Windows operating systems.



The setup runs in 800600 resolution, I can now hope Windows supports old GeForce4 MX and gives me 16801050 after installation. The setup is weird, it gave Upgrade and Custom installation types, but I didn't have any Windows on this computer. I deleted all Linux partitions and create new one. It automatically created 200MB for System type, the rest for Primary type.



The installation needs to restart twice, which I don't understand why would it needs to. At second time reboot, you can set up a new account and enter the product key. The whole process of installation takes less than 30 minutes, this is quite fast.



I am still stuck in 800600. I tried to set up Internet connection, but it kept saying it couldn't. So I checked up the Device Manager, and found out Ethernet Controller doesn't have driver. I manually installed NVIDIA nForce Networking Controller. I thought this will be working, but it doesn't. Windows 7 has proved me that it's a Windows descendant by a royal Windows tradition when I tried to configure the NIC, I got a Not responding window. The End Process button doesn't work, the only way seems to restart or shutdown. But it just showed me Shutting down... Thankfully, this machine has a Reset button. Good job, Microsoft.



So I downloaded a Windows XP driver for nForce2 from nVidia website (it's categorized as Legacy), it doesn't have Vista version. However, this still doesn't work for NIC (other devices seem to work). I found nf123xp stuff, which has newer drivers than from nVidia's website. The file I downloaded is NF123LR1.0. While installing these newer drivers, boom! BSOD! Another royal tradition. I then tried again, it happened on installing audio driver. I resolved it by manually installing.



Now, finally, I can connect to Internet. I installed Kaspersky software from the three suggestions on Windows 7 website, also updated the system. I tried to install nVidia GeForce4 MX (Integered using 128 MB shared memory) 93.71 driver for XP/2K, which I downloaded from nVidia, but installer said this is not Windows! How hilarious! But I can still install it manually.



Oh, yeah! I got 16801050 after rebooted. I just downloaded Steam, and Kaspersky warmed me that it detected Worm.P2P.generic. So, I uninstalled Kaspersky. However, the games are not playable, I guess that is driver problem.



I feel Windows 7 is just a pretty Windows XP, nothing more except you have to keep click on Yes and Allow buttons to make sure your system is more Secure. I encountered troubles with driver issues, they are not supported officially, even though they are working. If you want to try Windows 7, make sure you have a sticker on your hardware. Buying a pre-installed computer might be a better way.






Trying out new ATI driver on Fedora 10 x86_64

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 read some people trying new ATI Catalyst driver 8.12 (8.561-6.8.12.fc10) about weeks ago, until an hour ago, I finally tried it out. I am glad that I tried.

The steps are easy, you just follow leigh123@linux's instruction, but for the first step, I actually did:
yum
--enablerepo=rpmfusion-nonfree-updates-testing install akmod-fglrx
xorg-x11-drv-fglrx xorg-x11-drv-fglrx-libs.i386
xorg-x11-drv-fglrx-libs.x86_64

I installed this new driver along with kernel 2.6.27.7-134.fc10.x86_64, here is some results to check out:
$ glxinfo | head -5
name of display: :0.0
display: :0  screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.2

$ fglrxinfo
display: :0.0  screen: 0
OpenGL vendor string: ATI Technologies Inc.
OpenGL renderer string: ATI Mobility Radeon X1400
OpenGL version string: 2.1.8304 Release

$ glxgears
10959 frames in 5.0 seconds = 2191.728 FPS

$ fgl_glxgears
Using GLX_SGIX_pbuffer
2326 frames in 5.0 seconds = 465.200 FPS

Then, I tried on kernel 2.6.27.9-159.fc10.x86_64, resulted:
$ glxgears 
11390 frames in 5.0 seconds = 2275.998 FPS

$ fgl_glxgears
Using GLX_SGIX_pbuffer
2451 frames in 5.0 seconds = 490.200 FPS

The numbers are better. However there is a big problem from 159 for some models of Dell's laptop. No audio output through headphone, in my case Dell Inspiron 6400! This bug report has few comments about kernel 2.6.28, so I downloaded 2.6.28-4 from Koji. That does work, but I seem to have keyboard issues, I couldn't use Alt+F1/F2 to the main menu or bring up run dialog in GNOME.

If you don't know how to upgrade kernel from other than YUM repository, you can do:
# Find out what you should download
yum list kernel-*
# Download the packages
su
yum --nogpgcheck localinstall kernel-*.rpm

The most significate improvement is Woopra, I have complained about that. But now, after installed this new ATI driver, Woopra runs much faster.

Following Googles services on Twitter

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.
Now, even Google starts to use Twitter, though not really the core of Google itself. We now have @Blogger and @googlereader. Maybe there are more out there, if yes, please let us know.



There is a blog posting from Google that makes me thinking, which writes about Jaiku bought by Google in 2007 will be open-sourced. It's interesting that Blogger and Google Reader chose Twitter not Jaiku. It's not hard to understand, all because of amount of users.






Updated on 2009-03-26: List of known Google services on Twitter:

Compiling Crafty Chess just for Benchmark

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 don't know chess, I compiled Crafty Chess only for getting benchmark after I read this post. The version I compiled is 22.8, you can download the source from FTP.

I got an error when make linux-amd64:
main.c:3729: error: too many arguments to function numa_node_to_cpus

I have no idea why to fix this, therefore I just removed -DNUMA from Makefile, so target linux-amd64 target becomes:
linux-amd64:
$(MAKE) target=LINUX \
CC=gcc CXX=g++ \
CFLAGS='$(CFLAGS) -Wall -pipe \
-fbranch-probabilities -fomit-frame-pointer -O3 -march=k8' \
CXFLAGS=$(CFLAGS) \
LDFLAGS='$(LDFLAGS) -lpthread -lnuma -lstdc++' \
opt='$(opt) -DINLINE64 -DCPUS=8 -DLIBNUMA' \
crafty-make

The results on my Core 2 Duo 1.83G:
$ ./crafty
unable to open book file [./book.bin].
book is disabled
unable to open book file [./books.bin].

Crafty v22.8 (1 cpus)

White(1): bench
Running benchmark. . .
......
Total nodes: 111671982
Raw nodes per second: 1861199
Total elapsed time: 60.74
White(1): quit

You also need numactl-devel package, though I am not sure if Crafty still uses it since the removal.

YouTube embedded video size calculator

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.
YouTube provides few predefined sizes of embedded code, but usually that won't fit perfectly for your blogs. I wrote a simple script to calculator based on the width that you want, it will give you what proportion you should set.

As of writing, the control panel, at bottom of video, is 25 pixels high. If you have set border on, that will increase 20 pixels on both width and height.





A sample embedded code looks like:
<object width="width" height="height">
<param name="movie" value="http://www.youtube.com/v/video_id&hl=en&fs=1&rel=0"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/v/video_id;hl=en&fs=1&rel=0"
type="application/x-shockwave-flash" allowscriptaccess="always"
allowfullscreen="true" width="width" height="height"></embed>
</object>

You need to replace proportion in two places, which are marked in red.

This B Thing

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.
This is my 7th active blog on Blogger, yeah! lucky 7!

You should already know what this B thing is, which stands for blogging. That means I will post thing about blogging. However, this is not a blog that provides you tips, tricks, or tutorials, at least, not intentionally. It's for storing my notes or experineces of blogging, leaning towards to technical stuff.

Devil in my bed, thinks my cat

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.
Before I tell you the story, I have another story.

My cat loves sleeping in my bed, but you know that he has to jump up first. Last year, his first failure of jumping, which I saw that happening. At the moment, I laughed. It's really funny when you saw a cat seems to slip upon wooden floor. I must be laughing quite loud, he made a very sad sound. That's the first time that I felt cat has self-esteem, too! Afterwards, I try to hold my breath very hard.

About two weeks ago, I made a 1-step stair for him. He didn't use that at first, I think he has no idea what it is. A week ago, I tried to teach him how to use. I put his front legs on the stair and slapped my bed to give him a sign to jump up. He did, we tried few times. I then just directly gave him a sign when he was on floor entirely and he stepped on stair then the bed. Since then, he knows there is a thing, that he can step on. I am so happy that he can learn and this is his first trick. (No, I don't think he can learn dog-tricks)

Okay, back to the topic, I have a blanket and he loved it, but not anymore. If you have a cat, it's easy to understand they love scratch that kind of soft stuff, although sometimes they are not really scratching. Anyway, damage would have made, my poor blanket. I don't mind he sleeps in my bed, but I really don't want he scratches.

I tried to stop him but he seems to think I am playing with him. So I decided to grab his legs from beneath of the blanket. Every time I do, he scares. He freezes a bit, try to pull his legs back, then fall back few steps. You should look at his face. Confusing, scaring... wondering what's that? I didn't mean to scare him, but I scared him.

Now, he still jumps up, but he firstly circle around this evil blanket. Step by step, easily, slowly, carefully to get into the dangerous zone. Sometimes, he thinks that is still too risky, therefore he goes to the old bed.

Beware of the Yellow Devil!

GAE: Datastore Timeout

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.
Recently, my GAE application started to get few timeouts on operations on datastore.

Here is a sample traceback:
datastore timeout: operation took too long.
Traceback (most recent call last):
File "/base/python_lib/versions/1/google/appengine/ext/webapp/__init__.py", line 498, in __call__
handler.get(*groups)
File "/base/data/home/apps/brps/1.330624965687476780/index.py", line 104, in get
p = post.get(blog_id, post_id)
File "/base/data/home/apps/brps/1.330624965687476780/brps/post.py", line 85, in get
p = db.run_in_transaction(transaction_update_relates, blog_id, post_id, relates)
File "/base/python_lib/versions/1/google/appengine/api/datastore.py", line 1451, in RunInTransaction
raise _ToDatastoreError(err)
File "/base/python_lib/versions/1/google/appengine/api/datastore.py", line 1637, in _ToDatastoreError
raise errors[err.application_error](err.error_detail)
Timeout: datastore timeout: operation took too long.

Here is how you can catch it:
from google.appengine.api.datastore_errors import Timeout

try:
pass
except Timeout:
pass

Results of You comment, I donate!

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.
The number of comments is much lower than I dreamed for. Basically I got 19 comments over 6 blogs, 9 is the outcome after removed comments from same commenter.

I probably foresaw the number, therefore I have set up the minimal amount of donation at start of this, which is USD$100.

My donation have gone into the General Donation, I think this would be best for all.

Is the CrapEmail mode enabled?

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.
Why would I always receive crap, junk, and spam email?



And this is the same email content that I reported phishing few days ago and it was in my Inbox not Spam box.

What's wrong with these dumbs? Is keeping sending these ever making them money?

Catching DeadlineExceededError is the last chance

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.
As far as I know, every request has around 10-second runtime limitation. You may have seen this in your log:
<class 'google.appengine.runtime.DeadlineExceededError'>:
Traceback (most recent call last):
File "/base/data/home/apps/brps/1.330485825438182004/index.py", line 149, in <module>
main()
File "/base/data/home/apps/brps/1.330485825438182004/index.py", line 145, in main
run_wsgi_app(application)
File "/base/python_lib/versions/1/google/appengine/ext/webapp/util.py", line 76, in run_wsgi_app
result = application(env, _start_response)
[snip]

For sake of user experience, we need to deal with that. This post explains where you can import DeadlineExceededError.
# DeadlineExceededError can live in two different places
try:
# When deployed
from google.appengine.runtime import DeadlineExceededError
except ImportError:
# In the development server
from google.appengine.runtime.apiproxy_errors import DeadlineExceededError

By throwing in my app, the time is around 8.5 seconds. If you try to catch it, it does work, but what if you try to stall? (Yeah, you are a bad boy!)
class DeadlineExceededErrorPage(webapp.RequestHandler):
def get(self):
try:
time.sleep(20)
logging.debug('Impossible!')
except DeadlineExceededError:
logging.debug('Houston, we got a problem! But we are going to make it worse!')
time.sleep(20)
logging.debug('Houston, we really are in a big trouble!')
logging.debug('We should never be here!')
self.response.out.write('Done!')

I made this piece of code to try on production server (It didn't run as my expectation on development server, maybe I need to use urlfetch instead of sleep?), here is the log:
1.01-05 05:55AM 23.941 /DeadlineExceededError 500 9151ms 139ms-cpu 0kb
118.169.142.109 - - [05/Jan/2009:05:55:33 -0800] "GET /DeadlineExceededError HTTP/1.1" 500 0 - -

2.D 01-05 05:55AM 32.687
Houston, we got a problem! But we are going to make it worse!

3.E 01-05 05:55AM 33.090
<class 'google.appengine.runtime.DeadlineExceededError'>:
Traceback (most recent call last):
File "/base/data/home/apps/yjltest/1.330487966959697473/index.py", line 55, in main
run_wsgi_app(application)
File "/base/python_lib/versions/1/google/appengine/ext/webapp/util.py", line 76, in run_wsgi_app
result = application(env, _start_response)
File "/base/python_lib/versions/1/google/appengine/ext/webapp/__init__.py", line 498, in __call__
handler.get(*groups)
File "/base/data/home/apps/yjltest/1.330487966959697473/index.py", line 41, in get
time.sleep(20)

Time to catch the exception is about 8.7 seconds, then at 9.1 seconds, we know the answer of the stalling, that is getting another DeadlineExceededError.

If you are really bad, you would ask why not try again? I tried, we don't have the second chance!

If Linux Had A Catch Phrase...

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 reading this thread on FedoraForum, it's too funny to ignore. I picked up few and shared here in order of how I like:
  1. Fedora: to boldly break things that no one has broken before. posted by Shivas
  2. Fedora: To boldly go where no Penguin has gone before. Zigzagcom
  3. Fedora: Hold On to Your Hat, It Might Be A Bumpy Ride. Hlingler
  4. Fedora: Get in, buckle up, hold on and shut up. Dan

I believe that they were inspired by Why is Fedora always seem to be broken? and I agreed with them, but I am still a Fedora user.

Building Python 2.6 and 3.0 alongside current 2.5 from Fedora 10

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 thought I needed to do some tricks in order to put them all together, but it turns out none is needed. The following is cited from README:

Installing multiple versions
----------------------------

On Unix and Mac systems if you intend to install multiple versions of Python
using the same installation prefix (--prefix argument to the configure
script) you must take care that your primary python executable is not
overwritten by the installation of a different versio.  All files and
directories installed using "make altinstall" contain the major and minor
version and can thus live side-by-side.  "make install" also creates
${prefix}/bin/python which refers to ${prefix}/bin/pythonX.Y.  If you intend
to install multiple versions using the same prefix you must decide which
version (if any) is your "primary" version.  Install that version using
"make install".  Install all other versions using "make altinstall".

For example, if you want to install Python 2.5, 2.6 and 3.0 with 2.6 being
the primary version, you would execute "make install" in your 2.6 build
directory and "make altinstall" in the others.

All I did is:
./configure --prefix=/usr
make
su -c "make altinstall"
for both Python 2.6.1 and Python 3.0.

Since Python 3.0 is compatible with current any Python programs, never make install Python 3.0 unless you are 100% sure your system doesn't use Python scripts for system maintenance. On Fedora, Yum is very important Python script. If you have done, rpm and Koji are your savers.

As you can see on Koji, Python 2.6 seems to be the primary version on Fedora 11.

When I make 2.6, there are few bits missing:
Failed to find the necessary bits to build these modules:
bsddb185           dl                 imageop
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.

After checked the setup.py, I think they are not necessary on my system.

More updates on BRPS

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.
After small update, I then added a requests count with chart using Google Chart API and a list of active blogs. Check out the screenshot below:


I also replace Blogger.com with just Blogger.

Oldest file meme

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.
After drink meme, I got another meme to play with, New Year's meme: What are the oldest files in your home directory?, first started by Brandon  Rhodes.



Rules

  1. Run the following script in your home directory. (You might want to use less to read the output.)

  2. Ignore files whose date does not reflect your own activity.

  3. List the oldest files in a blog post and discuss!

#!/usr/bin/env python
"""Print last-modified times of files beneath '.', oldest first."""
import os, os.path, time
paths = ( os.path.join(b,f) for (b,ds,fs) in os.walk('.') for f in fs )
for mtime, path in sorted( (os.lstat(p).st_mtime, p) for p in paths ):
     print time.strftime("%Y-%m-%d", time.localtime(mtime)), path
Only include files whose last-modified time is a date on which you really touched the file. The file's time should neither result from an error (a few files beneath my own home directory have an incorrect date of 1970-01-01), nor from unpacking someone else's archive that has old files inside of it.



But there is no requirement that the actual content of each file you list be your own. Whether you wrote the file yourself long ago, or downloaded it from some ancient and forgotten FTP site, you have a story to share!


My files


# The first day I started to use Pidgin on Linux?
2007-08-29 ./.purple/logs/jabber/[my_email]@gmail.com/[a_contact]@gmail.com/2007-08-29.160713+0800CST.html
# The day I started to run my own server at home, shutdown months later due to noise from fans
2008-04-11 ./tmp/thetinybit/etc/ppp/chap-secrets
Nothing really old because of a harddisk failure in 2005. I lost all my data, photos, documents, etc. After that tragedy, I usually don't store anything on my computer except raw images/music files/or files I would use often.

Sox On

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 don't wear sox at home usually, but the temperature is too low for me.



I know this probably is like hot summer for whom lives with polar bears or elks. It's just freaking cold for me.

In summer, I complain about computer generates too much hear; in winter, I still complain about the heat but generates too less.

This is how I keep my feet warm:
IMG_2083

Okay, not really worked. The cat only laid down for a few seconds, then went to sleep in bed, my bed, of course. He just wants scratches.

Without the cat, that sox doesn't keep my feed warm. Maybe one more pair?

Update of BRPS

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.
Today, I spent about an hour to update BRPS. I actually updated for fixing a bug. Somehow, querying label Fedora caused a error return on one of my blogs. I don't understand why that would happen. Right now, I just exclude any situation like from final result.

Currently, BRPS receives 1.5K+ requests a day. I would say there might be 10+ blogs actively use BRPS, not include my blogs. I can't give you an explicit list since I haven't designed that in BRPS, I might never do that.

Here is a screenshot:



Disappointingly, no one wrote for introducing BRPS. They just use it, I wonder if they do know what BRPS is and I believe some of them have never visited BRPS website. They might be copying the code from a blogger which I asked him if he wanted to write about BRPS.

Anyway, I also makde an important modification retrying. Retrying is quite important and more necessary because I increased label querying from 5 labels to 10 labels. That means the 5-second download timeout on GAE almost has to be happened (Note that there is still other type of timeout, I haven't dealt with), currently, as my observation, that happens in a rate as 1%. From now on, BRPS might have more DeadlineExceededError.

Amazingly, I got no compliant about that 1%. Possibly, no one notices that Related Posts section missing.

I don't like to use a widget that has linkback, so I won't put that kind of things in my widget. I just hope people would like it and write for it. I am still waiting.

Drink meme

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 saw this meme in this post Have a Drink (or hundred), started by this post Imbibers One Hundred.

So here is my meme for drink:

Instructions:
  1. Copy this list into your blog, with instructions.
  2. Bold all the drinks youve imbibed.
  3. Cross out any items that you wont touch.
  4. Post a comment here and  link to your results.
OR

If you dont have a blog, just count the ones youve tried and post the number in the comments section.

List of Drinks You Must Try Before You Expire
  1. Manhattan Cocktail
  2. Kopi Luwak (Weasle Coffee)
  3. French / Swiss Absinthe
  4. Rootbeer
  5. Gin Martini
  6. Sauternes
  7. Whole Milk
  8. Tequila (100% Agave)
  9. XO Cognac
  10. Espresso
  11. Spring Water (directly from the spring)
  12. Gin & Tonic
  13. Mead
  14. Westvleteren 12 (Yellow Cap) Trappist Ale
  15. Chateau dYquem 
  16. Budweiser
  17. Maraschino Liqueur
  18. Mojito
  19. Orgeat
  20. Grand Marnier
  21. Mai Tai (original)
  22. Ice Wine (Canadian)
  23. Red Bull
  24. Fresh Squeezed Orange Juice
  25. Bubble Tea
  26. Tokaji
  27. Chicory
  28. Islay Scotch
  29. Pussers Navy Rum
  30. Fernet Branca
  31. Fresh Pressed Apple Cider
  32. Bourbon
  33. Australian Shiraz
  34. Buckleys Cough Syrup What the ...?
  35. Orange Bitters
  36. Margarita (classic recipe)
  37. Molasses & Milk
  38. Chimay Blue
  39. Wine of Pines (Tepache)
  40. Green Tea
  41. Daiginjo Sake
  42. Chai Tea
  43. Vodka (chilled, straight)
  44. Coca-Cola
  45. Zombie (Beachcomber recipe)
  46. Barley Wine
  47. Brewed Choclate (Xocolatl)
  48. Pisco Sour
  49. Lemonade
  50. Speyside Single Malt
  51. Jamaican Blue Mountain Coffee
  52. Champagne (Vintage)
  53. Rosé (French)
  54. Bellini
  55. Caipirinha
  56. White Zinfandel (Blush)
  57. Coconut Water
  58. Cerveza
  59. Cafe au Lait
  60. Ice Tea
  61. Pedro Ximenez Sherry
  62. Vintage Port
  63. Hot Chocolate
  64. German Riesling
  65. Pina Colada
  66. El Dorado 15 Year Rum
  67. Chartreuse
  68. Greek Wine
  69. Negroni
  70. Jägermeister
  71. Chicha
  72. Guiness
  73. Rhum Agricole
  74. Palm Wine
  75. Soju
  76. Ceylon Tea (High Grown)
  77. Belgian Lambic
  78. Mongolian Airag
  79. Doogh, Lassi or Ayran
  80. Sugarcane Juice
  81. Ramos Gin Fizz
  82. Singapore Sling
  83. Mint Julep
  84. Old Fashioned
  85. Perique
  86. Jenever (Holland Gin)
  87. Chocolate Milkshake
  88. Traditional Italian Barolo
  89. Pulque
  90. Natural Sparkling Water
  91. Cuban Rum
  92. Asti Spumante
  93. Irish Whiskey
  94. Château Margaux
  95. Two Buck Chuck
  96. Screech
  97. Akvavit
  98. Rye Whisky
  99. German Weissbier
  100. Daiquiri (classic)

This meme shows me that I am not qualified as drinker. Still many on the list I have no idea what they are.