Archive for August, 2005

Aug 23 2005

Flickr can Post Pictures

Published by Chris McAvoy under Blog


IMG_0281

Originally uploaded by chris.mcavoy.

Neat. Just testing. I haven’t actually posted anything terribly interesting to my flickr account. I’m not sure I will. It’s fun to have a gajillion unused tools at my fingertips.

No responses yet

Aug 17 2005

Anonymous Session Support in Django

Published by Chris McAvoy under Python

Anonymous-session support has been added to Django. This is great news. Great work Django-neers.

No responses yet

Aug 12 2005

August ChiPy Meeting

Published by Chris McAvoy under Python

We had three great presentations tonight. asl2/”>Aaron Lav gave us a rundown on the current state of Unicode (in Python, and out in the world in general), and showed us his Chinese language annotator. It’s a pretty neat system. You set it as your proxy server, and it rewrites Chinese language pages with links from the individual characters on the page to their literal translation. He built the system as a step towards learning the language, but ended up learning more about Unicode than Chinese.

Ian Bicking compared and contrasted distutils and setuptools. The number of options for packaging your Python modules is increasing as of late, so it was good to survey the territory.

Finally, tobis/”>Michael Tobis kicked off a new series of presentations aimed at the Python new-folks. He covered the Python Debugger. Although it was geared for people new to Python, it ended up being very informative for the whole room.

We’re going to continue making at least one presentation per month focus on relatively beginner level introductory stuff, and mix it up with more advanced presentations. Next month Brian Ray has offered to give a presentation on embedded Python, and someone (still up in the air who exactly) will most likely give a presentation on extending Python. It should be a good September.

The meeting was held at Imaginary Landscapes, who also provided pizza and pop for everyone. Thanks Landscapers!

Incidentally, we made a couple of half-assed attempts at recording the presentations. A variety of technical gotchas may make them un-watch-a-listen-able. We’ll see. It was a good experiment. We consistently have great presentations at the ChiPy meetings, and we’re trying to get the content out there folks that can’t make it in person.

No responses yet

Aug 10 2005

Stacks are the new frameworks

Published by Chris McAvoy under Blog

Stacks are the new frameworks” says brian d foy.

Eeep. I say Stack all the time. Clearly I’m a shill for buzzwords.

No responses yet

Aug 10 2005

Thanks Leo

Published by Chris McAvoy under Python

Leo, the neat-o Python based outlining program, got me a nice compliment from my manager this morning. I started building an outline for some documentation I had to write. I went to start writing it up in M$ Word, and decided to spend an hour or so surveying the Leo-landscape to see if anyone had come up with a compelling tool to let me flesh out the outline, and spit it out in some sort of documentation-like format.

Lo and behold, Leo now has a ReStructuredText plugin that comes with it (batteries included). Part of the plugin allows you to doubleclick the root level reSt node, and generate a very nice looking HTML page. I edited up the CSS a bit, and voila: documentation done. The only prerequisite to the plugin is Docutils, which I had installed anyways. I put the page out on our intranet, and recieved a nice compliment “I like the format of that documentation.” The Leo plugin builds a table of contents, handles all the internal links, and even does nice tables and footnotes. I was very impressed, so was my boss.

I’ve tried writing reSt in Vim, but have always ended up getting bogged down in the markup. Something about the size of the documents made it difficult for me to keep it all together. I like the node-yness of Leo. I build some top level sections (introduction, the problem, what we did, why what we did is awesome, conclusion, appendix) and then go to town. Editing a section at a time is nice. It keeps me moving forward, like blinders on a horse.

A side-bonus is the ability to open a given node in Word. Sure, we hate word, but we do like the spellchecker (I couldn’t get the Leo Spellchecking plugin to work).

No responses yet

Aug 09 2005

Daily Python loves Django

Published by Chris McAvoy under Python

Django appears 47 times on Daily Python-URL.

No responses yet

Aug 08 2005

Neat bit of magic from Django

Published by Chris McAvoy under Python

I’m interested in the whole idea of writing domain specific languages for “stuff.” Nothing really specific, it just seems like a neat idea to me.

Something that I like in Perl is the ability to call a method on an object through a variable name:


my $method = "someAwesomeMethod";
my $i = $someobject->$method("some argument");

Python has getattr, which is pretty flexible:


method = "someAwesomeMethod"
i = getattr(bigobject,method)
i("some argument")

The problem that I’ve run into with both these methods is you need to know the name of the module that you’re pulling the function from. Django makes use of a lot of on the fly “get this function from this module” stuff in the configuration, which is pretty cool. I was poking around the code trying to find an example of this, and found one a few minutes ago:

