SimpleIsBest 1/6/2009 12:02:17 AM Simple is best - Alex Mackey Everything should be made as simple as possible, but not simpler" Einstein Alex Mackey www.simpleIsBest.co.uk noreply@blogger.com SpiceWeasel 63 12/31/2008 12:00:00 AM 12/31/2008 12:00:00 AM 12/31/2008 12:00:00 AM Update and Happy New Year
I cant say  too much about this at present as Apress wont allow me to yet, however more details coming soon...

I would like recommend a very interesting book I have been reading about Neural Networks called Introduction to Neural Networks for C#, Second Edition
http://www.heatonresearch.com/online/introduction-neural-networks-cs-edition-2

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: http://dynamicnotions.blogspot.com/

Next year we will have a few changes to DevEvening:

First of all we have a new venue, The Bird in hand pub in Mayford which will offer cheaper food and beer! 
We will vary our evenings with member and professional speakers
We have 2 excellent speakers joining us Andrew Fryer and Craig Murphey on the next meeting on Jan 29th
I also have other speakers such as Jon Skeet, Dinis Cruz and Andrew Dean lined up for the future

So lots to look forward too,

All the best for the new year!
 
]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
62 12/10/2008 12:00:00 AM 12/10/2008 12:00:00 AM 12/10/2008 12:00:00 AM Genetic Algorithms On Reddit someone posted an excellent animation that demonstrated genetic algorithms (GA). The example shows GA refining a vehicle to move over bumpy terrain:
http://www.wreck.devisland.net/ga/

But how does a genetic algorithm work?

The basic idea is actually pretty simple although I bet the implemention is trickier (most notably the breeding part!)

  1. A set of initial solutions to try is created
  2. These are then tried against a specific task (in this case can the vehicle move across the terrain) this is called the fitness function.
  3. Some vehicles will move better over the terrain than others these will be given a higher fitness rating
  4. 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"
  5. These solutions are then bred together in an attempt to produce better solutions

nbsp;

Pretty cool eh?

For more information Wikipedia as usual is our friend:
http://en.wikipedia.org/wiki/Genetic_algorithm

]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
61 11/17/2008 12:00:00 AM 11/17/2008 12:00:00 AM 11/17/2008 12:00:00 AM Any DevEvening members looking for a new position
You would be working at Rusty's startup company Incuvis (www.incuvis.com)

Rusty says:
"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.

We're developing radically new business risk intelligence software. Core skills will be ASP.net (we think ...) and charting tools and moving
towards MS Silverlight. An understand of analytics and data would also be a bonus."


If this sounds like you please email sarim at incuvis.com. ]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
60 11/9/2008 12:00:00 AM 11/9/2008 12:00:00 AM 11/9/2008 12:00:00 AM Azure first look
Azure is Microsoft's cloud computing platform and made up of a number of components and services.

Azure can be split into a number of technologies (not all of which are currently available)

  • .Net Services (Message broker, security and Workflow hosting)
  • SQL Services (an online database accessed using REST)
  • Live Services (a number of different services from interfacing with messanger to sending alerts)
  • Sharepoint Services
  • Microsoft CRM

Currently .net and to some degree SQL services are available.

To play around with Azure you need to register so sign up at: http://www.microsoft.com/azure/register.mspx.

Microsoft will then send you a key (mine took about a week to arrive) allowing you to access the online facilities.

Until you get this key you can still play around to an extentby downloading the SDK: http://www.microsoft.com/downloads/details.aspx?FamilyId=BB893FB0-AD04-4FE8-BB04-0C5E4278D3E9amp;displaylang=en.

I suggest you also download the tools for visual studio from http://www.microsoft.com/downloads/details.aspx?FamilyId=63D0D248-1B08-4F7D-ABDE-62EB75CB1E69amp;displaylang=en. As this is beta software you probably want to be running it in virtual pc (although I didnt and everything seems fine still).

The first thing you should do is watch Steve Marx's presentation on developing an application in Azure at: http://channel9.msdn.com/pdc2008/ES01/
Steve is an excellent preseter, great to watch and will take you through the basics of Windows Azure.

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 (.csdef and .cscfg). 

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).

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:

lt;?xml version="1.0"?gt;
lt;
ServiceConfiguration serviceName="CloudService3" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration"gt;
lt;
Role name="WebRole"gt;
lt;
Instances count="1"/gt;
lt;
ConfigurationSettingsgt;
lt;/
ConfigurationSettingsgt;
lt;/
Rolegt;
lt;/
ServiceConfigurationgt;

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.

 


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.



