Gareth Hughes Blog RSS Feed http://grhughes.com/ Gareth Hughes en-uk 600 Sun, 22 Apr 2012 15:12:00 GMT Moving to AppHarbor http://grhughes.com/31/moving-to-appharbor http://grhughes.com/31/moving-to-appharbor Sun, 22 Apr 2012 15:12:00 GMT I was holding out moving over to AppHarbor until they added support for RavenDB which they recently addded (http://blog.appharbor.com/2012/02/17/hosted-ravendb-on-appharbor). My current vps hosting which is massively underused was about to expire so I decided to make the switch.

Deployment

Deploying to AppHarbor is very easy, I opted to push to AppHarbor from my local git repo rather than integrating with BitBucket (http://support.appharbor.com/kb/getting-started/deploying-your-first-application-using-git).

Problems

I had a few initial deployment issues, such as having more than one sln file in my codebase. Then the fun started, the main problem I encountered was with Simple.Data and it proved quite difficult for me to solve, the first issue was the lack of error output from AppHarbor which I eventually solved with this class

   1: public class LogEvent: WebRequestErrorEvent
   2: {
   3:   public LogEvent( string message )
   4:     : base( null, null, 100001, new Exception( message ) ) {}
   5: }

When this is called with

   1: new LogEvent( e.Message ).Raise();

An error is recorded in the AppHarbor error viewer. I did get this code from somewhere on the web but I can’t remember where.

Once I had this in place I worked out that Simple.Data for some reason wasn’t working and also wasn’t reporting any errors. So I upgraded it and redid all the references to make sure there were no references to incorrect version. This however still didn’t work. I kept getting the exception “No ADO Provider found”, which isn’t the best error message. Simple.Data it seems doesn’t work if you don’t reference the Simple.Data dlls in projects that reference other projects using Simple.Data

So basically I have grhughes.com.Core which uses Simple.Data for database access and grhughes.com.Web which references grhughes.com.Core and for Simple.Data to work it needs to be referenced by both of these projects. I believe this is because it dynamically loads providers at start up and it can’t find them if they’re not referenced in the web project.

Now that’s all sorted the app is fully deployed and working.

]]>
Nancy http://grhughes.com/30/nancy http://grhughes.com/30/nancy Thu, 23 Feb 2012 23:45:22 GMT Nancy is a Micro .NET framework inspired by Sinatra and is available on Nuget. I decided that it was time to rewrite this site. The previous version of this site was made using ASP.NET MVC, NHibernate and Castle Windsor. The new version uses Nancy, Simple.Data and TinyIoC. 

Rather than using controllers Nancy applications are made from modules with routes and action. The first example in the docs is:

public class HelloModule : NancyModule
{
    public HelloModule()
    {
        Get["/"] = parameters => "Hello World";
    }
}

It's a typical Hello World example but you can use Razor or Spark with this and the routing can be any regular expression mapped to parameters which get passed through to the action as a dynamic object. The actions are of type Func<dynamic, Response>. 

You can also specify a condition which is type Func<NancyContext, bool>.

You can do more complex routes such as the following to match an id which is a digit and a slug which are then passed to BlogPage. CheckBlogExists does logic to make sure that the blog exists before it loads.

Get[ @"/(?<id>[\d]+)/{slug}", CheckBlogExists ] = p => BlogPage( p );

Nancy currently doesn't pass the params through to the condition, my fork of Nancy has been patched to do that because it suited my needs more. I've raised it as an issue with the Nancy devs but it's currently by design for performance.

]]>
PNI.org.uk http://grhughes.com/29/pni-org-uk http://grhughes.com/29/pni-org-uk Thu, 09 Feb 2012 23:23:58 GMT Technophobia has its own version of Fedex days which basically consists of teams of people trying to deliver something in one day. Towards the end of last year I volunteered to work on a charity website to try and give them a better looking, more modern and functional website than their existing one which was quite dated. It was a great opportunity to work on something that we would never usually get the chance to do and do something for a good cause.

This is the previous website.

Trying to deliver a website in a day is not something we usually do and is generally quite ambitious so we needed to chose the right tools. So we got ourselves into a meeting room with our computers, using Wordpress and fuelled on donuts and coke we set about trying to deliver the new site.

This is what we managed to come up with in our day and about a month later it has been put live after a few tweaks.

You can visit the new site here.

A summary of the day can be seen here. 

]]>
Pain http://grhughes.com/28/pain http://grhughes.com/28/pain Mon, 06 Feb 2012 21:34:29 GMT Decided to take up Ice Skating. Then I decided the rental boots hurt too much so I bought my own and went Ice Skating:

Then this happened:

:(

]]>
Social Feed http://grhughes.com/27/social-feed http://grhughes.com/27/social-feed Thu, 22 Dec 2011 13:29:33 GMT Social Feed So I felt like I wanted to have a play around with some new tech and I decided that would be Raven DB. I had an idea what I wanted to do, collect all my social feeds, Twitter, Facebook, Flickr, Diigo and something for gaming and show them on the side of this page.

