<?xml version="1.0" encoding="UTF-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom">
<id>SimpleIsBest</id>
<updated>7/10/2010 2:52:16 AM</updated>
<title>Simple is best - Alex Mackey</title>
<subtitle type="html">Everything should be made as simple as possible, but not simpler" Einstein</subtitle>
<author>
<name>Alex Mackey</name>
<uri>www.simpleIsBest.co.uk</uri>
<email>noreply@blogger.com</email>
</author>
<generator version="1.00" uri="http://www.devcafe.co.uk">SpiceWeasel</generator>
<link rel="self" href="http://feeds.feedburner.com/SimpleIsBest-AlexMackey" type="application/atom+xml" />
<entry><id>113</id>
<published>4/14/2010 12:00:00 AM</published>
<updated>4/14/2010 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">4/14/2010 12:00:00 AM</app:edited>
<title>ALM conference</title>
<content type="html"><![CDATA[<p>
I had a great time the last few days at the <a shape="rect" href="http://www.australianalm.com/" shape="rect">Australian ALM conference</a>. My slides and examples for my VS2010 IDE talk and whats new in .net 4 are available <a shape="rect" href="http://www.simpleisbest.co.uk/content/downloads/almConf.zip" shape="rect">here</a>.
</p>
<p>
One delegate asked about using MEF for a web application. Of course this is possible but you need to be careful as this has some issues with shared/singleton instances. I found an interesting link on this <a href="http://davesbox.com/archive/2009/02/07/changing-default-creation-policy-from-shared-singleton-to-non-shared-transient.aspx">here</a>. I havent tried what the article suggests yet and MEF has probably been updated since this was written but interesting reading.
</p>]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/ALMconference/113" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>112</id>
<published>2/28/2010 12:00:00 AM</published>
<updated>2/28/2010 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">2/28/2010 12:00:00 AM</app:edited>
<title>Beginning ASP.net security by Barry Dorrans</title>
<content type="html"><![CDATA[<p>
Beginning ASP.net security begins by introducing the reader to security principals such as defence in depth, never trusting user input etc. The author then ensures the reader understands how the web and ASP.net function by providing an overview of HTTP  ASP.net processing of events, form submissions and Viewstate– all essential concepts to understand the security issues surrounding ASP.net applications.
</p>

<p>
The book is divided into 16 easy to read chapters. Chapters contain small snippets of code and demonstrate various security issues ensuring the reader understands the problem being discussed. Detailed advice is then given and solutions provided to fix the various issues. 
</p>
<p>
 Issues are supplemented with real world examples and the author’s own experience (I chuckled at the index server example) and help provide some colour to what can be a difficult topic to keep interesting.  
 </p>
<p>
The book covers all major web based security issues such as XSS, XSRF, Sql Injection and also related topics such as securing IIS and issues surrounding the file system. Important concepts such as encryption, hashing and certificates are also covered in depth. The final chapters cover advanced topics such as CAS, Securing IIS and third party authentication solutions.
</p>
 <p>
So what could be better? very little the book is clear, easy to read and contains concise examples. I would have perhaps liked to see an example of implementing a custom membership provider and a bit more on client side scripting/ajax related issues but the book does a great job covering the major areas and pointing the reader towards further resources.
 </p>
  <p> 
 I liked that the book provides recipes for dealing with complex problems such as implementing certificate based authentication and implementing Open ID. Several useful tools I wasn’t aware of are also referenced. 
  </p>
   <p>
Before I began reading Barry’s book although no security expert I considered that I had a pretty good knowledge of security and was glad to see for the most part the book confirmed my understanding! It always surprises me how many web developers have so little knowledge of basic security concepts and best practice. There is no excuse now and if you have never looked into security this book should be required reading!
However don’t think that this book has nothing to offer the intermediate/advanced developer as it had many gem’s for me (correct implementation of salting passwords, certificates, ViewStateUserKey, WCF security).
 </p>
  <p>
This book is a great introduction to security and related concepts and will serve as a useful reference/cook book to more experienced developers.
 </p>

]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/BeginningASP.netsecuritybyBarryDorrans/112" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>111</id>
<published>2/6/2010 12:00:00 AM</published>
<updated>2/6/2010 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">2/6/2010 12:00:00 AM</app:edited>
<title>Agile Alliance Meetup Melbourne</title>
<content type="html"><![CDATA[
<p>
On Tuesday I attended the <a href="http://www.meetup.com/Agile-Alliance-Melbourne" target="_blank">Agile Alliance Australia - Melbourne</a> meet up. The event was held in a fancy hotel on Collins Street with free food and drink sponsored by Thoughtworks and attended by around 150 delegates. There was a mix of developers, consultants, business analysts and project managers. I believe the event was more aimed at BA's but seemed to be dominated by developers.
</p>
<p>
Keith Dodds (Thoughtworks) gave an introduction to the group and kudos to him for setting this up. I guess I was a little unclear on what the groups objectives were and think this should have been emphasised more rather than discussions of boards etc. I am a little wary of organizations (particularly in an Agile usergroup) with a hierarchy etc. I do however understand the need for this in larger organisations - especially those that have a membership fee. I found a membership page on Tuesday that I cannot find now that listed individual membership as $100 which seemed a little steep although I understand this would be deducted from price of a yearly conference ticket.
</p>
<p>
After Keiths introduction there was an excellent speech by Roy Singham on some of the work Thoughtworks had been doing with UNICEF. Whatever you may think about Roy there is no doubt he is a brilliant speaker. Roy held the crowds attention easily and it was fantastic as an amateur speaker myself to see an expert in action.
</p>

<p>
I am not sure I would agree with all the points Roy made through such as: 
<ul>
<li>
Australia is 5 years behind the UK in terms of Agile and innovation. My own experience has shown the opposite. If anything Australian developers seem more passionate. Hiring tests are also noticably more difficult. Alt dot net technologies and groups do however seem more prevalent in the UK and are promoted by some vocal individuals.

</li>
<li>
Brazil will be the next centre of innovation. Apparently Brazil developed a number of its own programming languages due to government restrictions in the past and is a very large user of Ruby. Hmm well we will see I guess but not sure these factors are going to lead to this. 
</li>
<li>
Roy seemed (over?) excited about Ruby. Yes its cool (and fashionable at the moment) but at the end of the day its just a tool and I dont think as game changing as some people would like to think.
</li>
</ul>
</p>

 <p>
  It will be interesting to see what happens with the group and it is early days. I like the idea of an agile discussion group and to hear about others experiences of what works and what doesn’t. I do think that there is a risk with this type of group that they can become vehicles for promoting individuals and organisations and very much about being seen to be doing the right thing rather than dealing with the original issues they were set up for. 
 </p>]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/AgileAllianceMeetupMelbourne/111" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>110</id>
<published>2/5/2010 12:00:00 AM</published>
<updated>2/5/2010 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">2/5/2010 12:00:00 AM</app:edited>
<title>Bye Bye Barry</title>
<content type="html"><![CDATA[<p>Just a short blog post to wish <a shape="rect" href="http://www.idunno.org" target="_blank" shape="rect">Barry Dorrans</a> all the best with his new position on the Microsoft Security team that he joins on Monday. </p>
<p>If you dont know who Barry is the chances are you have run into him or felt his influence if you have attended a UK dev community event (he is the rather vocal lanky irish chap). Barry has contributed a huge amount to the UK development community over the years, is a regular speaker, coordinated the Nxtgen Oxford group (since taken over by the very capable Richard Hopton), Security MVP, <a shape="rect" href="http://www.amazon.com/dp/0470743654?tag=barrdorr-20amp;camp=213381amp;creative=390973amp;linkCode=as4amp;creativeASIN=0470743654amp;adid=1VMHZ13K77FK6AP622CTamp;" target="_blank" shape="rect">author</a> and was fundamental in running and setting up the DDD events. Barry has also assisted me with a number of dev and community related issues. Barry was given a well deserved <a shape="rect" href="http://idunno.org/archive/2010/02/05/and-this-is-why-irsquoll-miss-the-uk-.net-community.aspx" target="_blank" shape="rect">send off</a> on DDD8. </p>
<p>So in conclusion whilst there is little doubt Barry is a bit of git, he is just probably not as much of one as he would like you to think (probably). </p>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/ByeByeBarry/110" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>109</id>
<published>1/31/2010 12:00:00 AM</published>
<updated>1/31/2010 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">1/31/2010 12:00:00 AM</app:edited>
<title>Silverlight Code Camp Review</title>
<content type="html"><![CDATA[<p>This weekend I attended the Silverlight Code Camp. Silverlight code camp is a free 2 day event held at NAB training centre in Melbourne docklands. It was great to see a large corporate such as NAB taking interest in sponsoring an event such as this and when NAB announced they were looking for more developers I certainly would be tempted if I was looking for a new position. Actions such as supporting community events such as this reflect really well on companies in my view and I like places that encourage their staff to learn and contribute. </p>
<p>The event was divided into two tracks a beginner and advanced. In practice through people switched between the tracks depending on the topics they were interested in. There were apparently 150 delegates registered for the event with another 100 or so on the waiting list which is a great achievement given the little publicity the event was given. It also bodes well for DDD Melbourne in the coming months. </p>
<p>The day began with a talk from the Development manager of a division of NAB (may not be correct job title) who had some interesting figures on NAB’s development structure and spending. Next up was an excellent key note from Scott Barnes who used to be the product manager for Silverlight. It was really interesting to hear from someone inside Microsoft of their experiences and it was a great presentation although the Mankini image is going to take a bit of repressing. </p>
<p>The next session I attended was by Brendan Forster on MEF amp; Silverlight. MEF’s a tricky thing to demo well and in my experience difficult to get across some of the benefits. I think the session would have worked better in a more intimate group where they could have explored in more detail and would have benefited from more visual examples. Brendan knew his stuff through and probably did a better job than I did when I tried to explain it. I think we both made the same mistake through of using Console applications to demonstrate some of the features. One of the best MEF presentations I have seen was by Ben Hall who demonstrated putting together an application. </p>
<p>Next up was Mahesh Krishnan’s session an intro to Blend. Mahesh did a well structured presentation and I enjoyed this hour even though I knew how to use most of these features. </p>
<p>Lunch was a nice BBQ which worked great on such a hot day with sandwiches being provided on the second day. </p>
<p>I think one of the highlights of day 1 for me was the Qamp; A panel where the inevitable should we wait for HTML 5 question was raised. This was well answered well with responses such as HTML 5 is not actually ratified yet and it will take time for the browsers to catch up. At least at the moment the conclusion seemed to be Silverlight will be the way to go for rich UI experiences which I think I would agree with. </p>
<p>After the QA session there was a lightening talk hour. This was fun and anyone could speak for up to 10 minutes. I decided to jump in with a book plug/10 min intro to VS2010 amp; .net 4. It reminded me of how much I enjoy giving talks and I look forward to my next one. </p>
<p>The next session I saw was Alex amp; Jordan Knight on Designer/Developer. This was an enjoyable session and they were both good presenters (hats off to Alex for his first presentation) and had a great demo app but not sure how much I learnt from this session. </p>
<p>The final session on day 1 was getting started with Silverlight Sketch Flow with Shane Morris. Poor old Shane had a nightmare time with a laptop when it wouldn’t display more than 640 resolution. He did incredibly well under difficult circumstances and still managed a great talk in sweltering heat for an hour. I would like to see more Shane Morris talks as he was very entertaining to listen to and I love learning more about the UX side of things. </p>
<p>Day 2 began with a presentation from Adam Cogan on Sharepoint 2010. I don’t really have any interest in Sharepoint but it was a fun and informative presentation which involved lots of audience interaction. </p>
<p>Next up was Julian Hedt’s presentation on Silverlight controls. Many of the presentations were at an overview level so it was good to see Julian delve deeper. Julian ran out of time just as he was getting onto the testing Silverlight app’s - I’d like to see more from this guy as he had a lot to show and hear more about his testing experiences. </p>
<p>After Julian, Miguel Madro presented on Silverlight security. Miguel started off really well with an interesting example showing how easy it is to modify a Silverlight App and the network traffic it sent. Miguel’s presentation seemed to petter off towards the end a bit and I think he could have made some of the points clearer e.g. never trust client input but it was a fascinating session none the less. </p>
<p>It was then lunch and I had an interesting discussion with Mahesh, Brian, Shane and Microsoft evangelist Michael on Ipad, Iphones, Windows Mobile and writing books. </p>
<p>They day ended with Stephen Dekker discussing his experiences of developing a Silverlight application for NAB. I love hearing about other applications architecture and the problems they had. The parts Stephen showed us looked as if ASP.net would have probably fulfilled the requirements but who knows what else it did and I wouldn’t turn down an opportunity for Silverlight development either! I guess now they also have some experience for more complex apps. </p>
<p>I think the following would have improved the event: </p>
<ul>
    <li>Not sure it needed to be 2 days – 2 days is a long time and most people don’t want or cannot spend a whole weekend for work type stuff. The popularity of these events however shows how enthusiastic the community is and I suspect many developers have little training from their own organisations. I have yet to meet a developer who has a company that sends them on lots of training courses and conferences (my own experience is the company will pay for a book!). I think this is a shame as suspect sales people etc benefit from many training courses during their career. </li>
    <li>I didn’t see any agenda’s being given out but maybe they were? </li>
    <li>A minor thing but think the website should have been written in plain ole' Html as it would have made it easier to read (understandable that Silverlight was used through!) </li>
    <li>Evaluation forms are really important to help speakers to improve – these should have been made more prominent, given out at beginning of each session and collected as delegates left. Delegates should also have been given pens to fill them in! </li>
    <li>The presenters all obviously knew their stuff but a few would have benefitted from structuring their presentations more and perhaps running through them a few times. A few would also benefit from feed back from organizations such as Toastmasters about body language etc. Its not that people were not good presenters its that they could be even better with a bit of criticsm on style etc. </li>
</ul>
<p>In conclusion these are minor improvements and it was a great weekend thanks to all the speakers and Stephen Dekker for organizing. </p>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/SilverlightCodeCampReview/109" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>107</id>
<published>1/19/2010 12:00:00 AM</published>
<updated>1/19/2010 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">1/19/2010 12:00:00 AM</app:edited>
<title>Introducing .net 4 with Visual Studio 2010 reviews</title>
<content type="html"><![CDATA[<p>My book recieved 3 mentions/reviews today which was nice (disclaimer I have met all of these people!). </p>
<p><a shape="rect" href="http://www.craigmurphy.com/blog/?p=1621" target="_blank" shape="rect">Craig Murphy</a> posted a review on his blog and Microsoft evangalist <a shape="rect" href="http://geekswithblogs.net/iupdateable/archive/2010/01/18/visual-studio-2010-and-.net-4-book-available-and-it.aspx" target="_blank" shape="rect">Eric Nelson</a> gave it a mention on his blog. </p>
<p>Below is a review from <a shape="rect" href="http://www.ipona.com/" target="_blank" shape="rect">Dave Sussman</a>. I was particularly interested in Dave's review and advice as he has authored many books himself. </p>
<p>Reviewing Introducing .NET 4.0 with Visual Studio 2010 by Alex Mackey (Apress) was an interesting exercise because I already know quite a lot of the material. The review therefore partly became a hunt for things I didn’t know, of which there were enough to keep me interested. There were however, sections I skipped through lightly simply because the particular topics aren’t part of my development life and therefore aren’t directly relevant. While skimming those topics though, I’ve now enough background knowledge to dig deeper should I need to, a fact that’s been made easier throughout the book by ample references to online topics, blogs, etc, where more depth or discussions could prove useful. </p>
<p>Topic relevancy is the first important point about the book, clearly stated by Alex at the beginning; this is a shallow and wide book, rather than deep and narrow, or as Alex puts is “breadth rather than depth”, which is perhaps more accurate, as shallow gives the impression the book is light on content, which it definitely isn’t. The target audience is developers using previous version of the .NET framework and Visual studio, for whom there has been little time or incentive to either work with the latest betas or read up on the new features. What’s quite bold is the restriction to the Professional edition of Visual Studio 2010, thus eliminating the advanced features which are more niche and aren’t going to be a major part of most developers’ requirements. I like this approach as it reduces the size, and therefore cost, of the book, while still keeping it relevant for the majority of the audience. </p>
<p>Alex clearly breaks down the topics, showing both the toolset and framework features, with enough code to give you an understanding, but without overwhelming you. The opening salvo is into the tool itself, discussion the changes to the editor, the technology behind it and the extensibility it brings; it’s an area that has huge potential for productivity improvements and one that will provide a rich ecosystem of tools. Alex then digs into the languages, the CLR and class libraries and support for parallelization, before breaking out into the frameworks, such as Workflow (WWF), Communication (WCF), and data (EF and WCF Data Services). Next come the UI features: ASP.NET, Ajax and jQuery, MVC, Silverlight and WPF, before finishing up on cloud services and Azure. </p>
<p>Despite the fact that Alex has limited the depth of coverage, at 450 pages there is still plenty of technical material to learn about the new features, as well as learn the basics of many of the technologies. It’s certainly a great overview and a good starting point if you wanted to trial one of the backend or UI frameworks without buying a specific book. I enjoyed it. Is it suitable for ever developer? Of course not, that’s not its purpose. Is it suitable for developers who’ve not been following the 4.0 trends? Absolutely, and I wouldn’t hesitate to recommend it to anyone who needs to get a heads up into .NET 4.0 and Visual Studio 2010. Was there anything I didn’t like? No. </p>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/Introducing.net4withVisualStudio2010reviews/107" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>108</id>
<published>1/18/2010 12:00:00 AM</published>
<updated>1/18/2010 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">1/18/2010 12:00:00 AM</app:edited>
<title>New version of ebook due end of week</title>
<content type="html"><![CDATA[As some readers may be aware there are some minor formatting and editing issues in Introducing .net 4 with Visual Studio 2010. Many of these were due to problems in the formatting/editing process at Apress and outside of my control. To their credit Apress have reacted quickly and will be releasing an updated version of the ebook towards the end of this week with anyone who has already purchased the ebook receiving the update at no cost (you will receive an email advising when this is available from Apress). The next print run will also contain the corrections and I am trying to make a free version of the ebook available for those readers that purchased the first print edition. 
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/Newversionofebookdueendofweek/108" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>106</id>
<published>1/16/2010 12:00:00 AM</published>
<updated>1/16/2010 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">1/16/2010 12:00:00 AM</app:edited>
<title>My writing experiences</title>
<content type="html"><![CDATA[<p>Some time ago I read an excellent post by Michael Foord about his experiences writing for Manning (<a shape="rect" href="http://www.voidspace.org.uk/python/articles/technical-writing.shtml" target="_blank" shape="rect">http://www.voidspace.org.uk/python/articles/technical-writing.shtml</a>). Having just finished writing Introducing .net 4 with Visual Studio 2010 I decided to share my own experiences. </p>
<p><strong>The idea!</strong> <br />
Just over a year or so ago I decided to write a book. This decision was brought about by two things: a discussion with a guy called Simon Pease who was contracting at my place of work and frustration with a few developers who kept asking me the same old questions! </p>
<p>Simon and I discussed the huge number of technologies Microsoft were bringing out and how it would be useful if there was an overview book to introduce each new technology. This would negate the need for the reader to wade through blogs, books and conference videos to find areas they were interested in. I thus proposed to write a breadth rather than depth book that would give a good introduction to .net 4 and Visual Studio 2010. </p>
<p><strong>So how do you get to write a book in the first place? </strong><br />
Well if you are well known in your industry I guess you probably get approached but for everyone else you put together a proposal. Chris Webb has some excellent <a shape="rect" href="http://ckwebb.com/category/publishing/" target="_blank" shape="rect">articles and advice</a> on this process. </p>
<p>For everyone else you put together a proposal and discuss it with the publisher. I submitted a proposal directly to Apress via their website. It was nice that Apress gave an unknown a chance to write. My original proposal was for an easy to read overview covering web based changes in VS2010 amp; .net 4. I wanted to focus on the web as that is my own experience. Apress understandably however wanted to cover a wider range of technologies so the proposal was modified to include additional areas. </p>
<p>The entire .net framework is of course huge and this makes for a much bigger proposition and one I don’t think I would attempt on my own again. As you can probably imagine covering the full .net framework was a huge amount of work. Additionally you cannot be an expert in all areas so to ensure I wasn’t writing crazy stuff I spoke to many different people who were experts in their field. <br />
<br />
* Tip - consider writing with someone else. This will reduce the workload and give you someone else to bounce ideas off </p>
<p>Once the proposal was approved, contracts were signed. It is my understanding the Apress contract is one of the least restrictive around - you can even view it on the main Apress site. <br />
<br />
I then had to write 3 chapters by Xmas 2008 for approval before the rest of the book could continue. Once these chapters were approved I then received the first payment and the book essentially got the go ahead. <br />
<br />
Most book publishers will give you an advance payment (mine was $6000 and divided into 3 parts that would be paid throughout the books development. <br />
<br />
Note the advance is an advance on final sales not in addition to! This means sales will pay off the advance before you get any more money (the publisher also holds some back in case of returned stock). Peter Cooper has a good post on how this works on his <a shape="rect" href="http://beginningruby.org/what-ive-earned-and-learned/" target="_blank" shape="rect">website</a>. <br />
<br />
* Tip - don’t be afraid to talk to other people most are very helpful and only too happy to assist. It was fantastic to get contributions and assistance from some of the Microsoft teams directly and some well known individuals in the .net community. </p>
<p>Apress said they would be able to arrange briefings with the Microsoft teams to assist my research. This however never happened and I organised it myself. I was lucky in that I had some good friends and contacts through my user group involvment. I was grateful for the assistance of Microsoft UK evangelists Mike Ormond and Eric Nelson and almost all of the Microsoft teams were very helpful in responding to queries. <br />
<br />
* Tip - you are probably going to have to do much the leg work yourself.. </p>
<p>When you are writing you will have a number of questions that you will need to discuss with your editor. Dealing with Apress in this respect was a bit frustrating. They must be pretty busy as it took days (and even weeks) to respond to some queries. When they did however the advice was helpful and they certainly have some good people working for them. However Apress even modified the title of my book several times without my approval! Their approach to source control is also “interesting..” <br />
<br />
* Tip - Dealing with (some?) publishers can be painful at times (heh they probably say the same about writers!) </p>
<p><strong>Technical Review </strong><br />
One of the highlights of working with Apress was working with my technical reviewer Stefan Turluski. I cannot recommend Stefan highly enough. Stefan was of great help, helped me improve as a developer and the book is sooo much better from his input. We have all read books that contained missing or incomplete instructions. I now appreciate how very easy it is to miss out steps when writing even the simplest bits of code so was grateful for Stefans eagle eye! <br />
<br />
* Tip - Technical Review is vital and will be your best friend! </p>
<p><strong>Beta technologies</strong> <br />
Writing about Beta technologies is difficult. There is a lack of documentation, stuff doesn’t work properly and there is a big learning curve. When you write a book you will be given probably half the time you would want to write it. At one point I was given 10 days to write a chapter – bear in mind that each chapter is roughly 5000-7000 words, you are researching new changing technologies and you can see how this can be pretty difficult. You want a social life as well as writing a book? forget it! <br />
<br />
* Tip - Books take a huge amount of time (but you probably already knew this..) </p>
<p><strong>Its a material world..</strong> <br />
Despite the lofty ambitions you may have for your book it is also a product. Remember this. You signed a contract which handed over some of your rights to the publisher. If you want full control then you will have to self publish - seriously consider this option you can probably make more money this way. <br />
<br />
I can understand why Apress launched my book when they did (first .net 4/VS2010 book) but personally feel they could have waited a bit longer and I could have added more content  (sounds a bit like pretty much any software development project you know!). <br />
<br />
If you have read my book you will probably notice the strange double brackets on some of the method names when they are quoted in text, interesting punctuation and a few typos and spelling mistakes. Apress were given a list of many of these to correct (which took me about a week to do) but decided for an some reason not make these changes. This makes me pretty mad and hopefully doesnt detract from the content too much but it does mean the book is not as polished as it could and should have been.<br />
<br />
So.. my apologies for these issues but they were out of my control. I guess different publishers have different processes. For example I understand one publisher uses four different technical reviewers to Apress's one so are likely to catch more issues. Additonally given the beta nature of the technologies and a number of similar books being produced by competitors we decided not to release an early acess edition which is a shame as the book would have benefited from others input. <br />
<br />
Tip - Your work of art is a product </p>
<p><strong>Summary </strong><br />
<br />
So good things for me: </p>
<ul>
    <li>Learnt a huge deal </li>
    <li>Developed the ability to quickly learn/research unknown technologies </li>
    <li>Improved writing abilities and learn more about publishing </li>
    <li>Got to meet, talk and work with some cool people </li>
    <li>Helped me get to speak at conferences </li>
    <li>Impress chicks - "hey im a published author" (just dont tell them its about programming say poetry or something) </li>
    <li>Looks good on CV </li>
</ul>
<p> </p>
<p>Not so good things:</p>
<ul>
    <li>Rushed copy editing and formatting jaded the final result and experience for me </li>
    <li>I didnt do much of the formatting given time constraints but understand this can be a huge pain in the ass for many writers </li>
    <li>Poor source control from publisher introduced some issues and made took time to resolve </li>
    <li>Change in direction from Microsoft e.g. Oslo meant a few chapters were dropped or merged </li>
    <li>The huge amount of time and effort taken up writing (but guess this is part of it!). At times I was exhausted working a full day then writing/editing in the evening. </li>
    <li>Money - forget it go work for burger king you will earn more for the hours! </li>
</ul>
<p> </p>
<p><strong>Conclusion</strong> <br />
A good experience on the whole that was slightly jaded towards the end. Would I do it again? Hmm certainly not for a while and I would look at self publishing next time. <br />
<br />
Thanks for reading. </p>
<p>The below image made me laugh - just 1.5 days after ebook released - a compliment of sorts and if more people read it and benefit all the better I guess (cheap skates!): <br />
<br />
<img alt="Book torrents" src="http://www.simpleisbest.co.uk/content/images/torrent.jpg" complete="complete" complete="complete" /> </p>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/Mywritingexperiences/106" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>105</id>
<published>1/15/2010 12:00:00 AM</published>
<updated>1/15/2010 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">1/15/2010 12:00:00 AM</app:edited>
<title>Book released</title>
<content type="html"><![CDATA[After over 12 months work Introducing .net 4.0 with Visual Studio 2010 is available. I believe you can purchase the print edition in the US as of today with the UK shortly after. The book has also been in ebook format for the last few days on the <a shape="rect" href="http://apress.com/book/view/143022455x" target="_blank" shape="rect">Apress site</a>. Writing this and working with Apress has been a mixed experience - some very good experiences and some not so great! <br />
<br />
I believe this is the 1st book on VS2010 and .net 4 (a double edged sword). I have noticed and been made aware of a number of minor issues with some of the text editing amp; formatting which is frustrating as much of this is outside of my control. Apologies for these issues and we will aim to correct this asap. Hopefully this doesnt detract too much from the content and I hope the book will serve as a good introduction to .net 4 amp; VS2010. 
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/Bookreleased/105" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>104</id>
<published>1/7/2010 12:00:00 AM</published>
<updated>1/7/2010 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">1/7/2010 12:00:00 AM</app:edited>
<title>Devevening User group Melbourne</title>
<content type="html"><![CDATA[I am pleased to announce Dev Evening - Melbourne! <br />
<br />
Dev Evening is a free to attend .net user group held in a seperate room at the back of the Nash Hotel in Richmond. <br />
<br />
This is the second DevEvening group as prior to this I established and ran Devevening in the UK for just under 2 years. A typical DevEvening involves a .net related topic (related and alt type topics are also welcome) followed by food and then another topic. Presentations are given by a mix of members and professional speakers. We find the pub atmosphere (and beer!) was ideal for encouraging discussion!<br />
<br />
For more details and to register for our next event on the 28th of Jan (.net 4 parallel and T4) please refer to:<br />
<a shape="rect" href="http://www.deveve.net" target="_blank" shape="rect">http://www.deveve.net</a><br />
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/DeveveningUsergroupMelbourne/104" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>103</id>
<published>1/3/2010 12:00:00 AM</published>
<updated>1/3/2010 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">1/3/2010 12:00:00 AM</app:edited>
<title>.net 4 Visual Studio 2010 book</title>
<content type="html"><![CDATA[A short cartoon illustrating whats different about my Introducing .net 4 with VS2010 book.

<br/>
<br/>

<img alt="book cartoon" src="http://www.simpleisbest.co.uk/content/images/bookCartoon.jpg" />]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/.net4VisualStudio2010book/103" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>102</id>
<published>1/2/2010 12:00:00 AM</published>
<updated>1/2/2010 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">1/2/2010 12:00:00 AM</app:edited>
<title>2010 plans</title>
<content type="html"><![CDATA[Well I am pretty much done with the book now and final corrections went off on Friday. I will write a blog post shortly about my experiences as I have a few tips for others and want to share some of my experiences. Writing a book takes a huge amount of time so when its done it leaves a bit of void! <br />
This coming year I want to do the following development-wise: <br />
<br />
<strong>Learn a new language such as Python or Ruby</strong><br />
Apart from a brief introduction to C++ and Java at university my career has been pretty Microsoft centric. I think I want to look at a language such as Python or Ruby to make me a more rounded developer. I am quite interested in some of the functional languages and have played a bit with F# but can’t think of anything I would really use them for at the moment. Scripting languages however could be pretty useful. Part of the problem with learning a new language is obviously using it enough to become familiar with it so am going to need to find some problems to address! <br />
<br />
<strong>Read some more books!</strong><br />
I love books and read a huge amount. I think apart from rent and food its probably my biggest monthly expense! I am looking forward to reading Barry Dorrans new <a shape="rect" href="http://www.amazon.co.uk/Beginning-ASP-NET-Security-Barry-Dorrans/dp/0470743654/ref=sr_1_1?ie=UTF8amp;s=booksamp;qid=1262392353amp;sr=1-1”" target="”_blank”" shape="rect">Introducing ASP.net security</a> book and Ben Halls <a shape="rect" href="http://www.amazon.co.uk/Testing-ASP-NET-Applications-Wrox-Programmer/dp/0470496649/ref=sr_1_1?ie=UTF8amp;s=booksamp;qid=1262392312amp;sr=8-1”" target="”_blank”" shape="rect">Testing ASP.net applications</a>. Other books that have been recommended to me are Refactoring and Clean code. <br />
<br />
<strong>Get a really deep understanding of threading</strong><br />
The majority of my work is web development and it’s pretty rare that I have to do any work with threads directly. Writing the parallelization chapter forced me to look into this area in more detail and it’s certainly something I want and need to understand to a deeper level. I think I might put together an introduction to Parallelization in VS2010 talk as well. <br />
<br />
<strong>Dev Community</strong><br />
Well DDD Melbourne will be happening in early June and we have a planning session this coming week to start to firm up a few details. I also intend on setting up Devevening Australia. A collegue at work David Millington has suggested a venue. Devevening will have a different format to groups such as Victoria .net One of the best things about Devevening in the UK was the interaction which was facilitated by it taking place in a pub! I also miss some of the alt .net events which had some interesting discussion so maybe can bring that kind of angle in as well. <br />
<br />
All the best in 2010 
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/2010plans/102" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>101</id>
<published>1/1/2010 12:00:00 AM</published>
<updated>1/1/2010 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">1/1/2010 12:00:00 AM</app:edited>
<title>Do you really need that layer of abstraction</title>
<content type="html"><![CDATA[Do you really need that layer of abstraction? Dont get me wrong abstraction and techniques such as dependency injection are essential techniques in any programmers toolbox and can make for much more flexible and easy to maintain code. <br />
<br />
Sometimes however abstraction can be taken to ridiculous levels resulting in over engineered, hard to understand and difficult to debug code. <br />
<br />
This seems to be an increasing trend probably partly fuelled by the increasing popularity of unit testing, MVC based approaches and some open source projects written by some very clever people. <br />
<br />
I have recently seen code with four or five levels of inheritance (and this is for a really quite simple system), interfaces implementing multiple interfaces which in turn implement other interfaces IObject type stuff aggraahh! <br />
<br />
Often such techniques are implemented in order to be able to unit test their code, separate concerns or to develop architectures such as MVVM. Admirable aims.. however the modification of code to support this way of working can result in code that is tricky for experienced developers to understand let alone newbie’s that may be maintaining your code. Current IDE’s also offer limited support for working with these techniques. E.g. debugging dependency and IOC containers can be a painful process. <br />
<br />
Of course I am not suggesting that you should stick to writing just simple code but making code easy for others to understand is normally pretty important.  <br />
<br />
The addition of complexity also has the potential to result in more mistakes so ironically refactoring simple classes to be unit testable could actually result in more mistakes. <br />
<br />
I am not against unit testing, far from it but some problems or stories can be very difficult if not impossible to unit test without introducing so much complexity I question whether it is worth doing at all.<br />
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/Doyoureallyneedthatlayerofabstraction/101" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>98</id>
<published>12/3/2009 12:00:00 AM</published>
<updated>12/3/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">12/3/2009 12:00:00 AM</app:edited>
<title>Whats new in .net 4 and VS2010</title>
<content type="html"><![CDATA[I haven't had much time to blog lately as have been flat out writing <a shape="rect" href="http://apress.com/book/view/143022455x" shape="rect">Introducing .NET 4.0: with Visual Studio 2010</a> for Apress. This is a bredth rather than depth overveiw of every thats new in .net 4 and VS2010 with the aim of producing something that can be easily read in a few weekends. I have some great excerpts and mini interviews with some well known industry experts. Well I am nearing the end of this now and am really pleased with the product and the huge amount of information I have crammed into the book. This book has been over a years worth of work (and boy is writing hard) so I am looking forward to it being published now. Once the book is out the way I then look forward to focusing on some key areas and organizing DDD Melbourne for June 2010.
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/Whatsnewin.net4andVS2010/98" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>99</id>
<published>12/1/2009 12:00:00 AM</published>
<updated>12/1/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">12/1/2009 12:00:00 AM</app:edited>
<title>Garbage collection</title>
<content type="html"><![CDATA[<p>Garbage collection is something you rarely have to worry about in our nice managed world so before we look at what has changed in .net 4 let’s quickly recap on how GC currently works to put the new changes in context. </p>
<p>
<strong>Garbage Collection prior to .net 4</strong>
</p>
<p>As you probably know the CLR allocates memory for your applications as they require it and assumes an infinite amount of memory is available (we wish). This is of course a mad assumption so a process called the Garbage collector (GC) is needed in order to clean up unused resources. </p>
<p>The GC keeps an eye on available memory resources and will perform a cleanup in 3 situations: a threshold is exceeded, the user specifically calls the garbage collector or a low system memory condition occurs. </p>
<p>To make this as efficient as possible the GC divides items to be collected into “generations”. When an item is first created it is considered a generation 0 item (gen 0) and if it survives subsequent collections (e.g. it is still in use) then it is promoted to a later generation - generation 1 and later generation 2. </p>
<p>This division allows the garbage collector to be more efficient in the removal and reallocation of memory. For example generation 0 items mainly consist of instance variables that can be quickly removed (freeing resources earlier) whilst the older generations contain objects such as global variables that will probably stick around for the life time of your application. On the whole the GC works very well and saves us writing lots of tedious clean up code to release memory. </p>
<p>The GC operates in a number of modes: Workstation, Concurrent workstation (default for multi-core machines) and Server. These modes are optimized for different scenarios. For example workstation is the default mode and optimized for ensuring your applications have a quick response time (important for UI based applications) whilst server mode is optimized for throughput of work (generally more important for server type applications). Server mode does however have the disadvantage that it pauses all other managed threads during a garbage collection. If Server mode was used for a Windows forms application this collection could manifest itself as intermittent pauses which would be very annoying. </p>

<p><strong>Garbage Collection in .net 4</strong></p>
<p>So what’s changed then? <br />
Prior to .net 4 a Concurrent Workstation GC could do most but not all of a generation 0 and 1 collection at the same time as a generation 2 collection. The GC was also unable to start another collection when it was in the middle of a collection which meant that only memory in the current segment could be reallocated. In .net 4 however Concurrent Workstation GC collection is replaced by background garbage collection. The simple explanation (and GC gets very complex) is that background garbage collection allows another GC (gen 0amp;1) to start at the same time as an existing full GC (gen 0,1 and 2) is running reducing the time full garbage collections take. This means that resources are freed earlier and that a new memory segment could be created for allocation if the current segment is full up. </p>
<p>Background collection is not something you have to worry about – it just happens and will make your applications perform quicker and be more efficient so yet another good reason to upgrade your existing applications to .net 4. It is important to note that background collection is not available in Server mode GC although the CLR team has stated they are aiming to achieve this in the next version of the framework. </p>
<p>The GC team have also done work to ensure garbage collection works effectively on up to 128 core machines and improved GC ‘s efficiency reducing the time needed to suspend managed threads </p>
<p>For more information and a detailed interview with the GC team please refer to: <br />
http://blogs.msdn.com/ukadc/archive/2009/10/13/background-and-foreground-gc-in-net-4.aspx <br />
http://channel9.msdn.com/shows/Going+Deep/Maoni-Stephens-and-Andrew-Pardoe-CLR-4-Inside-Background-GC/ </p>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/Garbagecollection/99" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>100</id>
<published>11/19/2009 12:00:00 AM</published>
<updated>11/19/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">11/19/2009 12:00:00 AM</app:edited>
<title>CorruptedStateExceptions</title>
<content type="html"><![CDATA[<p>Many developers (ok I may have done this too) have written code such as the following: </p>
<p>
try <br/>

{ <br/>

// do something that may fail <br/>

} <br/>

catch(System.exception e) <br/>

{ <br/>

.. <br/>

} <br/>
 <br/>
</p>
<p>

As we all know this is almost always a very naughty way to write code as all exceptions will be hidden. Hiding exceptions you don’t know about is rarely a good thing. Additionally there are some exceptions that should never be caught (even by lazy developers) such as low down beardy stuff like access violations and calls to illegal instructions. These exceptions are potentially so dangerous that you it’s best to just shut down the application as quick as possible to prevent further damage.
So in .net 4 corrupted state exceptions will never be caught even if you specify a try catch block like above. 
However if you do want to enable the catching of corrupted state exceptions application wide (e.g. to route them to an error logging class) then you can add the following setting in your applications configuration file:
</p>
<p>
LegacyCorruptedStateExceptionsPolicy=true
</p>
<p>
This behavior can also be enabled on individual methods with the following attribute: <br/>
[HandleProcessCorruptedStateExceptions]
</p>]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/CorruptedStateExceptions/100" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>97</id>
<published>10/21/2009 12:00:00 AM</published>
<updated>10/21/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">10/21/2009 12:00:00 AM</app:edited>
<title>Visual Studio 2010 beta 2</title>
<content type="html"><![CDATA[VS2010 beta 2 was released to MSDN subscribers on Monday with everyone else getting to download it today. You can download it from <a shape="rect" href=" http://www.microsoft.com/visualstudio/en-gb/try/default.mspx#download" shape="rect">here</a>. As its a beta I would strongly recommend you install on a virtual machine however saying that I installed it on my laptop alongside VS2008 with no issues. <br />
<br />
I did however have three issues installing it:
</p>
<ul>
    <li>CRootComponent::Install(): Cannot install; setup files failed verification - solved by downloading ISO again so must have been corrupt grrr </li>
    <li>Silverlight 3 failed to install - uninstalling the existing Silverlight 3 SDK seemed to resolve this </li>
    <li>Visual SVN tried to load in VS2010 but failed - simply disable it </li>
</ul>
<p>Early impressions are very promising and it is much much quicker than previous preview versions. Beta 2 also has a go live licence so feel free to use it to develop your applications. As per usual Microsoft have played around with release editions. VS2010 is available in Express, Professional, Premium and Ultimate editions (details to follow as I look into this). You will have to wait until March 22nd for the final release. </p>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/VisualStudio2010beta2/97" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>96</id>
<published>10/14/2009 12:00:00 AM</published>
<updated>10/14/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">10/14/2009 12:00:00 AM</app:edited>
<title>IDE Presentation Victoria Usergroup</title>
<content type="html"><![CDATA[Nice to meet people at the Victorian .net user group last night. Hope you enjoyed the presentation - answers to questions and links from last nights talk: <br />
<br />
<strong>Does VB.net have C#'s refactoring functionality in VS2010?</strong><br />
As of Beta 1 the answer appears to be no. <br />
<br />
<strong>Does MEF have inbuilt xml configuration?</strong><br />
For what purpose? I assume the questioner is thinking of using config files in a manner similar to an IOC container such as Windsor does (sorry should have checked)? To my knowledge MEF has no built in XML configuration although the source code is available for you to make any customizations you may want to. I would question what you wanted to do with these configuration files. <br />
<br />
Slides from last nights talk:<br />
<a shape="rect" href="http://www.simpleisbest.co.uk/content/downloads/ide.pptx" shape="rect">Powepoint slides</a> <br />
<br />
Links mentioned in talk:<br />
<a shape="rect" href="http://www.danielmoth.com/Blog/2009/08/parallel-tasks-and-parallel-stacks.html" shape="rect">Parallel debugging in VS2010</a> <br />
<a shape="rect" href="http://blogs.msdn.com/ricom/archive/2009/06/10/visual-studio-why-is-there-no-64-bit-version.aspx" shape="rect">Why there is no 64 bit version of Visual Studio</a><br />
<a shape="rect" href="http://ayende.com/Blog/archive/2008/09/25/the-managed-extensibility-framework.aspx" shape="rect">MEF is not an IOC container<br />
</a><a shape="rect" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=d197feb6-ced5-40d4-949d-a51f02309ee8amp;displaylang=en" shape="rect">Visual Studio SDK<br />
</a><a shape="rect" href="http://channel9.msdn.com/posts/matthijs/Scott-Guthrie-Visual-Studio-2010-and-NET-Framework-40/" shape="rect">Most recent Scott Gu presentation on IDE<br />
<br />
</a>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/IDEPresentationVictoriaUsergroup/96" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>95</id>
<published>10/11/2009 12:00:00 AM</published>
<updated>10/11/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">10/11/2009 12:00:00 AM</app:edited>
<title>Victoria .net usergroup</title>
<content type="html"><![CDATA[I will be speaking at the <a shape="rect" href="http://www.victoriadotnet.com.au/" target="_blank" shape="rect">Victoria.net usergroup</a> on Tue 13th Oct. I will be speaking about VS2010 IDE changes along with Brian Noyes who will be discussing building composite WPF and Silverlight applications. Hope to see you there! 
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/Victoria.netusergroup/95" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>94</id>
<published>10/6/2009 12:00:00 AM</published>
<updated>10/6/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">10/6/2009 12:00:00 AM</app:edited>
<title>Multitouch and Microsoft</title>
<content type="html"><![CDATA[Interesting video on Microsofts experiments with multi touch mice:<br />
<a shape="rect" href="http://mashable.com/2009/10/06/microsofts-multitouch-mice/" shape="rect">http://mashable.com/2009/10/06/microsofts-multitouch-mice/</a><br />
<br />
As some of you may know Windows 7 and WPF 4 contain support for multitouch which is great news although I am not sure the hardware is really available to make use of this yet! <br />
<br />
At the time of writing there are very limited options available (although I did find a <a shape="rect" href=" http://blog.wpfwonderland.com/2009/06/29/developing-win-7-multi-touch-apps-without-multi-touch-screen/" target="_blank" shape="rect">hack</a> developed to simulate multitouch with two mice): Dell have a tablet laptop (Latitude XT) and HP a desktop. I also found press releases of multitouch monitor from Albatron but this doesnt seem available to buy yet. <br />
Is a cheap option available yet?
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/MultitouchandMicrosoft/94" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>93</id>
<published>10/3/2009 12:00:00 AM</published>
<updated>10/3/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">10/3/2009 12:00:00 AM</app:edited>
<title>MVP award</title>
<content type="html"><![CDATA[I was very pleased to be awarded an <a shape="rect" href="https://mvp.support.microsoft.com/profile=ACCD6C05-EAFD-4254-B44A-84FEF9E8BD37" shape="rect" target="_blank">MVP</a> a few days ago. <br />
<br />
I have been very active in the dev community the last year speaking at a number of conferences amp; user groups and researching my upcoming book on VS2010 and .net 4. The last year has seen DevEvening double in size and become a popular user group. We have had some great well known speakers such as Jon Skeet, Barry Dorrans, Sebastian Lambla, Mike Ormond, Craig Murphy, Liam Westley, Ray Booysen and also had some good talks from new speakers such as Andy Pike, Stuart Lodge and Alan Broun. It was with some sadness I handed the running of DevEvening over to the very capable Matt Lacey upon moving to Melbourne. <br />
<br />
I firmly believe that one of the best ways to improve as a dev is to get involved in a community or perhaps an open source project. This will challenge existing beliefs you may have and show you new ways of doing things. <br />
<br />
Next week I am presenting on the VS2010 IDE for the Victoria .net user group and I look forward to meeting some more of the local devs. Melbourne is a fantastic city but doesnt have the variety of the UK in terms of user groups and conferences (or I havent found them yet!). In the UK pretty much every week there was an event or meeting of some description going on so I look forward to contributing to this. <br />
<br />
I would encourage anyone to get involved with the community it will give you so much more back. 
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/MVPaward/93" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>92</id>
<published>9/21/2009 12:00:00 AM</published>
<updated>9/21/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">9/21/2009 12:00:00 AM</app:edited>
<title>Tuple</title>
<content type="html"><![CDATA[A Tuple is a “type safe reference type collection of fixed size”.  </br>
Tuples were introduced for interoperability with F# and IronPython but can also make your code more concise. </br>

Tuples are declared with the following syntax:</br>

Tuple<int, int, int, int, int> MultiplesOfTwo = Tuple.Create(2, 4, 6, 8, 10);</br>
</br>


Individual items in the Tuple can then be queried with the Item property e.g.</br>

Console.WriteLine(MultiplesOfTwo.Item2);</br>
</br>


Tuples may contain up to 7 elements but if you want to add more items than this then you need to pass in another Tuple to the Rest parameter e.g.:</br>

Tuple<int, int, int> MultiplesOfThree = Tuple.Create(3, 6, 9);</br>
Tuple<int, int, int, int, int, int, int, Tuple<int, int, int>> MultiplesOfTwo = Tuple.Create(2, 4, 6, 8, 10, 12, 14, MultiplesOfThree);</br>
</br>


Items in the second Tuple can then be accessed by querying the Rest property:</br>

Console.WriteLine(MultiplesOfTwo.Rest.Item1);
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/Tuple/92" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>90</id>
<published>9/20/2009 12:00:00 AM</published>
<updated>9/20/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">9/20/2009 12:00:00 AM</app:edited>
<title>Melbourne .net Conference (DDD Melbourne)</title>
<content type="html"><![CDATA[<p>In the UK a number of my friends and colleagues ran a series of events called DeveloperDeveloperDeveloper Day (abbreviated to DDD!)  (<a shape="rect" href="http://www.developerdeveloperdeveloper.com/" shape="rect">http://www.developerdeveloperdeveloper.com/</a>). </p>
<p>DDD events are free to attend and were supported by Microsoft UK and sponsors such as Camtasia and DevExpress who provided a venue and refreshments. </p>
<p>In a DDD event the agenda is created by delegates - anyone can submit a conference session (as long as it is Microsoft or development focussed) but the actual agenda is then voted for by attendees. DDD events were very successful in the UK and the highlight of the conference calendar. Events were nearly always booked out with 200+ delegates.  <br />
<br />
I am currently looking to hold DeveloperDeveloperDeveloper Melbourne event some time in the future - watch this space! </p>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/Melbourne.netConference(DDDMelbourne)/90" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>91</id>
<published>9/20/2009 12:00:00 AM</published>
<updated>9/20/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">9/20/2009 12:00:00 AM</app:edited>
<title>BigInteger</title>
<content type="html"><![CDATA[Working with really big numbers in .net can get a bit strange, try the below example (without advanced options such as overflow checking) and  you may be surprised at the result you get*: </br>
</br>
int a = 2000000000;</br>
Console.WriteLine(a * 2);</br>
Console.ReadKey();</br>
</br>
Running this code will give you the following answer:</br>
-294967296</br>
</br>
*Note VB.net wont even let you compile the equivalent </br>
</br>
This issue occurs due to how numbers are calculated in binary. To avoid such issues .net 4 introduces the BigInteger class. BigInterger is contained in the System.Numerics namespace and is an immutable type with a default value of 0. </br>
BigInteger has no upper or lower bounds  - subject of course to available memory (if exceeded an out of memory exception will be thrown).
</br>
BigInteger’s can be initialized in two main ways:</br></br>

BigInteger bigIntFromDouble = new BigInteger(4564564564542332);</br>
BigInteger assignedFromDouble = (BigInteger) 1790324456645;</br>
</br>
You can assign decimal and floating point numbers to a BigInteger by casting or converting the values:</br>
BigInteger assignedFromDouble = (BigInteger) 179032.6541;</br>
</br>
BigInteger has a number of useful methods not found in other integer types:
<ul>
<li>	Abs (returns absolute value) </li>
<li>	DivRem (returns quotient and reminder of division) </li>
<li>	GreatestCommonDivsor (largest common divisior of two BigIntegers </li>
<li>	Pow (returns power of number) </li>
</ul>]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/BigInteger/91" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>89</id>
<published>9/11/2009 12:00:00 AM</published>
<updated>9/11/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">9/11/2009 12:00:00 AM</app:edited>
<title>Code Contracts</title>
<content type="html"><![CDATA[<p>Code contracts are a method for expressing constrains and assumptions within your code and are part of Microsoft’s ongoing research project Spec#. Code contracts originated in the Eiffel programming language and Spec#’s developers say they have been influenced by Eiffel, JML and Asml. Code contracts allow the specification of complex rules that can be validated at both compile* and runtime. In addition to validation purposes code contracts can also assist with code documentation. <br />
<br />
* Compile time or static verification is only available in the TFS edition of Visual Studio. This is a real shame as will probably prevent wide spread adoption of this great technology please vote about this on Connect: <a shape="rect" href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=481327" target="_blank" shape="rect">http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=481327</a></p>
<p><strong>Hello Code Contracts</strong> </p>
<p>To ensure values are not null you have probably written code similar to the following many times: <br />
<br />
Public function myFunction(string input)<br />
{<br />
If(input==null)<br />
{<br />
throw new System.NullReferenceException(“Input cannot be null”);<br />
}<br />
}<br />
Or perhaps you utilized the Trace/Assert statement:<br />
<br />
Trace.Assert(input!=null)<br />
<br />
Code contracts are superior to the above methods for the following reasons: </p>
<ul>
    <li>They allow the creation of more complex rules </li>
    <li>Can be validated at both compile and run time </li>
    <li>Are easier to read </li>
    <li>Can be used by automated tools such as PEX </li>
    <li>Unlike debug statement are utilized in both debug and release builds </li>
</ul>
<p>Let’s now create a simple code contract to ensure that an input value is not null or equal to five.<br />
<br />
Create a new console application<br />
Add the following using directive:<br />
using System.Diagnostics.Contracts;<br />
<br />
Now add the following code<br />
<br />
static void Main(string[] args)<br />
{<br />
DoSomething(5); <br />
}<br />
<br />
public static void DoSomething(int? Input)<br />
{<br />
Contract.Assert(Input != null);<br />
Contract.Assert(Input != 5)<br />
} <br />
Note how the code compiles but when run you will receive an error message.<br />
<br />
Hang on don’t code contracts get validated at compile time?<br />
<strong><br />
Enabling code contract static verification (TFS edition only)</strong> <br />
To enable static go into the project properties, select the code analysis tab then ensure that the “perform static contact checking” check box is checked. You may question why this option is not enabled by default. One possible reason is that if you are writing unit tests then you may want to pass null values into your methods and check your code handles them correctly. If static verification was always “on” then you could run your unit tests! <br />
<br />
<strong>Architecture</strong><br />
Behind the scenes code contracts interacts and rewrites the generated IL of your application. At a high level we can divide code contract functionality into 3 main components:</p>
<ul>
    <li>Static methods (express assumptions amp; constraints) – we will look at this shortly </li>
    <li>Binary rewriter (used to perform run time checks as some assumption IL must be rewritten) </li>
    <li>Static checker (verifies assumptions that have been made at compile time) </li>
</ul>
<p>Let’s now look at how we declare assumptions in our code using code contracts static methods.<br />
<br />
<strong>Conditions</strong> <br />
Code Contracts allows you to create 3 types of conditions:</p>
<ul>
    <li>Preconditions </li>
    <li>Postconditions </li>
    <li>Invariants </li>
</ul>
<p>Below I have listed some of the conditions you may want to utilize (this is by no means an exhaustive list):<br />
<br />
<strong>Preconditions</strong><br />
Preconditions are a type of condition that must be true at the entry of a method for it to be executed. <br />
<br />
Contract.Requires<br />
Ensure the condition is true before the code is processed.<br />
The following will ensure the input parameter is not null<br />
Contract.Requires(input != null);<br />
<br />
Contract.RequiresAlways<br />
When an assumption is declared using the RequiresAlways method it will be verified even if code contract static checks are not set to run. The following ensures that the input parameter is not null.<br />
Contract.RequiresAlways(input != null);<br />
<br />
Contract.EndContractBlock<br />
Contract.EndContractBlock statement tells the compiler to treat code as a precondition and allows you to utilize legacy code without converting it to code contracts format.<br />
if (input==null) throw new System.NullReferenceException(“input is null”);<br />
Contract.EndContractBlock();<br />
Note you cannot use EndContractBlock in conjunction with any other preconditions.<br />
<br />
<strong>Post conditions</strong><br />
Post conditions are conditions that are true at the exit of your method calls.<br />
<br />
Contract.Ensures<br />
Ensures a condition is true on exit of method:<br />
Contract.Ensures(MyValue != 7);<br />
<br />
Contract.EnsuresOnThrow<br />
Use to ensure a specific exception type is thrown for a condition<br />
Contract.EnsuresOnThrow<ioexception />(MyValue != null);<br />
<br />
Contract.forall(cart, s=gt; s!=i))<br />
Allows the iteration through a set to ensure all members meet a specific condition:<br />
Contract.forall(MySet, i=gt; i!=null));<br />
<br />
<strong>Object Invariants</strong><br />
Object invariants allow you to specify conditions that must always be true for an object and are created by decorating a procedure with the [ContractInvariantMethod] attribute. The following code ensures that the ImportantData variable can never be null:<br />
[ContractInvariantMethod]<br />
void MyInvariant() {<br />
Contract.Invariant(ImportantData !=null);<br />
} <br />
<br />
<strong>Code contract Values</strong><br />
Code contracts offer some useful pseudo variables that can be useful when creating conditions.<br />
<br />
Contract.Result<br />
Contract.Result accesses a value in a condition that will be returned from a function without referring to it directly:<br />
Contract.Ensures(Contract.Result<int32 />() gt;= -1);<br />
<br />
Contract.OldValue<br />
Contract.OldValue represents the values state is at the start of the method call. OldValue performs a shallow copy of the specified variable and could be used to check if a value has changed:<br />
CodeContract.Ensures(MyValue != CodeContract.OldValue(MyValue)); </p>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/CodeContracts/89" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>88</id>
<published>9/4/2009 12:00:00 AM</published>
<updated>9/4/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">9/4/2009 12:00:00 AM</app:edited>
<title>Bye bye UK</title>
<content type="html"><![CDATA[On Monday I will be emigrating to Melbourne, Australia. <br />
<br />
Looking forward to the experience (apart from the very long flight!) and getting involved with Melbourne's dev community. <br />
<br />
To all my UK friends, keep in touch and all the best.
<br />
<br />
<img src="http://www.simpleisbest.co.uk/content/images/melbourne.jpg" />
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/ByebyeUK/88" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>87</id>
<published>8/30/2009 12:00:00 AM</published>
<updated>8/30/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">8/30/2009 12:00:00 AM</app:edited>
<title>Future .net job trends</title>
<content type="html"><![CDATA[As part of my book research I thought it would be interesting to speak to an employment agent about what are the hot .net related skills to have. I spoke to Jonathan Keen head of search practice at UK recruitment agency Cognitive group (<a shape="rect" href="http://www.cognitive-group.co.uk" target="_blank" shape="rect">cognitive-group.co.uk</a>) about current trends in the .net sphere and he had the following to say:<br />
<br />
• Generally companies are cutting back on new projects so seeing less development roles in general<br />
• Most popular and highest paid skills at time of writing (Aug 2009) in London are Sharepoint, Dynamics AX and Dynamics CRM <br />
• Many roles focusing on integration with existing applications such as Sharepoint amp; Dynamics suite<br />
• More competition for job roles places increasing importance on distinguishing yourself. Prove your passion for development (get out here to conferences, user groups and blogging) (Buying Apress books about new releases of .net ;) – AM)<br />
• C#, ASP.net, SQL Server remain core skills companies are looking for<br />
• Interest in “Agile” skills and SCRUM but rare interest in TDD approaches<br />
• Increasingly WCF and WPF skills expected <br />
• Many public sector projects still using .net 1.1<br />
• A noticeable shift in job opportunities from desktop to web<br />
• Silverlight and MVC still rare (note many developers I spoke to felt that Silverlight would be the hot area to be in and there is certainly evidence of very high contract salaries particularly in the financial sphere)<br />
• MVC has been used as hook to interest developers <br />
• Biztalk has decreased drastically in popularity<br />
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/Future.netjobtrends/87" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>86</id>
<published>8/14/2009 12:00:00 AM</published>
<updated>8/14/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">8/14/2009 12:00:00 AM</app:edited>
<title>Talking at Epicenter Dublin</title>
<content type="html"><![CDATA[I will be talking at <a shape="rect" href="http://epicenter.ie/index.html" target="_blank" shape="rect">Epicenter 2009</a> (Dublin, Fri 28th of Aug at 11:45) hope to see you there!<br />
<br />
Below is the session I will be doing:<br />
<br />
<strong>Visual Studio 2010 - IDE and ASP.net changes</strong><br />
These are exciting times to be a .net developer and this release of Visual Studio and the framework will bring a bewildering number of changes. When something big like Visual Studio 2010 is released I believe developers need and want an overview of what’s out there. Most of us have been developing long enough now that we just need a lead in to a new technology and can explore in further detail ourselves. We don’t need to read an entire 600 page book to begin benefiting from new technologies. <br />
<br />
In this hour long presentation we will be getting you up to speed on what's new in VS2010 IDE and ASP.net. We will take a look at some of the great new productivity enhancements and how to create your own add ins. This demo based presentation will give you practical knowledge that will stand you in good stead for the release of Visual Studio 2010. 
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/TalkingatEpicenterDublin/86" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>85</id>
<published>6/30/2009 12:00:00 AM</published>
<updated>6/30/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">6/30/2009 12:00:00 AM</app:edited>
<title>Working with Tasks in VS2010</title>
<content type="html"><![CDATA[<p>Task is a new class in .net 4 that is used to perform work in parallel. The Task Parallel Library (TPL) provides methods to create, schedule and synchronize tasks. Let's take a look at this functionality now.<br />
<br />
<strong>How do tasks get scheduled?</strong><br />
<br />
1. When Tasks are created they are added to a global task queue<br />
2. The task manager will by default create “worker” threads equal to the number of processors/cores on the machine<br />
3. Each worker thread then picks up tasks from the global queue and will move it onto its local queue for execution<br />
4. Each worker thread will then process the tasks on its queue <br />
5. If a thread finishes all the work in its local queue it will steal tasks (Task Stealing) from other queues to ensure work is processed as quick as possible.  Note that tasks will steal work from the end of other task's queues to minimize the chance that the task is cached already.<br />
 <br />
<strong>Creating a new task<br />
</strong>Tasks are very easy to schedule and I think more intuitive to work with than traditional threading classes. <br />
<br />
There are a couple of ways to create a new task but before we see these we need to add the following using directive as all the task functionality is found in the System.Threading.Tasks namespace:</p>
<p>Using System.Threading.Tasks;<br />
<br />
One way to create a new Task is with the Task.Factory.StartNew method. This method accepts an Action delegate and immediately starts a task. </p>
<p>Task task1 = Task.Factory.StartNew(() =gt; StockService.CallSomeLongRunningService(Stocks[0]));<br />
<br />
Another way you can start a task is to pass the code you want run into the Task’s constructor. The main difference here is that we have to explicitly start the Task when using this method. This could be useful for scenarios where you don’t want the task to start running straight away:<br />
<br />
Task task2 = new Task(<br />
 delegate<br />
 {<br />
     StockService.CallSomeLongRunningService(Stocks[0]);<br />
 }<br />
 );</p>
<p>task1.Start();<br />
Console.ReadKey();</p>
<p><strong>Task.Wait amp; Task.WaitAll<br />
</strong>Task.Wait and Task.WaitAll allow you to pause the flow of execution until the tasks you specify have completed. For example when running the above code you may find the main program exits before the StockService has completed its work and output the results to the screen. <br />
<br />
Below shows an example of using the Wait method to ensure task1 has completed and the WaitAll method to ensure tasks2,3 and 4 have finished:<br />
<br />
Task task1 = new Task(delegate { StockService.CallSomeLongRunningService(Stocks[0]);});<br />
Task task2 = new Task(delegate { StockService.CallSomeLongRunningService(Stocks[1]); });<br />
Task task3 = new Task(delegate { StockService.CallSomeLongRunningService(Stocks[2]); });<br />
Task task4 = new Task(delegate { StockService.CallSomeLongRunningService(Stocks[3]); });</p>
<p>task1.Start();<br />
task2.Start();<br />
task3.Start();<br />
task4.Start();</p>
<p>task1.Wait();<br />
Task.WaitAll(task2, task3, task4);</p>
<p>Console.ReadKey();</p>
<p><strong>Task.WaitAny<br />
</strong>You can also wait for the results of any task to complete with Task.WaitAny – perhaps you would use this if many Tasks are retrieving the same data from different sources:<br />
<br />
Task.WaitAny(task2, task3, task4);<br />
<br />
<strong>IsCompleted<br />
</strong>You can also check if a task is completed by querying the IsCompleted property. This will return a boolean value indicating if the task has completed its work.<br />
<br />
while (task1.IsCompleted == false)<br />
{<br />
 Console.WriteLine("Waiting on task 1");<br />
}</p>
<p><strong>ContinueWith<br />
</strong>It is often necessary to specify work should be performed in a specific order . This can be declared in a fluent like manner with the ContinueWith method: </p>
<p>Task task3 = Task.Factory.StartNew(delegate{ StockService.CallSomeLongRunningService(Stocks[0]); })<br />
.ContinueWith(delegate<br />
{ StockService.CallSomeLongRunningService(Stocks[1]); })<br />
.ContinueWith(delegate<br />
{ StockService.CallSomeLongRunningService(Stocks[2]); });</p>
<p>Console.ReadKey();</p>
<p><strong>Returning values from Tasks<br />
</strong>You can retrieve a value that has been returned from a task by querying the result property:<br />
<br />
var data = Task.Factory.StartNew(() =gt;  StockService.CallSomeLongRunningService(Stocks[0])).Result;<br />
Console.WriteLine("Parallel task returned with value of {0}",data);</p>
<p>Alternatively you can use one of the generic Task classes and again query the result property:</p>
<p>Tasklt;stringgt; t = new Tasklt;stringgt;(delegate{return doSomething();} );<br />
t.Start();<br />
Console.WriteLine("Parallel task returned with value of {0}", t.Result);</p>
<p><strong>What happens if the Task does not yet have a result? <br />
</strong>If you try and access the result if the task has completed its work then the value will be returned. If however the task has not completed its work then the code will block until the task has completed. As you can probably predict this could slow your application down as the CLR waits for the return value. To minimize slow down you probably want to run the task as soon possible before you need access to the actual value. </p>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/WorkingwithTasksinVS2010/85" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>83</id>
<published>5/27/2009 12:00:00 AM</published>
<updated>5/27/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">5/27/2009 12:00:00 AM</app:edited>
<title>Visual Studio 2010 Screencasts - First look and Visual Basic changes</title>
<content type="html"><![CDATA[I have recorded two screencasts on Visual Studio 2010:<br />
<br />
VS2010 First look and IDE enhancements:<br />
<a shape="rect" href="http://www.simpleisbest.co.uk/content/downloads/vs2010_01.wmv" shape="rect">http://www.simpleisbest.co.uk/content/downloads/vs2010_01.wmv</a><br />
<br />
Visual Basic Language enhancements:<br />
<a shape="rect" href="http://www.simpleisbest.co.uk/content/downloads/vs2010_02.wmv" shape="rect">http://www.simpleisbest.co.uk/content/downloads/vs2010_02.wmv</a><br />
<br />
I plan on recording a number of screencasts and will shortly be working on the following:<br />
<ul>
    <li>C# Language amp; Variance changes </li>
    <li>DLR </li>
    <li>Parallelization </li>
    <li>Customizing IDE </li>
    <li>ASP.net amp; AJAX </li>
</ul>
<p>Any suggestions/requests welcome! </p>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/VisualStudio2010Screencasts-FirstlookandVisualBasicchanges/83" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>84</id>
<published>5/27/2009 12:00:00 AM</published>
<updated>5/27/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">5/27/2009 12:00:00 AM</app:edited>
<title>Oslo May CTP</title>
<content type="html"><![CDATA[New Oslo CTP available:<br />
<a shape="rect" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=827122a5-3ca0-4389-a79e-87af37cbf60damp;displaylang=en" shape="rect">http://www.microsoft.com/downloads/details.aspx?FamilyID=827122a5-3ca0-4389-a79e-87af37cbf60damp;displaylang=en</a><br />
<br />
I havent had a chance to review this properly yet but initial thoughts:<br />
<ul>
    <li>New version of Quadrant! </li>
    <li>Intellipad much quicker than previous releases </li>
    <li>Command line tools merged into m.exe </li>
    <li>Minor syntax changes - most notably =gt; used for declaring contents of extents </li>
</ul>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/OsloMayCTP/84" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>82</id>
<published>5/26/2009 12:00:00 AM</published>
<updated>5/26/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">5/26/2009 12:00:00 AM</app:edited>
<title>Speaker Feedback</title>
<content type="html"><![CDATA[This morning I got emailed the feedback from my recent talks at WebDD and DDD Belfast. <br />
<br />
I was very interested to see this feedback as these were much larger events than I had talked at before. I found in smaller user groups people tend (but not always!) to be a bit kinder so with a larger and unknown audience I thought I would get a more honest assessment of my presentation. <br />
<br />
The presentation I gave was an overview of all the new changes in VS2010 and .net 4. This was a bit different to previous presentations I have done given the scarce information available. The presentation was pre VS beta release so I only had the existing CTP to play with. I decided given the Nov CTP’s instability and slowness to not utilize it in my talk. <br />
<br />
The negative comments could be summarized as the following:<br />
<ul>
    <li>Need more demos/too much Powerpoint </li>
    <li>Too quick </li>
    <li>Too much information </li>
    <li>Need more detail </li>
    <li>Make fonts bigger and close windows (totally agree sorry forgot to do this!) </li>
</ul>
<p>These are all valid comments that I can learn from– apart from the demo one - if the CTP was worth showing I would have demoed it! <br />
I think it’s probably impossible to please everyone. From the comments there were obviously some hard core devs who wanted much more detail – not sure this would have been so enjoyable or useful to everyone else. Maybe future session should make clear the level they are aimed at to avoid these disappointments. <br />
Despite the suggestions I covered too much material too quickly many commented they liked the quick overview. <br />
<br />
<strong>Lesson – you cannot please everyone! <br />
</strong><br />
These sort of comments can probably be minimized by writing a good session abstract. <br />
<br />
In conclusion I will be doing a newer version of this presentation at DevEvening the end of Aug/very early Sep. The new presentation will be very much demo based now the Beta is here (maybe beta 2 by then?) and I will be limiting Power Point to the minimum. I think I will also pick fewer areas and go into more detail. <br />
<br />
Overall very happy with feedback. </p>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/SpeakerFeedback/82" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>81</id>
<published>5/20/2009 12:00:00 AM</published>
<updated>5/20/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">5/20/2009 12:00:00 AM</app:edited>
<title>VS2010 Beta Problems and Questions</title>
<content type="html"><![CDATA[<strong>Questions:<br />
</strong>Q: Where is VS2010 beta?<br />
A: MSDN subscribers can download it off the main subscription site. For everyone else it is at: <a shape="rect" href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx" target="_blank" shape="rect">http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx</a><br />
<br />
Q: Can I install VS2010 beta alongside VS2008?<br />
A: Yes... but studio betas have a long history of being tricky to install so my advice would be to use a virtual image instead<br />
<br />
Q: Does VS2010 beta work in Vmware, Virtualbox etc?<br />
?A: Yes<br />
<br />
Q: Does VS2010 beta run on Win7?<br />
A: Yes and it seems quicker than my Vista VMware image<br />
<br />
Q: No MVC what the %*#$!<br />
Nope sadly MVC v1 was just too late to be included. However there is a workaround:<br />
<a shape="rect" href="http://haacked.com/archive/2009/05/18/aspnetmvc-vs2010-beta1.aspx" target="_blank" shape="rect">http://haacked.com/archive/2009/05/18/aspnetmvc-vs2010-beta1.aspx</a><br />
<br />
Q: Is there a training kit?<br />
Yes and its got huge amounts of great stuff to play with:<br />
<a shape="rect" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=752cb725-969b-4732-a383-ed5740f02e93amp;displayLang=en" shape="rect">http://www.microsoft.com/downloads/details.aspx?FamilyID=752cb725-969b-4732-a383-ed5740f02e93amp;displayLang=en</a><br />
<br />
Q: Is there any MSDN documentation?<br />
Yes but it early stuff still and some areas are a bit incomplete, lacking examples etc:<br />
<a shape="rect" href="http://msdn.microsoft.com/en-us/library/dd409230(VS.100).aspx" target="_blank" shape="rect">http://msdn.microsoft.com/en-us/library/dd409230(VS.100).aspx</a><br />
<br />
Q: Any tutorial sites?<br />
A: Yes there will some great tutorials and screen casts here!.. but if you have to go else where then here are some good links (to be expanded):<br />
<a shape="rect" href="http://msdn.microsoft.com/en-us/vstudio/dd441784.aspx" target="_blank" shape="rect">http://msdn.microsoft.com/en-us/vstudio/dd441784.aspx</a><br />
<br />
<strong>Problems:</strong><br />
I am keeping track of some of the issues people have had installing VS2010 beta and have the following problems and solutions so far:<br />
<br />
Q: I am using a virtual machine and getting some weird graphics issues/ VS2010 beta seems very slow?<br />
A: Turn off GPU acceleration (thanks to Gary Short for this one) something weird going on with WPF IDE<br />
<br />
Q: I get Error 1603 after the framework 4 install step<br />
A: This can occur just after the framework 4 step is completed. I think this is due to having other technology previews installed. I had Silverlight 3 preview, Azure tools and Oslo SDK installed. I used fresh image and it was fine. Suspect issue was with Silverlight 3 but who knows.<br />
<br />
Q: Weird message about removing framework 1.0<br />
A: You need to do some clean up! consult Peter Brombergs blog at:<br />
<a shape="rect" href="http://petesbloggerama.blogspot.com/2009/05/visual-studio-2010-beta-1.html" target="_blank" shape="rect">http://petesbloggerama.blogspot.com/2009/05/visual-studio-2010-beta-1.html</a><br />
<br />
<br />
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/VS2010BetaProblemsandQuestions/81" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>80</id>
<published>5/19/2009 12:00:00 AM</published>
<updated>5/19/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">5/19/2009 12:00:00 AM</app:edited>
<title>VS2010 Beta</title>
<content type="html"><![CDATA[Well after a long wait the VS2010 beta is finally here (for MSDN subscribers anyway everyone else has to wait until Wednesday). Apparently this will work fine with VS2008 as well if you are failing brave. <br />
<br />
However as this is beta software and early versions of Studio have a long history of being difficult to uninstall it is a sensible thing to install on a virtual machine.<br />
<br />
This was a bit of a painful for me where I discovered the following:<br />
<br />
Dont install it if you have any of the other beta tools or you may get <strong>error 1603</strong>. I had Silverlight 3, Azure Tools and Oslo SDK. I suspect Silverlight 3 preview is actually the problem as this seems less stable than the other items and caused me a few other issues but I have no evidence for this.<br />
When you dont have any other virtual images around dont use an expired Windows 7 (build 7000) image<br />
I then received a corrupt cabinet file error while macro tools were installing. I think this was my burn of the ISO image (thanks Active ISO burner) as it installed fine when I used the ISO image directly in VMware<br />
<br />
The overall install seems a fair bit quicker than previous versions of studio and much simpler. I liked that there was two install config options .net development or C++ developer! Whether this will stay like this remains to be seen. <br />
<br />
Further posts and a screencast showing basic features such as language enhancments to follow! 
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/VS2010Beta/80" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>79</id>
<published>5/13/2009 12:00:00 AM</published>
<updated>5/13/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">5/13/2009 12:00:00 AM</app:edited>
<title>Whats good in VS2010 and dot net 4</title>
<content type="html"><![CDATA[I thought it would be useful to put together a deep zoom composition of all the great new features coming out in .net 4 and Visual Studio 2010. <br />
<br />
This information is taken from my book research and all the points represent a section in my book that I will be covering. Oops I left MEF off this diagram - dont worry there is a section on this important area too!<br />
<br />
 Information on some areas (WPF, WCF and Entity Framework) is still a bit scarce or I am waiting on a newer CTP (IDE) so I will be updating this diagram over the coming months. <br />
<br />
<br />
<object width="800" height="600" data="data:application/x-oleobject;base64,QfXq3+HzJEysrJnDBxUISgAIAACuUgAAAz4AAAwAAAB3AGgAaQB0AGUAAAAAAAAAAAAAAAAAAACMAAAAaAB0AHQAcAA6AC8ALwB3AHcAdwAuAHMAaQBtAHAAbABlAGkAcwBiAGUAcwB0AC4AYwBvAC4AdQBrAC8AYwBvAG4AdABlAG4AdAAvAHMAaQBsAHYAZQByAGwAaQBnAGgAdAAvAEQAZQBlAHAAWgBvAG8AbQBQAHIAbwBqAGUAYwB0AC4AeABhAHAAAAA8AAAAAAAAACYAAABvAG4AUwBpAGwAdgBlAHIAbABpAGcAaAB0AEUAcgByAG8AcgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAGAAAADIALgAwAC4AMwAxADAAMAA1AC4AMAAAAAoAAAB0AHIAdQBlAAAAAAAAAA==" type="application/x-silverlight-2" althtml="
lt;rade_param name=quot;sourcequot; value=quot;http://www.simpleisbest.co.uk/content/silverlight/DeepZoomProject.xapquot;gt;
lt;rade_param name=quot;onerrorquot; value=quot;onSilverlightErrorquot; gt;
lt;rade_param name=quot;backgroundquot; value=quot;whitequot; gt;
lt;rade_param name=quot;minRuntimeVersionquot; value=quot;2.0.31005.0quot; gt;
lt;rade_param name=quot;autoUpgradequot; value=quot;truequot; gt;
lt;a href=quot;http://go.microsoft.com/fwlink/?LinkID=124807quot; style=quot;text-decoration: none;quot;gt;
lt;img src=quot;http://go.microsoft.com/fwlink/?LinkId=108181quot; alt=quot;Get Microsoft Silverlightquot; style=quot;border-style: nonequot;/gt;
lt;/agt;
">
<param name="source" value="http://www.simpleisbest.co.uk/content/silverlight/DeepZoomProject.xap">
<param name="onerror" value="onSilverlightError" >
<param name="background" value="white" >
<param name="minRuntimeVersion" value="2.0.31005.0" >
<param name="autoUpgrade" value="true" >
<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>
</a>
</object>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/WhatsgoodinVS2010anddotnet4/79" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>78</id>
<published>4/18/2009 12:00:00 AM</published>
<updated>4/18/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">4/18/2009 12:00:00 AM</app:edited>
<title>WebDD</title>
<content type="html"><![CDATA[It has been a very busy few weeks for me in terms of speaking. In the past few weeks I have spoken at DDD Belfast, Vbug London and today at WebDD09. With speaking I firmly believe the only way to really improve is to do it. It has been a great learning experience and I have enjoyed watching other presentations and making some new friends. I am glad that it is now finished for a bit through! <br />
<br />
The presentation I did today was an overview of the new features of Visual Studio 2010 and .net 4. It was intended as an overview of all the new stuff coming out. Like many people I prefer presentations to have few slides and more demos. As I was discussing new changes I had the choice of using the current CTP or being slide heavy. After umming and arring about this I decided to opt for slides. I had 2 comments about this descision in the 3 talks that I would like to address: <br />
<ul>
    <li>At the time of writing the only ctp available outside of Microsoft is 6 months old and does not contain most of the intended changes </li>
    <li>Current CTP is unstable and slow - not ideal for presentations! </li>
    <li>I showed the more finished areas such as Oslo and AJAX. Take a look at what is currently available you will find not much to demo </li>
    <li>An overview of the entire framework doesnt give much time to look into any area in detail (well duh!)</li>
</ul>
<p>For me the best presentation of the day was given by Sebastian Lambla. Seb is a very entertaining presenter and was discussing MVC best practices. Unfortunatly the demo gods were not with him :O Near the beginning of his talk he suffered a BSOD mid presentation. His machine wouldnt turn on and he then had some weird issue where ASP.net could not find Castle IOC assemblies. If that wasnt enough R# was then causing issues. However Seb managed to recover from this very well and I think the audience probably went away more impressed because of it. <br />
<br />
I learnt a number of lessons from the conference talks: </p>
<ul>
    <li>Speaking at user group is very different to conferences </li>
    <li>For some reason today I found I had a tendency to talk to screen rather than audience. I noticed I was doing this half way through presentation - sorry! </li>
    <li>Dont try and explain ADO.net dataservices without slides or examples </li>
    <li>Oslo is tricky to explain in 5 minutes </li>
    <li>I have a tendency to talk quicker when nervous </li>
    <li>Don't change your talk the night before. I added in an example of M schema which didnt fit with my slide order which showed MGrammar </li>
    <li>Talking on a microphone is cool</li>
    <li>You cant please everyone - some liked an overview others were frustrated and wanted more detail </li>
</ul>
<p>I look forward to Microsoft releasing a newer CTP and being able to go into more detail. At present I have a load of information and documentation on the various upcoming changes but cant play around with it until have a working version. All in all an enjoyable day and thanks to all the organisers</p>
<br />
<br />
<img alt="Badge" src="http://www.simpleisbest.co.uk/content/images/badge.jpg" complete="complete" complete="complete" />
<p>My special badge given to me by Barry "Sock" Dorrans after proper one read Alax Mackey</p>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/WebDD/78" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>77</id>
<published>4/12/2009 12:00:00 AM</published>
<updated>4/12/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">4/12/2009 12:00:00 AM</app:edited>
<title>Should user groups be free</title>
<content type="html"><![CDATA[User groups are a strange concept in many ways as in some ways we are paying to promote a company's product with little or no support from them. This was a point of discussion at Vbug London last week with Graham Parker prompted by the finding that at a previous session there was only one fully paid up member :( <br />
<br />
That's not to say they didnt have people attending just no one actually paying grrrr. With Pizza being ordered each event this situation obviously could not continue.<br />
<br />
Running a group does cost money but for something like DevEvening the costs are pretty minimal. Our venue is paid for with the agreement that guests will purchase food and drink and the only real cost has been a projector after a member could no longer borrow one from work. Prizes and swag are provided by a number of companies and we offer them in return a great way to promote their products (although we are independent so will say if its crap!). <br />
<br />
The main groups that charge a membership are Nxtgen and Vbug. Nxtgen seem to be doing pretty well and continually expanding so the pay model can obviously work. They currently charge £7.99 a month or £89 a year whilst Vbug charge £175 for individuals or £799 for corporate 5 members. It should be noted that vbug also give you a magazine and technical support for your money. <br />
<br />
Once a user group reaches a certain size it probably becomes very difficult for it to remain free. For one you need a larger venue which will become trickier to obtain for free, plus all the admin that goes with handling larger numbers of people. Having funds also allows you to pay speakers costs, promote and advance your group. <br />
<br />
Well whether or not user groups should be free we intend for DevEvening to be for the forseeable future :) 
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/Shouldusergroupsbefree/77" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>76</id>
<published>4/4/2009 12:00:00 AM</published>
<updated>4/4/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">4/4/2009 12:00:00 AM</app:edited>
<title>DDD Belfast Slides</title>
<content type="html"><![CDATA[I enjoyed my DDD Belfast session - hopefully those who attended did too! <br />
<br />
<a shape="rect" href="http://www.simpleisbest.co.uk/content/downloads/whatsNewDotNet4Slides.zip" shape="rect">Download slides</a> <br />
<a shape="rect" href="http://www.simpleisbest.co.uk/content/downloads/whatsNewDotNet4Code.zip" shape="rect">Download code</a> <br />
<br />
<img alt="DDD Belfast speaking" src="http://www.simpleisbest.co.uk/content/images/dddBelfastSpeak.jpg" complete="complete" complete="complete" /> <br />
<br />
<img alt="DDD Belfast speaking" src="http://www.simpleisbest.co.uk/content/images/dddCrowd.jpg" complete="complete" complete="complete" /> <br />
<br />
<img alt="DDD Belfast speaking" src="http://www.simpleisbest.co.uk/content/images/dddBelfastSpeak2.jpg" complete="complete" complete="complete" /> <br />
<br />
Thanks to Barry Dorrans for photos! ]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/DDDBelfastSlides/76" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>75</id>
<published>4/2/2009 12:00:00 AM</published>
<updated>4/2/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">4/2/2009 12:00:00 AM</app:edited>
<title>Speaking Engagements</title>
<content type="html"><![CDATA[Lots of speaking engagements coming up. Speaking at conferences on unreleased unstable software is one of those things that seems a good idea at the time! <br />
<br />
Hope to see you at the following great events:<br />
<br />
<a shape="rect" href="http://developerdeveloperdeveloper.com/belfast/ViewSession.aspx?SessionID=213" target="_blank" shape="rect">DDD Belfast 4th April </a>Whats new in .net 4?<br />
<a shape="rect" href="http://www.vbug.co.uk/Events/April-2009/VBUG-London-Whats-good-in-NET-4-and-Visual-Studio-2010.aspx" target="_blank" shape="rect">Vbug London 7th April</a> Whats new in .net 4? <br />
<a shape="rect" href="http://www.developerdeveloperdeveloper.com/webdd09/ProposedSessions.aspx" target="_blank" shape="rect">WebDD 09 18th April </a>Whats new in .net 4?<br />
<a shape="rect" href="http://www.nxtgenug.net/ViewEvent.aspx?EventID=192" target="_blank" shape="rect">NxtGen Oxford 5th May</a> Whats new in .net 4? (nugget)<br />
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/SpeakingEngagements/75" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>74</id>
<published>3/31/2009 12:00:00 AM</published>
<updated>3/31/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">3/31/2009 12:00:00 AM</app:edited>
<title>Sample Book Cover</title>
<content type="html"><![CDATA[Apress sent me a sample book cover today to put in my upcoming presentations just have to write the rest of it now!<br />
<br />
<img alt="Book Cover" src="http://www.simpleisbest.co.uk/content/images/alexBookCover.gif" border="0" complete="complete" complete="complete" /> 
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/SampleBookCover/74" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>73</id>
<published>3/28/2009 12:00:00 AM</published>
<updated>3/28/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">3/28/2009 12:00:00 AM</app:edited>
<title>Open Space Code Day</title>
<content type="html"><![CDATA[Just got back from Open Space Code day held at Conchango's London office and organised by Alan Dean. <br />
<br />
Open Space Code days are an interesting format focussed more on actually writing stuff than passivley listening to a presentation. <br />
<br />
At the start of the day delegates suggest individual sessions which are then voted for. Delegates then have a choice of the most popular sessions and can freely switch between them. <br />
<br />
I attended the following sessions:<br />
IronRuby (which was quite short as we realised no one knew much about it) <br />
BDD session (where I finally understand Mocking) <br />
DSL run by Ian Cooper - Not sure I would ever implement something the way Ian was suggesting but taught me another use of interfaces. <br />
<br />
It was great to work with other developers and some very smart people! <br />
<br />
If you would like to attend a future Open Space Code day why not sign up at: <a shape="rect" href="http://openspacecode.com/home.en.html" shape="rect">http://openspacecode.com/home.en.html</a><br />
<br />
Thanks to Alan Dean and Michelle Flynn for organising the day. <br />
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/OpenSpaceCodeDay/73" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>72</id>
<published>3/17/2009 12:00:00 AM</published>
<updated>3/17/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">3/17/2009 12:00:00 AM</app:edited>
<title>Simple MGrammar Example</title>
<content type="html"><![CDATA[I am currently looking into the Oslo platform and decided to have a go at MGrammar. <br />
<br />
MGrammar allows you to create your own Domain Specific Languages (DSL). A DSL is just a language meant for a specific purpose e.g. SQL could be considered a DSL for databases. DSL's can make it much easier to work with data and encapsulate functionality specific to its domain. <br />
<br />
I wanted to create a really simple DSL to represent something everyone was familiar with. In my example we will use a pack of cards or more specifically a hand of cards in the game of Poker. <br />
<br />
Consider what makes up a poker hand:<br />
<ul>
    <li>A card can be one of 4 suits </li>
    <li>A card can be values 2-10 and Jack, Queen, King, Ace. </li>
    <li>A hand is made up of 5 cards (in certain sub games of poker) </li>
</ul>
<p>Okay let's get started. <br />
<br />
First if you havent already you will need to install the Oslo preview from:<br />
<a shape="rect" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=f2f4544c-626c-44a3-8866-b2a9fe078956amp;displaylang=en" shape="rect">http://www.microsoft.com/downloads/details.aspx?FamilyID=f2f4544c-626c-44a3-8866-b2a9fe078956amp;displaylang=en</a><br />
Once this is installed it will install an application called Intellipad Intellipad is an editor for working with M languages<br />
Open Intellipad<br />
As not everything is implmented yet you will need to manually create a new file called PokerHand.mg (mg is the extension for MGrammar language files)<br />
Open up Intellipad (Samples enabled)<br />
Change the mode we are working in. To do this click the top right corner where it says Standard Mode click and change the mode to MGrammarMode. This will change the menus available to you on the main bar.<br />
Click the MGrammar menu on the menu bar and select Tree Preview<br />
An open file dialogue will appear (it wont be like this in final release) select the PokerHand.mg file you created earlier<br />
In the centre pane (this is where we define our Grammar) enter the following to create our grammar:</p>
<div style="font-family: courier new; background: white; color: black; font-size: 10pt">
<p style="margin: 0px"> </p>
<p style="margin: 0px">/*</p>
<p style="margin: 0px">Author:<span style="color: #006400"> </span>Alex<span style="color: #006400"> </span>Mackey</p>
<p style="margin: 0px">Web:<span style="color: #006400"> </span>www.simpleisbest.co.uk</p>
<p style="margin: 0px">Description:<span style="color: #006400"> </span>Simple<span style="color: #006400"> </span>MGrammar<span style="color: #006400"> </span>to<span style="color: #006400"> </span>hold<span style="color: #006400"> </span>poker<span style="color: #006400"> </span>deck</p>
<p style="margin: 0px">*/</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"><span style="color: #0000ff">module</span><span style="color: #006400"> </span>SimpleIsBest</p>
<p style="margin: 0px">{</p>
<p style="margin: 0px"><span style="color: #006400">    </span>language<span style="color: #006400"> </span>CardDeck</p>
<p style="margin: 0px"><span style="color: #006400">    </span>{</p>
<p style="margin: 0px"><span style="color: #006400">       </span>syntax<span style="color: #006400"> </span>Deck<span style="color: #006400"> </span>=<span style="color: #006400"> </span><span style="color: #800000">"Deck"</span>;</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"><span style="color: #006400">        //Card values 1-9 Jack, Queen, King, Ace</span></p>
<p style="margin: 0px"><span style="color: #006400">        </span>token<span style="color: #006400"> </span>Value<span style="color: #006400"> </span>=<span style="color: #006400"> </span><span style="color: #800000">"1"</span>..<span style="color: #800000">"9"</span></p>
<p style="margin: 0px"><span style="color: #006400">                        </span>|<span style="color: #800000">"10"</span></p>
<p style="margin: 0px"><span style="color: #006400">                        </span>|<span style="color: #800000">"J"</span></p>
<p style="margin: 0px"><span style="color: #006400">                        </span>|<span style="color: #800000">"Q"</span></p>
<p style="margin: 0px"><span style="color: #006400">                        </span>|<span style="color: #800000">"K"</span></p>
<p style="margin: 0px"><span style="color: #006400">                        </span>|<span style="color: #800000">"A"</span>;</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"><span style="color: #006400">        //Card suit Hearts, Club, Diamond, Spades</span></p>
<p style="margin: 0px"><span style="color: #006400">        </span>token<span style="color: #006400"> </span>Suit<span style="color: #006400"> </span>=<span style="color: #006400">  </span><span style="color: #800000">"H"</span></p>
<p style="margin: 0px"><span style="color: #006400">                      </span>|<span style="color: #800000">"C"</span></p>
<p style="margin: 0px"><span style="color: #006400">                      </span>|<span style="color: #800000">"D"</span></p>
<p style="margin: 0px"><span style="color: #006400">                      </span>|<span style="color: #800000">"S"</span>;</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"><span style="color: #006400">        //A card is made up of value + suit      </span></p>
<p style="margin: 0px"><span style="color: #006400">        </span>token<span style="color: #006400"> </span>Card=<span style="color: #006400"> </span>Value<span style="color: #006400"> </span>+<span style="color: #006400"> </span>Suit;</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"><span style="color: #006400">        </span>syntax<span style="color: #006400"> </span>PokerHand<span style="color: #006400"> </span>=<span style="color: #006400"> </span>Deck<span style="color: #006400"> </span>Card<span style="color: #006400"> </span>Card<span style="color: #006400"> </span>Card<span style="color: #006400"> </span>Card<span style="color: #006400"> </span>Card;</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"><span style="color: #006400">        //Change how results are displayed (or projected official term)</span></p>
<p style="margin: 0px"><span style="color: #006400">        </span>syntax<span style="color: #006400"> </span>Main<span style="color: #006400"> </span>=<span style="color: #006400"> </span>ph:PokerHand+<span style="color: #006400"> </span>=gt;<span style="color: #006400"> </span>[ph];<span style="color: #006400">  </span></p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"><span style="color: #006400">        // Ignore whitespace</span></p>
<p style="margin: 0px"><span style="color: #006400">        </span>syntax<span style="color: #006400"> </span>LF<span style="color: #006400"> </span>=<span style="color: #006400"> </span><span style="color: #800000">"\u000A"</span>;</p>
<p style="margin: 0px"><span style="color: #006400">        </span>syntax<span style="color: #006400"> </span>CR<span style="color: #006400"> </span>=<span style="color: #006400"> </span><span style="color: #800000">"\u000D"</span>;</p>
<p style="margin: 0px"><span style="color: #006400">        </span>syntax<span style="color: #006400"> </span>Space<span style="color: #006400"> </span>=<span style="color: #006400"> </span><span style="color: #800000">"\u0020"</span>;</p>
<p style="margin: 0px"><span style="color: #006400">        </span>interleave<span style="color: #006400"> </span>Whitespace<span style="color: #006400"> </span>=<span style="color: #006400"> </span>LF<span style="color: #006400"> </span>|<span style="color: #006400"> </span>CR<span style="color: #006400"> </span>|<span style="color: #006400"> </span>Space;</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"><span style="color: #006400">    </span>}</p>
<p style="margin: 0px">}</p>
</div>
<!--EndFragment--><br />
<p>I think most of thats pretty readable. The only tricky bits are:<br />
<br />
<span style="color: #006400"> </span>syntax<span style="color: #006400"> </span>Main<span style="color: #006400"> </span>=<span style="color: #006400"> </span>ph:PokerHand+<span style="color: #006400"> </span>=gt;<span style="color: #006400"> </span>[ph];<span style="color: #006400"> - this changes how the data is displayed or projected</span><br />
interleave<span style="color: #006400"> </span>Whitespace<span style="color: #006400"> </span>=<span style="color: #006400"> </span>LF<span style="color: #006400"> </span>|<span style="color: #006400"> </span>CR<span style="color: #006400"> </span>|<span style="color: #006400"> </span>Space; - this just means ignore the whitespace<br />
<br />
<br />
In the left hand pane (where we put our test data) enter the following test data:<br />
<br />
Deck KC 3C 5H 2H 2H<br />
Deck KH 3C 5H 2H 2C<br />
<br />
In the right hand section you should see how M has transformed our input data. <br />
<br />
In the next post we will look at how to actually use our DSL within Visual Studio with aid of the DynamicCompiler class. <br />
<br />
  </p>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/SimpleMGrammarExample/72" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>71</id>
<published>3/12/2009 12:00:00 AM</published>
<updated>3/12/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">3/12/2009 12:00:00 AM</app:edited>
<title>Podcast with DevEvenings Matt Lacey on Windows Mobile</title>
<content type="html"><![CDATA[Craig Murphy recently recorded a podcast with DevEvenings very own Matt Lacey on Windows Mobile:<br />
<a href="http://www.craigmurphy.com/blog/?p=1398">http://www.craigmurphy.com/blog/?p=1398</a><br />
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/PodcastwithDevEveningsMattLaceyonWindowsMobile/71" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>69</id>
<published>3/8/2009 12:00:00 AM</published>
<updated>3/8/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">3/8/2009 12:00:00 AM</app:edited>
<title>Come learn about the upcoming changes in .net 4 and VS 2010 at DDD Belfast and Vbug London</title>
<content type="html"><![CDATA[I will be presenting "What's good in .net 4 and VS2010?" at the following events:<br />
<br />
<a href="http://developerdeveloperdeveloper.com/belfast/ViewSession.aspx?SessionID=213" target="_blank">DDD Belfast 4th April</a><br />
<a href="http://www.vbug.co.uk/Events/April-2009/VBUG-London-Whats-good-in-NET-4-and-Visual-Studio-2010.aspx" target="_blank">Vbug London 7th April</a><br />
<br />
The talks will cover at a high level the upcoming changes in .net 4 and VS2010.<br />
<br />
Hope to see you there!<br />
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/Comelearnabouttheupcomingchangesin.net4andVS2010atDDDBelfastandVbugLondon/69" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>70</id>
<published>3/8/2009 12:00:00 AM</published>
<updated>3/8/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">3/8/2009 12:00:00 AM</app:edited>
<title>Recommended book - Head first design patterns</title>
<content type="html"><![CDATA[I would throughly recommend the book <a href="http://www.amazon.co.uk/Head-First-Design-Patterns-Freeman/dp/0596007124/ref=sr_1_1?ie=UTF8amp;s=booksamp;qid=1236537822amp;sr=8-1" target="_blank">Head First Design Patterns</a>. I am just over half way through reading it and I think this may be the best programming book I have ever purchased. <br />
<br />
I really wish I had this book 9 years ago when I started developing software. The book explains in an easy to read an entertaining style various patterns you can apply to your software design and their pro's and cons. Some may be put off by the cartoony style but this book contains a huge amount of information in an easy to digest form. Design patterns can be a pretty dry subject but this book keeps it very light. The examples are in Java but easily transposed to C#. Highly recommended. <br />
<br />
<img alt="Head first design patterns" src="http://ecx.images-amazon.com/images/I/5195WV5qz0L._BO2,204,203,200_PIsitb-sticker-arrow-click,TopRight,35,-76_AA240_SH20_OU02_.jpg" border="0" />
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/Recommendedbook-Headfirstdesignpatterns/70" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>68</id>
<published>2/22/2009 12:00:00 AM</published>
<updated>2/22/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">2/22/2009 12:00:00 AM</app:edited>
<title>Playing with genetic algorithms</title>
<content type="html"><![CDATA[<p>Genetic Algorithms (GA) can help you find the optimal solution to a problem where many different solutions exist. GA’s will not necessarily find the best solution to a problem but will find a good solution. </p>
<p>How do GA’s work? </p>
<p>Glad you asked - let’s take the example of task scheduling. We have a number of different task items and want to know what is the best order to complete them so we can generate the highest profit as soon as possible. </p>
<p>To do this we will use a simple function (known as a fitness function) that return a numeric value for an inputted task set. The value will be calculated by totalling the billable amount of the first two schedule items in a set. In reality the fitness function would be more complex and take into account factors such as task length, priority, resource usage etc but you get the idea. </p>
<p>We will setup an initial list of task items and then generate eight new lists of tasks by swapping two items around (there are a number of ways to do this but I think this is the simplest). We will then use the task set with the highest fitness as the basis to generate our next generation. This process will carry on for a number of iterations (called epochs) hopefully the best solution should then be found as the best is used from each generation. GA’s require many iterations and can be quite slow however the more epochs you perform the better your solution is likely to be. </p>
<p>Below is a simple example I knocked up in C#. The highest fitness value that can be returned is 4800 (3200 + 1600). Obviously in this example it is simple to work out the best solution as there are only a few task but imagine if you had thousands of tasks and a more complex fitness function and you can see how GA’s can be useful. Try changing the epoch number to 100 and notice how you need many epochs (around 10,000 for this example) to consistently get the best order. The number of epochs needed could be drastically improved by randomizing a set in the initial population and then choosing the fittest.</p>
<div style="font-size: 10pt; background: white; color: black; font-family: courier new">
<p style="margin: 0px"><span style="color: #0000ff">using</span> System;</p>
<p style="margin: 0px"><span style="color: #0000ff">using</span> System.Collections.Generic;</p>
<p style="margin: 0px"><span style="color: #0000ff">using</span> System.Linq;</p>
<p style="margin: 0px"><span style="color: #0000ff">using</span> System.Text;</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"><span style="color: #0000ff">namespace</span> GAScheduling</p>
<p style="margin: 0px">{</p>
<p style="margin: 0px">    <span style="color: #0000ff">class</span> <span style="color: #2b91af">Program</span></p>
<p style="margin: 0px">    {</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">        <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">int</span> Epochs = 10000;</p>
<p style="margin: 0px">        <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">double</span> MutationPossibility = 0.1;</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">        <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Main(<span style="color: #0000ff">string</span>[] args)</p>
<p style="margin: 0px">        {</p>
<p style="margin: 0px">            <span style="color: #0000ff">int</span> CurrentEpoch = 0;</p>
<p style="margin: 0px">            <span style="color: #2b91af">List</span>lt;<span style="color: #2b91af">TaskItem</span>gt; Tasks = <span style="color: #0000ff">new</span> <span style="color: #2b91af">List</span>lt;<span style="color: #2b91af">TaskItem</span>gt;();</p>
<p style="margin: 0px">            <span style="color: #2b91af">List</span>lt;<span style="color: #2b91af">TaskItem</span>gt; BestGeneration = <span style="color: #0000ff">new</span> <span style="color: #2b91af">List</span>lt;<span style="color: #2b91af">TaskItem</span>gt;();</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">            <span style="color: #008000">//Setup new tasks</span></p>
<p style="margin: 0px">            Tasks.Add(<span style="color: #0000ff">new</span> <span style="color: #2b91af">TaskItem</span> { ID = 1, BillableAmount = 100 });</p>
<p style="margin: 0px">            Tasks.Add(<span style="color: #0000ff">new</span> <span style="color: #2b91af">TaskItem</span> { ID = 2, BillableAmount = 200 });</p>
<p style="margin: 0px">            Tasks.Add(<span style="color: #0000ff">new</span> <span style="color: #2b91af">TaskItem</span> { ID = 3, BillableAmount = 400 });</p>
<p style="margin: 0px">            Tasks.Add(<span style="color: #0000ff">new</span> <span style="color: #2b91af">TaskItem</span> { ID = 4, BillableAmount = 800 });</p>
<p style="margin: 0px">            Tasks.Add(<span style="color: #0000ff">new</span> <span style="color: #2b91af">TaskItem</span> { ID = 5, BillableAmount = 1600 });</p>
<p style="margin: 0px">            Tasks.Add(<span style="color: #0000ff">new</span> <span style="color: #2b91af">TaskItem</span> { ID = 6, BillableAmount = 3200 });</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">            BestGeneration = <span style="color: #0000ff">new</span> <span style="color: #2b91af">List</span>lt;<span style="color: #2b91af">TaskItem</span>gt;(Tasks);</p>
<p style="margin: 0px">            <span style="color: #2b91af">List</span>lt;<span style="color: #2b91af">TaskItem</span>gt; NewTasks;</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">            <span style="color: #0000ff">while</span> (CurrentEpoch != Epochs)</p>
<p style="margin: 0px">            {</p>
<p style="margin: 0px">                NewTasks = CreateNewGeneration(BestGeneration);</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">                <span style="color: #008000">//Is this generation better than last if so use it in next cross over</span></p>
<p style="margin: 0px">                <span style="color: #0000ff">if</span> (CalculateFitness(NewTasks) gt; CalculateFitness(BestGeneration))</p>
<p style="margin: 0px">                {</p>
<p style="margin: 0px">                    BestGeneration = NewTasks;</p>
<p style="margin: 0px">                }               </p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">                CurrentEpoch++;</p>
<p style="margin: 0px">            }</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">            <span style="color: #2b91af">Console</span>.WriteLine(<span style="color: #a31515">"Best fitness: "</span> + CalculateFitness(BestGeneration).ToString() + <span style="color: #a31515">"\n"</span>);</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">            <span style="color: #008000">//Show items</span></p>
<p style="margin: 0px">            <span style="color: #2b91af">Console</span>.WriteLine(<span style="color: #a31515">"Order:"</span>);</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">            <span style="color: #0000ff">foreach</span> (<span style="color: #2b91af">TaskItem</span> TaskItem <span style="color: #0000ff">in</span> BestGeneration)</p>
<p style="margin: 0px">            {</p>
<p style="margin: 0px">                <span style="color: #2b91af">Console</span>.WriteLine(TaskItem.ID.ToString() + <span style="color: #a31515">" ("</span> + TaskItem.BillableAmount + <span style="color: #a31515">")"</span>);</p>
<p style="margin: 0px">            }</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">            <span style="color: #2b91af">Console</span>.ReadKey();</p>
<p style="margin: 0px">        }</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">        <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #2b91af">List</span>lt;<span style="color: #2b91af">TaskItem</span>gt; CreateNewGeneration(<span style="color: #2b91af">List</span>lt;<span style="color: #2b91af">TaskItem</span>gt; InputTasks)</p>
<p style="margin: 0px">        {</p>
<p style="margin: 0px">            <span style="color: #0000ff">int</span> PopulationCount = 7;</p>
<p style="margin: 0px">            <span style="color: #0000ff">int</span> CurrentPopulationIndex = 0;</p>
<p style="margin: 0px">            <span style="color: #2b91af">List</span>lt;<span style="color: #2b91af">TaskItem</span>gt; BestGeneration = <span style="color: #0000ff">new</span> <span style="color: #2b91af">List</span>lt;<span style="color: #2b91af">TaskItem</span>gt;();</p>
<p style="margin: 0px">            <span style="color: #0000ff">decimal</span> HighestRating = 0;</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">            <span style="color: #008000">//Generate new populations</span></p>
<p style="margin: 0px">            <span style="color: #0000ff">while</span> (CurrentPopulationIndex != PopulationCount)</p>
<p style="margin: 0px">            {</p>
<p style="margin: 0px">                <span style="color: #2b91af">List</span>lt;<span style="color: #2b91af">TaskItem</span>gt; NewGeneration = Randomize(<span style="color: #0000ff">new</span> <span style="color: #2b91af">List</span>lt;<span style="color: #2b91af">TaskItem</span>gt;(InputTasks));</p>
<p style="margin: 0px">                <span style="color: #0000ff">decimal</span> FitnessRating = CalculateFitness(NewGeneration);</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">                <span style="color: #008000">//Is this new generation better than the old population?</span></p>
<p style="margin: 0px">                <span style="color: #0000ff">if</span> (FitnessRating gt; HighestRating)</p>
<p style="margin: 0px">                {</p>
<p style="margin: 0px">                    HighestRating = FitnessRating;</p>
<p style="margin: 0px">                    BestGeneration = NewGeneration;</p>
<p style="margin: 0px">                }</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">                CurrentPopulationIndex++;</p>
<p style="margin: 0px">            }</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">            <span style="color: #008000">//Return best generation</span></p>
<p style="margin: 0px">            <span style="color: #0000ff">return</span> BestGeneration;</p>
<p style="margin: 0px">        }</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">        <span style="color: #008000">//Swaps a task item around </span></p>
<p style="margin: 0px">        <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #2b91af">List</span>lt;<span style="color: #2b91af">TaskItem</span>gt; Randomize(<span style="color: #2b91af">List</span>lt;<span style="color: #2b91af">TaskItem</span>gt; InputTasks)</p>
<p style="margin: 0px">        {           </p>
<p style="margin: 0px">            <span style="color: #2b91af">Random</span> Random=<span style="color: #0000ff">new</span> <span style="color: #2b91af">Random</span>();</p>
<p style="margin: 0px">            <span style="color: #2b91af">List</span>lt;<span style="color: #2b91af">TaskItem</span>gt; TmpTasks = <span style="color: #0000ff">new</span> <span style="color: #2b91af">List</span>lt;<span style="color: #2b91af">TaskItem</span>gt;(InputTasks);</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">            <span style="color: #008000">//Get two random numbers making sure second is not same as first</span></p>
<p style="margin: 0px">            <span style="color: #0000ff">int</span> Index1 = Random.Next(0, TmpTasks.Count);</p>
<p style="margin: 0px">            <span style="color: #0000ff">int</span> Index2=0;</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">            <span style="color: #0000ff">do</span></p>
<p style="margin: 0px">            {</p>
<p style="margin: 0px">                Index2 = Random.Next(0, TmpTasks.Count);</p>
<p style="margin: 0px">            } </p>
<p style="margin: 0px">            <span style="color: #0000ff">while</span> (Index2 == Index1);</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">            <span style="color: #008000">//Swap items around</span></p>
<p style="margin: 0px">            <span style="color: #2b91af">TaskItem</span> Item1 = TmpTasks[Index1];</p>
<p style="margin: 0px">            <span style="color: #2b91af">TaskItem</span> Item2 = TmpTasks[Index2];</p>
<p style="margin: 0px">            TmpTasks[Index1] = Item2;</p>
<p style="margin: 0px">            TmpTasks[Index2] = Item1;</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">            <span style="color: #008000">//Check for mutation</span></p>
<p style="margin: 0px">            <span style="color: #0000ff">if</span> (Random.NextDouble() lt; MutationPossibility)</p>
<p style="margin: 0px">            {</p>
<p style="margin: 0px">                <span style="color: #008000">//Mutation is sometimes introduced to stop generations stagnating</span></p>
<p style="margin: 0px">            }</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">            <span style="color: #0000ff">return</span> TmpTasks;</p>
<p style="margin: 0px">        }</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">        <span style="color: #008000">//Fitness function calculated by totaling billable cost of first two iterations</span></p>
<p style="margin: 0px">        <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">decimal</span> CalculateFitness(<span style="color: #2b91af">List</span>lt;<span style="color: #2b91af">TaskItem</span>gt; InputSchedule)</p>
<p style="margin: 0px">        {</p>
<p style="margin: 0px">            <span style="color: #0000ff">int</span> Count = 0;</p>
<p style="margin: 0px">            <span style="color: #0000ff">decimal</span> RevenueValue = 0;</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">            <span style="color: #0000ff">while</span>(Count!=2)</p>
<p style="margin: 0px">            {</p>
<p style="margin: 0px">                RevenueValue += InputSchedule[Count].BillableAmount;</p>
<p style="margin: 0px">                Count++;</p>
<p style="margin: 0px">            }</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">            <span style="color: #0000ff">return</span> RevenueValue;</p>
<p style="margin: 0px">        }</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">    }</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> <span style="color: #2b91af">TaskItem</span></p>
<p style="margin: 0px">    {</p>
<p style="margin: 0px">        <span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> ID = 0;</p>
<p style="margin: 0px">        <span style="color: #0000ff">public</span> <span style="color: #0000ff">decimal</span> BillableAmount = 0;</p>
<p style="margin: 0px">    }</p>
<p style="margin: 0px">}</p>
</div>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/Playingwithgeneticalgorithms/68" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>67</id>
<published>2/1/2009 12:00:00 AM</published>
<updated>2/1/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">2/1/2009 12:00:00 AM</app:edited>
<title>Windows Azure erm what are you going to use it for</title>
<content type="html"><![CDATA[<p>Last week I was disussing Azure with DevEvening member Howard Richards. I was arguing Azure is a solution for a problem that doesnt really exist. <br />
Howard replied:<br />
<br />
<em>“Azure is a solution for a very narrow set of problems”<br />
</em><br />
I think Howards statement is probably more accurate.<br />
<br />
Don’t get me wrong I like Windows Azure, scalable on demand, virtualized computing is cool and has a number of benefits. 
<br/>
Currently I see Azure of being of use for a limited set of problems (high traffic sites/applications) and for me the disadvantages of using it currently out way the advantages. Let me explain..<br />
<br />
<strong>Advantages</strong><br />
The following are normally touted as advantages of Windows Azure (and cloud computing in general): </p>
<ul>
    <li>Quickly scale out your applications </li>
    <li>Let Microsoft/Amazon/Google take care of the infrastructure </li>
    <li>Due to virtualization technology less hardware is required and thus lower power consumption leading to cheaper and greener computing </li>
    <li>No hardware compatibility issues due to abstraction of hardware - erm when was the last time on Microsoft platform you had this issue? </li>
</ul>
<p><strong>Disadvantages</strong><br />
However the disadvantages are equally numerous:</p>
<ul>
    <li>Poor debugging and logging support </li>
    <li>Less mature than Google and Amazon’s tried and tested services </li>
    <li>Less control – what happens if your application goes wrong? </li>
    <li>Pricing could and likely will change over years </li>
    <li>How would you import large amounts of data? </li>
    <li>If you delete something can you be sure it is definantly deleted? </li>
    <li>Microsoft could terminate service in the future where would this leave you? </li>
    <li>Governance/Data protection issues with data being held around the world.  It is likely that Microsoft will allow you to restrict this to specific areas in order to adhere to legislation </li>
</ul>
<p>In addition to these issues are you going to store your data?<br />
<br />
At the time of writing Azure provides facilities for storing and accessing data in a RESTful manner through the use of blobs, queues, table storage. In addition to the mentioned Azure storage methods there is also SQL data services that provides “advanced functionality” such as concurrency and richer querying. Annoyingly SQL data services is nothing like either:<br />
<br />
A) SQL server<br />
B) ADO.net data services/Astoria<br />
<br />
You could argue that SQL server is not going to scale as well as a REST solution (and it probably wont) but SQL server seems to be working pretty well for many existing customers. So.. currently if you want to use Azure you will probably need to rewrite your data layer of the application (oh and make sure you are not using LINQ to SQL but EF). Fantastic.</p>
<p>One of Azure’s most touted benefits is its scalability - create a start-up with zero investment and then scale it out as needed. I am not sure that hosting was the major obstacle for most start-ups, a sustainable business plan was perhaps a bigger issue?<br />
<br />
<strong>What I like..</strong></p>
<ul>
    <li>Azure has some very promising areas of functionality like.net services (stuff for integration, security and work flow) and Live services (any web based service Microsoft has ever provided has been lumped in here). </li>
    <li>Move towards RESTful services and will help bring this architecture mainstream </li>
    <li>Worker Roles – For me the most useful part of Azure. Worker roles are similar to a services and are very easy to create and host. </li>
</ul>
<p><strong>Summary<br />
</strong>Maybe I am being too negative about Windows Azure/cloud computing and we are not yet at a version one release but for me the current benefits seem mostly confined to high traffic applications and then you will need to rewrite your data layer. In my opinion to achieve main stream adoption Azure needs to offer developers an easy way to store relational data such as SQL server.</p>
<p> </p>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/WindowsAzureermwhatareyougoingtouseitfor/67" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>66</id>
<published>1/31/2009 12:00:00 AM</published>
<updated>1/31/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">1/31/2009 12:00:00 AM</app:edited>
<title>January</title>
<content type="html"><![CDATA[This month has been a very busy month for me with juggling a number of projects at work, writing chapters on jQuery and ADO.net data services and organising DevEvening #6.<br />
<br />
DevEvening started off the new year with some great speakers: Andrew Fryer on SQL 2008 and Craig Murphy on Open XML. Our new pub venue was a generall good experience although there are some things we can do to reduce ambiant noise. As suggested we will project onto the other end of the room and remove the seating from a nearby table (which had a small group of vocal customers). <br />
<br />
Over the last month I have come across or been sent a number of fantastic links which I thought I would share.<br />
<br />
Blog - Chris Webb is a publisher and has a number of great articles on writing and publishing:<br />
<a href="http://ckwebb.com/">http://ckwebb.com/</a><br />
<br />
Blog- Thoughts on creativity illustrated by some fantastic cartoons:<br />
<a href="http://www.changethis.com/6.HowToBeCreative">http://www.changethis.com/6.HowToBeCreative</a><br />
<br />
Blog - Using a JavaScript neural network to solve a (particularly crappy) CAPTCHA. Perhaps the most interesting bit is how the image is prepapared for the neural network by being changed to gray and having noise reduced:<br />
<a href="http://ejohn.org/blog/ocr-and-neural-nets-in-javascript/">http://ejohn.org/blog/ocr-and-neural-nets-in-javascript/</a><br />
<br />
Tool - Neat free tool for presentations and training sessions that allows you to zoom into areas of the screen and annotate them:<br />
<a href="http://technet.microsoft.com/en-us/sysinternals/bb897434.aspx">http://technet.microsoft.com/en-us/sysinternals/bb897434.aspx</a><br />
<br />
Book - Programming Collective Intelligence - Ignore the web 2.0 rubbish this book will explain the basics of things like how Amazon recommends similar products, optimizing searches, genetic algorithms etc. Examples in Python but easily readable to any programmer:<br />
<a href="http://www.amazon.co.uk/Programming-Collective-Intelligence-Building-Applications/dp/0596529325/ref=sr_1_1?ie=UTF8amp;s=booksamp;qid=1233404537amp;sr=8-1">http://www.amazon.co.uk/Programming-Collective-Intelligence-Building-Applications/dp/0596529325/ref=sr_1_1?ie=UTF8amp;s=booksamp;qid=1233404537amp;sr=8-1</a> 
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/January/66" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>65</id>
<published>1/11/2009 12:00:00 AM</published>
<updated>1/11/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">1/11/2009 12:00:00 AM</app:edited>
<title>Azure Storage and REST API</title>
<content type="html"><![CDATA[<strong>Storage in Windows Azure<br />
</strong>I have been working with Windows Azure lately and taking a look into Azure Storage. <br />
<br />
For storing data you want to keep indefinatly in Windows Azure you have two main options:<br />
• Azure Storage <br />
• SQL Data Services<br />
<br />
You can think of Azure storage as being intended for storing file or data with a simple strucure. <br />
SQL data services offers a much richer query interface and is better suited for more complex data schemas. <br />
<br />
The differences are summarized below: <br />
<br />
<strong>Azure Storage</strong> <br />
• Higher performance than SQL Data Services<br />
• Stores Blobs, Queues and non relational tables<br />
• Will be cheaper than SQL Data Services <br />
• Does not use SQL Server (The development version does through)<br />
• Is not relational and doesnt use SQL query language<br />
• Access is provided by the REST API<br />
<br />
<strong>SQL Data Services</strong><br />
• Uses SQL Server behind the scences... but is NOT like SQL Server. If anything it ressembles Azure Storage tables (we will look at these shortly)<br />
• Everything is accessed in a RESTful manner using REST or SOAP similar to Azure Storage tables REST API<br />
• Feature support for complex relational queries <br />
• Concurrency support<br />
• Will be more expensive than Azure Storage<br />
• Future functionality will include aggregates, distributed queries, schemas, reporting, analytics and ETL functionality (Extract, Load and Transform)<br />
• Items are held in authorities and containers<br />
<strong><br />
Azure Storage</strong><br />
Azure storage allows you to store 3 types of data:<br />
<ul>
    <li>Blobs (files and large strings </li>
    <li>Queues (made up of messages to be processed in first in first out order) </li>
    <li>Tables (stores class objects) </li>
</ul>
<p>To work with Azure storage currently you have 2 options:<br />
• Make a request to the REST API directly<br />
• Utilize StorageClient wrapper classes to access the REST API<br />
<br />
So as you can see the choice is ultimatly REST API or er REST API! </p>
<p><strong>StorageClient<br />
</strong>To ease working with the REST API in the Azure SDK samples is a wrapper class called StorageClient. StorageClient is great for putting together test applications and understanding how Azure Storage works but Microsoft dont advise you to use it for live applications.<br />
<br />
<strong>Lets REST for a minute<br />
</strong>If you are not familiar with REST, REST stands for Representational State Transfer and is a style of architecture introduced by a guy named Roy Fielding (one of the main authors of http protocol). <br />
<br />
You can read more about what Roy proposed at: <a href="http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm">http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm</a><br />
<br />
Applications implementing Roy’s proposed architecture are sometimes described as RESTful. <br />
<br />
I don’t want to get into a debate about what exactly constitutes a RESTful system (some people feel scarily passionate about this) so the important points to note for our purposes are that: </p>
<p>• There is no state in REST applications <br />
• Everything is abstracted into a resource which is accessible by a unique address</p>
<p>This might not seem a big deal but these characteristics are essential for cloud based applications. These features allow inter platform operability, easy integration and allow us to easily scale out our applications by taking advantage of features aimed for website performance such as caching and load balancing. There is no difference at an http level from a request to Azure storage to a web page request. <br />
<br />
<strong>Using REST API directly</strong><br />
I wanted to understand what StorageClient was doing behind the scenes with the REST API so I put together the following code (with help from David Lemphers article at: <span><a href="http://blogs.msdn.com/davidlem/archive/2008/12/20/windows-azure-storage-exploring-blobs.aspx"><span><span style="color: #0000ff">http://blogs.msdn.com/davidlem/archive/2008/12/20/windows-azure-storage-exploring-blobs.aspx</span></span></a>) to list the containers present in the system.<br />
<br />
</span><strong>Overview of how we access Azure Storage Rest API</strong><br />
1. A request is made to a URL and port. The following URL for example is used to retrieve a list of containers held in Azure Storage:<br />
<a href="http://127.0.0.1:10000/devstoreaccount1/devstoreaccount1?comp=list">http://127.0.0.1:10000/devstoreaccount1/devstoreaccount1?comp=list</a><br />
2. We then set a number of headers in the request <br />
3. We set the http verb of the request to describe what we are doing e.g. GET, PUT etc<br />
4. Calculate a hash of the headers and a hidden key so no one can modify the request and Azure Storage can authenticate us<br />
5. Azure Storage will then give us our results back as XML<br />
<br />
Okay let's create our test application now.<br />
<br />
<strong>Example Application</strong><br />
Create a new console application<br />
<br />
Add the following using statement:<br />
<br />
<span style="color: #0000ff">using</span> System.Net;<br />
<br />
Enter the following code </p>
<div style="font-size: 10pt; background: white; color: black; font-family: courier new">
<div style="font-size: 10pt; background: white; color: black; font-family: courier new">
<p style="margin: 0px"><span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Main(<span style="color: #0000ff">string</span>[] args)</p>
<p style="margin: 0px">{</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"><span style="color: #008000">//Gets a list of containers</span></p>
<p style="margin: 0px"><span style="color: #0000ff">string</span> AccountName = <span style="color: #a31515">"devstoreaccount1"</span>;</p>
<p style="margin: 0px"><span style="color: #0000ff">string</span> AccountSharedKey = <span style="color: #a31515">"Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="</span>;</p>
<p style="margin: 0px"><span style="color: #0000ff">string</span> Address = <span style="color: #a31515">"http://127.0.0.1"</span>;</p>
<p style="margin: 0px"><span style="color: #0000ff">string</span> Port = <span style="color: #a31515">"10000"</span>;</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"><span style="color: #008000">//Action to perform e.g. ?comp=list</span></p>
<p style="margin: 0px"><span style="color: #0000ff">string</span> QueryString = <span style="color: #a31515">"?comp=list"</span>;</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"><span style="color: #0000ff">string</span> uri = Address + <span style="color: #a31515">":"</span> + Port + <span style="color: #a31515">"/"</span> + AccountName + QueryString;</p>
<p style="margin: 0px"><span style="color: #0000ff">string</span> MessageSignature = <span style="color: #a31515">""</span>;</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"><span style="color: #008000">//Build Request</span></p>
<p style="margin: 0px"><span style="color: #2b91af">HttpWebRequest</span> Request = (<span style="color: #2b91af">HttpWebRequest</span>)<span style="color: #2b91af">HttpWebRequest</span>.Create(uri);</p>
<p style="margin: 0px">Request.Method = <span style="color: #a31515">"GET"</span>;</p>
<p style="margin: 0px">Request.ContentLength = 0;</p>
<p style="margin: 0px">Request.Headers.Add(<span style="color: #a31515">"x-ms-date"</span>, <span style="color: #2b91af">DateTime</span>.UtcNow.ToString(<span style="color: #a31515">"R"</span>));</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"><span style="color: #008000">//Create signaure of message contents </span></p>
<p style="margin: 0px">MessageSignature += <span style="color: #a31515">"GET\n"</span>; <span style="color: #008000">//Verb</span></p>
<p style="margin: 0px">MessageSignature += <span style="color: #a31515">"\n"</span>; <span style="color: #008000">//MD5 (not used)</span></p>
<p style="margin: 0px">MessageSignature += <span style="color: #a31515">"\n"</span>; <span style="color: #008000">//Content-Type</span></p>
<p style="margin: 0px">MessageSignature += <span style="color: #a31515">"\n"</span>; <span style="color: #008000">//Date optional if using x-ms-date header</span></p>
<p style="margin: 0px">MessageSignature += <span style="color: #a31515">"x-ms-date:"</span> + Request.Headers[<span style="color: #a31515">"x-ms-date"</span>] + <span style="color: #a31515">"\n"</span>; <span style="color: #008000">//Date</span></p>
<p style="margin: 0px">MessageSignature += <span style="color: #a31515">"/"</span> + AccountName + <span style="color: #a31515">"/"</span> + AccountName + QueryString; <span style="color: #008000">//resource</span></p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"><span style="color: #008000">//Encode signature using HMAC-SHA256</span></p>
<p style="margin: 0px"><span style="color: #0000ff">byte</span>[] SignatureBytes = System.Text.<span style="color: #2b91af">Encoding</span>.UTF8.GetBytes(MessageSignature);</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">System.Security.Cryptography.<span style="color: #2b91af">HMACSHA256</span> SHA256 = <span style="color: #0000ff">new</span> System.Security.Cryptography.<span style="color: #2b91af">HMACSHA256</span>(<span style="color: #2b91af">Convert</span>.FromBase64String(AccountSharedKey));</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"><span style="color: #008000">// Now build the Authorization header</span></p>
<p style="margin: 0px"><span style="color: #2b91af">String</span> AuthorizationHeader = <span style="color: #a31515">"SharedKey "</span> + AccountName + <span style="color: #a31515">":"</span> + <span style="color: #2b91af">Convert</span>.ToBase64String(SHA256.ComputeHash(SignatureBytes));</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"><span style="color: #008000">// And add the Authorization header to the request</span></p>
<p style="margin: 0px">Request.Headers.Add(<span style="color: #a31515">"Authorization"</span>, AuthorizationHeader);</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"><span style="color: #008000">//Get response</span></p>
<p style="margin: 0px"><span style="color: #2b91af">HttpWebResponse</span> Response = (<span style="color: #2b91af">HttpWebResponse</span>)Request.GetResponse();</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"><span style="color: #0000ff">using</span> (System.IO.<span style="color: #2b91af">StreamReader</span> sr = <span style="color: #0000ff">new</span> System.IO.<span style="color: #2b91af">StreamReader</span>(Response.GetResponseStream()))</p>
<p style="margin: 0px">{</p>
<p style="margin: 0px"><span style="color: #2b91af">Console</span>.WriteLine(sr.ReadToEnd());</p>
<p style="margin: 0px">}</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">}</p>
<p>Ensure Azure Storage is running<br />
Press F5 to run your application<br />
The application should then list all the containers in your application in an XML format:</p>
<br />
lt;?xml version="1.0" encoding="utf-8"?gt;<br />
lt;EnumerationResults AccountName="<a href="http://127.0.0.1:10000/devstoreaccount1">http://127.0.0.1:10000/devstoreaccount1</a>"gt;<br />
lt;Containersgt;<br />
lt;Containergt;<br />
lt;Namegt;alexgallerylt;/Namegt;<br />
lt;Urlgt;http://127.0.0.1:10000/devstoreaccount1/alexgallerylt;/Urlgt;<br />
lt;LastModifiedgt;Sat, 03 Jan 2009 19:49:21 GMTlt;/LastModifiedgt;<br />
lt;Etaggt;0x8CB3BF381CA452Flt;/Etaggt;<br />
lt;/Containergt;<br />
lt;Containergt;<br />
lt;Namegt;testgallerylt;/Namegt;<br />
lt;Urlgt;http://127.0.0.1:10000/devstoreaccount1/testgallerylt;/Urlgt;<br />
lt;LastModifiedgt;Mon, 10 Nov 2008 22:32:58 GMTlt;/LastModifiedgt;<br />
lt;Etaggt;0x8CB119B6B02863Dlt;/Etaggt;<br />
lt;/Containergt;<br />
lt;/Containersgt;<br />
lt;NextMarker /gt;<br />
lt;/EnumerationResultsgt;
<p> </p>
<p>For futher information on the REST API consult the SDK documentation at: <span>C:\Program Files\Windows Azure SDK\v1.0\doc\ServiceHostingSDK</span></p>
</div>
<p style="margin: 0px"><!--EndFragment--></p>
</div>
<!--EndFragment-->
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/AzureStorageandRESTAPI/65" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>64</id>
<published>1/10/2009 12:00:00 AM</published>
<updated>1/10/2009 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">1/10/2009 12:00:00 AM</app:edited>
<title>Parallelization in framework 4</title>
<content type="html"><![CDATA[<strong>Parallelization <br />
</strong>Until recently CPU manufactures regularly released faster processors. Recent speed increases have leveled off due to issues such as power consumption and heat dissipation. No doubt these issues will at some point be resolved but until this happens manufacturers are instead concentrating on producing CPU’s with multiple cores to increase processing speed. <br />
<br />
Multi core or dual CPU’s allow you to run code at the same time (in parallel). This can result in calculations being performed quicker and applications running faster. <br />
<br />
Applications have to be specifically designed to take advantage of multi-core/cpu functionality and not all code will necessarily benefit from running on a multi-core system. Writing code to run in parallel is tricky and has a number of issues similar to those you may have encountered when working with threads. <br />
Microsoft foresaw the coming so called multi-core shift and added new features to enable developers to take advantage of multi cores in an easy and consistent way. <br />
<br />
Some of the parallelization enhancements in .net 4 have been released previously as an installable addition called Parallel Extensions. <br />
<br />
In .net 4 these enhancements are included at CLR level in mscorlib.dll rather than as an additional install. <br />
<br />
<strong>What applications will benefit from parallelism? <br />
</strong><br />
Most applications will contain some segments of code that will benefit from parallelization and some that will not. <br />
<br />
Code that is likely to benefit from being run in parallel will have the following characteristics:<br />
<br />
<ul>
    <li>Can be easily divided into self contained units </li>
    <li>Has no dependencies on other bits of code </li>
    <li>Does not communicate with other areas of code that are also being run in parallel </li>
</ul>
</p>

<p>
A classic example of code that would benefit from being run in parallel is code that iterates through stock quotes and performs a long running calculation on each quote. As each individual calculation is independent from the others it can be run in parallel so the overall task is completed quicker. <br />
Some people like to refer to problems such as above as embarrassingly parallel in that they are very suited for the benefits of parallelization. <br />
<br />
<strong>Crap Code running in parallel is just Parallelized crap code!<br />
</strong>Before trying to speed up any code by parallelizing it, check that you cannot optimize it any further. Crap code running in parallel is still just parallelized crap code and is still likely to be quite slow! Done that? Okay you are ready to look at the Parallel Enhancements. <br />
<br />
The parallel extensions and enhancements can be divided into 5 areas:<br />
<ul>
    <li>Task Parallel Library (TPL) and Concurrency Run time </li>
    <li>Parallel LINQ (PLINQ) </li>
    <li>Coordination data structures (LazyInit etc) </li>
    <li>Parallel Pattern Library </li>
    <li>Debugging and profiling tools </li>
</ul>
</p>
<p>
To learn about the extensions I suggest you download the Visual Studio 2010 CTP and check out the following websites:<br />
<a href="http://blogs.msdn.com/pfxteam/" target="_blank">http://blogs.msdn.com/pfxteam/<br />
</a><a href="http://www.danielmoth.com/Blog/" target="_blank">http://www.danielmoth.com/Blog/</a><br />
<a href="http://channel9.msdn.com/pdc2008/TL26/" target="_blank">http://channel9.msdn.com/pdc2008/TL26/<br />
</a>
</p>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/Parallelizationinframework4/64" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>63</id>
<published>12/31/2008 12:00:00 AM</published>
<updated>12/31/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">12/31/2008 12:00:00 AM</app:edited>
<title>Update and Happy New Year</title>
<content type="html"><![CDATA[I havent written much lately as have been very busy working on my book. <br />
<br />
I cant say  too much about this at present as Apress wont allow me to yet, however more details coming soon...<br />
<br />
I would like recommend a very interesting book I have been reading about Neural Networks called Introduction to Neural Networks for C#, Second Edition<br />
<a href="http://www.heatonresearch.com/online/introduction-neural-networks-cs-edition-2">http://www.heatonresearch.com/online/introduction-neural-networks-cs-edition-2</a><br />
<br />
Introduction to Neural Networks for C#, Second Edition is the first book that I have read that expains beyond the basics of how neural networks work and manages to avoid too much maths (unlike most other AI books). I also came across a very interesting AI blog at: <a href="http://dynamicnotions.blogspot.com/">http://dynamicnotions.blogspot.com/</a><br />
<br />
Next year we will have a few changes to DevEvening:<br />
<br />
First of all we have a new venue, The Bird in hand pub in Mayford which will offer cheaper food and beer! <br />
We will vary our evenings with member and professional speakers<br />
We have 2 excellent speakers joining us Andrew Fryer and Craig Murphey on the next meeting on Jan 29th<br />
I also have other speakers such as Jon Skeet, Dinis Cruz and Andrew Dean lined up for the future<br />
<br />
So lots to look forward too,<br />
<br />
All the best for the new year! <br />
 <br />
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/UpdateandHappyNewYear/63" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>62</id>
<published>12/10/2008 12:00:00 AM</published>
<updated>12/10/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">12/10/2008 12:00:00 AM</app:edited>
<title>Genetic Algorithms</title>
<content type="html"><![CDATA[<p>On Reddit someone posted an excellent animation that demonstrated genetic algorithms (GA). The example shows GA refining a vehicle to move over bumpy terrain:<a href="http://www.wreck.devisland.net/ga/"><br />
</a><a href="http://www.wreck.devisland.net/ga/">http://www.wreck.devisland.net/ga/</a><br />
<br />
But how does a genetic algorithm work?<br />
<br />
The basic idea is actually pretty simple although I bet the implemention is trickier (most notably the breeding part!)</p>
<ol>
    <li>A set of initial solutions to try is created </li>
    <li>These are then tried against a specific task (in this case can the vehicle move across the terrain) this is called the fitness function. </li>
    <li>Some vehicles will move better over the terrain than others these will be given a higher fitness rating </li>
    <li>The GA then selects the solutions with the best rating. To stop future solutions becoming too similar and converging a few random of the not so successful solutions from the previous group are also "bred" </li>
    <li>These solutions are then bred together in an attempt to produce better solutions </li>
</ol>
<p> </p>
<p>Pretty cool eh?<br />
<br />
For more information Wikipedia as usual is our friend:<br />
<a href="http://en.wikipedia.org/wiki/Genetic_algorithm">http://en.wikipedia.org/wiki/Genetic_algorithm</a></p>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/GeneticAlgorithms/62" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>61</id>
<published>11/17/2008 12:00:00 AM</published>
<updated>11/17/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">11/17/2008 12:00:00 AM</app:edited>
<title>Any DevEvening members looking for a new position</title>
<content type="html"><![CDATA[New DevEvening member Rusty has contacted me to see if anyone is looking for a new position. <br />
<br />
You would be working at Rusty's startup company Incuvis (<a href="http://www.incuvis.com">www.incuvis.com</a>)<br />
<br />
Rusty says:<br />
<em>"We're currently looking to work with a lead developer for our venture, it's a typical risk-reward model and we can share equity.<br />
<br />
We're developing radically new business risk intelligence software. Core skills will be ASP.net (we think ...) and charting tools and moving<br />
towards MS Silverlight. An understand of analytics and data would also be a bonus."</em><br />
<br />
If this sounds like you please email sarim at incuvis.com. 
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/AnyDevEveningmemberslookingforanewposition/61" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>60</id>
<published>11/9/2008 12:00:00 AM</published>
<updated>11/9/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">11/9/2008 12:00:00 AM</app:edited>
<title>Azure first look</title>
<content type="html"><![CDATA[One of the most exciting upcoming technologies is Windows Azure.  <br />
<br />
Azure is Microsoft's cloud computing platform and made up of a number of components and services.<br />
<br />
Azure can be split into a number of technologies (not all of which are currently available)<br />
<br />
<ul>
    <li>.Net Services (Message broker, security and Workflow hosting) </li>
    <li>SQL Services (an online database accessed using REST) </li>
    <li>Live Services (a number of different services from interfacing with messanger to sending alerts) </li>
    <li>Sharepoint Services </li>
    <li>Microsoft CRM </li>
</ul>
<p>Currently .net and to some degree SQL services are available. <br />
<br />
To play around with Azure you need to register so sign up at: <a href="http://www.microsoft.com/azure/register.mspx">http://www.microsoft.com/azure/register.mspx</a>. <br />
<br />
Microsoft will then send you a key (mine took about a week to arrive) allowing you to access the online facilities. <br />
<br />
Until you get this key you can still play around to an extentby downloading the SDK: <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=BB893FB0-AD04-4FE8-BB04-0C5E4278D3E9amp;displaylang=en">http://www.microsoft.com/downloads/details.aspx?FamilyId=BB893FB0-AD04-4FE8-BB04-0C5E4278D3E9amp;displaylang=en</a>. <br />
<br />
I suggest you also download the tools for visual studio from <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=63D0D248-1B08-4F7D-ABDE-62EB75CB1E69amp;displaylang=en">http://www.microsoft.com/downloads/details.aspx?FamilyId=63D0D248-1B08-4F7D-ABDE-62EB75CB1E69amp;displaylang=en</a>. As this is beta software you probably want to be running it in virtual pc (although I didnt and everything seems fine still).<br />
<br />
The first thing you should do is watch <strong>Steve Marx's</strong> presentation on developing an application in Azure at: <a href="http://channel9.msdn.com/pdc2008/ES01/"><span style="color: #2e58c2">http://channel9.msdn.com/pdc2008/ES01/</span></a><br />
Steve is an excellent preseter, great to watch and will take you through the basics of Windows Azure.<br />
<br />
After installing the Visual Studio tools you can create Web Cloud service ASP.net projects. Cloud projects are very similar to standard ASP.net projects but contain another project that has some additional files that describe where the service is hosted and configuration settings (.<strong>csdef</strong> and .<strong>cscfg</strong>). <br />
<br />
If you look at the project name in Visual Studio you will see it is called something like CloudService1_webRole. Role is a term within Azure that seems to describe the type of service you are running. If you right click on the service project you can deploy it to the cloud (which they havent given me access to yet). <br />
<br />
As it would be inconvenient to deploy your app every time you wanted to test it Microsoft provide an application called the development fabric which simulates how it will function in the cloud (below). If you open the cscfg in studio you will see its an XML file that contains the following:<br />
<br />
<span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">lt;?</span></span><span style="font-size: 13px; color: #a31515"><span style="font-size: 13px; color: #a31515">xml</span></span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff"> </span></span><span style="font-size: 13px; color: #ff0000"><span style="font-size: 13px; color: #ff0000">version</span></span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">=</span></span><span style="font-size: 13px">"</span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">1.0</span></span><span style="font-size: 13px">"</span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">?gt;<br />
lt;</span></span><span style="font-size: 13px; color: #a31515"><span style="font-size: 13px; color: #a31515">ServiceConfiguration</span></span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff"> </span></span><span style="font-size: 13px; color: #ff0000"><span style="font-size: 13px; color: #ff0000">serviceName</span></span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">=</span></span><span style="font-size: 13px">"</span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">CloudService3</span></span><span style="font-size: 13px">"</span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff"> </span></span><span style="font-size: 13px; color: #ff0000"><span style="font-size: 13px; color: #ff0000">xmlns</span></span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">=</span></span><span style="font-size: 13px">"</span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration</span></span><span style="font-size: 13px">"</span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">gt;<br />
lt;</span></span><span style="font-size: 13px; color: #a31515"><span style="font-size: 13px; color: #a31515">Role</span></span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff"> </span></span><span style="font-size: 13px; color: #ff0000"><span style="font-size: 13px; color: #ff0000">name</span></span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">=</span></span><span style="font-size: 13px">"</span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">WebRole</span></span><span style="font-size: 13px">"</span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">gt;<br />
lt;</span></span><span style="font-size: 13px; color: #a31515"><span style="font-size: 13px; color: #a31515">Instances</span></span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff"> </span></span><span style="font-size: 13px; color: #ff0000"><span style="font-size: 13px; color: #ff0000">count</span></span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">=</span></span><span style="font-size: 13px">"</span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">1</span></span><span style="font-size: 13px">"</span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">/gt;<br />
lt;</span></span><span style="font-size: 13px; color: #a31515"><span style="font-size: 13px; color: #a31515">ConfigurationSettings</span></span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">gt;<br />
lt;/</span></span><span style="font-size: 13px; color: #a31515"><span style="font-size: 13px; color: #a31515">ConfigurationSettings</span></span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">gt;<br />
lt;/</span></span><span style="font-size: 13px; color: #a31515"><span style="font-size: 13px; color: #a31515">Role</span></span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">gt;<br />
lt;/</span></span><span style="font-size: 13px; color: #a31515"><span style="font-size: 13px; color: #a31515">ServiceConfiguration</span></span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">gt;<br />
<br />
</span></span>If you alter the instances count element and run the app you will see more instances created in development fabric. This simulates adding capacity to your Azure application e.g. if you are expecting many visitors to hit the site. <br />
<br />
<img alt="" src="http://www.simpleIsBest.co.uk/content/UploadImages/azureDevFabric.gif" /> <br />
<br />
<br />
Once you have your key and have activated it you can log into the Azure services platform. This will take you to an interface like the screen shot below. At present its a bit rough around the edges but you can see the direction they are going. <br />
<br />
<img alt="" src="http://www.simpleIsBest.co.uk/content/UploadImages/azure1.gif" /> <br />
<br />
Currently within .net services you have access to 3 components:</p>
<ul>
    <li>Service Bus (acts as a broker/intermediatry for messages) </li>
    <li>Workflow (hosts workflow) </li>
    <li>Access control service (authentication and authorization) </li>
</ul>
<p>The examples provided in the SDK take you through the basics of how these work. There is an example of a chat application that sends messages via the service broker. What is impressive is the speed of it, no noticable delay at all. There is also another example application to demonstrate the security features )(a calculator app). This threw an security exception when I tried to run it about token being valid 10 seconds after it was requested?! <br />
<br />
Security is defined by an input claim e.g. a specific username which is then matched to Output claims (e.g. in the included example give the ability to multiply). <br />
<br />
<img alt="" src="http://www.simpleIsBest.co.uk/content/UploadImages/azureSecurity.gif" /> <br />
<br />
<img alt="" src="http://www.simpleIsBest.co.uk/content/UploadImages/azureWorkflow.gif" /> <br />
<br />
<br />
Some of the examples are a bit cryptic at present and I would suggest brush up on your WCF and Workflow as these concepts will certainly be used. <br />
<br />
It all looks really promising so far and I cant wait to learn more about it. </p>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/Azurefirstlook/60" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>59</id>
<published>11/6/2008 12:00:00 AM</published>
<updated>11/6/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">11/6/2008 12:00:00 AM</app:edited>
<title>Must watch PDC sessions</title>
<content type="html"><![CDATA[I have been watching a number of the PDC sessions online (much to the annoyance of my wife who failed to get excited about parallel programming). The Silverlight player works very well making them the sessions easy to watch.<br />
<br />
I would recommend the following as highlights (for me anyway)<br />
<br />
Day 2 Keynote<br />
<a href="http://mschnlnine.vo.llnwd.net/d1/pdc08/WMV-HQ/KYN02.wmv">http://mschnlnine.vo.llnwd.net/d1/pdc08/WMV-HQ/KYN02.wmv</a><br />
Okay you should probably watch day 1 for all the Azure stuff but I found day 2 more interesting. Very slick Tesco's WPF application.<br />
<br />
Future of C#<br />
<a href="http://channel9.msdn.com/pdc2008/TL16/">http://channel9.msdn.com/pdc2008/TL16/</a><br />
Anders is an excellent speaker and a very interesting session.<br />
<br />
Parallel Programming<br />
<a href="http://channel9.msdn.com/pdc2008/TL26/">http://channel9.msdn.com/pdc2008/TL26/</a><br />
Daniel Moth presents an excellent session demonstrating some of the parallel enhancements. <br />
<br />
Introduction to F#<br />
<a href="http://mschnlnine.vo.llnwd.net/d1/pdc08/WMV-HQ/TL11.wmv">http://mschnlnine.vo.llnwd.net/d1/pdc08/WMV-HQ/TL11.wmv</a><br />
Excellent talk on the basics of F# and demonstration of some of the advantages<br />
<br />
A lap around Oslo<br />
<a href="http://mschnlnine.vo.llnwd.net/d1/pdc08/WMV-HQ/TL23.wmv">http://mschnlnine.vo.llnwd.net/d1/pdc08/WMV-HQ/TL23.wmv</a><br />
Take a first look at "M" <br />
<br />
Developing and deploying your first Windows Azure service<br />
<a href="http://channel9.msdn.com/pdc2008/ES01/">http://channel9.msdn.com/pdc2008/ES01/</a><br />
Good demo of Azure with MVC application<br />
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/MustwatchPDCsessions/59" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>58</id>
<published>11/2/2008 12:00:00 AM</published>
<updated>11/2/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">11/2/2008 12:00:00 AM</app:edited>
<title>DevEvening update</title>
<content type="html"><![CDATA[I have made a couple of textual changes to the site and made the forms a bit easier to use. At some point I need to sort out the layout for logged in users as it has just been all plonked on one page due to time constraints.  <br />
<br />
There is now a feedback page at:<br />
<a href="http://www.devevening.co.uk/suggest.aspx">http://www.devevening.co.uk/suggest.aspx</a><br />
<br />
This allows users to send feedback about DevEvening and suggest possible future sessions. <br />
<br />
I am currently talking to <strong>Jon Skeet</strong>, MVP and author of the book C# in depth (<a href="http://csharpindepth.com/">http://csharpindepth.com/</a>). With any luck Jon will be coming to DevEvening at some point next year to give a talk on C#. Jon is very active in the community and frequently answers questions my current fav site StackOverflow. A number of people have recommended Jon's book to me which I have ordered and look forward to reading when Amazon deliver it. 
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/DevEveningupdate/58" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>57</id>
<published>10/30/2008 12:00:00 AM</published>
<updated>10/30/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">10/30/2008 12:00:00 AM</app:edited>
<title>XSS, MVC and JSON</title>
<content type="html"><![CDATA[Earlier I noticed an issue with my blogging engine. I had recently added the abiity to add comments to posts using JSON (described in <a href="http://www.simpleisbest.co.uk/Blog/BlogEntryDetail/JSONandMVC?id=53">http://www.simpleisbest.co.uk/Blog/BlogEntryDetail/JSONandMVC?id=53</a>) and had made the classic mistake of not validating and encoding the users input. This would have allowed XSS attacks. Luckily no one tried this apart from me (something I almost take personally!).<br />
<br />
The mistake I had made was that I thought that the AJAX post would have been run through ASP.net's standard filters but apparently not. I wondered if this is to do with the dataType JSON attribute on the post but this made no difference. Will have to look into this further.<br />
<br />
I suspect with the upcoming use of JQuery and MVC a few people wll make this mistake. <br />
<br />
The important thing to remember is always encode user input when outputting it using Server.HtmlEncode method. 
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/XSS,MVCandJSON/57" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>56</id>
<published>10/28/2008 12:00:00 AM</published>
<updated>10/28/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">10/28/2008 12:00:00 AM</app:edited>
<title>Nevron offers prizes for DevEvening members</title>
<content type="html"><![CDATA[Today a company called Nevron contacted me to say they would like to offer their product Nevron Chart for .net lite edition as a prize for DevEvening members. Nevron produce very nice looking charting and diagram components. They have kindly offered to provide this as a prize for the next year at each DevEvening.<br />
<br />
I havent had a chance to use this component yet but they certainly look interesting and considerably cheaper than their competitors offerings. Having personally used a number of graphing components such as Infragistics, Telerik and Component Arts offering's I will be very interested to see what Nevron's component is like.  <br />
<br />
At the next DevEvening we will give away a licence for this component. <br />
<br />
Perhaps the first winner of the licence can let us all know how they get on with the product?<br />
<br />
For further information please look at:<br />
<a href="http://www.nevron.com/">http://www.nevron.com/</a>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/NevronoffersprizesforDevEveningmembers/56" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>55</id>
<published>10/27/2008 12:00:00 AM</published>
<updated>10/27/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">10/27/2008 12:00:00 AM</app:edited>
<title>Windows Azure</title>
<content type="html"><![CDATA[<p>Microsoft are putting the PDC sessions online at: <a href="http://microsoftpdc.com/">http://microsoftpdc.com/</a><br />
<br />
The site is struggling a bit at the moment but was running at a decent speed about 18:30 GMT. If you watch the key note and skip to about minute 24 you will get to the demos and skip the marketing spiel. As expected the key note from Ray Ozzie concentrated on Microsofts cloud computing strategy which they are naming Windows Azure (Azure sounds really irritating when spoken by an American). <br />
<br />
Windows Azure is a collection of service based components. The initial demo didnt show too much apart from someone deploying an ASP.net hello world application and then accessing it (erm couldnt we do that now). <br />
<br />
They then showed a social networking application called blue hoo (<a href="http://www.bluehoo.com/">http://www.bluehoo.com/</a>). Blue hoo detects other users running the software via bluetooth. I wasnt awed by it but it looked polished. The keynote stressed one of the nicest aspects of the Azure platform if the ability to easily scale it up by adding nodes (whatever that means in real terms) they also appear to have support for many different types of authentication. <br />
<br />
However the problem I have with cloud computing (apart from all the hype) is:</p>
<ul>
    <li>Is the current infrastructure really quick and reliable enough</li>
    <li>Can Microsoft really cope with huge demand (e.g the PDC site is struggling although to be fair there is a lot of video streaming going on)</li>
    <li>Some clients will object to data being hosted out of their organisation or country</li>
</ul>
<p>Having said this it does look interesting from the point of view of:</p>
<ul>
    <li>Let Microsoft manage the infrastructure</li>
    <li>Can start off small and easily scale application</li>
    <li>Cheaper? - we will have to wait and see! </li>
</ul>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/WindowsAzure/55" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>52</id>
<published>10/26/2008 12:00:00 AM</published>
<updated>10/26/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">10/26/2008 12:00:00 AM</app:edited>
<title>Add on to copy and paste Visual Studio code as HTML</title>
<content type="html"><![CDATA[Good tool (as mentioned in MSDN) that adds a new option in visual studio to copy as HTML. You can then paste it into your blog/website.<br />
<br />
Download from:<br />
<a href="http://www.jtleigh.com/people/colin/software/CopySourceAsHtml/">http://www.jtleigh.com/people/colin/software/CopySourceAsHtml/</a><br />
<br />
Example of results of copy html:<br />
<br />
<div style="font-size: 10pt; background: white; color: black; font-family: courier new">
<p style="margin: 0px">  <span style="color: #2b91af">DataContext</span> objCon = <span style="color: #0000ff">new</span> <span style="color: #2b91af">DataContext</span>(System.Configuration.<span style="color: #2b91af">ConfigurationSettings</span>.AppSettings.Get(<span style="color: #a31515">"ConnStr"</span>));</p>
<p style="margin: 0px">            <span style="color: #2b91af">Table</span>lt;<span style="color: #2b91af">BlogEntryComment</span>gt; objBlogEntryCommentTable = objCon.GetTablelt;<span style="color: #2b91af">BlogEntryComment</span>gt;();</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">            <span style="color: #0000ff">var</span> query = <span style="color: #0000ff">from</span> b <span style="color: #0000ff">in</span> objBlogEntryCommentTable</p>
<p style="margin: 0px">                        <span style="color: #0000ff">orderby</span> b.CommentDate</p>
<p style="margin: 0px">                        <span style="color: #0000ff">where</span> b.BlogEntryID ==BlogEntryID</p>
<p style="margin: 0px">                        <span style="color: #0000ff">select</span> b;</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px">            <span style="color: #0000ff">return</span> query.ToList();</p>
</div>
<!--EndFragment--><br />
<br />
<br />
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/AddontocopyandpasteVisualStudiocodeasHTML/52" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>53</id>
<published>10/26/2008 12:00:00 AM</published>
<updated>10/26/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">10/26/2008 12:00:00 AM</app:edited>
<title>JSON and MVC</title>
<content type="html"><![CDATA[When working with Javascript it is often necessary to return server side data without posting the entire page. Probably the simplest way to implement this in ASP.net is with a control such as the update panel. The update panel takes care of all the details for you however behind the scenes it also posts the entire page back which is pretty wasteful in terms of bandwidth if you want just a string value back. <br />
<br />
Other options include

<ul>
    <li>Decorated functions with the WebMethod attribute (although I have had problems using this with nested controls). </li>
    <li>Handcoding webservice calls (This is a pain to create and process the return data) </li>
    <li>JSON and JQuery </li>
</ul>
<p>Perhaps the best option if you just want a single value back is to use a format called JSON in conjuction with JQuery. <br />
<br />
JSON stands for Javascript object notation and is a very lightweight format to return a simple object. For example a stock quote result might look something like this:<br />
<br />
{Symbol:"MSFT",Value:"4.4"}<br />
<br />
I think we can all agree thats a lot less data than your average SOAP call and its pretty readable making JSON less heavy on bandwidth and probably quicker to process than XML (needs confirming!). Libraries such as JQuery understand JSON is an object which makes it very easy to work with e.g:<br />
<br />
alert(objMyResult.Value); <br />
<br />
Which is much preferable to processing XML from SOAP results etc...<br />
<br />
But how do you use this with ASP.net?<br />
<br />
Currently ASP.net and JSON support is pretty ropey (however nothing to stop you returning JSON formatted strings). In the MVC framework there is some nice inbuilt functionality for dealing with JSON posts in controllers. I decided to add the ability for users to comment on my blog posts and decided to implement this with MVC. The client side code is below and can be seen in action by commenting on any of the blog posts. Note you will need JQuery to use this code and currently the Json result class is only included in MVC projects (System.Web.MVC). </p>
<br />
<br />
<p>Client side code:</p>
<span style="font-size: 13px">
<p> </p>
</span>
<p><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">function</span></span><span style="font-size: 13px"> submit()
<p>{</p>
</span></p>
<p>nbsp;</p>
<p> </p>
<p><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">var</span></span><span style="font-size: 13px"> strName = $(</span><span style="font-size: 13px; color: #a31515"><span style="font-size: 13px; color: #a31515">"#txtName"</span></span><span style="font-size: 13px">).val();<br />
</span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">var</span></span><span style="font-size: 13px"> strEmail = $(</span><span style="font-size: 13px; color: #a31515"><span style="font-size: 13px; color: #a31515">"#txtEmail"</span></span><span style="font-size: 13px">).val();<br />
</span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">var</span></span><span style="font-size: 13px"> strComment = $(</span><span style="font-size: 13px; color: #a31515"><span style="font-size: 13px; color: #a31515">"#txtComment"</span></span><span style="font-size: 13px">).val();<br />
</span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">var</span></span><span style="font-size: 13px"> strSpamCheck = $(</span><span style="font-size: 13px; color: #a31515"><span style="font-size: 13px; color: #a31515">"#txtSpamCheck"</span></span><span style="font-size: 13px">).val();<br />
</span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">var</span></span><span style="font-size: 13px"> rand1=window.rand1;<br />
</span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">var</span></span><span style="font-size: 13px"> rand2=window.rand2;
<p>$.ajax({<br />
type: </p>
</span></p>
<p>nbsp;</p>

<p><span style="font-size: 13px; color: #a31515"><span style="font-size: 13px; color: #a31515">"POST"</span></span><span style="font-size: 13px">,<br />
dataType: </span><span style="font-size: 13px; color: #a31515"><span style="font-size: 13px; color: #a31515">"json"</span></span><span style="font-size: 13px">,<br />
url: </span><span style="font-size: 13px; color: #a31515"><span style="font-size: 13px; color: #a31515">"lt;%=Application["</span></span><span style="font-size: 13px">URLRoot</span><span style="font-size: 13px; color: #a31515"><span style="font-size: 13px; color: #a31515">"].ToString() + "</span></span><span style="font-size: 13px">BlogEntryComment/Submit?id=</span><span style="font-size: 13px; color: #a31515"><span style="font-size: 13px; color: #a31515">" + objBlogEntry.BlogEntryID.ToString() %gt;"</span></span><span style="font-size: 13px">,<br />
data: { Email: strEmail, Name: strName, Comment: strComment, SpamCheck: strSpamCheck, Rand1: rand1, Rand2: rand2},<br />
success: </span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">function</span></span><span style="font-size: 13px">(result) {<br />
$(</span><span style="font-size: 13px; color: #a31515"><span style="font-size: 13px; color: #a31515">"#CommentEntry"</span></span><span style="font-size: 13px">).fadeOut(</span><span style="font-size: 13px; color: #a31515"><span style="font-size: 13px; color: #a31515">"slow"</span></span><span style="font-size: 13px">);<br />
setTimeout(redirect,2000);<br />
},<br />
error: </span><span style="font-size: 13px; color: #0000ff"><span style="font-size: 13px; color: #0000ff">function</span></span><span style="font-size: 13px">(error) {<br />
alert(</span><span style="font-size: 13px; color: #a31515"><span style="font-size: 13px; color: #a31515">'error '</span></span><span style="font-size: 13px">);<br />
}
<p> </p>
<p>});<br />
}</p>
</span></p>
<p>nbsp;</p>
<p> </p>
<p>Then server side I use this code in my controller class for processing BlogEntryComments:</p>
<div style="font-size: 10pt; background: white; color: black; font-family: courier new">
<p style="margin: 0px"><span style="color: #0000ff">public</span> <span style="color: #2b91af">JsonResult</span> Submit(<span style="color: #0000ff">string</span> Email, <span style="color: #0000ff">string</span> Name, <span style="color: #0000ff">string</span> Comment, <span style="color: #0000ff">int</span> SpamCheck, <span style="color: #0000ff">int</span> Rand1, <span style="color: #0000ff">int</span> Rand2)</p>
<p style="margin: 0px">{</p>
<p style="margin: 0px"><span style="color: #0000ff">if</span> (SpamCheck != (Rand1 + Rand2))</p>
<p style="margin: 0px">{</p>
<p style="margin: 0px"><span style="color: #0000ff">return</span> Json(<span style="color: #0000ff">new</span> { message = <span style="color: #a31515">"SPAM"</span> }); </p>
<p style="margin: 0px">}</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"><span style="color: #0000ff">if</span> (Comment == <span style="color: #a31515">""</span>)</p>
<p style="margin: 0px">{</p>
<p style="margin: 0px"><span style="color: #0000ff">return</span> Json(<span style="color: #0000ff">new</span> { message = <span style="color: #a31515">"SUCCESS"</span> });</p>
<p style="margin: 0px">}</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"><span style="color: #0000ff">if</span> (<span style="color: #a31515">""</span> + Name.Trim() == <span style="color: #a31515">""</span>)</p>
<p style="margin: 0px">{</p>
<p style="margin: 0px">Name = <span style="color: #a31515">"Anon"</span>;</p>
<p style="margin: 0px">}</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"><span style="color: #2b91af">DataContext</span> objCon = <span style="color: #0000ff">new</span> <span style="color: #2b91af">DataContext</span>(System.Configuration.<span style="color: #2b91af">ConfigurationSettings</span>.AppSettings.Get(<span style="color: #a31515">"ConnStr"</span>));</p>
<p style="margin: 0px"><span style="color: #2b91af">Table</span>lt;<span style="color: #2b91af">BlogEntryComment</span>gt; objBlogEntryCommentTable = objCon.GetTablelt;<span style="color: #2b91af">BlogEntryComment</span>gt;();</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"><span style="color: #2b91af">BlogEntryComment</span> objBlogEntryComment = <span style="color: #0000ff">new</span> <span style="color: #2b91af">BlogEntryComment</span>();</p>
<p style="margin: 0px">objBlogEntryComment.IP = System.Web.<span style="color: #2b91af">HttpContext</span>.Current.Request.UserHostAddress.ToString();</p>
<p style="margin: 0px">objBlogEntryComment.BlogEntryID=<span style="color: #2b91af">Convert</span>.ToInt32(Request.QueryString[<span style="color: #a31515">"id"</span>]);</p>
<p style="margin: 0px">objBlogEntryComment.CommentDate = System.<span style="color: #2b91af">DateTime</span>.Now;</p>
<p style="margin: 0px">objBlogEntryComment.Name = <span style="color: #a31515">""</span> + Name;</p>
<p style="margin: 0px">objBlogEntryComment.Email = <span style="color: #a31515">""</span> + Email;</p>
<p style="margin: 0px">objBlogEntryComment.Comment = <span style="color: #a31515">""</span> + Comment;</p>
<p style="margin: 0px">objBlogEntryComment.Approved = 0;</p>
<p style="margin: 0px">objBlogEntryCommentTable.InsertOnSubmit(objBlogEntryComment);</p>
<p style="margin: 0px">objCon.SubmitChanges();</p>
<p style="margin: 0px"> </p>
<p style="margin: 0px"><span style="color: #0000ff">return</span> Json(<span style="color: #0000ff">new</span> { message = <span style="color: #a31515">"SUCCESS"</span> });</p>
<p style="margin: 0px">}</p>
</div>
<!--EndFragment--><br />
<p>If you want to adapt this for you own use couple of things to note:</p>
<ul>
    <li>Parameter names for the server side function must match exactly what you declare in the client side Javascript </li>
    <li>Make sure you are posting it to the right controller and URL - this can be confusing if your running on debug with the inbuilt webserver. I found it best to attach to process </li>
</ul>
<p> </p>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/JSONandMVC/53" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>54</id>
<published>10/26/2008 12:00:00 AM</published>
<updated>10/26/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">10/26/2008 12:00:00 AM</app:edited>
<title>DevEvening Update</title>
<content type="html"><![CDATA[<strong>Swag update!</strong><br />
Microsoft have kindly sent me some T shirts and books to give away at next DevEvening (TechEd 97 no expense spared!). We have registered to be part of the SQL 2008 community launch which means that Ian and I at some point will be trained in SQL 2008 and then feed this knowledge back to DevEvening members. We will also receive a launch kit (not sure what that contains)<br />
<br />
<strong>Events</strong><br />
DeveloperDay books out in under 4hrs! Currently 3 DevEvening members are attending with one on the waitlist. <br />
<br />
PDC occuring this week in LA. Unless you are lucky enough to be attending all the sessions are going to be viewable online at Channel9 (<a href="http://channel9.msdn.com/">http://channel9.msdn.com/</a>)<br />
<br />
Microsoft emailed me about the UK equivalent occuring in March next year (<a href="http://www.devweek.com/pdd/">http://www.devweek.com/pdd/</a>). If you register now for the Professional developer day it is at the reduced price of £169 ex VAT until Dc. I plan on going to this event so let me know if you are attending. <br />
<br />
<strong>Changes to DevEvening site</strong><br />
Made the following changes to DevEvening website:<br />
<br />
Minor content changes on FAQ and register pages<br />
Ability to view other DevEvening users email addresses (if they have opted to allow this - to change this login, check the box marked show email to other users and click update)<br />
<br />
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/DevEveningUpdate/54" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>51</id>
<published>10/22/2008 12:00:00 AM</published>
<updated>10/22/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">10/22/2008 12:00:00 AM</app:edited>
<title>DD7 Registration Open</title>
<content type="html"><![CDATA[Book now or be disappointed!<br />
<br />
<a href="http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032393874amp;Culture=en-GB">http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032393874amp;Culture=en-GB</a><br />
<br />
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/DD7RegistrationOpen/51" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>50</id>
<published>10/20/2008 12:00:00 AM</published>
<updated>10/20/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">10/20/2008 12:00:00 AM</app:edited>
<title>Functional Programming and F Sharp</title>
<content type="html"><![CDATA[One of the terms I have heard banded about alot lately is Functional programming. But erm what exactly is it?<br />
<br />
Functional programming refers to a number of concepts in much the same way object orientated programming does so shouldnt be considered a set of rules. <br />
<br />
One of the fundamental concepts of functional programming is<br />
Once you declare a value <strong>it cannot be changed</strong> <br />
<br />
Now read that again and imagine writing a program without changing the values of any variables. <br />
<br />
Impossible? no, but certainly tricky..<br />
<br />
Below is an example of declaring a value in F# (Microsofts implementation of Functional Programming)<br />
<br />
<code>let a=1</code> <br />
<br />
However you could also do something like this:<br />
<br />
<code>let b=(a+a)</code> <br />
<br />
Or even<br />
<br />
<code>let c=(a+b*2)</code> <br />
<br />
You get the idea. Values are declared as functions (hence the functional bit!) and can be passed around to each other. <br />
<br />
Chances are you may have used some functional concepts already if you have done much work with LINQ lamda functions any one?<br />
<br />
But why would you want to do writ something in a functional way?<br />
<br />
<strong>Testability</strong><br />
If a function can only modify values within itself then theoretically it becomes easier to test and debug as you just need to detect the input and output of each function.<br />
You can use automated tools to test applications<br />
<br />
<strong>Concurrency</strong><br />
Running applications on multi core and multi cpu systems is going to become more common as hardware manufacturers reach the limit of current cooling technologies.  As a value can only be modified once you shouldnt need to worry about dead locks or race conditions.<br />
Possibility of creating hot swappable applications <br />
<br />
If this sounds interesting take a look at F#. It is downloadable from:<br />
<a href="http://research.microsoft.com/fsharp/fsharp.aspx">http://research.microsoft.com/fsharp/fsharp.aspx</a><br />
<br />
I have just started playing with it and it looks pretty interesting. Although it doesnt have any immediate uses for me it does contain a number of features that I suspect will make their way into the next version of c# (indeed its inventor added generics to c#). It also forces you to understand some tricky programming concepts but more importantly opens your mind to doing things a different way. <br />
<br />
A very good article on Functional programming concepts is at:<br />
<a href="http://www.defmacro.org/ramblings/fp.html">http://www.defmacro.org/ramblings/fp.html</a><br />
<br />
The book I am currently learning from that I would recommend is called Foundations of F# by Robert Pickering:<br />
<br />
<img alt="F# book" src="http://ecx.images-amazon.com/images/I/41tkfmANaNL._SL500_BO2,204,203,200_AA219_PIsitb-sticker-dp-arrow,TopRight,-24,-23_SH20_OU02_.jpg" /> <br />
<br />
<br />
<br />
<br />
<br />
<br />
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/FunctionalProgrammingandFSharp/50" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>49</id>
<published>10/17/2008 12:00:00 AM</published>
<updated>10/17/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">10/17/2008 12:00:00 AM</app:edited>
<title>New beta release of MVC framework</title>
<content type="html"><![CDATA[Nice features include:<br />
<ul>
    <li>Intellisense in views :) </li>
    <li>New Scripts directory with JQuery </li>
    <li>Html helper enhancements </li>
</ul>
<p><a href="http://weblogs.asp.net/scottgu/archive/2008/10/16/asp-net-mvc-beta-released.aspx">http://weblogs.asp.net/scottgu/archive/2008/10/16/asp-net-mvc-beta-released.aspx</a></p>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/NewbetareleaseofMVCframework/49" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>47</id>
<published>10/16/2008 12:00:00 AM</published>
<updated>10/16/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">10/16/2008 12:00:00 AM</app:edited>
<title>Dont make me think</title>
<content type="html"><![CDATA[<p>Recently I received a letter from the student loans dept saying that I could view my balance online. <br />
<br />
Great I thought as previously you received an update once a year (sometimes). <br />
<br />
They sent me 2 letters one with a username another with a password. However for some reason they had split my account into two seperate loans (why is anyones guess). Each account had a different username and password with the letters giving no clue as to which one. So of course I ended up locking my account by typing in the wrong login. <br />
<br />
The help desk thensuggested I go to a page which asked some questions only I would know to reset this login. However she said make sure you type it all in capital letters and leave no spaces in my phone number box - erm WHAT?</p>
<p>A number of things come to mind:</p>
<ul>
    <li>Why were 2 loan accounts created when they had several unique identifiers e.g. my NI number, student number etc </li>
    <li>The letters with the login details really need to match up to a username maybe display the last 3 digits etc </li>
    <li>Why give the user an option with something that can be automated like capitalizing the data in the textboxes? </li>
    <li>Or failing this at the very least tell the user they need to do this on the page </li>
    <li>Why not remove spaces from the phone number automatically? </li>
</ul>
<p>It doesnt take too much imagination to see the problems with the above. The bozos who designed this system would do well to read a book called <strong>Dont Make me think</strong> by Steve Krug (<a href="http://www.amazon.co.uk/Dont-Make-Think-Usability-Circle-Com/dp/0789723107/ref=sr_1_2?ie=UTF8amp;s=booksamp;qid=1224192586amp;sr=8-2">http://www.amazon.co.uk/Dont-Make-Think-Usability-Circle-Com/dp/0789723107/ref=sr_1_2?ie=UTF8amp;s=booksamp;qid=1224192586amp;sr=8-2</a>)<br />
<br />
Steve considers when people make decisions they make not necessairly the smartest <strong>but the easiest decision</strong> <strong>possible</strong> (with no problems). <br />
<br />
This has implications for user interface design the ideal being the user should make the decisions without having to think about them. I think you can see this with a well designed site like Amazon or StackOverflow where you just feel drawn to the right button etc. You can help or hinder this process by adhearing to well known standards and ui elements. <br />
<br />
After covering basic concepts and web standards Steve takes a number of websites, shows the current design and alters them (some times very slightly to improve the usability). Every developer should be made to read this book. It took me about 2-3 hours to read cover from cover and it was an entertaining read. Every developer should read this book. </p>
<img alt="" src="/content/uploadImages/dontMakeMeThink.jpg" /> <br />
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/Dontmakemethink/47" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>45</id>
<published>9/26/2008 12:00:00 AM</published>
<updated>9/26/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">9/26/2008 12:00:00 AM</app:edited>
<title>Silverlight 2 Release Candidate Now Available</title>
<content type="html"><![CDATA[<a href="http://weblogs.asp.net/scottgu/archive/2008/09/25/silverlight-2-release-candidate-now-available.aspx"><span style="color: #6699cc">http://weblogs.asp.net/scottgu/archive/2008/09/25/silverlight-2-release-candidate-now-available.aspx</span></a> 
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/Silverlight2ReleaseCandidateNowAvailable/45" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>43</id>
<published>9/22/2008 12:00:00 AM</published>
<updated>9/22/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">9/22/2008 12:00:00 AM</app:edited>
<title>Manipulating bitmap images with pointers uh oh</title>
<content type="html"><![CDATA[One of our sales people wanted some new functionality (why cant they just be happy..) to adjust brightness and contrast on images. I started playing around with this expecting to find a .brighten method. Sadly not!<br />
<br />
There are two ways to do this. You can either use the bitmaps SetPixel and GetPixel methods or pointers. Pointers have better performance. I will be using this in Silverlight over a webservice which will be slow anyway so I am going to go with pointers.<br />
<ul>
    <li>Its not the most straight forward thing but here is the basic concepts </li>
    <li>Your image is essentially a byte array </li>
    <li>In a (RGB) image 3 values from 0-255 make up the image (you could also have a 4th for gamma I think) </li>
    <li>Depending on the strenth of these values it makes a color e.g. 255 0 0 would be red </li>
    <li>For some reason when you read these values they come out back to front e.g. BGR 0 0 255 for Red (?) </li>
    <li>As .net is managed code and we are using pointers we need to mark it as unsafe and click the allow unsafe code </li>
    <li>To manipulate these values you load up the image, Fix its place in memory then get a pointer to the start of it (scan0) </li>
    <li>Each line of the image from the top is the width of the image * 3 (in 24 bit image) </li>
    <li>This number must be divisible by 4 otherwise it will have a padding bit </li>
</ul>
<p>Belows the code I used to convert an imagr to greyscale. I have commented out brightness adjustment (just add to each value) and some other stuff I was playing with.</p>
<code class="prettyprint">using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Text;<br />
using System.Drawing;<br />
using System.Drawing.Imaging;<br />
 <br />
<p>public class Imaging<br />
    {</p>
<p>        public string ExportDir = "";</p>
<p>        public string ModifyImageProperties(string Mode, string FilePath, int RedModify, int GreenModify, int BlueModify, int Lighten, int Darken)<br />
        {<br />
            int intStride = 0;<br />
            int intBrightness = -150;<br />
            System.IntPtr Scan0;<br />
            Bitmap objBitmap = new Bitmap(FilePath);<br />
            string strNewFileName = "" + Guid.NewGuid().ToString() + ".jpg";</p>
<p>            BitmapData objBitmapData = objBitmap.LockBits(new Rectangle(0, 0, objBitmap.Width, objBitmap.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);<br />
            //For 24 bit formats (RGB) stride=imageWidth * 3 (note if this isnt a number divisible by 4 an offset will be added to make it so)<br />
            //For 32 bit formats (RGB) stride=imageWidth * 4<br />
            intStride = objBitmapData.Stride;<br />
            Scan0 = objBitmapData.Scan0;</p>
<p>            unsafe<br />
            {<br />
                //Pointer to start of image<br />
                byte* p = (byte*)Scan0;<br />
                //Calculate offset<br />
                int nOffset = intStride - (objBitmap.Width * 3);<br />
                int nWidth = (objBitmap.Width * 3);<br />
                int intRed = 0;<br />
                int intGreen = 0;<br />
                int intBlue = 0;</p>
<p>                for (int y = 0; y lt; objBitmap.Height; ++y)<br />
    {<br />
                    for (int x = 0; x lt; objBitmap.Width; ++x)<br />
     {</p>
<p>                        intRed =p[2];<br />
                        intGreen =p[1];<br />
                        intBlue = p[0];<br />
                        <br />
                        if (Mode == "RGB")<br />
                        {<br />
                            intRed = intRed + RedModify;<br />
                            intGreen = intGreen + GreenModify;<br />
                            intBlue = intBlue + BlueModify;<br />
                        }<br />
                        <br />
                        if(Mode=="INVERT")<br />
                        {<br />
                            intRed = 255 - p[2];<br />
                            intGreen = 255 - p[1];<br />
                            intBlue = 255 - p[0];<br />
                        }</p>
<p>                        if (Mode == "GREY")<br />
                        {<br />
                            intRed = (byte) (.299 * intRed + .587 * intGreen + .114 * intRed);<br />
                            intGreen = (byte) (.299 * intRed + .587 * intGreen + .114 * intRed);<br />
                            intBlue = (byte)(.299 * intRed + .587 * intGreen + .114 * intRed);<br />
                         <br />
                        }</p>
<p>                        if (Lighten gt; 0)<br />
                        {<br />
                            intRed = intRed + Lighten;<br />
                            intGreen = intGreen + Lighten;<br />
                            intBlue = intBlue + Lighten;<br />
                        }</p>
<p>                        if (Darken gt; 0)<br />
                        {<br />
                            intRed = intRed - Darken;<br />
                            intGreen = intGreen - Darken;<br />
                            intBlue = intBlue - Darken;<br />
                        }</p>
<p>                        if (intRedgt; 255) intRed = 255;<br />
                        if (intGreen gt; 255) intGreen = 255;<br />
                        if (intBlue gt; 255) intBlue = 255;<br />
                     <br />
                        if (intRed lt; 0) intRed = 0;<br />
                        if (intGreen lt; 0) intGreen = 0;<br />
                        if (intBlue lt; 0) intBlue = 0;</p>
<p>                        p[2] = (byte) intRed;<br />
                        p[1] = (byte) intGreen;<br />
                        p[0] = (byte) intBlue;</p>
<p>                        //++p;<br />
                        p += 3;<br />
                        <br />
                    }<br />
                    <br />
                    p += nOffset;<br />
                }</p>
<p>                objBitmap.Save(ExportDir + strNewFileName, ImageFormat.Jpeg);</p>
<p>                objBitmap.UnlockBits(objBitmapData);</p>
<p>                return strNewFileName;<br />
            }<br />
        }<br />
    }</p>
<br />
<br />
</code>
<p>
I found a few links which helped me put this together the codeproject was very helpful (although not the most readable):<br />
<br />
<a href="http://www.bobpowell.net/lockingbits.htm"><span style="color: #6699cc">http://www.bobpowell.net/lockingbits.htm</span></a><br />
<a href="http://www2.sys-con.com/ITSG/virtualcd/Dotnet/archives/0104/brown/index.html"><span style="color: #6699cc">http://www2.sys-con.com/ITSG/virtualcd/Dotnet/archives/0104/brown/index.html</span></a><br />
<a href="http://www.codeproject.com/KB/GDI-plus/csharpgraphicfilters11.aspx"><span style="color: #6699cc">http://www.codeproject.com/KB/GDI-plus/csharpgraphicfilters11.aspx</span></a>
</p>]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/Manipulatingbitmapimageswithpointersuhoh/43" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>41</id>
<published>9/19/2008 12:00:00 AM</published>
<updated>9/19/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">9/19/2008 12:00:00 AM</app:edited>
<title>Remix Day 2</title>
<content type="html"><![CDATA[<p>We started of day to of Remix with a talk on MVC. I havent had a chance to play with MVC yet so was quite interested in this talk. MVC stands for Model View Controller and is ASP.net's implementation of an architecture designed in the 1970s. But dont let that put you off! </p>

<p>In relation to standard ASP.net</p>
<br />
<ul>
    <li>Model is your data </li>
    <li>View is your aspx and ascx controls </li>
    <li>Controller is your business objects, managers etc </li>
</ul>
<p>
MVC doesnt make use of standard view state so some scenerios may be more difficult than classic ASP.net. The application uses the url and http verbs to map to the views e.g /products/GetList is automatically mapped to GetList view

<br />
<br />
The main advantage of using MVC are that:</p>

<ul>
    <li>As each unit is independent they are easy to change </li>
    <li>Seperation suited to unit tests </li>
    <li>Better search engine optimization due to url parsing </li>
</ul>
<p>After the MVC session we watched a talk on optimizing ASP.net performance from the front end.<br />
<br />
The main conclusions were:</p>
<ul>
    <li>Dont make unnecessary http requests e.g. consider combining js and css files </li>
    <li>Place js and css files at bottom of home page so they are preloaded and due to page position dont interrupt user experience </li>
    <li>Careful with use of update panel as it posts back whole page, use [webmethod] attribute instead </li>
    <li>Implement http compression </li>
    <li>Implement compression in asp.net side </li>
    <li>Silverlight can be used to preload stuff and appears quicker than javascript </li>
    <li>Use caching - duh! </li>
</ul>
<p>The other session I atteneded was given by Mike Taulty on how Silverlight can interact with the page.<br />
<br />
This was very impressive:</p>
<ul>
    <li>Silvelight can refer to, add, modify amp; hook up to events on the external html page </li>
    <li>The html page can talk to silverlight </li>
    <li>Call web services </li>
    <li>Listen on sockets </li>
</ul>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/RemixDay2/41" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>39</id>
<published>9/18/2008 12:00:00 AM</published>
<updated>9/18/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">9/18/2008 12:00:00 AM</app:edited>
<title>Remix Day 1</title>
<content type="html"><![CDATA[<p>Bit dashed this post and in need of an edit but I wanted to get something down before I forgot it all...<br />
<br />
I drove down to Brighton the night before Remix in order to avoid the traffic and be awake for the sessions. I spent Wed evening in a very strange hotel talking to some very drunk people in the hotel bar .<br />
<br />
My weird Dr Who esque bed:<br />
<br />
<img alt="" src="/Content/UploadImages/weirdBed.jpg" /></p>
<p>After meeting up with Howard just outside the exhibition hall the day began with an excellent key note speech given by Bill Buxton ( usability and industrial design expert) Bill has written an interesting looking book called <a href="http://www.amazon.co.uk/Sketching-User-Experiences-Interactive-Technologies/dp/0123740371/ref=sr_1_1?ie=UTF8amp;s=booksamp;qid=1221769709amp;sr=8-1"><span style="color: #6699cc">Sketching user experiences</span></a> which I purchased.<br />
<br />
Bill argued that in many places the design phase occurs after the product development and that it was a mistake to let non experts be too involved in design (e.g. the FD on a project being involved to the level of screen design). He argued that good design was dependent on many aspects citing Apples Ipod. Prior to this Apple had been in decline. At this time a number of key personnel Jonathan Ive had been at Apple some time but the Ipod wouldnt become a success until a combination of events such as:</p>
<ul>
    <li>Jobs empowering the designers </li>
    <li>Lawyers negotiated with record labels $99 per track </li>
    <li>Ives and his team creating the design </li>
</ul>
<p>After this we attnded 2 sessions by Scott Gu on Silverlight. I have spent some time with Silverlight lately and would highly recommend the video tutorials. Scott said that Silverlight 2 was due to be released shortly (somewhat non committal!). Other items that looked interesting were IE 8 which includes a javascript profiler and useful looking development tools, Visual studio intellisense support for javascript frameworks such as prototype, about 50 new silverlight controls including graphing components coming. </p>
<p>We then saw a session on Sql data services (astoria). Astoria is basically a REST api to query sql server. I am not sure what I would use this for but it may be useful for example in a silverlight situation to avoid writing a web service interface for every crud query.<br />
<br />
The final session was on Visual Studio IDE tips given by Sara Ford. This was very interesting and contained several time saving tips. I suggest you look at her blog which has a tip a day <a href="http://blogs.msdn.com/saraford/default.aspx"><span style="color: #6699cc">http://blogs.msdn.com/saraford/default.aspx</span></a><br />
<br />
After we left this session I managed to talk to Scott Gu. One of the great things about Remix was how accessible all the presenters were. To have the chance to talk to Microsoft's VP was pretty cool.<br />
<br />
<img alt="" src="/Content/UploadImages/scottgu.jpg" /><br />
<br />
I asked Scott about whether we should be using Web sites or Web application projects (a contentious issue in our company). Scott suggested web application projects where the dll is built is the better way to go. This was due to better performance and the ability to produce unit tests as a dll is built.<br />
<br />
After the main sessions I had a few beers with Howard and had a chance to look at Microsoft Surface. There was an excellent demonstration given which had a virtual earth map. You could rotate it at any angle and even zoom into and walk inside buildings. At $13000 per unit they dont come cheap through.<br />
<br />
I am looking forward to the MVC session tomorrow (finding out what exactly it is!) </p>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/RemixDay1/39" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>35</id>
<published>9/11/2008 12:00:00 AM</published>
<updated>9/11/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">9/11/2008 12:00:00 AM</app:edited>
<title>Color schemes that should never be repeated..</title>
<content type="html"><![CDATA[Cant see the below finding its way into Windows 7..<br />
<br />
<img alt="" src="/Content/UploadImages/hotDog.JPG" /> 
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/Colorschemesthatshouldneverberepeated../35" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>37</id>
<published>9/11/2008 12:00:00 AM</published>
<updated>9/11/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">9/11/2008 12:00:00 AM</app:edited>
<title>To thread or not to thread..</title>
<content type="html"><![CDATA[<span class="blsp-spelling-corrected" id="SPELLING_ERROR_0">Don't</span> would be my advice..<br />
<br />
Threading is an immensely complex subject and one that is poorly understood by most developers (im certainly not claiming any expertiese). I suspect some implement threading just because they think its cool.<br />
<br />
Threading <em>can</em> increase the performance of your application greatly especially with long running processes and may be very necessary depending on your requirements. However I would say its best avoided if possible.<br />
<br />
Never under estimate the additional complexity that adding threading will add to your application in terms of development, debugging and testing.<br />
<br />
Recently I have experienced a number of issues with programs (written by other people grrr) that have implemented threading.<br />
<br />
The mistakes I have seen over the last few weeks include:<br />
<ul>
    <li>Failure to lock resources accessed over multiple threads. This ends up with unexpected behaviour when 2 threads are altering the same variable. Various methods to solve inc sync lock, refactoring code, using patterns etc </li>
    <li>Not killing threads properly - Use finally statment etc. Never assume the thread will be killed </li>
    <li>Some interesting ways to manage multiple threads - make use of thread pool! </li>
    <li>Deadlocks - not one thats come up yet but something to be aware of </li>
</ul>
<p>So always practice safe threading or refrain..</p>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/Tothreadornottothread../37" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>33</id>
<published>9/10/2008 12:00:00 AM</published>
<updated>9/10/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">9/10/2008 12:00:00 AM</app:edited>
<title>Nunit WatiN basics</title>
<content type="html"><![CDATA[NUnit is a tool to enable automated testing. With NUnit you construct your tests using standard .net code to call the classes and methods you wish to test. Assert statements are then used to check the data or results are what your expecting.<br />
<br />
To let NUnit know what tests you want to run you need to annotate the methods with special attributes that are picked up by the NUnit test runner which then runs the tests individually.<br />
<br />
<strong>But why would you want to use NUnit?</strong><br />
Yes there is a bit of upfront work but if you are going to test anyway (and you should) why not make the test repeatable in the future?<br />
Once a test is written you can run it as many times as you like!<br />
The test will be run the exact same way and wont make mistakes unlike people!<br />
Let tests run overnight to pick up errors or integrate with your build process perhaps with CruiseControl.net<br />
Tests can help pick up integration problems e.g. changes to libraries etc<br />
<br />
<strong>So how do you use it?<br />
</strong>Download and install NUnit from:<br />
<a href="http://sourceforge.net/project/downloading.php?groupname=nunitamp;filename=NUnit-2.4.8-net-2.0.zipamp;use_mirror=kent"><span style="color: #6699cc">http://sourceforge.net/project/downloading.php?groupname=nunitamp;filename=NUnit-2.4.8-net-2.0.zipamp;use_mirror=kent</span></a><br />
<br />
Create a new class project<br />
In your project add a reference to Nunit.framework.dll<br />
<br />
<br />
Add the following imports statements in your code:<br />
Imports NUnit.Framework<br />
<br />
Create a class with two methods:<br />
<br />
<code class="prettyprint">
Public Class Ben<br />
<br />
Public Sub AddTwoNumbers()<br />
Assert.AreEqual(1 + 1, 2)<br />
End Sub<br />
<br />
Public Sub MakeTea()<br />
Throw new system.exception("Ben doesnt make tea")<br />
End Sub<br />
<br />
End Class
</code>
<br />
<br />
Add the test fixture attribute to the class and Test attribute to your methods.<br />
<br />
<code class="prettyprint">
lt;TestFixture()gt; _<br />
Public Class Ben<br />
<br />
lt; test()gt; _<br />
Public Sub AddTwoNumbers()<br />
Assert.AreEqual(1 + 1, 2)<br />
End Sub<br />
lt;test()gt; _<br />
Public Sub MakeTea()<br />
Throw new System.Exception(“Ben doesn’t make tea”)<br />
End Sub<br />
<br />
End Class
</code>
<br />
<br />
Compile your application<br />
<br />
Open up Nunit<br />
Click File Open Project, select the dll output of your project<br />
<br />
<br />
Your screen should now look like below:<br />
<br />
<img alt="" src="/Content/UploadImages/nunit1.JPG" /><br />
<br />
Notice how NUnit has divided up the tests by class and method.<br />
<br />
Click AddTwoNumbers and then click the run button it should pass 1+1=2!<br />
<br />
<img alt="" src="/Content/UploadImages/nunit2.JPG" /><br />
<br />
Click MakeTea<br />
<br />
The test will fail (Ben doesn’t like to make tea!)<br />
<br />
If you want to run both tests at once you can click Ben and then Run.<br />
<br />
<br />
<br />
Congratulations you have now run your first NUnit test!<br />
<br />
For further information about NUnit please refer to:<br />
<a href="http://www.nunit.org/index.php?p=download"><span style="color: #6699cc">http://www.nunit.org/index.php?p=download</span></a><br />
<br />
<br />
<strong>WatiN</strong><br />
Nunit on its own is great for running small class based tests but as most of our applications are web based we want to use a program called Watin as well. Watin is a helper class for using Internet Explorer and allows you to automate most internet explorer actions<br />
<br />
First of all download Watin from:<br />
<a href="http://watin.sourceforge.net/"><span style="color: #6699cc">http://watin.sourceforge.net/</span></a><br />
<br />
Download Watin Test recorder from:<br />
<a href="http://downloads.sourceforge.net/watintestrecord/TestRecorder101b.msi?modtime=1190992400amp;big_mirror=0"><span style="color: #6699cc">http://downloads.sourceforge.net/watintestrecord/TestRecorder101b.msi?modtime=1190992400amp;big_mirror=0</span></a><br />
<br />
Install Watin Test Recorder<br />
<br />
In your project add a reference to Watin.core.dll<br />
In your project add a reference to Interop.SHDocVw.dll<br />
<br />
Add a new imports statement at the top of your class file:<br />
Imports WatiN.Core<br />
<br />
In your NUnit test project add a new method:<br />
<br />
<code class="prettyprint">
lt;test()gt;_<br />
Public Sub IsGoogleWorking()<br />
Dim objIE As New IE("http://www.google.com")<br />
<br />
objIE.TextField(Find.ByName("q")).TypeText("Hicom")<br />
objIE.Button(Find.ByName("btnG")).Click()<br />
<br />
Assert.IsTrue(objIE.ContainsText("Hicom"))<br />
<br />
End Sub
</code>
<br />
<br />
We want to run Watin with NUnit which opens up some funny threading issues we need to tell Nunit about. We do this by creating a configuration file called projectname.config.dll e.g. if my project was DE01Nunit the file would be called DE01Nunit.dll.config. Open this file in notepad and place the following:<br />
<br />
lt; ?xml version="1.0" encoding="utf-8" ?gt;<br />
lt;configurationgt;<br />
lt;configsectionsgt;<br />
lt;sectiongroup name="NUnit"gt;<br />
lt;section name="TestRunner" type="System.Configuration.NameValueSectionHandler"gt;<br />
lt;/sectiongroupgt;<br />
lt;/configsectionsgt;<br />
lt;nunitgt;<br />
lt;testrunnergt;<br />
lt;!-- Valid values are STA,MTA. Others ignored. --gt;<br />
lt;add value="STA" key="ApartmentState"gt;<br />
lt;/testrunnergt;<br />
lt;/nunitgt;<br />
lt;/configurationgt;<br />
<br />
Now run this test in NUnit and it should open up the web browser type Hicom in, search and check the search results contain Hicom.<br />
<br />
<strong>Notes</strong><br />
The test recorder will generate some of this code for you but it will be in C# so VB users will need to change a few things<br />
You might need to add a delay in to calls to pages (system.threading.sleep(1000) to give them a chance to load up<br />
You can call javascript by using the runscript method<br />
You can capture screen shots by using the CaptureWebPageToFile method <br />
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/NunitWatiNbasics/33" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>31</id>
<published>9/7/2008 12:00:00 AM</published>
<updated>9/7/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">9/7/2008 12:00:00 AM</app:edited>
<title>New Sony Book Reader - some obvious flaws that should have been fixed</title>
<content type="html"><![CDATA[I was in town today browsing through my local waterstones bookshop and noticed they had the new Sony Reader device (see below). Being gadget minded I had to take a look.<br />
<br />
The reader device allows you to buy and download books which can then be read on the screen. Apparently it allows you to hold up to 160 ebooks and the battery lasts up to 7500 page turns. (further details at: <a href="http://www.waterstones.com/waterstonesweb/displayProductDetails.do?sku=6337796"><span style="color: #6699cc">http://www.waterstones.com/waterstonesweb/displayProductDetails.do?sku=6337796</span></a>).<br />
<br />
<img alt="" src="/Content/UploadImages/readeropen_250.jpg" /><br />
One of the most noticable things about this device is the screen is beautiful. I imagined it would be like a laptop or phone screen with horrible glare. Its not they have done a really good job on this.<br />
<br />
However:<br />
<br />
<ul>
    <li>Its £199, ouch! </li>
    <li>Books arent that much cheaper if at all (are you really asking me after paying 200 quid to pay 12.99 for a book?) </li>
    <li>It needs to be plugged in to download new books </li>
    <li>Books are not like music where you want to keep lots of songs. At most people are reading 2 or 3 books at a time and who cares if you can store 160 books your not going to flick through them unless they are some kind of reference. </li>
    <li>Not touch screen - why? </li>
</ul>
<p>But the real killer is that when you change pages the entire screen flashes which is really irritating. Why with all the effort that has gone into the rest of it would you do this.<br />
<br />
Nice try Sony but I dont think its there yet...</p>]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/NewSonyBookReader-someobviousflawsthatshouldhavebeenfixed/31" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>29</id>
<published>9/5/2008 12:00:00 AM</published>
<updated>9/5/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">9/5/2008 12:00:00 AM</app:edited>
<title>Book Review - The Career Programmer Guerilla Tactics for an Imperfect World</title>
<content type="html"><![CDATA[I just finished reading the book The Career Programmer: <span class="blsp-spelling-error" id="SPELLING_ERROR_0">Guerilla</span> Tactics for an Imperfect World<br />
<br />
(<a href="http://www.amazon.co.uk/Career-Programmer-Guerilla-Tactics-Imperfect/dp/1590596242/ref=sr_1_1?ie=UTF8amp;s=booksamp;qid=1220614735amp;sr=8-1"><span style="color: #6699cc">http://www.amazon.co.uk/Career-Programmer-Guerilla-Tactics-Imperfect/dp/1590596242/ref=sr_1_1?ie=UTF8amp;s=booksamp;<span class="blsp-spelling-error" id="SPELLING_ERROR_1">qid</span>=1220614735amp;<span class="blsp-spelling-error" id="SPELLING_ERROR_2">sr</span>=8-1</span></a>)<br />
<br />
With development its quite easy to become engulffed in the technical aspects of the job, forgetting that it just exists as a small part of a business. This book is about these business aspects you need to be aware of and how best to deal with them from a development perspective.<br />
<br />
I have heard <span class="blsp-spelling-error" id="SPELLING_ERROR_3">much praise </span>about this book and it got 4.5 out of 5 on Amazon so I thought it worth a read. Whilst the book raises some very good points I cant help but think it could have been written in about 20 pages. Some of the book is quite amusing, particularly the author recollecting their own personal experience but it really does waffle on and some jokes are very overused. It is obviously written by an American for an American audience which may irritate some UK readers. On the whole I found it quite negative at times about programming as a career - or maybe on the whole I have worked for decent companies (you know who you are non decent places...)<br />
<br />
From the book these are the useful points I took away:<br />
<ul>
    <li>When estimating time to complete a task estimate that only 60% of your day will be spent actually coding the rest on fixing, meetings, browsing adult sites etc </li>
    <li>Choose your battles - its not worth arguing every point even if you "know" you are right -something I know I can be drawn into :) </li>
    <li>Many times the ideas that are chosen are not <span class="blsp-spelling-corrected" id="SPELLING_ERROR_4">necessarily</span> the best - just the best presented and argued (all the more reason to practice speaking/presentation abilities!) </li>
    <li>Its important to be able to speak both tech and business (obvious but have seen many developers forget this) </li>
    <li>Testers should be made to feel part of the team - What you work in a company where they actually employ testers you lucky thing! </li>
    <li>You are not going to change some places, if you dont like it leave! </li>
</ul>
<p>
On the whole not a bad book and if you think you need to wise up to some of the non technical issues well worth a read. </p>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/BookReview-TheCareerProgrammerGuerillaTacticsforanImperfectWorld/29" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>23</id>
<published>9/2/2008 12:00:00 AM</published>
<updated>9/2/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">9/2/2008 12:00:00 AM</app:edited>
<title>Copy SQL server diagrams from one server to another</title>
<content type="html"><![CDATA[I came across a nice script yesterday that would allow you to copy SQL diagrams from one server to another. Its pretty easy to use and confirm it works.<br />
<br />
<a href="http://www.codeproject.com/KB/database/ScriptDiagram2005.aspx" class="external free" title="http://www.codeproject.com/KB/database/ScriptDiagram2005.aspx" rel="nofollow"><span style="color: #6699cc">http://www.codeproject.com/KB/database/ScriptDiagram2005.aspx</span></a> 
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/CopySQLserverdiagramsfromoneservertoanother/23" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>25</id>
<published>9/2/2008 12:00:00 AM</published>
<updated>9/2/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">9/2/2008 12:00:00 AM</app:edited>
<title>LINQ to SQL Reflection</title>
<content type="html"><![CDATA[<span style="font-family: georgia">One of the cool things about LINQ to SQL classes is that you can define relationships between classes/tables. Defining a relationship allows you to make use of it in queries and access properties in an intuitive way e.g. <span style="font-family: courier new">objBusiness.staff[0].firstName</span></span><br />
<br />
I wanted to make use of this table linking functionality in order to avoid having to write this code myself.<br />
<br />
<span style="font-family: georgia">Below is a snipet of code of how to get a proprties value from a LINQ to sql class.</span><br />
<span style="font-family: georgia"></span><br />
<span style="font-family: courier new">using System.Data.Linq;<br />
using System.Reflection;</span><br />
<span style="font-family: courier new"></span><br />
<span style="font-family: courier new">DataContext objCon = new DataContext(strConn);</span><br />
<span style="font-family: courier new">Episode objEpisode; </span><br />
<span style="font-family: courier new">string strObjectName = "";</span><br />
<span style="font-family: courier new">string strFieldName = "";<br />
strObjectName = "Episode";</span><br />
<span style="font-family: courier new">strFieldName = "EpisodeDate";<br />
</span><br />
<span style="font-family: courier new">Table<episode /> objEpisodeTable = objCon.GetTable<episode />(); </span><br />
<span style="font-family: courier new"></span><br />
<span style="font-family: courier new">//Get an item</span><br />
<span style="font-family: courier new">objEpisode = objEpisodeTable.Single<episode />(Episode =gt; Episode.EpisodeID == new Guid(guidPatientID));</span><br />
<span style="font-family: courier new"></span><br />
<span style="font-family: courier new">PropertyInfo pi = objEpisode.GetType().GetProperty(strFieldName); </span><br />
<span style="font-family: courier new">//Get sub property </span><br />
<span style="font-family: courier new">strObjectName = "Patient"; </span><br />
<span style="font-family: courier new">strFieldName = "CreatedDate";<br />
</span><br />
<span style="font-family: courier new">PropertyInfo objToCreate = objEpisode.GetType().GetProperty(strObjectName); </span><br />
<span style="font-family: courier new"></span><br />
<span style="font-family: courier new">object objTmp = objToCreate.GetValue(objEpisode, null); PropertyInfo objFieldInfo = objTmp.GetType().GetProperty(strFieldName); </span><br />
<span style="font-family: courier new"></span><br />
<span style="font-family: courier new">MessageBox.Show(objFieldInfo.GetValue(objTmp,null).ToString());</span><br />
<span style="font-family: courier new"></span><br />
<span style="font-family: georgia"><strong>One to many items</strong></span><br />
Getting the values out of related items is slightly trickier. You have to create the top level item then each item as you navigate through.<br />
<br />
E.g. in our example <span style="font-family: courier new">objBusiness.staff[0].firstName</span> in order to obtain a staff members name we will need to create a business object and a staff object before getting the firstName field.<br />
<br />
<span style="font-family: georgia">If the property you want to get hold of is contained within an object there could be more than one of e.g. something like objBusiness.staff rather then objBusiness.primaryOffice it gets a bit trickier. </span><br />
<br />
<span style="font-family: georgia">First you need to test if the property is compatible with IList. This can be done with the following statement:</span><br />
<br />
<span style="font-family: courier new">if (objToCreate is IList)</span><br />
<span style="font-family: courier new"></span><br />
<span style="font-size: 0px">You can then cast the object to IList (does this seem weird to anyone else you can do this?)</span><br />
<span style="font-family: courier new"><br />
IList listObject = (IList) objTmp;<br />
<br />
<span style="font-family: georgia">You can then iterate through the objects in the object.</span><br />
<br />
foreach (object o in listObject)<br />
{<br />
<br />
}</span><br />
<br />
<span style="font-family: courier new"><span style="font-family: georgia">You can now use the variable "o" to get at the various object. I suggest you use a recurssive function to iterate through the objects looking for the field you are after.</span></span> 
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/LINQtoSQLReflection/25" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>27</id>
<published>9/2/2008 12:00:00 AM</published>
<updated>9/2/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">9/2/2008 12:00:00 AM</app:edited>
<title>New Google browser beta released</title>
<content type="html"><![CDATA[Google tonight launched their new browser called Chrome. <br />
<br />
It is available from:<br />
<a href="http://www.google.com/chrome/"><span style="color: #6699cc">http://www.google.com/chrome/</span></a><br />
<br />
They also produced a comic book explaining the new features which is quite nice:<br />
<a href="http://www.google.com/googlebooks/chrome/"><span style="color: #6699cc">http://www.google.com/googlebooks/chrome/</span></a><br />
<br />
First impressions are it looks nice and works well.<br />
<br />
I like the way it collects the most popular sites you visit so you can jump to them. I like the predictive address bar and privacy functions. Rearranging the tabs and address bar does make sense when you think about it.<br />
<br />
Will this restart the browser wars again? Well competion is a good thing and facilitates innovation but from a developer designer/perspective another browser to test is kind of a pain in the ass!<br />
<br />
However despite all the new features and the no doubt very clever programming advances my wife turned to me and said "erm it doesnt look any different..." which I think is a valid point...<br />
<br />
<img alt="" src="/SimpleIsBest/Uploads/Editor/chrome.JPG" /> 
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/NewGooglebrowserbetareleased/27" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>21</id>
<published>8/29/2008 12:00:00 AM</published>
<updated>8/29/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">8/29/2008 12:00:00 AM</app:edited>
<title>Learn presentation and speaking skills with Woking Speakers</title>
<content type="html"><![CDATA[I attended a session last night by the group Woking Speakers. Woking speakers in their own words: "Work together to share our knowledge and practise our skills regularly to keep improving and practising our speaking skills".<br />
<br />
It was a very enjoyable evening and friendly group. This will certainly be a group I will be joining. I would highly recommend anyone who wants to develop their public speaking and communication skills to consider attending for further details please go to: <a href="http://www.wokingspeakers.org.uk/"><span style="color: #6699cc">http://www.wokingspeakers.org.uk/</span></a> 
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/LearnpresentationandspeakingskillswithWokingSpeakers/21" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>19</id>
<published>8/26/2008 12:00:00 AM</published>
<updated>8/26/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">8/26/2008 12:00:00 AM</app:edited>
<title>SQL Bits conference 13th Sep, Hatfield</title>
<content type="html"><![CDATA[Ian Pettman (he did a talk on LINQ for DevEvening) has recommended the following free conference:<br />
<a href="http://www.sqlbits.com/information/MainAgenda.aspx"><span style="color: #6699cc">http://www.sqlbits.com/information/MainAgenda.aspx</span></a><br />
<br />
I have been to a talk previously about SQL 2008 from these guys and they seemed very knowledgeable. I wont be able to go as it is my wife's birthday but it looks pretty good.. 
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/SQLBitsconference13thSep,Hatfield/19" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>17</id>
<published>8/25/2008 12:00:00 AM</published>
<updated>8/25/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">8/25/2008 12:00:00 AM</app:edited>
<title>Google automated queries</title>
<content type="html"><![CDATA[I had a small application which automated queries to Google. This had stopped working over the weekend as Google seem to have made changes to their search results html which resulted in my application getting into an infinite loop. When attempting to debug this I discovered they block you temporarily if you try stuff like this.<br />
<br />
<img alt="" src="/Content/UploadImages/google.JPG" /> 
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/Googleautomatedqueries/17" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>15</id>
<published>8/24/2008 12:00:00 AM</published>
<updated>8/24/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">8/24/2008 12:00:00 AM</app:edited>
<title>Reading ATOM feeds with LINQ</title>
<content type="html"><![CDATA[A number of people that havent used LINQ before often wonder what the point of it is, concluding that existing technologies such as SQL and XSL work well enough for them already.<br />
<br />
Well okay but LINQ can make it all so much easier for you...<br />
<br />
Today I wanted to integrate blog posts from this site into another site.<br />
<br />
This was very easy with recent LINQ enhancements:<br />
<br />
<span style="font-family: courier new">XDocument objDoc = new XDocument();</span><br />
<span style="font-family: courier new">XNamespace objNS ="</span><a href="http://www.w3.org/2005/Atom"><span style="font-family: courier new"><span style="color: #6699cc">http://www.w3.org/2005/Atom</span></span></a><span style="font-family: courier new">";<br />
</span><br />
<span style="font-family: courier new">objDoc = XDocument.Load("</span><a href="http://www.simpleisbest.co.uk/feeds/posts/default"><span style="font-family: courier new"><span style="color: #666699">http://www.simpleisbest.co.uk/feeds/posts/default</span></span></a><span style="font-family: courier new">");</span><br />
<span style="font-family: courier new"></span><br />
<span style="font-family: courier new">var query = from objNode in objDoc.Descendants(objNS + "entry") </span><br />
<span style="font-family: courier new">select new </span><br />
<span style="font-family: courier new">{ </span><br />
<span style="font-family: courier new">link = objNode.Element(objNS + "link").Attribute("href"), </span><br />
<span style="font-family: courier new">id = objNode.Element(objNS + "id").Value, </span><br />
<span style="font-family: courier new">title=objNode.Element(objNS + "title").Value, </span><br />
<span style="font-family: courier new">content=objNode.Element(objNS + "content").Value, </span><br />
<span style="font-family: courier new">published = objNode.Element(objNS + "published").Value </span><br />
<span style="font-family: courier new">};</span><br />
<br />
And then just bind query to your repeater/datagrid :)<br />
<br />
The only thing to remember is to add the namespace as I was puzzled for a while why no nodes were returned doh.<br />
<br />
LINQ is such a useful addition to any developers tool kit. I can see it becoming one of those skills that is almost as important as SQL that a developer will be expected to know.<br />
<br />
I would recommend the book LINQ in action (<a href="http://www.amazon.co.uk/LINQ-Action-Fabrice-Marguerie/dp/1933988169/ref=sr_1_1?ie=UTF8amp;s=booksamp;qid=1219586627amp;sr=8-1"><span style="color: #6699cc">http://www.amazon.co.uk/LINQ-Action-Fabrice-Marguerie/dp/1933988169/ref=sr_1_1?ie=UTF8amp;s=booksamp;qid=1219586627amp;sr=8-1</span></a>). For a techy book it is very readable.
<h3></h3>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/ReadingATOMfeedswithLINQ/15" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>13</id>
<published>8/23/2008 12:00:00 AM</published>
<updated>8/23/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">8/23/2008 12:00:00 AM</app:edited>
<title>How to install Cruise Control .net</title>
<content type="html"><![CDATA[I have been playing around with NUnit and Watin for a while (post to follow). A number of people mentioned I should take a look at CruiseControl.net. Here is the basics of how to set it up.<br />
Cruise Control.net is a continous integration server application. So er what does it do?<br />
<br />
<ul>
    <li>It allows you to automate complilation (builds) of your application<br />
    You can get it to retreive the latest version from your source control system before building </li>
    <li>You can automate other tasks such as NUnit tests to be performed as part of this build </li>
    <li>You can receive the results of the builds and tests </li>
    <li>And best of all its free (always a plus with tight ass bosses)! </li>
</ul>
<p>But why would you want to do this?</p>
<ul>
    <li>In a large scale project with many developers working on it you can find out early on if a change has broken the build </li>
    <li>Integration testing e.g. run it overnight to receive notification of build/unit test failures </li>
    <li>Create many different build configurations and use CruiseControl.net as a way of kicking them off </li>
</ul>
<p>Perhaps the only problem with CruiseControl.net is the documentation which you are going to have to do a bit of searching around. However CruiseControl.net is a popular application so there are quite a few tutorials. </p>
<p>CruiseControl.net has 2 parts the application itself and a web front end. The web front end is okay however you can modify various bits yourself through XSL files. </p>
<p><strong>Using CruiseControl.net</strong><br />
<br />
1) Download NUnit from: <a href="http://sourceforge.net/project/downloading.php?groupname=nunitamp;filename=NUnit-2.4.8-net-2.0.msiamp;use_mirror=osdn"><span style="color: #6699cc">http://sourceforge.net/project/downloading.php?groupname=nunitamp;filename=NUnit-2.4.8-net-2.0.msiamp;use_mirror=osdn</span></a> (not strictly necessary but this tutorial will be integrating NUnit tests in the build)<br />
2) Download CruiseControl.net from: <a href="http://sourceforge.net/project/showfiles.php?group_id=71179amp;package_id=83198"><span style="color: #6699cc">http://sourceforge.net/project/showfiles.php?group_id=71179amp;package_id=83198</span></a><br />
3) Check you have IIS amp; .net 3.5 installed<br />
4) Install NUnit amp; CruiseControl.net<br />
5) This will create a short cut on your desktop click this to run it you should see a dos window with a load of messages similar to this:<br />
<br />
<img alt="" src="/Content/UploadImages/cruiseInitial.JPG" /><br />
<br />
<strong>Create Project to build<br />
<br />
</strong>Now what we need to do is create a sample project for CruiseControl to build.<br />
<br />
I have created a new blank solution called cctestapp and added a console application to it. My solution file is at E:\wwwroot\Testing\cctestapp\cctestapp.sln and the application is at E:\wwwroot\Testing\cctestapp\cctestapp\.<br />
<br />
Once you have created your console application add a reference to Nunit.framework.dll (by default this is at: C:\Program Files\NUnit 2.4.8\bin)<br />
<br />
<br />
<br />
Add the following code to your console application:<br />
<br />
<span style="font-family: courier new">using System;<br />
using NUnit.Framework;<br />
namespace MonitoringApplication<br />
{<br />
[TestFixture]<br />
public class Program<br />
{<br />
[Test]<br />
public void AlexTest()<br />
{<br />
Assert.AreEqual(1, 1);<br />
}<br />
public static int Main(string[] args)<br />
{<br />
//My program<br />
return 0;<br />
}<br />
}<br />
}<br />
<br />
</span>Check the application compiles okay.<br />
<br />
Now we need to tell CruiseControl.net we want to build this project. To do this we need to alter an xml configuration file. This XML configuration file contains all the projects that are to be built. The configuration file contains a reference to a program called MsBuild. When you compile a project in visual studio behind the scences MsBuild is used to create the final output.<br />
<br />
1) Open ccnet.config in notepad (by default its at C:\Program Files\CruiseControl.NET\server).<br />
2) Modify it so it looks like this <a href="http://www.devcafe.co.uk/downloads/blog/ccnet.txt"><span style="color: #6699cc">config file</span></a>. This config file automates a build on Mondays and Wednesdays at 18:00 and runs NUnit tests.<br />
3) Remember to alter the various paths to where you have created your project. I think these are fairly self explanatory. e.g assembly, executable, working directory, project file and logger.<br />
4) If you now open up a web browser and go to <a href="http://localhost/ccnet/"><span style="color: #6699cc">http://localhost/ccnet/</span></a> you should see the main build screen like below:<br />
<br />
<img alt="" src="/Content/UploadImages/CCTray.JPG" /><br />
<br />
5) Click the Force button to run the build.<br />
6) You can then click refresh status to see if it built correctly if it did under the build status it should say Success.<br />
7) To look at more details about whether your project built properly click the project name you can then view the build report and see the results of any tests.<br />
8) If the project didnt build properly check your file paths are correct in ccnet.config.<br />
<br />
<br />
You will probably want to install the CruiseControl tray application this notifies you of failures and allows you to kick of builds etc. This you can install by opening the web application and clicking the download CCTray link on the left.<br />
<br />
<strong>Further reading</strong><br />
<br />
These tutorials helped me to get this running:<br />
<br />
<a href="http://johnnycoder.com/blog/2008/01/29/getting-started-with-cruisecontrolnet/"><span style="color: #6699cc">http://johnnycoder.com/blog/2008/01/29/getting-started-with-cruisecontrolnet/</span></a><br />
<a href="http://weblogs.asp.net/jdanforth/pages/How-to-Hook-Up-a-VS.NET-2005-Solution-With-CruiseControl.NET-in-a-Few-Minutes.aspx"><span style="color: #6699cc">http://weblogs.asp.net/jdanforth/pages/How-to-Hook-Up-a-VS.NET-2005-Solution-With-CruiseControl.NET-in-a-Few-Minutes.aspx</span></a> </p>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/HowtoinstallCruiseControl.net/13" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>11</id>
<published>8/19/2008 12:00:00 AM</published>
<updated>8/19/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">8/19/2008 12:00:00 AM</app:edited>
<title>Update Panel - Message received could not be parsed</title>
<content type="html"><![CDATA[<p><span style="font-family: arial">Recently I did some work on the DevEvening booking forms. As part of this I used an update panel around a grid view and some dropdown lists. One of DevEvening's member Craig found he was getting a weird error when trying to book onto an event:<br />
<br />
<img alt="" src="/Content/UploadImages/CraigErrorMessage.jpg" /><br />
<br />
Craig found this occurs when the site is accessed on some firewalls such as Watchguard. He suggests this is due to headers being disrupted by the unit. I havent had any problems with Update panel before but one to watch out for (well done to Craig for figuring that weird one out)</p>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/UpdatePanel-Messagereceivedcouldnotbeparsed/11" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>7</id>
<published>8/18/2008 12:00:00 AM</published>
<updated>8/18/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">8/18/2008 12:00:00 AM</app:edited>
<title>Visual Studio SP1 out</title>
<content type="html"><![CDATA[<p>
Dont let the initial 500k fool you this is one of those that goes off to get a load of files and is currently listing 50 minutes to download...You will need this to install SQL 2008 if you have Visual Studio installed.<br />
<br />
<a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=fbee1648-7106-44a7-9649-6d9f6d58056eamp;DisplayLang=en"><span style="color: #6699cc">http://www.microsoft.com/downloads/details.aspx?FamilyID=fbee1648-7106-44a7-9649-6d9f6d58056eamp;DisplayLang=en</span></a> 
</p>
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/VisualStudioSP1out/7" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>9</id>
<published>8/18/2008 12:00:00 AM</published>
<updated>8/18/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">8/18/2008 12:00:00 AM</app:edited>
<title>MS SQL 2008 Unleashed event</title>
<content type="html"><![CDATA[<a href="http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032385183amp;Culture=en-GB"><span style="color: #6699cc">http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032385183amp;Culture=en-GB</span></a> 
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/MSSQL2008Unleashedevent/9" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>5</id>
<published>8/13/2008 12:00:00 AM</published>
<updated>8/13/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">8/13/2008 12:00:00 AM</app:edited>
<title>Enhancements to DevEvening</title>
<content type="html"><![CDATA[I am slowly getting round to enhancing the online booking etc.<br />
<br />
Tonight I have made the following changes:<br />
<br />
Ability to update email and password<br />
Feedback forms (might change these about a bit as we have more than one presentation per session)<br />
Converted data access to LINQ to SQL (so much nicer than direct db calls)<br />
Aestheric changes 
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/EnhancementstoDevEvening/5" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>3</id>
<published>8/11/2008 12:00:00 AM</published>
<updated>8/11/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">8/11/2008 12:00:00 AM</app:edited>
<title>Email issues resolved Vbug Silverlight event</title>
<content type="html"><![CDATA[Email issues now seem to be resolved. Vbug are running a Silverlight event on Tuesday evening in Bracknell which looks interesting:<br />
<br />
<a href="http://www.vbug.co.uk/Events/August-2008/VBUG-Bracknell-Creating-Silverlight-apps-using-Blend-and-VS08.aspx"><span style="color: #6699cc">http://www.vbug.co.uk/Events/August-2008/VBUG-Bracknell-Creating-Silverlight-apps-using-Blend-and-VS08.aspx</span></a> 
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/EmailissuesresolvedVbugSilverlightevent/3" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry><entry><id>1</id>
<published>8/9/2008 12:00:00 AM</published>
<updated>8/9/2008 12:00:00 AM</updated> 
<app:edited xmlns:app="http://www.w3.org/2007/app">8/9/2008 12:00:00 AM</app:edited>
<title>DevEvening Email Down</title>
<content type="html"><![CDATA[<span style="font-family: arial">Currently due to 1amp;1 upgrading their email servers there are problems with DevEvening email access:<br />
<br />
</span><a href="http://www.theregister.co.uk/2008/08/08/1and1_exchange/"><span style="font-family: arial"><span style="color: #6699cc">http://www.theregister.co.uk/2008/08/08/1and1_exchange/</span></span></a><br />
<span style="font-family: arial"><br />
Hopefully these should be fixed shortly...</span> 
]]></content>
<link rel="self" type="application/atom+xml" href="http://www.simpleIsBest.co.uk/Blog/BlogEntryDetail/DevEveningEmailDown/1" />
<author>
<name>Alex Mackey</name> 
<uri>http://www.simpleIsBest.co.uk</uri> 
<email>noreply@devcafe.co.uk</email> 
</author>
</entry></feed>