Archive for the ‘School’ Category

FSCONS, day 2 + summary

Monday, October 27th, 2008

FSCONS 2008 has now come to an end. FSCONS 07 was good, 08 was better. Well, I can’t speak for the talks, since I only to see two, but behind the scenes everything seemed to go much smoother. The speakers seemed happy, the visitors seemed happy, I know that the staff had some troubles, but I guess it is in their job description to worry ;)

The one great hiccup of FSCONS 08 was that the doors on floor 3 was locked today when we got there. Why? Because. It created quite a racket as the schedule had to be rewritten, moving speeches from rooms on the third floor, and then distribute these changes to all the visitors. And the situation had to be rectified before the visitors left the initial speech at 10:00. It was.

This posed another problem though. It was planned that each track would be assigned two rooms, one being empty while there was a talk in the other. That way each room would be available for cleaning, and preparations for the next speaker, and in the event that the talk did go over time, the subsequent talks would not suffer from it.

The loss of floor 3 meant that each track only got one room to play with, so when the GTK+ team wanted to follow the speech with a little coding session, they had no where to go.

I was standing in the corridor waiting for another speech to end, when a volunteer approached me and wondered if I knew of any room the GTK people could use for a coding session. The obvious question then was if the volunteer had an access-card, he hadn’t, his girlfriend, also a volunteer, had. I redirected them to one of “our” rooms on floor 3. Problem solved.

As I am desperately (and unsuccessfully) grasping for the words I need to express the joy of having been part of all this, I think I’ll just go to sleep, and try to write something more coherent tomorrow or another day.

- Smiling Bandit, signing out (Well, 50% of the Austrian Dreamteam will get it at least ;))

FSCONS, day 2

Saturday, October 25th, 2008

I am not going to imply that the social event yesterday was too drawn-out, but I will go so far as to say that I got home in a more reasonable time today.

The day has been… in a word… hectic. I might jinx it all, get myself an ulcer or something, but I do like hectic. I was “roaming”, going from presentation to presentation, making sure that laptops where provided and fit for the presentation, and otherwise trying to give the speakers as pleasant a time as possible.

The only drawback with this, was that I only managed to see one presentation, about SkoleLinux. Oh yeah, two drawbacks. The second one: being on my feet, alert and ready to jump to wherever I was needed, took a hefty toll when I actually sat down to listen to the SkoleLinux presentation. I almost fell asleep. And that is such a pity since I strongly like the SkoleLinux  project, and have been fascinated by it ever since I first heard of it.

Anyway, dinner was superb, much better than last year, and nothing points to that this first “real” day of FSCONS08 was anything but a pure success.

Another volunteer dubbed me… what was it? “Smiling bandit” or something, I am not sure if I remember it correctly, or really why he dubbed me that, but oh well, I’ve been called worse ;)

Time, now, however, for bed. One more day to go, hopefully it will only get better :D

FSCONS, day 1

Saturday, October 25th, 2008

The first day of FSCONS 2008 is now officially at an end. I just got out of the shower after coming home some twenty minutes ago.

