Categories
Computers Music Windows

CD ripping workflow

Since some time back I have moved my entire music library online in a fully lossless format. The idea of ripping the entire library of CDs did not exactly thrill me – especially since I had ripped most of the records already, but in a non-optimal format.

After having carefully studied all alternatives I settled on using the FLAC format to store the music, the main reasons for this was the open source nature of FLAC. Your mileage may vary and for many a fully managed process using Windows Media Player or iTunes may be a better option – if you can live with your music being locked into the respective format.

My music environment includes multiple Slim devices (one Transporter and one Squeezebox) both driven by SlimServer on a Linux server running 24/7. To use this workflow the following applications are required: Exact Audio Copy, FLAC encoder, MP3Tag. In addition an graphics program is benecifical in order to process the cover art.

The step-by-step process I employ to rip a new CD is:

  1. Use Exact Audio Copy (EAC) to rip the CD (my configuration file can be found below). I don’t like the anglo-saxon way of capitalising every word in the song titles so I change them all manually. I also add multiple genres separated by semicolon which works fine with SlimServer but freaks out iTunes and Windows Media Player.
  2. I make sure to save a copy of the log file from EAC to the same folder as the FLAC files.
  3. For multi-record album (and other complex albums) I use MP3Tag to add DISCNUMBER and other information and rename the files so that each file has a three digit number where the first digit indicates the record within the album set.
  4. I then scan the cover of the record and create a 1080×1080 pixel JPG image which is save in the same folder as the files.
  5. Finally, the files are moved to my Linux server where the attached Perl script is used to generate thumb nails. The script requires the presence of ImageMagick on the system which must be installed separately.

Attachments

Categories
Computers Windows

Purge stale shadow copy data in Windows Vista

diskspace.gif

Some versions of Windows Vista comes with Volume Shadow Copy, a souped up version of the system restore function of Windows XP. Now, not only registry and core files are restored but any file on a protected drive can be restored to an earlier point in time.

If this feature is enabled on a drive, Windows Vista sets aside a significant amount of disk space to keep the old copies. Supposedly this space can be reclaimed by using the Disk Cleanup feature. I had partitioned my hard drive and installed Windows Vista. When reinstalling Windows Vista I only reformatted my system drive and later noticed that a large amount of disk space was not accounted for when adding the sizes of all folders on the drive.

It turned out that Volume Shadow Copy was not enabled on my data drive after the reinstallation, but the data was kept from the previous installation and just wouldn't go away. To see the shadow storage I opened a console as administrator and typed 'vssadmin list shadowstorage'. I enabled Volume Shadow Copy on the data drive and ran the Disk Cleanup, before I disabled Volume Shadow Copy. No luck.

From what I have been able to tell, the Disk Cleanup feature does not work in this case. When I did the same thing but instead of the Disk Cleanup function issued the following command (still in the administrator console) it worked:

vssadmin resize shadowstorage /For=D: /On=D: /MaxSize=300MB
Categories
Computers Windows

Put user data on another disk in Windows Vista

By default, Windows Vista, like all previous versions, insists on saving user data on the same disk as the system files. This may be fine for many people but I really don't want it to work that way. Before Windows Vista, you could edit the registry to move the folders around. Now in Windows Vista, Microsoft has added support to move the folders directly from within the file explorer which, in theory, should simplify matters. However, it doesn't always work and many applications fail to save in the new location. What is even worse, it appears to be impossible to change the location of the public folders from the GUI – even though the text in the GUI states that it is possible.

Realising that doing the changes via the GUI was totally worthless I tried to find another way. What worked very well for me was to change the two keys ProfilesDirectory and Public under HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ ProfileList.

The change to the key Public affects all users in the system whereas changing the key ProfilesDirectory only affects accounts that are created (or rather when the user first logs on) after the change was made. I recommend you create an Admin user at the end of the Windows Vista installation process, make the changes to the registry and then add normal accounts for the users who will use the system.

As always, be very careful when changing the registry as a mistake could potentially wreck your system.

Categories
Computers Windows

Stop capitalising 'i' in Outlook

For years I have been annoyed by the fact that Microsoft Outlook insists on capitalising the letter 'i' when I write email. In Swedish 'i' means 'in' and is not to be capitalised like the pronoun 'I' in English. It was not exactly apparent how to stop this AutoCorrect (bad name in this case) feature.

