November 3rd, 2009 under python
Python is a great language, with a good community (see Freenode irc channel #python) — but its modules can have lousy documentation at times.
One place where I find the documentation lacking is in the description of urllib2’s BaseHandler class. Subclasses of this class can be passed to urllib2’s build_opener function to add functionality to [...]
August 29th, 2009 under linux
Recently I set up an SVN repository in the hopes that maybe I can show off some of my programming work to potential clients (or maybe just other people who are interested). I ran into sufficient trouble during setup that I thought it would be a good idea to give a run-down of my [...]
August 3rd, 2009 under linux
One thing it seems bash has no tool for is padding strings. If you want to left-pad a number (say, 3) with zeros to a certain “string width” (say, 5 characters wide), you could do:
$ echo `printf "%05d" 3`
00003
However, this only works with numbers. Actually, it only works with integers (bash can’t handle [...]
June 18th, 2009 under php, web
This post reveals two handy PHP constructs I’ve been using for a while now: a Socket class and a webpage-downloading function.
The files:
Socket.php (highlighted; plaintext)
webpage.php (highlighted; plaintext)
What good is a full-on Socket class and function, you may ask, when you can simply run file_get_contents with allow_url_fopen turned on? Well, consider that you want to send [...]
May 29th, 2009 under linux
In my daily work on linux, I constantly have several tabs open in my console app for various CLI activites. Normally, when I log in to a session, Yakuake auto-starts and I immediately open four tabs in it. Tab four becomes a system monitor through the use of the “top” command, tab one [...]