this.AreaOfInterest = Development.All();

Anglebrackets Fall 2013, MGM Grand, Las Vegas


The journey began on Friday, October 25 when I left Karlskoga by train heading for Oslo. The first flight at 6:35am via Paris, Los Angeles and finally Las Vegas, Nevada.

Sunday October 27thThe flights went very well, Airbus A380 was clearly a very cool experience. Shit, that airplane is huge!
Arriving in Las Vegas 08:00pm there was food and a “some drinks” together with my colleagues Odd and Daniel along with a friend of Daniel before it was time to get some sleep for the workshop on Sunday morning.

Application Architecture for Multiple UIs

Paul D. Sheriff

I though this workshop would include a lot more patterns & practices on a deeper level, it was the most entry-level stuff. I did not attend the last hours because of that. Paul went through how to easily create your own ORM which in practice is not that difficult until it comes to a little more complex scenarios.
Showing a Hello World demo is not that hard, it’s when you get to the more advanced scenarios of a framework that you really need to put some effort in it. We actually talked about this with Hanselman in the hallway and his conclusion was that Scandinavian developers have a high level of knowlegde. He told us, if we think a session is bad, just leave and go to another one, you have paid to learn, so learn. I always feel bad about leaving a session since that sends a message to the speaker, but he mean that’s a kind of a feeback aswell.

Monday 29th October

Advanced ASP.NET Web Forms

Damian Edwards

This session was exactly what we wanted to see. Damian is extremely easy to listen to and has in-depth knowledge of what he ‘s talking about. Here we got a review of some new features in ASP.NET 4.5 and some tips & tricks on how NOT to use the framework. He talked about FriendlyUrls & Routing, async and RequestValidation.

Understanding Dependency Injection & Writing Test Variable Software

Miguel Castro

Although I have pretty good knowledge of Dependency Injection and Inversion of Control, it’s always nice to hear someone else talk about it. Miguel stated that he will continue to nag about DI until it’s mainstream and I agree entirely with that. When I build applications today (for any purpose really), DI is a must for loosely coupled code, extensibility and maintainability.

He went through the different DI frameworks available on the market. I may not have learned that much at this session, but it was great fun to see how impressed the audience was. I agree with Miguel here, he’s right on the spot, we need to see this as a regular development routine, not a special feature!

AngularJS SPA Jumpstart

Dan Wahlin

I had no experience on AngularJS at all so this was interesting. John Papa, I’ve read a lot from in the past so I know that he is competent and knows what he’s talking about. It was a very good review of the basics of AngularJS even if I would have needed another half hour / hour to figure out the last concepts of the framework to get the whole picture. I became more curious about it and that’s a good rating. AngularJS is about a framework to build SPA’s (Single Page Applications).

Modern C#

Bill Wagner

It was a session that both Daniel and I had high expectations about. The idea was to be shown how to use C# today compared to the early versions. There are many who write “old” C# code even now when we have LINQ, lambda expression and async. I anticipated a high level, but it ended up that we walked away after 15 minutes. The sound was extremly bad, the speaker dropped the microphone and appeared to be either hungover or just had a bad demo day. We went on to…

Building an End-to -End AngularJS App

Dan Wahlin

Here we got some additional AngularJS details and even though we arrived a little late in the session, it was a good continuation of the earlier AngularJS session we attended by John Papa.

Tuesday 29th October

Choosing Your SPA Framework Weapon: AngularJS and DurandalJS

John Papa

I thought it would be a little more action in this session, but it was mostly a “you have to choose depending on what you are building “-talk on AngularJS or Durandal. I’ve heard this so many times before and I think it’s a little wierd to say so when it’s actually the help to make that decision you need. It depends, ON WHAT? I don’t think he was going through what you need to know to make that choice, that’s what I expected from this talk. The differences he showed was good, but not enough.

What’s New in Visual Studio 2013 ASP.NET Web and Cloud Tools

Scott Hanselman & Scott Hunter

Not listening to Scott Hanselman when at a conference is a shame, so of course we attended this session! Here we got to see some new features in Visual Studio and Windows Azure. Incremental deploy to Azure is awesome. Being able to modify a webpage css directly in the browser when debugging and saving it back to css file is even more cool (although I think it was in a beta, it will probably be released soon). Visual Studio 2013 now has the possibility to connect multiple browsers in debug mode and refresh them all at the same time, no more Alt+Tab+F5 :)

What do Web Developers need to know in 2014?

Scott HanselmanDenise R. JacobsDouglas CrockfordMichele Leroux Bustamante & John Papa

A panel discussion on what a developer needs to know today. Douglas Crockford is the man who, among other things, came up with the json format. The sound was a bit bad from Michele, so we didn’t that much from her. The conclusion of this session was that developers need to be more agile and not focus so much on a finished product. Build something simple and get it on the market in order to take further decisions on what the next step is based on input from users and measurements.

JavaScripts, Virtual Machines, the Cloud and The Metal

Scott Hanselman

Scott talked about that we have a virtual machine in every device in form of JavaScript and showed some examples of how powerful it actually is. There are operating systems built in JavaScript today, that power is something we have to embrace.

Wednesday, October 30

Web API 2 – Web Services for Websites, Modern Apps, and Mobile Apps

Scott Hunter

