My Software : Comments and observations related to the usage and installation of softwares on my systems.
Updated: 2007-02-01; 08:49:48.

 

Subscribe to "My Software" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.


Categories: (Check them too. My content isn't all on the main page)

Knowledge Management
Technology
My Hardware
My Software
En français!
Top 20 topics!


Currently reading:

The Second World War, Volume 1: The Gathering Storm by Winston S. Churchill

Beginning Linux Programming (Programmer to Programmer) by Richard Stones and Neil Matthew



www.blogwise.com

Male/31-35. Lives in Canada/Ontario/Ottawa/Manor Park, speaks French and English. Spends 80% of daytime online. Uses a Faster (1M+) connection. And likes Cooking/Reading.
This is my blogchalk:
Canada, Ontario, Ottawa, manor Park, French, English, Male, 31-35, Cooking, Reading.


The Political Compass: Economic Left/Right: -3.50
Authoritarian/ Libertarian:
-2.26


Technorati Profile
Popdex Citations



 
 

11 mai 2003


Autocompletion in the command prompt!.

Roy Osherove posted a link to some cool Registry settings. One of them I found quite usefull: Enable AutoCompletion in Command Prompt. Once this setting is done, you can use the tab key for autocompleting while typing in the command prompt (cmd)! For example you type "cd c:\progr" (without return) and press the tab key, "progr" will be completed to "Program Files".

To enable this setting, change the following key in the registry:
HKEY_CURRENT_USERSoftwareMicrosoftCommand ProcessorCompletionChar
Change this value (or create the key, DWORD) to 9.

[.NET Weblogs]
Outstanding trick!

9:09:07 PM    comment []  - See Also:  .NET Micro$oft 


Transferring properties to a thumbnail image.

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).

Given that 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)]
[.NET Weblogs]
This is a very cool trick as I take tons of pictures that I shuffle around and manipulate a lot. I could use this trick in a script that is applying a series of "steps" to a fixed set of pictures.

8:23:32 PM    comment []  - See Also:  .NET Multimedia Metadata 

© Copyright 2007 Charles Nadeau.



Click here to visit the Radio UserLand website.
 



-->
May 2003
Sun Mon Tue Wed Thu Fri Sat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Apr   Jun


Google
Search the whole web!
Search Charles radio!


www.flickr.com


Top 5 artists I listen to the most often during the last week:


I subscribe to:

Here's how this works.


Weather in Ottawa:
The WeatherPixie
Weather in Fukuoka:
The WeatherPixie