Currently within .net services you have access to 3 components:

  • Service Bus (acts as a broker/intermediatry for messages)
  • Workflow (hosts workflow)
  • Access control service (authentication and authorization)

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?!

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).

 




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. 

It all looks really promising so far and I cant wait to learn more about it.

]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
59 11/6/2008 12:00:00 AM 11/6/2008 12:00:00 AM 11/6/2008 12:00:00 AM Must watch PDC sessions
I would recommend the following as highlights (for me anyway)

Day 2 Keynote
http://mschnlnine.vo.llnwd.net/d1/pdc08/WMV-HQ/KYN02.wmv
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.

Future of C#
http://channel9.msdn.com/pdc2008/TL16/
Anders is an excellent speaker and a very interesting session.

Parallel Programming
http://channel9.msdn.com/pdc2008/TL26/
Daniel Moth presents an excellent session demonstrating some of the parallel enhancements.

Introduction to F#
http://mschnlnine.vo.llnwd.net/d1/pdc08/WMV-HQ/TL11.wmv
Excellent talk on the basics of F# and demonstration of some of the advantages

A lap around Oslo
http://mschnlnine.vo.llnwd.net/d1/pdc08/WMV-HQ/TL23.wmv
Take a first look at "M" 

Developing and deploying your first Windows Azure service
http://channel9.msdn.com/pdc2008/ES01/
Good demo of Azure with MVC application
]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
58 11/2/2008 12:00:00 AM 11/2/2008 12:00:00 AM 11/2/2008 12:00:00 AM DevEvening update
There is now a feedback page at:
http://www.devevening.co.uk/suggest.aspx

This allows users to send feedback about DevEvening and suggest possible future sessions.

I am currently talking to Jon Skeet, MVP and author of the book C# in depth (http://csharpindepth.com/). 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. ]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
57 10/30/2008 12:00:00 AM 10/30/2008 12:00:00 AM 10/30/2008 12:00:00 AM XSS, MVC and JSON http://www.simpleisbest.co.uk/Blog/BlogEntryDetail/JSONandMVC?id=53) 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!).

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.

I suspect with the upcoming use of JQuery and MVC a few people wll make this mistake.

The important thing to remember is always encode user input when outputting it using Server.HtmlEncode method. ]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
56 10/28/2008 12:00:00 AM 10/28/2008 12:00:00 AM 10/28/2008 12:00:00 AM Nevron offers prizes for DevEvening members
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.  

At the next DevEvening we will give away a licence for this component. 

Perhaps the first winner of the licence can let us all know how they get on with the product?

For further information please look at:
http://www.nevron.com/ ]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
55 10/27/2008 12:00:00 AM 10/27/2008 12:00:00 AM 10/27/2008 12:00:00 AM Windows Azure Microsoft are putting the PDC sessions online at: http://microsoftpdc.com/

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).

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).

They then showed a social networking application called blue hoo (http://www.bluehoo.com/). 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.

However the problem I have with cloud computing (apart from all the hype) is:

  • Is the current infrastructure really quick and reliable enough
  • 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)
  • Some clients will object to data being hosted out of their organisation or country

Having said this it does look interesting from the point of view of:

  • Let Microsoft manage the infrastructure
  • Can start off small and easily scale application
  • Cheaper? - we will have to wait and see!
]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
52 10/26/2008 12:00:00 AM 10/26/2008 12:00:00 AM 10/26/2008 12:00:00 AM Add on to copy and paste Visual Studio code as HTML
Download from:
http://www.jtleigh.com/people/colin/software/CopySourceAsHtml/

Example of results of copy html:

  DataContext objCon = new DataContext(System.Configuration.ConfigurationSettings.AppSettings.Get("ConnStr"));

            Tablelt;BlogEntryCommentgt; objBlogEntryCommentTable = objCon.GetTablelt;BlogEntryCommentgt;();

 

            var query = from b in objBlogEntryCommentTable

                        orderby b.CommentDate

                        where b.BlogEntryID ==BlogEntryID

                        select b;

 

            return query.ToList();




]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
53 10/26/2008 12:00:00 AM 10/26/2008 12:00:00 AM 10/26/2008 12:00:00 AM JSON and MVC
Other options include
  • Decorated functions with the WebMethod attribute (although I have had problems using this with nested controls).
  • Handcoding webservice calls (This is a pain to create and process the return data)
  • JSON and JQuery

