Monthly Archives: February 2006

Ahrrg! Got bitten by a snake!

When I started to wrote some lines in python I was not all happy about the libs and how namespace are managed and by the not so OO design of most of the built-in libs. But now that I’ve written some more lines I think it’s all right. Even more, I think that python is by far the most productive language I’ve learn. Let me sum this up like this:

1. Identation

Making indentation matter solves more then the ‘style’ problem. The code flow comes really close to the thinking flow. For example, when I write a function in C or java, until I’ve written the final } I can’t even start to think, my brain is frozen. I know what you’re saying! Wear a hat while coding! Yeah, but I’m not a hat type of guy. So when I code I like it to flow as fast as my thoughts and not make me think of what I want to do at the end when I’ve not even started to think what I was trying to do. Idendation makes the code looks right in my brain, this should be a closer step to implementing a compiler right into my brain.

2. Imports

Even if I’ve not all hyped about namespace management, typically the fact the you have to write shutil.copy(...) and not copy(...) bugs me a bit. But in a way, this make the code more readable, cause when looking at a line you know exactly what libs is taking care of what and when. But the thing I like is how imports are handled in you scripts. You can be in the 10th directory level and still write from base import MyClass and all that without defining references of annoying stuff like that.

Yes, but…

But the main drawback is speed. Python is slow, really. So maybe Boo could be a cool alternative, plus that it can use all .NET libs, aye!

Leave a comment

Filed under Misc

Double release

Today I’m releasing two of my projects one was sleeping on my hard drive for some time now. So I guess if this can be of some use for someone else, cause it was for me, so there it is…

The first is an asp code documenter, implemented has a NAnt task. It browses you asp pages and gather all XML comments (same format as .NET XML comments) and extract them to a XML file. I’ve also included a XSL file to format the document to a HTML page. So you could easily twiq this to generate the doc and post it to your web site, which is what I did for some asp project.

Here’s the binaries :

And here’s the sources :

To compile run :

> nant build.debug

My other project is my first intro to python, it’s a code generator largely inspired by Ruby on Rails generators

To run it type in the base directory:

> python

This one should be even easier to twiq. To add a generator of your own, go to the base directory and type:

> python generator mygenerator

Then go to the directory /mygenerator that was created. The file is the main class that act has the generator, check other directories for sample usage. The directory templates contains all the templates used to generate the output. Here’s a sample generator to explain this a little:

class SampleGenerator(Generator):
def run(self, argv):
# Each time you define a new class variable,
# it will be accessible from the templates
# generated from here. = argv[0]

# This is pretty explicit…

# This parse a file while replacing all
# python template variables (starting
# with a $) with class variable (self.)
# and outputing to readme.txt in the
# directory previously created.

Leave a comment

Filed under Misc

Switching to Linux

Recently I had to install Linux on my computer to complete a school assignment (with Qt and OpenGL) which I did on dual boot with Grub. I chose SUSE, with which I had minor problems will installing, but overall it was pretty easy. And now using KDE, all I can say is wow! All is fully customizable from the window behavior to the bottom panel icons animation. What a difference with Microsoft rigidity (which I guess is volontary to keep a uniform “brand” look). Anyway all that to say that I’m very please I will probably stick with Linux… as long as I can get to compile all my main project with Mono, heur…
Anyone had experience “porting” existing .NET projects to Mono?

Leave a comment

Filed under Misc