Sunday, December 14, 2008

Pylons & PIL (Python Image Library)

Pylons is moving along nicely and I am delighted by that fact. The Pylons book was recently sent for publishing. Pylons itself reached the final RC versions. Christmas is coming. What more could one want. Fine maybe not everything is going that smooth but at least we can pretend.

Without further general talk the topic for today: Pylons and PIL in a virtualenv.

I am on an Ubuntu machine with the latest updates installed. Recently I started a new project with Pylons using the latest version (as of time of writing it is 0.9.7rc4). I setup a virtualenv and began tapping the keyboard. Soon enough I needed to manipulate some images and what better way to do it then PIL. Let the tough stuff begin.

Ubuntu comes with python-imaging package which is exactly PIL but the way it is packaged it does not get picked up by while virtualenv is being created. I poked around the directory structure where PIL is installed and found it to be linked to another directory (/usr/shared/pyshared I think it was). I guess the Ubuntu guys who rely on python extensively need the library and for convenience or something else distribute the package like this. So system-wide PIL is out of the question. Need to install on in the virtualenv then.

Downloaded the source and upon attempting to build the package a whole twenty something screen of errors poured. This missing, that missing... Holy cow! Scrolled way back to the beginning and noted that Python.h was missing. A-ha! Quick fix:

sudo apt-get install python-dev

Presto! Compilation wend on like a charm. Time for selftest.py. Bang! No-go again. One test of 57 failed:

IOError: decoder jpeg not available
1 items had failures:
1 of 57 in selftest.testimage
***Test Failed*** 1 failures.
*** 1 tests of 57 failed.

Searching here and there the "cure" was found:

sudo apt-get install libfreetype6-dev libfreetype6 libjpeg62-dev libjpeg62

After a recompile and a selftest.py again everything looks fine:

57 tests passed.

The obligatory check in the virtualenv was in order:

