Monday, May 09, 2005



Bolivia just came in this morning :)

She's my new Laptop. A sexy Compaq R4000.

Right now, its running Windows Only..... Uggh!! I'll fix that over the weekend. Put Archlinux + Enlightenment D17.

I can hardly wait to see Enlightenment on this baby.... un... one... two... UNO!!

Right now, i'm paying my last rights to Wendy (My Older Laptop a buxom Dell Inspiron 2500), She served me well too, and stuck with me thru my earliest of Open Source Projects (ALE, PTSP and currently imlib2 python bindings and edje python).

She's done good, but i'm eager to put Bolivia to the test... with a sweet 15.4" widescreen, coding has never been this good.


Ok ok ok... let me get back to work now... this week is going to be full of collaborations btw Wendy and Bolivia as I slowly romance Bolivia :D

ok ok ok....

I'm off now :)

Ohh... and yeah... this post is made from Bolivia :)

Friday, May 06, 2005

XSL Transformations AT WORK - Literally

During our ‘Geekify’ session on Wednesday, Stan took us on XSL transformations and it was like… WOW!!!!


You know… XML is cool and all, but probably XSL is really what makes XML sooo usefull. Its so interesting.


Also, just to satisfy the Geek Child in me, I designed an XML format and accompanying XSL stylesheet for our daily SCRUM updates. Those where beginning to look messy, and I’d had in mind to write a Python frontend, to generate the report, but once Stan did the XSL tutorials, I was like… HEY!!! That’s what I need. Akin is currently using the XML raw, but he’s interested in Building a GUI frontend, to generate the XML for him. I mean, he takes notes at scrum, so he’s the one to make his life easier.


The other part of this is that, with all this ‘make_life_easier’ projects I’m introducing at the office, its interesting to see how other members of my team are reacting… it seems hacking is back in fashion at the office, and I’m beginning to notice it in how we’re working.


Ahh… the rise of the hackers :)



   [x for x in range(0,200) if (lambda y: len([z for z in range(2,y-1) if y%z == 0]) == 0)(x)]






Wednesday, May 04, 2005

Python In The Office

I’ve been finding ways to make my life easier, more interesting and generally more efficient.

Ok… that’s just an excuse to introduce my lattest work plaything… Python.

If you know me at all, you’ll know that I would love to work daily with Python, but I work in a C#/.NET outsourcing, so it’s sort of impossible right? I mean since IronPython is still in early alpha, there’s nothing I can actually do about that, right?

Well, I’d not been really using my brain earlier. Now that I am actually turning on my brain full force, by aggressively getting lazy about repetitive tasks in any incarnation, I’ve began to really see uses of Python all around what I do almost on a daily basis.

It started with writing libpm, which is a Python library to interface with a Webservice which we use to do some reporting at work. Well, my next focus was some really dreary analyses I’ve been doing on a database project. I run some huge queries, and produce files and I’m supposed to compare for accuracy and other stuff. Well, when I’m troubleshooting, I get to do a lot of other fancy stuff to those files, and I’d been doing all these visually all this while!!!

Last week, I had to get back to the project, as it has over-dragged behind other projects, and for the analyses, I said NO NO NO, I’m not doing this visually again. I mean, its not even efficient enough, so I dug up Python and started building up small functions and small programs. As a result of that I now have a little module called ‘kamba’ that does some really interesting text processing. The most exiting is a function align, that if given two lists in the form of:



Will return a third list which aligns the second one against the first one, like:

[1, ,3, ,5,6, , ,9,10, ]

This single functionality is a realllll time shaver :D, and combined with other stuff has helped me get more usefull results in my analyses.

I think I’ve discovered in doing this, that hackability of a platform depends on a lot of factors, but most importantly are the tools available and the mindset of the said hacker.

I really am not thrilled by Windows generally, but hey, Python on Windows is helping me get some of the fun I normally catch on UNIX.

The second thing is that flexible tools affect mindset. For instance, If I didn’t have Python available to me, there is no way I would have written those tools in a language like C# or similar. Why? Well… there’s a lot of inherent overhead in setting up the project, and just thinking thru annoying issues like type definitions and other things that are not directly related to the problem you’re trying to solve.

This is not exactly a bad thing considered on its own, I mean, there’s the argument that you should use another tool to do that kind of thing. Well… this brings me to my point. My point is that a lot of programmers these days (well, at least more than I would like to think about), don’t have any kind of dynamic programming tool at their disposal, because there’s this prevalent all or nothing mindset.

Those kind of people are more apt to resist programmatic changes. They don’t think in terms of scripts and quick solutions. They’re not used to making small programs that do only one thing and do it well, or really to writing small functions that do one thing and do it well.

Basically, by sticking to and working with non-malleable programming languages their mindset is also non-malleable. These kinds of programmers find it hardest to think Agile or think in the dynamic way needed to really drive software development these days.

