Published by Rolf on 10 Jul 2010

Quick steps to configure SSL encryption on a WAMP server

There are a number of guides for this on the web, all of varying accuracy.  These are the minimal steps I followed to get it working for development on a stock WAMP server installation:

  1. Enable ssl_module in the Apache module list
  2. Create the self-signed certificate keys as per Section 3 of http://tud.at/programm/apache-ssl-win32-howto.php3:
    cd c:\path\to\wamp\bin\apache\Apache2.2.11\conf
     
    # Set a PEM passphrase of 4 characters or more.  You can leave the challenge password blank.
    openssl req -config openssl.cnf -new -out my-server.csr
     
    # Set the "Common Name" to localhost, accepting the rest of the defaults.
    openssl rsa -in privkey.pem -out my-server.key
     
    openssl x509 -in my-server.csr -out my-server.cert -req -signkey my-server.key -days 365
  3. In your conf/extra/httpd-vhosts.conf, add this:
    ### SSL
    # see http://www.modssl.org/docs/2.8/ssl_reference.html for more info
     
    # change this from "sem" to avoid startup errors
    SSLMutex default
     
    SSLRandomSeed startup builtin
    SSLSessionCache none
     
    Listen 443
    <VirtualHost *:443>
    ErrorLog logs/ssl.log
    LogLevel info
    # You can later change "info" to "warn" if everything is OK
     
    SSLEngine On
    SSLCertificateFile conf/my-server.cert
    SSLCertificateKeyFile conf/my-server.key
     
    # copy the <Directory> information from the appropriate HTTP virtual host
    DocumentRoot "C:/path/to/docroot"
    <Directory />
        ...
    </Directory>
    </VirtualHost>
  4. Restart Apache.

That should do it, then just navigate to http://localhost:443.  You’ll get browser warnings complaining that the certificate is self-signed and thus probably bogus, but it will work otherwise.

Published by Rolf on 06 Jul 2010

Installing Subversion on CentOS – be careful what you read

The CentOS directions are pretty good – follow them to the letter.  The directions in the installed /etc/httpd/conf.d/subversion.conf – less so.  In particular, your <Location> node should look something like this, in order to work (ignore the rest):

<Location /repos>
  DAV svn
  # path to your repo here
  SVNPath /var/www/svn/repos
 
  AuthType Basic
  AuthName "Subversion repos"
  AuthUserFile /etc/svn-auth-conf
  Require valid-user
</Location>

Published by Rolf on 05 Jul 2010

Saving out a playlist to share it

Apple, and to a lesser extent, Microsoft, go out of their way to make sharing music painful – even in the simple case of sharing a playlist of songs with your buddy (which clearly falls under Fair Use!).  For example, suppose you made a playlist for yourself (of music you own), put it on an iPod, and then played it for a friend.  If they liked it and wanted it on their iPod as well, how would you share it with them?  You can’t “send” them a playlist – you’d have to copy the songs one by one to a hard drive or DVD, then hand it to your friend, he plugs it into his computer, he copies over the songs, then he takes the time to recreate your playlist manually in iTunes.  It would be funny if the state of the art wasn’t so sad!

In just this situation, I ended up writing a short PHP console script to do this semi-automatically.  It parses a playlist file in PLS format, then copies the files to a central directory, which can then be copied to an external hard drive.  This would then be plugged into your friend’s PC, and the music copied to the destination of choice.  Finally, it outputs a modified PLS file with all the paths changed.

No magic here, just a few lines of code to make the tedious task of sharing music you like, somewhat less so.

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
// saveplaylist.php
$copy_folder = 'H:\\temp\\'; // path to a central directory
$destination_folder = 'C:\\My Music\\';  // the destination on your friend's PC
$playlist_file = 'C:\Users\JohnDoe\Music\Playlists\myplaylist.pls';  // the playlist file
$contents = file_get_contents($playlist_file);
 
$newplaylist = $contents;
 
