New Charts and a new Reader

Witold blogged that he has published a new version of his Chart classes for Qt 4. They are based around the Interview framework and look really promissing. He has been doing some really interesting things with Qt 4's support for MVC programming - just look at his OpenGL + MVC articles. It looks very interesting to me. For those of you not familiar with Witold, he is one of the leading members of QtCentre.org - and I would love to see him added to PlanetKDE.

The second new is that my RSS reader - Google Reader - has been updated. The interface is still a bit hard to get used to for me, but it looks like a change to the better. The primary reason for me to use Google Reader is that it allows me to check all my feeds from my mobile phone - a great feature for bored geeks :-)


Travelmate - easier than 855/915resolution

I have blogged about getting a new laptop, an Acer Travelmate 8204. I'm happy with it this far and have finally gotten around to actually installing Linux on it. The contestants where Suse and Kubuntu. Suse's installer failed to boot, so Kubuntu won the trust on walk over.

When trying the Kubuntu live CD I ran into the issue of screen resolutions - my odd widescreen could not be selected. Some of you (thanks!) wrote and told me about the 855resolution and 915resolution packages - and reading instructions for them intimidated me. Thus, I decided to first attempt to get the ATI drivers going. To do that, I used the following lines from the Ogre Wiki (thanks!):

sudo apt-get install xorg-driver-fglrx
echo fglrx | sudo tee -a /etc/modules
sudo sed -i -e 's/"vesa"/"fglrx"/' /etc/X11/xorg.conf
Press alt-backspace

The parts in italics where changed by me to get things working - and to save a reboot. Now all I have to do is to install svn, Qt 4 and QtopiaCore and I'm happy for tonight.

Qt Quarterly

Issue 18 of Qt Quarterly was just released on-line. I would just like to recommend my article on mouse gestures - it was fun developing the code and fun writing the text.


Post Prague

Got home from Prague today at 3:00 AM. Tired, exhausted and soon over-worked. Today I've spent a good three hours on the phone and written two quotations. We'll see what we catch at the end :-)



Since this year's result is over the expectations in the budget I'm going to Prague. Will be a nice weekend!


Generic Development

A couple of years ago my girlfriend (now wife) complained about me having christmas decorations up close to the easter holidays. To solve this problem I designed a pair of generic decorations.

It is (supposed to be) santa and Rudolph (the reindeer) - both in beautiful, easter compatible, yellow.


During the summer vacation this year some friends of mine and myself built a garage. I planned to have it done in one week, but had to spend around five weeks getting the exteriour done. Now, my wife has painted two siluettes on the walls. First up was a Volvo Amazon, my wife's dream car.

On the other side of the garage I originally planned for a BMW 850, but the profile is a bit too dull - much due to the aerodynamic properties of the car. Instead, I went for a F1 race car.

All that is left now is shelves, a workbench and cleaning.

Election Results

Sweden will have a new leadership! This will mean lower taxation on work, better education and - in due time - no taxation for owning houses. Great news IMHO.

A little bonus for some of us is that prime minister Goran will leave the political scene all together. No loss for Sweden there.


Election on Sunday

I'm just going to refer to an editorial in yesterday's Göteborgsposten (in Swedish). That will be my only blog entry on the Swedish elections taking place on Sunday.


Road-side trees

I was driving home and saw something strange a few days ago. Thinking about it - I have noticed it before, but this was a prime example. The picture below shows a tree that has got a foothold - it is growing.

Some of you might have noticed the closeness to the roadside. That is because the tree is a stick that has been placed there by the Swedish Road Administration - Vägverket. They have experimented with putting wooden sticks as markers to show where the road is during snow.
There used to have orange plastic sticks that they had to collect in the spring - some where lost others broken. It was a big expense. The new sticks where ment to be cut when the roadsides where cleaned - but apparantly not.

My hope is that Sweden will go from the country of round-abouts to the country of road-side death by trees.


More OO for the Compiler

I've been looking at the tokenizer and lexer of SpeedCrunch laterly - much because there seems to be a problem with how it handles functions. After some thought I've come to the conclusion that the lexer part really could be made more object orientated.

My thought is to have each language element, such as an adding operation, contant, function, etc represented by a class. Each class has a evaluate member that takes a current environment (that is, a list of available variables and functions). They also have a common base class, lets call it LangElem, and a static factory function.

Lets try to implement a minimalistic language that can do multiplication and addition where multiplication has preceedence. Since the addition has the lowest priority, we start with it:

AddElem :: MulElem ['+' MulElem]*

This is some sort of hand made, non-standard, BNF encoding. All it says is that an addition consist of at least one multiplication element. If the token after the multiplication is a '+', then another multiplication element is added to the list. This goes on until no more '+' tokens are found.

The multiplication element looks like this:

MulElem :: ValueElem ['*' ValueElem]*

It works just like the AddElem, just that it takes value elements and '*' tokens. So, how does the value element look?

ValueElem :: constant | identfier | '(' AddElem ')'

Each value element can either be a constant token (remember, we run the tokenizer first), an identifier token or an addition element enclosed in parenthesises.

This all looks nice, but how do we implement it? Before we look at the code, remember, this is pseudo-code.

class AddElem : public LangElem
static LangElem *factory( TokenStack stack )
LangElem *temp = MulElem::factory( stack );
if( stack.top() != '+' )
return temp; // When no addition takes place, skip the AddElem, and go directly for the MulElem
List<langelem*> tempList;

stack.pop(); // Take the '+' from the token stack
temp = MulElem::factory( stack );
tempList << temp;
} while (stack.top() == '+')

return new AddElem( tempList );

ResultType evaluate( Context context )
// Simply add all sub-results together and return the sum
resultType res = 0;
foreach( LangElem *e, mulElems )
res += e->evaluate( context );

return res;

AddElem( List<langelem*> tempList ) : mulElems(tempList) {}

List<langelem*> mulElems;

The MulElem looks about the same, and the ValueElem tries to match identifiers, constants and parenthesises. There are two issues with this approach: first, "compilation errors" needs to be handled by exceptions and the ResultType must be able to carry an error message or exceptions will have to be employed there as well.

The benefits are many - specially with some implementation tricks. First, the context keeps a list of variable values, where the latest one is the valid one. A function can choose to accept a variable name instead of a value as a parameter.

This means that the function plot( variable, range, expression ) is possible. Variable is the value to iterate over, range is just a type that can be matched by a RangeElem (can looks like [start:step:end]) and the expression is what is to be plotted. For example plot( t, 0:0.1:2*pi, sin(t) ).

When the plot function evaluates it returns a standard answer - NoValue or something. It takes t and adds it on the top of the variable list (since the first hit is valid, this means that t is local to the plotted expression, it is removed (popped) from the list after the plot so everything is kept intact. The expression can then be evaluated any number of times with a different context each time - that is, with a different t value.

My though is to implement this new compiler, along with a value type that is picked at compile time (so you can trade performance and precision freely). Perhaps a cousin of evaluate() could be compile() that uses libjit for just-in-time compilation. This new approach makes it possible to keep many of the existing interfaces and at the same time build a SpeedCrunch script language. It also makes it easier to modify and extend the system in the future as the changes can be kept inside a single class.


Making the deadlines

This has been a great day. This week I'm faced with major deadlines Tuesday, Wednesday, Thursday and Friday. Today I was able to move the Friday deadline to Sunday, complete the work needed for Tuesday's and Wednesday's deadlines and got to know that the draft I delivered for Thursday's deadline was good enough - so it will only be an approval of my text put in a standard formatting.

A great day. Hope that this will be a great week.


Qt Collaterals and Electronix Scandinavia

I just wanted to show you some of the collateralls that Trolltech brought to the Quickstart last week. Lots of nice material - much with focus on Qtopia which I find interesting.

I felt that one fair was not enough for last week, so I also visited Electronix Scandinavia as well. Since I'm easily amused I took the chance to go Tux-hunting. First was an all alone Tux by some pens and candy.

There where more Tuxes out there, but some guys actually brought wooden Gnomes. They did, however, not know of GTK+ so there must have been some misunderstanding :-)

I was at the fair the last day of three, so some exhibitors where a bit tired. The Solitec guys seemed tired of customers - they did not even look up from their mobiles. I wonder if they where playing single player, wireless multiplayer or just checking their mail?

Just before leaving I found the booth shown below. Yes, their company name starts with five As. That is AAAAA. I guess they tried to appear first in the fair catalogue - too bad 3M was there :-)


First post

Ok, so Advogato is going read-only and I'm moving to Blogger - but with my own hosting. It is a bit sad to move away from Advogato. The site was kind of nice, with its plain-text log. Before its time, and now falling into history. All my old entries are available from here, and I will not bother to move them to Blogger.