Image resizer freeware

resizer_drag.jpg

Every now and then I find myself in the situation where I want to resize images to a defined size. To speed up the workflow I have created this simple application that supports drag-and-drop resizing. Just drag an image file onto the application icon and the image will be resized according to the settings.

The application requires .NET Framework 2.0. There is no installer. Just put the executable file wherever you want.

If the application is launched by itself it present the setting dialog, shown below.

resizer_gui.gif

The bounding box is the largest possible image that will be the result of the operation. If the “crop to box” option is set, the source image will be cropped to leave an image of the exact size of the bounding box. If, on the other hand, the “fit within box” option is selected the image will be made as large as possible with retained aspect ratio and still fit within the bounding box. The bounding box can be of any size and the cropping, if required, will be done from the centre.

A watermark text can be added to the finished image by enabling the watermark option and typing a suitable string in the edit box. The font or position of the watermark text can not be changed.

Images can be saved to the same folder as the source image or to a defined target folder and will be given a suffix of “_resized”. The application will add extra numbers at the end to avoid overwriting existing files. If required, the metadata associated with the source image can be copied over to the resulting image.

To avoid having to keep the application on the desktop or somewhere else where it is readily available you can do the following:

  • Put the application (resizer.exe) anywhere you want on your hard drive
  • Right-click on any image file and select “Open with…” followed by “Choose program…”
  • Make sure the “Always use the selected program…” checkbox is unchecked and browse for the application file
  • Press OK

Windows will remember the application you selected for the jpeg files and will include the Resizer application on the “Open with…” submenu. The next time you want to resize a file you just have to pick the Resizer option from the “Open with…” submenu.

The resizing is done using bicubic with the highest quality setting. If I get around to it I will implement support for “unsharp mask”.

License

