OpinionatedGeek Logo
Windows Tools

Source code for all these tools is on GitHub.

ADO.NET ConnTest A simple, free Windows program to test ADO.NET connection strings.

Lines of C# Ever wanted to know how many lines of C# code are in a file or folder hierarchy?  This free Windows program will tell you.

XmlTools Free tools to process XML files from the command line.

But there was a new release of the PowerPack.


Posted by 'Geoff' on Monday, 04 July 2005. No comments.
OK, let's say you spend a long, long time writing a rather nifty ComboBox for ASP.NET.
 
What would you do if someone looked at your code to fix issues in their own version?
 
What would you do if they then gave their version away for free?
 
And to make it worse, what would you do if they publicly thanked you?
 
It all makes me wonder why I bother.  Why go to the effort of producing controls at all?  Why spend time fixing the really difficult DHTML issues whenever someone else will just come along, "review" the code and then release their own version, for free, so that people don't buy from the folks that fixed the issues?
 
Why do I bother?
 
(P.S. No, I don't have kids.)


Posted by 'Geoff' on Wednesday, 15 June 2005. No comments.
I've just put the finishing touches to the latest release (v1.1.0.2) of the PowerPack.  You can download it right now.

One of the changes made in this release was moving the Javascript objects' methods into closures set through the prototype.  This is interesting stuff, if you're into DHTML, and like watching paint dry if you don't.  Feel free to switch off now.

Javascript's notion of objects is a bit different from what developers in compiled OO languages are used to.  Instead of having a specific entity like a constructor, Javascript just uses a function.  If the function returns something, and it's called via a "new" call instead of a regular function call, then it's assumed to be a constructor.

Which is nice enough, but it does leave you with the problem of how you create methods in your object.

The way it was done int he PowerPack up until now was just to do something like:

function MyObject ()
{
    this.myMethod = myMethodBody;

    return;
}

function myMethodBody ()
{
    return;
}

So you'd be assigning a reference to the myMethodBody function to the this.myMethod property on the new object.  You could then do something like:

var myObj = new MyObject ();
myObj.myMethod ();

Which gives you nice OO flavour.

The new way of doing this in the PowerPack uses closures and prototypes.  This gives the same results as the above mechanism, but it has a couple of advantages.

The equivalent closure and prototype code for the above would be:

function MyObject ()
{
    return;
}

MyObject.prototype.myMethod = function ()
{
    return;
}

This again allows you to use code like:

var myObj = new MyObject ();
myObj.myMethod ();

The advantages of this closure and prototype approach are:
  • I'm no longer polluting the global namespace with function names that are redundant. (Since they'll always be called through their method names, the function names themselves are never used.)
  • The creation of methods associated with objects can be optimised better, since it isn't done through the constructor every time an object is constructed.
  • This is a cleaner, more Javascripty approach.
Why did I wait until now to do this?  To be honest, I don't know.  I don't know why they weren't done like this in the first place.  It's not like I wasn't aware of Javascript prototypes - I've code I wrote in the nineties that used them.

Still, better late than never.

The complete fix list for this release is:
  1. ComboBox. Layout problem with absolutely-positioned Panels/DIVs in IE. FIXED.
  2. ComboBox. Different layout problem with absolutely-positioned Panels/DIVs in Firefox. FIXED.
  3. ComboBox. Designer wasn't appearing in design-view. FIXED.
  4. ComboBox. Caused Javascript errors in Firefox if Visible was set to False. FIXED.
  5. RichTextBox. Toolbar would occasionally become disabled. FIXED.
  6. ComboBox, DatePicker, RichTextBox, ShowOnConditionClientSide. All Javascript files now use enclosures and prototypes for their object definitions, so they no longer clutter the global namespace. FIXED.



Posted by 'Geoff' on Sunday, 05 December 2004. No comments.
Now that FTP appears to be back, I've uploaded the new release of the PowerPack.  You can get it here.

We apologise for the inconvenience.


Posted by 'Geoff' on Wednesday, 24 November 2004. No comments.
The good news is that I've been working on a new version of the PowerPack for y'all.  A few bug fixes, a few improvements to the RichTextBox and so on.
 
Unforunately, I don't have FTP access to this site at the minute, so I can't upload it.
 
Rest assured I'll get it to you as soon as I can.


Posted by 'Geoff' on Sunday, 21 November 2004. No comments.
RSS 2.0 Subscribe to the RSS 2.0 feed for Geoff’s Blog.