June 2nd, 2008
Inspired by the recent earthquake on Iceland measuring 6.1 on Richters Scale (and possibly the 7.9′er in Kina) I decided to create my own earthquake screensaver for my Sony Ericsson 810i.
For those of you interessted in seismic activity in and around Norway feel free to download the source or binaries here.
Binaries:
http://www.labraaten.com/wpblog/wp-content/2008/06/EarthQuake.jad
Source:
EarthQuake.java
EarthQuakeCanvas.java
- Petter
Posted in Code | No Comments »
May 1st, 2008
Like any other serious website www.labraaten.com now has its own Sudoku! Wee! Just click a ’square’ and enter a number.
Read the rest of this entry »
Posted in Misc | 2 Comments »
April 27th, 2008
Posted in Schnee | Enter your password to view comments
April 4th, 2008
One thing that makes my - and others - code look ugly are all those for-loops repeatedly embedded into the code.
A typical example ias converting a string of comma seperated numbers into an array of integers. Here’s how to do it in one statement, without any loop:
Dim str As String = "1,2,3,4,5"
Dim ints As Integer() = Array.ConvertAll(Of String, Integer)(str.Split(","), _
AddressOf Convert.ToInt32)
- petter
Posted in VB | No Comments »
April 1st, 2008
First I encountered the error message:
Compiler Error CS1540: Cannot access protected member 'member' via a qualifier
of type 'type1'; the qualifier must be of type 'type2' (or derived from it).
Then I encountered Eric Lipperts explanation of Why Can’t I Access A Protected Member From A Derived Class?
Then I got angry. Read the rest of this entry »
Posted in C# | No Comments »
March 4th, 2008
If they can find pirated DVDs, then it’s just a matter of time before they can sniff up buggy, copy&paste code…
http://news.bbc.co.uk/1/hi/northern_ireland/7275060.stm
- petter
Posted in Code | No Comments »
March 1st, 2008
Here’s a beatuful illustration of how software development works. It may seem like a joke, but it’s actually quite accurate.

- petter
Posted in Code | 1 Comment »
February 29th, 2008
C# 3.0 comes with this new language feature called Collection Initializaton. It’s more or less syntactical sugar that simplifies the way you initialize collections.
Where you pre 3.0 would initialize a list of integers like this:
List<int> list = new List<int>();
list.Add(1);
list.Add(2);
list.Add(3);
You now can do this:
List<int> list = new List<int>() {1, 2, 3};
Now, this is somewhat beautified, but it does exactly the same as in the first example. The compiler parses the code and calls the Add method, implemented by List<int>, once for every integer in the initialization list.
Now, wouldn’t this be nice to do on your own proprietary collections? Read the rest of this entry »
Posted in C# | No Comments »
February 29th, 2008
When it comes to Visual Studio installation folders, why is it that Microsoft don’t just settle for one naming convention?
Here it seems that thy’re not sure what their product is named. Sometimes is .NET, sometimes not. Sometimes by year, sometimes by version (with or without the decimal):
Microsoft Visual Studio .NET 2003
Microsoft Visual Studio 8
Microsoft Visual Studio 9.0
At times they find capitalized words totally unnecessary:
microsoft frontpage
And sometimes a space, sometimes not:
Microsoft ASP.NET
Microsoft.NET
- petter
Posted in Misc | No Comments »