2007-03-31

Windows, CMake and console

When playing around with Qt on Windows one always runs into the console issue. Some sooner, others later. The problem is that a Windows application does not have a console by default. When thinking about this, it is pretty obvious, given the nature of Windows.

This means that qDebug and friends cannot output to anything, so you don't get any feedback at run-time. The solution to this has always been to add a line reading CONFIG += console in the project file.

Now I'm trying to find out how this is handles when I'm building using CMake. Does anybody know? Please leave a comment!

2007-03-30

An Internal GCC Gem

Dexen deVries just sent me a lovely little GCC error message: unable to find a register to spill in class. An actual internal GCC error causing the compiler to show its internal intermediate code. This looks like, quoting Dexen, "...ad-hoc, informally-specified bug-ridden slow implementation of half of Common Lisp...".

I've added this to my collection of GCC error messages. If anybody knows a proper solution to this, do post a comment. Any new error messages are also welcome!

2007-03-25

My favourite machine



This machine drives wooden poles into the ground, then the operator puts a concrete pole on top of the wooden pole and drive it too into the ground. This makes quite alot of noice. It goes something like BANG BANG BANG BANG... for about eight hours a day. The photo has been taken from my office window. Needless to say - I'm very fond of this machine.

PS. Another nice feature is that it produces a lot of dust so my car now has a yellow-ish colour tone.

2007-03-20

DM500T and Boxer

This weekend my DM500-T has finally debuted as my own little media centre. It was given the highly important task of recording the F1 race and store the TS file on my little file server. The file server is a little Debian box built around a slow VIA Mini-ITX card with passive cooling. All that I need to do before it is allowed in the living room is to replace a fan in the chassis with a quite one and get some rubber suspensions for the harddrive.

Installing Debian worked like a charm - starting from the minimal network installation CD, downloading what I needed and configuring Samba to handle the file sharing. All I need to do is to install acpid to make it possible to turn the box off - it does not have a keyboard. Apparently using ssh, logging in and running shutdown was not a wife compatible solution :-)

The only thing that I'm looking for to make the Dreambox setup complete is a good slideshow software for the DM500. Any tips are welcome!

Finally, this was kind of funny.

2007-03-19

More Compiler Error Messages

I've just updated my page listing GCC error messages with a whole bunch of new messages. Lots and lots thanks to Diederik from Codingdomain. He just send me a mail with a whole list of error messages and solutions.

Stop the Insanity

According to US patent 7028023 it looks like everyone using QLinkedList are violating a patent. Let's have some of those in Europe as well *irony*. I'm making a donation to FSFE.

2007-03-18

Melbourne 2007

The F1 season has finally started with a nice race. Hamilton proved to be quick, Kovi was a bit of a disappointment, as was the breakdown of Kubica's car. The results could had been even better than they where (for a BMW fan, that is). A fourth for Heidfeld, with a good part of the race in second place was really good. Hopefully we'll see both cars there or even further ahead next time.

2007-03-17

Qt Designer Plug-ins

When creating plug-ins for Qt Designer you always run into the task of implementing a plug-in class. This can be tedious as you pretty much add your class name to a template. Now, thanks to some php-magic, you just have to enter your class name and press a button to get the code. Try it yourself: the Qt Designer Plug-in Generator.

Note! This is beta (alpha) software - not very tested - use it at your own risk.

2007-03-16

Skoda Fabia

Last week I had my car on service and was given a fairly new Skoda Fabia as a replacement car for the day. I live in Sweden, so I had the car fitted with spiked tires, just in case. As you might already be aware - these tires adds some extra noise, compared to ordinary friction tires or summer tires. Anyway - I just could not understand why the car was fitted with a stereo. Especially as I had to rev it over 4000 rpm to get a decent high-way speed.

But all is not bad - having to rev means having to shift alot and that makes the driving more challenging. To sum thing up, it is slow, noisy and requires quite alot of shifting - but also kind of fun in that regard. It felt good to get my own car back.

2007-03-15

More errors

I've just updated my list of GCC errors and their solutions with three more entries:
  • Potential vtable problems when using Qt.
  • Using const_cast to solve qualifier issues.
  • Warnings about uninitialized variable usage.
Enjoy!

2007-03-14

Selecting

I ran into something peculiar today when using the Model/View classes in Qt 4.2 - probably something related to TaskTracker issue 143383. To demonstrate, let's start with a minimal model that can be reset from a public method:

class MyStringListModel : public QStringListModel
{
public:
MyStringListModel( const QStringList &items ) : QStringListModel( items, 0 ) {}

void resetModel() { reset(); }
};


I start by initializing the model and viewing it through a QListView:

  QListView listView;
QStringList items;
items << "Kalle" << "Olle" << "Albert" << "Sven" << "Anders" << "Markus";
MyStringListModel model( items );
listView.setModel( &model );


Then I set the current index and select it - this is equvalent to picking it with the mouse (that was how I ran into the issue):

  listView.selectionModel()->setCurrentIndex(
model.index( 3, 0, QModelIndex() ),
QItemSelectionModel::SelectCurrent );


This gives us the following state:

  listView.selectionModel()->hasSelection() == true
listView.selectionModel()->selectedIndexes().count() == 1
listView.selectionModel()->currentIndex().isValue == true


Now, I reset the model:

  model.resetModel();


The situation changes to:

  listView.selectionModel()->hasSelection() == true
listView.selectionModel()->selectedIndexes().count() == 0
listView.selectionModel()->currentIndex().isValue == false


The same thing happens when using select instead of setCurrentIndex. When using the following line...

  listView.selectionModel()->select(
model.index( 3, 0, QModelIndex() ),
QItemSelectionModel::SelectCurrent );


