<?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 &#187; Tips</title>
	<atom:link href="http://www.guyrutenberg.com/category/tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.guyrutenberg.com</link>
	<description>Keeping track of what I do</description>
	<lastBuildDate>Wed, 16 Jun 2010 19:53:40 +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>Deleting Comments from Tickets in Trac</title>
		<link>http://www.guyrutenberg.com/2010/05/19/deleting-comments-from-tickets-in-trac/</link>
		<comments>http://www.guyrutenberg.com/2010/05/19/deleting-comments-from-tickets-in-trac/#comments</comments>
		<pubDate>Wed, 19 May 2010 12:42:06 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Trac]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=684</guid>
		<description><![CDATA[Spammers apparently love Trac. After trying to fighting spam tickets and later installing the SpamFilter plugin, I&#8217;ve managed to control spam tickets in the Open Yahtzee Trac site.. But now spammers started spamming in the ticket comments. The bad news is that Trac (at least in version 0.11) doesn&#8217;t have built-in facilities to completely remove [...]]]></description>
			<content:encoded><![CDATA[<p>Spammers apparently love Trac. After trying to fighting spam <a href="/2009/01/08/deleting-a-range-of-tickets-in-trac/">tickets</a> and later installing the SpamFilter plugin, I&#8217;ve managed to control spam tickets in the <a href="http://www.openyahtzee.org">Open Yahtzee</a> Trac site.. But now spammers started spamming in the ticket comments. The bad news is that Trac (at least in version 0.11) doesn&#8217;t have built-in facilities to completely remove ticket comments.</p>
<p><a href="http://www.guyrutenberg.com/wp-content/uploads/2010/05/trac-comment.png"><img src="http://www.guyrutenberg.com/wp-content/uploads/2010/05/trac-comment.png" alt="" title="trac-comment" width="509" height="311" class="aligncenter size-full wp-image-688" /></a><br />
<span id="more-684"></span><br />
The solution is to directly delete them from Trac&#8217;s SQLite backend. There are several type of comments: Plain ones and comments that describe a change to the ticket&#8217;s properties. I&#8217;ll deal with only the plain comments, but the methods I describe should also be applicable to the other kinds.</p>
<p>First things you should note down the ticket number and the comment number. The comment number appears in the URL of the permalink to it. It is the number that is pointed by an arrow in the screenshot above, it will be displayed when you hover over the circled link. Now in the shell, <code>cd</code> to the <code>db</code> directory of you trac installation and do:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">sqlite3 trac.db &quot;delete from ticket_change where ticket=&lt;TICKET NUM&gt; and field='comment' and oldvalue=&lt;COMMENT NUM&gt;&quot;</pre></div></div>

<p>For example for the ticket in the screenshot:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">sqlite3 trac.db &quot;delete from ticket_change where ticket=12 and field='comment' and oldvalue=3&quot;</pre></div></div>

<p>You can delete different kinds of tickets by using other values in the <code>field</code> column, such as <code>keywords</code> and <code>summary</code>. Another useful column is the <code>author</code> column.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2010/05/19/deleting-comments-from-tickets-in-trac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>URL-Safe Timestamps using Base64</title>
		<link>http://www.guyrutenberg.com/2010/04/30/url-safe-timestamps-using-base64/</link>
		<comments>http://www.guyrutenberg.com/2010/04/30/url-safe-timestamps-using-base64/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 17:08:56 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=667</guid>
		<description><![CDATA[Passing around timestamps in URLs is a common task. We usually want our URLs to be as shortest as possible. I&#8217;ve found using Base64 to result in the shortest URL-safe representation, just 6 chars. This compares with the 12 chars of the naive way, and 8 chars when using hex representation.
The following Python functions allow [...]]]></description>
			<content:encoded><![CDATA[<p>Passing around timestamps in URLs is a common task. We usually want our URLs to be as shortest as possible. I&#8217;ve found using Base64 to result in the shortest URL-safe representation, just 6 chars. This compares with the 12 chars of the naive way, and 8 chars when using hex representation.</p>
<p>The following Python functions allow you to build and read these 6 chars URL-safe timestamps:<br />
<span id="more-667"></span></p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">base64</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">struct</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">time</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> build_timestamp<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">&quot;&quot;&quot;
    Return a 6 chars url-safe timestamp
    &quot;&quot;&quot;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #dc143c;">base64</span>.<span style="color: black;">urlsafe_b64encode</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">struct</span>.<span style="color: black;">pack</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;!L&quot;</span>,<span style="color: #008000;">int</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">time</span>.<span style="color: #dc143c;">time</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span>:-<span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> read_timestamp<span style="color: black;">&#40;</span>t<span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">&quot;&quot;&quot;
    Convert a 6 chars url-safe timestamp back to time
    &quot;&quot;&quot;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #dc143c;">struct</span>.<span style="color: black;">unpack</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;!L&quot;</span>,<span style="color: #dc143c;">base64</span>.<span style="color: black;">urlsafe_b64decode</span><span style="color: black;">&#40;</span>t+<span style="color: #483d8b;">&quot;==&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span></pre></div></div>

<p>These functions work by translating the timestamp into a 4-byte binary form and then encoding it using a URL-safe version of Base64. And finally we strip the padding, which is neither URL-safe nor necessary (as we know the size of the encoded data).</p>
<p>The result looks something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">In [72]: build_timestamp()
Out[72]: 'S9sNOQ'</pre></div></div>

<p>We got a timestamp in using only 6 URL-safe chars.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2010/04/30/url-safe-timestamps-using-base64/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>1</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>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>\lyxframeend Undefined when Using Beamer with Lyx</title>
		<link>http://www.guyrutenberg.com/2009/07/22/lyxframeend-undefined-when-using-beamer-with-lyx/</link>
		<comments>http://www.guyrutenberg.com/2009/07/22/lyxframeend-undefined-when-using-beamer-with-lyx/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 14:40:14 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Beamer]]></category>
		<category><![CDATA[Errors]]></category>
		<category><![CDATA[LyX]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=411</guid>
		<description><![CDATA[I&#8217;m using LyX for the first time with Beamer. Making the title page was smooth. But when I&#8217;ve tried adding a new frame (using BeginFrame) I was confronted with the following error

 \lyxframeend
                 {}\lyxframe{Outline}
The control sequence at the end [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m using LyX for the first time with Beamer. Making the title page was smooth. But when I&#8217;ve tried adding a new frame (using BeginFrame) I was confronted with the following error</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"> \lyxframeend
                 {}\lyxframe{Outline}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.</pre></div></div>

<p>After comparing my document to example (working) beamer documents I&#8217;ve found out that you must have an EndFrame command after your last frame.Too bad it wasn&#8217;t documented anywhere I&#8217;ve found as this little thing drove me crazy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2009/07/22/lyxframeend-undefined-when-using-beamer-with-lyx/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Using Amarok Generated Playlists (m3u) on Sansa Clip</title>
		<link>http://www.guyrutenberg.com/2009/07/11/using-amarok-generated-playlists-m3u-on-sansa-clip/</link>
		<comments>http://www.guyrutenberg.com/2009/07/11/using-amarok-generated-playlists-m3u-on-sansa-clip/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 18:23:39 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Amarok]]></category>
		<category><![CDATA[Sansa Clip]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=405</guid>
		<description><![CDATA[Few days ago, for the first time, I&#8217;ve created a playlist using Amarok for files on my Sansa Clip player. To my surprise (and disappointment) when I&#8217;ve unplugged my Sansa Clip and powered it, the playlist showed up empty, unlike playlists which originated in Windows. As I keep my music collection organized in Amarok, the [...]]]></description>
			<content:encoded><![CDATA[<p>Few days ago, for the first time, I&#8217;ve created a playlist using Amarok for files on my Sansa Clip player. To my surprise (and disappointment) when I&#8217;ve unplugged my Sansa Clip and powered it, the playlist showed up empty, unlike playlists which originated in Windows. As I keep my music collection organized in Amarok, the situation seemed to be very uncomfortable.</p>
<p>I&#8217;ve decided to compare one of the working playlist files and the &#8220;empty&#8221; Amarok generated playlist. Two things were noticeable:</p>
<ol>
<li>Amarok uses forward slashes, like in a Linux environment, and the working playlist used backward slashes.</li>
<li>The working playlist used relative paths without any prefix &#8211; directly beginning with the path. Amarok prefixed the relative paths with a dot-slash (./).</li>
</ol>
<p>After noticing those things I&#8217;ve modified my Amarok generated playlist to look like the Windows generated one, and voila, it worked. I tried going through Amarok&#8217;s configuration dialogs to find some option controlling the format of generated m3u playlists, but couldn&#8217;t find any (I&#8217;m using Amarok 1.4.10). So with my newly found wits I&#8217;ve looked for a way to make using the playlists easier. I&#8217;ve came up with the following one-liner:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;*.m3u&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> -I<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">&quot;s/^\.\///;s/\//\\\\/g&quot;</span> <span style="color: #660033;">-i</span><span style="color: #ff0000;">''</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>The command should be run in the <code>MUSIC</code> directory of the Sansa Clip&#8217;s filesystem. It recursivey looks for m3u playlists and for each one strips any leading dot-slash and replaces forward slashes with backward ones. It can be used to easily convert all your playlists to the format understandable by Sansa Clip.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2009/07/11/using-amarok-generated-playlists-m3u-on-sansa-clip/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Emulating Kav-Mafrid (em-dash) for the David Font</title>
		<link>http://www.guyrutenberg.com/2009/07/11/emulating-kav-mafrid-em-dash-for-the-david-font/</link>
		<comments>http://www.guyrutenberg.com/2009/07/11/emulating-kav-mafrid-em-dash-for-the-david-font/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 06:37:09 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[culmus-latex]]></category>
		<category><![CDATA[Hebrew]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=395</guid>
		<description><![CDATA[The David font that is used in Culmus-LaTeX lacks support of Kav-Mafrid, the ligature that is created by two consecutive dashes, --. Because the regular Hebrew dash, Maqaf, is position near the top of the line, one can&#8217;t use it instead of the Kav-Mafrid and expect a graphically pleasant result (while Kav-Mafrid can replace Maqaf [...]]]></description>
			<content:encoded><![CDATA[<p>The David font that is used in <a href="/culmus-latex">Culmus-LaTeX</a> lacks support of Kav-Mafrid, the ligature that is created by two consecutive dashes, <code>--</code>. Because the regular Hebrew dash, Maqaf, is position near the top of the line, one can&#8217;t use it instead of the Kav-Mafrid and expect a graphically pleasant result (while Kav-Mafrid can replace Maqaf and the text would still look ok). To make things even more problematic, this ligature is supported by Culmus-LaTeX&#8217;s default font, Frank Ruehl, which means one can&#8217;t easily switch fonts without hurting the layout.<br />
<span id="more-395"></span></p>
<p>At first, I&#8217;ve tried to use the English dash and en-dash but result weren&#8217;t satisfactory. Both of them were too light and positioned too low to be used in an Hebrew text written in the Culmus fonts (see screenshot).</p>
<p>So finally, I&#8217;ve decided to write a simple macro to emulate a Kav-Mafrid for the David font.</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\newcommand</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\dd</span></span><span style="color: #E02020; ">}{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\lower</span>0.17em<span style="color: #800000; font-weight: normal;">\hbox</span><span style="color: #E02020; ">{</span>-<span style="color: #800000; font-weight: normal;">\kern</span>-0.13em-</span><span style="color: #E02020; ">}}</span></pre></div></div>

<p>The command works by kerning two Hebrew, Maqaf&#8217;s, together (with a slight overlap to adjust width), and lowering their position to the middle of the line.</p>
<p>In the following screensot the first line features the Frank Ruehl font and it\&#8217;s Maqaf and Kav-Mafrid. The second line featured the david font with a Maqaf and the missing Kav-Mafrid ligature. The third line features the David font with English dash and en-dash. The last line uses David with the regular Maqaf and the <code>\dd{}</code> macro.<br />
<div id="attachment_397" class="wp-caption alignnone" style="width: 208px"><img src="http://www.guyrutenberg.com/wp-content/uploads/2009/07/dash-example.png" alt="Different dash examples" title="dash-example" width="198" height="232" class="size-full wp-image-397" /><p class="wp-caption-text">Different dash examples</p></div></p>
<p>As it can be seen, the <code>\dd{}</code> macro does provide a good alternative for the Kav-Mafrid. However this solution isn&#8217;t perfect. One can improve the macro by detecting if the Kav-Mafrid ligature is present in the current font and if so, use it instead of the kerned one. This would enable one to use the macro and safely switch fonts, knowing he will always get the best Kav-Mafrid possible.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2009/07/11/emulating-kav-mafrid-em-dash-for-the-david-font/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Algorithm Float Label for Hebrew Document</title>
		<link>http://www.guyrutenberg.com/2009/06/18/algorithm-float-label-for-hebrew-document/</link>
		<comments>http://www.guyrutenberg.com/2009/06/18/algorithm-float-label-for-hebrew-document/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 16:00:12 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Hebrew]]></category>
		<category><![CDATA[LyX]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=379</guid>
		<description><![CDATA[For a while now I&#8217;ve refrained from using the very nice Algorithm environment for LaTeX papers I wrote in Hebrew due to the way it&#8217;s label was displayed. The English label was displayed in reverse.


For sometime before letting go of the issue, I&#8217;ve tried to correct the direction of the label. It could have been [...]]]></description>
			<content:encoded><![CDATA[<p>For a while now I&#8217;ve refrained from using the very nice Algorithm environment for LaTeX papers I wrote in Hebrew due to the way it&#8217;s label was displayed. The English label was displayed in reverse.</p>
<p><img src="http://www.guyrutenberg.com/wp-content/uploads/2009/06/algorithm-before.png" alt="algorithm-before" title="algorithm-before" width="230" height="150" class="aligncenter size-full wp-image-380" /><br />
<span id="more-379"></span><br />
For sometime before letting go of the issue, I&#8217;ve tried to correct the direction of the label. It could have been fixed by marking the float as English text in LyX (I use it for editing Hebrew papers, as it makes editing multi-lingual texts easy), effectively adding <code>\selectlanguage{english}</code> before the <code>\begin{algorithm}</code> line. However, it resulted in display mess in LyX and some LaTeX errors when compiling (also it seemed LaTeX could complete the first pass).</p>
<p>Today, I&#8217;ve decided to tackle and solve the problem for a new paper I&#8217;m writing. After searching a bit for a way to override the Algorithm environment label, I&#8217;ve found a general way to override a float label in LaTeX:</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\floatname</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">floatname</span><span style="color: #E02020; ">}{</span><span style="color: #2020C0; font-weight: normal;">floatlabel</span><span style="color: #E02020; ">}</span></pre></div></div>

<p>So for our case it would look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\floatname</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">algorithm</span><span style="color: #E02020; ">}{</span><span style="color: #2020C0; font-weight: normal;">אלגוריתם</span><span style="color: #E02020; ">}</span></pre></div></div>

<p>You should put it in your LaTeX preamble (Documents->Settings in LyX). This neatly fixes the problem (see screenshot below).</p>
<p><img src="http://www.guyrutenberg.com/wp-content/uploads/2009/06/algorithm-after.png" alt="algorithm-after" title="algorithm-after" width="303" height="163" class="aligncenter size-full wp-image-381" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2009/06/18/algorithm-float-label-for-hebrew-document/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

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