Scott blamed his computer for behaving strangely, I think he was hungover since it was mostly giddy and he seemed distracted. It was at least a bit of a review on Web API 2 and how to use it in mobile apps, but it was mostly just waiting on demos that didn’t work as expected…

Mobile First Responsive Design with Bootstrap 3

Shawn Wildermuth

This was really good, a sensible review of Bootstrap which is, for those of you who don’t know, a framework of CSS and JavaScript to easily get started with responsive design. There are also pre-made themes to download. Shawn is extremely talented and easy to listen to, here I became curious about actually using Bootstrap, although I have seen some of it before.

Mobile ASP.NET Web Forms – Making the Impossible Possible

Jeff Fritz

Also a good review of how to abstracting web forms and move the logic from code- behind and instead use multiple views of a controller, even in Web Forms! This is something that we’ve already, partially, implemented at my job but I got some ideas on how to take it a step further. This loosely coupled views for the same model is something I love about MVC and MVVM.

Thursday, October 31

A Day of Phonegap

Shawn Wildermuth

We attended this session to get some understanding on the concepts of PhoneGap. The basics are to build an html app and using PhoneGap to compile this to device-specific packages (iPhone, Androd etc). PhoneGap allows you to access native functions by using JavaScript. He showed Adobe PhoneGap Build, which is an online service where you can upload your project and pick up the compiled packages on the other end.

Wrap up

IMG_0246Last but not least, a little summary of my first visit to Las Vegas (and hopefully not the last).
Las Vegas is a crazy place, everything is extremely huge and everything is so… alive. We visited some night clubs, such as Voodoo at the Rio, which is a terrace at the top of the hotel with fantastic view and great music.
I got to eat good sushi at RA Sushi, ribs at the Hard Rock Café and shop a bunch of stuff to my lovely wife :)

I thought I would be more tempted to gamble, but when you see a billion slot machines, you get tired of them :) We talked about attending a poker tournament, but we didn’t find the time (or maybe that was just us prioritizing other stuff).

We did go to Rock of Ages at the Venetian and I must say, that was so frickin’ awesome. We bought our tickets at our hotel, MGM Grand. Brought the voucher to the Venetian and went in. We got the worst seats at the very back row, totally waaay back from everyone else. It seemed like one of those who worked there felt a bit sorry for us, so he asked us to follow him. He got us some seats on the 3rd row from the stage, the Rock Star seats :). It was an unforgettable evening of show and rock music from the 80’s.
So darn good it almost brought a little tear at the end when they performed Journeys “Don’t stop believin'”

From the seats in the back row

From the seats in the back row

Rock Star seats!!

Rock Star seats!!

From the 3rd row :)

From the 3rd row :)

And here are some more images from Sin City! Sorry about the quality, taken with my iPhone 4…

My room at the MGM Grand

My room at the MGM Grand

View from VooDoo

View from VooDoo

Just a pic

Just a pic

Just a pic

Just a pic

Just a pic

Just a pic

Just crazy

Just crazy

Shopping mall at Ceasars

Shopping mall at Ceasars

Outside MGM Grand Conference Center

Outside MGM Grand Conference Center

Ribs at Hard Rock Café

Ribs at Hard Rock Café

Vegas -> New York

Vegas -> New York


Healthy breakfast!

November 11, 2013 Posted by | Events | , , , | Leave a comment

VS2012, IISExpress, migration of domainuser and network share = wtf?!

Update available, scroll down!

When I started working at my current employer I noticed that My Documents was mapped to a network share. That didn’t occur to me as a problem, at the moment.

Last week the IT department decided that it was a good idea to move users to a new domain and also avoid having My Documents stored on a network share. Now they should be stored in the regular c:\users\username\documents directory. Fine with me!

Alright, its just copy and paste you think :)


Here is the insane part that I still haven’t got working:

IISExpress stores the applicationhost.config file in your whatever My Documents/IISExpress/config directory. Visual Studio does the same thing with all your important WebApplication1 projects as well as other templates and settings. This is not that hard to move since you can reconfigure Visual Studio to point to the new location.

For IISExpress  the path to the applicationhost.config file is a little different since that is stored in some hidden path buried deep down inside IISExpress and makes use of the %USERPROFILE% environment variable(which of course I now have pointing to the c:\users\username directory). If you just move the file (and relocate the My Documents library) and try to start IISExpress with a command prompt, you end up with this:

“An error occurred while reading configuration information. Make sure that the configuration file \\?\UNC\server\users\jonas\_data\IISExpress\config\applicationHost.config exists, it is accessible, and contains valid configuration information.”

This is totally acceptable since IIS Express have this hidden storage with all the path’s that’s important in your life. I still would like to know where… Trust me, I have searched the registry a couple of times for this.

A solution to one part of the problem

On the other hand, this is quite easy to solve with a reinstall of IISExpress. After you’ve done that you can start it via command prompt again.

Here’s the bad, crazy, insane, reeeeally frustrating bits

When I open my solutionfile in Visual Studio (with projects that take advantage of IISExpress) I get this error message:

C:\whateverproject.csproj : error : Creation of the virtual directory http://localhost:54000/whatever failed with the error: Filename: \\?\UNC\server\users\jonas\_data\IISExpress\config\applicationHost.config
Error: Cannot read configuration file due to insufficient permissions