This application is provided free of charge for personal use. If you like it I would appreciate if you would link to my web site (http://www.spotwise.com).

Uninstallation

Just remove the EXE file and all registry settings under HKCU\Software\Bergek\Resizer.

If you added the application as a short cut under the right-click context menu you can remove the application in the registry under the key HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Explorer \ FileExts \ .jpg \ OpenWithList. As always, be careful when editing the registry.

Attachments

IIS authentication freeware

Authenticator is an add-on filter to the Microsoft IIS web server that provides basic authentication against Microsoft Access, Microsoft SQL Server and MySQL Server data sources. This means that the standard client authentication dialogs can be used for authentication without requiring user licenses for accounts in Active Directory in Windows.

The filter has been tested successfully on:

  • Windows XP Professional
  • Windows 2000 Professional
  • Windows 2000 Server
  • Windows Server 2003

License

This application is provided free of charge for personal use. If you like it I would appreciate if you would link to my web site (http://www.spotwise.com).

Installation

Add the database as a data source as a System DSN in the Data Sources (ODBC) applet in the Control Panel. Database templates are provided for Microsoft Access, Microsoft SQL Server and MySQL Server. Choose the one that suits your purposes the best and add suitable user accounts to the database (check below).

Install the filter on a web site in the IIS snap in and set the security settings on a virtual directory below the web site to disallow unauthenticated access and instead use basic authentication. Although the filter requires the username/password to be sent in clear text it is be possible to use it in conjunction with SSL to encrypt the data over the network. Set the RequireSSL registry value to true if you want to prevent cleartext passwords to be sent over the network. Also, set the realm; the text will be shown in the authentication dialog if supported by the client operating system.

When first loaded by IIS, the code will write default registry settings. Start regedit and make changes under HKLM \ Software \ Bergek \ Authenticator.

Note: As always, be careful when changing the registry as mistakes can, at worst, render the computer unbootable.

  • ConnectionString [SZ] – The connection string used to connect to the data source. In its simplest form it is just “DSN=Authenticator” (with Authenticator configured as the data source name in the control panel), although it can be formatted in various ways. The data source must be added as a System DSN since the user which will access it will most likely be the IUSR_{computer} account.
  • SqlStyle [DWORD] – Controls the SQL style used to query the ODBC data source. Possible values are 0:Microsoft SQL Server, 1:Microsoft Access and 2:MySQL Server. By default MySQL Server syntax is used.
  • RequireSSL [DWORD] – If set, the filter will return HTTP 401 Access denied if a request is made using non-encrypted HTTP. The HTTP 401 response is sent before the client has sent the user credentials which means that they will not be transmitted in cleartext form on the network.
  • MappedLogin [SZ] – A valid user name on the computer. Accesses against the virtual directory will be mapped against this user which must exist and be allowed to access the resource in the web application. The user name should be provided in the form {domain}\{login} but it can be {login} only if the default domain is set in the IIS snap in. If your computer is not in a domain you should write the account as {computer}\{login}
  • MappedPassword [SZ] – The password for the user account selected above. When the filter is first accessed this password will be encrypted and the encrypted version will replace whatever you type here.
  • LogSuccesses [DWORD] – If set to true (non-zero), authentication successes are written to the database.
  • LogFailures [DWORD] – If set to true (non-zero), authentication failures are written to the database.

After having changed the registry settings access requests to the protected web application folder will be matched against the database and IIS will use the mapped user account for all access.

Database settings

Two things must be added to the database in order for a user to be allowed access. First of all a user account must be created in the 'users' table:

  • Login: The login name of the user
  • Password: The password (in clear text) for the login account
  • Enabled: Must be set to true (1)
  • Expires: If set to false (0) the account does not expire
  • Expiration: Determines the expiration time for the account. Only used if Expires is set to true (1)
  • Administrator: Not currently used

In addition to the account itself site, directory permissions must be set for the user. This is done in the 'permissions' table:

  • UserID: The ID of the user in the 'users' table
  • SitePrefix: The IIS instance metapath for the site. For the first site on the system this is typically /LM/W3SVC/1
  • PathPrefix: The URL path prefix for which the user should be granted access (e.g. /secret)

The PathPrefix can be used to allow access only to certain areas of the web site. To give access to the entire site the PathPrefix should be set to a single slash ('/').

Troubleshooting

Error in the ISAPI filter are most frequently related to the connection between the filter DLL and the database. Please make sure that the latest versions of relevant ODBC drivers are installed on your computer and check the database connection in the Data Sources (ODBC) applet in the Control Panel. Errors are logged to the system event log. Incorrect account information for the mapped account is not shown by the filter but might be logged by the web server or by the system itself.

Errors could also be the result of the account running the web server not having sufficient permission to update the relevant registry keys under HKLM\Software\Bergek\Authenticator.

Uninstallation

Remove the ISAPI filter from the IIS snap-in. Restart IIS and then remove the DLL, database ODBC DSN and the registry key HKLM \ Software \ Bergek \ Authenticator.

If you are unable to remove the DLL file, please make sure that the filter has been removed from within the IIS snapin and that the event viewer is not running.

Attachments

First impressions of Lacie Rugged All-Terrain

lacie_rugged.jpg

After hearing about friends having their computers stolen and losing precious data I finally got around and purchased a new external backup disk, settling on a Lacie Rugged All-Terrain 80GB. DVD backups worked fine until last year when I purchased a Canon EOS 20D and decided to shoot in raw format. Now, instead of having a few GB of data per year to backup I find myself with some 50GB.

I have tried a large number of bus powered USB drives but none of them seemed to work without extra power via a second USB cable. I was happy to notice that the Lacie Rugged All-Terrain 80GB could do with just the power supplied from the USB port on my Shuttle SN95G5v3. It is worth noticing that I also have a Lacie Mobile hard drive from late 2004 which does require extra power when connecting it to the same Shuttle PC. It seems, thus, that this rugged drive requires less power than the older drive but it is uncertain whether newer drives of the Porsche designed series require as much power.

On the negative side I was a little surprised to note the flimsy orange protection around the edges. Contrary to what I thought after having seen images on the Internet, the protective cover is just slipped over the drive. It would feel more solid if Lacie were to at least glue it together.

As would be expected, the drive is quite silent and the sound is barely noticeable. When making an initial backup of 50GB of data I saw a sustained throughput of 12 MB/s.

In short, this external USB drive does what it says. But I would like it better if the orange protector was attached more firmly to the drive itself.

Eurovision 2006

The monster rockers from Finland won the Eurovision song contest 2006 in Athens. As always, I couldn't help but think that the tele-voting has a tendency to favour neighbouring countries. To figure out just how real this tendency is I set out to adjust the scores according to the distance between the countries.

Eurovision2006.gif

The graph above shows the official score for the top five participating countries and two alternative scores. The first alternative uses normalisation based on the distance between the capitals of the country voting and the country receiving the vote. The second alternative is more extreme in that it gives a weight of zero to countries that share land borders. Please note that it is only the relations between the countries within each alternative that are valid – the fact that Russia received different amount of points for the different alternatives is thus not relevant.

In other words, the normalisation means that an icelandic vote for Greece is more valuable than if Albania would vote for Greece.

As can be seen Lordi won even more impressively taken distances into account.

In my eyes tele-voting by country takes away too much of the musical aspect of the competition. The purist in me would like to get the proper jurys back but since we seem to be stuck with tele-voting I think it should be done with just one big “jury” and the song that gets the most votes wins.

I attach the spreadsheet if you want to check how I have done the calculations or modify it further.

Attachments

Linux screen resolution issues in Virtual PC

Virtual PC is great for setting up testbeds but the support for Linux is less than optimal. When installing standard Linux distributions under Virtual PC it may be impossible to set the resolution to anything higher than 800×600 or even to get any image at all.

Edit the sections for Monitor, Device and Screen in the file /etc/X11/xorg.conf to look like this:

Section "Monitor"
    Identifier  "Monitor0"     VendorName  "Monitor Vendor"     ModelName    "General Laptop Display Panel 1280x768"     HorizSync    31.5 - 90.0     VertRefresh  59.0 - 75.0     Option     "dpms" EndSection
Section "Device"
    Identifier  "Videocard0"
    Driver      "vesa"
    VendorName  "Videocard vendor"
    BoardName   "VESA driver (generic)"
    VideoRam    8192
EndSection
Section "Screen"
    Identifier "Screen0"
    Device     "Videocard0"
    Monitor    "Monitor0"
    DefaultDepth     16
    SubSection "Display"
        Viewport   0 0
        Depth     16
        Modes    "1280x768" "1024x768" "800x600" "640x480"
    EndSubSection
EndSection

The above works for Fedora Core 5 under Virtual PC 5.3.582.27. If you are unable to get any image then boot from the rescue CD and use 'nano' or 'vi' to edit the file.

UsbAutorun

UsbAutorun is an application that enables autostarting of applications upon insertion of USB memory cards in Windows. Autostarting of applications when inserting new media is generally used for CDs and triggered by a file called autorun.inf in the root of the disk. This function is not supported for USB memories in the base OS although Windows XP sp2 introduced some support for it.

This application is provided as-is and is free for any use provided that it is not resold or included in any commercial offering.

Installation

To install this application:

  1. Extract the application (UsbAutorun.exe) to your disk.
    Open a command promt window and change directory to where the application was extracted
  2. Type usbautorun /install
  3. Type usbautorun /password {password} (with a password of sufficiently high entropy)
  4. Type usbautorun

Usage

As long as the application is running it will react on device insertions and use the autorun.inf file in the root of the USB memory to start any application indicated in the file. The autorun.inf file needs to have a new segment named UsbAutoRun which gives details on what to do when the USB memory is inserted. It also provides a password which must match the password configured in the computer itself. If the passwords don't match, the application will silently disregard the insertion of the USB memory. Below is an example of an autorun.inf file.

[AutoRun]
UseAutoPlay=1
ShellExecute=HelloWorld.vbs
icon=setup.ico

[UsbAutoRun]
ShellExecute=HelloWorld.vbs
Password=pwd

Running usbautorun /install writes data to the registry at HKCU \ Software \ Microsoft \ Windows \ CurrentVersion \ Run to make the application autostart when the current user is logged on. After it is installed the application must not be moved as the path is written to the registry. For more information on command line parameters, type usbautorun -? at the command promt.


Note: Is is highly recommended to use a password as the ability to run an application on the computer just by inserting a USB memory card otherwise may be misused as a way to spread viruses.

Attachments

Misbehaving Netgear WGPS606

To avoid having to run cables I have used a Netgear WGPS606 to wirelessly connect computers on my desktop with my broadband connection. When checking the log files on my Linux box I noticed that the Netgear unit was causing my log to fill up with DHCPDISCOVER/DHCPOFFER:

Jun 20 23:21:21 xxx dhcpd: DHCPDISCOVER from <mac>(WGPS606) via eth0
Jun 20 23:21:21 xxx dhcpd: DHCPOFFER on 10.1.1.191 to <mac>(WGPS606) via eth0
Jun 20 23:21:41 xxx dhcpd: DHCPDISCOVER from <mac> (WGPS606) via eth0
Jun 20 23:21:41 xxx dhcpd: DHCPOFFER on 10.1.1.191 to <mac> (WGPS606) via eth0
Jun 20 23:22:01 xxx dhcpd: DHCPDISCOVER from <mac> (WGPS606) via eth0
Jun 20 23:22:01 xxx dhcpd: DHCPOFFER on 10.1.1.191 to <mac> (WGPS606) via eth0

It is all very strange since the MAC address for which the DHCP discover is sent is the wireless NIC. But the wireless NIC has a static IP address and should not need to request a DHCP address in the first place. Furthemore, the DHCP server is on the LAN side of the Netgear box.

Netgear support has been unable to assist so in the end I had to blacklist the WGSP606 using the following few lines in dhcpd.conf:

host wgps606 {
        hardware ethernet <mac>;
        ignore booting;
        ignore bootp;
}

Apart from this the WGPS606 has been doing a great job for now almost a year.

Standard connectors, please!

Over the past ten years I have had a number of mobile phones from a couple of manufactures. In the process I have gathered an impressive (although my wife would tell you otherwise) collection of chargers, sync cables and headphones, most of which are incompatible with each other.

I understand the manufacturers' interest in making easy money on the after-market by flogging substandard equipment at a premium price but I would rather see they made my life easier.

I already have a set of headphones that are better than anything they would ever make me able to connect to their phone. I don't want to spoil a small phone by having to drag along a set of accessories and if I need to charge my phone when I am at a friend's place I want to use whatever charger is available. And I most certainly don't want a dongle that is sure to get lost anyway to connect a standard set of headphones to some proprietary connector.

So please:

  • Use Mini-USB to connect the phone with a computer and make it possible to charge via the same connector
  • Provide a 3.5″ audio connector directly on the phone

How to save a Real audio stream using only freeware

On more than one occassion I have found myself with a need to save a Real audio stream from a web site. Each time I have had to browse through multiple web sites to find a working solution. This is how I managed to do it last time around.

  1. Download and install FlashGet (http://www.flashget.com/index_en.htm)
  2. Copy audio stream URL (ending with .ram) from the web browser
  3. Create a new download in FlashGet using the URL taken from the previous step
  4. Run the download job to get the Real audio file
  5. Download and install Switch (http://www.nch.com.au/switch/)
  6. Use Switch to convert the Real audio file to the desired format

If required, use an application such as Mp3splt (http://mp3splt.sourceforge.net) to split the file into manageable parts.

All of the above applications are free to download and use.

SimpleSocket

SimpleSocket is a COM DLL server that wraps basic UDP send/receive functionality. It is quite simple to use from all major Windows programming environments (C++, C#, VB, VBScript etc).

This application is provided as-is and is free for any use provided that it is not resold or included in any commercial offering.

The DLL must be registered prior to use. Although this can be done in many ways, one simple way is:

  1. Extract the File SimpleSocket.dll to a suitable folder
  2. Press the start button and select “Run…”
  3. Type cmd and press OK
  4. Type regsvr32 followed by the full path to the DLL

Although the exact usage varies depending on programming environment, the following sample should be able to serve as a guide. It includes a sending and a receiving application. Put each of these code segments in a file with the suffix .vbs, then run them both.

Receiver

Set socket=WScript.CreateObject("SimpleSocket.Udp", "event_")
Sub event_OnReceive(data)
    WScript.Echo "Received: " & data
End Sub

socket.Listen "127.0.0.1", 10000
While(True)
    WScript.Sleep(5000)
Wend
socket.Abort

Sender

Set socket=WScript.CreateObject("SimpleSocket.Udp")
socket.Send "127.0.0.1", 10000, "Data sent from the client"

Methods

The following methods are supported

  • Listen {ip}, {port} – Starts listening for incoming data on the ip and port.
  • Abort – Stops listening for data.
  • Send {ip}, {port}, {data} – Sends the data to the peer using the ip and port. The data must be provided in text format.
  • OnReceive – Callback method for asynchronous notification of incoming data.

Uninstallation

  1. Press the start button and select “Run…”
  2. Type cmd and press OK
  3. Type regsvr32 -u followed by the full path to the DLL

Attachments