Category Archives: Development

This is where i blog about my developer projects. I try to keep it in english.

Am i the only one who rewrites the same project over and over again? :)

Am I the only one why keeps rewriting the same code, over and over again, while learning new languages or plattforms?

For me, it’s mainly because i hate to run Hello world examples or create meaningless projects. Because of that, my hobby project NautiCalc (you can find i web version right here) has been rewritten in PHP, Objective-C, Java, Javascript  on plattforms like iOS, Android, Web and OS X.

And now, it’s time again! Last week I attended to DevSum 2016, and I got totally hooked by Xamarin! Time to build a cross-plattform version, running on iOS and Android!

After 3-4 days of coding with Xamarin on my Mac, my first reactions are:

  • Xamarin studio is surprisingly  complete, and supports pretty much everything you need!
  • Creating UI in XAML is really nice! I’ve missed it since i dropped Silverlight.
  • Xamarin.Forms is really nice and makes it easy to write cross-plattform apps. The best thing is that it maps to native components for each plattform.
  • The built-in dependency injection adds to that!

NautiCalc in Xamarin

So, my main screen is built up by a TabbedPage built with XAML. In this page all i do is adding my namespace, so i can reference separate pages for each tab, instead of have one huge XAML file.

The TabbedPage render native navigation menus for each plattform. IT works with Windows as well, but who cares about Windows phones?

Below you can see the about page on Android and iOS, where the navigation is created by the XAML in my TabbedPage. The Android version lacks graphics at this moment,



The XAML for the about page above is also the same on both plattforms. There’s only one thing thats different on each plattform, and that is the margins:

And, off course, there’s a small code behind as well. We need to add a GestureRecognizer to enable click on the hyperlinks:

My NavigationPage (the main screen in the app) uses Xamarin.Forms.Maps. This package has to be installed from NuGet, and it also requires some initiation and for Android som configuration like API key. When that is done, map component renders Apple Maps on iOS, Google Maps on Android and Bing Maps on Windows. All with the same code!



Cross-plattform have never been easier, and ism deeply impressed by both Xamarin Studio and the framework!

Time will tell if the app finishes, or maybe i’ll change my mind and rewrites this project before it gets done. Who knows 🙂

How to create Websites (and more) with PowerShell?

If you, like me, are maintaining lots of websites, you probably want to script as much as you can. It’s time consuming to change a setting for 20+ websites, and it’s also a great chance you miss something in the process.

PowerShell is really neat in these cases, and it gets better for every new release as well.

This is a script i use to do the following:

  1. Create a new application pool, with the preferred .NET version, identity and a few other settings
  2. Create a folder to hold the website
  3. Create the website
  4. Configure a scheduled task to rotate and archive log files.

This script is highly customized for my needs and my environment. As you can se there’s a lot of assumptions in the script, that you may want to change, but i may be a nice start for you!


Exact searches with Lucene (and searches with special characters)

There’s off course thousands of ways to solve this issue. I decided to go old-school 🙂

So whats the problem? Well, if you really want to search for an exact value, and perhaps it contains strange characters (like formulas, algorithms), maybe it’s to short to be indexed correctly… and I’m sure there are more reasons.

What can you do? One way to address this is to construct a unique string, store it in the index and search that column instead of the column containing the clear text value.

An example, lets say you have values like A(b)-c in a column, and you really only want to find exact matches. Parentheses and hyphens makes this hard, and if you replace these you risk get other matches as well. Want you can do is pass the value to a base64-encoder, which will give you a unique string without strange characters, in this case you’ll get: QShiKS1j

This has to be done when you create your index. So now you have two columns, side-by-side, one with the actual value and one with encoded value.

So, when a user enters A(b)-c in the search field, all you have to do in base64-encode it before using it in your search query, and of course search in the encoded field rather than the clear text one.

The code to encode and decode strings:

The code to create an index

And here’s one way to search the index



NautiCalc v0.6.2

ikon_jonli_72Added more weather data that should be of interest at sea:

  • Visibility in km
  • Thunder probability in %

I’m starting to run out of new ideas so any suggestions is appreciated 🙂


Find the app here:

NautiCalc v0.6.1

Implemented simpleCache (check out this project at to offload server API at SMHI. Weather data is cached locally for 1 hour.

Find the app here: