programming
How to convert an integer to base64 in Python
I found a bunch of solutions on web and noticed it may lead to entirely different results if you ignore a few assumptions.
First of all, the input of base64 algorithm is an array of bytes, which is a string in Python. Thus, before converting an integer to base64, you need to convert the integer to [...]
glassfish errors in netbeans
I don’t use IDE since I am used to editing in vim. I tried to adopt eclipse for java work several times. But I just could not keep using it. However, I recently started to see if I can adopt netbeans for java ee development. My environment is netbeans + glassfish + maven.
I experienced several [...]
Connection Close in HttpClient
I recently made a mistake using Java Jakarta Commons HttpClient. I decided to dig deeper into the issue.
My code uses HttpClient to send HTTP requests to another machine. The load is very high. Over time, I often see exceptions of “Too many open files” in logs. But the problem may auto recover. Using netstat, I [...]
Install pygtk
First, download gtk from
http://www.gtk.org/download-windows.html
I downloaded the all-in-one bundle
http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.16/gtk+-bundle_2.16.6-20090911_win32.zip
unzip the file to c:\gtk
Then, I modify windows environment variable PATH by appending C:\gtk\bin to it. (Right click “My Computer”, click “Properties”, “Advanced”, “Environment Variables”, edit “path”)
Go to http://www.pygtk.org/downloads.html, download the latest version pycairo, pygobject, pygtk. (I am using python 2.6).
pycairo-1.4.12-2.win32-py2.6.exe
pygobject-2.14.2-2.win32-py2.6.exe
pygtk-2.12.1-3.win32-py2.6.exe
Run them one by one. The python [...]
Chit – a useful ruby util
I found an interesting ruby util – chit. it can retrieve cheat sheets from repositories powered by git!
http://wiki.github.com/robin/chit/user-s-guide
so far I haven’t found any especially useful cheat sheets there. but it looks interesting and promising.
what’s the difference between a cheat sheet and a man page? man pages spend too much effort to define options formally. cheat [...]