Archive for April, 2009

MORE iPhone links

I’m currently down with man-flu, however have found the next tutorial to have a go with when I’m back – on iCodeBlog is a multi-part tutorial taking you through building your own iphone tennis app!  I shall update this post as i find other stuff

No Comments

iPhone Hello World! (and other iPhone dev links!)

My very first iPhone App!  Good tutorial to help you actually get your hands dirty! – the same site also hs a bunch of other iphone tutorials which are worth a look and i shall be attempting over the coming days..

First iPhone Application – iPhone SDK Articles.

Some good video tutorials for starting out with iphone development

Christo’s iPhone Dev Page.

A useful beginners guide for iPhone development which I’m about to embark on! eek!

Trails in the Sand » Blog Archive iPhone Development: Objective-C Primer ».

No Comments

ASP.NET Page Life Cycle Overview

I used to have this printed out and pinned up but no longer have any space so figured i’d just blog it!

Page Event Typical Use
PreInit Use this event for the following:

  • Check the IsPostBack property to determine whether this is the first time the page is being processed.
  • Create or re-create dynamic controls.
  • Set a master page dynamically.
  • Set the Theme property dynamically.
  • Read or set profile property values.
    If the request is a postback, the values of the controls have not yet been restored from view state. If you set a control property at this stage, its value might be overwritten in the next event.
Init Raised after all controls have been initialized and any skin settings have been applied. Use this event to read or initialize control properties.
InitComplete Raised by the Page object. Use this event for processing tasks that require all initialization be complete.
PreLoad Use this event if you need to perform processing on your page or control before the Load event.

Before the Page instance raises this event, it loads view state for itself and all controls, and then processes any postback data included with the Request instance.

Load The Page calls the OnLoad event method on the Page, then recursively does the same for each child control, which does the same for each of its child controls until the page and all controls are loaded.

Use the OnLoad event method to set properties in controls and establish database connections.

Control events Use these events to handle specific control events, such as a Button control’s Click event or a TextBox control’s TextChanged event.

In a postback request, if the page contains validator controls, check the IsValid property of the Page and of individual validation controls before performing any processing.
LoadComplete Use this event for tasks that require that all other controls on the page be loaded.
PreRender Before this event occurs:

The PreRender event occurs for each control on the page. Use the event to make final changes to the contents of the page or its controls.

SaveStateComplete Before this event occurs, ViewState has been saved for the page and for all controls. Any changes to the page or controls at this point will be ignored.

Use this event perform tasks that require view state to be saved, but that do not make any changes to controls.

Render This is not an event; instead, at this stage of processing, the Page object calls this method on each control. All ASP.NET Web server controls have a Render method that writes out the control’s markup that is sent to the browser.

If you create a custom control, you typically override this method to output the control’s markup. However, if your custom control incorporates only standard ASP.NET Web server controls and no custom markup, you do not need to override the Render method. For more information, see Developing Custom ASP.NET Server Controls.

A user control (an .ascx file) automatically incorporates rendering, so you do not need to explicitly render the control in code.

Unload This event occurs for each control and then for the page. In controls, use this event to do final cleanup for specific controls, such as closing control-specific database connections.

For the page itself, use this event to do final cleanup work, such as closing open files and database connections, or finishing up logging or other request-specific tasks.

During the unload stage, the page and its controls have been rendered, so you cannot make further changes to the response stream. If you attempt to call a method such as the Response.Write method, the page will throw an exception.

ASP.NET Page Life Cycle Overview.

No Comments

Removing stored log in credentials for network shares in Windows XP

At work we run Windows XP and recently had a big security review where all the passwords were changed. This complicated things for me as our Source Safe database is held on a central server which I access across the network. When trying to access the share I was prompted for a password, so I entered the new one yet it refused to let me in. It seems this is because even though Windows asks you for a password, it doesn;t actually bother using the value you enter as the credentials are all cached!

