Monday, February 09, 2009

Things I've been doing

Here is a list of stuff I've been working on:

  • Object Relation Mappers (nHibernate using Fluent)

  • Inversion of Control containers (AutoFac, ninject, Structure Map, Windsor, MEF ???)

  • Test Driven Development - This is about DESIGN NOT TESTS, and I need to make myself do this more. DON'T WRITE CODE WITHOUT TEST!!!

  • SOLID Priciples (see Uncle Bob)

    1. Single Responsibility Principle - A class should have one, and only one, reason to change.

    2. Open Closed Principle - You should be able to extend a classes behavior, without modifying it.

    3. Liskov Substitution Principle - Derived classes must be substitutable for their base classes.

    4. Interface Segregation Principle - Make fine grained interfaces that are client specific.

    5. Dependency Inversion Principle - Depend on abstractions, not on concretions.



Okay, now I have the basics. Well enough of the basic to do little bit better...

I've been working with these tools and principle for a couple of months now and I have realised what a big difference this make. Not a little bit difference, but a HUGE difference.

You can change the whole structure of the system, and when you're finished all the tests still pass. I don't think this would have been possible before, or I was just to scared to try it.

Wednesday, January 30, 2008

Been a while

Well I haven't kept this very up to date...

I'm Doing stuff......

Sunday, August 19, 2007

Scrum Masters

I was recently sent an e-mail where I can print off my Scrum Masters Certificate.
So, I also had a look for myself on the Scrum Masters list.

I also found John Magner on this page, and Shaun Keane on this page

Thursday, August 16, 2007

WPF and VS2008 beta 2

I was creating my first real wpf application and kept getting the followng error.

...xaml' does not belong to te project being debugged.















What I did was I set up 2 textboxes, the first one has an event wired up on change and it updates the second textbox.

DON'T DO THIS.
It fires the event on the first one (I think when it sets the defaul value) before the second textbox has been created and throws a null referrence.


xaml



Code Behind

public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}

private void textBox1_changed(object sender, TextChangedEventArgs e)
{
textBox2.Text = "World";
}
}

Friday, July 20, 2007

Wild life at our house

I was just outside with Curtis (son), as he was releasing a gecko that had been running around the house and he showed me 3 possums in the trees right next to the house.
For me, that is very cool.

Gecko on a business card

Windows Vista Aero vs Linux Ubuntu Beryl

I heard about this a while ago, but hadn't seen it running.
The video is worth watching. Video

Thursday, July 19, 2007

Moved to Sunny (but right now cold) Brisbane

I have moved to Sunny Queensland!!!!
We have been up here for about a month now and like it a lot. We just need all our friend to move up here as well.

My wife an kids love the house (so do I). Its a bit of a trip into Brisbane but its worth it.















Work has ended up to be good, I've got some work at Technology Effect and I'm enjoying it. I miss all the guys at the AFP, and Tuesdays indoor cricket (if I can get them all up here it would be perfect). Well, I'll use this blog a lot more now and let people know what I'm doing.

Thursday, January 11, 2007

Tagged for five things

Alright... Rory Primrose has tagged me.

5 most things about me.

  1. I don't like being told I can't do something, and will go out of my way to prove that it can be done...to a point of being obsessive.
  2. I am scared of spiders, and Jamie (my 3 year old) tries to scare me with his toy spiders.
  3. I own a motorbike and really enjoy riding it, probably too much (I need to slow down).
  4. When I was at high school I was told by 2 teachers that I would not get into uni (just realized this relates to point 1).
  5. My father in-law was in the same year in high school as John Howard (I thought it was interesting). There high school reunion was last year.

Thursday, November 16, 2006

Sidebar gadgets in vista

I wanted to create a dynamic gadget for my windows sidebar. The original purpose was for a view over all the builds that are running with red and green lights that refesh every couple of seconds.

But I started small building the smaples "Hello World", etc...

So what I have now is a Gadget that does:

  • an async call to a web site
  • Added a timer, that cals the site every 10 sec.
  • made it the timer interval a setting (gadget settings).
  • Add the web site as a setting.
  • Gave it some default settings, so that it works the first time.
  • Dynamiclly creates a table with the reults from the web site.
  • Deletes to the table before another table is added (next call in 10 sec).

