Hi, I am Martin.

This is my blog on mainly technology, entrepreneurship and design. Links about just about anything comes through now and then though. I also run a site on photography called Digital Photo Guide! If you are into photography, why not check that out?

Go to digitalphotoguide.net

Windows 7 near release?

So, the news today seem to ooze of the information allegedly straight from Microsoft about Windows 7 being released between summer and christmas. Almost the same amount of people have heard summer as those who heard christmas so I think that we all can agree upon that it’s all just a bunch of rumors.

Anyhow, whether they release summer, winter, fall or spring. I will so get me a mac the next time I upgrade anyhow. I have given Microsoft about ten years now (before then I was on Mac OS) to prove that they have a clue but I was let down. The only bright spot on the Microsoft OS front was XP, really. I raise my finger for Windows 2000 which did work really smooth after a bunch of service packs but if I remember correctly there was quite too many crashes on that system as well.

To conclude, Windows – you had your go. I’m going home to Mac again.

Die Welle, aka The Wave

I REMEMBER BACK IN SCHOOL quite some years ago, we got a book in our hands and about one week to finish it. The title of this book was The Wave and we all read and tried to analyze. Probably the understanding of the actual story in this book did not hit me until a few years later, I thought I understood it but I guess I didn’t.This old thought made me fire of one big smile when I found out that this story actually had been made into a movie. Had to see it.

THE MOVIE kept the story and the feeling as I remembered it, some parts of it was changed to better fit a visual interpretation of course. The Wave is about a teacher which is a warrior of the old reactive ways and his mindset of letting the kids understand how the world works. By setting up a one week project where he aims to show everyone how easy it is to be caught up in a dictatorship he cross the line of what a teacher actually should let his pupils do.

BY THE FACT that the movie also is a German production, set in Germany in our time, the question about if a people who were enslaved in about fifty years ago can be so blind that they fall into the same trap once again is perhaps more up-to-date today then in a long time. The world spins on and it is so easy to forget about old teachings and do the same errors over and over again.

I CAN RECOMEND The Wave for most people out there. If you are a teacher speaking of the power of a group this is a great tool of education. Or if you are a parent trying to explain to your child about how easy it is to be talked into doing things you never had done else; this movie is for you all.

You can find more information about the movie over at IMDB.

Arraylist vs. Array

ARRAYLIST and ARRAY are quite alike but in the same way very unlike. They can both keep data in a structure which you can walk through in different ways but the ArrayList is a bit more dynamic in how we can use it.

An Array is always declared with a static amount of data. In the example below we create an Array named myNumbers with space to hold three integers.

int[] myNumbers = new int[3];

UPON CREATION they will all be set to 0 so actually they exist directly after creation. If we try to access or add a fourth integer to this Array we would get an ArrayIndexOutOfBoundsException. You might think that all we need to do is to declare same myNumbers with more then three spaces for integers but if you do this the old myNumbers will be erased and a new created with more space.

int[] myNumbers = new int[4]; /* this would completly erase the
old myNumbers-array, creating a new one */

So if we would like to have the strength of an Array but feel that what we usually can do with it is to less we can as of Java 1.5 or later use an ArrayList. The declaration for an ArrayList look like this.

ArrayList name = new ArrayList();

THE CLASS should be what kind of variable you would like to store in the ArrayList, if you do not use any class here any object can be saved. Using no class at all is the same as using Object, i.e any object can be saved.

ArrayList myNumbers = new ArrayList(); /* can hold Integers only */
ArrayList collection = new ArrayList(); // can hold any object

When we have an ArrayList created we can use some built in functionallity to handle it. I will give short examples below in a code-snippet.

ArrayList myNumbers = new ArrayList(); /* can hold Integers only */
myNumbers.add(10); // adds the number 10 to the list
myNumbers.add(10,1); /* adds the number 10 to second element in
the list due to the fact that the first element have index 0 */
myNumbers.get(0); // get the first element from the list
myNumbers.size(); /* returns the number of elements in list,
in our case 2 */
myNumbers.isEmpty(); // true if empty
int myCheckedNumber = 10;
myNumbers.contains(myCheckedNumber); /* returns true if 10 is
within the list */
System.out.println(myNumbers); /* would print "[10,10]" in
console */

WORTH TO REMEMBER is that an Array with n elements would only need about 4*n bytes of memory. If we use an ArrayList for the same n elements would require about 20*n bytes of memory. The reason for this is that the ArrayList is an array of objects as well as an array of references. Due to this fact we always should use Array if we know how many elements we will need and memory is an issue for us. ArrayList should in this aspect only be used in cases where we need functionallity from it.