Home

Blog


Reload DNX whenever a file changes


I am currently developing a console app in .NET Core on my Mac. It’s a rather nice experience, although I miss a lot of stuff from Visual Studio - expecially R#.


Setup DNX in macOS


After so much waiting, so many “I’ll do this first”, so much app coding etc. etc. (yep, I blame my family as well), I finally managed to start playing around with DNX and ASP.NET 5.








IoC in iOS


UPDATE 2017-01-25: Since I wrote this post, much better alternatives are now available for Swift. My favorite is Dip. A second option is Swinject. I really like Dip, but you should check out both and see which suits you best.





Denise Jacobs - The Creativity (R)Evolution


The creativity evangelist Denise Jacobs coaches people in the tech field through creativity. In her keynote, she talked about creativity, betterness and habits. She’s a pro-speaker, meaning that her presentation is more or less what you could expect from an “American motivational speaker”. Professional, but so streamlined. Interesting, but leaving you with a feeling of “what did she say…really?”.


Siren Hofvander - Being Secure on a Mobile Platform


This nice talk on mobile security by Siren Hofvander kicked off with some general good-to-knows, like how a cell phone is lost every 3 minutes. Adding this to the fact that 3 of 4 companies allow BYOD (Bring Your Own Device), a lot of sensitive information can get lost to the public, if you ignore to secure your information.




Jimmy Nilsson & Jon Gyllensward - Less is more! When it comes to art and software


My fourth session of the day was a case study from Sirius International, where my old colleague Jon Gyllenswärd and friend and Jimmy Nilsson from factor 10 talked about a two year long change process they managed together. The process involved a complete system redesign, moving to a business optimal code base, cross functional teams and, sometimes controversially, always choosing the simplest solution possible.



















Windows 8 Activation Fail


Unlike Apple’s outstanding OS X experience, Microsoft really have to step up the Windows user experience. If you are going to charge a lot of money for people to use your os and require them to activate their copy of Windows, you need to make this work. Not work good, just plain work.


Multiple SSH Files


When working with git, I have mainly used a single SSH key pair, which I use for e.g. GitHub.



New legal label in MKMapView


I am using Google Maps in a couple of iOS apps that I have created. Or, at least I was before Apple threw out Google Maps and put in their own. So, now I guess I am using Apple Maps instead.


Perform web.config transforms on build


In a current project, we are auto-creating deploy packages of an ASP.NET MVC web site, using Team City. When we do, we need to perform web.config transformations so that a properly transformed configuration file ends up in the package.



Natural Scrolling in Windows 8


In OS X Lion, Apple introduced natural scrolling. It means that when you scroll, the scrollable content will move around like it was a sheet of paper you pressed and dragged around with your finger.


Git not found in Mountain Lion


I recently updated OS X Lion to OS X Mountain Lion on all my personal computers. The installation was smooth, but afterwards some things did not work as expected.



Oredev 2012 - Day 2


My second day at Øredev 2012 was amazing! When it was over, I had to sit down and take it all in. There were so many great talks, and I still had to skip many that I wanted to see.


Activating Windows 8


Inspired by my trip to Oredev and all the great devices and presentation, I have finally installed Windows 8. I decided to upgrade my Windows 7 installation, and found the installation to be very quick and painless.


Oredev 2012 - Day 1


I am happy to once again attend Øredev in Malmö, Sweden. Thanks, Cloud Nine, for sending me here. Three days with great speakers and nice friends is just what is needed in the dark, Swedish November.


iOS Bounce Animation


I have an app with a main menu, where users can swipe horizontally through a set of large icons that each take the user to a certain part of the app. When an icon is tapped, it bounces, plays a sound, then takes the user to that particular part of the app.


iOS Localization


This post will show you how to localize your iOS apps, so they can be translated to several languages. The post will describe how to translate plain text and how to create localized versions of your storyboards.


NDepend 4


Earlier this summer, the NDepend team released v4. I have been meaning to try it out for some time, but life (summer, sun, vacation…hey, we Swedes live in snow, cold and darkness for like 3/4 of the year) and some projects got in the way.



Xcode - Disable ARC for individual files


I am building an app that uses ARC (Automatic Reference Counting), which means I from now on will not have to handle memory management as actively as I have done before. There are still things you have to consider when using ARC, but it makes memory management a lot easier and less tedious.


JSON in iOS


I am currently creating an iOS app that will share data using JSON. Working with JSON is trivial in iOS 5, since there is now a great, native JSON serializer and deserializer. It works well, but I find it tedious to write all the required code for creating and parsing JSON data over and over again.


Retrive Core Data objects with case insensitive comparison


I am currently building an iOS app that uses core data for data persistency. All works great, but as I started adding data and retrieved entities sorted by name, I noticed that the sorting did not work as I expected. The objects came out in a strange order:


DevSum 2012 - Day 2 Summary


The second and last day of DevSum featured some great sessions. Some were really challenging as well, especially for a parental leave douchebag like myself :)




Adding photos to the iPhone simulator


I am currently developing an iOS app that will make use of the device camera. It works really well, but since I am also running this app on the simulator, I want to be able to select pictures from the photo library as well.






Øredev 2011 in the rear-view mirror – Part 4


This is the fourth part of my Øredev 2011 summary. It has taken quite a long time to get this finished, so I will write a bit less about each session in this post and refer to external resources instead of spending lines on describing products and concepts.


Trying out NDepend


I have been using NDepend to analyze the latest version of my NExtra library. The code is spotless (this is where you should detect the irony), but the analysis is highlighting some interesting design flaws that I should fix in the next version.





Where do I put the logic?


I could use some advice regarding a project I’m currently working on. It’s a web site where people can sign up and join various groups (did I hear a “Facebook is already doing that”?) and do stuff depending on what groups they belong to.


Am I writing tests?


To grow as a developer, there is nothing as good as inviting others to criticize your potential flaws…that as well as reading a book every now and then.



Scheduling NDepend for a set of solutions


In a project that I am currently working on, I use NDepend to continuously run a scheduled code analysis on a bunch of solutions that make up a large part of the software infrastructure of a major Swedish company.





EditorBlockFor HTML helper


In ASP.NET MVC, Microsoft has done a nice job with creating various HTML helpers that can be used in a form, e.g. LabelFor, EditorFor, ValidationMessageFor and many others.


Clone a .NET solution in no time


When working with .NET, I sometimes find myself wanting to just clone a solution instead of setting everything up from scratch over and over again.


Print screen in BootCamp using an Apple keyboard


I have started to boot up Windows directly from my BootCamp partition on my iMac instead of running Windows under VMWare Fusion. This way, I do not have to share resources with the OS X partition, which is nice for gaming, programming etc.



Open file with the keyboard in OS X


Although I love OS X, I am still new to it and a Windows user at heart. As such, the unintuitive and “secret club”-like keyboard shortcuts are not one of my most favorite parts with it.


NUnit BadImageFormatException


While developing a unit tested hobby project in .NET, everything has worked great until now. Suddenly, NUnit thinks that there is something wrong with an assembly:



Slow iMac about to be fixed?


I have been having big problems with my iMac 27″ (4GB RAM) that runs Windows 7 on a Boot Camp Partition (using VMWare Fusion). It is basically the same setup as I have on my MacBook Pro (which has 8GB RAM though), with the minor difference that the MBP is fast as lightning and the iMac is slow as HELL!



Running Facebook authentication on localhost


It has taken some time, but I have finally started building an ASP.NET MVC3 site that will use the Facebook API to create and authorize users. It’s a really easy thing to accomplish, and I curse myself for not having a look at this earlier.



WPF WTF


My personal WPF WTF list has grown steadily since I started to work with WPF. In my opinion, WPF is filled with bad naming conventions and inconsistencies.



Hide the close button of a WPF window


In a WPF application that I am currently working with, I have to be able to hide the close button of a progress window. Instead of being closed by the user (like an alert window or a message box), this progress window should instead be closed by its owner window once its related operation has finished.


Legacy code horror


When working in a legacy code base of someone else’s making, imagine to refactor code that is mainly built up on structures like this:


WampServer URL rewriting problem