Registration? Hit some snags (mostly due to enthusiastic visitors who wanted to be registered way earlier than what was expected.

Printer acting up with paper jams? Surely! Three times, at least.

Social event after registration? Bloody brilliant. No offense to FSCONS 2007, but 08 has pretty much surpassed 07, even before we got to the main tracks.

Good job everyone, very good job :D

Python, urllib2 and Vox Anonymus

Wednesday, October 22nd, 2008

The project I am currently working on for the Advanced Free Software Tools course, Vox Anonymus, strives to offer a web-based (through Django) anonymous voting platform, giving users the ability to change their votes after having cast it.

In order to ensure anonymity, while retaining the ability to modify the vote, and also keep voters from cheating (the mantra “trust, but verify” comes to mind), an individual “vote key” is generated for each voter.

This vote key is then used as the password in a Password-Based Key Derivation Function (PBKDF for short) to generate a fairly strong key, which is hard to reverse-engineer back to the vote key. This generated key is then used to link a voter, with votes in various topics. It is a bit technical, and this is not the purpose of this post, so, moving along, quickly:

The vote key must be generated by Vox Anonymus, in order to disable a dishonest user from cheating the system. There are some pretty serious restrictions on the key as well, most of the regarding entropy. So, in order to create a good vote key, we need som pretty good random numbers.

Random numbers are tricky. You can’t generate them, since that would imply that there was some form of structured process to “generate” them. And how could a structured process create randomness? Especially, how could a structured process create randomness, and guarantee that said randomness for the same situation, state and input, won’t output the same randomness again?

There are some rather cool Pseudo-Random Number Generators (PRNG) available, but if an adversary got hold of the exact state of the PRNG at the time it generated a random sequence, the adversary could generate the same sequence, and thus get a hold on the key.

On GNU/Linux systems there is most of the time the /dev/random pool, and you can install the Entropy Gathering Daemon to improve it further, but using that in Vox Anonymus is not an option, as I intend to keep it as system independent as possible.

The solution, then, is not to look within, but to look outwards. Enter Sure, there are no proofs that these numbers are random, and as such, should they be used? If the site is for real, then gathering randomness from the static in the airwaves are just as good, if not better, than any PRNG implementation I could include in the project.

So the procedure for fetching random numbers from is as follows:

  1. Determine the external IP number of the server on which Vox Anonymus runs
  2. Check the quota for “my” IP number on
  3. If there are enough numbers left, fetch the needed numbers, otherwise wait a couple of minutes

Step number one is completely retarded. I determine “my” external IP number by querying for it… And I have found this to be the only? robust way of actually determining the external IP number through Python.

Please correct me if I’m wrong (and I don’t see how I couldn’t be).

We have finally arrived at the reason for this post: urllib2. I found a rather good resource,, which showed me most of what I needed to know.

There where however some problems: offers a http interface, based on query strings (GET requests). At the same time, the creator of asks that people writing scripts to automate the process of fetching random numbers please include their email address in the User-Agent header, so that they can be sent a notification in the event that their scripts are behaving badly.

I spent quite some time figuring out how to create a request going through GET, but adding the User-Agent header. The final outcome was rather easy, so I guess I am somewhat of an idiot for not figuring it out earlier, but hopefully this will help someone else:

import urllib
import urllib2

values = {'foo': 1, 'bar': 2}
data = urllib.urlencode(values)
url = '' + data
header = {'User-Agent': ''} # don't do this, only for
req = urllib2.Request(url, data, header)
    response = urllib2.urlopen(req)
except urllib2.HTTPError, e:
    # do something
except urllib2.URLError, e:
    # do something else

Thus ends the adventures in Python-land, for now anyway

Thinking outside the box

Monday, October 20th, 2008

Edit: Refurbished the post with a better title, as suggested by mra.

A friend from my old class at the University sent me a message earlier tonight asking me some programming advice. I was in the process of stepping away from the computer but he caught me just in time, and he’s a good friend, and I have to admit that his sporadic inquiries, which also gives me some slight insight into how code in the corporate world can look like, sometimes prove quite challenging, and I do enjoy trying to provide help, guidance and the occasional solution. So I sat back down, made myself comfortable and read his situation:

One thing I have come to notice, whomever it is that asks me, is that they have a pre-conceived notion about how they would like to solve the problem. More often than not, the help I provide is more in line of  offering an alternative way of looking at the problem. And the key my apparent success lies in that I gather as much information beforehand, and then try to either remember a similar situation, or think up a solution based on previous situation or knowledge bordering the problem at hand.

He described that there existed a loop, in which values were being generated, and used to build a query, which was then generated (inside the loop) resulting in a result set. And following the loop, he wanted to make use of the result set derived from the iterations of the loop.

The primary problem, at first, seemed to be that the result set was being overwritten with newer information at every iteration, and at the loops end, there was only data in the result set from the last iterations query.

Problem solving mode kicked in, but soon reported that there was too many unknowns to come up with something resembling a solution, more information was needed.

Well, no, the first thought was how difficult it would be to go into the internal storage-structure of the result set object and “append” the information returned in this query with the result set from the previous query. I rejected that idea within a few seconds time of deliberation. (Don’t know about you, but I would not feel comfortable fracking around with the internal state of a Java object I really don’t know anything about.)

So, more information, did query X+1 depend on the information returned in query X? If not, what was the data being generated in the loop, which was fed to the query?

I am ashamed to admit it, but my next idea was almost as big an ugly hack as the first idea, which essentially was to create a result set array, and store the result set from each query in that array, and instead of manipulating one big result set at the end of the loop, just manipulate each element in the array individually. I honestly cannot say why I thought of that idea, but I think that may be a rather “hard-coded” notion I get when I see Java code… in any case, all the while I was examining this hair-brained idea for flaws (I cannot say that I liked the idea, it would probably work, but it didn’t feel “right”) I started getting answers to my previously stated questions. The generated data was integers, id numbers to be specific, and they did not relate depend on the previous query.

The code, then, was basically something along the lines of:

for (i=0; i<something_predetermined; i++)
    resultSet = SQLquery(query, i);

The little code snippet I got to see looked a little different, it has been obfuscated to preserve his anonymity :)

