November 2003 - Posts
This goes in the "here's something I learned today" bucket.
I was working on my ASP.NET based photo gallery sample/experiment and realized that I needed to ensure that the names of images I stored in the database couldn't contain illegal filename characters. This is because I allow the user to specify a path like http://imgsample/P51.jpg and I use URL rewriting to translate this to http://imgsample/ViewImage.aspx?name=P51 or http://imgsample/ViewImage.aspx?ID=12&size=med.
Not being a database guy (yet!) as I thought about ensuring only valid names I figured I could use form validation. But then I remembered "hey this is a database app", can't the database enforce this? A few minutes browsing MSDN clued me into the Check Constraints capability on columns. All I had to do was add the following expression as a check constraint to my images table.
(left([img_name],1) <> ' '
and right([img_name],1) <> ' '
and charindex('\',ltrim(rtrim([img_name]))) = 0
and charindex('/',ltrim(rtrim([img_name]))) = 0
and charindex('?',ltrim(rtrim([img_name]))) = 0
and charindex('&',ltrim(rtrim([img_name]))) = 0
and charindex('*',ltrim(rtrim([img_name]))) = 0
and charindex('..',[img_name]) = 0)
Now whenever I enter an invalid name I get a SQL error on the insert. Cool. Next I need to figure out how to handle those errors gracefully.
One of my favorite industry visionaries, Ray Ozzie, has written a great note in his blog on WinFS titled "
640KB ought to be enough for everyone".
Interesting read. He references
Jim Gray (another of my geek heros) and points to an old but topical
presentation on the trends in storage. Jim gets it.
I'm cranking away on really learning ASP.NET by building my own photo gallery component (primarily for my '95 BMW 540 M-Sport (www.kindel.com/bmw) registry). Even though I know it won't perform as well I implemented it by writing the images (full size, medium size, and thumbnails) to the SQL Server. Fun stuff. Anyway, I deployed it to another server and wanted to debug. Didn't have VS.NET installed on that server so debugging won't work. So in went the MSDN DVD and I ran setup. Got:
Setup has detected that a previous version of Microsoft .NET framework 1.1 is currently installed. Uninstall this application before continuing with Setup....
Can't uninstall 1.1 on W2K3 because it's built-in. Searching the web found one hit that was sorta useful. Seems like I may have un-installed VS.NET incorrectly before or after upgrading this machine to W2K3 from W2K. But the hit didn't actually help me fix the problem. Fortunately I work at Microsoft so sending mail to the internal VS.NET Setup DL was an option.
Here's the suggested fix:
- Download the Windows Installer SDK and get msizap.exe from it.
- From a cmd prompt run msizap T {DF420000-A5AB-407C-92FF-D1D4B709B8F9}
- From a cmd prompt run msizap T {C9913503-1500-4454-94CD-365ADC1BB9B9}
- 4. Re-run VS.NET 2003 setup.
This get's us past the first setup error. But then trying to install the pre-requisites gives another error! Arrrg.
Turns out this additional problem is because for some reason %windir%\system32 is taking precedence over the local dir when VS setup is spawing setup.exe, causing something else to execute. To get around this, and I had to go directly into the WCU directory on the DVD where the pre-requisites setup.exe is and run it from there. That did the trick.
My daughter's 10 year-old soccer team (the Polar Bears) is playing for the championship tomorrow! Three weeks ago they started the tournament loosing their second game and going into the bottom bracket of 16 teams (it's a double-elimination tourney). For the past three weeks they have played incredibly hard and after winning two games today have emerged out of the bottom bracket to face the only team left in the top bracket tomorrow.
Because the other team has not lost any games, and it's a double-elimination tourney, we have to beat them twice tomorrow.
I am so incredibly proud of these girls.
Update: 11/16 - They lost the first game of the championship 0-1. They played hard, but the other team got a good goal and we couldn't get it back. In true form, the girls cheered their 2nd place achievement and skipped across the field singing Smash Mouth's All Star on their way to pick up their medals.
I also finally got w.bloggar to work. Not sure what I did to fix this either. But now it works.
Testing image posting.