I have a hobby project that works great on MAMP, but that doesn’t run so good on WampServer. It’s quite frustrating to have to test all new components in two PHP environments that should be more or less similar, so I decided to look into this.



Trying out Plupload"


In a hobby project of mine, I had a really handy UI plugin called FileUploadForm, that could upload any number of files with AJAX. All you needed to do was to add such a form to the page to have it handle the entire upload process automatically.


Automatically convert HTML5 to HTML4


I love HTML5 and how easy things will become once it breaks through. However, it will take time for many browsers to support HTML5 and until they do, the code we write must be supported by older browsers as well.


Spotify background playback problem on iOS


This is not a development-related blog post, but well worth mentioning to all of you who have been experiencing playback problems when the Spotify app for iOS is sent to the background.


Flush the Visual Studio Template Cache


After my last blog post, where I wrote about adding the Spark template engine to an ASP.NET MVC 2 project, I decided to create a project template that uses Spark, instead of the default Web Forms view engine.


Adding Spark to ASP.NET MVC 2


After much curiosity, with other stuff stealing my time, I finally got some time to look at the Spark View Engine. Since Razor will be shipped with ASP.NET MVC 3, I decided to give Spark a try before trying Razor.


ImageGen Cache Problem


We will probably use ImageGen in a project that I’m currently working on. People who have used it before really seem to like it, so I look forward to try it out.



HTML5 localstorage


I have spend some time experimenting with the new HTML 5 localStorage feature. It is a new feature that simplifies storing data in a browser, using JavaScript.


Moving ViewState to the bottom of the page


ViewState is ASP.NET’s way of simulating state in the otherwise state-less web environment. It is a bag of bytes that is sent back and forth between the client and server. It is then deserialized by the server, which can use it to restore a previous state in its components.


PHP magic quotes


About a year ago, I had problems when sending data to a PHP page, using AJAX. In order to be able to unpack the data, I had to use stripslashes, which does not seem good. However, since it worked, I let it be without further considerations.



A quick NuPack walkthrough


Yesterday, I got a demonstration of NuPack: a free, open source, developer-focused package manager for .NET. It looked awesome, so I visited the web site, downloaded NuPack and gave it a try. This is how you do it:



Getting started with NDepend 3


After some time, I have finally got my thumb out and added an NDepend project to one of my hobby project solution, to get some analyzing done before releasing it.



Fonts.com web fonts


The time has finally come to throw Arial and Verdana and a bunch of other crappy fonts into the trash bin (Helvetica can stay for a while), as Monotype, Linotype and ITC (and others) have teamed up and developed a really cool service.




Getting familiar with PHP 5.3.2


Since I’m no real PHP developer (just pretending) I have only now started to use PHP 5.3.2, although it was released quite long ago. The reason to this is that I have just installed Aptana Studio 2, which comes with PHP 5.3.2, so I guess it’s time to learn it.









Visual NUnit 2010


I have a license for R# at work. It’s a really nice utility that helps me save a lot of time. Besides providing a lot of shortcuts and extensions to Visual Studio, it also integrates NUnit in a very convenient way.



Generate a game board map from a bitmap


I am currently developing an adventure board game in XNA, where players can play missions that take place on a board that is made up of horizontal tiles. It is a lot like the amazing, old board game Hero Quest.


A* implementation for XNA


I have recently been playing around with the XNA framework to get a grasp at how to develop games for the XBOX 360. It is great fun, but quite different from the development I usually do. So far, I have a game engine foundation, which lets me create generate missions from image/text file tuples, where the image determines the mission’s board and the text file describes the mission, emenies, goals etc.


Using shared libraries in iOS


After a couple of evenings, my first (really simple) iPhone app is taking shape. However, since I am a .NET developer at heart, it is painfully clear how spoiled I have become by all amazing Visual Studio features.


NSUserDefaults


I have now created my first iOS app UI. It’s a nice tab bar that toggles between four different views. This $$$ are not far away now…right?


XOT-Uzg TV Streaming on your XBOX