APIs are available for Twitter/Facebook/Diigo/Flickr and these were relatively easy to work with. Some of the JSON returned was aimed at JSONP rather than server side consumption but I worked around it.

The gaming feed was slightly more of an issue. There are a few sites which collect data from Steam, Xbox live and PSN etc. The most notable being Playfire and Raptr, however neither site have any public API available though which is a huge shame. Steam also has really quite pathetic Web APIs available which are very little use.

The best solution I found was using Raptr. Raptr at least lets you auto tweet activities so I set up a Twitter account just for Raptr to tweet to and used that.

Technical Solution

Using Quartz.NET and a bit of reflection I created a Job for each feed that I want to collect and have them running every 10 minutes. I then use Newtonsoft Json to parse the results and throw them at Raven DB which is what I’m using for the data store for this feed.

Each job uses a WebClient and then calls DownloadStringAsync to download the result. A simple solution really.

And when loading the page I load the last 20 updates and throw them out on the page.

]]>
Tattoo http://grhughes.com/26/tattoo http://grhughes.com/26/tattoo Tue, 20 Dec 2011 15:26:25 GMT

Yes I got a tattoo and yes it is a Zelda Triforce Eagle. Boom.

]]>
The Legend of Zelda 25th Anniversary Symphony http://grhughes.com/25/the-legend-of-zelda-25th-anniversary-symphony http://grhughes.com/25/the-legend-of-zelda-25th-anniversary-symphony Fri, 28 Oct 2011 23:42:49 GMT This year is the 25th Anniversary of The Legend of Zelda and Nintendo organised three symphonies, one in Tokyo, one in Los Angeles and one in London on the 25th of October. I attended the London one.

They handed out these programmes at the door and had a small amount of merchandise available, which was way too expensive so I didn't bother getting any.

The symphony was in the Hammersmith Apollo and there was a huge projection the latest trailer for Skyward Sword projected on the outside of the building as we were queuing to enter.

There was a large screen which featured lots of in-game footage to match the musical arrangements (massively nerdy but amazing).

The symphony was introduced by Eiji Aonuma and Zelda Williams gave most of the track introductions.

They played music from most of the modern Zelda games including Twilight Princess and Wind Waker. This track was a particular highlight for me (Nintendo may get this taken down). 

The performance was amazing and and I'm looking forward to getting my CD with the Limited Edition version of Skyward Sword.

]]>
Canada http://grhughes.com/24/canada http://grhughes.com/24/canada Sat, 20 Aug 2011 22:45:55 GMT Here are a few of the better quality photos that I took while in Canada. I had a great time, it was nice to finally leave the country and to go somewhere as beautiful as Vancouver.

It turns out I really don't like flying but it was definitely worth it. I flew with Thomas Cook, it wasn't exactly comfortable but as I've had no other flying experience I can't really judge, the nerves definitely didn't help.

I stayed with friends in Surrey which seemed a nicer place than they claimed it to be. Downtown Vancouver was stunning and we saw Distant Worlds at the Orpheum Theatre.

We also went to Granville Island Brewery and tried a lot of their beers, they had a really great Maple Ale which I need to somehow get imported here.

We also went to the top of Grouse Mountain and The Eye of the Wind and the view was amazing.

The best bit for me though was taking a cruise from Vancouver Harbour around Stanley Park and watching the Celebration of Light from English Bay. 

]]>
Trying something new with the design http://grhughes.com/23/trying-something-new-with-the-design http://grhughes.com/23/trying-something-new-with-the-design Fri, 24 Jun 2011 23:37:13 GMT I got annoyed with the previous design, mostly because I suck at it. So i'm trying something a bit different with the design, I will probably change it again soon until I'm happy with it again.

I'm now going to look into using some new tech on this site, I really want to use Node.js for something so I may add that to here. There's also the possibility that I use it in the "game" I started to make using canvas. http://home.grhughes.com/ (Doesn't do much other than movement with the arrow keys right now.)

I ran into an interesting problem with upgrading a web app that was made using Google Gears and SVG ,the problem is that Gears is no longer supported so this app basically only works in Firefox 3.6 which isn't the fastest browser in the world. Because of the heavy Gears reliance I can't easlly get it to work in newer browsers as Gears hasn't been maintained. I was looking at WebSQL but that seems to be dead too, so other than rewrite half of the app I'm not sure what I can do with it now.

]]>
Where's my beta invite you bastards? http://grhughes.com/22/where-s-my-beta-invite-you-bastards http://grhughes.com/22/where-s-my-beta-invite-you-bastards Fri, 24 Jun 2011 23:26:57 GMT

This looks like it's going to be one of the best MMOs released in quite a few years, probably since WoW. I just can't help noticing that it looks a lot like WoW unfortunatly. I hope the story part adds enough to make the game feel less like another WoW clone and more like another great Bioware game.

I'll definitely be buying this and this cinematic is amazing, so now give me a beta invite you bastards.

]]>