$ python
Python 2.5.3a0 (r252:60911, Nov 23 2008, 12:10:42)
[GCC 4.3.3 20081122 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import PIL
>>>

Works like a charm. Time to get on cracking on the source again. Hope this helps someone!

Tuesday, August 26, 2008

Way to go Joomla!

I am not really fond of Joomla or PHP for that matter. I am more of a Python kind of guy. I like things being ordered and symmetric. To the point...

Recently I needed to craft a site for a friend's business in a hurry. I had some experience with writing/debugging PHP before but more importantly I have used Mambo and Joomla before. Need to make something clear: I have been using both as an end user! In a matter of days I remambered what Mambo was all about and crafted the site in question, installed some components and modules and a new template. Everything worked out fine, my friend is happy, I'm happy, peace all over the world...

The component used by the site is one written for Mambo 4.5.x/ Joomla 1.0.x and hence I had to use that one. Geeky by nature I had to check out how the component would fare in Joomla 1.5. As you have probably guessed by now, it did quite poorly. It did not install even. Being an amateur developer I decided to look within the code, dig in a bit deeper and check if I can flex my fingers on the keyboard and massage it a bit Joomla 1.5.x style.

I decided that the simplest and quickest way to go would be to simple change any references to old functions and stuff like that, so I went that route. After a week I noticed I am not going anywhere this way, it was hopeless. But wait I've been coding for a while, this should not pose such a big problem, it is a rather simple problem. So on to rewriting it was. This woule require more effort but hey, a person learns his whole life, why not learn this. I took a book from a friend, a Joomla 1.5 extensions development book, to be precise. I read through it quickly, it was an easy read and not a too long one - roughly 150 pages. Time for some coding. I rolled up my sleeves and began hammering out some code. Few hours of coding behind my back I stumbled for the first time. The code in the book I read did not work. I did a quick check for the version the book was for and it read 1.5. So the API changed at some point in time after Joomla 1.5 was out, but we are only a x.x.point release from the 1.5 branch. Red point number one!

The "bug" I found was an undefined function. It was removed from the framework somewhere. First thought was to look it up the API. The API itself is kind of hidden in the Joomla site (thank you Google), is not searchable and to top it all is rediculously slow to load. I looked here and there within the API to no avail. Nowhere was there a mention of my missing function, so I turned to the Joomla forums where I only found a few other people like me who had used the function (probably read the same book) and got the same error but no answer. Upon some extensive use of Google I managed to find a commit log. In it I found a one-line reference saying that the name of the function was changed from "outputFilter" to "filterOutput" or something very similar to that. Difficult access to information for rookie developers scores one more red point in my table.

I managed to move on coding various aspects of the component but was constntly annoyed with the documentation. Sometimes the documentation was refereing to API that was depriciated in Joomla 1.5 and sometimes even in Mambo. For some things there is virtually no documentation. I will not even mention the fact that the documentation is spread across a wiki, a documentation page, a forum... Perfect order. Strike three.

Right now I am quite frustrated with all this. I will still continue developing the component as I would like to update my friend's installation to Joomla 1.5 (hopefully less security risks). Further it is a bit of a challange and I like one of those. I just want to send a clear message to the Joomla team: Guys, you might want to revisit your strategy for gathering developers under your flag. Right now I'd say you are trying to scare everyone off from coding for Joomla...

Wednesday, August 06, 2008

Desktop Linux – still absent from the scene

There were times where Linux was just a dot on the radar. Back in those old days you were to be happy if you could get X (XFree86 was it called?) running, let alone play videos or heavens forbid, games. Years came and went Linux evolved and so did its window manager, desktop environments and graphical user interface software. In recent years everyone is singing a happy song about a mythical creature known as Desktop Linux. Soon after a new year has come everyone is rejoicing naming it the year Linux will be ready for the desktop. And we have being hearing this happy cheers for at leas three years now. Still no desktop Linux on the horizon. How come?

One can go and name reasons why there is still no desktop Linux yet for as long as he wishes to continue doing so. Last night before going to sleep I was thinking of one – desktop graphics user interface performance. For the general public out there who are not devoted Linux fans (like I am for example) there are a few things that matter: ease of use, speed and looks. Almost everyone on the OS market has got the ease of use done arguably right by now. Linux has at least got GNOME with its UIG (or was it HIG). The other two: looks and speed are still missing in action.

Mark Shuttleworth himself once said that in order to achieve better market penetration Linux must get prettier. Well this has happened to some extent. The KDE team managed to roll out version 4.1 of their software a few days back and even though I am no KDE fan at all I have to admit that it looks good. On the GNOME end of the fence there are also nice improvements with every version being more polished then the last one. Mint Linux for example has a gorgeous default GNOME look. If looks is your game then stop by the Enlightenment shop where you will be sure to notice all the eye candy.

Speed and I mean desktop software performance is absent though. You are free to disagree with me and throw and kind of speed tests and benchmarks at me but I stand firm behind my opinion. Whatever way of measuring you may have my one and true meter for desktop speed is how speedy I feel it is.

With compiz enabled my desktop is as speedy as my Nokia E50 and my phone is not that fast! Do not get me wrong on this one, my PC is no dawn of computing era machine, I have an Athlon X2 BE 2300 with 2GB of RAM and a flashy new 640GB Western Digital hard drive running off an AMD 780G motherboard. I hear the crowd roaring. Yes. I am using integrated graphics and the best one I think (so does Anandtech) but this should not make my desktop sluggish when switching windows for example. Turning compiz off or using the proprietary drivers does not help all that much, you get a speed “increase” and it is noticeable but let me break it for you:


It is no way near as quick as, the now 7 years old, Windows XP.


I know XP is as old as the universe and we now have all this new functionalities that we can use with GNOME and recent KDE versions... enough crap. M$ uses these marketing tricks to lure you into buying that bloated piece of crap “software” called Vista.

Speed is missing on the Linux desktop, it is missing in giant quantities. I know there are Enlightenment, Fluxbox and etc. who can make your desktop really snappy but is this all we have got? With all the developer resources behind GNOME, KDE, X, graphics cards drivers... I do not think so. The community can perform better and I am waiting for the moment when I'll be having a snappy GNOME desktop using my integrated graphics and it would be faster then any XP, any day.



Until then no desktop Linux for anyone. Period

Tuesday, June 17, 2008

Fedora 9 and the Firefox legacy

I am a Fedora user for quite a while now - roughly a decade. I have followed though the development of this nice operating system since RedHat Linux 5.2, I think. Let me tell you I am a fan! I have had the occasional flirts with other distributions (ZenWalk, Slackware, Ubuntu I am looking at you) but in the end I always returned to the venrable Fedora. I have been in the ups and downs, through the name change and the "realease" in the wild. I am not saying that I am an expert but a rather a user.

One thing annoyed me quite a lot back in the days of Fedora 6 and now it has come after me again in Fedora 9 - the installed by default version of Firefox. Fedora being bleeding edge and what not, amongst other things, should have the latest and greatest in all of the installed software? Wrong! Fedora 6 shipped on the 24th of October 2006 with Firefox 1.5 (refer to Distrowatch.org for the exact details) as the default browser. Firefox 2.0 was released on the very same day. This new second version of the very popular browser came to Fedora eventually after a month or two...

The next two versions of Fedora shipped with Firefox 2 by default as it took the Mozilla guys an eon in open source development time to roll out Firefox 3 today - 17th of June 2008. No offence Moziila guys, take your time.

Recently we witnessed the birth of Fedora 9, on the 13th of May 2008 to be exact (hip-hip hurrah!). This latest incarnation is close to being bleeding edge but not close enough. The default installed version of the popular browser is Beta 5. After more then a month post release date and more then 300Mb of downloaded updates no Firefox RC in sight...

I know that 3.0 final is in rawhide. I know I can go to http://getfirefox.com and get the latest linux precompiled binary and install it. I know I can compile the source...

Come on guys what's there in a browser (someone in the crowd shouting: "What's not in a browser?)? Other distributions are pushing out Firefox versions a day or two after the Mozilla guys tag a new version in the source tree.

I am all in for the Fedora magic going in all of the packages but are we really lacking so much in the web browser packinging department?

Anyone else being puzzled by this issue? I'd love to hear some opinions. If anyone of the Fedora guys handling the Firefox "issue" ever reads this I would love to hear from him/her/them.

Update: One day after the official release date of Firefox 3 Fedora has already got it in. I am actually writing this with FF3. Congratulations and happy surfing!

Sunday, May 11, 2008

With my first post I would like to clarify the intent and purpose of this blog.
I will be sharing my thoughts (and that is mine only) on Information Technology. Occasionally you will be able to find reviews of different software - from operating systems to general purpose applications. I will share my experience with problems I have faced in my IT life. Other bits and pieces may find their way in this blog too. Those include but are not limited to hardware reviews, coding practices, python (and this is not the snake)...

This will also be my first interaction with the blog universe.

Happy reading! If you find anything you read here to be helpful or interesting please post a comment.