return getattr(__import__(mod_name, '', '', ['']), func_name)

I’ve never used __import__ , so I had to play around with it a bit. It ends up returning the module you’re trying to import named by the string in mod_name. Then getattr does what getattr does. Pretty neat. It’s a pretty easy way to then build little languages that refer to “tools” you’ve built for a business group. So they could do something like:


if test1: test2
else: pass

Or some such thing. Nice work Django guys, not that they invented this method, but in laying it out for me. I’m not entirely sure what they’re doing with the extra arguments to import(). More research is needed I guess.

EDITED TO NOTE: more research was pretty quick: http://www.python.org/doc/2.3/lib/built-in-funcs.html

No responses yet

Aug 04 2005

Django First Impressions

Published by Chris McAvoy under Python

Actually, my first impression was last month, but I’ve only really had the chance to sit down and check stuff out over the past couple of days. What I’ve seen so far has been really good. In a single sentence: I think I can build some cool stuff with Django.

I’m putting the finishing touches on a website for my wife and her coworkers to sell handmade jewelry. I’m using Myghty and SQLObject for it, and the experience has been really positive. The project was originally going to be a Plone based app, but I ended up having a hard time fitting my stuff into the Plone model of doing things. Of course, moving to Myghty meant that I had to build a bunch of stuff from scratch. SQLObject saved me a lot of time on the backend, I had a working database model in less than an hour of paper planning / typing.

Building the back end adminstrative stuff with Myghty was pretty much the same old CRUD that’s involved with just about every LAMP app. It’s boring, repetitive, and gets old quick. If I’d used Django (which wasn’t released when I started the project back in May), this kind of stuff would have been delivered for free. Which would have saved me an awful lot of time and typing.

All the CRUD was one of the main reasons I was trying to build the app in Plone in the first place. I was really impressed with Plone archetypes. It was neat being able to build objects with complete editing stuff built automatically. It got hairy later on when I was trying to build the frontend stuff. Object databases are confusing to me, and ZPT just doesn’t work for my way of thinking. It was a pretty frustrating experience. So I ditched Plone (sorry Plone) and went with Myghty. It made sense because I’d just started working 9-5 as a Perl / Mason developer, so it’s nice having some heavy similarities between the day job and off hour projects.

When Adrian presented Django last month, I was kind of turned off by what appeared to be strange ways of building URL parsing. I loved the admin / db-api stuff instantly, but thought the front end might be too much for me handle comfortably. After running through the tutorials, and experimenting a bit, I found out I was totally wrong. So wrong, that I actually ended up using the basic Django URL parsing concept for my Myghty dhandlers.

So far I’ve tried a handful of Python web frameworks, Zope / Plone, Myghty, Webware, CGI (is that a framework?), and now a bit of Django. Of all of them the Myghty & SQLObject seems the most natural to me. That said, Django is what I wanted Plone to be way back when. I can’t really say a whole lot more than that until I try and build something substantial with it. Paraphrasing what Jason writes in his blog Django is sort of between Myghty and Plone in terms of the ratio of what you get for free, and how much you’re ultimately forced into a certain model. The ratio could also be something like the amount of time I save versus what how much I clench my jaw during the course of the build out. Myghty is right about level on both scales, Zope is definitly way too far on the jaw-clenching side of things, my first impression of Django is that I’m probably going to kind of squish my face up a few times as I learn stuff, but the free stuff is ultimately going to far outweigh any stuff I’m not sure about.

The thing I like about the whole RAD web app Rails / Django world is the idea that you can implement an idea very quickly. Quick is a big deal to me. I am a Chicago Transit Authority sideline coder. The majority of the work on any side projects I’m messing around with happens in the 90 minutes I spend on the train to and from work each day. If Django lets me churn out ideas as quickly as I suspect it will, then it will most likely become my preferred web app making doo dad.

It also helps that the website and documentation is like a big fat candy bar. I love it.

Also, as an aside, I don’t want to hurt anyone’s Plone feelings. I really do think Plone is a great product, it’s just not for me. At least, until I have some big CMS to build, in which case it would be my first choice.

No responses yet

Aug 04 2005

Python USB!

Published by Chris McAvoy under Python

PyUSB popped up on daily-python-url this morning. That’s pretty good news. Something to check out, as serial connections are getting harder to come by. If PyUSB makes USB programming as easy as PySerial does, that would certainly be something to watch.

No responses yet

Aug 03 2005

O’Reilly Connections

Published by Chris McAvoy under Blog

I’ve been having a grand time messing around with O’Reilly Connections. If you’re on there, send me one of those invites. It will increase my feeling of self-worth.

No responses yet

Next »