Ever since I started working with ASP.NET MVC there has been one thing that has bugged me a little bit; needing to reference my strongly-typed Controllers and Action methods by their string names. It’s not a major problem for me but last night I decided to have a go at solving the problem for a project I’m currently working on. There are the obvious simple solutions such as manually creating string constants or HtmlHelper and UrlHelper extension methods. In the past I have used the extension method approach but frankly it’s a real pain to maintain going forward with updating names, removing methods, adding new methods etc. In my opinion developers shouldn’t have to worry themselves with this kind of work when we can leave it up to the IDE (Visual Studio 2012 in this case) to do this monotonous work for us.
Recently I’ve started using Git as my main source control system after several months of very vocally complaining about it. I liked the idea of Git and distributed source control in theory but my limited practical experiences had been full of difficulties. I figured this was simply due to me not really knowing how to work with it; turned out I was right. After learning the basics I started to really enjoy using Git, so I decided to move a couple of my projects from SVN to Git and have never looked back since! Now all my code is in Git.
I found myself needing a date picker in the C# and XAML Windows Store app that I’m currently working on. To my disappointment I found this control was available in the default controls for HTML and JS apps but not XAML. I love XAML because it’s immensely powerful and flexible and I love being able to use it to develop apps for Windows 8 but the lack of equality in terms of availability of commonly required controls frustrates the crap out of me.
For the Windows Phone app that I’ve been working on recently I want to make sure that it has good support for both the light and dark themes on Windows Phone. This is pretty easy to achieve in most places by binding styles to the built-in resources but I found myself needing to change the background image of a panorama control.
Recently I’ve been spending a lot of time working on a 3D game engine using XNA and wanted to implement some model measuring functionality. I noticed that my measurements weren’t coming out quite right so with the help of the App Hub’s shape renderer sample I was able to visualise the bounding sphere for the model and noticed it was significantly smaller than my model. After some poking around and googling I discovered that I needed to set the units in my install of 3DS Max to be centimeters - once this was done and I exported my model again the bounding spheres were correctly sized and my model measurements were returning the correct results!
I always hear good things about NHibernate and how it is better than alternatives such as Entity Framework so I decided to try it out for myself; not being a fan of large XML configuration files I went the route of using Fluent NHibernate which provides a fluent interface for configuration purposes. Even though I’ve recently become a big fan of ASP.NET MVC 3 I decided to try out NHibernate in an ASP.NET Web Forms application since that’s what I work with every day.
The repository pattern is an abstraction layer which provides a well-organised approach to maintaining a separation between an applications data access and business logic layers. This gives us the important advantages of making code more maintainable and readable and improving the testability of our code. It also works great with dependency injection!
Recently at work I’ve been working on a script to import large amounts of data (~800,000 list items) into a SharePoint site. The first version of the script had obvious performance issues and I had estimated it to run for 29 hours. Turning off workflows which start automatically when a new list item is created cut this time to around 3 hours.
While working on my current ASP.NET project at work I encountered the following error when trying to call the SubmitChanges method on my LINQ to SQL data context:
This past week I have spent a little bit of time playing with the Kinect SDK and trying to get to grips with how it all works. My biggest interest is to use the Kinect SDK along with Microsoft’s XNA Framework for games development so I made a sample project using these technologies. I’ve posted a link to this project at the end of the article.