A quick google later and it turns out you can force windows to clear this cache from the command line (but it also nocks out your network drives so you will need to re-map these!

net use /d *

It will ask you if you’re sure- just say yes and it will wipe out your mapped drives and any saved credentials – so make sure you note down the list of drives you currently have mapped which it will show you, so you can set them up again!

No Comments

Creating a re-usable shopping basket with Generics in C#

We recently had troubles with our new reusable basket we’re developing at work.  We sell books, and most books come from one central data source which for the sake of this article i shall call CDS- so we have a CDS entities project which holds elements Group, Book, Author etc.  However not all of our sites run use the CDS for their data- so we have other projects with their own elements for Book, Author, Category etc which hold their own data.

We wanted to create a central project containing the basket functionality which we could drop into any project and use.  So the basket needs to be able to add lots of different types of books- some from the CDS entity library or some any other entity library we use.  To do this we created an Interfaces project which holds an interface called IBook which held the minimum data required by the basket such as Title, Price, ISBN, Cover Image.  This project is then referenced by the sites, the entity libraries (like CDS or any other’s we build) and the basket itself.

Adding the book to the basket was fine, however the problem arose when viewing items- the basket needed to be able to load the book data back- this is fine we thought- we would simply add a load() method to IBook, however this didnt solve the problem as the basket only had IBook signature of load- it didn’t know which concrete implementation of load to run.

The answer was to use generics.  We added a generic parameter to the top of the basket which accepted a type which it assumed to be derived from IBook and always have a default constructor, like so;

public class Basket<T> where T : Hachette.ProcessLayer.IBook, new() {
   private List<BasketItem<T>> _basket_items;

Likewise we made the basket item’s generic, and pass the type T from the basket to the basket item when instanciating them- the basket items are then able to define a real book instance of type T so it knows which concrete book it’s dealing with, so it can call the correct load method. The use of generics here means the basket object can reference a real book class from the CDS project (in a separate assembly) without having to reference that assembly, meaning we can drop in any type of book from any assembly for future sites, and with the parent website stating the type to use when creating the basket, the basket can remain completely independent.


Machine Key Generator

A while back we were having the occasional issue on the web farm with the view state validation failing- this was due to the machine key differing on the two machines on the farm so the view state was being encrypted on one machine then posted back and the other machine was picking up the request and trying to decrypt with it’s own key.

We resolved this by updating the machine.config file on both machines and generating a fixed machine key which we got from the site – being in the machine config means this will apply for any website hosted on that server.

Incidentally, the machine.config file is located a;



No Comments

Colour Picking Website colour picker tool colour picker tool

Tash showed me quite a cool site, thought of more use to designers than developers- it’s – this shows you premade palettes of colours which owrk together, and also has a clever flash tool allowing you to create your own palette’s while offering you some guidance.

1 Comment

JQuery Accordion Control links not working

I recently swapped the .net Accordion control on my main home page from the Ajax Control toolkit for the jQuery Accordion control from this was mainly because i have a big moving flash background of the sky wooshing past, and found the MS accordion control a bit too heavy to expand out smoothly on slower machine, so thought i would try the jQuery version and was pleased to find it was a lot smoother.

However, to my horror, all my links stopped working!

$(function() {
                active: false,
                alwaysOpen: false,
                animated: "easeslide"
<ul id="menu" style="width: 250px;">
    <a href="#">Welcome</a>
    <div>This is the home page to what will eventually be a whole bunch of different web projects that i have online to fiddle about with.</div>
    <a href="#">Work</a>
          <a title="My Web Development Blog" href="">My Code Blog</a>

This is because the jQuery accordion, using the default settings as i was, treats links as buttons for expanding the sections of the accodion, so voids their default action.  I resolved this by updating the jQuery settings to only treat links with a specific class as the accordion headings, and leave other links alone- i created a new class called accordion-label to use for the accordion buttons and updated the jquery as follows;

$(function() {
                active: false,
                alwaysOpen: false,
                animated: "easeslide",
                navigation: true,
                header: "a.accordion-label"

I then added the accordion-label class to my “Welcome” link, “Work” link etc, and left the rest as-is.

No Comments


As most of my colleagues will know, I love JQuery and one of our contractors, Lee, today showed me the brilliant JQueryUI library which features a whole bunch of functionality similar to the horribly bloated .net control extenders. Well worth a look over at

No Comments

Move from to WordPress 2.7.1!

I’m a .net developer by day, so am always keen to use .net technologies where ever possible.  For the past few months I’ve been persevering with, a dot net blogging platform which I run on my Windows 2k8 IIS7 box from home, however I can do it no more!  I’ve found myself looking on with envy at the features in the newer builds of WordPress as i struggle on with the various “quirks” of BlogEngine and finally decided I could no longer put up with it- I’ve made the switch to WordPress which I’ve used in the past and I have to say I’m pleasantly surprised- not only is it as good as i remember, but it’s come on leaps and bounds both feature and interface wise since I last used it.

To get WordPress up and running I had to setup PHP5, mySQL (and phpMyAdmin to save me the pain of mySQL command line syntax again) under IIS7 which I also found to be easy (all up and running within an hour!) following the guides over on the TrainSignal training website

No Comments

I absolutely love these. They came at the lace wigs are good quality, and very soft. Absolutely love these extensions. I just love this hair. Hair came on time, I waited until after hair extensions uk very full, no shedding and it is been installed for 3 weeks now and yes I jus ordered 3 more bundles. Lol. I definitely recommend this company for your bundles ladies. They are soft, hair bundles on the head for human hair wigs and I would continue to recommend them. I have thinner hair so they cover and blend nicely.