Perhaps the best option if you just want a single value back is to use a format called JSON in conjuction with JQuery.

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:

{Symbol:"MSFT",Value:"4.4"}

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:

alert(objMyResult.Value);

Which is much preferable to processing XML from SOAP results etc...

But how do you use this with ASP.net?

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).



Client side code:

 

function submit()

{

nbsp;

 

var strName = $("#txtName").val();
var strEmail = $("#txtEmail").val();
var strComment = $("#txtComment").val();
var strSpamCheck = $("#txtSpamCheck").val();
var rand1=window.rand1;
var rand2=window.rand2;

$.ajax({
type:

nbsp;

"POST",
dataType:
"json",
url:
"lt;%=Application["URLRoot"].ToString() + "BlogEntryComment/Submit?id=" + objBlogEntry.BlogEntryID.ToString() %gt;",
data: { Email: strEmail, Name: strName, Comment: strComment, SpamCheck: strSpamCheck, Rand1: rand1, Rand2: rand2},
success:
function(result) {
$(
"#CommentEntry").fadeOut("slow");
setTimeout(redirect,2000);
},
error:
function(error) {
alert(
'error ');
}

 

});
}

nbsp;

 

Then server side I use this code in my controller class for processing BlogEntryComments:

public JsonResult Submit(string Email, string Name, string Comment, int SpamCheck, int Rand1, int Rand2)

{

if (SpamCheck != (Rand1 + Rand2))

{

return Json(new { message = "SPAM" });

}

 

if (Comment == "")

{

return Json(new { message = "SUCCESS" });

}

 

if ("" + Name.Trim() == "")

{

Name = "Anon";

}

 

DataContext objCon = new DataContext(System.Configuration.ConfigurationSettings.AppSettings.Get("ConnStr"));

Tablelt;BlogEntryCommentgt; objBlogEntryCommentTable = objCon.GetTablelt;BlogEntryCommentgt;();

 

BlogEntryComment objBlogEntryComment = new BlogEntryComment();

objBlogEntryComment.IP = System.Web.HttpContext.Current.Request.UserHostAddress.ToString();

objBlogEntryComment.BlogEntryID=Convert.ToInt32(Request.QueryString["id"]);

objBlogEntryComment.CommentDate = System.DateTime.Now;

objBlogEntryComment.Name = "" + Name;

objBlogEntryComment.Email = "" + Email;

objBlogEntryComment.Comment = "" + Comment;

objBlogEntryComment.Approved = 0;

objBlogEntryCommentTable.InsertOnSubmit(objBlogEntryComment);

objCon.SubmitChanges();

 

return Json(new { message = "SUCCESS" });

}


If you want to adapt this for you own use couple of things to note:

  • Parameter names for the server side function must match exactly what you declare in the client side Javascript
  • 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

 

]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
54 10/26/2008 12:00:00 AM 10/26/2008 12:00:00 AM 10/26/2008 12:00:00 AM DevEvening Update Swag update!
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)

Events
DeveloperDay books out in under 4hrs! Currently 3 DevEvening members are attending with one on the waitlist.

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 (http://channel9.msdn.com/)

Microsoft emailed me about the UK equivalent occuring in March next year (http://www.devweek.com/pdd/). 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.

Changes to DevEvening site
Made the following changes to DevEvening website:

Minor content changes on FAQ and register pages
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)

]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
51 10/22/2008 12:00:00 AM 10/22/2008 12:00:00 AM 10/22/2008 12:00:00 AM DD7 Registration Open
http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032393874amp;Culture=en-GB

]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
50 10/20/2008 12:00:00 AM 10/20/2008 12:00:00 AM 10/20/2008 12:00:00 AM Functional Programming and F Sharp
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.

One of the fundamental concepts of functional programming is
Once you declare a value it cannot be changed

Now read that again and imagine writing a program without changing the values of any variables.

Impossible? no, but certainly tricky..

Below is an example of declaring a value in F# (Microsofts implementation of Functional Programming)

let a=1

However you could also do something like this:

let b=(a+a)

Or even

let c=(a+b*2)

You get the idea. Values are declared as functions (hence the functional bit!) and can be passed around to each other.

Chances are you may have used some functional concepts already if you have done much work with LINQ lamda functions any one?

But why would you want to do writ something in a functional way?

Testability
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.
You can use automated tools to test applications

Concurrency
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.
Possibility of creating hot swappable applications

If this sounds interesting take a look at F#. It is downloadable from:
http://research.microsoft.com/fsharp/fsharp.aspx

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.

