Tuesday, 26 May 2009

Ubuntu UK Podcast

So despite being a fedora user I've recently checked out the uk ubuntu podcast after my lecturer touted my cctray project to them. I've tried listening to tech podcasts before and most of them are dull and tedious to listen to. However the guys who do the ubuntu uk podcast are easy to listen to and quite entertaining. Definitely take the time to check out their latest podcast you won't be disappointed.

Sunday, 24 May 2009

NUnit and NMock

Whist working on a piece of course work for uni I started using NMock as part of some unit tests written using nunit. Having mainly used MSTests for unit tests at work I decided to use nunit as everyone has said that they are very similar. I'm extremely impressed with the potential power that NMock has given me during testing. For the assignment I wrote a small spider application that crawly a site and stores all the link. Using NMock it allowed me to test the structure of the site without requiring internet access. During this assignment I also tried to use the test driven development approach, opposed to my normal sit down and hack away. Not only were there less bugs at the end, the overall quality of my code was noticeable higher. This was largely due to the fact that I had tests already created for what it was meant to do, which required me to put more effort into the implementation. Hopefully I'll keep this style of programming up, and not just forget it as soon as I get back to work.


Here's a sample nunit test that uses nmock. The nmock object mocks the calls that request specific urls and loads the data for local files.

[Test()]
public void MockLinkFinderTest()
{
IMock mockWebClient = new DynamicMock(typeof(IWebClient));
mockWebClient.ExpectAndReturn("GetPage",File.ReadAllText("HTML/1.htm"),new object[]{"http://domain.example/1.htm"});
mockWebClient.ExpectAndReturn("GetPage",File.ReadAllText("HTML/2.htm"),new object[]{"http://domain.example/2.htm"});
mockWebClient.ExpectAndReturn("GetPage",File.ReadAllText("HTML/3.htm"),new object[]{"http://domain.example/3.htm"});

string domain = "domain.example";
string url = "http://domain.example/1.htm";

LinkFinder linkFinder = new LinkFinder();
LinkItemCollection linkCollection = linkFinder.Find(url,domain,(IWebClient)mockWebClient.MockInstance);

int expected = 3;
Assert.AreEqual(expected,linkCollection.Count);
}

Wednesday, 20 May 2009

More Running

So I've managed to keep this running thing up. Not only have I been more than once but I have started to increase the distance I've been continuously running. I am however still trying to get into a regular training pattern as it seems to be a couple of days running, then a break for a couple of days, then running again. I have created a running route that will easily allow me to extend it as I get fitter. So far its only 1.9 miles, according to google, with a half mile run to warm up, and a quarter mile run to warm down. But it is still early days yet and I should have enough time to be ready for the marathon in September. I hope so anyway.

Tuesday, 12 May 2009

New GTK# Project

I've started a new project, RssNotify, to try and learn more about developing applications using GTK. I'll still be developing cctray-gtk as this project is useful, but the RssNotify is more of a project to satisfy my curiosity.

The RssNotify project aims to provide an easy way for a user to receive notifications when an rss feed has been updated. the idea is to use notify-sharp to display the new news items. The rest of the interface will be used to try to explore the features widgets that GTK# offers.

Saturday, 9 May 2009

Running!

So I have now officially started training for the marathon that my brother has convinced me to run. Its a hill marathon, which as far as I've been told it doesn't matter how slowly you do it, as long as you finish. So I'll try and keep a log of my training, although this will mainly be for myself to stop myself slacking off.

Heres the marathon I'll be running
http://www.runnersworld.co.uk/events/viewevent.asp?sp=&v=2&EN=48185.

Wednesday, 6 May 2009

CCTray updates and Mono musings

Impleneted some more to the CCTray-gtk project with the ability to add build servers that communicate over HTTP. This did involve commenting out some of the code in the CCTrayLib project, which was unavoidable. The issue occurred as the library added a delegate to the Service point manager


ServicePointManager.ServerCertificateValidationCallback = delegate{ return true; }


These were causing an exception to be thrown as it is currently not implemented in mono. This so far is the only part of mono that I've found that has caused any problems.

https://bugzilla.novell.com/show_bug.cgi?id=346561

I've also started to implement the ability to remove a project, at the moment it removes the project from the preferences window but does not yet remove the associated project monitor or remove it from the main window's treeview.

Once this has been implemented I will create a release or something for testing.