The old configurationfiles still resides on the network share and this error indicates that the “new” domain don’t have permissions to access it. I COULD resolve that by fixing the access but I don’t wan’t Visual Studio to use that file in the first place. WHY does Visual Studio still use that path for the configuration?

I have searched the registry both one and five times without finding it.
Also, looking at all the environment variables using a simple “set” does not give any path containing the network share.


I’ve probably sent a dozen e-mail back and forth with Microsoft on the matter and yesterday I received this. It’s to bad there is no workaround, but always good to know that there is an issue (not only with my setup)

Hi Jonas,

This problem happened because of a bug on IISExpress.

When the CustomUserHome registry key value is configured, which is set by running IISExpress.exe with -userhome parameter, Visual Studio can’t get the right path from IISExpress and still get the wrong path of the user profile directory.

I have logged a product bug on that issue and reported to bug and the bug would be fixed in the next release of IISExpress.

When the bug is fixed, Visual Studio will work from the directory which is configured by the CustomUserHome registry key value and your problem will be solved. 

Unfortunately there is no work-around right now. So, until the bug is fixed, I’d like to recommend to remove the CustomUserHome registry key value and makes the “new” domain user have the access permission on the share as you said in your mail as the following.

November 13, 2012 Posted by | ASP.NET, Development | , , | 2 Comments

//build 2012 Microsoft Campus, Redmond

Here is my story, the one when i attended Microsoft //build 2012. The conference that i almost missed out due to sitting on a train from Oslo to my hometown when the tickets where released. Thanks to my good friend/coworker/travel buddy Daniel Hellkert, who helped me with registration by the phone, I was able to get one of the tickets.

Friday & Saturday, October 26/27

My trip started already on Friday 26th when i left Karlskoga for Oslo by train. In Sweden we never really trust the train company arriving on time so to be sure not missing my flight to the US i departed from home the day before.

After having a good breakfast at Baker Hansen in Oslo (near my apartment used when i work in Norway) I left for Gardermoen and the trip really started of. As some of you know this was actually my first trip to the United States. I was so excited! My flight did one hour stop and change of plane on Keflavik Iceland and then left for Sea-Tac International, Seattle. The flight went well and, actually during the whole trip, everything was on time. Amazing! :)

I took a cab to the hotel, checked in and made myself comfortable in the big room, just waiting to throw myself into the king size bed, excited to just be there. Daniel of course was delayed from Frankfurt so he missed his flight and had to go buy bus from Vancouver to Seattle, thus arriving a bit later than expected. When he finally arrived we went down to the Koral Bar & Kitchen located on the first floor at the hotel for some beers and a burger, discussing what we should do the days before the conference started. After having a couple of beers and the standard Captain Morgan & Coke we got some sleep, ready for the next days adventure.

Sunday, October 28

After getting a “good” night sleep (timezone’s disturbing a little bit of course) we wen’t down to a cafe for some breakfast. Then we took a cab and left for the Museum of Flight which was a fantastic idea to visit. Later this afternoon i will show my kids the photos i took and I have a guess they will be quite amazed, I was! They have a lot of different kinds of airtraffic related stuff stored in there; Air Force One, Concorde, a Boeing 747, and also a space center with some cool gears from, for example Apollo 11. Here are some photos from the visit. Do go there if you are visiting Seattle, we both agreed the time spent was worth it.

When visiting Seattle, the first thing you think of is: I MUST go up the Space Needle. Daniel on the other hand had Trip Advisor installed and quickly found another place that was cheaper AND higher. The Columbia Center Sky View. So we took a cab downtown Seattle, navigating the streets using the phone and finally got to the amazing building. The first elevator took us up to the 40th floor really fast (as the ears quite quickly tell you) and the second took us up the remaining 33 ending at the stunning 73rd floor! The view was absolutely fantastic as you can see on the photos. Later on we caught some other Swedish guys that had visit the Space Needle and was quite amused to tell them that we looked down on them :) We also grabbed some lunch at the fantastic DragonfisH restaurant where we had some delicious sushi. Daniel told me that the standard lunch was supposed to be sushi and a White Russian for desert. You should comply to standards shouldn’t you?

When we finally got back to the hotel we went to a place that came to be THE place that ended almost all days of our visit. the Joey Bellevue located just outside the hotel. This was a combined restaurant and sports bar with great beer, great food and great personnel (although asking for id the last couple of days, especially if you are 32, was a little bit disturbing. At least when they didn’t accept Swedish drivers license and had us run to the hotel room to pick up our passports. Yes, run. We where in a hurry to catch Taken 2 on the Lincoln Square cinema).

Monday, October 29

Monday started of with some breakfast and then headed of to Microsoft Building 40 to attend a streamed event of the Windows Phone 8 launch. The event was organized by Magnus Mårtensson and was really good except for some minor network issues.
After that we went back to the hotel for a while before it was time for //build registration at Microsoft Building 92. When we arrived the lines was depressingly long and we had to stand there for maybe an hour. Glad it didn’t rain though. The lines was also something that came to be a default routine at //build and I’ve seen a lot of complains about having this kind of event at campus. More about that later on…
After getting the bag with the standard stuff (you know, the t-shirt and the promotional stuff) we went to the Microsoft Commons and entered the welcome reception. There was beer and some food (although me and Daniel didn’t have that much of an appetite at the moment, although there is always room for beer). We hooked up with Johan Lindfors and some other Swedish guys but didn’t stay that long. There was also some mingle with the ASP.NET team but it was so crowded that we didn’t care to join.

