• Setting up Mono on nginx posted on 28 Jun 2013

    Now we get to the fun stuff, getting up Mono. I'll be demoing with Mono 2.10 but after this series I may include a 6th part on how build Mono 3.0 from source and run it.

    Setting up our test page

    I figured we should start with setting up our test page. Something super simple, we will create a new page that outputs a bit of server side text.

    We wont deploy a bin folder or anything like that, it will be almost like deploying Classic ASP.

    <%@ Page Language="C#" AutoEventWireup="true" %>
    
    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <div>
        <% var test = "Hello World! Got an aspx page running on nginx!!!"; %>
    
        <%= test %>
        </div>
    </body>
    </html>
    

    So we are just creating a variable named test with some test data, then outputting it to the page.

    Read more...

  • Setting up new Website and Domain on nginx posted on 27 Jun 2013

    The purpose of series is to be able to create an end-to-end setup of a Linux Server on Azure and deploy a brand new production NancyFX website or ServiceStack service, and not get confused in-between. Like I was when I sussed all this out. :)

    Prelude

    When using IIS I think it's safe to say a large majority of us would use the GUI to configure or create new Web Sites. Even though it's actually possible to create a new website and configure it entirely through Powershell.

    But, as scary as it sounds it's not too hard to configure a new Website in nginx. I actually think its easier than doing it with Apache, despite the fact that they are relatively similar.

    Read more...

  • Setting up Ubuntu and nginx on Azure posted on 26 Jun 2013

    Note: I'm breaking this up into 5 parts because otherwise it gets far too long :(

    So after spending a week with OSX, I thought I would see how well I go with setting up Mono on Ubuntu... on Azure.

    Turns out it's actually rather simple!

    Setting up the Virtual Machine

    Setting up the virtual machine is pretty straight forward. From the Azure Portal, click the Virtual Machines tab, and select New.

    I create mine from the gallery rather than the quick option.

    Select Ubuntu Server 13.04 from the options, give your new server a name. For Authentication I recommend making a password rather than uploading an SSH key. Only because if you're new or trying this out just to play around, that stuff is probably too difficult for now :)

    Read more...

  • Making NuGet a little easier to use with an Alias posted on 21 Jun 2013

    So I've been in hospital all week with Mycoplasma Infection (or AIDs, doctor says otherwise tho), and figured it would be a good time to mess around with Mono.

    So I began by testing WorldDomination.Web.Authentication

    While it works GREAT! (Future post maybe) I did run into one issue early on, that is restoring packages.

    I found a great post by @orientman about using NuGet on OSX.

    http://orientman.wordpress.com/2012/12/29/for-the-record-how-to-run-nuget-exe-on-os-x-mountain-lion/

    But I didn't like having to type the following out each time, since I needed to install a few different project packages.

    Read more...

  • NancyFX - Hosting with OWIN posted on 29 May 2013

    By now you've probably heard of OWIN, its slowly becoming more and more popular, hell even ThoughtWorks mentioned them on their Radar

    If you want to know what OWIN is, head on over to Paul Glavich's blog post on Owin, Katana, and getting started

    The question of running NancyFX with Owin has been popping up more often lately so I figured I would show you how to get setup.

    Codez - Project Setup

    Lets start off by creating a brand new Empty Web Application:

    Once created you should get a semi long list of References...

    Read more...

  • NancyFX - Revisiting Content Negotiation & APIs (Part 3) posted on 20 May 2013

    In this last part I want to show you creating your own media type, so far we have gone over a really basic example of returning a response and letting the accept header handle different results, and then we went over how explicitly using Negotiate allows you to customize your response more.

    Creating your own Media Type may be something you never have to do, but it can help you solve some strange scenarios, for instance you could have a user request an invoice, rather than clutter your code with:

    if (requestedInvoice.Type == "pdf")
    {
        // get a pdf invoice
    }
    else if (requestedInvoice.Type == "word")
    {
    
    }
    else if (...)
    

    You get the picture, this is tedious problematic work, every time we want to supply a new invoice type we need to modify the existing request, what we want to do is just handle a new media type and process it if we know about it.

    Read more...

  • Setup my first Azure Virtual Machine! posted on 16 May 2013

    Every time I touch Azure I'm constantly amazed at how much simpler it is compared to when I tried it back when it had the crappy Silverlight management site.

    Infact every time I touch the thing I over-complicate something only to realize it was dead simple to begin with.

    I'm currently in the process of slowly building a VM to run a few small websites I'm building in my own time. Based on what I need Azure will cost me $60 less each month for roughly the same specs (with about 256mb less ram)

    The first time creating a VM took me a couple of hours to setup and working, nuking it and starting again took about as long as it took to provision the VM (few minutes)

    Read more...

  • NancyFX - Revisiting Content Negotiation & APIs (Part 2) posted on 09 May 2013

    In part 1 I went over a really basic scenario, and one of the fiddly things we had was the view name for returning a collection.

    Using Negotiate gives as more flexibility on what we can return, allowing us to customize the response to respond differently to different media types or returning partial content in some scenarios.

    Going back to my previous post I said we should be able to use the same API to build our website as we expose. But what about when we want to have additional information on the website that isn't pushed out to the client.

    Lets say you have a product catalog, and you can view a particular product on your website. You also allow people to pull the content from your site to display on their website as like an affiliate system of some sort. But when you render your product you may have a special, but when you send the product to the consuming client you don't want to include the special for them since it's something specific to your website.

    Show me the codez!

    So lets update the Product to include SpecialPrice

    Read more...

  • RSS/Atom spam :( Sorry... posted on 07 May 2013

    Sorry to anyone who subscribes to me, I was setting up an RSS since not everything accepts Atom, and I guess it re-processed everything and has spammed everyone.

    Real sorry about that :(

    Read more...

  • Disabling Namespaces on folders in Visual Studio posted on 26 Apr 2013

    I just discovered this little trick I found in Visual Studio to turn off namespacing on a folder. Not sure how after 8 years I only just found this.

    The Problem

    Lets assume we're working with Entity Framework... (shiver)... We create a Data Model, add all our Entities and away we go.

    Then we want to extend one of the Entities, maybe to add some methods and such, so we need to create some partial classes. So far we have:

    We create a new Member.cs class in the Partials folder;

    Read more...