Free Software startups

At GUADEC last days, fun times. One thing I noticed (again) is the growth of the number of small companies, some of them driven by young guys (like, between 25 and 30) doing some really great stuff with Free Software, combining a steady income, whilst still providing valuable contributions to the community.

I’d want to write more about this seen, but here’s a quick idea: how about creating a mailing list for, at one side, these young startups or people interested in starting one, and on the other side people who already got their business running, or already established investors or managers, to discuss issues they encounter, potential business plans, how to get in contact with potential customers, how to combine open communication at one side and dealing with closed environments on the other,…

This could lower the barrier for people to start working full-time on the projects they love, it’d add value to Free Software because larger companies can start using it even more, because more expertise and consultancy is available on the market,…

I guess this is just a shot in the dark, but I think it could be pretty useful. Thoughts?

Python factory-like type instances

When designing applications or libraries, sometimes you need to be able to create instances of a certain interface (in a liberal sense) at runtime without knowing at write/compile time which specific implementation (class) you’ll need to use, as this could depend on runtime variables.

An example of this is an interface providing some functionality which should be implemented differently on different platforms, eg Linux and Windows.

There are some standard patterns how to achieve this. One of them is the factory pattern, which works somewhat like this Python example (let’s pretend ‘PLATFORM’ is ‘linux2′ or ‘win32′, ie sys.platform):

#Pretend we use sys.platform instead of PLATFORM where we use it
PLATFORM = 'linux2'

class FooBase(object):
    def say_foo(self):
        print 'foo'

class PlatformFoo(FooBase):
    def say_platform_foo(self):
        raise NotImplementedError

    @staticmethod
    def get_class():
        #Several ways to get this (dict, introspection, if-tree,...), pick yours
        klass = {
            'linux2': LinuxFoo,
            'win32': WindowsFoo,
        }.get(PLATFORM, None)
        if not klass:
            raise Exception, 'Platform not supported'
        return klass

class WindowsFoo(PlatformFoo):
    def say_platform_foo(self):
        print 'win32 foo'

class LinuxFoo(PlatformFoo):
    def say_platform_foo(self):
        print 'linux foo'

def main():
    foo_class = PlatformFoo.get_class()
    foo = foo_class()
    foo.say_platform_foo()

if __name__ == '__main__':
    main()

Executing this code will, as expected, write ‘linux foo’ to the console. Obviously we could not return the platform-specific class in a PlatformFoo function, but an actual instance, up to you.

Python allows you to handle this situation somewhat nicer though, without introducing any intermediate functions, by using metaclasses.

Continue reading »

How not to write Python code

Lately I’ve been reading some rather unclean Python code. Maybe this is mainly because the author(s) of the code had no in-depth knowledge of the Python language itself, the ‘platform’ delivered with cPython,… Here’s a list of some of the mistakes you should really try to avoid when writing Python code:

  • Remember Python comes batteries included
    Python is shipped with a whole bunch of standard modules implementing a broad range of functionality, including text handling, various data types, networking stuff (both low- and high-level), document processing, file archive handling, logging, etc. All these are documented in the Python Library Documentation, so it is a must to browse at least through the list of available modules, so you get some notions of what you can use by default. An example: don’t introduce a dependency on Twisted to implement a very basic and simple custom HTTP server if you don’t have any performance needs, use BaseHTTPServer and derivates.
  • Python is Python, don’t try to emulate bad coding patterns from other languages
    Python is a mature programming language which provides great flexibility, but also has some pretty specific patterns which you might not know in other languages you used before.
    As an example, don’t try to emulate PHP’s ‘include’ or ‘require’ function, at all. This could be done, somewhat, by writing the code to be included (and executed on inclusion) in a module on the top level (ie. not in functions/classes/…), and using something like ‘from foo import *’ where you want this code to be executed. This will work, but it can become hard to maintain this. Modules are not meant to be used like this, so don’t. If you need to execute some code at some point, put it in a module as a function, import the function and call it wherever you want.
  • Continue reading »

VirtualBox launch script

I’ve been playing around with VirtualBox some more today (more on it, and other virtualization related stuff might follow later). I got a Windows XP instance running fine (and fast!) in it. Still got some issues (shared folders seem not to work when logged in as a non-administrator user in XP, although I tend to blame Windows for this issue, not VirtualBox), played around with a little Linux installation acting as an iSCSI target for its virtual block devices, accessing them from Windows using the Microsoft iSCSI initiator, etc. Here’s a screenshot of all this.

I added a launcher for my Windows VM to my panel, which was simply running ‘VBoxManage startvm <VM UUID>’. This was not an optimal solution though, as I wanted it to show a little error dialog when something went wrong when attempting to launch the VM (eg because I forgot it was already running), when the virtual disk files aren’t accessible (because I forgot to mount the volume they reside on), etc.

So I cooked a little script which runs some sanity checks before launching the virtual machine, and reports any errors. Here it is:

Continue reading »

Interesting though

I’m at the ProFOSS virtualisation event currently. This morning there was a nice talk by Tarry Singh in which an interesting (and, imho, correct) thought was raised:

What matters is Usable Source, a mix of Open Source and Closed Source.

(Disclaimer: these aren’t his exact words, they might be rephrased a little, but you get the idea.)

I kinda like the idea :-)

KDE4 reviewed

I’ve been able to download the KDE4 LiveCD by now, so I wanted to give it a test ride and write a basic KDE 4 review. These are my findings. I first and foremost want to stress I do not ever want to attack, offend or whatever anyone in this post (as reactions of vocal users on posts like these can be fierce sometimes ;-)). These are my findings, both positive and negative.

One reason to read this until the end (in case you wouldn’t ;-)):

KDE 4.0 Button Overflow

