NuPack - Microsofts own NU but with VS integration

by DotNetNerd 6. October 2010 17:44

Apparently I was not the only one who fell in love with the NU project, that I blogged a while ago. Microsoft just launched their own NuPack project which provides the same basic features, as well as integration directly with Visual Studio. As a cool sidenote it will be included in the install if you install the latest MVC 3 beta. To get started or just to see a quick runthrough of how it works take a look at Scott Hanselmans post on the subject.

 

Windows Phone 7 – my personal statusupdate

by DotNetNerd 19. September 2010 16:49

This past week I went to a meeting at Trifork about Windows Phone 7, with very big expectations. As an enthusiastic .NET developer the prospect of Microsoft “getting in to the game” of phone development is incredibly interesting. My thoughts before the meeting was that I would probably be talked into buying one right off the bat, so I could get started with writing my own apps.

The meeting started out great with the presenter being all smiles, and with a lot of praise for the phone and the experience he has had playing with it and with the developer tools. He was also happy to show a little app he had written and talked about the nice experience of working with the developer tools and MVVM light. In spite of the presenter being happy about the product, quite a bit of the talk ended up revolving around limitations arund the software that you get out of the box, as well as limitations for the developer.

More...

Tips and tricks for keeping up-to-date

by DotNetNerd 1. September 2010 16:39

These days a lot of people in the software business, including myself, do (or should do) some work to keep up with technologies, and what experiences others have. This includes quite a bit of reading both on misc websites and blogs. This can at times feel like quite a bit of work, because technologies that might be relevant tends to come in bundles, and if you wish to follow the relevant blogs it may be quite a few which means new updates every day.

More...

Tags: ,

Testing Delicious Bookmark Plugin for WLW

by DotNetNerd 18. August 2010 14:43

Tags:

NU – gem like packaging for .NET

by DotNetNerd 26. July 2010 20:37

I just had a look at NU which is made to be for .NET what gems are for Ruby. Why should you care? Well if you are like me downloading new versions of miscellaneous open source projects and updating them along the way is not your favorite thing. It’s just tedious and seems to be a hassle for something so basic. This is where NU gives you a hand.

If you have IronRuby running simply open an command line and type:

igem install nu

Then when the installation is done go to the root of your projects folder (eg. D:) and type:

nu install <some_gem>

I started out running “nu install nunit” and “nu install nhibernate” and in less than a minute I had nunit, unhibernate, log4net, castle.core and castle.dynamicproxy2 unpacked to D:\lib like this.

image

Like a good handyman a developer needs his tools – and plugins

by DotNetNerd 23. July 2010 17:34

Over the last couple of weeks I have been looking at quite a few new frameworks, tools and plugins. My focus area has mainly revolved around an app that I will be building that needs to pop and therefore it will make pretty heavy use of javascript and css - and of course by extention jQuery.

First of all dotLessCss deserves a mention, even though its actually not one things I looked at now. Basically it allows you to do some of the stuff you probably miss when working with css. Variables, mixins and nesting really helpes reduce all the repetitiveness. SquishIt is a little library I read about a while ago. It makes bundeling and minimizing javascript and css files as easy as can be. On top of that it also makes sure the files get versioned, so you won't run into users running on an old cached version.

In the category nice jQuery plugins I have looked at quite a few things. jQuery cookie addin makes it a no brainer to work with cookies. Watching a video from NDC I learned that newer browsers now support other ways of saving data on the client called sessionStorage and localStorage. As always the problem is compatibility, but there is a shim to fix this for IE6 and IE7, which are the main culprits.

I also looked at a few flashy jQuery addins, and FancyBox and Cycle solve a few of the things designers crave these days while being super simple to implement. Now that we are in the design department Cufón helpes you do font replacement easily, so you can use cool non websafe fonts.

Video is an area where there are quite a few options available, and it is becomming a jungle figure out which players support which formats and run in which browsers. Video for everybody is a simple way to implement videos in a way that will work across all the popular browsers. The idea is to use the html 5 video tag and then default to others where it is not supported. If being crossbrowser is not quite that important but designing the player is Silverlight has some great optios as well as flowplayer. Both are also easy to work with from javascript almost as straight foreward as the html 5 player API.

Lastly I saw a tweet about TopShelf and decided to try it out. Safe to say, I'll probably use it everytime I need to write a Windows Service from now on. It makes it just a little easier, and allows you to run your app either in a console or as a windows service.

 tools

Tags: , ,

IronRuby 1.1 with LINQ support

by DotNetNerd 20. July 2010 08:37

Finally LINQ is supported in IronRuby now from v. 1.1 and I think it has been solved quite elegantly without any real syntactical gooeyness. Trying it out has been made very straight forward by looking at the 101 LINQ samples rewrite for IronRuby.

From day one LINQ has seemed a natural fit with IronRuby already having a similar approach with functions such as .each {|item| ...} which is accessible on anything that can be enumerated - very much like a big part of LINQ is extentions methods to the IEnumerable interface. No doubt there has been some challanges around how to map generics, extention methods etc between the languages, but syntactically it seems a natural fit.