That little tidbit of information made me think about what he had going into the problem, where the problem could be broken up into smaller pieces etc. Basically, he had a list of id numbers, or could at least generate such a list, independently from the loop and queries. That’s when I remembered a piece of SQL syntax that I have never had a chance to try out for myself. Something I’d read, but never had any use of personally. Something along the lines of:

SELECT * FROM foo WHERE id IN [1,2,3,4];

And I was almost correct. My only hurdles was that I a.) wasn’t sure that it was correct syntax, and b.) the specification use parentheses to represent a list of values, not square brackets. I.e.:

SELECT * FROM foo WHERE id IN (1,2,3,4);

This solution was something I would be able to live with. Not that I really had any stake here, but I couldn’t really recommend the usage of a piece of code I wouldn’t want to be caught dead using myself, but this, outsourcing the work to the database, work it was written to excel at performing, yes, this felt “right”.

Next question, would this syntax work in whatever database his project was powered by? As it turns out, it would seem so. A quick Google revealed that SQL Server should indeed support this syntax. My friend did some limited testing and that also checked out, so I considered my work, at least for now, done.

Who knew?

Thursday, October 2nd, 2008

As you may, or may not, know I am taking a course called Advanced Free Software Tools (pdf) held at the IT University in Göteborg, which basically boils down learning about and how to use the tools commonly used in Free Software projects, and as a part of this course the students are encouraged to either take part in an existing project, or to create a project of their own.

I opted to create a new project. I figure there are pros and cons with each approach (if you join an existing project there will (possibly) be a lot of code to get the hang of before you can start contributing, which is bad, but at the same time, it is also good that you get exposed to other peoples code. The inverse for these pros and cons are the pros and cons of creating a project of your own)

One thing that I don’t believe I would have gotten any actual “real-world” training in, had I joined an existing project, is in writing change logs and the more project administrative-posied tasks, and I have to say, I am finding it rather enjoyable, not the administrative tasks in themselves, but researching syntaxes, finding the ones which are conforming to the overall environment in which my project will coexist etc.

For instance, the project I have chosen to work on, is a web-based voting system, implemented as a Django application. It should be some sort of free software in order to follow course-requirements, so a free software license had to be chosen. Then a coding standard. Django is programmed in Python, following the Python coding standard, so my application should follow this as well. The Django team doesn’t appear to have any official changelog document, which would have overridden most other considerations, but instead I fall back to the GNU ChangeLog format.

Who knew all this “administrative work” could actually be this fun?

Firefox + University WLAN + Offline mode = not so happy camper

Wednesday, September 17th, 2008

Back when I was studying Software Engineering and Management, we had one “classroom”, it was nice, I being an early bird always got a wired connection (limited amount of LAN sockets in the classroom). Nowadays, taking single courses, means having the lecture in any lecture hall which is free at the time of the lecture (it isn’t that bad, the halls are booked in advance) however, they aren’t like the classrooms we used to have. No LAN for anyone… ok so this is not a problem anymore (on my old Acer, with a Broadcom WiFi card, it would have presented an irritating challenge at best) but nowadays, WiFi is good. Except for one little irritating thing:

The university has (of course) restricted access to the network, so that only students and teachers can use it. Sure it would be nice if they offered it free for anyone but that’s not likely to happen anytime soon. However, that is not the reason for my irritation. The reason is that Firefox likes to try to discover the network. Failing to find a LAN, it goes for WiFi, and since Firefox is a slow ass beast to start up, I do that about the same time as I run the script which tells the system to start a WiFi connection to the university network.

Long story short, every frakking time I do this procedure, Firefox plunges itself into offline mode. I for one detests it for doing so. So I looked around the net (googled) and found this, and specifically this about:config hack:

Enter about:config, type browser.offline-apps.notify and set it to false.

Will it work? I have no idea yet, but I am keeping my fingers crossed.

Update: No, for me, the about:config hack did NOT work. So now I am trying the addon also provided in the thread.

Update 2: Failure strikes again… the addon… it does nothing for me.

A great success!

Saturday, August 18th, 2007

This summer I have had the opportunity to perform a complementary project in order to get a grade in the AI project, which I flunked pretty hard during the third term. Yesterday, approximately one week after the deadline, the lecturers most closely involved in that project held and examination session in which me and the members of “my” group where to present our work, and explain / defend the choices we made as the project progressed.

I am happy to say that we all passed. In the end it was worth all the struggle; giving away all of the summer… however, one thing that should really be considered is that had we actually gotten started earlier, actually doing things, effectively, from an early stage, we would probably have had a working agent, plus documentation, ready and handed in after about one and a half months, and had plenty of time for summer too.

But I am happy, we all passed, we get to continue in term 5 now after the summer, with our classmates, if it continues this way I will graduate in roughly one years time from now.

So in closing; Gabe, Robbie: Good work! :D