Ofcourse you could say this is just my opinion, and I’d agree with you, but I’ll point out that I’ve met plenty of these kinds of programmers.

My recommendation is that every programmer, should learn more than one language. And these languages should be best spread along different programming paradigms. For instance, if someone learnt to program with Java, and has now learnt C#, yeah… that’s ok… but this person has NO IDEA whatsoever of how a program can be written without classes. This programmer also is more likely to have more complex approaches to problems than others that are exposed to say C, Ruby, Python, Perl, and shell scripting.

Anyways…. Work is currently more interesting.



Yesterday nite, at the perfect witching hour( 12.00 midnite), myself and stan started work on building a python extension module for imlib2.


Imlib2 is a very robust and interesting image manipulation library is part of the new generation Enligtenment Family – Enlightenment Foundation Library.


It was a very enlightening experience (pun intended – mfon, I just had to say that :P). Our approach which we’re trying to keep as Agile as possible so we see quick results, was to pickup the EFL Cook Book, and go thru the examples on imlib2, then for each example, port enough functionality to a python extension to allow the example to be done in Python totally.


As at yesternite, we have just one function left to complete example one.


So far we have:






tonite, we’ll add imlib2.blend().


What we’ve been thinking is that it will be more natural to have an Imlib2Image object(), that will have all these functions as methods. For now, we’ve not totally decided how to implement this, but I don’t think we’ll build the object in C. its more likely that when we have the functions in python completely, then we’ll build a higher level Python Library abstracting that into an Object. That’s the more natural way that I’m thinking of it.


Ahh… this application layering thing is making lots of sense now.



   [x for x in range(0,200) if (lambda y: len([z for z in range(2,y-1) if y%z == 0]) == 0)(x)]






The Force Is Strong With This One

If you've not yet guessed, my favourite programming languages are C,Python and D. I have no real order there, as it depends on what i'm doing, but with those three languages i have a whole spectrum of problem areas covered.

Recently, i've been thinking of adding one more layer to projects i do in C. A python layer.

The thougt process follows from trying to make a system as programmable and explorable as possible, and to reduce the amount of time needed for a hacker to get to actually hacking the system. What trips me silly about python everytime, is the live intepreter you get with it, so one can interogate libraries while learning about them. You don't have to use the usuall - READ_FIRST->Code->Compile->PRAY_MURPHY_IS_BUSY->Execute cycle. You can actualy grab a library, and fireup the intepreter, print the __doc__ string, and start figuring out how to go, if you get stuck, google, then come back and continue.

To a large extent you can do this in other languages, but Python with its live intepreter takes it to a new level... trust me :)

Anyway, this is a model of programming in c i'm trying to formulate:

[Applications (C-Programs,shellscripts, GUIs,etc)]

| | |

| [c-command-line-utility][Python Layer]

| | |

[ c-library-layer ]


[ problem scope ]

At the bottom-most of this layer, is the problem we're trying to solve. Say for instance, manipulating Netfilter on LInux in userspace.

The first layer, is made up of a well designed C-Library (in this case, libipq), that properly abstracts every kind of interaction with the linux Netfilter layer. Once the library is in place, theoritically, the problem is solved, but normal users can't use it yet. Applications have to be written.

On unix, there is a common practice, that these libraries normally are accompanied by command-line utilities, that are almost like proof-of-concepts for the libraries. Some of these tools are so advanced that every single thing doable in the library is doable by the commandline utility with just an option switch and the proper argument. (I should state here that sometimes, probably most times i guess, these libraries are never solo projects, but actually arise while on the path to craft the command-line tools)

Traditionally, after the command-line tool layer is available, it qualifies as an Application, well..., as a System software. At this stage, system administrators can use shell scripting, perl or even python to drive the command-line utility in ways the creators never thought was possible. Finally, GUIs can be tacked on as a Front-end to many of these utilities, and we have a complete appliation stack.

The problem is that once in a while, there exists a feature that can not by its very nature be exposed by the command-line-utility. Apart from that, it may not be desirable for any reason to write a much higher level application in C. I personally prefer to leave that layer for languages like Python and D... Actually Python ;)

This is where the other layer, the Python Layer comes in. I placed it at the same layer as the command line utility, because it interacts with the c-library-layer for you, but unlike the command-line-utility, it can have access to every single functionality of the c-library, hence allowing even more to be done at a higher level in the stack, without having to fall back to raw C.

I'm currently literally putting my money where my mouth is, by building a python layer for 'scode' i call, pyscode. Scode is a personal project of mine (hmm... i should put it up on my website next weekend.)

I’ve also concluded a python extention to another library I have (a much smaller one I use for managing packed inet addresses and dotted notation), called ‘addrtool’.

so far, i'm having fun learning how to extend Python with C. It trully a path to increasing the Force withing you :D

Ok... so much for my ramblings.


[x for x in range(0,200) if (lambda y: len([z for z in range(2,y-1) if y%z == 0]) == 0)(x)]