Creating a standalone Nancy server

Something I tend to be doing more often, is creating a standalone Nancy server and with each of them, I setup a lot of the same boilerplate code. So I thought I would put together what that setup looks like and throw the code up on GitHub.

This is an opinionated setup using the following packages: Nancy, Autofac, Serilog, ConfigInjector

Getting Started

Starting with a new empty web application in Visual Studio 2015:

image

Then add the initial nuget packages:

Install-Package Nancy.Hosting.Aspnet

Install-Package Nancy.Bootstrappers.Autofac

Next, implement the Autofac Bootstrapper for Nancy by adding a class called Bootstrapper.cs and implement the AutofacNancyBootstrapper:

    public class Bootstrapper : AutofacNancyBootstrapper
{
protected override void ConfigureApplicationContainer(ILifetimeScope existingContainer)
{
var builder = new ContainerBuilder();
builder.RegisterAssemblyModules(Assembly.GetAssembly(typeof(Bootstrapper)));
builder.Update(existingContainer.ComponentRegistry);
}
}

Finally create a NancyModule class for the endpoint:

    public class SampleEndpoint : NancyModule
{
public SampleEndpoint() : base("/sample")
{
Get["/"] = _ => GetSampleData();
}

private Response GetSampleData()
{
return "hello world";
}
}

Now if you run up the application, and navigate to the sample endpoint, you should get the hello world response.

image

In the next post I’ll add some logging.

Microsoft Arc Touch Mouse–First Impressions

After borrowing a colleagues Microsoft Arc Mouse last year I ended up buying several of them and have been using them   exclusively since, so when the Microsoft Arc Touch Mouse came out a few weeks ago I had to get my hands on one and take it for a spin. First impressions of the mouse is how flat it folds. The Arc Mouse when folded goes into a bit of a ball, but the Arc Touch folds complete flat and is only a couple of millimetres thick. Its super slim design is what really makes you sit up and notice, folding completely flat it has been built with portability in mind easily fitting into a pocket or the sleeve on the front of my laptop bag. When you first start taking it for a run, then next thing you notice is how lightweight it is. This is one of the reasons I loved the Arc Mouse and this does not disappoint. The USB receiver for the mouse is tiny and the underside of the mouse itself has a magnetic strip which allows you to simply stick the received to the bottom when packing it away. The one thing I don’t like about the Arc Mouse is that I run through the batteries pretty quickly. Unfortunately this is partly my fault as I keep forgetting to close the mouse which turns it off, but the new Arc Touch turns off when you fold it flat which I seem to be doing more often which I put down to the design. So far I’ve only had the mouse a couple of weeks so time will tell how the battery life compares.

So after a couple of week of usage, I have found that the mouse is not as comfortable to use as the Arc Mouse. Part of this I suspect is due to its lightweight design. Instead of having a middle button or a scroll wheel, as the name suggests the Arc Touch has a touch scroll area. This provides a vibration feedback as you swipe your finger up and down to scroll. Initially I thought this would be just a novelty, but as you start to use if, I’ve found it to be quite useful. The touch area not only works as a scroll wheel, but also as a middle click operation and also allows you page up and page down by clicking the top or bottom of the touch area. Scrolling works really well, but unfortunately I’ve struggled to master the middle click or the page up and page down functionality of the touch area. This feature has been very hit and miss for me.Arc Touch Mouse from Microsoft

When the Touch Mouse was first released, it was selling for around $80 which made it about double the price of the Arc Mouse, but a quick search today has them selling for about $50 making it only $10 more now. All in all I still think my day to day mouse will remain the Arc Mouse, but for a more portable solution the design and size of the Arc Touch make it a very close second.

Telco’s Holding Us To Ransom–An Update

In my previous article Telco’s Holding Us To Ransom I discussed my dissatisfaction at the way in which Windows Phone 7 updates are blocked by the Mobile Carriers. This doesn’t just affect the Windows Phone 7 platform, but also the iPhone and Android devices. It was interesting to read an article today discussing Microsoft’s strategy to break the hold that the mobile carriers have over them:

Microsoft has a good mobile OS, they just bought a soft carrier in Skype, and whether the rumors of a potential acquisition of Nokia pan out or not, Microsoft’s recent deal with Nokia seems to go beyond a simple OS licensing agreement. If Microsoft is trying to turn the cellular industry on end, it’ll start out with Nokia hardware built to Microsoft specifications…

And of course Microsoft isn’t alone in this ambition. Apple and Google each appear to have been moving to the same destination by different paths. Apple’s integration of FaceTime, first into the iPhone, then the iPod Touch, iPad 2, and Mac OS, is a clear move toward carrier independence.

Read the full article at Is Microsoft trying to end the reign of mobile carriers?

Tips and Tricks for Overseas Business Travel

A few weeks ago I went to the NZALM conference in Wellington and next week I’m off to Bali, so I thought I’d try to gather a few tips and tricks for overseas business travel.

