Archive for March, 2009

EXT3 and reserved space for Super User

// March 31st, 2009 // No Comments » // Linux, Troublesolving, Ubuntu

Now that is what I call a stellar title for a blog post! If you instantly get that, you have probably been fiddling with Linux for a while.

Well then, let the me explain myself. This is mostly a note to self so I know what to do the next time I run into this. I just installed a new 1TB disk for my Linux (Ubuntu) server. I partitioned it, and executed a simple:

mke2fs /dev/sdd1

I then went ahead and mounted the new file system, and checked the available space. I was a bit disappointed to see that my 1TB drive only had 871GB available space! OK, this is quite a lot of space but I was not at all satisfied with that. After chatting away awhile with my buddy mr Google I realized that the EXT3 format reserves 5% of the partition for the super user. Supposedly this is to be used in case of emergency, but this drive was used to be used as a simple file storage backup drive. To remove/change the amount of the reserved space, you just issue the following commands. Please be advised that you should NEVER do this on a system partition!

First, unmount the partition if it is mounted

sudo umount /dev/hdb1

Then issued this command to decrease the reserved space to 0:

sudo tune2fs -r 0 /dev/hdb1

And then just mount the partition again

sudo mount /dev/hdb1

And that’s all there is to it. Afterwards I had 917GB of available space. That’s more like it.

Balsamiq Mockups!

// March 24th, 2009 // No Comments » // GUI, Tools

I just tried Balsamiq Mockups and I instantly loved it! It is a extremely fast way of creating a GUI mockup! It was actually faster than drawing on paper with a pencil. It has a very nice “sketchy” look to it:

Balsamiq Mockups Screenshot

Balsamiq Mockups Screenshot

I watched a few minutes of the intro movie and then tried it myself. It literally took me 10 minutes from I first heard of the product until I was using it effectively. I would say that is pretty amazing. I then went ahead and showed it to my colleagues, and they too were very impressed. We’re going to use it soon since we are in need of mockups for the new systems we’re developing.

If you have yet to discover this gem, I recommend you do as I did. Just watch the movie and then try it online. It is developed using Adobe Air and it runs very well directly in the browser. So what are you waiting for? Go there now!

iPhone OS 3.0 Beta - First impressions.

// March 18th, 2009 // No Comments » // iPhone

I have just installed the new 3.0 Beta pre release from Apple on my 2nd generation iPod Touch, and everything looks good so far! Since there certainly are some NDAs involved I won’t be going into much detail. I have to share one thing though, and that is that we now have the Swedish characters ÅÄÖ on the right place on the keyboard!!! Yay! Here’s a screenshot of that:

iPod Touch with 3.0 Beta

iPod Touch with 3.0 Beta

Cut/Copy/Paste works great! You just double tap to active it. If you double tap on a word, it will select it. You can then modify the selection easily. If you double tap where there is no word, you also get the “select all” option.

I also tried runnings some apps and so far all of them are working just fine! That is very promising. I also tried one of my own apps, Decibel (iTunes), and it is working great! :-)

The new search screen also looks promising. To access it you just swipe right from the home screen; very easy. I don’t have much content on the Touch right now, but it returned results from mail and apps, and it was very quick. I will try it again later with all my content added.

Fluent NHibernate - verifying mappings with reflection

// March 9th, 2009 // No Comments » // .Net, NHibernate

I recently started to evaluate Fluent NHibernate which is a handy tool for getting rid of the NHibernate mapping XML files. I’m not going to go into more detail on either NHibernate itself or Fluent NHibernate in this post. Instead I’m going to share a nifty little piece of code I crafted to automate the process of verifying the mappings you create. Fluent NHibernate has a very useful generic class called PersistenceSpecification. You use it like this:

new PersistenceSpecification<Order>(Session).VerifyTheMappings();

By just executing the VerifyTheMappings method in your unit tests you instantly see if something is wrong with you mappings. Very nice! Now, you could add this line of code for each mapping class you have, and all would be well. But then again you might forget to add that line when creating new mappings. Wouldn’t it be nice if there was a way to make your unit test automatically find new mapping classes and test them for you? By using a little bit of reflection magic I ended up with this:

protected virtual void VerifyFluentMappingsByReflection(Assembly assembly)
{ 
    // Get all mapping types to test
    foreach (System.Type type in assembly.GetTypes())
    {
        // Make sure it is a generic type
        if (!type.BaseType.IsGenericType)
            continue;
 
        // Check if it inherits from FluentNHibernate.Mapping.ClassMap<>
        if (type.BaseType.GetGenericTypeDefinition().Equals(typeof(FluentNHibernate.Mapping.ClassMap<>)))
        {
            // Invoke VerifyTheMappings()
            Type typeGeneric = typeof(PersistenceSpecification<>);
            Type typeConcrete = typeGeneric.MakeGenericType(new Type[] { type.BaseType.GetGenericArguments()[0] });
            Object specificationObject = Activator.CreateInstance(typeConcrete, Session);
            MethodInfo verifyTheMappingsMethodInfo = typeConcrete.GetMethod("VerifyTheMappings");
            verifyTheMappingsMethodInfo.Invoke(specificationObject, null);
        }
    }
}

You can use this method in a unit test. Just add it to a class and execute it by passing in the assembly where your keep your mappings. Feel free to use the code in any way you like, and please give me a shout in the comments if you like it! :-)

SQL Server 2008 - Can’t save changes!

// March 9th, 2009 // No Comments » // .Net, SQL Server, Troublesolving

When using the SQL Server 2008 Management Studio I bumped into the following message while creating some new tables: “Saving changes are not permitted”.

Error Message

Error Message

Now, a warning that this is happening is just dandy, but totally preventing me from performing it was not what I expected. To get around the “problem” you need to disable an option. Simply select “Tools->Options”, then “Designers”, and finally uncheck the option “Prevent saving changes that require table re-creation”.

Options

Options

Ohh well, where was I now…

Göteborgsvarvet - The Movie

// March 4th, 2009 // No Comments » // General, Running

Last year I ran my first half marathon and I’m going at it again this year. More specifically, I’m participating in the half marathon in Gothenburg in Sweden (the second largest half marathon race in the world, mind you). Adidas has published a movie of the entire race, check it out!

I’m back

// March 4th, 2009 // No Comments » // General

Going to resume some kind of blogging effort again. I’m starting of by using a new theme and I’m going to do some customizations to it, so stay tuned.