May 2003 - Posts

Jesse Ezell came up with a fairly clever way to add new styles to the .NET Weblogs without having access to the source code, by dint of a bit of javascript inserted in the news section that removes the stylesheets selected in configuration, and replaces it with a stylesheet specified by URL. Jesse's post on the subject includes instructions (in the comments) on how to take advantage of this technique.

Borrowing on Jesse's idea, I've added a modified stylesheet to my blog to give it a more unique look. Hopefully, it's also fairly easy on the eyes. Alas, the stylesheet doesn't seem to be friendly with Netscape 6.x, but then neither was the original stylesheet I was using, so I guess I'm no worse off. If you're using a browser other than IE, and the styles seem off to you, please let me know in the comments. Below is what the site should look like.

A Blog For Graymad - New Style
with 7 comment(s)
Filed under:

It's official. The 1.0 release of the ASP.NET Community Starter Kit is now available on the ASP.NET Starter Kits main page! More information on changes from v0.5 to v1.0 is available here.

Enjoy!

Happy Mother's Day to all you mothers out there!

I spent the afternoon celebrating my wife's first Mother's Day at Dumbarton Oaks gardens in northwest Washington, DC. I'm not usually much for gardens, but Dumbarton Oaks is simply stunning. There are amazing gardens, both huge and unusual trees, pools and fountains, and amazing views. I got some great photos while we were there, and I'll update this post with a link to some once I upload them from the camera.

Hope everyone else has as nice a Mother's Day as we've had.

UPDATE: Here's the link to the photos, for anyone who's interested.

with no comments
Filed under: ,

A while back, I created a simple console app for thumbnailing photos for posting on my family Web site. The application simply asks for a directory and a reduction percentage, then looks for any images in the directory provided and reduces them by the requested percentage.

This was fine as far as it went, but I realized after a colleague, Ryan Trudelle-Schwarz, requested copies of some of the photos I'd thumbnailed with this app, that I had neglected to correctly transfer the properties from the old image to the newly-created thumbnail. Given that digital cameras like mine (a Nikon CoolPix 4500) provide a lot of information in the properties, from photo info like focal length, exposure time, and ISO speed to important stuff like the date the photo was taken (as opposed to the date the file was last copied/altered), this is stuff you don't want to lose.

Since the app did mostly what I wanted, I didn't tackle the property transfer until recently. I was pleased to find that as with most stuff in .NET, it was pretty easy, once I stopped trying to fight the platform (I initially tried doing a For loop with a counter variable, but wasn't getting the PropertyItems populated that way). My initial successful code took advantage of a neat feature of arrays (the properties of an image are stored in an array called PropertyItems) called Enumerators. Enumerators, which implement the IEnumerator interface, allow you to easily traverse the members of an array or collection much the same way as you would a recordset or a DataReader. The code below gets an enumerator for the PropertyItems array of an instance of System.Drawing.Image that is created from the image being thumbnailed, and then calls the SetPropertyItem method of a new instance of System.Drawing.Bitmap that will contain the thumbnail version of the image:

Dim imgPropEnum As System.Collections.IEnumerator = _
   img.PropertyItems.GetEnumerator
While imgPropEnum.MoveNext()
   bmp.SetPropertyItem(imgPropEnum.Current)
End While

In a subsequent email, Ryan suggested the following code, which is a little cleaner, and perhaps more like what a VB programmer would expect to use:

Dim PropItm As PropertyItem
For Each PropItm In img.PropertyItems
   bmp.SetPropertyItem(PropItm)
Next

Either will work, and both are examples of how simple tasks graphics-related tasks are in the .NET Framework. The trick, as I discovered, is to work with the framework, rather than against it.

As an aside, while I was playing with the code above, I also took a look at the GetThumbnailImage method of the Image class, but found that the method appears to both reduce the size of the image and compress it, such that the resulting image quality is fairly poor. In all fairness, the MSDN docs for the GetThumbnailImage method does warn that

GetThumbnailImage works well when the requested thumbnail image has a size of about 120 x 120. If you request a large thumbnail image (say 300 x 300) from an Image object that has an embedded thumbnail, there could be a noticeable loss of quality in the thumbnail image. It might be better to scale the main image (instead of scaling the embedded thumbnail) by calling DrawImage.

but I was hoping that the code for creating a decent thumbnail would've been as simple as a single method call, perhaps one overloaded to allow both compressed and non-compressed thumbnails. Not that it's all that difficult to scale an image in .NET, of course. I guess I've just gotten spoiled by how much the framework classes do for the developer that now I expect them to do everything. Perhaps in version 2.0.

[Listening to: How Blue Can You Get? - B.B. King - The Best of B.B. King [MCA] (05:09)]
Found this at http://www.sellsbrothers.com/fun/ http://alladyn.art.pl/eng/clock.html
[Listening to: Mr. Mouse - Coupe/Love - All Over the Map (02:39)]

Julia writes:

via Chris Sells: MSDN's Dr. GUI, is now blogging. So I gotta figure out how that works. Dr. GUI is like a compilation of a bunch of MSDN folks, right? So who gets to do the blog? Is it a free for all? Well, I'm sure it will be fun, informative and full of all the silly puns we have become used to!

[Julia Lerman Blog]

Actually, I don't think Dr. GUI is a compilation. At least, I've met someone who claimed to be Dr. GUI (even had it on his business cards), and I have no reason to doubt the claim. I suppose that there could be more than one "Dr. GUI", but that wasn't my impression from the meeting.

[Listening to: Carnival Overture, Op.92 - Antonín Dvorák - New World Symphony (08:58)]
with no comments
Filed under:

As folks who follow my blog already know, I've been trying to set a good example by running my main computer on a day-to-day basis with a plain vanilla user account, with no administrative privileges, in order to reduce the risk of providing elevated privileges to malicious code I might somehow accidentally run, as well as to ensure that any code I write installs and executes without requiring elevated privileges.

While for the most part this effort has gone fairly smoothly, there are days (like today) when I just want to pull my hair out. The reason in this case? Microsoft ActiveSync.

I recently purchased a new PocketPC, Phone Edition device from T-Mobile (currently available from CompUSA for $299 after rebates). I managed to get the device set up and synchronized OK, but soon discovered that I was having difficulty getting any new software to install onto the device. Since I'd originally installed ActiveSync before downgrading my day-to-day account to a non-admin account, I guessed that perhaps a mismatch in permissions might be the problem, so I decided to remove and reinstall ActiveSync. Bad idea...removing was no problem. But ActiveSync refused to install for my base user account (not sure whether this was a permissions issue or not, as the error message I got was not permissions-related, and was essentially useless). Of course, when I used the Run As... feature to run the install from an Admin account, the setup program configured ActiveSync for that account. Since the administrative account did not have an Outlook profile set up, this meant that it was impossible to synchronize contacts, mail, etc.

In the end, I had to add my day-to-day account back into the Administrators group long enough to reinstall ActiveSync, and then remove it again. I have a feeling there may be a better solution, but I wasn't able to find it in the Microsoft Knowledge Base, and I usually have pretty good luck finding what I'm looking for there. The realm of connecting/synchronizing mobile devices is an area where Microsoft really needs to improve things, both from an ease-of-use standpoint, and to address any elevated privilege requirements. If someone like me, who has been developing software and tinkering with hardware for years, has this much trouble with ActiveSync, what chance does the average person have? If Microsoft wants to sell PocketPCs and PocketPC Phones to folks like my mom and dad, they need to make this much easier.

That said, I love my PocketPC phone. I've had an iPaq for a couple of years now, and while I still sometimes carry it, I got very tired of carrying two different devices (cell phone and PDA) all the time. Being able to use just one device, especially with the level of integration of phone and PDA this device pulls off, is something I've been waiting for for awhile. And now that the price is right...

[Listening to: Symphony No,9 in E Minor, Op.95 - Mvt. II - Antonín Dvorák - New World Symphony (12:30)]
with 3 comment(s)
Filed under:

Kent Sharkey writes:

Of course, I have something else on my mind. I noticed it first internally when the Windows Media 9 toys were launched a week or two back, and I've been seeing it externally now that Windows Server 2003 has become available. People complaining/commenting that X client software doesn't run on Server 2003. Blogging add-ins for Windows Media player, w.bloggar, etc. I think back to the glory days of Novell, when YOU WOULDN'T EVEN THINK OF USING A SERVER FOR YOUR DESKTOP MACHINE. Sorry, but Windows Media Player shouldn't even install on W2K3. It's server software, not workstation. Using it as your primary OS (especially as I'm guessing most of you log in as Administrator) increases your security hole. IMO, run XP Pro, install VMWare/Virtual PC if you must run a server on the same box. Ideally, however, install server on another box, disconnect the monitor, don't attach a mouse, and even don't attach a keyboard if you can get away with it. Use it as a server.
[Kent Sharkey]

All I can say to this is AMEN! Much like my rant on Request Validation, I'm often baffled by the fact that people can even ask the question, "why isn't X software supported on Win2K3 Server?" DUH! Because it's SERVER software. Can you force Win2K3 to run like a workstation OS? Sure. But that doesn't mean that you should.

I'm with Kent...if you need to run Win2K3 on your primary machine, do it in a VM. And stick with Windows XP Pro for your base OS. Use the right tool for the job.

[Listening to: Desire - Toad - Coil (03:36)]

Mads Haugbø Nissen writes:

I really don't like the thing that puts in what song people are listening to whilst blogging.

This is by definition spam. This is not IRC, nor SMS allowing us to write likah l33t h4x0rs & kidz on tha block in tha houze. Spam will hit blogs soon enough.

Thought I'd express this before everyone uses this thing.

[Mads Haugbø Nissen]

My first reaction to this post was, essentially, "geez, guy...lighten up!", but I thought perhaps a somewhat more thoughtful response was warranted.

While it may have something to do with the fact that I'm one of those who uses the WMP plug-in, I guess I don't see why this is a problem, nor do I agree that "this is by definition spam". By definition, if someone reads my blog (or even the main feed at dotnetweblogs.com), it's not unsolicited, which is a rather important part of the definition of SPAM. They may not like or find useful everything that I have to say, or all of what I post, but that doesn't make it unsolicited.

And there's a simple solution...if you don't like blogs that provide this information, don't read them. The way I look at it, people who read my musings on code, technology, etc., may also find it interesting to know other stuff about me, including the music that I listen to. I may be wrong about that, but I'm hardly forcing folks to read my blog, and if they can't manage to ignore a one-line note on my current listening habits...well, let's just say I'm not going to get my knickers in a hitch about it. No offense meant, Mads, but I really think there are more important things to get worked up about.

[Listening to: Whatever I Fear - Toad - Coil (02:57)]
with 4 comment(s)
Filed under:

All it took was copying the w.bloggar install directory to a directory in which the non-admin account has permissions. Again, not an ideal solution, especially since it demonstrates that the default install doesn't need to be the way it is, but I suppose I shouldn't complain too much about security in freeware. After all, you get what you pay for

[Listening to: II-II vecchio castello - Berliner Philharmoniker - Pictures at an Exhibition/The Firebird Suite (04:43)]
More Posts Next page »