Tuesday, October 30

So, finally the conference really started! Keynote time! Really looooong lines time? YES!
Breakfast at the big food tent located at building 92, and then standing in line to get into the even bigger tent built for the keynotes. This was quite an amazing construction though, not the average wedding tent :)
I think that the keynote was probably one of the best parts of the conference, more specifically since Steve Ballmer did a lot of demos himself. Kind of adds a little more to it instead of some product specialist doing it on stage.

The preshow of the keynote was Jordan Rudess (from Dream Theater) showing a really cool app for Windows 8. Just watch the video, I can’t even explain how awesome that was.

And of course, as you all know: we got the swag :) I think that Ballmer did a fantastic job delivering the SkyDrive 100Gb gift to the audience, followed by the Surface RT. Let’s say it was expected, but when it became reality, the cheering was awesome. A bit later into the keynote we saw a slide saying “Wait, there is more..” and Richard Kerris (Vice President of Nokia) went up on stage talking a bit about the new Nokia Lumia 920, which has “working maps” :) He announced that all attendees was getting a 920 device. Looking at the keynote now i get the same goosebumps as I did when I was there. This was awesome stuff and I have been using them all week and both of them are fantastic devices!

I’m not going to get into more details about all the sessions as I have done in my other conference posts. I’m just going to describe some of the highlights from each day.

  • The release of EntityFramework 5 contains a lot of nice new things, more specific: support for enums (I’ve been waiting for this since the first release!), spatial data types and some major performance improvements.

Wednesday, October 31

Wednesday starting of with the more technical keynote where Satya Nadella, Scott Guthrie, Scott Hanselman, Dave Campbell, Jason Zander, Josh Twist did some presentations about all the new stuff coming in different areas of Microsoft products.

Today’s highlights:

  • Great network and proximity support in Windows Phone 8 (Got an NFC card from the Nokia booth that i have been playing around with a bit and see some really great things doable with this)
  • Security in WinJS applications for Windows 8, know your JavaScript, it can be used for malicious script inserts!
  • Using Visual Studio and Blend together to build great apps for Windows 8. I’ve always written my XAML in the code editor. I really can’t answer why I’ve done that but now I feel that it’s just to time consuming and should move over to using the design surface in Blend more often. It looks really easy!

Thursday, November 1

Today’s highlight:

  • Building a Windows Store game in JavaScript is actually not that hard as explained by Giorgio Sardo in this video where he also entered (and did the presentation) dressed as a yeti
  • SignalR is great, give me something to work on using it. Also, Damian Edwards Australian accent is nice listening to!
  • Mads Torgersen talking about easy asynchrony is a really good presentation that i urge you to watch. It is more of an explanation about what they have made around async/await but also some really nice features on how it can be used just to get you going in the direction of the asynchronous programming model. I think they are spot on when they have parts of the framework that don’t even have synchronous api’s.
  • Scott Hanselman is the most competent presenter there is, period!

Friday, November 2

Today’s highlights:

  • App to app communication (as well as device to device) is a bliss. You can write your applications to allow interaction between them using a common way that will support different kind of communication without you changing your code. It’s all about uri’s! You can open your app using a uri protocol from, for example, an SMS or NFC interaction with the same entry point in your app.
  • Jon Galloway and Scott Hanselman‘s talk about Bleeding Edge ASP.NET made me laugh, SO many times!

The people

I have met some really nice people at the conference. First of is Justin Rusbatch who asked for a tweetup at Joey’s (surprise…) where we actually was sitting at the moment so he joined in and we hooked up almost every day togheter with Filip Ekberg, Andreas Gustavsson and Adam Cabler. We also had some good chats with Johan Lindfors, Magnus Mårtensson and Peter Drougge.

Here are some random photos from the conference, Seattle and friends/geeks/hope-to-see-again’s:

Wrap up

//build was awesome. If I would go there again? Absolutely! But if I would, i probably hope that they will either host the conference on another location OR decrease the amount of tickets. It was to much transportation between the buildings and to much lines. There was so little time between the sessions (since you had to use the shuttles between building 92 and 33) that you didn’t have the time to just walk around talking to people, checking out the exhibition area or just having a snack without worrying that you will miss a session due to the fact that the room was full 30 min before the session started.

All in all, great experience (and fantastic swag :))!!

November 5, 2012 Posted by | Events | , | Leave a comment

TechDays 2011 #Day 2 – summary

Day two of TechDays was in many cases better the first day in. Today they put a session before the keynote. I don’t know if it’s because they wanted all the hungover people to attend the keynote or somethin else…
Anyway, I started with a session about RIA architecture

RIA Architecture, there are actually a network between client and server! (Fredrik Normén)
As described in the materials, this session was a level 400 (which is the most advanced). I don’t really know how that figure got there but it was NOT a level 400, rather 200 and contained a lot of very basic principles of systemdevelopment. How to use domain models, mapping them to the presentation layer. That you should not send unnecessary data between client and server are things that developers should know and embrace, but it is not level 400 on MY TechDays. However, a good presentation but I should have chosen another session (I tend to do this mistake every year…)