For me, the 'bug' didn't manifest itself all the time but only when I wrote mail in plain text.

One would assume that application wide options for Outlook could control this behaviour. I could uncheck the 'Replace text as you type' option but that removed all corrections which was not what I wanted.

It turns out that the way to change the behaviour is to change the AutoCorrect options from within a plain text email (i.e. not from the main Outlook window). Just remove the i/I pair from the list of corrections. After that, 'i' will not be changed to 'I' in future emails.

StopAutocorrect_3.gif

Categories
Computers Windows

ATL smart device development with IE7

VS_WM_IE7_bug_small.gif

If you have tried to write ATL based smart device applications under Visual Studio 2005 on a computer running IE7 you may have seen this error message. This error is due to changes in IE7. Apparently the upcoming service pack for Visual Studio 2005 (scheduled for Q3 2006) will fix this issue but until that happens, this is how to do it.

Run regedit.exe and add an empty key under HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Ext \ PreApproved. Name the new key “{D245F352-3F45-4516-B1E6-04608DA126CC}”. Then restart Visual Studio.

You may also use the attached file.

Attachments

Categories
Computers Windows

Enhancements for Windows Services for Unix

I found Windows Services for Unix by chance but has since got used to having a Unix-like environment on my Windows system, enabling me to more easily work with boxes running Linux.

If you have installed Windows Services for Unix (for a description of how to do it, please read this article) you might have realised that there are only so much you can do with the system out of the box. Many commands you take for granted in a Linux system are not there and some of those which are actually included don't behave quite the way you expect them to function.

Not to worry. The source code for most commands can be downloaded (www.gnu.org is a prime source) and compiled within SFU.

To save you the time to set up an environment with some tools that at least I found more or less necessary I provide a link to a set of scripts at the bottom of this post. The scripts automate the process of building the system by downloading and compiling the following applications:

To install, download the file below to a directory within your SFU installation (e.g. /tmp, normally c:\sfu\tmp from your Windows Explorer), then type the following from a C Shell window:

gunzip SfuPlus.tar.gz
tar -xvf SfuPlus.tar
cd SFU_Plus
./sfuplus.sh

The build process will take about 15 minutes on a modern computer. Slower computers may take more than an hour.

Attachments

Categories
Computers Windows

Install Windows Services for Unix 3.5

Microsoft Windows Services for Unix (or SFU for short) is a relatively unknown product. This is a shame since it can be quite handy for some people. And the price is definately right – free!

Contrary to other applications (e.g. cygwin) that attempt to provide a Unix/Linux envrionment under Windows, SFU is not an emulator running under Windows. Instead SFU provides a Posix subsystem that runs side by side with Win32 directly on top of the NT kernel. This should provide for better performance but I have not tested that myself. What I have found very nice, however, is that commands compiled and existing under SFU can be executed under Win32 anv vice versa.

Windows Services for Unix comes with a basic set of tools. Some of them are crippled in comparison with what you might be used to. In a separate post I will provide my setup script that adds a number of utilities (nano, wget, openssl, openssh etc) to the default setup.

To get started you need to download SFU from Microsoft and run the setup file. To help you I provide screenshots of all the steps necessary to set up SFU on your computer.

sfu_setup_1.gif

sfu_setup_2.gif

sfu_setup_3.gif

sfu_setup_4.gif

sfu_setup_5a.gif

sfu_setup_5b.gif

sfu_setup_6.gif

sfu_setup_7.gif

sfu_setup_8.gif

sfu_setup_9.gif

sfu_setup_10.gif

sfu_setup_11.gif

sfu_setup_14.gif

Categories
Computers Windows

Run Drupal on IIS

Of all the open source CMS solutions Drupal is one of my favourites (this site used to be run Drupal but has since been switched to WordPress). Installing it under Linux is normally a breeze since all of the requirements (PHP, MySQL etc) are already met by many popular Linux distributions. It requires a little more effort to install it on a Windows box and run it under IIS instead of under Apache but it is certainly doable.

Now why on earth would you like to do this, you may wonder. After all, Apache is available under Windows so why not just ditch IIS and go for Apache. Well, like me you may need to use IIS to run other sites that require IIS on the same server. While it would be possible to run both IIS and Apache on port 80 with some creative HTTP proxying it sure sounds easier to use a single server.

Install IIS