Issues:

  • Did have it working in Gadgets and a Web Page, but broke it about 30min ago and can't work out whats wrong.
  • Dose not call my build results web service yet.
  • Need to clean up the background image, and icon.
  • Haven't added icons for Build Succces or Faliure ( in-fact just returns 3 customers, no build data).
  • But now know what I need to do to finish it. Here is what I have so far.
  • I know it not very good, I just need to store it somewhere for later.


    HelloWorld.html





















    AjaxSample.js
    ////////////////////////////////////////////////////////////////////////////////
    //
    // By: Paul McKee and other peple mentioned in links
    //
    ////////////////////////////////////////////////////////////////////////////////
    var timerID;
    var startTimer = True;
    var timerInterval = 10000;
    var wsURL = "http://localhost:50824/SidebarBuilds/Service.asmx/GetCustomers?fakeParam=11";

    function OnLoad()
    {

    timerInterval = 10000;
    wsURL = "http://localhost:50824/SidebarBuilds/Service.asmx/GetCustomers?fakeParam=11";
    ReadContentText();
    setContentText();
    try{
    System.Gadget.settingsUI = "Settings.html";
    System.Gadget.onSettingsClosed = SettingsClosed;
    }
    catch (e)
    {}

    // Start it running
    UpdateTimer()
    }

    function ReadContentText()
    {
    try
    {
    // *********************************************
    ///10000 is 10 sec
    //timerInterval = 10000
    // *********************************************
    timerInterval = System.Gadget.Settings.read("timerInterval");
    // URL for web service
    wsURL = System.Gadget.Settings.read("wsURL");

    }
    catch (e)
    {}
    if (timerInterval == null) {timerInterval = 10000;}
    if (wsURL == null) {wsURL = "http://localhost:50824/SidebarBuilds/Service.asmx/GetCustomers?fakeParam=11"; }

    // I'm not sure why it needs to be a string?
    if (timerInterval.length ="0") {timerInterval = 10000;}
    if (wsURL.length = "0") {wsURL = "http://localhost:50824/SidebarBuilds/Service.asmx/GetCustomers?fakeParam=11"; }

    }

    function SettingsClosed()
    {
    try
    {
    ReadContentText();
    //setContentText();
    }
    catch (e)
    {}
    }

    function setContentText()
    {
    try
    {
    System.Gadget.Settings.write("timerInterval",timerInterval);
    System.Gadget.Settings.write("wsURL",wsURL);
    }
    catch (e)
    {}
    }


    function StartTimer()
    {
    if (StartTimer)
    {
    timerID = setTimeout("UpdateTimer()", timerInterval);
    }
    }


    function StopTimer()
    {
    clearTimeout(timerID);
    StartTimer=False;
    }

    function UpdateTimer()
    {
    CallService();
    StartTimer();
    }


    //*************************************************************************************
    // See link for details: http://developer.mozilla.org/en/docs/AJAX:Getting_Started *
    // Create the Web service call and the call back.
    //*************************************************************************************
    function CallService()
    {
    text1.value = "onreadystatechange";
    webService = new ActiveXObject("Msxml2.XMLHTTP"); //new ActiveXObject("Microsoft.XMLHTTP");
    webService.onreadystatechange=function() { State_Change(webService); };
    text1.value = "GET:" + wsURL;
    webService.open("GET",wsURL,true);

    text1.value = "SEND";
    webService.send(null);

    }

    function State_Change(webService)
    {

    if (webService.readyState==4)
    {
    if (webService.status==200)
    {

    var xmlDoc = new ActiveXObject("Microsoft.XMLDom");
    xmlDoc.load(webService.responseXml);
    ProcessData(xmlDoc);

    }
    else
    {
    text1.value = "ERROR - webService.status:" + webService.status + webService.responseXml;
    }
    }

    }

    // ******************************************************************
    // Prcess the data returned from the web service
    // ******************************************************************
    function ProcessData(xmlSource)
    {

    var customers = xmlSource.getElementsByTagName('Customer');
    mytable = createDynTable(customers);

    }

    // ******************************************************************
    // http://www.dustindiaz.com/add-and-remove-html-elements-dynamically-with-javascript/
    // ******************************************************************
    function removeElement(id)
    {
    var d = document.getElementById('myDiv');
    try{
    var oldTable = document.getElementById(id);
    if (oldTable != null)
    {
    d.removeChild(oldTable);
    }
    }
    catch (e)
    {
    // alerts don't work in sidebar gadgets
    //alert("Function: removeElement " + e.description);
    }

    }
    //*************************************************************************************
    // Create dynamic table
    // link: http://www.faqts.com/knowledge_base/view.phtml/aid/41352
    // I only modified the function to add the cell data.
    //*************************************************************************************
    // This function creates table dynamically,.
    function createDynTable(customers) {

    var tableId = "dynmicTable";


    // get the reference for the body
    //var mybody = document.getElementsByTagName("body")[0];
    var mybody = document.getElementById('myDiv');

    var row = customers.length;
    var col = customers[0].childNodes.length


    // Remove the table
    removeElement(tableId);

    // creates a element and a element
    mytable = document.createElement("table");
    mytable.setAttribute('id',"dynmicTable");
    mytablebody = document.createElement("tbody");
    // creating all cells
    for(var j = 0; j <>element
    mycurrent_row = document.createElement("tr");
    for(var i = 0; i <>element
    mycurrent_cell = document.createElement("td");

    // add edit cell;
    mycurrent_cell.ondblclick = function (evt) { editCell(this);};

    // creates a text node
    currenttext = document.createTextNode(customers[j].childNodes[i].text);
    // appends the text node we created into the cell
    mycurrent_row.appendChild(mycurrent_cell);
    }
    // appends the row into
    mytablebody.appendChild(mycurrent_row);
    }
    // appends into

    mycurrent_cell.appendChild(currenttext);
    // appends the cell
    into the row

    mytable.appendChild(mytablebody);
    // appends
    into
    mybody.appendChild(mytable);
    // sets the border attribute of mytable to 2;
    mytable.setAttribute("border", "2");

    return mytable;
    }


    Settings.html




    Code for the Web Service (in C#)

    using System;
    using System.Web;
    using System.Web.Services;
    using System.Web.Services.Protocols;
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class Service : System.Web.Services.WebService
    {
    public Service () {
    //Uncomment the following line if using designed components
    //InitializeComponent();
    }
    [WebMethod]
    public string BuildSuccess(String BuildName)
    {

    String returnValue = String.Empty;

    // Will use an XML config file to store the details of where to look
    // for valid biulds
    switch (BuildName)
    {
    case "MainLine":
    {
    returnValue = "True";
    break;
    }
    default:
    {
    returnValue = "False";
    break;
    }
    }
    // Return the results
    return returnValue;
    }
    [WebMethod]
    public Customer[] GetCustomers(int fakeParam)
    {
    // Customer[] customerList = new Customer[3];
    Customer[] customerList = new Customer[] { new Customer("Mark", "Johnston", 35), new Customer("Joe", "Bloggs", 40), new Customer("Marjory", "Dorrs", 38) };
    return customerList;
    }
    }


    ///
    /// Summary description for Customer
    ///

    public class Customer
    {
    public Customer()
    { }
    public Customer(String firstName, String lastName, int age)
    {
    this.FirstName = firstName;
    this.LastName = lastName;
    this.Age = age;
    }
    private String _FirstName;
    public String FirstName
    {
    get { return _FirstName; }
    set { _FirstName = value; }
    }
    private String _LastName;
    public String LastName
    {
    get { return _LastName; }
    set { _LastName = value; }
    }
    private int _Age;
    public int Age
    {
    get { return _Age; }
    set { _Age = value; }
    }
    }

    Wednesday, August 16, 2006

    Managed to hire another gun developer

    A quick note that we now have another gun developer starting at the Australian Federal Police.

    Rory Primrose

    Saturday, August 06, 2005

    Scrum and Agile Projects

    I have just finished reading Agile Project Management
    with Scrum
    and also thinking about how to apply it in the current enviroment I am in.

    I just read Agile Development Products - Soft Targets? by Rocky Heckman. At this stage I disagree, that systems developed using an Aglie methodology are more at risk that other projects. As security should be a requirement of the system and developed as such (1st or 2nd sprint). But I might have to think about this a bit more...

    My next big this to look at are:
  • Data connection on state less applications (eg. connection pools)
  • Pros and Cons of Windows forms against Web application on an internal network
  • Application Frameworks, How useful are they? How big should they be?
  • How hard is it more an area from waterfall to agile?
  • How to get all this working together?



    The next thing I'm going to read is An Introduction to SQL Server Service Broker

    Hopefully I'll keep this blog a bit more up to date.

    Paul
  • Thursday, April 14, 2005

    Who am I

    My first Blog.....

    To start with, who am I?

    I'm a .Net developer/Team Leader, my current professional interests are .Net, and Agile Development Methodology.

    I'm currently based in Canberra Australia.

    Some of the people that I have met recently (last 6 months) that I’ve been impressed with are:

    Dr. Neil Roodyn
    Darren Neimke
    Mitch Denny

    Hopefully my next post will have something interesting, as this is more of a test to see how it works.