A very good article on Functional programming concepts is at:
http://www.defmacro.org/ramblings/fp.html

The book I am currently learning from that I would recommend is called Foundations of F# by Robert Pickering:

F# book 






]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
49 10/17/2008 12:00:00 AM 10/17/2008 12:00:00 AM 10/17/2008 12:00:00 AM New beta release of MVC framework
  • Intellisense in views :)
  • New Scripts directory with JQuery
  • Html helper enhancements

http://weblogs.asp.net/scottgu/archive/2008/10/16/asp-net-mvc-beta-released.aspx

]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
47 10/16/2008 12:00:00 AM 10/16/2008 12:00:00 AM 10/16/2008 12:00:00 AM Dont make me think Recently I received a letter from the student loans dept saying that I could view my balance online.

Great I thought as previously you received an update once a year (sometimes).

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.

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?

A number of things come to mind:

  • Why were 2 loan accounts created when they had several unique identifiers e.g. my NI number, student number etc
  • The letters with the login details really need to match up to a username maybe display the last 3 digits etc
  • Why give the user an option with something that can be automated like capitalizing the data in the textboxes?
  • Or failing this at the very least tell the user they need to do this on the page
  • Why not remove spaces from the phone number automatically?

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 Dont Make me think by Steve Krug (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)

Steve considers when people make decisions they make not necessairly the smartest but the easiest decision possible (with no problems).

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.

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.


]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
45 9/26/2008 12:00:00 AM 9/26/2008 12:00:00 AM 9/26/2008 12:00:00 AM Silverlight 2 Release Candidate Now Available http://weblogs.asp.net/scottgu/archive/2008/09/25/silverlight-2-release-candidate-now-available.aspx ]]> Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk 43 9/22/2008 12:00:00 AM 9/22/2008 12:00:00 AM 9/22/2008 12:00:00 AM Manipulating bitmap images with pointers uh oh
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.
  • Its not the most straight forward thing but here is the basic concepts
  • Your image is essentially a byte array
  • In a (RGB) image 3 values from 0-255 make up the image (you could also have a 4th for gamma I think)
  • Depending on the strenth of these values it makes a color e.g. 255 0 0 would be red
  • For some reason when you read these values they come out back to front e.g. BGR 0 0 255 for Red (?)
  • As .net is managed code and we are using pointers we need to mark it as unsafe and click the allow unsafe code
  • To manipulate these values you load up the image, Fix its place in memory then get a pointer to the start of it (scan0)
  • Each line of the image from the top is the width of the image * 3 (in 24 bit image)
  • This number must be divisible by 4 otherwise it will have a padding bit

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.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
 

