Archive for 2003

Last Week’s News, Today!

Wednesday, August 6th, 2003

If you’re a regular reader of this site, you’re probably in tune with

what’s going on in the world of Python, in which case I don’t have to

tell you that Python 2.3 was

released last week.

The advantage of reporting news a week late is, I suppose, that I can

take the time to explore it a bit before writing. So I think I can state

firmly that Python 2.3 is very nice. In fact, it has enough improvements and new

modules that I’m seriously considering throwing backwards compatibility

out the window and enthusiastically adopting Python 2.3 for all my current

and future projects.

Some of the new features I’ll be using:

  • csv – this could have saved me many hours of work at my day job,

    had I known about it 4 months ago.

  • datetime – finally, real datetime types, and methods to convert

    datetime objects into all the commonly used string formats.

  • DocXMLRPCServer – I probably won’t use this directly, as I don’t

    think it will integrate with Twisted, but the concept is very cool and I

    may be able to port/import some code.

  • logging
  • optparse – easy command line parsing and –help option printing
  • textwrap – utilities for wrapping long lines of text by inserting

    line breaks. This will be a big help in the Hep messaging library.

  • sets – compare and combine dictionaries without nested-loop

    silliness.

For more details on the new features of Python 2.3, see

the Python 2.3

Highlights page, and

>the effbot Python Standard Library New Modules page.

Python support in Eclipse getting better

Wednesday, July 23rd, 2003

Browsing SourceForge today I was happy to see that there’s a new

Python plugin available for Eclipse:

Xored TruStudio.

It does more than syntax highlighting, offering a working outline view

that makes navigating large modules much faster. It gives you

the ability to run an interactive Python console within Eclipse, so you

don’t have to launch a seperate terminal window. And, of course, it’s

open source.

Also worth keeping an eye on: PyDev.

At first glance, this looks like YAEPPOSTHRAFY (Yet Another Eclipse Python Plugin On Sourceforge That

Hasn’t Released Any Files Yet), but a look at the project homepage reveals

a link to the author’s blog… which is hosted at

href='http://blogs.osafoundation.org/atotic/'>blogs.osafoundation.org.

Yes, it looks like Alex Totek’s work on PyDev is being sponsored by

the OSA Foundation – in which case it could become the first-class development

environment I’ve been looking for.

The Twistification of Hep

Saturday, June 28th, 2003

I know it’s been a few weeks. Sorry for the silence, here folks. I’m still

around. The main reason for the lack of posts is that my local copy of

my blogging tool of choice

has been broken, as I’ve been aggressively refactoring some of the core

classes in the messaging library, as well as making some important changes

in Hep (more on that later). Also, I’ve been incredibly busy. But finally

today I have the combination of time and motivation to write a weblog entry

the manual way – by ssh’ing in to my server and typing it in vi.

Back on the 7th Thomas Weholt posted a question to the Twisted list. He was

trying to write a web server, using Hep’s code as a starting point. This had

the consequence of bringing attention to the fact that, while Hep was using

Twisted, it was not using Twisted the Right Way (you can read the complete

thread on the Twisted mailing list here).

Twisted is a pretty big framework,

and up until this month I wasn’t ready to jump in with both feet. I picked

bits and pieces of the libraries, mostly the protocol implementations, and used

the mainloop to run Hep, but I avoided relying on Twisted features if I didn’t

have to. Now, though, I’ve reached a level of confidence with Twisted where

I’m ready to do things the Twisted Way throughout Hep, and hopefully make Hep

into a good example for Twisted newbies to learn from. I’ve started this

process already, and I’m not regretting it. Twisted is really nice, and the

developers are very smart guys. There is a learning curve, but so far I’ve

found that the time invested in reading the docs and asking for help on

the mailing list and IRC is well worth it.

In the coming days I’m going to start writing some “What I’ve learned about

Twisted” posts, explaining the various Twisted features I’ve started using

in Hep. So stay tuned for that.

Test Post

Tuesday, June 10th, 2003

Checking to make sure my timestamps are correct… ignore me!

Letting the dough rise

Tuesday, June 3rd, 2003

I haven’t had much time to work on Hep lately. I’ve been wrapping up a 9-month project at my day job, which has been taking up most of the time I would usually have for Hep and other fun things.

But I think the break has actually been a good thing. Like wine, cheese, and bread dough, some ideas get better after they ferment for a while. I had been wrestling with some design decisions; now I’ve come up with solutions that I’m happy with. So as soon as I get a few extra hours I can start implementing them!

Meanwhile, elsewhere on the internet:

  • Sam Ruby is doing something interesting with his comments. Take a look at this thread, and notice all the different places comments are coming from: posts, emails, trackbacks, excerpts. Posts and trackbacks are easy enough to understand. Excerpts can be pulled from other sites by analyzing the referrer log. I’m not sure how he’s getting email content in there. Hey Sam, what’s going on behind the scenes? Are you posting relevant emails by hand?
  • The first public release of Haystack is available. I ran it on a Windows box today. It looks sweet, but at the moment it’s so unbelievably slow that it’s painful even to play with. I’m sure this will get better with time.