International Roaming

Firstly, when it comes to international roaming and smart phones you have a choice, either disable your data usage, or be prepared for a huge bill when you get home. Prior to the trip I prepaid for a data plan, but on my return I still found that I had an excess data usage bill of $70. On a pay as you go style data plan this actually only equates to less than 5MB of data (cost is $15/MB). Half way through the trip I remembered that my Kindle DX has free internet access through their WhisperNet service so I tried to use this where possible. Now this may not be the best experience for web browsing, but for things like sending and receiving emails, I found it worked a treat. To access Google Mail on a mobile device, navigate http://m.gmail.com and you will get a very text based view of your emails cutting down on a lot of the extras that you just don’t need.

clip_image001

With the Kindle web browser, there are obvious limitations such as the fact that you only have a black and white screen, you don’t have a mouse so you have to use the 5-way controller and previous and next page to navigate around, but if you are prepared to live with these you’ll save yourself a fortune in roaming data charges.

Most of the Google apps are easily viewable on the Kindle Gmail. Navigate to http://m.google.com and you will be presented with a list of many of the Google apps including Gmail and Google Reader that you can access.

Other great sites that work well on the Kindle are Lonely Planet (http://m.lonelyplanet.com), Yahoo Mail (http://m.yahoo.com) , Facebook (http://touch.facebook.com) and Twitter (http://mobile.twitter.com). There is also a great service which collects some of the most popular links at http://kinstant.com. Be sure to check out the great lightweight Google maps app they have at http://kinstant.com/maps/.

clip_image002

clip_image003

Power Converters

Fortunately NZ use the same power points and voltage as in Australia, so I didn’t need to take a converter for my previous trip, but for my next trip I’ll need to take a power adapter. One trick I learned was make sure you not only take a power adapter, but also at least a double adapter. Not only will there be times when you need to connect more than one device, but also just in case any fellow travellers you are with forget theirs.

 

So what tips and tricks do you have for overseas business travel? Please add them to the comments below.

“Down Under” Tax Strikes Again

You may recall from a previous post I talked about the "down under" tax that Harvey Norman had applied to the Samsung Series 9 laptops, well today Lenovo has had to defend its aussie pricing of its new X1 laptop.

Over the weekend Harvey Norman had a 30% sale on all laptops, so it just goes to show the kind of mark-up they have on these to be able to simply chop nearly a third off the price tag. This brought the laptop within my budget, plus I’m heading overseas next week so I’ll be able to get the GST back. All up this brings the price down to $1570 – a much more reasonable price I think.

Game of the Week – Flight Control

imageAs I mentioned in last weeks game Wordament, the keys to a successful portable game are firstly, the game need to be easy to learn but takes a while to master and secondly, you can play for as little as a couple of minutes or a couple of hours. Flight Control is one of those games that will keep you playing all day and not want to put it down.

The game is quite simple, aircraft enter from the edges of the screen and its your job to direct them to their runway to land. The only real rules are that different aircraft types have specific runways that they need to land on, and don’t let them crash. Simple enough hey, but as I said earlier, it will keep you coming back for more as you try to squeeze dozens of aircraft on the screen at the same time and keep them from crashing into each other.

Flight Control was originally developed for the iPod touch by Australian game maker Firemint and has remained in the top all time games for several years now. Flight Control is one of those success stories which has racked up over 4 million downloads and has since been ported to the iPad, Android, Windows Phone 7, Nintendo DS, Playstation and also the PC and Mac. Recently Firemint was acquired by EA Games which will hopefully mean some more capital investment to allow them to keep coming out with more great apps like this.

When the Windows Phone 7 update goes pear shaped

imageYesterday I advised that the NoDo update had been released by Telstra, unfortunately the update process didn’t go so smoothly. At the second last step it was supposed to do a reboot, but unfortunately the phone vibrated 7 times then hung on the boot screen. I left the phone and Zune update process for a considerable amount of time, but it was obvious the upgrade had failed. Attempts to reboot the phone by switching it off and on all simply returned to the same state. Further attempts to get it working including a factory reset also failed. Unfortunately the process of performing a factory reset effectively wipes everything off the phone and takes you back to the raw ROM, but seeing as the ROM is in a partial state – this is not possible. After much research on the web trying to find a solution I came across the following blog: http://barrymoves.blogspot.com/2011/05/did-you-use-chevronwp7updater-on-your.html which provides instructions for downloading and reloading the original Telstra ROM. So thankfully I now have a nice clean phone at its original state when I first bought it, all I need to do now is re-install all the apps and reconfigure all the settings again.

Samsung Series 9 Laptops and the "Down Under" Tax

Yesterday ZDNet released an article Why Do Aussies pay more for software, and I’ve come to expect that many things cost more in Australia and especially electrical goods as we simply don’t have the size market to get the economies of scale that they can achieve in markets such as the US or Europe but this story really hit home with me.

Over the weekend I was looking at some reviews of the new Samsung Series 9 laptop and liking what I saw. Check out a full review at http://www.laptopmag.com/review/laptops/samsung-series-9.aspx, but some of key features are:

  • Weighs 1.3Kg
  • 1.7cm thick
  • Intel Core i5
  • Sandy Bridge
  • 128GB Solid State Hard Drive
  • Wakes from hibernate in under 3 seconds, and boots from cold in under 20 seconds.

Seriously, with specs like these what’s not to love, however, if you want to buy one in Australia, Harvey Norman has them exclusively and the mark-up they have put on it can only be described as a “down under” tax. At the time of writing, Harvey Norman is selling the laptop for $2498, but if you bought the same laptop from the US you’d be paying $1599. Given the current exchange rate (at the time of writing 1.07) the totally cost would come to AU$1495 giving us a difference of just over $1000 or a mark up of 67%.

An alternative option that I think is going to become more and more popular given the huge mark up is to purchase the goods from overseas and ship them out, however most places such as Amazon won’t ship electrical goods to an international address. To get around this you can use a service such as My US Address (www.myus.com/Australia) which effectively allows you to register an address with Amazon for your goods to be delivered to within the US and they will then forward the goods to you in Australia. Now even taking into consideration freight of about $100 and GST, you are still going to be around $700 – $800 better off. A couple of things you will need to think is firstly power supply. Fortunately with laptops all the manufacturers are creating standard power bricks which you can replace the connection to the power point with a localised power cord. The second is warranty. Samsung is offering an international warranty on the laptop, so if you need to make a claim you would need to post it to their customer site in Sydney to have it taken care of, but otherwise you are covered.

Alternatively, the exclusive deal with Harvey Norman runs out at the end of June, so hopefully this will allow for some more competitive prices. Here’s hoping.

Telco’s Holding Us To Ransom

imageI was stoked last year when Microsoft decided to launch the new Windows Phone 7 devices in Australia and New Zealand. Now I know this is mostly due to it being a softer market to launch into where they can iron out any last minute show stoppers before the big launches into markets such as the US and Europe, but it was still very exciting to be one of the first in the world to be on the new platform.

During a press conference prior to the launch that Microsoft and Telstra hosted, one of the questions from the media asked about how software updates were going to be handled and the answer was that everyone would receive the updates at the same time, regardless of the carrier they were on which brought much joy to the wider audience. Fast forward 4 months when Microsoft started to release the first software updates in February (firstly a prep update known as pre-NoDo which was simply a patch to ensure the actual update went smoothly, then the real update – NoDo) and what do we find – the updates though they are coming from Microsoft via the Zune software, looks up your phone to see which carrier and does a verification to check if they have allowed the update.

Now at the time of writing (almost 3 months after the updates were released), all of the carriers in the world except two have release the update – Telefonica in Spain and Telstra in Australia (http://www.microsoft.com/windowsphone/en-us/features/update-schedule-world.aspx ), yet the frustrating thing is that Telstra were the launch partner! The big question on everyone’s mind is simply why? What could they possibly be still testing? If they find any bugs, its unlikely that Microsoft will stop the release seeing as all providers in the world except these two have released it. You would think this was a big enough testing bed to find any issues, plus any issues they did find, unless they were major bugs, would most likely be going into the next release (Mango). Its also very unlikely that there are compatibility issues between NoDo and the Telstra network, seeing as they already released the HTC HD7 pre-installed with the update over a month ago. So this bring me back to the initial question, why are they holding up the release, and the only conclusion I can come to is simply because they can. In a market where class actions are taking place against their competitors, it puts them in a position that those on the network are unlikely to up and change carriers (not mentioning the fact that I am locked into a 2 year contract) – even though the other carriers here in Australia have already released the NoDo update.

So. the biggest thing that I find most annoying is the fact that we were led to believe at launch that we would not be left in this situation where the carriers hold us to ransom, for what gain I really don’t know.

Update: Telstra has released the update as of this morning. The update includes NoDo as well as the SSL critical update.image

Windows Phone 7 Game–Wordament

clip_image001I was listening to the Frankly Speaking Podcast the other day and was put onto a great new game for the Windows Phone 7 called Wordament. It’s essentially a word search game, but played in real time against other players on the internet. The board consists of 16 tiles and you have 2 minutes to try to find as many words as possible by dragging your finger from one letter to the next. At the end of the 2 minutes you get to see the words you missed, then get shown a leader board to see how you went against your online competitors. I’ve never been big on word games like boggle or scrabble, but the fast pace and the multi player aspect of the game gets you totally hooked in very little time.

One of the best recipes for phone games is they are easy to play, but take a long time to master, plus, you can play for as little as a few minutes or can play all day and this game certainly fits that bill nicely. You’ll go to bed and think, I’ll just have one quick game, and before you know it you’ve been sitting there playing for an hour. I’m totally addicted, not to mention the other great thing is that the game is free. Definitely give it a try.