public class Imaging
    {

        public string ExportDir = "";

        public string ModifyImageProperties(string Mode, string FilePath, int RedModify, int GreenModify, int BlueModify, int Lighten, int Darken)
        {
            int intStride = 0;
            int intBrightness = -150;
            System.IntPtr Scan0;
            Bitmap objBitmap = new Bitmap(FilePath);
            string strNewFileName = "" + Guid.NewGuid().ToString() + ".jpg";

            BitmapData objBitmapData = objBitmap.LockBits(new Rectangle(0, 0, objBitmap.Width, objBitmap.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
            //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)
            //For 32 bit formats (RGB) stride=imageWidth * 4
            intStride = objBitmapData.Stride;
            Scan0 = objBitmapData.Scan0;

            unsafe
            {
                //Pointer to start of image
                byte* p = (byte*)Scan0;
                //Calculate offset
                int nOffset = intStride - (objBitmap.Width * 3);
                int nWidth = (objBitmap.Width * 3);
                int intRed = 0;
                int intGreen = 0;
                int intBlue = 0;

                for (int y = 0; y lt; objBitmap.Height; ++y)
    {
                    for (int x = 0; x lt; objBitmap.Width; ++x)
     {

                        intRed =p[2];
                        intGreen =p[1];
                        intBlue = p[0];
                       
                        if (Mode == "RGB")
                        {
                            intRed = intRed + RedModify;
                            intGreen = intGreen + GreenModify;
                            intBlue = intBlue + BlueModify;
                        }
                       
                        if(Mode=="INVERT")
                        {
                            intRed = 255 - p[2];
                            intGreen = 255 - p[1];
                            intBlue = 255 - p[0];
                        }

                        if (Mode == "GREY")
                        {
                            intRed = (byte) (.299 * intRed + .587 * intGreen + .114 * intRed);
                            intGreen = (byte) (.299 * intRed + .587 * intGreen + .114 * intRed);
                            intBlue = (byte)(.299 * intRed + .587 * intGreen + .114 * intRed);
                        
                        }

                        if (Lighten gt; 0)
                        {
                            intRed = intRed + Lighten;
                            intGreen = intGreen + Lighten;
                            intBlue = intBlue + Lighten;
                        }

                        if (Darken gt; 0)
                        {
                            intRed = intRed - Darken;
                            intGreen = intGreen - Darken;
                            intBlue = intBlue - Darken;
                        }

                        if (intRedgt; 255) intRed = 255;
                        if (intGreen gt; 255) intGreen = 255;
                        if (intBlue gt; 255) intBlue = 255;
                    
                        if (intRed lt; 0) intRed = 0;
                        if (intGreen lt; 0) intGreen = 0;
                        if (intBlue lt; 0) intBlue = 0;

                        p[2] = (byte) intRed;
                        p[1] = (byte) intGreen;
                        p[0] = (byte) intBlue;

                        //++p;
                        p += 3;
                       
                    }
                   
                    p += nOffset;
                }

                objBitmap.Save(ExportDir + strNewFileName, ImageFormat.Jpeg);

                objBitmap.UnlockBits(objBitmapData);

                return strNewFileName;
            }
        }
    }



I found a few links which helped me put this together the codeproject was very helpful (although not the most readable):

http://www.bobpowell.net/lockingbits.htm
http://www2.sys-con.com/ITSG/virtualcd/Dotnet/archives/0104/brown/index.html
http://www.codeproject.com/KB/GDI-plus/csharpgraphicfilters11.aspx

]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
41 9/19/2008 12:00:00 AM 9/19/2008 12:00:00 AM 9/19/2008 12:00:00 AM Remix Day 2 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!

In relation to standard ASP.net


  • Model is your data
  • View is your aspx and ascx controls
  • Controller is your business objects, managers etc

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

The main advantage of using MVC are that:

  • As each unit is independent they are easy to change
  • Seperation suited to unit tests
  • Better search engine optimization due to url parsing

After the MVC session we watched a talk on optimizing ASP.net performance from the front end.

The main conclusions were:

  • Dont make unnecessary http requests e.g. consider combining js and css files
  • Place js and css files at bottom of home page so they are preloaded and due to page position dont interrupt user experience
  • Careful with use of update panel as it posts back whole page, use [webmethod] attribute instead
  • Implement http compression
  • Implement compression in asp.net side
  • Silverlight can be used to preload stuff and appears quicker than javascript
  • Use caching - duh!

The other session I atteneded was given by Mike Taulty on how Silverlight can interact with the page.

This was very impressive:

  • Silvelight can refer to, add, modify amp; hook up to events on the external html page
  • The html page can talk to silverlight
  • Call web services
  • Listen on sockets
]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
39 9/18/2008 12:00:00 AM 9/18/2008 12:00:00 AM 9/18/2008 12:00:00 AM Remix Day 1 Bit dashed this post and in need of an edit but I wanted to get something down before I forgot it all...

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 .

My weird Dr Who esque bed:

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 Sketching user experiences which I purchased.

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:

  • Jobs empowering the designers
  • Lawyers negotiated with record labels $99 per track
  • Ives and his team creating the design

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.

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.

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 http://blogs.msdn.com/saraford/default.aspx

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.



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.

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.

I am looking forward to the MVC session tomorrow (finding out what exactly it is!)

]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
35 9/11/2008 12:00:00 AM 9/11/2008 12:00:00 AM 9/11/2008 12:00:00 AM Color schemes that should never be repeated..
]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
37 9/11/2008 12:00:00 AM 9/11/2008 12:00:00 AM 9/11/2008 12:00:00 AM To thread or not to thread.. Don't would be my advice..

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.

Threading can 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.

Never under estimate the additional complexity that adding threading will add to your application in terms of development, debugging and testing.

Recently I have experienced a number of issues with programs (written by other people grrr) that have implemented threading.

The mistakes I have seen over the last few weeks include:
  • 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
  • Not killing threads properly - Use finally statment etc. Never assume the thread will be killed
  • Some interesting ways to manage multiple threads - make use of thread pool!
  • Deadlocks - not one thats come up yet but something to be aware of

So always practice safe threading or refrain..

]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
33 9/10/2008 12:00:00 AM 9/10/2008 12:00:00 AM 9/10/2008 12:00:00 AM Nunit WatiN basics
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.