I recently picked up my old, black beast from my basement, where it has lived in solitude since I bought my Wii. Since it is old and much has happened with the video game indistry since it came out, I don’t game on my XBOX anymore. I use it to play around with the XBOX MediaCenter software, instead. After upgrading XBMC to the latest version, a friend of mine told me about XOT-Uzg, which is a script that can be used to stream web TV.


MagSafe toggles green/orange (part 2)


I have some strange updates regarding the greeen/orange blinking MagSafe I wrote about yesterday, where the LED on the MagSafe toggles between green orange, even though my new battery is fully loaded.


MagSafe toggles green/orange


In my last entry, I wrote about problems with my MacBook (strangely though, this computer is by far the best I’ve ever had…which says a LOT about PC:s :)


MacBook swollen battery


I have previously written about my numerous problems with my new, white MacBook, which I purchased in August 2007. For instance:


Load all assets in a folder in XNA


I have started looking at XNA, which I’ve been longing to do for quite some time now. My friend Jens came over to guide me some of the basics, and after a little configuration, we happily loaded random textures by pressing space.


Doxygen - A brief tutorial


I am using Doxygen to generate a web-based documentation from my well-documented NExtra project’s source code. Doxygen also supports extracting the documentation in various formats (HTML, LaTex, .man, XML etc.). I’ll go with HTML for now.


Show all files in Finder


A habit I’ve grown into while spending 80% of my time in front of a computer, is to show hidden files in Explorer or Finder. However, Explorer or Finder will not to so by default, so how to we bend them to our will?


Auto-eject external drives when Macbook goes to sleep


Edit August 28, 2010 SleepWatcher has been changed since I wrote this post and now differs from the information found in the link below. This approach does still work, though, as does the modified script that I provide below.




JSON serialization in C#


From time to time, I forget where the various classes are defined. So, here is a short tutorial to how you get JSON working in C#:


Using Moq with NUnit


As I continue to work on the NerdDinner tutorial, I have discovered that some of my development patterns has to change. Surprise? One thing that has to change is how I write tests with NUnit, when testing my repositories.


Using themes in ASP.NET MVC


I have finally gotten around to create my first web site with ASP.NET MVC. After looking through the nice start examples, I noticed that .css files were manually included in the master page.





Make URL rewriting in IIS 7 work like in IIS 6


I have had a lot of problems with getting URL rewriting to work in Windows Vista, running IIS 7. Compared to IIS 6, virtual paths in IIS 7 will not allow extensions like .js, .css, which is really problematic if you are working on systems that use shared files in virtual paths.




My first thoughts on TDD


After a very interesting conference talk on Test Driven Development (TDD) and Behavior Driven Development (BDD), I have finally started using NUnit to write unit tests while developing new features in C#.


json_encode works bad with UTF8


I have had some serious problems with UTF8 and PHP’s built-in JSON functionality. After solving it, I realized that it was not even an UTF-8 issue, but a JSON one.


Twitter vs Jaiku


I have been trying out Twitter and Jaiku (a couple of years too late). Since the two services basically do the same thing, I have evaluated which service that is the best fit for my needs. Keeping both accounts would just be a hassle, since I would have to keep both feeds going.


Automatically convert media links with jQuery


I am currently developing a PHP-based framework called Wigbi, which can be used to quickly generate sites with a database, data objects that are auto-generated in JavaScript, using PHP data classes. It also comes with a simple cms that lets you add pages and populate them with text, images, links and any data object you like. It’s actually quite amazing.


DataGridView SelectionChanged event behaves strange


In a project where I use the handy DataGridView control I, bind a data source to a grid view, then listen for the SelectionChanged event. When the event is fired, I enable or disable other controls according to the data that is contained in the grid. For instance, I disable a move down button if I have less than two items in the list, or if the selected row is the last one.


IIS 7 does not allow ports on Windows Vista


After clean installing Windows Vista on my work computer, then installing Visual Studio 2005 and Visual Studio 2008, I suddenly faced problems with using dynamic ports when developing web applications in ASP.NET.




Avoid empty img src values


A while ago, I was assigned to optimize a really slow web site. The problems were numerous, like loading all content of an expandable dashboard with tons of data at once, instead of when the user expanded each section.