Yay! I finally got the image gallery to work. It suddenly started working after I completely stopped w3svc and restarted it.
My home network is setup such that kindel.com resolves internally to a local IP address (192.168 range). Of course kindel.com resolves for everyone else in the world to my public IP address.
This means that .Text is hosed for me because it relies on the host header to find blogs (via the blog_Config table). My blogs are either visible to the Internet (host = kindel.com) or locally (host=kindelsrv). To access my blogs from home I either have to change blog_Config temporarily or VPN in to my work network and come back into my server that way.
To ease changing blog_Config I decided to write a little C# app using ADO.NET. I've never done any ADO.NET coding, so this was a good exercise for me. Took me 30 minutes! I'm not a database guy, and each time I”ve tried to do database stuff I've struggled. On my BMW site (www.kindel.com/bmw) I used to have a working registry for cars like mine. It's been broken for 6 months because I'm not sure what I screwed up and it all confuses me too much to figure it out.
After writing this little “blogswitch” app that lets me toggle all my “host” entries from “kindelsrv” to “kindel.com” I'm going to re-do that car registry using ASP.NET and ADO.NET!
Very cool.
Bummer. We will be unable to attend the last two home Seahawks games this year. We have 4 seats in section 306, Row P on the isle. These are excellent seats on the North side (under cover). I'm selling them for face value $52/seat. I want to sell all 4 seats together.
Games are:
Seahawks v. Browns: Sunday, November 30 @ 1:00PM
Seahawks v. Cardinals: Sunday, December 21 @ 1:00PM
Drop me a line if you are interested (charlie@kindel.com).
Head on over to http://www.kindel.com/Default.aspx?tabid=31 for details.
The driver is now called the Kindel Systems Premise External Control Processor Bridge. I renamed it because it is actually completely generic and not specific to Crestron at all. It can be made to work with other external RS-232 attached home control processors that support a text based protocol and can be programmed.
See my new
article on how I designed and built the home automation system for my house.
I've developed a solution for integrating Lantronix' Premise Home Control Software with Crestron. I did this for my own home and am now considering what to do next with the code. I'd be interested in hearing from people who have thoughts on this...
Basically my Premise driver (written in C++ using the Premise HSDK) implements what looks to Premise like a set of COM ports. For each device in Crestron you want to expose to Premise you define a "prefix string" and create one of these virtual COM devices. So for my Integra DTR 7.3 receiver I have a COM port available in Premise named "Rec Room Integra", and it has a "prefix" property of "dtr73".
Whenever code in Premise writes to the virtual COM port (e.g. the Premise Integra driver, which is all VB code BTW), I take the written data, and prefix it with the "prefix" and a colon. So "FOO\n" becomes "dtr73:FOO\n".
On the Crestron side I have a SIMPL+ thing that makes it easy to attach a serial RX$ to the real serial TX$ for the device and strip the prefix.
Same thing happens in reverse. If output a serial string in Crestron to Premise, it needs to be prefixed with the prefix:. The Premise driver maps the data to the correct virtual COM port.
There is a single serial connection between Premise and Crestron. My driver effectively multiplexes many "virtual" serial (or IR) connections over that.
Works amazingly well. Was a bit tricky to write because the only implementations of the COM port interfaces w/in Premise are in the core. I figured it out though.
Next step is to make it work over Ethernet.
Two articles illustrating how this works:
http://kindel.com/blogs/spkindel/posts/175.aspx
http://kindel.com/blogs/spkindel/posts/174.aspx
The driver is not ready for broad distribution. I am willing to allow access to people who are willing to test it. I may charge for the final version. Testers who provide solid feedback will be given a significant discount.
Go to www.kindel.com/blogs/spkindel for more complete information.
I created a test link to see how links worked in .text. Somehow the URL gets munged to include the path of my currently selected skin. Instead of
www.kindel.com/blogs/charlie
I get
http://www.kindel.com/blogs/Skins/HabaHaba/Controls/www.kindel.com/blogs/charlie
Huh? Is this a known bug?
I'm a n00b when it comes to this blogging thing, so maybe this has either already been done or is just a dumb idea. Anyway, I want to be able to post entires to my blog by simply sending an email. If I think up a good idea, or random thought, or story, or whatever, I should be able to just type it up in my email application and “send it to my blog”.
If this were possible, then offline blogging would work. I could post blogs while on an airplane!
I may just try to implement this. Here's how I would do it:
- The basic idea would be that you'd send an email to yourself with a subject line that had some magic cookie in it that only you knew (so other's sending you mail wouldn't add blog entries on your behalf). Something like “blog::“ where was the magic cookie, and was the subject of the blog. You could have other options where you could specify a catetory etc...
- The entire body of the message would be posted as the blog entry.
- I believe it's possible in Exchange to crack messages on the server side and run VBScript against them. I think it's called CDO. There's gotta be APIs in there for cracking the messages, looking for the cookie, and then using web services to make the post, right?
It seems that other blog systems already support this, but I've only looked into it briefly. Movable type apparently has some support for this. I want to keep using .Text as my blog engine given, and I'd like to see it support this. Maybe I'll take on the challenge...
Hmmmm.... Time do do some research...
More Posts
Next page »