At first bootup the OpenSuSE bootsplash theme attracts your attention. I really like it, very smooth.

After a successful bootup (using VirtualBox virtualization) the KDE desktop starts. This takes a while, but this can be blamed on the use of a LiveCD, and a virtual machine. The splash screen is very clean, the use of black and rounded corners reminds me of Apple OS X a little, don’t ask me why. The icon animation is nice, although I think the transparency shouldn’t go all the way to completely transparent (at least, that’s what it looks like), an maybe it should change somewhat slower. Next to this, the last icon in row (the KDE icon) is much bigger than the others, which doens’t look nice. Anyway, minor details.

Once booted, the user is presented with his desktop and a ‘Useful Tips’ dialog:

KDE 4.0 First login

Continue reading »

Pages: 1 2 3 4 5 6

Properties of a good programmer

I was just pointed to this article thanks to the blog of Kris Buytaert. The author writes about his experiences on how to recognize a good programmer as a recruitment person.

As I still am unqualified myself (no degree yet, maybe I won’t ever get one) the article was a relief to read, as in some of the things he mentions I could recognize myself. Hopefully lots of HR people read it too ;-)

Some excerpts of particular interest, and my opinion on them (all blockquotes © inter-sections.net):

Update: article blog seems to be down, see the comments for a Google cache link.

Continue reading »

Nokia 6300 SyncML follow-up

Last couple of days I’ve been trying to get SyncML up and running on my new Nokia 6300 cellphone, as it wasn’t working before. I’ve been collaborating with the main libsyncml author to figure out what’s going wrong, but no success, although there is a report of someone who did get it working.

The phone firmware is broken though, that’s pretty sure. As you can read in the bug report, he had to sync the phone in Windows using the Nokia PC Suite, before it wanted to work using libsyncml. Next to this, authentication had to be enabled on the phone before it wanted to sync.

It looks like I’m not the only person who got issues though: even the official Nokia software under Windows refuses to work (”PC Sync has encountered a problem and has terminated the synchronisation“, “Data transfer not possible“) for several users. There are reports of SyncML working in iSync, although this needs an external “plugin”. Luckily I was able to make a complete phone backup using the PC suite. This, and all other suite features, except sync, seem to work fine.

Anyway, libsyncml traces, obex data dumps or logs of the data sent and received by the official client under Windows (by snooping USB data) didn’t provide any solution, yet.

The fact synchronization doesn’t work is a killer bug if you ask me: I bought this phone to be able to sync, otherwise I’d have settled with some basic model at half the price (like my old 3100).

One more issue: I configured the built-in email client to fetch mails from my IMAP server using an SSL connection. When trying to sync my mails, the client errors out though, as my (self-signed) server certificate can’t be validated. I checked the phone’s manual, but there’s nothing regarding CA keys in the phone’s trust list, nor could I find it myself…

It would be really nice if, in some new version of the firmware (next to fixing the SyncML issues) the contact list would be somewhat better integrated with other applications:

  1. Allow sending emails to contacts or browsing to the webpage of contacts from within the contacts application. Currently you can only view the addresses, if set, but there’s no way to launch the email client or browser application with the given address.
  2. Integrate calendar and contact birthday information: you can set the birthday of contacts, but these are not displayed in the calendar, whilst the latter one does allow you to add birthdays. I guess nobody wants to add all contacts manually in his calendar application too…

So, if you happen to know some people working on series40 firmware, please point them to these issues, thanks ;-)

More Wii innovation: head tracking

Someone just sent a mail to the xorg and compiz mailing lists, pointing to this YouTube video regarding a new way of (ab)using the Nintendo Wii to control a virtual environment. If you didn’t see it yet, check it out, it’s rather impressive:

I don’t know whether this could actually be useful in a pure desktop environment, but for games (although I’m no gamer myself) I could imaging this offers a whole new spatial experience. Up to Nintendo or third-party vendors to design and commercialize the necessary gadgets or remotes.

Too bad there’s not enough empty space around our TV at home, otherwise I think I’d buy a Wii, love the tennis game ;-)

Cellphone, Bluetooth and reddit rant

Got a new cellphone today, a Nokia 6300. Pretty nice phone, except I can’t get the SyncML support to work on my Linux system… SyncML over OBEX is reported several times not to work, although the OpenSuSE wiki claims it should work… Most sources say one should use the gnokii OpenSync plugin, which does work, but has one major drawback: even when configuring the phone only to use it’s internal memory for contact list storage, the gnokii plugin will also sync the SIM content, which I copied to the phone memory. Result: duplication in my Evolution contact list. I guess I should patch libopensync-gnokii adding a configuration field providing the possibility to select only one storage container? Or try to figure out whether the Novell/SuSE guys have a patch for libsyncml?

Does anyone know whether there’s a Tango-style theme for this device? ;-)

Little unrelated rant: thanks to my blog statistics I found out my recent article on AJAX form validation with Django got featured on programming.reddit.com. I also saw some people commented on my article over there, comments on which I’ll reply later. Now I was wondering, why do people leave comments over there, and not beneath the blog entry, where everyone interested in the subject can easily find it, get into the discussion, the blog author will certainly read your comment, reply on it (as most likely he doesn’t read news-site X where user Y can post his comment, or news-site Z where Q posts his comments, etc, or he got no account on X or Z to be able to reply),… It’s as if I’d start my very own secret little webpage where I put links to all blog entries I want to comment on, and write the comment on that page, but don’t even do any trackback ping *sigh*

Oh and, those claiming AJAX form validation is bad: indeed, in some cases it is, except when you, eg, want to do “check username isn’t already registered”-style validation. If you’d have commented on the right place, we could have discussed this where it was appropriate.