But why would you want to use NUnit?
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?
Once a test is written you can run it as many times as you like!
The test will be run the exact same way and wont make mistakes unlike people!
Let tests run overnight to pick up errors or integrate with your build process perhaps with CruiseControl.net
Tests can help pick up integration problems e.g. changes to libraries etc

So how do you use it?
Download and install NUnit from:
http://sourceforge.net/project/downloading.php?groupname=nunitamp;filename=NUnit-2.4.8-net-2.0.zipamp;use_mirror=kent

Create a new class project
In your project add a reference to Nunit.framework.dll


Add the following imports statements in your code:
Imports NUnit.Framework

Create a class with two methods:

Public Class Ben

Public Sub AddTwoNumbers()
Assert.AreEqual(1 + 1, 2)
End Sub

Public Sub MakeTea()
Throw new system.exception("Ben doesnt make tea")
End Sub

End Class


Add the test fixture attribute to the class and Test attribute to your methods.

lt;TestFixture()gt; _
Public Class Ben

lt; test()gt; _
Public Sub AddTwoNumbers()
Assert.AreEqual(1 + 1, 2)
End Sub
lt;test()gt; _
Public Sub MakeTea()
Throw new System.Exception(“Ben doesn’t make tea”)
End Sub

End Class


Compile your application

Open up Nunit
Click File Open Project, select the dll output of your project


Your screen should now look like below:



Notice how NUnit has divided up the tests by class and method.

Click AddTwoNumbers and then click the run button it should pass 1+1=2!



Click MakeTea

The test will fail (Ben doesn’t like to make tea!)

If you want to run both tests at once you can click Ben and then Run.



Congratulations you have now run your first NUnit test!

For further information about NUnit please refer to:
http://www.nunit.org/index.php?p=download


WatiN
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

First of all download Watin from:
http://watin.sourceforge.net/

Download Watin Test recorder from:
http://downloads.sourceforge.net/watintestrecord/TestRecorder101b.msi?modtime=1190992400amp;big_mirror=0

Install Watin Test Recorder

In your project add a reference to Watin.core.dll
In your project add a reference to Interop.SHDocVw.dll

Add a new imports statement at the top of your class file:
Imports WatiN.Core

In your NUnit test project add a new method:

lt;test()gt;_
Public Sub IsGoogleWorking()
Dim objIE As New IE("http://www.google.com")

objIE.TextField(Find.ByName("q")).TypeText("Hicom")
objIE.Button(Find.ByName("btnG")).Click()

Assert.IsTrue(objIE.ContainsText("Hicom"))

End Sub


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:

lt; ?xml version="1.0" encoding="utf-8" ?gt;
lt;configurationgt;
lt;configsectionsgt;
lt;sectiongroup name="NUnit"gt;
lt;section name="TestRunner" type="System.Configuration.NameValueSectionHandler"gt;
lt;/sectiongroupgt;
lt;/configsectionsgt;
lt;nunitgt;
lt;testrunnergt;
lt;!-- Valid values are STA,MTA. Others ignored. --gt;
lt;add value="STA" key="ApartmentState"gt;
lt;/testrunnergt;
lt;/nunitgt;
lt;/configurationgt;

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.

Notes
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
You might need to add a delay in to calls to pages (system.threading.sleep(1000) to give them a chance to load up
You can call javascript by using the runscript method
You can capture screen shots by using the CaptureWebPageToFile method
]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
31 9/7/2008 12:00:00 AM 9/7/2008 12:00:00 AM 9/7/2008 12:00:00 AM New Sony Book Reader - some obvious flaws that should have been fixed
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: http://www.waterstones.com/waterstonesweb/displayProductDetails.do?sku=6337796).


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.

However:

  • Its £199, ouch!
  • Books arent that much cheaper if at all (are you really asking me after paying 200 quid to pay 12.99 for a book?)
  • It needs to be plugged in to download new books
  • 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.
  • Not touch screen - why?

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.

Nice try Sony but I dont think its there yet...

]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
29 9/5/2008 12:00:00 AM 9/5/2008 12:00:00 AM 9/5/2008 12:00:00 AM Book Review - The Career Programmer Guerilla Tactics for an Imperfect World Guerilla Tactics for an Imperfect World

(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)

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.

I have heard much praise 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...)

