Archives / 2009 / August
  • Bizzaro Referendum

    Stan Lee insulted me! But in Bizzaro World, that means he likes me! There is a referendum currently being voted on in New Zealand under the strangest circumstances.


    A couple of years ago New Zealand politicians voted to remove “reasonable force” as a defence for violence by a parent against their child. Both sides were very passionate with cries of “Won’t someone think of the children?” from supporters of the law change and rendering of clothing and gnashing of teeth by opponents, who dubbed it the “anti-smacking bill”.


    Fast forward to now and opponents to the bill have gathered enough signatures to force a non-binding referendum to be put to New Zealanders. The referendum question is:

    Should a smack as part of good parental correction be a criminal offence in New Zealand?

    Opponents of the law change to remove reasonable force are urging people to vote no it shouldn’t be a criminal offence, supporters of the law change to remove reasonable force are urging people to vote yes, make it a criminal offence.

    What makes the referendum bizzaro is when the reasonable force clause was removed as a defence, an additional clause was added.

    To avoid doubt, it is affirmed that the Police have the discretion not to prosecute complaints against a parent of a child or person in the place of a parent of a child in relation to an offence involving the use of force against a child, where the offence is considered to be so inconsequential that there is no public interest in proceeding with a prosecution.

    I read that as if you the parent smack your child, as part of a good parental correction, the New Zealand police aren’t going to do anything. What the referendum is asking for is already exists! (there is some difference but the end result is the same: you don’t go to jail for a light smack).


    So the bizzaro situation we are in is that opponents of the current law (reasonable force is not allowed as a defence) are showing their opposition to the current law by voting to keep the current law. Supporters of the current law are showing their support for the current law with a vote for change (all smacking illegal).


  • .NET 2.0 support added to Json.NET

    “There are those who said this day would never come. What are they to say now?” – Prophet of Truth, Halo 2

    As of the latest source code commit, Json.NET 3.5 supports running on the .NET 2.0 framework. Yes you read that right all you dot-net-two-point-oh-ers, next release expect a hot, hot Newtonsoft.Json.Net20.dll coming your way.

    LINQ enabling a .NET 2.0 application

    The main barrier to getting Json.NET running on .NET was LINQ – both usages internally inside Json.NET and unsurprisingly for LINQ to JSON. Fortunately getting LINQ running in a .NET 2.0 application is just a couple of steps.

    1. Set the project target framework

    The first thing you will need is VS2008 – it has the syntax support for extension methods and lambda expressions. VS2008 also has the ability to target a project against a specific version of the .NET framework. By setting the target framework to .NET 2.0 Visual Studio will remove all the assemblies from that project that have been added post 2.0 such as WCF, WPF, LINQ to SQL, LINQ to XML, etc.

    You can't seriously want to ban alcohol! It tastes great, makes women appear more attractive and makes a person virtually invulnerable to criticism!

    2. Reference LINQBridge

    Although VS2008 projects targeting .NET 2.0 still support extension methods and lambda expressions in code, without the LINQ assemblies added in 3.5 none of the LINQ extension methods (Select, Where, OrderBy) are available to use.

    The solution is LINQBridge, an open source reimplementation of the LINQ classes and assembly methods. LINQBridge looks and acts exactly the same as LINQ in .NET 3.5, right down to the System.Linq namespace. Just add a reference to LINQBridge.dll to the project and you’re done. Enjoy LINQ in your .NET 2.0 application!

    I'm meek...but I could stand to be meeker.

    3. Preprocessor #if tests – Optional

    This step is only necessary if you’re targeting multiple framework versions using multiple projects. The preprocessor lets you enable and disable portions of code based on conditional compilation symbols defined in a project. The Newtonsoft.Json.Net20 project defines the NET20 symbol and is used to disable portions of code that deal with functionality not available in .NET 2.0.

    Hi, I'm Troy McClure. You may remember me from such nature films as "Earwigs, ewwww" and "Man vs. Nature: The Road to Victory"

    4. Merge LINQBridge.dll into your application – Optional

    If you don’t want to distribute LINQBridge.dll with your application then ILMerge is a free command line app from Microsoft for merging .NET assemblies together. In my Json.NET build script I have used ILMerge to build LINQBridge.dll into Newtonsoft.Json.Net20.dll. The end user will never have to worry about the additional file.

    ilmerge.exe /internalize /out:Newtonsoft.Json.Net20.Merged.dll Newtonsoft.Json.Net20.dll LinqBridge.dll

    And that’s it. The next version of Json.NET will include the new 2.0 assembly or download the source code for yourself now.

    kick it on