Archive for May, 2007

Summer of Code Weekly #2

I can confirm it now, this second week of coding was even better. It was harder on my brain cells, though. I am mostly done with the StringIO merge. I now have working implementations in C of the BytesIO and the StringIO objects. The only thing remaining to do, for these two modules, is polishing the unit tests. And that shouldn’t that me very long to do. So, in basically one week of work, I completed the merge of cStringIO. I am certainly proud of that.

Now, I will need to attack the cPickle and cProfile modules. I don’t know yet which I work on first. cPickle still seems very scary to me, and unlike cStringIO it’s huge. It’s about five or six times bigger. cProfile, on the other hand, is about the same size of cStringIO and well documented. I even wonder if I need to code anything for cProfile. It will be a piece of cake to merge. Now, one question remains: should I take the cake now, or keep it for the end?

Summer of Code Weekly #1

During this summer, I will post each week a short summary of what I did, the challenges I encountered and what I learned during my Summer of Code project. I am doing this for helping me to keep track of my progresses.

So how was my first week? It was great. I don’t know why but I love programming in C. It is just plain fun. I thought learning Python C API was going to be hard, but it is quite easy after all. I just read the code in Python itself and check the reference manual for the things I don’t know. My biggest surprise, this week, was really learning how to do subclassable types. It is strikingly easy, however it’s quite verbose. You can look at my scratch extension module, if you want a minimal working example.

Other than learning the C API, I started working on the cStringIO/StringIO merge. My current plan is to separate the cStringIO module into two private submodules, _bytes_io and _string_io. One will be for bytes literals (ASCII), and the other for Unicode. This will reflect the changes made to the I/O subsystem in Python 3000. These two submodules will provide optional implementations for the speed-critical methods, like .read() and .write().

One the best things, of this week, was the great feedback I got from other Python developers, and particularly from my mentor Brett Cannon, who cheerfully answers all my questions. Now, I just hope the following week will be as fun, or even more, as this one.

Blogging with Emacs

This is my first blog entry with my brand new toy, the weblogging mode for Emacs. It uses the XML-RPC interface of your favorite blogging platform to manage your blog. In other words, it transformes Emacs into a thermonuclear blog editor.

Even better, the installation is simple and easy. Here’s the instructions how to get it working. First, check out the source code of weblogger into your .emacs.d directory:

cd ~/.emacs.d/
cvs -z3 -d:pserver:anonymous@cvs.savannah.nongnu.org:/sources/emacsweblogs \
  co -d weblogger weblogger/lisp

Then, make Emacs load this mode on startup by adding these two lines to your .emacs configuration:

(add-to-list 'load-path "~/.emacs.d/weblogger")
(require 'weblogger)

Now, you probably want to reload your configuration with M-x eval-buffer (assuming your .emacs is still open). Finally, setup weblogger for your blog with M-x weblogger-setup-weblog. This command will ask you a few simple questions, like your username and password for your blog. It will also ask you for the location of the XML-RPC interface of your blog. If you’re using WordPress, it will be somewhere like http://example.com/blog/xmlrpc.php. If you’re using another blog publishing platform like Blogger or MovableType, it will be somewhere else, so check your documentation.

And you’re done! You can now start new a new post with M-x weblogger-start-entry. Weblogger also includes a whole set of other commands for managing your blog. Look them up, with C-h a weblogger RET. Happy blogging!

Am I dreaming?

View plain text emails in fixed font in Gmail

Quick hack: here a script for Greasemonkey that changes the default proportional font to fixed font on Gmail. I was tired reading distorted PEP, and code patches. And since Gmail doesn’t allow changing the font style, I had to write this simple script. Enjoy!

Almost Summer

Bird are singing; the Sun is rising; and rivers are flowing again. In short, another beautiful summer is coming. To me that means the end of classes, and a wave of exams which will crush me for a week. But after, I will be free to do what I love — i.e. coding on open-source software, writing, and enjoying the weather while playing sports with my friends. Anyway, enough dreaming for today, I got some news.

I just finished the facelift to my blog’s layout. The new layout still keeps its original simplicity, while being more colorful and appealing. Personally, I am quite satisfied with the result. And thanks to two Firefox add-ons, called Firebug and Web Developer, the whole process was a breeze (and fun too). While I am at it, I would like to also thanks Becca Wei for the initial theme, Almost Spring, on which I built my theme upon. Feel free to comment about what you like or dislike. Since it’s you after all, who will use it (unless, of course, you’re using a feed reader).

A few longer posts will be coming up after I passed through my exams sessions. Plus, there will a weekly post about the status of my Google Summer of Code project. Thanks for reading!