From the book these are the useful points I took away:
  • 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
  • Choose your battles - its not worth arguing every point even if you "know" you are right -something I know I can be drawn into :)
  • Many times the ideas that are chosen are not necessarily the best - just the best presented and argued (all the more reason to practice speaking/presentation abilities!)
  • Its important to be able to speak both tech and business (obvious but have seen many developers forget this)
  • Testers should be made to feel part of the team - What you work in a company where they actually employ testers you lucky thing!
  • You are not going to change some places, if you dont like it leave!

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.

]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
23 9/2/2008 12:00:00 AM 9/2/2008 12:00:00 AM 9/2/2008 12:00:00 AM Copy SQL server diagrams from one server to another
http://www.codeproject.com/KB/database/ScriptDiagram2005.aspx ]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
25 9/2/2008 12:00:00 AM 9/2/2008 12:00:00 AM 9/2/2008 12:00:00 AM LINQ to SQL Reflection 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. objBusiness.staff[0].firstName

I wanted to make use of this table linking functionality in order to avoid having to write this code myself.

Below is a snipet of code of how to get a proprties value from a LINQ to sql class.

using System.Data.Linq;
using System.Reflection;


DataContext objCon = new DataContext(strConn);
Episode objEpisode;
string strObjectName = "";
string strFieldName = "";
strObjectName = "Episode";

strFieldName = "EpisodeDate";

Table objEpisodeTable = objCon.GetTable();

//Get an item
objEpisode = objEpisodeTable.Single(Episode =gt; Episode.EpisodeID == new Guid(guidPatientID));

PropertyInfo pi = objEpisode.GetType().GetProperty(strFieldName);
//Get sub property
strObjectName = "Patient";
strFieldName = "CreatedDate";

PropertyInfo objToCreate = objEpisode.GetType().GetProperty(strObjectName);

object objTmp = objToCreate.GetValue(objEpisode, null); PropertyInfo objFieldInfo = objTmp.GetType().GetProperty(strFieldName);

MessageBox.Show(objFieldInfo.GetValue(objTmp,null).ToString());

One to many items
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.

E.g. in our example objBusiness.staff[0].firstName 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.

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.

First you need to test if the property is compatible with IList. This can be done with the following statement:

if (objToCreate is IList)

You can then cast the object to IList (does this seem weird to anyone else you can do this?)

IList listObject = (IList) objTmp;

You can then iterate through the objects in the object.

foreach (object o in listObject)
{

}


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. ]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
27 9/2/2008 12:00:00 AM 9/2/2008 12:00:00 AM 9/2/2008 12:00:00 AM New Google browser beta released
It is available from:
http://www.google.com/chrome/

They also produced a comic book explaining the new features which is quite nice:
http://www.google.com/googlebooks/chrome/

First impressions are it looks nice and works well.

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.

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!

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...

]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
21 8/29/2008 12:00:00 AM 8/29/2008 12:00:00 AM 8/29/2008 12:00:00 AM Learn presentation and speaking skills with Woking Speakers
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: http://www.wokingspeakers.org.uk/ ]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
19 8/26/2008 12:00:00 AM 8/26/2008 12:00:00 AM 8/26/2008 12:00:00 AM SQL Bits conference 13th Sep, Hatfield http://www.sqlbits.com/information/MainAgenda.aspx

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.. ]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
17 8/25/2008 12:00:00 AM 8/25/2008 12:00:00 AM 8/25/2008 12:00:00 AM Google automated queries
]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
15 8/24/2008 12:00:00 AM 8/24/2008 12:00:00 AM 8/24/2008 12:00:00 AM Reading ATOM feeds with LINQ
Well okay but LINQ can make it all so much easier for you...

Today I wanted to integrate blog posts from this site into another site.

This was very easy with recent LINQ enhancements:

XDocument objDoc = new XDocument();
XNamespace objNS ="http://www.w3.org/2005/Atom";

objDoc = XDocument.Load("http://www.simpleisbest.co.uk/feeds/posts/default");

var query = from objNode in objDoc.Descendants(objNS + "entry")
select new
{
link = objNode.Element(objNS + "link").Attribute("href"),
id = objNode.Element(objNS + "id").Value,
title=objNode.Element(objNS + "title").Value,
content=objNode.Element(objNS + "content").Value,
published = objNode.Element(objNS + "published").Value
};

And then just bind query to your repeater/datagrid :)

The only thing to remember is to add the namespace as I was puzzled for a while why no nodes were returned doh.

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.

