Search Results: "nate"

16 May 2007

Piotr Roszatycki: Sun Java and alternatives

I maintain the HenPlus interface for databases. The tool is written in Java but it didn't work with non-Sun implementation of Java. The reason was sun.misc.Signal class. It is used for trapping Ctrl+C in application. I wonder why the GNU Classpath does not support this class. Does it mean the Sun Java is not really standarized? I've found the workaround. I unpacked some of sun/misc/*.java files from official Sun Java sources. Fortunatelly they was published under GPL license. The trick made possible to compile the HenPlus with GCJ+ECJ, so I could change the build-time dependency to java-gcj-compat-dev. It really worked! Even if the signal couldn't be handled with GCJ or SableVM, the application started with non-Sun Java runtime:
Hen*Plus> system-info
----------------------------------------+---------------------------------------------+
            System Property                                  Value                     
----------------------------------------+---------------------------------------------+
 Diff. of used memory (now-before) [KB]                                      1.932,00  
 Java VM                                     GNU libgcj 4.1.2 (Ubuntu 4.1.2-0ubuntu5)  
 Java Vendor                                           Free Software Foundation, Inc.  
 Java Home                                /usr/lib/jvm/java-1.4.2-gcj-4.1-1.4.2.0/jre  
[...]
I've found that the GCJ and Kaffe doesn't work with Oracle JDBC driver. I'm suprised that SableVM works without problems. It's good to see that there is a reasonable alternative for Sun's imlementation.

15 May 2007

Michal Čihař: Why do people buy non documented phones?

While working on Gammu, I still wonder why people who want to connect their phone to computer buy phones from vendors who use own proprietary protocol or do not share any documentation. Then they come to Gammu mailing list and/or bug tracker and want Gammu to support their phone. Sometimes the fix is easy, but usually it is quite lot of work to debug unknown protocol. I know this situation quite good from past. I had Alcatel phone, which was using proprietary protocol for access to in phone contacts and events. Fortunately Alcatel released synchronisation software for these phones (it of course runs only on Windows) which had enabled debugging and it was quite easy to understand protocol thanks to logs it could produce. But as newer phones with some extensions appeared, maintaining this became harder and harder. When I looked for new phone, I decided to buy Sony-Ericcsson K750i phone. Writing support for most of functionality (well in fact all I need) was just matter of few days. The reason why it was so fast was that this phones is using open standards (e.g. OBEX, IrMC) and vendor specific AT commands are documented in freely available documents. It's your choice how good will your phone interoperate with computer. If you buy well documented piece of hardware, chance to have it fully supported is much higher.

Meike Reichle: A little DebConf6 revival

Ever since I've returned from DC6 I've been planning to return to Mexico one day. Given the current state of my vacation fund this won't be any time soon. However, as a kind of consolation I'll have a little bit of Mexico coming to me this week! Pante n Rococ (alternate non-official site without so much flash) from Mexico City will be giving a concert in my crummy little hometown! Yay! If you are into good Ska music and living near Hildesheim don't miss out on this one! Oh, almost forgot. The whole thing happens on
Wed 16 May 2007
Admission: 19:00, Begins 20:00

Vier Linden
Alfelder Str. 55b
31139 Hildesheim

Tickets: 12,00 Euro Advance Booking or 15,00 Euro Box Office

Adam Rosi-Kessel: Grimmelmann on PrawfsBlawg

Not to be missed: well-known enfant terrible James Grimmelmann is guest-blogging on PrawfsBlawg. His opening commentary on the relationship between law practice and computer science:
Practicing lawyers, like practicing programmers, are professional pragmatists. Both must make their cases (and case mods) out of the materials they have available; both starve or eat steak depending on whether their creations work. The day-to-day practice of law is unlikely ever to require much high theory. We can mourn that fact because it means that they look at us with suspicion, or celebrate it because it frees us to chase Truth and Beauty and it will remain a fact either way.
Aside from the fact that I don’t eat steak, I think this is correct. Via a commenter on James’ entry, I learned that the 7th Circuit Court of Appeals is implementing a wiki (the entry page could surely use some more content). Surprisingly, it was not Posner but Easterbrook who spearheaded the effort. This is a very interesting development, but I expect it will be quite a while before any other circuit takes up the idea. Finally, I have been meaning to write about this New York Times story describing Jonathan Coulton’s success as a musician breaking with the traditional distribution /promotional channels (via 43 folders, a productivity blog that is still on my “probation” list). Unfortunately, slashdot beat me to it. I first re-discovered Jonathan Coulton during his guest episode of the Show with Ze Frank. In any event, the article is well worth reading:
More than 3,000 people, on average, were visiting his site every day, and his most popular songs were being downloaded as many as 500,000 times; he was making what he described as a reasonable middle-class living between $3,000 and $5,000 a month by selling CDs and digital downloads of his work on iTunes and on his own site Coulton realized he could simply poll his existing online audience members, find out where they lived and stage a tactical strike on any town with more than 100 fans, the point at which he d be likely to make $1,000 for a concert. It is a flash-mob approach to touring: he parachutes into out-of-the-way towns like Ardmore, Pa., where he recently played to a sold-out club of 140 . In total, 41 percent of Coulton s income is from digital-music sales, three-quarters of which are sold directly off his own Web site. Another 29 percent of his income is from CD sales; 18 percent is from ticket sales for his live shows. The final 11 percent comes from T-shirts, often bought online

14 May 2007

Jordi Mallach: Data disaster on pusa

pusa, a server I administer at uni, suffered a massive data accident on Wednesday. When I went to see why it didn't come up from a reboot on Friday, I found out the initrd hadn't been able to mount /. Weird... Luckily, the two new disks were already installed in the host and waiting for me to finish the migration to the RAID1 and the new Linux-VServer setup, but unfortunately I've been way too busy and it was too late for some of our data. A fsck of /dev/hda1 resulted on large portions of the data going to /lost+found. Discovering this made me feel like a great fool after not having dd'd the device before doing this (a dry-run of fsck had not reported anything useful). I found out some of the lost data in random directories, but in general lots were missing, and others made no sense:
/oldpusa/etc: gzip compressed data, was "libpng.txt", from Unix, last modified: Wed Dec 20 00:58:51 2006, max compression
I hoped for my PostgreSQL stuff being intact, so after dd'ing /dev/hda5, I fsck'd the image. The result was an empty filesystem, and a lost+found full of stuff. I can't find a directory with stuff that resembles postgresql data at all. I did find a directory with a PG_VERSION file in it, but the rest of the files in it (around 100) had numeric names and little more. If anyone thinks I might be able to rebuild my /var/lib/postgresql from this, I'll be infinitely grateful. Anyway, I haven't written to the corrupted after I fucked up the root partition. I'm very interested in knowing what could cause corruption on all partitions, making them unmountable, but still recognisable by fsck, even if the result is not good at all. Maybe a corrupted partition table? If so, what does the Dear Lazyweb recommend me to try out? I suspect the first portion of all partitions were damaged, but maybe just that. Some partition table shift , which makes the filesystems lose the first superblock (trying other superblocks didn't work either)? Suggestions is very welcome by comment or email, and detail on what tools and how to use to try out things, better. My backup of PostgreSQL is not so recent, and recovering some SmartList data would also be great. As for the mandatory where are your backups , the answer is basically we had no resources to store them until very recently, and when we finally got the disks I've had no time until now to set it up entirely, so some bits (db, lists, web) were still not running off the new drives. The luckiest people have been the MUD owners, who have had no data loss at all, as they were living entirely on /dev/md0. Losing MUD data probably means getting angry calls at 4AM or so. :)

Bastian Venthur: 4GB RAM on a T60?

Dear Lazyweb, at work we have bought some of those shiny new ThinkPad T60s with 64Bit. Some of them have 4GB RAM installed, but unfortunately those with 4GB only seem to have 3GB available under Debian/Etch/AMD64. Since those laptops are running on AMD64 kernels, they should work with > 3GB RAM out of the box, right? Unfortunately they don’t and thinkwiki says:
Note: While you can install 4GB of memory, the chipset in the T60 supports a maximum of 3GB usable memory.
while the BIOS correctly shows the full amount of installed RAM! So my question is: Has anyone out there a T60 running successfully with 4GB RAM or is it really a chipset constraint?

Isaac Clerencia: 1st WARPtivity: Ordesa

Past weekend Warp had its first WARPtivity (which, as you may suspect, stands for WARP activity, you know, team building and that stuff). We (including all partners and almost all workers) spent a night and a day in the breathtaking Ordesa valley. I’m quite biased as I love the valley since I was a child and have enjoyed lots of weeks there, but it’s indeed one of the most beautiful places I’ve ever seen. Unfortunately our regional government (PSOE and PAR, kick them out on the 27th May election) are spoiling most of the Pyrenees, I hope there is something left for the next generations. We arrived at Torla (a little village near Ordesa) on Friday evening, had a great dinner and some drinks and played table football. Next morning we woke up quite early and hiked through a nice forest path to the Horse Tail waterfall. After having lunch by the waterfall some of us decided to return by the Faja de Pelay, a higher path above the forest, with awesome sights. As it was still early May, there was some snow remaining in the path, making it a bit dangerous, as there is a 300 hundred meter cliff. Luckily enough we managed to survive and blog it :)

12 May 2007

Luk Claes: binNMU

Apparantly not everyone knows binNMUs. Sometimes bugs are filed when binNMUs can solve the problem. Some people even wonder about breaking NMUs without any notice. A binNMU:
* no source changes * sheduled on the build daemons by someone with wanna-build access * for versions of packages which already exist in the archive * can be requested on debian-release@lists.debian.org, no bugs should be filed So a binNMU is used often for library transitions with ABI changes but without API changes (libFOO-dev has not been renamed, but libFOObar has been renamed to libFOObaz) or to fix an upload of a package that was not built in a clean environment. Note that it is a good idea to contact the maintainers of packages that reverse depend on your library before starting a library transition in any case so people know why their packages don't build/install anymore and maybe can even coordinate uploads they were going to make anyway. Informing the Release Team about library transitions of more than a couple of packages would also be appreciated....

Enrico Zini: tg-more-singleselectfield-quirks

Turbogears quirks when testing controllers that use SingleSelectField Suppose you have a User that can be a member of a Company. In SQLObject you model it somehow like this:
    class Company(SQLObject):
        name = UnicodeCol(length=16, alternateID=True, alternateMethodName="by_name")
        display_name = UnicodeCol(length=255)
    class User(InheritableSQLObject):
        company = ForeignKey("Company", notNull=False, cascade='null')
Then you want to make a form that allows to choose what is the company of a user:
def companies():
    return [ [ -1, 'None' ] ] + [ [c.id, c.display_name] for c in Company.select() ]
class NewUserFields(WidgetsList):
    """Fields for editing general settings"""
    user_name = TextField(label="User name")
    companyID = SingleSelectField(label="Company", options=companies)
Ok. Now you want to run tests:
  1. nosetests imports the controller to see if there's any initialisation code.
  2. The NewUserFields class is created.
  3. The SingleSelectField is created.
  4. The SingleSelectField constructor tries to guess the validator and peeks at the first option.
  5. This calls companies.
  6. companies accesses the database.
  7. The testing database has not yet been created because nosetests imported the module before giving the test code a chance to setup the test database.
  8. Bang.
The solution is to add an explicit validator to disable this guessing code that is a source of so many troubles:
class NewUserFields(WidgetsList):
    """Fields for editing general settings"""
    user_name = TextField(label="User name")
    companyID = SingleSelectField(label="Company", options=companies, validator=v.Int(not_empty=True))

11 May 2007

Martin Michlmayr: GCC 4.3 related build problems: pedantic preprocessor warnings in C++

GCC 4.3 changed pedantic preprocessor warnings in C++ code into errors, in line with the C++ front-end. Because of this change, preprocessor warnings are now errors. This leads to a number of errors that are in my opinion too strict and I've started a discussion about this problem on the GCC mailing list. I hope this change will be reverted, or that some of these errors are downgraded to warnings again, but users of current gcc-snapshot package might encounter these errors. I haven't filed bugs about these issues since I'm waiting for a census from GCC developers. Nevertheless, it makes sense to fix these problems if they are present in one's package. This change has caused at least the three following errors which are all fairly common. error: "xxx" redefined It's not allowed to #define something twice, as in this example:
#define TEST "foo"
#define TEST "bar"
This code will lead to the following error:
test2.cc:2:1: error: "TEST" redefined
test2.cc:1:1: error: this is the location of the previous definition
Most typically, this occurs because something is defined in a header that is included and then redefined in the current source file. It can also happen when a #define is put in the code but also on the command line, e.g. via -DTEST="bar". This will lead to:
test2.cc:1:1: error: "TEST" redefined
<command line>:1:1: error: this is the location of the previous definition
The correct solution is to avoid redefinitions directly or to use #ifndef to make sure that something has not been defined already. extra tokens at end of #endif directive While an #ifdef obviously needs a second parameter, it's not allowed to give one to #else and #endif. Unfortunately, this is commonly done as a reminder for what is being tested for:
#ifdef TEST
#endif TEST
This code will lead to the following error:
test3.cc:2:8: error: extra tokens at end of #endif directive
missing newline The last line of a source file has to end with a newline. If this is not the case, the following error is now shown:
test4.cc:1:19: error: no newline at end of file

Martin Michlmayr: GCC 4.3 related build problems: extra semicolons

After I described yesterday that GCC rejects semicolons after functions, Ben Hutchings pointed out that semicolons are actually allowed according to the standard. I regularly complain to the GCC people for introducing new errors, but when this was was introduced I assumed there was a good reason and didn't want to complain yet another time. Turns out that I should have. Fortunately, somone else must have noticed the problem because GCC has been changed in SVN and this code is no longer rejected.

Martin Michlmayr: GCC 4.3 related build problems: extra semicolons

One mistake which some C++ programmers make which GCC 4.3 rejects is to put semicolons after functions. While a semicolon is needed to terminate a class, struct and enum it must not be used after functions. The following code is invalid because of an extra semicolon (in bold):
class Test  
    Test()  ;
 ;
GCC 4.3 will reject this code with the following error message:
test.cc:2: error: extra ';'
The obvious solution is to remove the spurious semicolon.

10 May 2007

Piotr Roszatycki: New libtool based on CVS snapshot is packaged

Some time ago I've filled ITP for libtool-cvs. I needed the new libtool for fakechroot project. The stable release of libtool is badly broken and causes that autoconf generates ./configure script which fails if C++ compiler is not installed in system. The cure is the newest libtoolize taken directly from CVS. I rather want to see the libtool package in Debian because it is hard to install it manually. So I decided to make the new package. Fortunatelly, the current stable libtool maintainer (Kurt Roeckx) is very helpful person and he don't see any problem if I prepare the experimental release of his package :) So here it is: fresh and brand new libtool Debian packages. There was some controversy with versioning schema. The current CVS snapshot is labeled as 2.1a. The upstream's authors promised that the next release should the version number greater than previous. I hope they really don't release new libtool i.e. as a version 2.0. Whatever. This is the experimental package at least. I don't know, why the package is not indexed by packages.debian.org yet. It is strange as fara as it came into ftp.debian.org.

Martin Michlmayr: GCC 4.3: common build failures

Even though GCC 4.2 has seen many delays and still hasn't been released (although it's finally getting close), a lot of development has already been done on trunk for the release of GCC 4.3. I started testing 4.3 in March and in addition to finding and reporting compiler issues I have filed bugs on packages that fail to build with GCC 4.3. The idea is to give people an advance warning and to be ready for GCC 4.3 when it will be released. We have almost 500 bugs related to GCC 4.3 already, mostly due to a clean-up of C++ headers in GCC that has exposed sloppy programming in many programs. Fortunately, these bugs are easy to fix. As I'm finding common mistakes in packages, I will document these problems and way to make sure a program is ready for GCC 4.3. Common problems

9 May 2007

MJ Ray: Highway Code and Cycling

Steve Kinsella wrote:
"Your right to ride on the road is in jeopardy. The revised Highway Code says cyclists should "use cycle facilities where possible". [...] The implications of this are bad. First, we will suffer more abuse and intimidating driving. Secondly cyclists will be disobeying the Highway Code when they assess that a cycle lane or path is dangerous and act accordingly. Thirdly, if a cyclist is involved in an accident and tries to claim damages, the insurance companies are likely to argue that the rider contributed to the accident by not using the cycle facility. The Highway Code has been laid before parliament. It will automatically be approved possibly by 20 May unless it is referred to a House of Commons Committee which cannot amend it and can only recommend the whole document be rejected. [...] There is a petition on the government website. One can be sceptical about the value of these petitions but the publicity is valuable as can be seen from this Sunday Times article of 7 May. It is interesting to note that 35 MP's objected to the original revised wording. Unfortunately, the replacement wording is worse. 11,000 objections were received to the previous wording. There are 70, 000 in the CTC alone who should now be objecting. If this Highway Code is approved by government cyclists will effectively lose the right to ride on the road where there are alternative routes or adjacent facilities. Please register your name on the petition and persuade others to do the same."
(via nscycle )

Anthony Towns: Torrenting the Debian Archive

Continuing the theme from my previous post – the first and fundamental thing any distro needs to have, and thus the first and fundamental thing to think about disintermediating, is some way of distributing software. That might be burning CDs and sending them out to resellers or OEMs, or having your stuff available for download, whether by putting it up on your own server, hosting it via a dedicated high-reliability provider like akamai, or maintaining a network of mirror sites and keeping them up to date. And, of course, anyone who wants to distribute their own software has to do the exact same thing – which either means doing it themselves, and not being able to take advantage of the scalability the distributor has already made work, or going through the distribution and dealing with the problems that entails, as well as the benefits. In this case, disintermediation and decentralisation are pretty much one and the same thing: and decentralising content distribution is already a well understood problem: that’s what peer-to-peer is all about, and peer-to-peer distribution of, well, distributions is already very successful – at least when it comes to CD (and DVD) images. Which means that just about anyone can create a CD image, and distribute it to the world in exactly the same way a major organisation like Debian or Red Hat would – upload a torrent file, run a seed, and let the magic of BitTorrent do its thing. Scalability is no longer something you need a distribution organisation to manage, instead it’s built directly into the technology itself. Unfortunately BitTorrent is designed for large static images – not something you update on a daily basis. And for better or worse, my preferred distribution (Debian testing, currently lenny) does update that frequently. Fortunately, though, BitTorrent’s an open protocol and has dozens of open source implementations – so last year I was able to propose it as part of the Google Summer of Code, and was lucky enough to get a few responses and a student to work on it. It didn’t get much further than that unfortunately – the student lost internet access not long into the programme (and for most of its duration), and that was pretty much that. So when this year’s SoC rolled around, I didn’t really expect much, and didn’t put the idea up for consideration again, but lo and behold someone came through and asked if it was still possible and if there was any more information, and when I forwarded on some of the mails from the previous year we ended up with a second chance at the project. So far it’s looking pretty good – we’ve had a lot more success at keeping in touch, and thanks to the extended schedule for the SoC this year we’ve been able to do a much better job of keeping on top of what’s going on. So much so, in fact, that there’s a first (alpha) release out before the SoC is officially due to start! Wonderful stuff! What it does at the moment is allow you to take a Packages file (the stuff “apt-get update” downloads, which includes descriptions of all the packages that are available, how they inter-depend, and so forth), and from that information create a usable torrent from which to obtain the packages themselves which can then be used to share and distribute the packages. There are two crucial steps in that: the first is allowing the torrent to work without requiring huge amounts of extra information to be distributed (which would introduce scalability problems of its own, instead of solving them), and the second is that the pieces that make up the torrent are selected in a way that matches the actual packages, so that when you upload a single new package, you are in fact only making a minor change to the torrent, rather than having it (on average) completely redefine half of the torrent (and again introduce scalability problems rather than solve them). There’s more information on the DebTorrent wiki page and Cameron’s blog if you’re interested. Anyway, it’s just an alpha release at the moment, which means while there’s code that does something, it’s not actually all that useful yet. The current plan is to next add some code to make it automatically prioritise packages based on what you’re actually using – so that rather than downloading all the debs it see, it’ll only download the ones you’ve got installed, or maybe only newer versions of the ones you’ve got installed, which should get us pretty close to the point where it’s actually useful for something. The end result, of course, is to build a tool that you can point at a Debian archive, run it on a machine connected to the Internet, and you won’t have to do anything more to have a reliable, scalable and reasonably efficient means of allowing your users to distribute and update their systems. In this case, scalable means that if you end up with as many users as Debian or Ubuntu, your users will have a comparable experience, as if you’d arranged for a similarly comprehensive mirror network, without actually having to do the leg work. And heck, presuming that works, it doesn’t even matter if no one else actually does that – it’s worth it even if it saves Debian or Ubuntu the effort of keeping track of a mirror network by hand. There are interesting possibilities at smaller scales too, of course. :)

8 May 2007

Daniel Stone: freedesktop.org downtime

It's just not our week, I guess. For the past couple of days, gabe.freedesktop.org (www.fd.o, ns1.fd.o, lists.fd.o) has been playing up: it will just mysteriously die with no explanation. It appears to still be alive, but we can't access it at all. Bringing it back up yields nothing suspicious before it dies, so we're suspecting some bad hardware. This wouldn't be too major a problem, bar the loss of the above-named services and dri.fd.o, openclipart.org, and a few other services, if it weren't for other things conspiring against us.

All revision control services (git/CVS/SVN committing and checkout, web access to same), Bugzilla, xorg.fd.o, people.fd.o and planet.fd.o, are on separate machines which are unaffected by this failure. But, unfortunately, we got less than 24 hours notice that our secondary DNS server at MIT was being moved, and would be offline for a while. Two DNS servers gone. Our third DNS server, hosted in the UK, is still servicing requests just fine, but apparently our registrar never noticed the update. So the third DNS server according to the glue records is home.keithp.com, which is also off the air right now for some reason.

So, ns0.bluelinux.co.uk is still serving names, and you can still access some services if you use that, but we're not sure how long until normal DNS is back up, let alone how long it will take us to get gabe fully fixed.

Sorry for the outage, please bear with us. If you think it's frustrating not being able to check www.fd.o, try checking the remote console and watching /proc/meminfo hopelessly spew into the serial console as you are unable to log in ...

Evan Prodromou: 17 Flor al CCXV

Had a great day yesterday. It was 20C outside in Montreal, so Maj and I had a bunch of friends over for "Sunday brunch" (at 3PM). I call it "bruncher", as a twist on diner and souper, lunch and dinner in Quebecois French, respectively. Our friends Patti and Meg, Anne-Marie and Jeff, Tobias and Cato, Heather and Damien, John Usher, Niko, and Maj's sister Lori were all there. I fired up my grill and made shrimp skewers, tuna burgers and salmon burgers (courtesy of the president), and tofu sausages, as well as corn on the cob. I prepped up a big green salad and a pasta salad, plus cheese and bread and chips and fresh guacamole. Topped off with a lot of vinho verde and the tasty EXP from Toasted Head, and we had a pretty nice meal. Oh, and John brought a pineapple, and we had berries and ice cream and watermelon for dessert. Nice. tags:

Montessori This morning Maj and I went to visit a potential pre-school and day-care centre for Amita June. It's the Outremont Montessori school, which was pretty nice inside and had a friendly staff. My three brothers and I were all taught using the Montessori method, and my mother is a Montessori instructor, so I'm probably a little picky about Montessori schools. But the Outremont one is bilingual, and they have all the Montessori method equipment, and a real commitment to it. The main thing I'm concerned about is that the teachers aren't AMI trained, as far as I can tell. They do a two-month workshop in the method, whereas AMI-trained teachers have one- or two-year degrees. I think we're going to check out the program and enroll Amita June for the day care (which is less intensive than the pre-school) and see how we feel about it. That is, if we get in: they've got a full school right now, but they might be able to put us on the waiting list. tags:

Plattsburgh International I'm pretty excited about the incipient opening of Plattsburgh International Airport, which calls itself "Montreal's U.S. Airport" (really!). Plattsburgh lies right across the New York (state) border, about 100km from Montreal and about a one to two hour drive depending on border crossing times. The clear market is for Montrealers seeking discount flights to (other) destinations in the USA. I think that's going to require significantly cheaper flights than are available at Trudeau Airport. Fortunately, that might not be that hard -- Trudeau is really lacking in cheap fares. But will the new airport's fares be cheap enough to justify driving an hour and crossing a land border? I'd be surprised. (via montreal city weblog, which is awesome.) ddf says: Sure, it's a bit of drive. But consider the fact that border customs is way less of a pain than airport customs. I think if you are traveling with a lot of bag and don't want to risk some extensive search before being able to board in Montreal, it might be worth the drive. tags:

7 May 2007

Enrico Zini: tg-override-sqlobject

Quirks when overriding SQLObject setters Let's suppose you have a User that is, optionally, a member of a Company. In SQLObject you model it somehow like this:
    class Company(SQLObject):
        name = UnicodeCol(length=16, alternateID=True, alternateMethodName="by_name")
        display_name = UnicodeCol(length=255)
    class User(InheritableSQLObject):
        company = ForeignKey("Company", notNull=False, cascade='null')
Then you want to implement a user settings interface that uses a Select box to choose the company of the user. For the Select widget to properly handle the validator for your data, you need to put a number in the first option. As my first option, I want to have the "None" entry, so I decided to use -1 to mean "None". Now, to make it all blend nicely, I overrode the company setter to accept -1 and silently convert it to a None:
    class User(InheritableSQLObject):
        company = ForeignKey("Company", notNull=False, cascade='null')
        def _set_company(self, id):
            "Set the company id, using None if -1 is given"
            if id == -1: id = None
            self._SO_set_company(id)
In the controller, after parsing and validating all the various keyword arguments, I do something like this:
            user.set(**kw)
Now, the overridden method didn't get called. After some investigation, and with the help of NandoFlorestan on IRC, we figured out the following things:
  1. That method needs to be rewritten as _set_companyID:
            def _set_companyID(self, id):
                "Set the company id, using None if -1 is given"
                if id == -1: id = None
                self._SO_set_companyID(id)
    
  2. Methods overridden in that way are alsop called by user.set(**kw), but not by the User(**kw) constructor, so using, for example, a similar override to transparently encrypt passwords would give you plaintext passwords for new users and encrypted passwords after they changed it.

Jesus Climent: On giving away laptops

After i wrote this entry, I received few comments on my blog from people asking me to send laptops to different parts of the world. Unfortunately I cannot do that. I have one spare laptop which will be taken to Edinburgh for Debconf7 and will be given away to a fellow Debian developer (or prospective developer) in need of such piece of hardware, but it will not be sent by post. My initial call was for a similar action from people with spare hardware which can be given away. Maybe one day I could start my own NGO to send laptops around the world for the needy, but right now that is not the case.

Next.

Previous.