Skip to content.

Green Leaf Technologies

Sections
Personal tools
You are here: blog

Tom's Blog

Created on 27th September 2006 03:51 PM. Python
Generating an RSS feed from a Database query is ridiculously easy with Python's awkwardly named PyRSS2Gen module.

Here's how simple it is. Create your database query, and then throw it into PyRSS2Gen's RSSItem method. Then create an RSS2 feed. This code shows you how:

 

items = []

 

for row in databaseitems: 

  items.append(
    PyRSS2Gen.RSSItem(
      title = row['title'], link = row['link'],
      description = row['description'],
      guid = PyRSS2Gen.Guid(row['guid']), pubDate = row['pub_date']    )  )

PyRSS2Gen.RSS2(
        title         = "Feed Title",
        link          = "http://localhost/test URL",
        description   = "Feed Description",
        lastBuildDate = datetime.datetime.now(),
        items         = items).write_xml(open("test.xml", "w"))

 

You can then connect to this with your rss reader by publishing the xml to a web directory and pointing your RSS reader to the location of the XML file. Very nice. 

Created on 14th September 2006 08:19 PM. Python
What's prompting this flurry of blog postings? Sometimes you just gotta share... Deskbar is great. I knew that before, but now I'm sure    

When I first discovered deskbar, I thought - great, now Linux has something that Mac already has, and that's a good thing because it means we're not so far behind.

But this time around, I've discovered it's not just a nice little applet that can match the functionality of the Mac applet, it's actually something that's very useful to me and I'm going to be using it as an integral part of my work schedule from now on. I love being able to send email to contacts from the deskbar, and initiate web, file content and/or file searches from the same place. Nice looking plugin architecture for it as well - been seeing some interesting add-ons on various blog postings recently including a built in calculator.

And it's written in python, which obviously tickles me in the right place. 

Created on 14th September 2006 12:31 PM. Python 2 comments
Today saw the end of an era - finally removed all Zope and Plone packages from the Green Leaf Technologies servers.
An impending apt-upgrade for zope2.7 reminded me that I still had Zope installed. Duly uninstalled them. Thanks for the service you gave me, guys, but I just found you too complicated to dive into and in the end you were nudged out by Django .
Created on 13th September 2006 12:19 PM. Mono | Open Source 2 comments
The default slideshow in f-spot shows each slide for only 2 seconds. I'd like it to be longer. Here's how I did it.    

By following the excellently simple instructions here I was able to get the CVS version of f-spot downloaded and building. I then took a quick peek in the src directory and saw a file called SlideView.cs. I edited the following section of code:

 

 private void ShowNext ()
                {
                        StopTweenIdle ();

                        if (current_idx != next_idx && next != null)
                                this.Pixbuf = next;

                        current_idx = next_idx;

                        black = false;
                        transition_interval = 75;
                        flip_interval = 5000; # Changed from 2000

 

               }

 

And then ran make all install. That's it! I can't believe how easy it all was. Since I'm partially interested in this whole Mono thing, and like the look of f-spot as an application, I've decided I'm going to try and enhance this a little by adding the ability to edit this value from within the menu. It would probably make the most sense under "Edit -> Preferences". If I can do this successfully hopefully I'll have learnt a bit of C#/Mono along the way, and maybe I'll even try and submit it as a patch.

Hard to believe, but I think this is the first time I've taken a look at the source code for a desktop Linux application, and it's been a very pleasant experience so far. Use the source!

Update: 2006-09-13

I've discovered on the f-spot mailing list that someone's already submitted a patch for this specific issue. Would be great to see it make it into the next release! 

Created on 11th September 2006 10:49 AM. Open Source
One of the most argued points in geekdom is the question of who will "win" in the "battle" between Microsoft and Open Source Software. While it's arguable how useful such a question is, it's always interesting, I find, to see how people are approaching it. Harvard Business School has decided to weigh in on the subject, and here I look at some of the things they say.

Their basic argument is all things being equal, Microsoft fails to dislodge OSS altogether, and OSS fails to break MS's monopoly entirely. I'm okay with that, to be honest - I think that's a realistic point of view, and despite my bias towards OSS, I can believe that's a good model for how things will work out. However, while I agree with their conclusions overall, I disagree with some specific points:

"In addition, a larger installed base [for Microsoft] also implies that there will be more feedback on bugs and more suggestions for new features." I'm not sure I agree with this. In principle, yes, but in practice not everyone who uses an OS files bug reports and send feedback. Who does? An active minority who have the technical know-how to do so (therefore to some extent it's dependent on how easy it is to file bug reports and give feedback, and how useful/specific such feedback is), those who are very passionate about the OS, and those who have a serious pain point with a specific feature or features of the OS. Therefore, it's not entirely accurate to say that more users equals more bug reports and feedback - it's better to say that more of these specific types of users means more bug reports and better feedback. And I'd argue that Linux users as a whole tend to fall more into these categories than Windows users.

"The basic trade-off is the following: With a duopoly, more individuals and organizations use PCs because prices are lower, and this raises welfare. However, with a duopoly, no operating system ends up exploiting fully its potential because developers' efforts wind up divided between the two systems. However, with a monopoly, the efforts to develop new software and improve the platform are directed towards one system only and this may turn out to be better from a social welfare perspective." This takes a far too simplistic approach to the relationship between a software monopoly and software development. In practice, there are other issues to consider:

  • How easy is it for developers to develop on a given platform?
  • If there are cross platform development tools, efforts to develop applications for an OS aren't split between OSes - they benefit both
  • A monopoly leads to software homogeneity
    • From a security perspective this is not in the social welfare
    • It can also lead to a lack of innovation because there are no alternatives to experiment with new ideas and approaches to things.

"we were also surprised to find that piracy may end up increasing Microsoft's profits". I don't think you should be surprised by this. I don't think Microsoft is and it's a fairly well known phenomenon in geekdom that MS would prefer piracy to using an alternative.

Other than that, I think this article has a lot of good points. Some interesting thoughts on how FUD (and other morally questionable approaches) is a strategic approach that can benefit MS.