Today’s keynote was very enjoyable and rewarding where Klas Hallberg (on fantastic Karlstad-dialect) talked about “How to get things done”. It was not as much product launch feeling this year.

Windows Azure behind the scene (Sriram Krishnan)
This was probably one of the coolest sessions where Sriram went in depth with the Windows Azure. Me and Joakim turned against each other at times and where fashinated about how extremely clever engineers Microsoft must have. There were many slides with arrows and boxes that showed routers, load balancers, racks, nodes and cores.
An interesting thing was about the current health of the different nodes. There is a type of heartbeat events from each node to the fabric controller. However, it is not enough that ONE heartbeat is missing because it can be a temporary network issue. They measure this with a kind of health index and when the index becomes too low, they will take the node out of production for further analysis. He also explained that if you’re going to have an application with some form of redundancy, you must have at least two instances running since at anytime one instance can be taken out of service due to updates of operating system or possible hardware problems. This will of course be no problem for an application that is “Azureized” because you are not using sessions for a specified instance. Load Balancing can fire a request the other instance on every request.

Developing Web Applications with HTML5 and ASP.NET MVC3 (Gustaf Nilsson Kotte, Karl Adriansson, Per Ökvist)
It started off well! With 20 minutes before the sessionstart there was no seats left. Far too small room when you saw the amount of people outside.
Microsoft’s “officials” worked, however, really fast and soon, like a tsunami, 500 visitors walked down the stairs at Conventum to a room more suited for the large demand.
In the end we got a quite cool review of various tools for developing great web applications using ASP.NET MVC3, HTML5 and bunch of JavaScripts. A list of tools just popped up on Twitter:

Architecture in Agile Projects – How to do it right (Mitch Lacey)
I saw a tweet from Robert Folkesson that this session should probably be very interesting. It shows quite clearly that the foreign speakers are somehow more accustomed to enthrall its audience (it has been like this throughout the whole TechDays).
Mitch has worked at Microsoft as a Program Manager and is a PMP (Professional Program Manager), CST (Certified Scrum Trainer) and have worked with agile projects for many years.
There was some very interesting parallels on how todays projects using Big Design Up Front compared to how you work in agile projects.
I hope that all the recorded sessions come out so that you can have a look at them. As always, there was some really interesting going simultaneously.

Finally, it has been a good TechDays but after attending every year for the last three years running, I am starting to miss the advanced stuff. There are far too many introductory sessions that go through the basic features of the framework and products that have existed for some time. Where have all the real-world-case sessions gone? And really, what happened to client development (WinForms / WPF). Not a single session of this despite the fact that many still have existing systems based on this.

I don’t mind attending next year aswell, but the question is if the session offered will be the same. If so, I’ll look around for something with a bit more advanced content to get something more out of the time and expense it means to attend.
Having that said, I still think that it is a privilige to be at TechDays since networking is part of the whole thing. To speak with so many talented people and meet with Twittercontacts are really funny.

Thank you for this year!

March 30, 2011 Posted by | Events | , | Leave a comment

TechDays 2011 #Day 1 – summary

So, the first day of TechDays is over. It was a great day, although I had wished that it was a bit better than the way it was.

Keynote was alright, Magnus Lidqvist was a great speaker, but I’m note sure that a panel discussion (which was not really even a debate) between Per Adolfsson and Atea’s CEO Lars Pettersson do not fit in a keynote speech on the first day of TechDays. When you leave a keynote like this, you should have a WOW! feeling, I didn’t ….

A technican Introduction to the Windows Identify Foundation (Dominick Baier)
The first session i squeezed myself through was Dominick Baier’s session about WIF (Windows Identity Foundation), which is a layer on top of .NET Framework’s auth mechanism. This is clearly a concept that one should look more at using.

And I do know what my next book purchase will be …
There was also some notices about the Active Directory Federation Services 2 which is a concept that a guy from Microsoft (which I unfortunately do not remember the name of right now) talked a lot about in the PDC. Pretty cool!

Windows Phone + 7 Windows Azure = Love! (Björn Eriksen)
Next seating was Björn Eriksen’s session on Windows 7 Phone + Windows Azure = Love. Although it is “love” for me, I would have chosen a different session. Bjorn is a very good speaker but an introductory course in WP7 and Azure is nothing I need. And MVVMLight I have already looked at. So, either I missed what the session level was or the description was incorrect. Still interesting area but I would have needed a bit more lowlevel than this.

Real World Azure: Elasticity from on-premise to cloud (and back) (Christian Weyer)
Christian Weyer, this German guy could talk just about anything and make it interesting. I’ve seen him three years in a row and he is really quite amazing to captivate an audience. This time, he talked about elasticity. How the cloud can be used to scale. And also what you should think about when you want to move your application to the “cloud” or simply move it back from the cloud to on-premise again …

Streamlined software development in practice (or how to become the most popular person in the team) (Magnus Juvas, Mathias Olausson)
Interesting session that did not really focus on what I thought. I had actually expected a bit more focus on the individuals and perhaps not so much on ALM as I’ve seen in previous years with the same speakers. After some more examination of Test/Lab Manager, i realize that: If we would have a free hand and set up a completely new project from scratch, with automated tests and test environments based on Hyper-V and just simply create the VM templates for our different environments. This is a dream come true in case of testability and “debugability”. Hope to experience this someday!

