ILoggable

A place to keep my thoughts on programming

 Subscribe

geekblog
[at]
claassen [dot] net

Powered by Blogger

Tuesday, November 14, 2006

UserControl need to be able to run with no arguments for Designer

When you create a Custom Control or User Control in Visual Studio 2k5, it needs to be able to render its running state with no additional information. I.e. it needs to have a no argument constructor and cannot need extra data passed in at initialization, otherwise Visual Studio 2k5 Designer will die when you add the Control to another form or control, even if it comes up fine in the Designer by itself.

Ok, this one is a big Duh! but i'm sure i'll forget again some day in the future and bitch and moan about Visual Studio hating me and constantly crashing. Basically it comes down to the designer embedding the control and running it. So OnPaint will get called and any timer you have that's not disabled will run. Now if you build controls that require extra initialization data, and the running portions of the control try to use them, you'll get a NullException. Makes perfect sense really, hence the Duh. But of course, you may forget that part, because, after all, the control by itself runs fine and only crashes if the control is added to another control/form. My bet is that the designer is basically a control container and will just discard the exception, but if you add the control to another, the control being added to doesn't handle the exception and complaints.

A cool little side-effect here is that that you can put an animation in a control and that animaton will run in the Designer. :)

Friday, November 10, 2006

Put it in the Dropboks

A friend of mine created a simple web app that falls in the "yeah, i was going to do that... some time.. when i have time.. right, any day now" category. But you know how it goes, you just wish someone did it and you never get around to it.

It's a web page for uploading all those files that you need to lug around various computers you use in different locations. As a geek, i generally end up scp'ing things to my server. But that only works if the machine has scp, etc. I tried iFolder for a while, but it just never worked reliably for me and ask me for my password every time i reboot, even though i tell it to remember me each time.

And sure, there are a ton of file upload but most of them are rich on features, and with that need for configuration, and I just never bother setting up an account. If I had built my own, i'd have started down that road as well, with a nice API, advanced user and group system, ways to mount the file system on the desktop, and would have just got bogged down in the complexity.

Dropboks does just one thing, but it does it immediately and it does it extremely well. It's brilliant in its simplicty and it's gonna be immensely useful to me.