$matches = array();
if (preg_match_all('/File(.*)=(.*)$/msU', $contents, $matches, PREG_SET_ORDER))
{
	foreach ($matches as $match)
	{
		$file = $match[2];
		$file = trim($file);
		$name = pathinfo($file, PATHINFO_BASENAME);
		echo "Copying {$file}...\n";
		$copy_file = $copy_folder . $name;
		$destination_file = $destination_folder . $name;
		copy($file, $copy_file);
		$escaped_filename = str_replace('\\', '\\\\', $match[2]);
		$escaped_filename = str_replace('.', '\\.', $escaped_filename);
		$escaped_filename = str_replace('[', '\\[', $escaped_filename);
		$escaped_filename = str_replace(']', '\\]', $escaped_filename);
		$escaped_filename = str_replace('(', '\\(', $escaped_filename);
		$escaped_filename = str_replace(')', '\\)', $escaped_filename);
		$newplaylist = preg_replace('/File'.$match[1].'='.$escaped_filename."/", 'File'.$match[1].'='.$destination_file, $newplaylist);
	}
}
echo '<hr>';
echo $newplaylist;

Published by Rolf on 28 May 2010

The best way to get a playlist onto an iPod or iPhone

It’s my firm belief that the bloated, horrible software that is iTunes will ultimately be the downfall of Apple’s music business. It’s really, really awful on a variety of fronts (performance, openness to outside developers, etc.), but is sadly the most reliable way I can get music onto my iPhone and iPod. Beyond that, I try to stay out of iTunes as much as possible.

While the Windows Media Player 12 (part of Windows 7) has improved significantly over the previous version, particularly in terms of performance and streaming more video formats out of the box, as a simple jukebox it still leaves a lot to be desired. The best media player app I’ve found is Songbird, due to several factors such as a) it’s open-source, b) it has a number of great community-built plugins for things like lyrics, and c) it allows you to manage your music in ways the other apps simply cannot.

A simple example is “What is the best way to get a playlist onto my iPod/iPhone”? This is much more complicated than it should be if you have a large library (i.e., too large to handle in iTunes, which isn’t much). So the best way is to create it in Songbird, then export it into a PLS file that can be read by iTunes. So the steps are

  1. Install Songbird.
  2. Install the “Playlist Export Tool” add-in. I suggest also installing the Windows Media Playback and LyricMaster add-ins while you’re at it.
  3. Import your library into Songbird by following the directions.
  4. Make the playlist you want. The search box in the upper right can be really useful in this.
  5. When done go to File->Export Playlist(s)
  6. Check the playlist, then click “Done” to save it as a PLS to the specified location.
  7. Close Songbird and open iTunes. You can now drag the PLS file into iTunes, which will then import the songs it needs. You can then sync it with your device.

This way you can actual spend time listening to your music, not fighting with iTunes.

Published by Rolf on 18 Mar 2010

Index PDF files with Windows 7 64-bit

In a previous post I offered some hints for getting Windows Search to work better.  Here’s another one.

Adobe PDF files are ubiquitous, so you’d expect to be able to index them.  But Windows doesn’t ship with a “filter” for this format, so you have to download your own.  According to Adobe:

Adobe currently bundles a 32-bit PDF iFilter with Adobe Acrobat® 9 as well as free Adobe Reader® 9 software. It uses the Microsoft iFilter interface and allows third-party indexing tools to extract text from Adobe PDF files.

In response to customer requests, Adobe is releasing Adobe PDF iFilter 9 for 64-bit platforms, which will allow searching PDF files on Microsoft® Windows® 64-bit platforms for applications such as Microsoft Office SharePoint Server 2007, Microsoft Exchange Server 2007, and Microsoft SQL Server 2005.

At least for me, the 32-bit filter version that got installed with Adobe Reader 9 apparently doesn’t work on Windows 7 64-bit, and worst of all, fails silently so you would never know there’s a problem.  So install the download at the link above.  After that you probably need to rebuild your index, but should get your PDF files indexed from that point forward.

« Prev - Next »