Medicine for migraine can cause headache

This is just hilarious. I know this is a blog post that's a bit out of place for me, but I just had to get this in writing.

I sometimes get this splitting headaches, something like a migraine. Usually I take some ordinary mild medicine, and lie down for half an hour and that's it. But under some circumstances I have to keep on going and that's been a problem. Therefor I got this new medicine called Zomig Nasal. On the package it says "for treating headache/migraine" and it's some kind of spray to be inhaled in the nose. It's quite expensive but for those times I really need it this could be a great thing.

So today, after exercising my enormous skills as a carpenter (NOT!) I got this splitting headache. Unfortunately we were going to a party during the evening and I didn't want to stay at home. So I decided to take the medicine. I opened the box and just had to read the instructions before inhaling.

Imagine the surprise when I read about the side effects and it says that more than 1 out of 100 people will have a headache as a side effect. HA! Yea, you read it correctly. Headache!

Unfortunately the text in the picture of the side effects is in Swedish.

And the worst part of this is that apparently I was one of the people that experienced this side effect. Now I'm not completely sure of this. The medicine could have no effect at all and my ordinary headache continued, in which case the medicine was totally useless. But my sensation was that my headache actually increased after taking the medicine. 

Somehow I feel that it is strange for a medicine that is supposed to treat headache to actually have headache as a side effect, especially for such a large number of persons (1 out of 100). Maybe I should just feel unique and special to be amongst such a chosen group. Maybe I should think twice before inhaling something that could just as easily increase my headache, and the instructions clearly specify this.

Sometimes things like this just amazes me. 


Bug in IE: duplicating characters

I've come across a bug in IE over the years and it's become one of those things I never write down, which means that I never remember how to solve the problem.Now it's time to write it down...

When using CSS float elements round text sometimes IE duplicates the last characters on a separate line beneath the end of the text. This is really confusing since the characters don't really exist if you check the HTML code. Another annoying thing about this problem is that the characters are not visible in Firefox, so you can't use Firebug for this. IE have some similar developer tools, but they are not even close to what you can do in Firebug.

Anyway the problem is not really connected to the CSS at all, even though you could solve it by changing your CSS style and not use floats. The problem lies in the use of many HTML comments. I found a great article by the CSS idiots describing the problem and the solution.
"Characters will get repeated when there are multiple HTML comments placed in between floated elements, also called as ghost text bug. First two comments have no effect, but each consecutive comment causes two duplicate characters. Three comments will duplicate three characters, four comments cause four repeating characters & six duplicate characters for five comments."
So the fix to the problem is really not to use too many comments in your code, alter your CSS not to use floats or make some kind of CSS fix as explained in the article.

I'm really getting fed up with these browser issues. I've worked with this stuff a long time now and checking the layout in five different browsers for bugs like this every time just doesn't feel like 2009, more something you would experience in the early 90's. I want a CSS standard that really works and can be used in all browsers. I can't wait to build real applications using Silverlight - I'll just have to speed up my own efforts in learning Silverlight before I use it in a live project.


OOP: is-a is not inheritance

I've been off work for a couple of days during Easter and I've been catching up on my blog reading and at the same time listening to some podcasts I've missed. When listening to an episode of Hanselminutes some of my concepts of OOP where shaken. Scott Hanselman interviews "Uncle Bob" about SOLID Principles. I really enjoy Hanselmans podcasts and the length of them suits me perfect, since my walk to work in the morning takes about 30 minutes.

Anyway, apart from bringing up some great topics about programming principles in general, 22 minutes into the podcast they bring up inheritance and remembering my education in object oriented programming I've always learned that inheritance is a "is-a" relationship. When deciding if class A should derive from class B you can always ask yourself if "A is a B".
Example: I have two base classes called Vehicle and Person. Now I am to create a class called Car and another one called Employee. A Car is a Vehicle and therefor Car should derive from Vehicle. An Employee is not a Vehicle but is a Person and will derive from Person. Pretty simple.
But according to Uncle Bob it's just not that simple. He brings up the old example with the Rectangle and Square. A Square is a Rectangle and according to the above mentioned rule a Square should derive from the Rectangle. But a Rectangle has a height and a width, and the Square only needs one variable. So the Square will inherit the wrong set of variables. Not a big problem maby, we just work around the problem so when you set the height of a Square the width is set too. But then the creator of the base class Rectangle wants to build a function that depends on the height and not the width. He knows that when you set the height, the width is not affected in a Rectangle. So he builds his function. But then you get problems with the Square, since this sets both the height and with at the same time. A Square is a Rectangle sounds right, but something is wrong.

In geometry the two objects are related, but not in code. They have completely separate behavior and therefor are not related at all. So inheritance really has nothing to do with is-a relationships it's just "a declaration of methods and variables in a sub scope" according to Uncle Bob.

I'll have to think about all of this for a while but for the time being I'll have to watch myself when dealing with inheritance, especially if I try to follow the SOLID principles. But somewhere I can't help to wonder if I would have grasped the basics of object oriented programming without the is-a. In most cases it really works.

Go ahead and check out the podcast and send some comments my way on this subject.


And now for some English

I'm switching to English on my blogg. It just feels more natural while blogging about mostly technical stuff.

My activity on this blogg has been close to nothing the last few months, but now my ambition is to be more frequent in my writing. I've been reading a lot of blog posts during the last week and I've been inspired by people who use the blog as a way to learn. By blogging about something they are in the process of learning they also get a lot of comments and thoughts on what they are doing. And also the blogg becomes an archive of things they have learned. Maby this is something for me. At least I'll give it a try.