I would recommend the book LINQ in action (http://www.amazon.co.uk/LINQ-Action-Fabrice-Marguerie/dp/1933988169/ref=sr_1_1?ie=UTF8amp;s=booksamp;qid=1219586627amp;sr=8-1). For a techy book it is very readable.

]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
13 8/23/2008 12:00:00 AM 8/23/2008 12:00:00 AM 8/23/2008 12:00:00 AM How to install Cruise Control .net Cruise Control.net is a continous integration server application. So er what does it do?

  • It allows you to automate complilation (builds) of your application
    You can get it to retreive the latest version from your source control system before building
  • You can automate other tasks such as NUnit tests to be performed as part of this build
  • You can receive the results of the builds and tests
  • And best of all its free (always a plus with tight ass bosses)!

But why would you want to do this?

  • In a large scale project with many developers working on it you can find out early on if a change has broken the build
  • Integration testing e.g. run it overnight to receive notification of build/unit test failures
  • Create many different build configurations and use CruiseControl.net as a way of kicking them off

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.

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.

Using CruiseControl.net

1) Download NUnit from: http://sourceforge.net/project/downloading.php?groupname=nunitamp;filename=NUnit-2.4.8-net-2.0.msiamp;use_mirror=osdn (not strictly necessary but this tutorial will be integrating NUnit tests in the build)
2) Download CruiseControl.net from: http://sourceforge.net/project/showfiles.php?group_id=71179amp;package_id=83198
3) Check you have IIS amp; .net 3.5 installed
4) Install NUnit amp; CruiseControl.net
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:



Create Project to build

Now what we need to do is create a sample project for CruiseControl to build.

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\.

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)



Add the following code to your console application:

using System;
using NUnit.Framework;
namespace MonitoringApplication
{
[TestFixture]
public class Program
{
[Test]
public void AlexTest()
{
Assert.AreEqual(1, 1);
}
public static int Main(string[] args)
{
//My program
return 0;
}
}
}

Check the application compiles okay.

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.

1) Open ccnet.config in notepad (by default its at C:\Program Files\CruiseControl.NET\server).
2) Modify it so it looks like this config file. This config file automates a build on Mondays and Wednesdays at 18:00 and runs NUnit tests.
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.
4) If you now open up a web browser and go to http://localhost/ccnet/ you should see the main build screen like below:



5) Click the Force button to run the build.
6) You can then click refresh status to see if it built correctly if it did under the build status it should say Success.
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.
8) If the project didnt build properly check your file paths are correct in ccnet.config.


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.

Further reading

These tutorials helped me to get this running:

http://johnnycoder.com/blog/2008/01/29/getting-started-with-cruisecontrolnet/
http://weblogs.asp.net/jdanforth/pages/How-to-Hook-Up-a-VS.NET-2005-Solution-With-CruiseControl.NET-in-a-Few-Minutes.aspx

]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
11 8/19/2008 12:00:00 AM 8/19/2008 12:00:00 AM 8/19/2008 12:00:00 AM Update Panel - Message received could not be parsed 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:



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)

]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
7 8/18/2008 12:00:00 AM 8/18/2008 12:00:00 AM 8/18/2008 12:00:00 AM Visual Studio SP1 out 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.

http://www.microsoft.com/downloads/details.aspx?FamilyID=fbee1648-7106-44a7-9649-6d9f6d58056eamp;DisplayLang=en

]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
9 8/18/2008 12:00:00 AM 8/18/2008 12:00:00 AM 8/18/2008 12:00:00 AM MS SQL 2008 Unleashed event http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032385183amp;Culture=en-GB ]]> Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk 5 8/13/2008 12:00:00 AM 8/13/2008 12:00:00 AM 8/13/2008 12:00:00 AM Enhancements to DevEvening
Tonight I have made the following changes:

Ability to update email and password
Feedback forms (might change these about a bit as we have more than one presentation per session)
Converted data access to LINQ to SQL (so much nicer than direct db calls)
Aestheric changes ]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
3 8/11/2008 12:00:00 AM 8/11/2008 12:00:00 AM 8/11/2008 12:00:00 AM Email issues resolved Vbug Silverlight event
http://www.vbug.co.uk/Events/August-2008/VBUG-Bracknell-Creating-Silverlight-apps-using-Blend-and-VS08.aspx ]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk
1 8/9/2008 12:00:00 AM 8/9/2008 12:00:00 AM 8/9/2008 12:00:00 AM DevEvening Email Down Currently due to 1amp;1 upgrading their email servers there are problems with DevEvening email access:

http://www.theregister.co.uk/2008/08/08/1and1_exchange/

Hopefully these should be fixed shortly...
]]>
Alex Mackey http://www.simpleIsBest.co.uk noreply@devcafe.co.uk