Message library improvements

Tuesday, May 20th, 2003

I’ve been working on improving Hep’s messaging library, fixing the things that have been bugging me about it. The messaging.Message class in particular has seen a lot of improvements. I’m feeling good about it now.

Basically, messaging.Message is just a thin convenience wrapper on top of email.Message (although it doesn’t inherit from it at the moment). This last set of changes was focused on improving the ability to edit existing Message objects. Up until now Hep has created mutipart/alternative messages, and generated the text and HTML versions of a message at the time of generation. But this has some disadvantages: it wastes disk space, and you lose track of the original message format – was it text, with generated HTML, or HTML, with generated text? Also, it wasn’t possible to inject the RSS link URL into the message body as needed, so I had to put it in there at the time of generation, which was less than ideal since it’s really metadata.

Anyhow, now it’s much nicer to work with. Sample code:


>>> import messaging

>>> m = messaging.Message()

>>> m.title = "Hello World"

>>> m.author = "abe@fettig.net"

>>> m.link = "http://www.fettig.net"

>>> m.setHTML("""

...    <h1>Test Message</h1>

...    This is a message in HTML format.

...    """)

>>> print m.asEmail()

Date: Wed, 21 May 2003 03:23:47 -0000

Subject: Hello World

From: abe@fettig.net

MIME-Version: 1.0

Content-Type: text/html

X-Hep-Link: http://www.fettig.net

        <h1>Test message</h1>

        This is a message in HTML format.

Notice how m.asEmail() gives you a nice simple e-mail message, with a content type of ‘text/html‘.

Now, to get a nice mutipart/alternative version of the message, with a text version for mail clients that

don’t support HTML display, and the link embedded in the message body, all you have to do is:


>>> print m.asEmail(generateMissingParts=1)

Date: Wed, 21 May 2003 03:23:47 -0000

Subject: Hello World

From: abe@fettig.net

X-Hep-Link: http://www.fettig.net

MIME-Version: 1.0

Content-Type: multipart/alternative;

        boundary="===============19186210073222743=="

Message-Id: <md5id:73d197064b90f25bb97b870cd82510d4>

--===============19186210073222743==

Content-Type: text/plain; charset="us-ascii"

MIME-Version: 1.0

Content-Transfer-Encoding: 7bit

Test message

This is a message in HTML format.

http://www.fettig.net

--===============19186210073222743==

Content-Type: text/html; charset="us-ascii"

MIME-Version: 1.0

Content-Transfer-Encoding: 7bit

        <h1>Test message</h1>

        This is a message in HTML format.

        <p><a href="http://www.fettig.net">http://www.fettig.net</a></p>

--===============19186210073222743==--

If you‘re using Hep from CVS, now would be a good time to do a cvs update. If there are bugs in this code I’d like to know about it.

Hep Update, May 7: new configuration pages

Wednesday, May 7th, 2003

If you update your copy of Hep from CVS you’ll find that there’s a new and improved web interface for adding, changing, and deleting connections, as well as setting protocol options. But before you jump in there and start changing things, a warning: If you rename a connection, you’ll lose any old messages that were associated with it. Also, searching will become very unstable, because search results may refer to messages that no longer exist, or that have moved. These problems will be fixed in time, but keep in mind that you now have the power to shoot yourself in the foot, and don’t rename or delete connections unless you really have to.

Also, let me come out and say that the current web code is really messy. I am not proud of this, and I’m actively working to make it better. In the meantime, please treat it with the same kind of of respect you would give a hot dog factory: enjoy the result, and don’t worry about what’s going on behind the scenes.

Have I mentioned that there’s a mailing list for Hep CVS commits? Just in case you feel the need to know about changes the instant I make them.

Paul Graham compares hackers to artists

Wednesday, May 7th, 2003

Paul Graham: Hackers and Painters (thanks to Ted Leung for the link). A intriguing and funny look at the difference between scientific and artistic professions, the role of the day job, and the importance of empathy in software design. (And it’s an even better read the second time).

Hep Update, May 2: Textile, Lupy, Windows file paths

Friday, May 2nd, 2003

Is it Friday again already?

I’ve checked in a couple of small (but important) changes to messaging in CVS. First, text-to-html conversion is now done with Mark’s PyTextile module. See the original textile page for more information. Second, I fixed URL parsing to handle windows paths correctly – now Hep should work on Windows even if you have an abolute path for ‘root’ in hep.ini.

Also there’s a new version of Lupy out. You don’t have to upgrade, but you can if you’d like – I’m using it with my personal copy of Hep and it works fine.

Hep Update, April 25

Friday, April 25th, 2003

This was a pretty quiet week for Hep development. I’ve been spending some time thinking about where to go next, but I’ve been so busy at my day job and in life that I haven’t had much time to work on code.

I did check some improvements to the web interface into CVS this afternoon. Screenshot:

I’ve also started working on improving the core Message class in messaging, but that’s not quite ready for checkin yet.