Securing REST services and Web APIs on the Windows Azure Platform (Dominick Baier, Christian Weyer)
These two German dudes are probably among the best I’ve ever seen. From the same company and with a very good interaction they deliver a very interesting session on how to authenticate and authorize users to REST services not only hosted in Azure, but also locally. This ranges from Basic HTTP Authentication to SAML, and SWT/JWT for use on eg. the WP7. Very interesting and with lots of laughter.

It’s been a long day, I was actually the first to enter TechDays this year. It’s not that I am a geek (…) but because I carpool with some people from my hometown and because of that it was a bit earlier than necessary. Since they began accepting entrance at 7:00, that means that in the afternoon I was a bit tired. After a headache-pill and a RedBull I was in the mood again and could enjoy Petter & September end the evening in a fantastic way!
I’ve also had the pleasure of discussing various things with the evangelists and other nerds who share my interest. For me, TechDays this year, is more focused on networking than knowledge acquisition.
Hope I’m more alert in the morning and the sessions are just a bit better.

I’ll try to come back with a report tomorrow as well. Goodnight TechDays 2011 and thanks for a great night!

March 29, 2011 Posted by | Events | , | Leave a comment

TechDays 2011 #Day 1 – intro

When you carpool with some other early dudes you are first in line for TechDays :)
Now I’m all check in, the first cup of coffea is finished and now awaiting for some friends to arrive and team up for the keynote.

I have taken a quick walk around the TechDays-hood and it looks quite nice. The exhibitor-area is really beautiful and since my company is present in the exhibition spending a couple of minutes there of course.

March 29, 2011 Posted by | Events | , | Leave a comment

TechDays 2011 #Day -1

So, the day before the day. Sitting in the couch preparing my TechDays schedule. This is the third year i will attend and I’m looking forward to it as much as the other years.

The current schedule setup is as follows:

11:00-12:00 – A Technical Introduction to the Windows Identity Foundation (Dominick Baier)
13:15-14:15 – Windows Phone + Windows Azure = Love! (Björn Eriksen)
14:45-15:45 – Real World Azure: Elasticity from on-premise to Cloud (and back) (Christian Weyer)
16:15-17:15 – Strömlinjeformad mjukvaruutveckling i praktiken (eller hur du blir den mest populära personen i teamet) (Magnus Juvas, Mathias Olausson)
17:45-18:45 – Windows Azure AppFabric – Middleware i molnet (Johan Hedberg)
17:45-18:45 – Securing REST-Services and Web-APIs on the Windows Azure Platform (Dominick Baier, Christian Weyer)

09:00-10:00 – RIA Architecture, det finns faktiskt ett nätverk mellan klient och Server! (Fredrik Normén)
12:30-13:30 – Windows Azure behind the scene (Sriram Krishnan)
12:30-13:30 – The Future of F#: Data and Services at your Fingertips (Don Syme)
14:00-15:00 – Windows Phone 7 – The good, bad and ugly (Johan Lindfors)
14:00-15:00 – SQL Azure – let’s go bananas! (Johan Åhlén)
15:30-16:30 – Architecture in Agile Projects – How to do it right (Mitch Lacey)

As always i have some conflicting sessions but that is up for decision right before entering the room :)

And of course I’m looking forward to meeting all the other geeks and hopefully talk to some of the persons i’ve been discussing things with through Twitter and Windows Live.

I have the intention to blog as I have done the other years but that depends on the speed of the Tuesdays-evening clock…

See you tomorrow!

March 28, 2011 Posted by | Events | , | 2 Comments

Using the WeakEventManager in Windows Presentation Foundation

The problem

On my current assignment we got into some trouble in some of our usercontrols. Since this is a WPF application we make heavy use of binding data to our controls. We display some dates in a very common way and for this specific case we implemented a usercontrol for this. The usercontrol have two Dependency Properties for binding data to the control instance. When data is bound we call a method to populate the usercontrol.

An experienced WPF developer would notice that this is kind of a wierd way to handle this scenario since we could use templates instead. BUT there is also the possibility to bind different values to this control, so it is more of a dynamic usage-scenario which led us to use this approach. So, to keep this post still useful, let’s agree that this is the correct way of solving such a problem.

What happended in our case was that when the binding was created (or updated via INotifyPropertyChanged) a specific method was called. What eventually happened was that one developer didn’t know exactly how often this method was called, and put an eventhandler registration in there to listen for a static applicationevent of ours. Some of you may already understand what happened later on. There was NO code unregistering for this event. So, when the application started up, everything was fine. But when users started working with the application and the events started travelling across the system.

The _invocationCount of the event looked like this

You might think that this is not such a big deal because it will be disposed when the “parent” goes out of scope and that is true, but a static applicationwide event never will, as long as the application is alive (which was not as long in our case since the application died from an OutOfMemoryException :)).

Rebuilding the usercontrol was not really an option, but the good news is that there was another great solution to loosely couple the event registration in the usercontrol.

The solution

