Strange errors running java7 on IPv6 wifi connection

Today I was developing at work as usual at work, however I used the wifi connection because the cabled network was not working. My first problem for the day was that Eclipse could not connect to repositories when trying to install new software. All I got was ”permission denied” errors and…

org.eclipse.equinox.p2.core.ProvisionException Unable to read repository at

Solution: Add ”” to eclipse.ini

My second problem was that I got really strange errors from my local Resin Application Server. It could not connect to my local SQl-server.

Solution: Add ”” to Resin jvm start arguments

My conclusion is that because our wifi network uses IPv6 then Java uses that instead of IPv4 if not clearly stated. And the applications that I was using was not ”configured” for IPv6 usage.

console.log not working in Internet Explorer

I am doing a lot of javascript coding nowadays with knockout.js and jQuery. Working in Firefox and Firebug make you forget all those nasty habits of Internet Explorer, until the releasedate is coming closer. ho ho! This was one nasty ”thing” that I had forgotten. Console.log is only available in ”debug mode” (hit F12) in Internet Explorer. If you are calling console.log in ”standard mode” your webpage breaks.

One solution is to remove all logging and another one is to follow ”Mister Lucky’s” comment at stackoverflow and declare console.log like this:

if (!('console' in this)) console={};
'log info warn error dir clear'.replace(/\w+/g,function(f) {
if (!(f in console)) console[f]=console.log||new Function;

Now I never forget this silly one…

Shortcode conflicts in WordPress plugins

I ran into a very strange problem in one of my WordPress sites. Some shortcode tags (Shortcode API) for a plugin did not work properly. In my case it was the ”NextGEN Gallery Version 1.9.3” plugin that couldn’t show a photo album, no photos where shown. Then I did some serious troubleshooting by looking into the source code of that plugin. I found out that the shortcode ”album” was misbehaving. It generated its output correctly but it were not shown on the webpage.

Then I began to realize that it was a case of shortcode conflict between my installed plugins. Two of my activated plugins used the same shortcode ”album”. After enabling and disabling my other plugins I found out that the ”Simple Facebook Connect Version 1.3 ” plugin caused the problem. Luckily I did not use that plugin any longer so I disabled and deleted it. If I really would have needed that plugin I would have to rewrite the source code of one of the plugins to change the shortcodes that conflicted.

This is something that WordPress users should be aware of, my guess is that there are a lot of conflicts between plugins that causes very random errors.

Updates on an knockout.js observableArray not showing in GUI

This was a really simple problem but is was pretty annoying for a while. I was working with an observableArray in knockout.js and wanted to update a field in one of the items like this:

var ExperienceViewModel = {
  items: ko.observableArray([])
  // adding items to array...

function updateViewModel(data)
  for (var i = 0; i < viewModel.items().length; i++) {
    if (viewModel.items()[i].Id == data.Id) {
      viewModel.items()[i].Description = data.Description;

By doing changes to the viewModel items this way the user interface (webpage) wasn't updated. Strange!? To get it working I had to remove the item from the array and then add it again like this:

function updateViewModel(data)
  for (var i = 0; i < viewModel.items().length; i++) {
    if (viewModel.items()[i].Id == data.Id) {
      viewModel.items.splice(i, 1);

I am not a master of knockout.js, however this solution solved my problem.

Min första Windows phone 7 app

Igår var jag på appslöjd med Microsoft och gjord min första Windows Phone 7 app. Det gick förvånansvärt bra och enkelt var det. Appen är klar, men tyvärr kan jag inte publicera den på marketplace då jag inte tycker att det är värt att betala 99$ årligen för utvecklar-licensen.

Då min app ska vara en gratisapp som max ett hundratal personer skulle använda så är det inte ekonomiskt motiverat att lägga upp den. Så tyvärr Microsoft, eran prismodell för WP7 passar inte för hobbyutvecklare av småskaliga appar. Det känns nästan som att man motarbetar sådana.

Androids prismodell med en engångsavgift på 25$ dollar känns här betydligt mer rimlig. Det priset är satt för att få bort de värsta HelloWorld-apparna men utan att skrämma bort hobbyutvecklarna. Det finns väl inget syfte med att motverka utvecklare till den egna plattformen kan man tycka som i WP7 fallet. Apple Ios-utvecklare får tydligen också betala samma summa.

Inkomsterna som dessa bolag får av utvecklarna borde vara försumbar i det stora hela. Den enda anledningen till denna barriär, som jag kan se det, är att genom att ha en relativt hög avgift så får man upp kvaliteten på apparna som publiceras. Det genom att de som satsar på att utveckla till en plattform verkligen ser till att jobba med sina appar med motiveringen att om man betalar en relativt hög avgift så vill man utnyttja det till fullo. Något som en hobbyutvecklare kanske inte har råd/tid med på samma sätt.

Så lite besviken är jag ändå på Microsoft att min app inte kan publiceras på marketplace under rådande omständigheter. Om Windows Phone får en större spridning så skulle jag omvärdera mitt beslut att inte publicera, men i dagsläget så är det inte värt det.

LazyInitializationException: could not initialize proxy – no Session

The error ”org.hibernate.LazyInitializationException: could not initialize proxy – no Session” has been giving me a headache for the last couple of days. So many people on the Internet have different answers and solutions to this error. The web-app that I am working on is made with Java + Resin + Spring + Hibernate + JSP + Stripes. This error occurs when the session is no longer active.

Add this to your web.xml file and sessions should be open during the entire request.



Works for me! Read more about OpenSessionInViewFilter

Ny webbsida –

Ibland får man väldigt roliga uppdrag på jobbet. Denna gång så var det Nolbybacken, en skidanläggning i Sundsvall, som behövde uppdatera sin hemsida Den befintliga hemsidan var en fossil som uppdaterades med klassiska lokala ändringar med efterföljande ftp-överföring.

Då jag i princip är uppvuxen i Sundsvalls slalombacke så kändes det väldigt roligt att få göra en lokalkonkurrents hemsida. Nolby Alpina räknade vi ju dock aldrig som någon konkurrent utan mer som en brödraförening. Nåväl, hemsidan då? Eftersom jag fick bestämma så blev det givetvis en WordPress-sajt av det hela. Se resultatet nedan eller på

CMS: WordPress (senaste)
Tema: Nolbybacken (subtema avDelicate)
Tillägg/plugins: Akismet, All in One SEO Pack, Dynamic Headers by Nicasio Design, Simple Facebook Connect, King of the slope

Plugin: King of the slope
Det roligaste på hela uppdraget var att göra ett WordPress-plugin/widget för King of the slope. Med det aktiverat så får man upp resultatlistan för backen enligt bild nedan.

Using remove_action in a WordPress child theme

When you make a WordPress child theme and want to override functions declared in the parent theme there aren’t any good documentation available from WordPress. In the reference manual you’ll find the the remove_action remove_action( $tag, $function_to_remove, $priority, $accepted_args)

The first location that you probably try to apply this is in the ”functions.php” file by adding something like this:

function newFunction() { echo "use me instead"; }

However, this is not going to work. The oldFunction is still going to be executed and the new one as well. The child themes ”functions.php” is executed before the parent themes ”functions.php” and the remove_action command doesn’t know about the function it is trying to remove. We somehow need to remove the old function after it has been declared. The wordpress hook after_setup_theme seems to be a good candidate for a solution because it runs AFTER the parent and childs functions are loaded.

Use it like this:

function removeOldFunction() {
function newFunction() { echo "use me instead"; }

Good reading
WordPress theme function files
The Right Way to Override Theme Functions

The best Android apps when visiting Thailand

I visited Thailand the last two weeks before christmas and travelled around Bangkok, Phuket, Koh Phi Phi and Krabi. I didn’t want to bring a laptop, instead I choose to bring my ZTE Light (running CyanogenMod) with me to great success. When I was preparing the device before the trip I assumed that I needed as much offline content as possible because WIFI access could not be guaranteed when travelling around and I wasn’t going to have any Thai SIM-card for mobile broadband access.

The first stuff that I downloaded was Thailand maps from Google Images. You can’t have enough of them. High resolution maps of all the places I would visit. For Bangkok you should probably download the transportation map as well.

I am a great fan of Wikitravel and uses it a lot. However there is no simple way to only download the pages you are interested in, in my case all of the Thailand pages. Then I found the Oxygenguide which is an offline copy of the wikitravel website. I downloaded this to my device and used it a lot on the trip. On the wishlist could be that the oxygenguide team updates the files more often.

Bangkok Travel Guide Triposo
An offline travel app with maps and information about all the places. This one is great because it requires no internet connection and has aggregated site data from many sources including wikitravel.

Thailand travel guide
An offline travel app for the rest of Thailand from the same makers as the Bangkok Travel Guide. Not as good as the Bangkok guide because many less visited/poular places are missing. But it does its job.

Check your bookings and flight info from Air Asia. Good to have when you are flying domestic with them.

Excellent folder based music player for offline usage. Winamp sucks!

Wifi analyzer
This app helped me to get better reception a lot of times when wifi access was bad at hotels. Sometimes it helped to move 1m on the bed as indicated by this app. It also helped me to find free wifi spots ;)

BTW! Don’t forget to have a good filemanager.

Other things to have with you on your Android phone when travelling:
* Copy of your passport
* Travel guides in pdf format, there are plenty of them online
* Copy of your hotel bookings etc.
* Music
* Books
* Saved webpages for offline reading

Frontwalker Sundsvall

Jag har glömt att berätta om att jag bytt jobb för jag arbetar numera för Frontwalker Sundsvall.

Företagets namn var tidigare det mer välkända.

Jag ska försöka att blogga lite mer nu då jag jobbar med riktigt rolig ny teknik på jobbet. Jobbar för tillfället med det senaste inom webb, Java och .NET. Får man ha så roligt på jobbet? Ja det får man om man har en bra arbetsgivare! Så håll utkik efter nya inlägg.