... you get the following:

  listView.selectionModel()->hasSelection() == true
listView.selectionModel()->selectedIndexes().count() == 1
listView.selectionModel()->currentIndex().isValue == false


And after resetting the model it looks like this:

  listView.selectionModel()->hasSelection() == true
listView.selectionModel()->selectedIndexes().count() == 0
listView.selectionModel()->currentIndex().isValue == false


The TaskTracker entry says that the bug is fixed, so this is likely to have been fixed in the Qt 4.3 snapshots. If you're using an earlier release it looks as if the selectedIndexes().count() is a better way to determine if something is selected.

I visited the BitSim headquarters yesterday and got a chance to see the spring in Stockholm. It was nice to notice that it is slightly warmer in Gothenburg - but still far too cold for my taste - around 8 dgC.

It it would have been raining it would have been dangerously close to the Swedish standard temperature. It is 12 dgC. Combined with rain this is the Swedish standard weather. It is called just that because it could be chistmas eve or midsummer. It is is 12 dgC and raining you cannot tell.

Now it may sound as if Sweden is permanently cold and rainy. That is quite far from the truth. I've seen beautiful winterdays in the north with temperatures close to -35 dgC. In the summer we can reach around 30 dgC some days - and that is a bit too hot for my taste. I prefer around 25-27 dgC if I can be picky :-)

Anyway, enough about the weather. Stockholm was nice as always and it is always fun to visit the headquarters. This time I got a chance to have a closer look at the Badger demo - it was really cool. Live video, alphablended graphics and nearly no CPU load - it impressed the geek in me :-)

More prizes

The PSP, one of the coolest pieces of portable power available out there. Want one? Enter the QtCentre programming contest.

2007-03-13

iPod, 30GB, looking for Qt owner


I know that the iPod really only is a toy for trend sensitive people wearing orange sun glasses (or was that last year, perhaps they will be pink or green this summer). Anyway, if you know your way about Qt and want one, enter the QtCentre Programming Contest.

2007-03-12


Do you want a GreenPhone of your own? It has got a touch screen, Bluetooth, an XScale CPU and runs Qtopia. It is also the greenest phone on the market! Anyway - if you want one, simply write an application for it and enter Qt Centre's programming contest.

2007-03-11

One week left...

... until Melbourne. Until then, some testing.

Anyone for a MacBook


I just wanted to remind everybody that if you are interested in getting a MacBook for free you can still join the QtCentre programming contest. Good luck to all of you - and may the Qt-est developer win :-)

2007-03-09

My Collection of Gems

I recently blogged about the way that GCC sometimes can write poetry. This has resulted in a small collection of gems and solutions: GCC Compiler Errors (and their meaning). Enjoy! If you want me to add something, do tell me. Either through a comment, or just mail me. I'm e8johan and use GMail.

The page is a part of the new wiki-based digitalfanatics.org - and the style sheets will need some more love before all is done. It is readable - but sometimes mixes colours that where not intended to be mixed. We're currently in the process of moving contents to the wiki, so there will be changes but the links posted here aught to stay valid.

2007-03-07

GCC gems

Everybody using GCC on a daily basis must have run into one of its hidden gems. Error messages that could be poetry, in a foreign language, written backwards. The message tells you pretty much - nothing. When you have found the problem and fixed you still wonder what GCC really meant and why it could not tell you something in English...

One of my personal favourites was when I was using C and wrote:

typedef struct { ... } Foo;

void function()
{
struct Foo foo;

...
}


Did you spot the mistake? GCC did - and told me this:

storage size of 'foo' isn't known

After much work I found that Foo wasn't a struct, but a typedefed struct. Just skipping the word struct in the declaration of foo solved it.

What are your favorites? Comment!

2007-03-06

Pick a job - any job

The Swedish National Agency for Higher Education - a.k.a. Högskoleverket - recently released as listing over the educations to pick if you want a job. I just wanted to give you my 0.05 EUR.

There are two problems with this list:

#1 If you are not interested in teaching or engineering - you will probably never be a good teacher or engineer. Only use the list if you want to pick a flavor - for example what kind of engineer that you want to be or at what level you want to teach.

#2 You are not the only one watching these lists. During the IT-boom everybody wanted to be an IT engineer. That meant that the backlash when the industry collapsed was unnecessary hard. By not going with the flow and instead pick something that you are genuinely interested in you are more likely to be able keep your job when bad times come. And bad times come now and then - if nothing else, that is something to learn from history.

2007-03-05

Spring is Arriving

Today was just a wonderful morning. The sky in the east was getting brighter, and when I was driving into Gothenburg the sun started to raise above the horizon. I just had to take a quick photo of beautiful colour of the sky and the houses of Lunden lit by the early morning sun. The photo was shot at 6.40 a.m. - but soon the sun will start rising even earlier. I'm longing for the days when it has risen, almost in the north, long before 6.00 a.m. - and the summer nights - bright almost around the clock. That is when it is lovely to live in the north.

2007-03-03

Solaris

Alvaro just tipped the world that the OpenSolaris project gives away a starter kit for free. Having browsed around their site a few minutes I saw that the licensing was OSI approved - so right now I'm waiting for the kit to arrive in the mail.

This connects back to the days when I discovered Linux. I was looking at all conceivable alternate operating systems - I even ran OS/2 instead of DOS. Right now the most interesting projects seems to be the desktop versions of BSD: PC-BSD and DesktopBSD. An interesting Linux project is the GoboLinux, an alternate approach to Linux. Then there is the Swedish OS: Contiki. Just the concept of being able to surf the web from a C64... wicked! :-)

2007-03-02

Quality links

For all debianese out there - the Debian Administration site is a great resource. Much applies to Kubuntu-nese too - which means me :-)