Older blog entries for avassalotti (starting at number 26)

25 May 2007 (updated 19 Jun 2007 at 21:07 UTC) »

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.

Syndicated 2007-05-25 03:14:37 (Updated 2007-05-28 15:57:35) from Alexandre Vassalotti

12 May 2007 (updated 24 May 2007 at 23:26 UTC) »
12 May 2007 (updated 9 Jul 2007 at 21:08 UTC) »

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 thermonuclear blog editor.

Even better, the installation is simple and easy. Here 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!

Syndicated 2007-05-12 03:37:42 (Updated 2007-05-12 18:14:34) from Alexandre Vassalotti

11 May 2007 (updated 19 Jun 2007 at 21:07 UTC) »

Am I dreaming?

Syndicated 2007-05-11 00:38:06 (Updated 2007-05-11 00:43:53) from Alexandre Vassalotti

4 May 2007 (updated 19 Jun 2007 at 21:07 UTC) »

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!

Syndicated 2007-05-04 02:31:34 (Updated 2007-06-16 14:40:09) from Alexandre Vassalotti

3 May 2007 (updated 19 Jun 2007 at 21:07 UTC) »

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!

Syndicated 2007-05-03 22:24:47 (Updated 2007-05-03 22:29:35) from Alexandre Vassalotti

21 Apr 2007 (updated 19 Jun 2007 at 21:07 UTC) »

Smoked brains for dinner

Today, there will be a special quiz on Python hosted by me, in #ubuntu-trivia on FreeNode, at 20:00 UTC. Most of the quiz will be to write some simple procedures, faster than your opponents. The winner will, of course, get a superb prize — 5 Ubuntu stickers! Obviously, the real prize is the fun that will get during the quiz. And who knows, maybe you will learn a few neat tricks. So, see you there!

Syndicated 2007-04-21 16:33:30 (Updated 2007-04-27 03:09:56) from Alexandre Vassalotti

16 Apr 2007 (updated 19 Jun 2007 at 21:07 UTC) »

Boosted Python Startup

Yesterday, I was reading Peter Norvig’s excellent article about spell checking. Then, I started to look to some of his older stuff. So, I found his Python IAQ (Infrequently Answered Questions), and discovered a pretty neat trick:

h = [None]  # history

class Prompt:
    """A prompt a history mechanism.
    From http://www.norvig.com/python-iaq.html
    def __init__(self, prompt='h[%d] >>> '):
        self.prompt = prompt

    def __str__(self):
            if _ not in h: h.append(_)
        except NameError:
        return self.prompt % len(h)

    def __radd__(self, other):
        return str(other) + str(self)

sys.ps1 = Prompt()
sys.ps2 = '     ... '

This improve the interactive prompt of Python with a shell-like history mechanism. With this prompt, you can reuse any previous value returned by Python. For example:

h[1] >>> lambda x: x * 2
<function <lambda> at 0xb7dab41c>
h[2] >>> [1, 2, 3, 4, 5]
[1, 2, 3, 4, 5]
h[3] >>> map(h[1], h[2])
[2, 4, 6, 8, 10]

You can make it your default prompt, by adding the above in your .pythonrc.py. You will need to specify its location to Python with the environment variable PYTHONSTARTUP. Just add something like the following to your shell configuration (e.g., .bashrc or .zshrc).

export PTHONSTARTUP="$HOME/.pythonrc.py"

I am sure there is a ton of other useful modifications, which can be done with the startup file of Python. If you’re interested, here my brand new startup file. And if you know any other cool tricks for Python, please tell me!

Syndicated 2007-04-16 02:36:05 (Updated 2007-05-07 19:28:34) from Alexandre Vassalotti

Pretty Emacs: Compile guide for unsupported platforms

If you are using a platform other than a i386, you will need to compile my Emacs packages yourself. So, here a simple guide how to do this.

  1. Download the source package with:
    apt-get source emacs-snapshot
  2. Install the build-dependencies and some packaging tools:
    sudo apt-get build-dep emacs-snapshot
    sudo apt-get install devscripts fakeroot
  3. Go in the package’s source directory:
    cd emacs-snapshot*
  4. Build it (take about 30 minutes):
    debuild -rfakeroot
  5. Finally, install the newly built packages:
    cd ..
    sudo dpkg -i emacs-snapshot-common*.deb
    sudo dpkg -i emacs-snapshot-el*.deb
    sudo dpkg -i emacs-snapshot-bin-common*.deb
    sudo dpkg -i emacs-snapshot-gtk*.deb

Syndicated 2007-04-14 02:23:03 from Alexandre Vassalotti

Flipping bits this summer

Dear Applicant, Congratulations! This email is being sent to inform you that your application was accepted to take part in the Summer of Code.

Today, I am truly happy. I wasn’t expecting to be accepted, really, and perhaps no other candidate did. My accepted project is to merge C and Python implementation of the same interfaces (i.e., StringIO/cStringIO, Pickle/cPickle, etc), and my mentor is the Python star, Brett Cannon. This is a challenging project; I will have to work hard and efficiently to be successful. But one thing is sure, I will have some great fun.

I would like to congrats everyone who have been accepted. A special thanks to students who will be working on Ubuntu, this summer. There is surely some great projects for Ubuntu. And also, another special thanks to the mentors, who will be helping us this summer.

Syndicated 2007-04-12 14:36:03 from Alexandre Vassalotti

17 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!