WPF introduces the WeakEventManger class in the System.Windows namespace. This class is added to support event registration that will not be a hard reference to its eventsource. The event delegation is done through an interface method instead of += delegate.

In the sourcecode for this post i have included two baseclasses that you can use (and the sample also makes use of them). One is for registering for static events and the other for events on an instance of an object.

What you need to do is create a WeakEventManager for each event that you want to support. Like this:

public class NewItemInViewModelListWeakEventManager : WeakEventManagerBase<NewItemInViewModelListWeakEventManager, ViewModel>
   protected override void StartListeningTo(ViewModel source)
      source.NewItemInViewModelList += DeliverEvent;

   protected override void StopListeningTo(ViewModel source)
      source.NewItemInViewModelList -= DeliverEvent;

Above is using the instance specific WeakEventManger baseclass. The generic arguments are the current eventmanager class and the instance type. This will attach the event through the manager instead of in the class that will handle the event.

Next up is just that class, the one that should handle the event.

Here we implement the interface IWeakEventListener. This interface contains only one method: ReceiveWeakEvent that will get called then the event is raised. It is here you place the logic that should occur if it does.

public bool ReceiveWeakEvent(Type managerType, object sender, EventArgs e)
   if (managerType == typeof(NewItemInViewModelListWeakEventManager))
      var arguments = e as CustomerAddedEventArgs;
      lastAddedCustomer.Content = arguments.AddedCustomer.Id;
      return true;
   return false;

When this is done you need to tell the manager that you are listening to events. This is normally done through the += delegate method. With the WeakEventManger, this is done like this:

   var viewModel = new ViewModel();
   NewItemInViewModelListWeakEventManager.AddListener(viewModel, this);

The smart thing about the WeakEventManger is, as i mentioned earlier, that it will create a loosley couple connection between the eventhandler and the source of the event. The WeakEventManger have a build in cleaning function. Since you register the listener with “this” it will have a reference to the class implementing IWeakEventListener and by that now where to distribute the event, but also have the possibility to locate finalized object and removing them from the distributionlist.

You don’t need to call the RemoveListener method (although it will help the managers cleaning pass a bit)

For us, this solution works very well and we can see that the GarbageCollector can finalize the objects and free up the memory.

The Sourcecode!

As always, have a look at the sourcecode and please get back to me with any comments or questions.


March 14, 2011 Posted by | Development, WPF | , , , | Leave a comment

Announcing: ASP.NET MVC ModelBinder Conventions

Using modelbinders today is quite easy to do, but i wanted to extend this feature a bit more using conventions for loading them.
Basically i wanted my models to use the default ASP.NET MVC ModelBinder functionality but also have the option to just create a class in a specific place and have it automatically map that binder to my model.

To further increase the features a bit i also added support for registering my modelbinders from a directory in the Web site but also from a separate assembly.

It works like this:

If i want to take for example a Customer object mapped with the default modelbinder into any action method. I just do it like this:

public ActionResult Index(Customer customer)
   return View(customer);

QueryString, Form-values, etc will be mapped into the Customer as it normally is with the default binder. Nothing special here…

Now, if i later on decide to extend how my Customer model should be mapped. Not having a special case for this, you figure it out. Maybe you need to perform some calculations depending on some parameters. This can be done as easy as these steps.
1. Register a ModelBinder location in Global.asax
2. Put you Model-specific ModelBinder implementation in this location.

That’s all!

First things first. How do you register a ModelBinder location. There are tre ways of doing this.

1. Register “internal” ModelBinders from a location in your ASP.NET MVC Project. Lets say that you want your binders located in the Models/ModelBinders directory.

protected void Application_Start()
   //..... Normal MVC stuff, register areas, filters and routes .....//

   //Here we register modelbinders from the Models/ModelBinders directory

2. Register “external” ModelBinders from a separate assembly in the same AppDomain. The parameter is the assemblyname. In this case ExternalBinders.dll

protected void Application_Start()
   //..... Normal MVC stuff, register areas, filters and routes .....//

   //Here we register ModelBinders from an external assembly located in the same AppDomain

3. Register a specific ModelBinder instance for a specific model

protected void Application_Start()
   //..... Normal MVC stuff, register areas, filters and routes .....//

   //Here we register a specific model with a specific ModelBinder
   ModelBinderConventions.Register<SpecificBinding, SpecificModelBinder>();

So, we know how to register the binders, lets get on with implementing one. There are two ways of doing this aswell. First is by using the MVC interface IModelBinder.

public class InterfaceImplementedModelBinder : IModelBinder
   public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
      return new InterfaceImplementedBinding
            Name = Convert.ToString(bindingContext.ValueProvider.TryGetValue("Name").AttemptedValue),
            Age = Convert.ToInt32(bindingContext.ValueProvider.TryGetValue("Age").AttemptedValue),
            Message = "This is set from the InterfaceImplementedModelBinder instance"

Some notes here, The ModelAttribute is needed to tag the binder with whatever Model type to use.
The TryGetValue(string) is an extensionmethod on the IValueProvider instance to not have the binder throw exception if the key is not present. Use GetValue(string) if you like it to.

The other way of doing this is to use the abstract base class ModelBinder included in the sample.

