Category Archives: Windows

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

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

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

Descript

Descript provides for an easy way to stop specific VBScripts. VBScripts running under either WScript.exe or CScript.exe, the two script hosts in Windows, turn up with just the name of the script host in the task manager and it can be difficult to know which process to kill.

descript_taskmgr.gif

By using this application the scripts are distinguished by the name of the actual script file.

descript_gui.gif

This application works on Windows XP and later only. This application is provided as-is and is free for any use provided that it is not resold or included in any commercial offering.

To install this application:

  1. Extract the application to your disk
  2. Run descript.exe

Usage
Right-click on the icon in the notification area (system tray) and select Stop. A list of scripts, if any, is shown. By selecting a script it is terminated. As an alternative, all scripts can be stopped in one operation. The icons to the left of the script names indicates if the script is running under WScript.exe or CScript.exe.

Attachments