products.where(lambda { |p| p.units_in_stock > 0 and p.unit_price > 3.00 }).each { |x| puts x.product_name }

Combining functional methods from LINQ with the existing Ruby methods just makes the "Integrated Query" syntax even better. So now we get a .each method with LINQ even though Microsoft originally didn't want to include it :)

 

Tags: ,

IronRuby and hashes in metaprogramming

by DotNetNerd 29. June 2010 19:39

This will probably be one of the shortest blogposts I'll ever write, and probably the one with the least amount of code - besides an occational rant. The reason is that like pictures sometimes say more than a 1000 words, so does elegant code.

module MyModule
class MyClass
def write_stuff text
puts text
end
end
end

m = MyModule::MyClass.new
actions = {:write_stuff => "Hello action packed world!"}
actions.each {|key, value| m.method(key).call(value) }

It might just be me who is weird - but I think this way of doing eg. a strategy pattern is pretty cool.

Tags:

Ajax-enabled WCF services and loadbalancing

by DotNetNerd 10. June 2010 20:35

This week I ran into a problem when we were deploying a webapplication that uses ajax-enabled webservices to an environment that uses loadbalancing. The services were running fine in the stage environment and when each of the servers were called directly, but as soon as we went through the loadbalancer they failed.

I started by checking if the svc files could be reached, and surely enough they could be accessed from the servers, but through the loadbalanced domain I got a 404.

Reading blogposts on the subject provided little help – well actually it just hightened my degree of confusion. So after some time I started thinking about IIS bindings. I remembered that I had written a custom WebScriptServiceHostFactory because we had several bindings which IIS doesn’t handle too well.

using System;
using System.Configuration;
using System.ServiceModel;
using System.ServiceModel.Activation;

namespace MySite.ScriptingService
{
    public class MyCustomHostFactory : WebScriptServiceHostFactory
    {
        protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
        {
            //This makes it possible to control which binding is used by sorting them in IIS.
            return new ServiceHost(serviceType, baseAddresses[int.Parse(ConfigurationManager.AppSettings["BindingIndex"] ?? "0")]);
        }
    }
}

I started playing around with which binding we used, and as I suspected if the binding was not the one for the loadbalanced domain it returned the 404. This was one of those “doh!” moments. I still had a problem though, because the site could be accessed both with and without the www subdomain. A colleague pointed to the fact that we could use the URL rewrite plugin for IIS, and have it ensure all traffic was directed through one of the domains. As it turnes out it actually has a CanonicalHostNameRule that does just this because its a SEO good practice. Only issue I had left was that umbraco on the other hand has a practice that it must be accessed directly on one server, so changes are made on the master and replicated to the slave(s). This just required extending the conditions so it does not redirect if the umbraco folder is part of the path.

IIS routing

So now by posting this I hope Ill save someone else from getting a few extra gray hairs, and if not maybe I’ll save my self some other time when I can’t remember how I did…

Tags: , ,

Hello rake-world

by DotNetNerd 27. May 2010 16:31

Rake is a quite popular build framework, that has its strengths in the fact that it is code (no more xml), and it is very simple to get started with. Actually setting it up is a 3 step process.

  1. Make sure the path environment variable is set to point at your ironruby/bin folder.
  2. Run “igem install rake” from the commandline
  3. Write a Rakefile.rb like the following and place it at the root of your site

require 'rake'

task :default => [:say_hi]

desc "Does quite a bit of greeting"
task :say_hi_to_me do
    puts "Hello me. Now that was easy."
end

task :say_hi_to_world do
    puts "Hi world!"
end

task :say_hi => [:say_hi_to_me,:say_hi_to_world] do
    puts "I’m, all hellowed out"
end

This really all it takes, so now you are ready to run your tasks from the commandline by writing: “rake” or “rake say_hi_to_me”.

Now for this to get really interesting you will need albacore which makes it easy to do all kinds of basic tasks.

This is installed with the command “igem install albacore”, and makes it possible to do builds and run unittests like this:

require 'rake'
require 'albacore'

task :default => [:full]

task :full => [:clean,:build_release,:run_tests]

task :clean do
    FileUtils.rm_rf 'build_output'
end

msbuild :build_release do |msbuild|
  msbuild.properties :configuration => :AutomatedRelease
  msbuild.targets :Build
  msbuild.solution = "TestApp/TestApp.sln"
end

nunit :run_tests do |nunit|
    nunit.path_to_command = "tools/nunit/nunit-console.exe"
    nunit.assemblies "build_output/TestAppTests.dll"
end

rakemonkey

Tags: ,

Who am I?

My name is Christian Holm Diget, and I work as an independent consultant, in Denmark, where I write code, give advice on architecture and help with training. On the side I get to do a bit of speaking and help with miscellaneous community events.

Some of my primary focus areas are code quality, programming languages and using new technologies to provide value.

Microsoft Certified Professional Developer

Microsoft Most Valuable Professional

Month List