Depending on your version of Windows, Microsoft Internet Information Services (IIS) may not be installed by default on your machine. If it is not installed you should start by doing so – Start -> Control Panel -> Add or Remove Programs -> Add/Remove Windows Components.

Install MySQL

If you don't already have MySQL installed on your system then please go ahead and install it. The simplest way is to download the Windows Essential installation file. I also recommend the use of MySQL Administrator and MySQL Query Browser from the same web site.

Install PHP

Download PHP from www.php.net. Pick the zip file and not the installer. I use PHP 5.1.4 but it should work with any version supported by Drupal.

Extract the zipped file to a location of your choice. For the sake of this walk-through I will assume that you extracted it to C:\PHP\.

Add C:\PHP to your system path. From the start menu, right click on My Computer and select Properties. Then add a semi-colon followed by C:\PHP to the system path under the environment settings on the Advanced tab.

Create the directory c:\php\temp and give the account running the web site (normally IUSR_<computer name>) full permissions.

Copy the file c:\php.ini-recommended to c:\php.ini. You need to make at least the following changes:

  • Change extension_dir to “./ext”
  • Uncomment extension=php_mysql.dd
  • Uncomment extension=php_gd2.dd
  • Change upload_tmp_dir to c:\php\temp
  • Change sendmail_from to a valid email address

Using regedit.exe, add a setting to the registry within HKEY_LOCAL_MACHINE\Software\PHP:

IniFilePath  [SZ]  C:\PHP\

Install Drupal

Create a new directory to hold the virtual directory (or use the default site).

Download the Drupal installation file and extract it to the IIS virtual directory. The Drupal installation file is provided in a tar.gz format which Windows is normally not capable of opening. 7-zip is a good option if you have an issue with opening the file.

