<?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>Guy Rutenberg</title>
	<atom:link href="http://www.guyrutenberg.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.guyrutenberg.com</link>
	<description>Keeping track of what I do</description>
	<lastBuildDate>Sun, 28 Feb 2010 19:20:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Improved FTP Backup for WordPress</title>
		<link>http://www.guyrutenberg.com/2010/02/28/improved-ftp-backup-for-wordpress/</link>
		<comments>http://www.guyrutenberg.com/2010/02/28/improved-ftp-backup-for-wordpress/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 06:38:44 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[backup]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=637</guid>
		<description><![CDATA[This script backups both the database and files of a WordPress blog into a remote FTP server (while keeping a local copy). It&#8217;s an update of my WordPress Backup to FTP script. The main changes are auto-detecting database settings and better support for caching plugins (specifically WP-Cache). The new version makes it easier to backup [...]]]></description>
			<content:encoded><![CDATA[<p>This script backups both the database and files of a WordPress blog into a remote FTP server (while keeping a local copy). It&#8217;s an update of my <a href="/2009/01/06/wordpress-backup-to-ftp/">WordPress Backup to FTP</a> script. The main changes are auto-detecting database settings and better support for caching plugins (specifically WP-Cache). The new version makes it easier to backup multiple WordPress blogs to the same FTP server.<br />
<span id="more-637"></span><br />
Usage is pretty simple after a short initial configuration. First, save the the script and make it executable:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> +x wp-backup</pre></div></div>

<p>(assuming you saved it under the name <code>wp-backup</code>). After saving it edit the file with your favorite editor and set the 5 configuration variable to whatever is appropriate for you. <code>BACKUP_DIR</code> is the folder to save the local backups to. <code>FTP_HOST</code>, <code>FTP_USER</code>, <code>FTP_PASS</code> control the FTP host, username and password, respectively, for the remote backup server. <code>FTP_BACKUP_DIR</code> sets the folder on the FTP server to save the remote backup to.</p>
<p>Now that the initial configuration is done, all you need to do is execute the script and give the path to the blog as an argument. For example:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>wp-backup <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>someuser<span style="color: #000000; font-weight: bold;">/</span>myblog</pre></div></div>

<p>And that it, the script will backup your files (excluding cache) and database to both a local and remote locations. This allows using the same script to backup multiple WordPress blogs, unlike the previous script which had to be modified for each blog.</p>
<p>And now the script itself:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Copyright 2008, 2010 Guy Rutenberg &lt;http://www.guyrutenberg.com/contact-me&gt;</span>
<span style="color: #666666; font-style: italic;"># WordPress FTP backup 2.0</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Easily backup wordpress instances via ftp.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Change Log:</span>
<span style="color: #666666; font-style: italic;"># ===========</span>
<span style="color: #666666; font-style: italic;"># 2.0:</span>
<span style="color: #666666; font-style: italic;">#  - Auto-detect database settings.</span>
<span style="color: #666666; font-style: italic;">#  - Exclude cache data from backups.</span>
&nbsp;
<span style="color: #007800;">BACKUP_DIR</span>=
<span style="color: #007800;">FTP_HOST</span>=
<span style="color: #007800;">FTP_USER</span>=
<span style="color: #007800;">FTP_PASS</span>=
<span style="color: #007800;">FTP_BACKUP_DIR</span>=
&nbsp;
<span style="color: #666666; font-style: italic;"># end of configuration - you probably don't need to touch anything bellow</span>
&nbsp;
<span style="color: #007800;">PROG</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">basename</span> <span style="color: #ff0000;">&quot;$0&quot;</span><span style="color: #000000; font-weight: bold;">`</span>
print_usage <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;USAGE: <span style="color: #007800;">${PROG}</span> [options] BLOG_ROOT&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Backup a WordPress blog&quot;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
print_help <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>  <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    print_usage
    <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #cc0000; font-style: italic;">&lt;&lt; EOF
&nbsp;
Options:
    -h, --help          show this help message and exit
&nbsp;
EOF</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #007800;">TEMP</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">getopt</span> <span style="color: #660033;">-o</span> h <span style="color: #660033;">--long</span> <span style="color: #7a0874; font-weight: bold;">help</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$PROG</span>&quot;</span> <span style="color: #660033;">--</span> <span style="color: #ff0000;">&quot;$@&quot;</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$?</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    print_usage
    <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">eval</span> <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">--</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TEMP</span>&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">true</span> ; <span style="color: #000000; font-weight: bold;">do</span>
    <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
        -h<span style="color: #000000; font-weight: bold;">|</span>--help<span style="color: #7a0874; font-weight: bold;">&#41;</span> print_help; <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000; font-weight: bold;">;;</span>
        --<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">shift</span>; <span style="color: #7a0874; font-weight: bold;">break</span><span style="color: #000000; font-weight: bold;">;;</span>
    <span style="color: #000000; font-weight: bold;">esac</span>
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
 print_usage <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>stderr
 <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #007800;">BLOG_DIR</span>=$<span style="color: #000000;">1</span>
<span style="color: #007800;">DB_NAME</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&lt;?php require_once(<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #007800;">${BLOG_DIR}</span>/wp-config.php<span style="color: #000099; font-weight: bold;">\&quot;</span>); echo DB_NAME;&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> php<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">DB_USER</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&lt;?php require_once(<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #007800;">${BLOG_DIR}</span>/wp-config.php<span style="color: #000099; font-weight: bold;">\&quot;</span>); echo DB_USER;&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> php<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">DB_PASS</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&lt;?php require_once(<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #007800;">${BLOG_DIR}</span>/wp-config.php<span style="color: #000099; font-weight: bold;">\&quot;</span>); echo DB_PASSWORD;&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> php<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">DB_HOST</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&lt;?php require_once(<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #007800;">${BLOG_DIR}</span>/wp-config.php<span style="color: #000099; font-weight: bold;">\&quot;</span>); echo DB_HOST;&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> php<span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #007800;">BLOG_DIR</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">dirname</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BLOG_DIR</span>&quot;</span><span style="color: #000000; font-weight: bold;">`/`</span><span style="color: #c20cb9; font-weight: bold;">basename</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BLOG_DIR</span>&quot;</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">BACKUP_DIR</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">dirname</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BACKUP_DIR</span>&quot;</span><span style="color: #000000; font-weight: bold;">`/`</span><span style="color: #c20cb9; font-weight: bold;">basename</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BACKUP_DIR</span>&quot;</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;dumping database... &quot;</span>
<span style="color: #007800;">DUMP_NAME</span>=<span style="color: #800000;">${DB_NAME}</span>-$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>Y<span style="color: #000000; font-weight: bold;">%</span>m<span style="color: #000000; font-weight: bold;">%</span>d<span style="color: #7a0874; font-weight: bold;">&#41;</span>.sql.bz2
mysqldump <span style="color: #660033;">--user</span>=<span style="color: #800000;">${DB_USER}</span> <span style="color: #660033;">--password</span>=<span style="color: #800000;">${DB_PASS}</span> <span style="color: #660033;">--host</span>=<span style="color: #800000;">${DB_HOST}</span> \
 <span style="color: #660033;">--databases</span> <span style="color: #800000;">${DB_NAME}</span> \
 <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">bzip2</span> <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #800000;">${BACKUP_DIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${DUMP_NAME}</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$?&quot;</span> <span style="color: #660033;">-ne</span> <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;failed!&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;done&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Creating tarball... &quot;</span>
<span style="color: #007800;">TAR_NAME</span>=<span style="color: #800000;">${BLOG_DIR##*/}</span>-$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>Y<span style="color: #000000; font-weight: bold;">%</span>m<span style="color: #000000; font-weight: bold;">%</span>d<span style="color: #7a0874; font-weight: bold;">&#41;</span>.tar.bz2
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-cjf</span> <span style="color: #800000;">${BACKUP_DIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${BLOG_DIR##*/}</span>-$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>Y<span style="color: #000000; font-weight: bold;">%</span>m<span style="color: #000000; font-weight: bold;">%</span>d<span style="color: #7a0874; font-weight: bold;">&#41;</span>.tar.bz2 <span style="color: #660033;">--exclude</span> cache <span style="color: #800000;">${BLOG_DIR}</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$?&quot;</span> <span style="color: #660033;">-ne</span> <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;failed!&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">2</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;done&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Uploading SQL dump and tarball to FTP... &quot;</span>
lftp <span style="color: #660033;">-u</span> <span style="color: #800000;">${FTP_USER}</span>,<span style="color: #800000;">${FTP_PASS}</span> <span style="color: #800000;">${FTP_HOST}</span> <span style="color: #cc0000; font-style: italic;">&lt;&lt;EOF
cd &quot;${FTP_BACKUP_DIR}&quot;
put &quot;${BACKUP_DIR}/${DUMP_NAME}&quot;
put &quot;${BACKUP_DIR}/${TAR_NAME}&quot;
&nbsp;
EOF</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$?&quot;</span> <span style="color: #660033;">-ne</span> <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;failed!&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">3</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;done&quot;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2010/02/28/improved-ftp-backup-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>&#8220;CC Yourself&#8221; and Spam</title>
		<link>http://www.guyrutenberg.com/2010/02/09/cc-yourself-and-spam/</link>
		<comments>http://www.guyrutenberg.com/2010/02/09/cc-yourself-and-spam/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 21:27:33 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Spam]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=624</guid>
		<description><![CDATA[Every good web programmer will note that the following contact form markup is probably flawed

&#60;form&#62;
...
    &#60;input type=&#34;hidden&#34; name=&#34;to&#34; value=&#34;support@example.com&#34; /&#62;
...
&#60;/form&#62;

as it is likely that if the value of the &#8220;to&#8221; field changes the message will be sent to the modified address. The problem with this kind of functionality is that it allows [...]]]></description>
			<content:encoded><![CDATA[<p>Every good web programmer will note that the following contact form markup is probably flawed</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;form&gt;
...
    &lt;input type=&quot;hidden&quot; name=&quot;to&quot; value=&quot;support@example.com&quot; /&gt;
...
&lt;/form&gt;</pre></div></div>

<p>as it is likely that if the value of the &#8220;to&#8221; field changes the message will be sent to the modified address. The problem with this kind of functionality is that it allows a malicious user to send emails from your mail server. More specifically,  it can allow spammers to user your benign server t send their spam (and as a side effect you might be flagged as a spammer yourself).</p>
<p>As this case is pretty obvious one doesn&#8217;t see many real-life uses of it anymore (but careless programmers used it more often n the past until they learned better). However one can achieve similar goals (spam-wise) by utilizing a common feature in contact forms: the &#8220;CC yourself&#8221; checkbox.<br />
<a href="http://www.guyrutenberg.com/wp-content/uploads/2010/02/contact_form.png"><img src="http://www.guyrutenberg.com/wp-content/uploads/2010/02/contact_form.png" alt="" title="CC Yourself" width="425" height="320" class="aligncenter size-full wp-image-632" /></a><br />
<span id="more-624"></span><br />
&#8220;CC yourself&#8221;  is a convention used by some people when mailing, to verify that the email was indeed sent. It had found a place in many contact forms, as people wanted a way to make sure the form indeed works. But contact forms (as well as some mail servers) don&#8217;t verify that the email provided as the &#8220;from&#8221; is indeed owned by whoever fills the form. Combine that with the fact that many contact forms don&#8217;t employ CAPTCHAs (to make the form simpler to use), and you&#8217;ll get a situation much like the one discussed above.</p>
<p>In the first case there was a usability advantage to the programmer (who could easily re-use the form&#8217;s backend for other forms), which can be easily sacrificed for enhanced security. This time it&#8217;s worse as this is a usability feature for the user, which many people believe to be very convinient in contact forms.</p>
<p>I think there are several solutions possible:</p>
<ol>
<li>Adding CAPTCHA to the form. This will make life for the spammers harder, but it also hurt the users by raising the bar for filling out the form. Also, nowadays, it getting harder and harder to find a strong yet easy for humans CAPTCHA.</li>
<li>Removing the &#8220;CC yourself&#8221; feature. this hurts the usability of the contact form.</li>
<li>Seperating verified users and unverified. Keeping the feature for registered users, but at the same time, removing it or adding CAPTCHA for unverified users. This seems like a good trade-off, but it requires more work and registration is not applicable for all websites.</li>
</ol>
<p>In my opinion none of the solutions is perfect. It seems that once again spammers hurt the user experience for everybody else in order to fill our inboxes with unsolicited email.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2010/02/09/cc-yourself-and-spam/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using MusicBrainz when Ripping CDs in KDE</title>
		<link>http://www.guyrutenberg.com/2010/01/09/using-musicbrainz-when-ripping-cds-in-kde/</link>
		<comments>http://www.guyrutenberg.com/2010/01/09/using-musicbrainz-when-ripping-cds-in-kde/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 08:37:29 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[KDE]]></category>
		<category><![CDATA[MusicBrainz]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=610</guid>
		<description><![CDATA[I guess this tip is Gentoo specific. By default KDE uses FreeDB for getting CD info when ripping CDs. If you want to use MusicBrainz native service (not via their FreeDB proxy), there are several steps you&#8217;ll need to take.

First, you should compile kde-base/libkcddb with the musicbrainz use-flag turned on. Next you should go to [...]]]></description>
			<content:encoded><![CDATA[<p>I guess this tip is Gentoo specific. By default KDE uses FreeDB for getting CD info when ripping CDs. If you want to use MusicBrainz native service (not via their FreeDB proxy), there are several steps you&#8217;ll need to take.<br />
<span id="more-610"></span><br />
First, you should compile <code>kde-base/libkcddb</code> with the <code>musicbrainz</code> use-flag turned on. Next you should go to System Settings->Advanced->CDDB Retrieval and check the &#8220;Enable MusicBrainz lookup&#8221; box. From my experience MusicBrainz is not a complete replacement for FreeDB as some CDs aren&#8217;t recognized by it (but recognized by FreeDB). </p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2010/01/09/using-musicbrainz-when-ripping-cds-in-kde/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disable Touchpad Tapping in Kubuntu</title>
		<link>http://www.guyrutenberg.com/2010/01/08/disable-touchpad-tapping-in-kubuntu/</link>
		<comments>http://www.guyrutenberg.com/2010/01/08/disable-touchpad-tapping-in-kubuntu/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 21:13:50 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[KDE]]></category>
		<category><![CDATA[TouchPad]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=611</guid>
		<description><![CDATA[In Ubuntu (gnome) there is an easy graphical way to disable tapping on the touchpad. However, KDE lacks such thing. But lacking graphical configuration doesn&#8217;t mean this should be difficult. All you need is the gsynaptics package. The package provides a small utility called synclient. Now you can disable tapping by doing

 synclient TapButton1=0

To disable [...]]]></description>
			<content:encoded><![CDATA[<p>In Ubuntu (gnome) there is an easy graphical way to disable tapping on the touchpad. However, KDE lacks such thing. But lacking graphical configuration doesn&#8217;t mean this should be difficult. All you need is the <code>gsynaptics</code> package. The package provides a small utility called <code>synclient</code>. Now you can disable tapping by doing</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"> synclient TapButton1=0</pre></div></div>

<p>To disable the tapping permanently you should use the following to run the command at the start of every KDE session.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">echo &quot;synclient TapButton1=0&quot; &gt; ~/.kde/env/disable-tapping.sh</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2010/01/08/disable-touchpad-tapping-in-kubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Duplicity and Amazon S3 &#8211; Notes and Examples</title>
		<link>http://www.guyrutenberg.com/2009/12/12/using-duplicity-and-amazon-s3-notes-and-examples/</link>
		<comments>http://www.guyrutenberg.com/2009/12/12/using-duplicity-and-amazon-s3-notes-and-examples/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 10:00:14 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Amazon AWS]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[duplicity]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=603</guid>
		<description><![CDATA[Up until now I&#8217;ve been doing my backups to Amazon S3 using my s3backup script. While it&#8217;s simple and does what I needed at the time, I&#8217;ve decided to cut some of the costs by switching to incremental backups.

I went on to define what I&#8217;m looking for, and after a short search I&#8217;ve came up [...]]]></description>
			<content:encoded><![CDATA[<p>Up until now I&#8217;ve been doing my backups to Amazon S3 using my <a href="/2008/10/21/s3backup-easy-backups-of-folders-to-amazon-s3/"><code>s3backup</code></a> script. While it&#8217;s simple and does what I needed at the time, I&#8217;ve decided to cut some of the costs by switching to incremental backups.<br />
<span id="more-603"></span><br />
I went on to define what I&#8217;m looking for, and after a short search I&#8217;ve came up with <a href="http://duplicity.nongnu.org/">duplicity</a> which support efficient incremental backups to Amazon S3 (among many other backends). While duplicity has an simple CLI interface, I did come across two pitfalls when using S3.</p>
<p>The first one is that one must export the <code>AWS_ACCESS_KEY_ID</code> and <code>AWS_SECRET_ACCESS_KEY</code> or else you get a error message from the underlying <code>boto</code> library:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">  File &quot;//usr/lib64/python2.5/site-packages/boto/connection.py&quot;, line 148, in __init__
    self.hmac = hmac.new(self.aws_secret_access_key, digestmod=sha)
AttributeError: S3Connection instance has no attribute 'aws_secret_access_key'</pre></div></div>

<p>The second thing to note is that is the way to specify buckets for <code>duplicity</code>. Instead of</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">s3://&lt;bucket-name&gt;/&lt;prefix&gt;</pre></div></div>

<p>which is used by <a href="http://s3tools.logix.cz/s3cmd"><code>s3cmd</code></a> (which is a great tool), it asks to specify it using</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">s3+http://&lt;bucket-name&gt;/&lt;prefix&gt;</pre></div></div>

<p>Being aware of these points can save some time and frustration. In order to automate the backup process one can use <code>cron</code>. For example add the following to your <code>crontab</code></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">AWS_ACCESS_KEY_ID=&quot;&lt;your-key-id&gt;&quot;
AWS_SECRET_ACCESS_KEY=&quot;&lt;your-secret-access-key&gt;&quot;
0 1 * * 0  duplicity --no-encryption &lt;folder-to-backup&gt; s3+http://&lt;bucket-name&gt;/&lt;prefix&gt; &amp;&gt;&gt; ~/backups.log
AWS_ACCESS_KEY_ID=&quot;&quot;
AWS_SECRET_ACCESS_KEY=&quot;&quot;</pre></div></div>

<p>I unset the environment variables, so it won&#8217;t leak to other cron jobs unnecessarily. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2009/12/12/using-duplicity-and-amazon-s3-notes-and-examples/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading All QT Modules in Gentoo</title>
		<link>http://www.guyrutenberg.com/2009/11/21/upgrading-all-qt-modules-in-gentoo/</link>
		<comments>http://www.guyrutenberg.com/2009/11/21/upgrading-all-qt-modules-in-gentoo/#comments</comments>
		<pubDate>Sat, 21 Nov 2009 20:01:06 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[QT]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=594</guid>
		<description><![CDATA[Upgrading minor versions QT seems to be a hassle, as each version blocks the previous and because of inter-dependencies, Gentoo can&#8217;t understand by itself how to solve them. The solution is to tell it to specifically upgrade all installed modules.


sudo emerge -avu1 $&#40;qlist -IvC /qt- &#124; grep 4. &#124; sed s/-4.*//&#41;

This will allow Gentoo to [...]]]></description>
			<content:encoded><![CDATA[<p>Upgrading minor versions QT seems to be a hassle, as each version blocks the previous and because of inter-dependencies, Gentoo can&#8217;t understand by itself how to solve them. The solution is to tell it to specifically upgrade all installed modules.<br />
<span id="more-594"></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> emerge <span style="color: #660033;">-avu1</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span>qlist <span style="color: #660033;">-IvC</span> <span style="color: #000000; font-weight: bold;">/</span>qt- <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> 4. <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> s<span style="color: #000000; font-weight: bold;">/</span>-4.<span style="color: #000000; font-weight: bold;">*//</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>This will allow Gentoo to solve the dependencies by uninstalling the old versions, unlike if you only try to upgrade a single package like <code>x11-libs/qt-core</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2009/11/21/upgrading-all-qt-modules-in-gentoo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NVidia driver fails to initialize after X restart</title>
		<link>http://www.guyrutenberg.com/2009/11/14/nvidia-driver-fails-to-initialize-after-x-restart/</link>
		<comments>http://www.guyrutenberg.com/2009/11/14/nvidia-driver-fails-to-initialize-after-x-restart/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 15:19:14 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Errors]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=589</guid>
		<description><![CDATA[This is mainly a note to myself. Sometimes when the X server is restart it complains that nvidia driver couldn&#8217;t be initialized and that no screens were found. This may be a result of a version mismatch between X11&#8217;s and the kernel&#8217;s nvidia module. The solution is to

modprobe -r nvidia

before restarting the X server.
]]></description>
			<content:encoded><![CDATA[<p>This is mainly a note to myself. Sometimes when the X server is restart it complains that <code>nvidia</code> driver couldn&#8217;t be initialized and that no screens were found. This may be a result of a version mismatch between X11&#8217;s and the kernel&#8217;s <code>nvidia</code> module. The solution is to</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">modprobe -r nvidia</pre></div></div>

<p>before restarting the X server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2009/11/14/nvidia-driver-fails-to-initialize-after-x-restart/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Blocking IP Range using UFW</title>
		<link>http://www.guyrutenberg.com/2009/11/07/blocking-ip-range-using-ufw/</link>
		<comments>http://www.guyrutenberg.com/2009/11/07/blocking-ip-range-using-ufw/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 19:19:15 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[ufw]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=584</guid>
		<description><![CDATA[Uncomplicated Firewall (ufw) is one of the greatest frontends to IPTables I&#8217;ve encountered. It is very simple to use and I just wish it was also available for Gentoo. Up until recently everything went smoothly for me and ufw, but we hit some rough waters when I&#8217;ve tried to block an IP range.
To block an [...]]]></description>
			<content:encoded><![CDATA[<p><a href="https://launchpad.net/ufw">Uncomplicated Firewall</a> (<code>ufw</code>) is one of the greatest frontends to IPTables I&#8217;ve encountered. It is very simple to use and I just wish it was also available for Gentoo. Up until recently everything went smoothly for me and <code>ufw</code>, but we hit some rough waters when I&#8217;ve tried to block an IP range.</p>
<p>To block an ip or I&#8217;p range in ufw you should do</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">sudo ufw deny from 188.162.67.197/21</pre></div></div>

<p><span id="more-584"></span></p>
<p>But here is the catch. Only the recent versions of <code>ufw</code> (which the version that comes with Ubuntu 8.04 isn&#8217;t one of them) support inserting new rules. When you add a rule it gets appended. So if you had a rule before that allows everyone to connect to your server on port 80, it also allows the IP range you&#8217;re trying to block, to connect to your machine.</p>
<p>As it&#8217;s impossible to foresee all the rules you might use, one has to resort to deleting all the rules he has to override, then re-add them so they will be after the rule that blocks the IP range. However I disliked the idea and looked for a simpler solution.</p>
<p>The easiest method I&#8217;ve found was to manully edit <code>ufw</code>&#8217;s configurations:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">sudo vim /var/lib/ufw/user.rules</pre></div></div>

<p>And then move the rule I&#8217;ve added, which looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">### tuple ### deny any any 0.0.0.0/0 any 188.162.67.197/21
-A ufw-user-input -s 188.162.67.197/21 -j DROP</pre></div></div>

<p>above any other rules in the configuration file.</p>
<p>Afterward, you&#8217;ll have to restart <code>ufw</code> so it will reload its configurations.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">sudo ufw disable
sudo ufw enable</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2009/11/07/blocking-ip-range-using-ufw/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An Early Release of the New cssrtl.py-2.0</title>
		<link>http://www.guyrutenberg.com/2009/09/20/an-early-release-of-the-new-cssrtl-py-2-0/</link>
		<comments>http://www.guyrutenberg.com/2009/09/20/an-early-release-of-the-new-cssrtl-py-2-0/#comments</comments>
		<pubDate>Sun, 20 Sep 2009 10:00:50 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[cssrtl.py]]></category>
		<category><![CDATA[RTL]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=578</guid>
		<description><![CDATA[It has been three years since I&#8217;ve released the ]]></description>
			<content:encoded><![CDATA[<p>It has been three years since I&#8217;ve released the <a href=/2007/12/28/convert-css-layout-to-rtl-cssrtlpy/">original version</a> of <code>cssrtl.py</code> (and two since it&#8217;s re-release). The old version did a nice job, but experience gained during that time led me to write from scratch a new version. I&#8217;ve detailed more than a month ago, the <a href="/2009/08/05/designing-a-better-a-css-rtl-convertor/">basic principles and ideas</a> that guided me to design a better tool to help adapting CSS files from left-to-right to right-to-left.</p>
<p>The guidelines weren&#8217;t just empty words, they were written while working on the <a href="/2009/08/15/rtl-and-hebrew-adaptation-of-the-fusion-wordpress-theme/">Hebrew adaptation to the Fusion theme</a> and in the same time writing a new proof-of-concept version of <code>cssrtl.py</code>. The original intent was to release a more mature version of that code when it will be completed. However, due to the apparent shortage of time in the present and foreseeable future, I can&#8217;t see myself complete the project any time soon. So following the &#8220;release early&#8221; mantra, I&#8217;ve decided to release the code as-is. As I said, the code is in working state, but not polished, so it may be of benefit but may contain bugs. If you find any bugs or have any suggestions, I would be glad to hear.<br />
<span id="more-578"></span></p>
<h3>Download</h3>
<p>You can download the new version from here: <a href="/wp-content/uploads/2009/09/cssrtl.py-2.0.tar.bz2">cssrtl.py-2.0.tar.bz2</a>. The code is available under the GPLv2 or any later version.</p>
<h3>Usage</h3>
<p>The new version works by creating a seperate css &#8220;fix&#8221; file that fixes the directionality of the css styles.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">./cssrtl.py &lt; main.css &gt; main-rtl.css</pre></div></div>

<p>Afterward, just link the <code>main-rtl.css</code> after <code>main.css</code> in your HTML files.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2009/09/20/an-early-release-of-the-new-cssrtl-py-2-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple AI Engine for the Oware Game</title>
		<link>http://www.guyrutenberg.com/2009/08/19/simple-ai-engine-for-the-oware-game/</link>
		<comments>http://www.guyrutenberg.com/2009/08/19/simple-ai-engine-for-the-oware-game/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 10:54:28 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[oware]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=568</guid>
		<description><![CDATA[Sometime ago I worked with a friend on building an Oware game. I was supposed to build the AI engine, and he was supposed to build the user interface to it. Unfortunately, while AI engine interface I designed and a simple alpha-beta pruning engine was implemented, the project was never completed.

Instead of letting the project [...]]]></description>
			<content:encoded><![CDATA[<p>Sometime ago I worked with a friend on building an <a href="http://en.wikipedia.org/wiki/Oware">Oware</a> <a href="http://www.wikimanqala.org/wiki/Oware">game</a>. I was supposed to build the AI engine, and he was supposed to build the user interface to it. Unfortunately, while AI engine interface I designed and a simple alpha-beta pruning engine was implemented, the project was never completed.</p>
<div id="attachment_569" class="wp-caption alignnone" style="width: 672px"><img src="http://www.guyrutenberg.com/wp-content/uploads/2009/08/oware-screenshot.png" alt="Screenshot of game session" title="oware-screenshot" width="662" height="412" class="size-full wp-image-569" /><p class="wp-caption-text">Screenshot of game session</p></div>
<p><span id="more-568"></span><br />
Instead of letting the project just sit and wait until it will be redeemed and completed I&#8217;ve decided to release my code. It consists of a simple terminal user-interface and an AI opponent. Compiling is straight forward and doesn&#8217;t require any special libraries. You can obtain the code from here: <a href="/wp-content/uploads/2009/09/oware-0.1.tar.bz2">oware-0.1.tar.bz2</a> [15.1 KB].</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">tar xvf ./oware-0.1.tar.bz2
cd oware
g++ main.cpp ai/basic_ai_engine.cpp -o oware</pre></div></div>

<p>Running the program is pretty simple, just type <code>./oware</code>. You will be prompted to select the level of the AI opponent. The higher the number the slower and better the opponent will play. I suggest starting pretty low, and climbing up untill you find it challenging. The houses (holes) are numbered from 0 to 11 starting with the bottom left hole (yours) and going counter-clockwise. </p>
<p>The game is licensed under the GPLv2 or any latter version, so fill free to hack and improve the game if you have time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2009/08/19/simple-ai-engine-for-the-oware-game/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.837 seconds -->
