<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>the echothis blog</title>
	<atom:link href="http://blog.echothis.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.echothis.com</link>
	<description>HelloWorld() shouldn't be so hard</description>
	<lastBuildDate>Thu, 12 Aug 2010 20:48:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Google Chrome doesn&#8217;t like to stream</title>
		<link>http://blog.echothis.com/2010/08/10/google-chrome-doesnt-like-to-stream/</link>
		<comments>http://blog.echothis.com/2010/08/10/google-chrome-doesnt-like-to-stream/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 22:03:23 +0000</pubDate>
		<dc:creator>Rolf</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.echothis.com/?p=387</guid>
		<description><![CDATA[Often if you have a long-loading page,  you&#8217;ll want to stream the content as it arrives.  Firefox does a great job of aggressively rendering content, but other browsers like Google Chrome and IE don&#8217;t. A typical workaround for this is to first &#8220;wake up&#8221; the browser, then periodically flush the output buffer &#8211; this has [...]]]></description>
			<content:encoded><![CDATA[<p>Often if you have a long-loading page,  you&#8217;ll want to stream the content as it arrives.  Firefox does a great job of aggressively rendering content, but other browsers like Google Chrome and IE don&#8217;t.</p>
<p>A typical workaround for this is to first &#8220;wake up&#8221; the browser, then periodically flush the output buffer &#8211; this has been known for awhile.  What&#8217;s less known, is that the textual content you&#8217;re sending actually matters as well (at least to Chrome and thus likely Safari).  E.g., a standard <a href="http://www.joeyrivera.com/2008/ob_start-ob_flush-flush-set_time_limit-give-user-feedback-during-execution">workaround</a> is this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// start output buffer</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">ob_get_level</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">ob_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span><span style="color: #cc66cc;">70</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;printing...&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">print</span> <span style="color: #990000;">str_pad</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">4096</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #990000;">ob_flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">usleep</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">30000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>But what&#8217;s interesting is that this slight modification breaks it on Chrome:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// start output buffer</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">ob_get_level</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">ob_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span><span style="color: #cc66cc;">70</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;printing...<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">print</span> <span style="color: #990000;">str_pad</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">4096</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #990000;">ob_flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">usleep</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">30000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Apparently Google engineers think &lt;br&gt;&#8217;s are important, but newline characters, not so much.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.echothis.com/2010/08/10/google-chrome-doesnt-like-to-stream/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What to do if your ISP decides to block outgoing SSH requests</title>
		<link>http://blog.echothis.com/2010/08/03/what-to-do-if-your-isp-decides-to-block-outgoing-ssh-requests/</link>
		<comments>http://blog.echothis.com/2010/08/03/what-to-do-if-your-isp-decides-to-block-outgoing-ssh-requests/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 20:55:36 +0000</pubDate>
		<dc:creator>Rolf</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.echothis.com/?p=385</guid>
		<description><![CDATA[I run several websites on a leased VPS box and use WinSCP to SSH in. Suddenly a few days ago I got locked out, and got only “Connection Timeouts” when I tried to log in. First I figured this was due to my Norton Internet Security firewall suddenly getting confused. But disabling it, and the [...]]]></description>
			<content:encoded><![CDATA[<p>I run several websites on a leased VPS box and use WinSCP to SSH in.  Suddenly a few days ago I got locked out, and got only “Connection Timeouts” when I tried to log in.</p>
<ol>
<li>First I figured this was due to my Norton Internet Security firewall suddenly getting confused.  But disabling it, and the Windows Firewall, had no effect.</li>
<li>Then I tried resetting my router and flushing my DNS cache, which I knew was a long shot but worth a try.  Still no luck.</li>
<li>I tried SSH’ing in from another box on the internet and sure enough, got in right away (as did a friend of mine elsewhere and the VPS support people).  So this told me that Comcast (my ISP) had decided that traffic shaping was in my best interest (or at least theirs), and was thus blocking port 22 traffic to this particular box.  I should note that this server has no objectionable content on it (it’s actually for a few nonprofits I work with), I don’t transfer large files back and forth, or anything like that.  And also, this is an <strong>outgoing </strong>connection, <a href="http://nexus172.wordpress.com/2009/04/21/how-i-got-around-comcasts-blockade-of-ssh/">not an incoming one</a>, so it’s 100% within the Comcast terms of use anyway.</li>
</ol>
<p>This in mind, I logged into the server (via the other internet box) and set up sshd to run on a second, higher-number port by editing /etc/ssh/sshd_config:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">...
Port <span style="color: #000000;">22</span>
Port <span style="color: #7a0874; font-weight: bold;">&#91;</span>HIGH_NUMBER<span style="color: #7a0874; font-weight: bold;">&#93;</span>
...</pre></div></div>

<p>Then I bounced the sshd service and was able to log in on the new port.</p>
<p>This of course begs the question of what exactly Comcast is doing snooping on my network traffic and blocking connections without warning.  If I have a spare few hours to sit on the phone with their tech support, I intend to find out.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.echothis.com/2010/08/03/what-to-do-if-your-isp-decides-to-block-outgoing-ssh-requests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to restore a SQL Server database from a backup file</title>
		<link>http://blog.echothis.com/2010/07/15/how-to-restore-a-sql-server-database-from-a-backup-file/</link>
		<comments>http://blog.echothis.com/2010/07/15/how-to-restore-a-sql-server-database-from-a-backup-file/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 17:42:20 +0000</pubDate>
		<dc:creator>Rolf</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.echothis.com/?p=380</guid>
		<description><![CDATA[Recently I volunteered to port a website from ColdFusion/SQL Server to PHP and MySql.  But rather than getting the database snapshot as a SQL script, which would have been easy to migrate, I was given the database in the form of a SQL Server backup, which has two parts: an LDF log fie and an [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I volunteered to port a website from ColdFusion/SQL Server to PHP and MySql.  But rather than getting the database snapshot as a SQL script, which would have been easy to migrate, I was given the database in the form of a SQL Server backup, which has two parts: an LDF log fie and an MDF data file.</p>
<p>Now not being particularly skilled in SQL Server, I had to hunt around for what to do with this.  It turned out to be ultimately pretty easy.  Just install SQL Server 2008 via the Web Installer, reboot, and then launch the administration interface and run this SQL statement to import the backup file as a database:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">RESTORE <span style="color: #993333; font-weight: bold;">DATABASE</span> mydb <span style="color: #993333; font-weight: bold;">FROM</span> disk <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'C:<span style="color: #000099; font-weight: bold;">\\</span>path<span style="color: #000099; font-weight: bold;">\\</span>to<span style="color: #000099; font-weight: bold;">\\</span>mydb.bak'</span>
<span style="color: #993333; font-weight: bold;">WITH</span> <span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">,</span> MOVE <span style="color: #ff0000;">'mydb_Dat'</span> <span style="color: #993333; font-weight: bold;">TO</span> <span style="color: #ff0000;">'C:<span style="color: #000099; font-weight: bold;">\\</span>Program Files<span style="color: #000099; font-weight: bold;">\\</span>Microsoft SQL Server<span style="color: #000099; font-weight: bold;">\\</span>MSSQL10.SQLEXPRESS<span style="color: #000099; font-weight: bold;">\M</span>SSQL<span style="color: #000099; font-weight: bold;">\\</span>DATA<span style="color: #000099; font-weight: bold;">\\</span>mydbdat.mdf'</span><span style="color: #66cc66;">,</span>
MOVE <span style="color: #ff0000;">'mydb_log'</span> <span style="color: #993333; font-weight: bold;">TO</span> <span style="color: #ff0000;">'C:<span style="color: #000099; font-weight: bold;">\\</span>Program Files<span style="color: #000099; font-weight: bold;">\\</span>Microsoft SQL Server<span style="color: #000099; font-weight: bold;">\\</span>MSSQL10.SQLEXPRESS<span style="color: #000099; font-weight: bold;">\\</span>MSSQL<span style="color: #000099; font-weight: bold;">\\</span>DATA<span style="color: #000099; font-weight: bold;">\\</span>mydblog.ldf'</span></pre></div></div>

<p>Then choose &#8220;Script to File&#8221; to output the database to an ordinary SQL script, which then can be imported into MySQL.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.echothis.com/2010/07/15/how-to-restore-a-sql-server-database-from-a-backup-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick steps to configure SSL encryption on a WAMP server</title>
		<link>http://blog.echothis.com/2010/07/10/quick-steps-to-configure-ssl-encryption-on-a-wamp-server/</link>
		<comments>http://blog.echothis.com/2010/07/10/quick-steps-to-configure-ssl-encryption-on-a-wamp-server/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 19:02:41 +0000</pubDate>
		<dc:creator>Rolf</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.echothis.com/?p=373</guid>
		<description><![CDATA[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: Enable ssl_module in the Apache module list 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 &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>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:</p>
<ol>
<li>Enable ssl_module in the Apache module list</li>
<li>Create the self-signed certificate keys as per Section 3 of <a href="http://tud.at/programm/apache-ssl-win32-howto.php3">http://tud.at/programm/apache-ssl-win32-howto.php3</a>:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> c:\path\to\wamp\bin\apache\Apache2.2.11\conf
&nbsp;
<span style="color: #666666; font-style: italic;"># Set a PEM passphrase of 4 characters or more.  You can leave the challenge password blank.</span>
openssl req <span style="color: #660033;">-config</span> openssl.cnf <span style="color: #660033;">-new</span> <span style="color: #660033;">-out</span> my-server.csr
&nbsp;
<span style="color: #666666; font-style: italic;"># Set the &quot;Common Name&quot; to localhost, accepting the rest of the defaults.</span>
openssl rsa <span style="color: #660033;">-in</span> privkey.pem <span style="color: #660033;">-out</span> my-server.key
&nbsp;
openssl x509 <span style="color: #660033;">-in</span> my-server.csr <span style="color: #660033;">-out</span> my-server.cert <span style="color: #660033;">-req</span> <span style="color: #660033;">-signkey</span> my-server.key <span style="color: #660033;">-days</span> <span style="color: #000000;">365</span></pre></div></div>

</li>
<li>In your conf/extra/httpd-vhosts.conf, add this:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">### SSL</span>
<span style="color: #666666; font-style: italic;"># see http://www.modssl.org/docs/2.8/ssl_reference.html for more info</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># change this from &quot;sem&quot; to avoid startup errors</span>
SSLMutex default
&nbsp;
SSLRandomSeed startup <span style="color: #7a0874; font-weight: bold;">builtin</span>
SSLSessionCache none
&nbsp;
Listen <span style="color: #000000;">443</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>VirtualHost <span style="color: #000000; font-weight: bold;">*</span>:<span style="color: #000000;">443</span><span style="color: #000000; font-weight: bold;">&gt;</span>
ErrorLog logs<span style="color: #000000; font-weight: bold;">/</span>ssl.log
LogLevel info
<span style="color: #666666; font-style: italic;"># You can later change &quot;info&quot; to &quot;warn&quot; if everything is OK</span>
&nbsp;
SSLEngine On
SSLCertificateFile conf<span style="color: #000000; font-weight: bold;">/</span>my-server.cert
SSLCertificateKeyFile conf<span style="color: #000000; font-weight: bold;">/</span>my-server.key
&nbsp;
<span style="color: #666666; font-style: italic;"># copy the &lt;Directory&gt; information from the appropriate HTTP virtual host</span>
DocumentRoot <span style="color: #ff0000;">&quot;C:/path/to/docroot&quot;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>Directory <span style="color: #000000; font-weight: bold;">/&gt;</span>
    ...
<span style="color: #000000; font-weight: bold;">&lt;/</span>Directory<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;/</span>VirtualHost<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

</li>
<li>Restart Apache.</li>
</ol>
<p>That should do it, then just navigate to <strong>http://localhost:443</strong>.  You&#8217;ll get browser warnings complaining that the certificate is self-signed and thus probably bogus, but it will work otherwise.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.echothis.com/2010/07/10/quick-steps-to-configure-ssl-encryption-on-a-wamp-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Subversion on CentOS &#8211; be careful what you read</title>
		<link>http://blog.echothis.com/2010/07/06/installing-subversion-on-centos-be-careful-what-you-read/</link>
		<comments>http://blog.echothis.com/2010/07/06/installing-subversion-on-centos-be-careful-what-you-read/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 21:06:50 +0000</pubDate>
		<dc:creator>Rolf</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.echothis.com/?p=358</guid>
		<description><![CDATA[The CentOS directions are pretty good &#8211; follow them to the letter.  The directions in the installed /etc/httpd/conf.d/subversion.conf &#8211; less so.  In particular, your &#60;Location&#62; node should look something like this, in order to work (ignore the rest): &#60;Location /repos&#62; DAV svn # path to your repo here SVNPath /var/www/svn/repos &#160; AuthType Basic AuthName &#34;Subversion [...]]]></description>
			<content:encoded><![CDATA[<p>The<a href="http://wiki.centos.org/HowTos/Subversion"> CentOS directions</a> are pretty good &#8211; follow them to the letter.  The directions in the installed /etc/httpd/conf.d/subversion.conf &#8211; less so.  In particular, your &lt;Location&gt; node should look something like this, in order to work (ignore the rest):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;</span>Location <span style="color: #000000; font-weight: bold;">/</span>repos<span style="color: #000000; font-weight: bold;">&gt;</span>
  DAV <span style="color: #c20cb9; font-weight: bold;">svn</span>
  <span style="color: #666666; font-style: italic;"># path to your repo here</span>
  SVNPath <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span>repos
&nbsp;
  AuthType Basic
  AuthName <span style="color: #ff0000;">&quot;Subversion repos&quot;</span>
  AuthUserFile <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>svn-auth-conf
  Require valid-user
<span style="color: #000000; font-weight: bold;">&lt;/</span>Location<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.echothis.com/2010/07/06/installing-subversion-on-centos-be-careful-what-you-read/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Saving out a playlist to share it</title>
		<link>http://blog.echothis.com/2010/07/05/saving-out-a-playlist-to-share-it/</link>
		<comments>http://blog.echothis.com/2010/07/05/saving-out-a-playlist-to-share-it/#comments</comments>
		<pubDate>Mon, 05 Jul 2010 16:44:20 +0000</pubDate>
		<dc:creator>Rolf</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.echothis.com/?p=353</guid>
		<description><![CDATA[Apple, and to a lesser extent, Microsoft, go out of their way to make sharing music painful &#8211; 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 [...]]]></description>
			<content:encoded><![CDATA[<p>Apple, and to a lesser extent, Microsoft, go out of their way to make sharing music painful &#8211; 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&#8217;t &#8220;send&#8221; them a playlist &#8211; you&#8217;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&#8217;t so sad!</p>
<p>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&#8217;s PC, and the music copied to the destination of choice.  Finally, it outputs a modified PLS file with all the paths changed.</p>
<p>No magic here, just a few lines of code to make the tedious task of sharing music you like, somewhat less so.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// saveplaylist.php</span>
<span style="color: #000088;">$copy_folder</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'H:\\temp\\'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// path to a central directory</span>
<span style="color: #000088;">$destination_folder</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'C:\\My Music\\'</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// the destination on your friend's PC</span>
<span style="color: #000088;">$playlist_file</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'C:\Users\JohnDoe\Music\Playlists\myplaylist.pls'</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// the playlist file</span>
<span style="color: #000088;">$contents</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$playlist_file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$newplaylist</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$contents</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$matches</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">preg_match_all</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/File(.*)=(.*)$/msU'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$contents</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #339933;">,</span> PREG_SET_ORDER<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$match</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$match</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> <span style="color: #990000;">pathinfo</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span> PATHINFO_BASENAME<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Copying <span style="color: #006699; font-weight: bold;">{$file}</span>...<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$copy_file</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$copy_folder</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$name</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$destination_file</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$destination_folder</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$name</span><span style="color: #339933;">;</span>
		<span style="color: #990000;">copy</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span> <span style="color: #000088;">$copy_file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$escaped_filename</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'\\'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'\\\\'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$match</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$escaped_filename</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'\\.'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$escaped_filename</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$escaped_filename</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'['</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'\\['</span><span style="color: #339933;">,</span> <span style="color: #000088;">$escaped_filename</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$escaped_filename</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">']'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'\\]'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$escaped_filename</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$escaped_filename</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'('</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'\\('</span><span style="color: #339933;">,</span> <span style="color: #000088;">$escaped_filename</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$escaped_filename</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">')'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'\\)'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$escaped_filename</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$newplaylist</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/File'</span><span style="color: #339933;">.</span><span style="color: #000088;">$match</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'='</span><span style="color: #339933;">.</span><span style="color: #000088;">$escaped_filename</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'File'</span><span style="color: #339933;">.</span><span style="color: #000088;">$match</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'='</span><span style="color: #339933;">.</span><span style="color: #000088;">$destination_file</span><span style="color: #339933;">,</span> <span style="color: #000088;">$newplaylist</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;hr&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$newplaylist</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.echothis.com/2010/07/05/saving-out-a-playlist-to-share-it/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The best way to get a playlist onto an iPod or iPhone</title>
		<link>http://blog.echothis.com/2010/05/28/the-best-way-to-get-a-playlist-onto-an-ipod-or-iphone/</link>
		<comments>http://blog.echothis.com/2010/05/28/the-best-way-to-get-a-playlist-onto-an-ipod-or-iphone/#comments</comments>
		<pubDate>Fri, 28 May 2010 20:27:14 +0000</pubDate>
		<dc:creator>Rolf</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.echothis.com/?p=351</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>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.</p>
<p>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.</p>
<p>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 <a href="http://getsongbird.com">Songbird</a>, then export it into a PLS file that can be read by iTunes.  So the steps are</p>
<ol>
<li>Install <a href="http://getsongbird.com">Songbird</a>.</li>
<li>Install the “<a href="http://addons.songbirdnest.com/addon/51">Playlist Export Tool</a>” add-in.  I suggest also installing the <a href="http://addons.songbirdnest.com/addon/24">Windows Media Playback</a> and <a href="http://addons.songbirdnest.com/addon/1230">LyricMaster</a> add-ins while you’re at it.</li>
<li>Import your library into Songbird by following the directions.</li>
<li>Make the playlist you want. The search box in the upper right can be really useful in this.</li>
<li>When done go to File-&gt;Export Playlist(s)</li>
<li>Check the playlist, then click “Done” to save it as a PLS to the specified location.</li>
<li>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.</li>
</ol>
<p>This way you can actual spend time listening to your music, not fighting with iTunes.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.echothis.com/2010/05/28/the-best-way-to-get-a-playlist-onto-an-ipod-or-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Index PDF files with Windows 7 64-bit</title>
		<link>http://blog.echothis.com/2010/03/18/index-pdf-files-with-windows-7-64-bit/</link>
		<comments>http://blog.echothis.com/2010/03/18/index-pdf-files-with-windows-7-64-bit/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 22:56:10 +0000</pubDate>
		<dc:creator>Rolf</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.echothis.com/?p=347</guid>
		<description><![CDATA[In a previous post I offered some hints for getting Windows Search to work better.  Here&#8217;s another one. Adobe PDF files are ubiquitous, so you&#8217;d expect to be able to index them.  But Windows doesn&#8217;t ship with a &#8220;filter&#8221; for this format, so you have to download your own.  According to Adobe: Adobe currently bundles [...]]]></description>
			<content:encoded><![CDATA[<p>In a <a href="http://blog.echothis.com/2010/02/10/making-windows-7-search-a-little-less-dysfunctional/">previous post</a> I offered some hints for getting Windows Search to work better.  Here&#8217;s another one.</p>
<p>Adobe PDF files are ubiquitous, so you&#8217;d expect to be able to index them.  But Windows doesn&#8217;t ship with a &#8220;filter&#8221; for this format, so you have to download your own.  According to <a href="http://www.adobe.com/support/downloads/detail.jsp?ftpID=4025">Adobe</a>:</p>
<blockquote><p>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.</p>
<p>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.</p></blockquote>
<p>At least for me, the 32-bit filter version that got installed with Adobe Reader 9 apparently doesn&#8217;t work on Windows 7 64-bit, and worst of all, fails silently so you would never know there&#8217;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.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.echothis.com/2010/03/18/index-pdf-files-with-windows-7-64-bit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making Windows 7 Search a little less dysfunctional</title>
		<link>http://blog.echothis.com/2010/02/10/making-windows-7-search-a-little-less-dysfunctional/</link>
		<comments>http://blog.echothis.com/2010/02/10/making-windows-7-search-a-little-less-dysfunctional/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 02:10:15 +0000</pubDate>
		<dc:creator>Rolf</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.echothis.com/?p=336</guid>
		<description><![CDATA[I was never a fan of Windows Desktop Search.  I had stuck with Google Desktop Search for a long time, but gradually got sick of the CPU hogging and so gave Windows Search (on Vista) another try.  It seemed to find emails in Outlook well enough, but as a tool for file-searching, it frankly sucked.  [...]]]></description>
			<content:encoded><![CDATA[<p>I was never a fan of Windows Desktop Search.  I had stuck with Google Desktop Search for a long time, but gradually got sick of the CPU hogging and so gave Windows Search (on Vista) another try.  It seemed to find emails in Outlook well enough, but as a tool for file-searching, it frankly sucked.  It just wouldn&#8217;t find stuff I knew was there.  So I was forced to go low-tech to, say, find all files with the word &#8220;wordpress blog&#8221; in them:  either</p>
<ol>
<li>Use the &#8220;Find In Files&#8221; feature of Visual Studio</li>
<li>Fire up a <a href="http://cygwin.com">Cygwin bash shell</a> and use the trusty old grep.</li>
</ol>
<p>I was rather disappointed to find the same shortcoming in Windows 7 Search: that it would completely fail to find plaintext files that contained some string.  How much simpler a request can you make?</p>
<p>Turns out Windows 7 <strong>can </strong>do what I am looking for, it just needs to be reconfigured in two significant ways:</p>
<ol>
<li>In the Start search box type in &#8220;Indexing Options&#8221; to open that  control panel.</li>
<li>Click the Advanced button.</li>
<li>Make sure that the file extensions you hope to find are set up to &#8220;index file contents&#8221;, which isn&#8217;t the default behavior.  So go to the &#8220;File Types&#8221; tab and find the extensions you&#8217;d like to find  (in my case it was &#8220;php&#8221;).  Highlight it and then click the &#8220;Index  Properties and File Contents&#8221; radio button.  If you can&#8217;t find the file type you&#8217;re looking for, you&#8217;ll have to add it at the bottom.  Repeat for other file  types.</li>
<li>OK out of the &#8220;Advanced Options&#8221; dialog.</li>
<li>Then, despite what the Windows 7 documentation says, <strong>simply adding a directory  to a Library does not make it get indexed</strong>.  So click the &#8220;Modify&#8221; button and manually add whatever directory you want indexed.</li>
<li>You probably want to delete and rebuild the index at this point (in the Advanced Options) dialog, then go for a nice long walk as it could take hours to finish the indexing.</li>
</ol>
<p>Do all this, and finally Windows 7 Search will at least work.  Now it&#8217;s still not quite as fully-functioned as, say,Visual Studio Search, for the following reasons:</p>
<ol>
<li>I don&#8217;t get preview snippets of PHP (or Javascript, or CSS, etc.) files in the search results, although I do for HTML files.  Huh?  Both are plain text, and Windows 7 knows that!</li>
<li>Non-alphanumeric characters get totally ignored in the search term.  E.g., I&#8217;m a big fan of <a href="http://www.firephp.org">FirePHP</a>, but good luck doing a search for all instances of, say, &#8220;<tt>fb(</tt>&#8220;.  The parenthesis gets dropped.</li>
</ol>
<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.echothis.com/2010/02/10/making-windows-7-search-a-little-less-dysfunctional/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Installing APC on PHP 5.3</title>
		<link>http://blog.echothis.com/2010/02/05/installing-apc-on-php-5-3/</link>
		<comments>http://blog.echothis.com/2010/02/05/installing-apc-on-php-5-3/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 15:25:06 +0000</pubDate>
		<dc:creator>Rolf</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.echothis.com/?p=342</guid>
		<description><![CDATA[In a previous post I had some instructions for building PHP 5.3 on 64-bit CentOS 5.  Turns out the caching extension listed there, eAccelerator, didn&#8217;t show a marked performance benefit in our benchmark testing.  So instead I decided to play with APC, one of the competitors.  Getting this installed was a bit tricky though (e.g., [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous post I had <a href="/2009/10/28/quickie-how-to-for-getting-php-upgraded-on-centos-5/">some instructions</a> for building PHP 5.3 on 64-bit CentOS 5.  Turns out the caching extension listed there, eAccelerator, didn&#8217;t show a marked performance benefit in our benchmark testing.  So instead I decided to play with <a href="http://si2.php.net/manual/en/book.apc.php">APC</a>, one of the competitors.  Getting this installed was a bit tricky though (e.g., compiling statically errors out), so follow these steps:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># First build PHP as usual, since we'll be installing this as a shared extension</span>
<span style="color: #666666; font-style: italic;"># Then try to get rid of any leftover header files</span>
yum remove php-devel
&nbsp;
<span style="color: #666666; font-style: italic;"># Symlink your &quot;real&quot; php include directory</span>
<span style="color: #c20cb9; font-weight: bold;">mv</span>  <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>include<span style="color: #000000; font-weight: bold;">/</span>php <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>include<span style="color: #000000; font-weight: bold;">/</span>php-previous-version
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>include
<span style="color: #c20cb9; font-weight: bold;">ln</span> –s <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>new<span style="color: #000000; font-weight: bold;">/</span>php<span style="color: #000000; font-weight: bold;">/</span>source<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">dir</span> php
&nbsp;
<span style="color: #666666; font-style: italic;"># only the beta version of APC works on PHP 5.3; see http://pecl.php.net/bugs/bug.php?id=16078</span>
pecl <span style="color: #c20cb9; font-weight: bold;">install</span> apc-beta
<span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>php<span style="color: #000000; font-weight: bold;">/</span>extensions<span style="color: #000000; font-weight: bold;">/</span>no-debug-non-zts-<span style="color: #000000;">20060613</span><span style="color: #000000; font-weight: bold;">/</span>apc.so <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>php<span style="color: #000000; font-weight: bold;">/</span>modules
&nbsp;
<span style="color: #666666; font-style: italic;"># copy the APC dashboard script to your webroot</span>
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>php<span style="color: #000000; font-weight: bold;">/</span>apc.php <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>your<span style="color: #000000; font-weight: bold;">/</span>webroot
&nbsp;
<span style="color: #666666; font-style: italic;"># Add the extension in a new file /etc/php.d/apc.ini</span>
; Enable apc extension module
<span style="color: #007800;">extension</span>=apc.so
apc.enable = <span style="color: #000000;">1</span></pre></div></div>

<p>Bounce apache and then go to yourdomain.com/apc.php to see the status.</p>
<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.echothis.com/2010/02/05/installing-apc-on-php-5-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
