• Microsoft Surface... So awesome, with issues... posted on 02 Jan 2013

    Shortly after the Microsoft Surface was released I got my hands on one, which wasn't exactly easy since they aren't available in Singapore yet. I had to pay $240 extra to get mine shipped from Hong Kong via http://www.expansys.com.sg and then an extra $70 for import tax...

    But it was 110% worth it. I use the thing ALL the damn time, and dispite it being limited in functionality due to Windows RT, I don't regret the purchase at all.

    There's HEAPS of good reviews on the internet about it so I'm not going to bore you with how amazingly awesome the thing is.

    What I want to discuss is 3 issues I have.

    Surface Charger

    The Surface Charger has a Magnetic Power Plug, similar to the old L-shaped MagSafe

    Read more...

  • Configuring multiple Forms Authentication sections with NancyFX posted on 20 Dec 2012

    So Phil Jones posted on twitter recently his desire to have multiple Forms Auth's for different area's in a website.

    The most common scenario is having an Administration and Member with completely separated logins.

    This is actually really easy in NancyFX. Expanding on my previous post:

    http://www.philliphaydon.com/2012/12/forms-authentication-with-nancyfx/

    I'm going to include a new area and a couple of new modules:

    I've added a folder called 'Admin' this is to act as an Area as described in my post about Nancy & Areas.

    Read more...

  • Forms Authentication with NancyFX posted on 18 Dec 2012

    There's already quite a bit of documentation on the Nancy wiki about forms authentication, but I wanted to write about it anyway.

    Note: This is written with Nancy 0.14.1 - this may be subject to change in future versions.

    Nancy supports a module for forms authentication, it works some-what similar to the way forms auth works in ASP.NET, except it's abstracted away and is not part of the core Nancy engine, which is great. It means that if you don't like the way forms authentication works, you can rip it out and write your own from scratch, or download the project and modify it to your hearts content.

    http://nuget.org/packages/Nancy.Authentication.Forms

    https://github.com/NancyFx/Nancy/tree/master/src/Nancy.Authentication.Forms

    If you take a look at the GitHub project, you can see that the implementation is actually really small. So should you want to poke around, there's not much to look at.

    Read more...

  • Windows Store App and Remote Debugging on a Surface RT posted on 18 Dec 2012

    In order to run your app from Visual Studio on your remote device, in my case I want to run it on my Surface... but you can do this with any remote device such as another desktop, a laptop, a tablet running Windows Pro or RT etc, all you really need to do is install the Remote Debugging tools.

    http://www.microsoft.com/visualstudio/eng/downloads#remote-tools

    For the Surface you just need to download and install:

    Once this is installed you will get a little icon on your Start Screen:

    You can see the Green Arrow:

    Read more...

  • Windows Store App with Caliburn.Micro - Getting Started posted on 14 Dec 2012

    So I've been learning Windows 8 development recently, specifically with C#/XAML, and Caliburn.Micro for the MVVM goodness. This is all brand new stuff for me, never done any WPF, Silverlight or Windows Phone dev. So I figured it's a good chance to blog what I'm learning.

    In this post I want to show you how to get up and running.

    I started by reading the blog posts over at Mindscape.

    http://www.mindscapehq.com/blog/index.php/2012/01/12/caliburn-micro-part-1-getting-started/

    (great series by @Jason, list of links at bottom of this post)

    The downside is they were very WPF centric, and a few things getting started have changed. There's no bootstrapper for example.

    So, here's my blog series.

    Read more...

  • Using Partial Renders with Nancy rather than Render Actions like MVC posted on 30 Nov 2012

    Today on twitter, Phil Jones (@philjones88) asked how you would do RenderAction (ASP.NET MVC extension)

    I personally don't like RenderAction in MVC, that's not to say it's bad, I just think it hides away important implementation of a page render. I think RenderAction is a bad abstraction. But this is my personal opinion. So don't hate me for it :)

    Rather than using RenderAction I prefer to use Partial views.

    Lets look at a youtube site for an example:

    On the left hand side is main content, while on the right hand side is related videos. In ASP.NET MVC we might use something like:

    @Html.RenderAction("Related", "Videos");
    

    Or something similar, I forget the syntax :)

    Read more...

  • NancyFX and Content Negotiation posted on 08 Nov 2012

    This has to be one of the most awesome features of Nancy, Content Negotiation. Recently added in 0.12, it gives you the ability to implement a single route that responds with different versions of the same document, without having to mess up your code with duplicate methods or conditional statements.

    When doing this in ASP.NET MVC I would have to check the content type and decide how I want to respond to the request.

    This ended up making duplicate methods, one which would be used by a normal GET request, while the 2nd would be for an AJAX request. Or if it was similar, use conditional logic in the single method to decide how the action should respond...

    Nancy on the other hand supports Content Negotiation out of the box.

    Get["/negotiated"] = parameters => {
        return Negotiate
            .WithModel(new RatPack {FirstName = "Nancy "})
            .WithMediaRangeModel("text/html", new RatPack {FirstName = "Nancy fancy pants"})
            .WithView("negotiatedview")
            .WithHeader("X-Custom", "SomeValue");
    };
    

    Note: Sample taken from Nancy GitHub Repo

    What is content negotiation?

    In short, it's the ability to serve different versions of a document to the same URI.

    Read more...

  • Sinatra Book Review posted on 03 Nov 2012

    For a while I've been wanting to pick-up Ruby, but not rails, every man and his dog is doing rails and everything I read I feel like it tries to do too much, much in the same way I feel ASP.NET MVC get's in the way too much by trying to do too much for me. I think I've written 'too much' too much. :)

    So I'm learning Ruby + Sinatra.

    Currently I'm reading Programming Ruby 1.9 but I just went on holiday, and figured a smaller book was a better idea to take with me.

    Enter Sinatra Up and Running

    This book, written by Alan Harris & Konstantin Haase, is brilliant. Clocking in at 103 pages (less than the 122 Amazon states), this book is everything you need to get your feet off the ground with Sinatra and get building applications.

    Read more...

  • Keep an eye on Raygun to zap all your errors away. posted on 24 Oct 2012

    Mindscape, creator of the awesome Web Workbench tool for visual studio as well as other awesome products, made an announcement today on twitter of a new up coming product they are working on.

    Raygun

    Little is currently known about this since trying to find out more from Mindscape is like squeezing blood from a stone, but what I do know is it's a online error tracking and reporting service, that will allow you to track errors that occur on both the serverside and the clientside.

    This looks awesome and quite possible be a great Elmah Replacement for my projects, since it will have the ability to track clientside issues that usually go unnoticed.

    Not only that but the community will be able to contribute their own plugins and extensions to the service!

    Apparently Alpha invites will start going out in the next 2 weeks, so head on over to http://raygun.io/?ref=1QWEy and signup!

    Read more...

  • Running 2 queries is fine, you don't need to ALWAYS eager load! posted on 06 Oct 2012

    Every now-n-then someone comes into JabbR or messages me asking about the best way to load a relationship. Often enough what the person is trying to do is Eager load some reference/relational data.

    For example, Order / Customer.

    If we want to load an Order and get the Customer information at the same time, we can eagerly fetch this information using an ORM, in RavenDB we can Include the results so that when we query them, the session already has the information and doesn't need to round-trip to the database.

    You don't need to!

    There really is nothing wrong with executing two separate queries in this scenario.

    var order = Session.Load<Order>(123); 
    var customer = Session.Load<Customer>(order.CustomerId);
    

    These queries are fast to execute, and there really is nothing wrong with it! You can add some complexity in your NHibernate mappings by creating a reference so you can Eagerly fetch the reference and have 1 trip to the database etc. But this really isn't where eager fetching is beneficial!

    Read more...