Create the directories 'files' and 'temp' within the Drupal site structure (if they don't already exist) and give the account running the web site (normally IUSR_<computer name>) full permissions to those directories.

Use MySQL Administrator to create a MySQL account that will be used by the site. Still from within MySQL Administrator, create a new database and give the account full permissions to that database.

From the Drupal directory, issue the command:

mysql -u [drupal account] -p [drupal database] < database/database.4.1.mysql

Edit the value of $db_url within the Drupal file /sites/default/settings.php to match your database and account settings.

Fix for clean paths

To support clean paths there must be a way for IIS to support URL rewriting in a similar way that mod_rewrite does it for Apache. There are a number of such utilities but most of them are provided at a charge. I found IIRF which does the job and is provided free of charge so go ahead and download it.

Change the ini file to be (remove or comment out existing lines):

RewriteRule /index\.php\?time=(.*)$ / [R]

# Add a slash in front of image URLs
RewriteRule my_theme/files/(.*)\.(?:jpg|jpeg|gif|png) /files/$1\.$2 [L]

#Allow direct access to some static information
RewriteRule /(.*)\.(?:css|jpeg|jpg|gif|png|js|ico) /$0 [L]

# Don't rewrite certain URLs
RewriteRule (.*)\?q=(.*) $0 [L]
RewriteRule ^/cron.php(.*)$ $0 [L]
RewriteRule ^/update.php(.*)$ $0 [L]

# Fix problem with links to next and previous pages
RewriteRule (.*)\?page=(.*) /\?q=$1&page=$2 [L]

# Change URLs in forms
RewriteRule ^/(.*)\?(.*)$ /$1

# Change the URL to query format
RewriteRule ^/(.*) /\?q=$1 [L]

The support to test the clean URL function in Drupal 4.7 is dependent upon .htaccess which is Apache related. Under IIS this has the effect that it is impossible to turn on clean paths from within the administration web pages. Instead you will have to add the following to your Drupal settings file (/sites/default/settings.php) in your Drupal directory.

$conf['clean_url'] = 1; // 1 enables, 0 disables

Hopefully that should do it. Good luck!

Categories
Computers Windows

Mail filter for Microsoft Exchange

I don't understand why people still open unknown attachments but apparently they do since the viruses with attachements with extension of .exe, .scr, .pif etc still flourish. A number of years ago and in the aftermath of such an virus attack I wrote this mail filter, implemented as an SMTP event sink for Microsoft Exchange Server 2003. I recently added support for recoding WAV file attachments to WMA based on my implementation of a WAV to WMA console utility.

Being able to transcode WAV files is particularily handy when used with a system that sends voice recordings in a poorly compressed format. An example of such an application is Avaya's voice mail server solution. A 45 second sound clip can thus be taken down from 750kB to 30kB which means that they can then easily and cost effectively be downloaded directly to smartphones capable of playing WMA files.

Installation

There is no installer included so you will have to do the installation manually. First you need to download and install the Microsoft Platform SDK. The only reason you need the Platform SDK is that you need the script SmtpReg.vbs from the include directory. Once you have the script you should copy it to some directory which is in your path. After that, do the following:

  • Copy the filter DLL to a suitable location on your Exchange server. It does not have to be in the same folder as Exchange itself.
  • Register the filter DLL by typing 'regsvr32 MailFilter.dll' from within the same folder.
  • Type 'smtpreg.vbs /add 1 OnArrival FilterSink MailFilter.Sink “rcpt to=*”'

The filter will be triggered by the first incoming email and write default settings to the registry (HKLM\Software\Bergek\MailFilter). Run the registry editor (regedit.exe) to make any changes you may want.

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

  • DropExtensions [SZ] Semicolon-separated list of attachment entries that will make the mail be dropped
  • ReencodeBitrate [DWORD] The minimum bitrate to be used to encode the sound files (only used if ReencodeWav is set)
  • ReencodeCodec [SZ] The preferred codec to be used to encode the sound files (only used if ReencodeWav is set)
  • ReencodeWav [DWORD] If true, reencodes WAV attachments using a voice encoder profile to save space
  • Syslog [DWORD] If true, log entries will be sent to a syslog client
  • SyslogAddress [SZ] The address to send syslog entries to (only used if Syslog is set)
  • SyslogPort [DWORD] The port to send syslog entries to (defaults to 514 and only used if Syslog is set)
  • WriteLog [DWORD] If true, writes log entries to a log file located in the same folder as the filter binary

Note that the log file is turned on by default which could grow big depending on the amount of email received by your system. To stop logging to a file, just change the value of WriteLog to zero. Also note that e-mail with at least one attachment with the extension .pif, .scr or .exe will be dropped entirely. To avoid dropping e-mail due to attachment extensions, just change the DropExtensions registry value to an empty string.

By writing 'rcpt to=*' when installing the event sink above the filter will receive all incoming SMTP mail traffic. If the filter should only be used for specific e-mail addresses they can be specified instead of the asterisk. It is also possible to use the format 'mail from=…' to filter only e-mail from a specific address. Multiple items can be separated by semi-colon.

Troubleshooting

Please verify directly after installation that your mail system is still operating as it should. Although this filter has proven very stable on my system it has not been tested on more than one system. If you do run into problems then just uninstall the filter and restart the IIS service (the first two points in the uninstallation instruction below).

Uninstallation

  • Remove the filter from the list of SMTP event sinks by typing 'smtpreg.vbs /remove 1 OnArrival FilterSink'
  • Restart the IIS SMTP service by running 'iisreset.exe'
  • Unregister the filter DLL by running 'regsvr32 /u MailFilter.dll'
  • Remove the filter DLL and the registry settings under HKLM\Software\Bergek\MailFilter

License

This application is provided as-is and free of charge as long as it is not included in any commercial offering. If you like it I would appreciate if you would link to my web site (http://www.spotwise.com).

Known issues

  • The file name for the attached sound file will change after the transcoding
  • Depending on the format of the e-mail received the filter may remove text encodings above 7 bit ASCII.

Attachments

Categories
Computers Music Windows

wav2wma – freeware console utility

VoiceWMA.gif

I provide this Windows console utility that transcodes from WAV files to WMA files. By default it uses the voice codec from Windows Media Audio 9 with a very low bitrate to encode voice content but it is possible to use any other Windows Media Audio codec and with a higher bitrate.

When I tried it after having done the last changes it even turned out to be possible to use mp3 files as input which was not even intentional but might be interesting to know. Do remember, however, that you would in that case be transcoding between two potential lossy formats which is normally not a good thing.

Usage: wav2wma -s source -t target [-c codec] [-b bitrate]
       wav2wma -l

Options
   -s source   Source WAV file
   -t target   Target WMA file
   -c codec    Preferred codec
   -b bitrate  Minimal bitrate [bps]
   -l          List all codecs on the system
   -?          Produces this help

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

Attachments

css.php