Tuesday, June 29, 2004

My Dream

Ok - dreaming is not exactly something that you would think to see as a blog topic.

I had a dream last night that I was trying to get an Okidata dot-matrix printer to work properly via a RS232 connection. The printer would work fine until you took the printer offline and then it would loose information (i.e. lines of text). It wasn't a difficult problem to say the least. Even though the customer and service guy said everything was set up properly, I was weaving my way through the RS232 setup menus on the printer. The problem was exactly what I expected. The flow control was not set properly. So even though the printer was taken offline, the server kept sending it data.

What a dream... just like being taken back into a time machine. The printer seemed real and all the RS232 configuration settings were there - just like it was in 1995. Flow control and bad RS232 cables were some of the leading problem of that eventually perculated up and had to be resolved by someone in Engineering.

When I woke up, I had a new appreciation for all those engineers who have made USB such a robust way of connecting devices to computers. Gone are all those cryptic settings. You just plug it in and it works. Awesome!

Thank you, thank you, thank you!

Monday, June 28, 2004

VS Setup project or WIX

This past weekend, I was suppose to come up with an alpha installation for our upcoming software project. I thought it was going to be pretty clear cut. I just needed to do a perusing through the internet and see if there was anything outstanding that we should take into consideration.

During my investigation, I stumbled across Rob Mensching's blog entry. Following the breadcrumbs to Windows Installer Xml toolset. Hmmmm... now we have some decisions.

I downloaded and compiled it. Documentation is seriously lacking with WIX. Right - open source is cool and everything, but taking up my time is not. I took one of my library installations and converted it over to the WXS format. It was a pretty simple installation. However the XML file came to over 1900+ lines. Ouch.

A Visual Studio setup project seems to be satisfactory for our needs. Sure you can use WIX as a post build step. However, a Setup project can also be made part of the solution. I did like being able to exactly see what an installation was made of. With Visual Studio, there's a lot of hocus-pocus and with some luck it all works out fine.

After reviewing the pros and cons, we decided against WIX. I think its a commendable start but it really needs better documentation and a user interface that simplifies the creation of an installation.

Thursday, June 24, 2004

SystemIcon to Icon - Take 2

After my last post, I took a look at a standard XP icon as opposed to what I was able to get. My "improvement" still left room for lots of improvement. So, I decided to get my hands dirty. I got rid of the PictureBox control entirely. Instead, I went with a lowly panel and set up a handler for the panel's Paint event.

So I have an Icon object that came from SystemIcons and I'm in the Paint handler. I do a little bit of math using size property properties from the Icon and Panel. From the PaintEventArgs, I get a good Graphics. Graphics.DrawIcon is the method you want. Bam! It's now good as the guys in Redmond can do.

Time burnt getting a system icon on a dialog box: 4 hours.

Tuesday, June 22, 2004

SystemIcon to Image

Today I wanted to display a system icon on a form. I found the SystemIcon class that contained what I wanted to show. I plunked down a PictureBox on the form. Lastly, I hooked up the image in the form constructor using something like:

m_pictureBox.Image = SystemIcon.Exclamation.ToBitmap()

Nothing could have been more simple... right? Wrong.

The icon displayed on the form looked pretty... well... sad. As I mentioned yesterday, I am professing to crafting software. This might do for some but not for me. The image was not smooth like the stock icons are. I will not profess to knowing a lot about graphics but I do know when a graphic doesn't look good.

So I went down the shortest path, but obviously that was not the correct one. So I took a step back and studied my alternatives. Was it something I could do with SystemIcon, Icon, or PictureBox? All of them turned up nothing.

After think about what was going on under-the-hood, I realized that Mr Bitmap had joined in the party. Studying the Bitmap class, I found a possible solution...

m_pictureBox.Image = Bitmap.FromHicon(SystemIcons.Exclamation.Handle);

Having nothing to lose (other than time), I hooked it up and guess what that does what I really wanted - a good looking system icon on my form.

Monday, June 21, 2004

Crafting software

"What do you do for living?" that's one of the inoculous and befuddling questions that I get asked. Normally, I use the pat answer of "I write software" or "I'm a programmer." The answer really leaves a bad taste in my mouth. It's kind of like a state congressman giving an answer like I make speeches when asked the same question. I really need to get a better answer.

On my business card, my coworkers had me put down "Software Wizard." No lie. Unfortunately, I don't think that is quite a good answer. It was put down more on a whim since we couldn't think of any better answer at the time. It was more for humor considering the degree of importance we place on people with business cards.

I think my new answer to this question is going to be, "I craft software."