Friday, April 15, 2005

Thanks to Clare Dillon Belfast is now also one of the locations for the "Visual C# and Windows Forms in Visual Studio 2005 Tour".

Mike Henderlight (Program Manager for the .Net Client Team) and Luca Bolognese (Program Manager for the C# team) will be giving high level talks about the new features and enhancements in C# 2.0, WinForms and Visual Studio 2005.

More information can be found on Clare's blog and you can also register for the event  which will be held at The Innovation Centre (Northern Ireland Science Park).

 

Friday, April 15, 2005 8:39:42 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0]Trackback
 Wednesday, April 13, 2005
I've uploaded the files and slides from Mondays SQL Server talk onto the NIMTUG website.
Thursday, April 14, 2005 6:29:00 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0]Trackback
 Tuesday, April 12, 2005

Tonight we had Microsoft's Robert Burke giving a talk on SQL Server 2005. Like the true .Net evangelist he is not even a forgotten USB cable or dodgy Virtual PC image could stop this guy giving a great talk. Rob covered most of the new feature but due to time constraints could only demo some of them, even so it gave us a good indication as developers of what to expect from Microsoft's next SQL Server release which should be with us shortly. Rob will be sending me the files/slides and related links from the talk shortly which I’ll be posting no the NIMTUG site, he also had a couple of interesting questions which stumped him but which he will be answering in his blog shortly.

 

We had a turnout of 33 and afterwards about 20+ of the talks attendees meet up afterwards for a drink and some food which was really good craic. Allot of good ideas came up with everyone getting together and talking which is something we'll hopefully be doing on a regular basis from now on.

If you have any follow up questions for Rob please post them on the NIMTUG forum

Tuesday, April 12, 2005 8:35:44 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0]Trackback
 Friday, April 08, 2005

I signed up for MSDN Ireland Connections a while back and completely forgot about the free book I'd requested until it arrived this morning - now all I have to do is find some free time to read it.

Introducing Microsoft SQL Server 2005 for Developers

 

Friday, April 08, 2005 9:25:16 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0]Trackback

UPDATE: I since written my own AJAX library for ASP.Net

I first heard about AJAX a while ago but never had the time to check it out properly but then i came across Michael Schwartz's AJAX Wrapper for .Net and hacked around with it for a while. It's incredibly simple to use, you simple add the HttpHandler to you web.config, add a custom attribute on the methods you want to expose sand add another custom attribute to the classes you want to transport and write a bit of JavaScript. The control I wrote was a simple category selector but by using this technique I'm able to remove allot of postbacks from my web application. PostBacks seems harmless enough but should be used sparingly in large projects - especially is the pages are large and ViewState is used heavily. I don't think I'm going to be ditching winforms just yet like but I'll certainly be using AJAX where possible.

You can download the dll from Michael's blog

http://weblogs.asp.net/mschwarz/archive/2005/04/07/397504.aspx 

 

Friday, April 08, 2005 1:23:18 PM (GMT Daylight Time, UTC+01:00)  #    Comments [5]Trackback
 Thursday, March 31, 2005

I've updated the event page for Robert Burke's talk to include the summary and Robert's bio. You can register for the event and also post any pre-talk questions you may have which you want Robert to cover in his talk.

http://nimtug.org/11-april-2005.aspx 

Friday, April 01, 2005 1:07:43 AM (GMT Daylight Time, UTC+01:00)  #    Comments [2]Trackback
 Sunday, March 27, 2005

I recently got caught out when writing some operator overloading code. I had originally checked if either of the objects were null in order to prevent a null reference exception not realising that the check itself was actually creating an infinite loop. Doh! Below is the correct code skeleton.

public static bool operator == (ObjectType c1,ObjectType c2)
{
    if( !(c1 is ObjectType) )
    {
        return !(c2 is ObjectType);
    }

    return c1.Equals(c2);
}

public static bool operator != (ObjectType c1, ObjectType c2)
{
    if( !(c1 is ObjectType) )
    {
        return (c2 is ObjectType);
    }

    return !c1.Equals(c2);
}


public override bool Equals(object obj)
{
    if(obj is ObjectType)
    {
        // do compare logic here
        return ((ObjectType)obj).Value == this.Value;
    }
    else
    {
        return false;
    }
}

Sunday, March 27, 2005 12:04:31 PM (GMT Daylight Time, UTC+01:00)  #    Comments [1]Trackback
 Friday, March 25, 2005

When working in ASP.Net there is often the need to store an object between page postbacks which is accomplished using ViewState. Sometimes the object happens to be a property of the subclassed Page or UserControl and I’ve noticed that a lot of people use this below technique.

Bad:

public ObjectType PropertyName
{
    get
    {
        ObjectType obj = this.ViewState["PropertyName"] as ObjectType;
        
        if( obj == null )
        {
            obj = new GetFromDataBase(); // or = new ObjectType();
        }
        
        return obj;
    }
    set
    {
        this.ViewState["PropertyName"] = value;
    }
}

Problems:

Every time the property is accessed you either load from ViewState and cast or save to ViewState. (performance hit)

If GetFromDataBase() returns null you will be accessing the database on every get. (performance hit)

If you instead instantise the object the property can never be null. (bad logic)

 


 

Good:

ObjectType _PropertyName;

private void Page_Load(object sender, System.EventArgs e)
{
    if (!this.IsPostBack)
    {
        _PropertyName = GetFromDataBase(); // or = new ObjectType();
    }
}


public ObjectType PropertyName
{
    get
    {
        return _PropertyName;
    }
    set
    {
        _PropertyName = value;
    }
}



protected override object SaveViewState()
{
    this.ViewState["PropertyName"] = _PropertyName;

    return base.SaveViewState ();
}

protected override void LoadViewState(object savedState)
{
    base.LoadViewState (savedState);

    _PropertyName = this.ViewState["PropertyName"] as ObjectType;
}

 

 

Friday, March 25, 2005 11:46:55 AM (GMT Standard Time, UTC+00:00)  #    Comments [1]Trackback

Not the best of introductions to the blogging world - I had just finished my first post and clicked on the submit button only to get this message "An error has been encountered while processing the page. We have logged the error condition and are working to correct the problem. We apologize for any inconvenience. ".

Friday, March 25, 2005 11:16:58 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]Trackback