public class InternalBindingModelBinder : ModelBinder
   public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
      base.BindModel(controllerContext, bindingContext);
      return new InternalBinding
            Name = TryGetValue("Name", Convert.ToString),
            Age = TryGetValue("Age", Convert.ToInt32),
            Message = "This is set from the InternalBindingModelBinder located in Models/ModelBinders"

Here you dont need the ModelAttribute since the Model’s type is picked up from the generic argument to the ModelBinder.
The ModelBinder also have helpermethods for TryGetValue and GetValue accepting a converter to help converting the value to the right type for your properties. the base.BindModel() i called to set the ControllerContext and the ModelBindingContext so that they can be used by the helpermethods.

You can run a sample that will use all these conventions and and classes. Just set ‘Web’ as startup and hit F5!

Please, have a look at the sample code included in this post. Don’t hesitate to ask if you have any questions or improvements!

Here is the sourcecode!

March 7, 2011 Posted by | ASP.NET, Development | , | 1 Comment

WPF Applicationwide ComboBox-style for commonly used data

A friend asked me the other day how to handle common data in his WPF-application. As i understoood they had some data floating around in the application that they displayed in some standardized way. So i gave him an example of how you can both store you data in the application but also how to implement a style for a usercontrol that consumes that data. It should of course also handle updates to the data so that it will be updated all around where it is used.

So to start of i added a UserInfo model which in this case should reflect my extremely advanced userdata model (just kiddin, its just a Name and a UserName for now)

public class UserInfo : INotifyPropertyChanged
	private string _fullName = string.Empty;
	public string FullName
		get { return this._fullName; }
			this._fullName = value;
		private string _userName = string.Empty;
	public string UserName
		get { return this._userName; }
			this._userName = value;

	public event PropertyChangedEventHandler PropertyChanged;
	public void Notify(string propertyName)
		if (PropertyChanged != null)
			PropertyChanged(this, new PropertyChangedEventArgs(propertyName));

The next thing to do is add a class which i like to call ApplicationContext. This class can be filled with the kind of data you like that you consider “global” for the entire application. Also note that i added a list of UserInfo as an ObservableCollection<T> to allow updates to be propagated to the userinterface.

public static class ApplicationContext
	static ApplicationContext()
		//Load data here or do it anywhere else and just set the properties
		private static void LoadGlobalComboBoxItems()
		//This data should be picked up from your superduper backend storage and mapped to a presentationslayer
		var list = new ObservableCollection<UserInfo>();
		list.Add(new UserInfo { FullName = "Jonas Cannehag", UserName = "joncan" });
		list.Add(new UserInfo { FullName = "John Doe 1", UserName = "johdoe1" });
		list.Add(new UserInfo { FullName = "John Doe 2", UserName = "johdoe2" });
		GlobalComboBoxItems = list;
		private static ObservableCollection<UserInfo> _globalComboBoxItems;
	public static ObservableCollection<UserInfo> GlobalComboBoxItems
			if (_globalComboBoxItems == null)
				return _globalComboBoxItems;
		set { _globalComboBoxItems = value; }

Now off to the real sugar in this exercise, the WPF (or Silverlight if you like) styles!

To make this really easy to reuse, i put all the properties, including the ItemsSource, into the style.

<Style x:Key="DefaultCombo" TargetType="{x:Type ComboBox}">
	<Setter Property="ItemsSource" Value="{x:Static Member=local:ApplicationContext.GlobalComboBoxItems}"/>
	<Setter Property="Margin" Value="20,10,20,0"/>
	<Setter Property="MinWidth" Value="200"/>
	<Setter Property="SelectedIndex" Value="0"/>

<Style x:Key="GlobalComboStyleSimple" TargetType="{x:Type ComboBox}" BasedOn="{StaticResource DefaultCombo}">
	<Setter Property="DisplayMemberPath" Value="FullName"/>

<Style x:Key="GlobalComboStyleWithDataTemplate" TargetType="{x:Type ComboBox}" BasedOn="{StaticResource DefaultCombo}">
	<Setter Property="ItemTemplate">
			<DataTemplate DataType="{x:Type model:UserInfo}">
				<StackPanel Orientation="Horizontal">
					<TextBlock Text="{Binding FullName}"/>
					<TextBlock Text="{Binding UserName, StringFormat={} ({0})}"/>

Now, i hope you understand the concept of this thing? The data is loaded and will remain there, you can add stuff into the list via the public property (or via some Add method that you add to the ApplicationContext class).

Lets get on to the fun part, USE the stuff we did. This is the best part, you just need to reference a style on a ComboBox like this:

<ComboBox Style="{StaticResource GlobalComboStyleSimple}"/>


That will, put some layout styles on your combo, BUT it will also put the ItemsSource on the combo and use the data from your ApplicationContext public static property of users.

There are two different styles in the above example and that is for you to understand the different ways you can access data from the collection you bind to. The simple way is to use the DisplayMemberPath. The slightly more advanced way is to use a template to display the stuff you really need.

In the sourcecode i also added a button to the form to allow you to add a new random user on-the-fly. That will add a user to the list and ALL combo’s in your application that utilizes this style will be updated with the new user you add.

Hope you find this useful. The sourcecode can be downloaded HERE

December 16, 2010 Posted by | Development, WPF | , , | Leave a comment


Get every new post delivered to your Inbox.