<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/alex-2012.css" ?>
<rss version="2.0"
    xmlns:wiki="http://purl.org/rss/1.0/modules/wiki/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:cc="http://web.resource.org/cc/"
    xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<title>Alex Schroeder: Software</title>
<link>http://alexschroeder.ch/wiki/Diary</link>
<atom:link href="http://www.google.com/profiles/kensanata" rel="me" type="text/html" />
<atom:link href="http://alexschroeder.ch/wiki?action=rss;full=1" rel="self" type="application/rss+xml" />
<description>The Homepage of Alex Schroeder.</description>
<pubDate>Wed, 22 May 2013 20:51:55 GMT</pubDate>
<lastBuildDate>Wed, 22 May 2013 20:51:55 GMT</lastBuildDate>
<generator>Oddmuse</generator>
<copyright>Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation.</copyright>
<cc:license>http://www.gnu.org/copyleft/fdl.html</cc:license>
<image>
<url>http://alexschroeder.ch/pics/alex.png</url>
<title>Alex Schroeder: Software</title>
<link>http://alexschroeder.ch/wiki</link>
</image>

<item>
<title>WMA to MP3</title>
<link>http://alexschroeder.ch/wiki/2013-05-07_WMA_to_MP3</link>
<guid>http://alexschroeder.ch/wiki/2013-05-07_WMA_to_MP3</guid>
<description>&lt;p&gt;This is based on &lt;a class="url http outside" href="http://www.wikihow.com/Convert-Unprotected-WMA-Files-Into-MP3-Files"&gt;How to Convert Unprotected WMA Files Into MP3 Files&lt;/a&gt;. I&amp;#x2019;m leaving the instructions here for my future self. &lt;img class="smiley" src="http://www.emacswiki.org/pics/smile.png" alt=":)" /&gt;&lt;/p&gt;&lt;pre class="real"&gt;for file in *.wma; do
  mplayer -vo null -vc dummy -af resample=44100 \
    -ao pcm:file="${file%%.[Ww][Mm][Aa]}.wav" "$file"
  lame --preset standard "${file%%.[Ww][Mm][Aa]}.wav" \
    "${file%%.[Ww][Mm][Aa]}.mp3"
done &lt;/pre&gt;&lt;p&gt;Use &lt;code&gt;locate lame|grep 'lame$'&lt;/code&gt; and &lt;code&gt;locate mplayer|grep 'mplayer$'&lt;/code&gt; to find the location of your executables. On a Mac, they&amp;#x2019;re probably not on your PATH&amp;#x2026; I installed &lt;b&gt;MPlayer OSX&lt;/b&gt; and &lt;b&gt;iTunes-LAME&lt;/b&gt; to get the executables. You&amp;#x2019;ll need to do something similar.&lt;/p&gt;&lt;p&gt;This is the result I just used for some files with upper case file extension:&lt;/p&gt;&lt;pre class="real"&gt;for file in *.WMA; do
  "/Applications/MPlayer OSX.app/Contents/Resources/External_Binaries/mplayer_intel.app/Contents/MacOS/mplayer" \
    -vo null -vc dummy -af resample=44100 \
    -ao pcm:file="${file%%.[Ww][Mm][Aa]}.wav" "$file"
  "/Applications/iTunes-LAME.app/Contents/Resources/lame" \
    --preset standard "${file%%.[Ww][Mm][Aa]}.wav" \
    "${file%%.[Ww][Mm][Aa]}.mp3"
done &lt;/pre&gt;&lt;p&gt;Tags: &lt;a class="outside tag" title="Tag" rel="tag" href="http://alexschroeder.ch/wiki?action=tag;id=Mac"&gt;Mac&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/Mac"&gt;&lt;img src="http://alexschroeder.ch/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt; &lt;a class="outside tag" title="Tag" rel="tag" href="http://alexschroeder.ch/wiki?action=tag;id=Music"&gt;Music&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/Music"&gt;&lt;img src="http://alexschroeder.ch/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt; &lt;a class="outside tag" title="Tag" rel="tag" href="http://alexschroeder.ch/wiki?action=tag;id=Software"&gt;Software&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/Software"&gt;&lt;img src="http://alexschroeder.ch/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt;&lt;/p&gt;</description>
<pubDate>Tue, 07 May 2013 18:11:56 GMT</pubDate>
<comments>http://alexschroeder.ch/wiki/Comments_on_2013-05-07_WMA_to_MP3</comments>
<dc:contributor>AlexSchroeder</dc:contributor>
<wiki:status>new</wiki:status>
<wiki:importance>major</wiki:importance>
<wiki:version>1</wiki:version>
<wiki:history>http://alexschroeder.ch/wiki?action=history;id=2013-05-07_WMA_to_MP3</wiki:history>
<wiki:diff>http://alexschroeder.ch/wiki?action=browse;diff=1;id=2013-05-07_WMA_to_MP3</wiki:diff>
<category>Mac</category>
<category>Music</category>
<category>Software</category>
</item>

<item>
<title>Text Mapper Progress</title>
<link>http://alexschroeder.ch/wiki/2013-03-01_Text_Mapper_Progress</link>
<guid>http://alexschroeder.ch/wiki/2013-03-01_Text_Mapper_Progress</guid>
<description>&lt;p&gt;I&amp;#x2019;m a big fan of the &lt;a class="local" href="http://alexschroeder.ch/wiki/2012-05-15_The_Forgotten_Depths"&gt;Forgotten Depths&lt;/a&gt;. I wanted to use its map as the goal for my &lt;a class="url http outside" href="http://alexschroeder.ch/wiki/2013-02-26_Text_Mapper"&gt;Text Mapper&lt;/a&gt;. As the mapper now allows the inclusion of other files, I&amp;#x2019;ve saved my library of colors and icons as &lt;a class="url http outside" href="http://alexschroeder.ch/contrib/default.txt"&gt;default.txt&lt;/a&gt; and I&amp;#x2019;ve saved the map as &lt;a class="url http outside" href="http://alexschroeder.ch/contrib/forgotten-depths.txt"&gt;forgotten-depths.txt&lt;/a&gt;. That&amp;#x2019;s why all you need to do now is include the map:&lt;/p&gt;&lt;p&gt;&lt;a class="image outside" href="http://alexschroeder.ch/text-mapper?map=include+http%3A%2F%2Falexschroeder.ch%2Fcontrib%2Fforgotten-depths.txt%0D%0A%0D%0A"&gt;&lt;img class="upload" title="Forgotten Depths SVG" src="http://alexschroeder.ch/text-mapper?map=include+http%3A%2F%2Falexschroeder.ch%2Fcontrib%2Fforgotten-depths.txt%0D%0A%0D%0A" alt="Forgotten Depths SVG" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;If you see white hexes, then I haven&amp;#x2019;t added any definitions for them, yet.&lt;/p&gt;&lt;p&gt;Tags: &lt;a class="outside tag" title="Tag" rel="tag" href="http://alexschroeder.ch/wiki?action=tag;id=SVG"&gt;SVG&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/SVG"&gt;&lt;img src="http://alexschroeder.ch/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt; &lt;a class="outside tag" title="Tag" rel="tag" href="http://alexschroeder.ch/wiki?action=tag;id=Software"&gt;Software&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/Software"&gt;&lt;img src="http://alexschroeder.ch/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt; &lt;a class="outside tag" title="Tag" rel="tag" href="http://alexschroeder.ch/wiki?action=tag;id=Maps"&gt;Maps&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/Maps"&gt;&lt;img src="http://alexschroeder.ch/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt; &lt;a class="outside tag" title="Tag" rel="tag" href="http://alexschroeder.ch/wiki?action=tag;id=Text%20Mapper"&gt;Text Mapper&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/Text%20Mapper"&gt;&lt;img src="http://alexschroeder.ch/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt;&lt;/p&gt;</description>
<pubDate>Fri, 01 Mar 2013 10:28:25 GMT</pubDate>
<comments>http://alexschroeder.ch/wiki/Comments_on_2013-03-01_Text_Mapper_Progress</comments>
<dc:contributor>AlexSchroeder</dc:contributor>
<wiki:status>new</wiki:status>
<wiki:importance>major</wiki:importance>
<wiki:version>1</wiki:version>
<wiki:history>http://alexschroeder.ch/wiki?action=history;id=2013-03-01_Text_Mapper_Progress</wiki:history>
<wiki:diff>http://alexschroeder.ch/wiki?action=browse;diff=1;id=2013-03-01_Text_Mapper_Progress</wiki:diff>
<category>SVG</category>
<category>Software</category>
<category>Maps</category>
<category>Text Mapper</category>
</item>

<item>
<title>SVG Filters</title>
<link>http://alexschroeder.ch/wiki/2013-02-27_SVG_Filters</link>
<guid>http://alexschroeder.ch/wiki/2013-02-27_SVG_Filters</guid>
<description>&lt;p&gt;I need help with &lt;a class="url http outside" href="http://www.w3.org/TR/SVG/filters.html"&gt;SVG filters&lt;/a&gt;. This question is &lt;a class="url http outside" href="http://stackoverflow.com/questions/15130850/svg-filter-fegaussianblur-needs-boosting"&gt;also on StackOverflow&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;This is what I want to achieve:&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.flickr.com/photos/kensanata/8511938807/" class="url http"&gt;&lt;img class="url http" src="https://farm9.staticflickr.com/8507/8511938807_5a793d726a.jpg" alt="https://farm9.staticflickr.com/8507/8511938807_5a793d726a.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Previously, I&amp;#x2019;d duplicate the text element, make the background white, and blur it:&lt;/p&gt;&lt;pre class="real"&gt;  &amp;lt;defs&amp;gt;
    &amp;lt;filter id="label-glow"&amp;gt;
      &amp;lt;feGaussianBlur stdDeviation="1" /&amp;gt;
    &amp;lt;/filter&amp;gt;
  &amp;lt;/defs&amp;gt;
  &amp;lt;text stroke="white" stroke-width="5" filter="url(#label-glow)"&amp;gt;Harald's Repose&amp;lt;/text&amp;gt;
  &amp;lt;text&amp;gt;Harald's Repose&amp;lt;/text&amp;gt;&lt;/pre&gt;&lt;p&gt;I&amp;#x2019;m trying not to duplicate the text element. Here&amp;#x2019;s how to do it using filters:&lt;/p&gt;&lt;pre class="real"&gt;  &amp;lt;defs&amp;gt;
    &amp;lt;filter id="label-glow"&amp;gt;
      &amp;lt;feFlood flood-color="white"/&amp;gt;
      &amp;lt;feComposite in2="SourceGraphic" operator="in"/&amp;gt;
      &amp;lt;feGaussianBlur stdDeviation="2"/&amp;gt;
      &amp;lt;feComposite operator="over"/&amp;gt;
      &amp;lt;feComposite operator="over"/&amp;gt;
      &amp;lt;feComposite operator="over"/&amp;gt;
      &amp;lt;feComposite operator="over"/&amp;gt;
      &amp;lt;feComposite in="SourceGraphic"/&amp;gt;
    &amp;lt;/filter&amp;gt;
  &amp;lt;/defs&amp;gt;
  &amp;lt;text filter="url(#label-glow)"&amp;gt;Harald's Repose&amp;lt;/text&amp;gt;&lt;/pre&gt;&lt;p&gt;Unfortunately the output of the Gaussian blur is very weak which is why I need to overlay it multiple times. What am I missing?&lt;/p&gt;&lt;p&gt;&lt;b&gt;Update&lt;/b&gt;: As I&amp;#x2019;ve been experimenting with it, I&amp;#x2019;ve decided to drop filters altogether. When using Firefox and printing the map to PDF, the filters all result in bitmap elements that don&amp;#x2019;t scale well.&lt;/p&gt;&lt;p&gt;Tags: &lt;a class="outside tag" title="Tag" rel="tag" href="http://alexschroeder.ch/wiki?action=tag;id=SVG"&gt;SVG&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/SVG"&gt;&lt;img src="http://alexschroeder.ch/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt; &lt;a class="outside tag" title="Tag" rel="tag" href="http://alexschroeder.ch/wiki?action=tag;id=Software"&gt;Software&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/Software"&gt;&lt;img src="http://alexschroeder.ch/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt;&lt;/p&gt;</description>
<pubDate>Wed, 27 Feb 2013 22:29:03 GMT</pubDate>
<comments>http://alexschroeder.ch/wiki/Comments_on_2013-02-27_SVG_Filters</comments>
<dc:contributor>AlexSchroeder</dc:contributor>
<wiki:status>new</wiki:status>
<wiki:importance>major</wiki:importance>
<wiki:version>1</wiki:version>
<wiki:history>http://alexschroeder.ch/wiki?action=history;id=2013-02-27_SVG_Filters</wiki:history>
<wiki:diff>http://alexschroeder.ch/wiki?action=browse;diff=1;id=2013-02-27_SVG_Filters</wiki:diff>
<category>SVG</category>
<category>Software</category>
</item>

<item>
<title>Text Mapper</title>
<link>http://alexschroeder.ch/wiki/2013-02-26_Text_Mapper</link>
<guid>http://alexschroeder.ch/wiki/2013-02-26_Text_Mapper</guid>
<description>&lt;p&gt;Recently I wanted to create a little hex map and I wanted to do it on an iPad, I wanted to eventually integrate it into my campaign wiki, I wanted it to be SVG based, and so on. All that meant, &lt;a class="url http outside" href="http://www.hexographer.com/"&gt;Hexographer&lt;/a&gt; wasn&amp;#x2019;t the appropriate tool. I needed to cook something up myself. Based on code I wrote nearly five years ago&amp;#x2014;the &lt;a class="local" href="http://alexschroeder.ch/wiki/2007-06-08_Old_School_Hex_Mapper_Getting_Better"&gt;Old School Hex Mapper&lt;/a&gt;&amp;#x2014;I wrote up a little something.&lt;/p&gt;&lt;p&gt;I&amp;#x2019;m calling it the &lt;a class="url http outside" href="http://alexschroeder.ch/text-mapper"&gt;Text Mapper&lt;/a&gt; because it takes text input. No interactive fiddling with the map.&lt;/p&gt;&lt;p&gt;There are various sections of the input.&lt;/p&gt;&lt;h2&gt;Map&lt;/h2&gt;&lt;p&gt;This is simple. Coordinates, terrain.&lt;/p&gt;&lt;pre class="real"&gt;# map definition
0101 mountain
0102 mountain
0103 hill
0104 forest
0201 mountain
0202 hill
0203 coast
0204 empty
0301 mountain
0302 mountain
0303 plain
0304 sea
0401 hill
0402 sand
0403 forest&lt;/pre&gt;&lt;p&gt;The rest of the input determines how things look: what colors to use, what icons to display. When you start the Text Mapper, the input area already contains an example. Start with that before doing anything else.&lt;/p&gt;&lt;h2&gt;Terrain attributes&lt;/h2&gt;&lt;p&gt;Now it gets tricky. For every terrain we used, the script will generate a hex. We need to provide some SVG attributes! Need documentation? Check out the &lt;a class="url http outside" href="http://www.w3.org/TR/SVG/shapes.html#PolygonElement"&gt;polygon in the SVG specification&lt;/a&gt; and click on &lt;em style="text-decoration: underline; font-style: normal;"&gt;show&lt;/em&gt; next to &lt;em style="text-decoration: underline; font-style: normal;"&gt;presentation attributes&lt;/em&gt;. That&amp;#x2019;s what you should be looking at.&lt;/p&gt;&lt;pre class="real"&gt;# attributes
empty attributes fill="#ffffff" stroke="black" stroke-width="3"
plain attributes fill="#7cfc00" stroke="black" stroke-width="3"
forest attributes fill="#228b22" stroke="black" stroke-width="3"
hill attributes fill="#daa520" stroke="black" stroke-width="3"
mountain attributes fill="#708090" stroke="black" stroke-width="3"
sand attributes fill="#eedd82" stroke="black" stroke-width="3"
coast attributes fill="#7fffd4" stroke="black" stroke-width="3"
sea attributes fill="#4169e1" stroke="black" stroke-width="3"&lt;/pre&gt;&lt;h2&gt;Icons&lt;/h2&gt;&lt;p&gt;In order to add little icons, you can specify a &lt;em style="font-style: normal; letter-spacing: 0.125em; padding-left: 0.125em;"&gt;path&lt;/em&gt; per terrain.&lt;/p&gt;&lt;div style="font-family: 'Andale Mono', Monaco, 'Courier New', Courier, monospace; font-size: 80%; line-height: 110%;"&gt; hill path M -42,11 C -38,5 -34,0 -28,-3 C -20,-6 -11,-5 -5,-0 C -2,2 1,6 3,9 C 4,12 2,13 0,14 C -3,9 -7,5 -13,2 C -21,-1 -30,0 -36,6 C -38,9 -40,11 -43,14 C -43,15 -44,14 -44,13 C -43,12 -43,12 -42,11 z M -5,-0 C 0,-6 7,-12 15,-16 C 21,-18 28,-17 33,-14 C 39,-11 41,-5 43,-0 C 42,2 41,5 39,2 C 37,-2 33,-8 27,-10 C 20,-13 12,-12 6,-7 C 2,-4 -1,-1 -4,1 C -7,4 -6,0 -5,-0 z&lt;p&gt;plain path M -18,-13 C -13,-6 -13,4 -8,12 C -11,14 -15,21 -18,26 C -20,17 -22,4 -28,0 C -26,-4 -21,-9 -18,-13 z M 5,-31 C 4,-19 3,-6 6,5 C 1,10 -0,14 -3,19 C -2,6 -3,-4 -4,-16 C -4,-21 2,-26 5,-31 z M 26,-1 C 16,6 19,5 9,18 C 12,3 21,-8 34,-17 C 32,-12 29,-6 27,-1 z &lt;/p&gt;&lt;/div&gt;&lt;p&gt;If you don&amp;#x2019;t want this path to be black, you need to specify attributes for the  &lt;a class="url http outside" href="http://www.w3.org/TR/SVG/paths.html#PathElement"&gt;path element&lt;/a&gt;.&lt;/p&gt;&lt;pre class="real"&gt;plain path attributes fill="#76ee00"
hill path attributes fill="#b8860b"&lt;/pre&gt;&lt;p&gt;And finally, the coordinates are simple &lt;a class="url http outside" href="http://www.w3.org/TR/SVG/text.html#TextElement"&gt;text elements&lt;/a&gt;.&lt;/p&gt;&lt;pre class="real"&gt;text font-size="20pt" dy="15px"&lt;/pre&gt;&lt;p&gt;If you wanted a black and white map, for example, you could use different strokes&amp;#x2026;&lt;/p&gt;&lt;pre class="real"&gt;empty attributes fill="white" stroke="#b3b3ff" stroke-width="3"
mountain attributes fill="white" stroke="#b3b3ff" stroke-width="3"
hill attributes fill="white" stroke="#b3b3ff" stroke-width="3"
forest attributes fill="white" stroke="#b3b3ff" stroke-width="3"&lt;/pre&gt;&lt;p&gt;If you want to create new path elements yourself in Inkscape, you should draw them in a rectangle from (-100,-100) to (100,100) and extract the the path info from the SVG. Yeah, adding new icons isn&amp;#x2019;t easy.&lt;/p&gt;&lt;p&gt;I need to add more icons. I&amp;#x2019;d also like to add multiple icons for the same terrain such that the code will pick one at random.&lt;/p&gt;&lt;p&gt;I wonder how easy it&amp;#x2019;s be to add text labels, roads, rivers and borders. &lt;img class="smiley" src="http://www.emacswiki.org/pics/smile.png" alt=":)" /&gt;&lt;/p&gt;&lt;p&gt;The result of the above:&lt;/p&gt;&lt;div style="width:500px"&gt; &lt;a class="image outside" href="http://alexschroeder.ch/text-mapper?map=%23+map+definition%0D%0A0101+mountain%0D%0A0102+mountain%0D%0A0103+hill%0D%0A0104+forest%0D%0A0201+mountain%0D%0A0202+hill%0D%0A0203+coast%0D%0A0204+empty%0D%0A0301+mountain%0D%0A0302+mountain%0D%0A0303+plain%0D%0A0304+sea%0D%0A0401+hill%0D%0A0402+sand%0D%0A0403+forest%0D%0A%0D%0A%23+attributes%0D%0Aempty+attributes+fill%3D%22%23ffffff%22+stroke%3D%22black%22+stroke-width%3D%223%22%0D%0Aplain+attributes+fill%3D%22%237cfc00%22+stroke%3D%22black%22+stroke-width%3D%223%22%0D%0Aplain+path+attributes+fill%3D%22%2376ee00%22%0D%0Aforest+attributes+fill%3D%22%23228b22%22+stroke%3D%22black%22+stroke-width%3D%223%22%0D%0Ahill+attributes+fill%3D%22%23daa520%22+stroke%3D%22black%22+stroke-width%3D%223%22%0D%0Ahill+path+attributes+fill%3D%22%23b8860b%22%0D%0Amountain+attributes+fill%3D%22%23708090%22+stroke%3D%22black%22+stroke-width%3D%223%22%0D%0Asand+attributes+fill%3D%22%23eedd82%22+stroke%3D%22black%22+stroke-width%3D%223%22%0D%0Acoast+attributes+fill%3D%22%237fffd4%22+stroke%3D%22black%22+stroke-width%3D%223%22%0D%0Asea+attributes+fill%3D%22%234169e1%22+stroke%3D%22black%22+stroke-width%3D%223%22%0D%0A%0D%0A%23+add+shapes%0D%0Ahill+path+M+-42%2C11+C+-38%2C5+-34%2C0+-28%2C-3+C+-20%2C-6+-11%2C-5+-5%2C-0+C+-2%2C2+1%2C6+3%2C9+C+4%2C12+2%2C13+0%2C14+C+-3%2C9+-7%2C5+-13%2C2+C+-21%2C-1+-30%2C0+-36%2C6+C+-38%2C9+-40%2C11+-43%2C14+C+-43%2C15+-44%2C14+-44%2C13+C+-43%2C12+-43%2C12+-42%2C11+z+M+-5%2C-0+C+0%2C-6+7%2C-12+15%2C-16+C+21%2C-18+28%2C-17+33%2C-14+C+39%2C-11+41%2C-5+43%2C-0+C+42%2C2+41%2C5+39%2C2+C+37%2C-2+33%2C-8+27%2C-10+C+20%2C-13+12%2C-12+6%2C-7+C+2%2C-4+-1%2C-1+-4%2C1+C+-7%2C4+-6%2C0+-5%2C-0+z%0D%0A%0D%0Aplain+path+M+-18%2C-13+C+-13%2C-6+-13%2C4+-8%2C12+C+-11%2C14+-15%2C21+-18%2C26+C+-20%2C17+-22%2C4+-28%2C0+C+-26%2C-4+-21%2C-9+-18%2C-13+z+M+5%2C-31+C+4%2C-19+3%2C-6+6%2C5+C+1%2C10+-0%2C14+-3%2C19+C+-2%2C6+-3%2C-4+-4%2C-16+C+-4%2C-21+2%2C-26+5%2C-31+z+M+26%2C-1+C+16%2C6+19%2C5+9%2C18+C+12%2C3+21%2C-8+34%2C-17+C+32%2C-12+29%2C-6+27%2C-1+z%0D%0A%0D%0Atext+font-size%3D%2220pt%22+dy%3D%2215px%22%0D%0A"&gt;&lt;img class="upload" title="Example map" src="http://alexschroeder.ch/text-mapper?map=%23+map+definition%0D%0A0101+mountain%0D%0A0102+mountain%0D%0A0103+hill%0D%0A0104+forest%0D%0A0201+mountain%0D%0A0202+hill%0D%0A0203+coast%0D%0A0204+empty%0D%0A0301+mountain%0D%0A0302+mountain%0D%0A0303+plain%0D%0A0304+sea%0D%0A0401+hill%0D%0A0402+sand%0D%0A0403+forest%0D%0A%0D%0A%23+attributes%0D%0Aempty+attributes+fill%3D%22%23ffffff%22+stroke%3D%22black%22+stroke-width%3D%223%22%0D%0Aplain+attributes+fill%3D%22%237cfc00%22+stroke%3D%22black%22+stroke-width%3D%223%22%0D%0Aplain+path+attributes+fill%3D%22%2376ee00%22%0D%0Aforest+attributes+fill%3D%22%23228b22%22+stroke%3D%22black%22+stroke-width%3D%223%22%0D%0Ahill+attributes+fill%3D%22%23daa520%22+stroke%3D%22black%22+stroke-width%3D%223%22%0D%0Ahill+path+attributes+fill%3D%22%23b8860b%22%0D%0Amountain+attributes+fill%3D%22%23708090%22+stroke%3D%22black%22+stroke-width%3D%223%22%0D%0Asand+attributes+fill%3D%22%23eedd82%22+stroke%3D%22black%22+stroke-width%3D%223%22%0D%0Acoast+attributes+fill%3D%22%237fffd4%22+stroke%3D%22black%22+stroke-width%3D%223%22%0D%0Asea+attributes+fill%3D%22%234169e1%22+stroke%3D%22black%22+stroke-width%3D%223%22%0D%0A%0D%0A%23+add+shapes%0D%0Ahill+path+M+-42%2C11+C+-38%2C5+-34%2C0+-28%2C-3+C+-20%2C-6+-11%2C-5+-5%2C-0+C+-2%2C2+1%2C6+3%2C9+C+4%2C12+2%2C13+0%2C14+C+-3%2C9+-7%2C5+-13%2C2+C+-21%2C-1+-30%2C0+-36%2C6+C+-38%2C9+-40%2C11+-43%2C14+C+-43%2C15+-44%2C14+-44%2C13+C+-43%2C12+-43%2C12+-42%2C11+z+M+-5%2C-0+C+0%2C-6+7%2C-12+15%2C-16+C+21%2C-18+28%2C-17+33%2C-14+C+39%2C-11+41%2C-5+43%2C-0+C+42%2C2+41%2C5+39%2C2+C+37%2C-2+33%2C-8+27%2C-10+C+20%2C-13+12%2C-12+6%2C-7+C+2%2C-4+-1%2C-1+-4%2C1+C+-7%2C4+-6%2C0+-5%2C-0+z%0D%0A%0D%0Aplain+path+M+-18%2C-13+C+-13%2C-6+-13%2C4+-8%2C12+C+-11%2C14+-15%2C21+-18%2C26+C+-20%2C17+-22%2C4+-28%2C0+C+-26%2C-4+-21%2C-9+-18%2C-13+z+M+5%2C-31+C+4%2C-19+3%2C-6+6%2C5+C+1%2C10+-0%2C14+-3%2C19+C+-2%2C6+-3%2C-4+-4%2C-16+C+-4%2C-21+2%2C-26+5%2C-31+z+M+26%2C-1+C+16%2C6+19%2C5+9%2C18+C+12%2C3+21%2C-8+34%2C-17+C+32%2C-12+29%2C-6+27%2C-1+z%0D%0A%0D%0Atext+font-size%3D%2220pt%22+dy%3D%2215px%22%0D%0A" alt="Example map" /&gt;&lt;/a&gt; &lt;/div&gt;&lt;p&gt;(Also &lt;a class="url http outside" href="https://github.com/kensanata/hex-mapping"&gt;on GitHub&lt;/a&gt;.)&lt;/p&gt;&lt;p&gt;Tags: &lt;a class="outside tag" title="Tag" rel="tag" href="http://alexschroeder.ch/wiki?action=tag;id=RPG"&gt;RPG&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/RPG"&gt;&lt;img src="http://alexschroeder.ch/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt; &lt;a class="outside tag" title="Tag" rel="tag" href="http://alexschroeder.ch/wiki?action=tag;id=Hex"&gt;Hex&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/Hex"&gt;&lt;img src="http://alexschroeder.ch/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt; &lt;a class="outside tag" title="Tag" rel="tag" href="http://alexschroeder.ch/wiki?action=tag;id=Maps"&gt;Maps&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/Maps"&gt;&lt;img src="http://alexschroeder.ch/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt; &lt;a class="outside tag" title="Tag" rel="tag" href="http://alexschroeder.ch/wiki?action=tag;id=Software"&gt;Software&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/Software"&gt;&lt;img src="http://alexschroeder.ch/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt; &lt;a class="outside tag" title="Tag" rel="tag" href="http://alexschroeder.ch/wiki?action=tag;id=Text%20Mapper"&gt;Text Mapper&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/Text%20Mapper"&gt;&lt;img src="http://alexschroeder.ch/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt;&lt;/p&gt;</description>
<pubDate>Tue, 26 Feb 2013 07:54:10 GMT</pubDate>
<comments>http://alexschroeder.ch/wiki/Comments_on_2013-02-26_Text_Mapper</comments>
<dc:contributor>AlexSchroeder</dc:contributor>
<wiki:status>new</wiki:status>
<wiki:importance>major</wiki:importance>
<wiki:version>1</wiki:version>
<wiki:history>http://alexschroeder.ch/wiki?action=history;id=2013-02-26_Text_Mapper</wiki:history>
<wiki:diff>http://alexschroeder.ch/wiki?action=browse;diff=1;id=2013-02-26_Text_Mapper</wiki:diff>
<category>RPG</category>
<category>Hex</category>
<category>Maps</category>
<category>Software</category>
<category>Text Mapper</category>
</item>

<item>
<title>Online Photos</title>
<link>http://alexschroeder.ch/wiki/2013-01-08_Online_Photos</link>
<guid>http://alexschroeder.ch/wiki/2013-01-08_Online_Photos</guid>
<description>&lt;p&gt;In 2012, I basically took pictures using &lt;b&gt;Instagram&lt;/b&gt;, shared them with &lt;b&gt;Facebook&lt;/b&gt; (part of the family), &lt;b&gt;Twitter&lt;/b&gt; (another part of the family), &lt;b&gt;Flickr&lt;/b&gt; (my favorite), and I used &lt;b&gt;IFTTT&lt;/b&gt; to send a copy to &lt;b&gt;Picasa Web&lt;/b&gt; because I felt that I&amp;#x2019;d like to have some pictures for people to see on &lt;strong&gt;Google+&lt;/strong&gt;.&lt;/p&gt;&lt;p&gt;But then, when &lt;a class="url http outside" href="http://www.techdirt.com/articles/20121218/11131721427/everyones-up-arms-over-instagrams-terms-service-they-didnt-read-first-place.shtml"&gt;Instagram changed its terms of service&lt;/a&gt; (they &lt;a class="url http outside" href="http://www.techdirt.com/articles/20121218/15010921430/instagram-wait-wait-thats-not-what-we-meant.shtml"&gt;rephrased them somewhat&lt;/a&gt;) and I decided that I might want to look into using something else for a bit.&lt;/p&gt;&lt;p&gt;I liked the new Flickr app somewhat.&lt;/p&gt;&lt;p&gt;I tried organizing my pictures on Picasa Web but was unable to create a new empty album in order to move some of my pictures in the Scrapbook album. When I selected more than 300 of the pictures and tried to move them, it also told me I could not move more than 100 at a time. I was confused. It looked like the user interface could use some improvements. I even started up my local Picasa copy and wasn&amp;#x2019;t clear on how to use it to manage my albums online. Perhaps you can&amp;#x2019;t. I was not impressed. It looks as if I&amp;#x2019;m not going to abandon iPhoto any time soon. Then again, I really want to abandon iPhoto one of these days because I hate it&amp;#x2019;s opaque storage regime.&lt;/p&gt;&lt;p&gt;Also, the lens or the protective plastic cover of my iPhone camera is scratched. The photos from the main camera now all look hazy. The terrible quality had resulted in me taking a lot of self-portraits from the second camera.&lt;/p&gt;&lt;p&gt;Since I didn&amp;#x2019;t want to use Instagram too often, I have uploaded the pictures to Flickr directly. This means that I haven&amp;#x2019;t posted any pictures to Facebook; I haven&amp;#x2019;t posted any pictures to Twitter, and none where uploaded to Picasa Web.&lt;/p&gt;&lt;p&gt;Strangely enough it doesn&amp;#x2019;t bother me.&lt;/p&gt;&lt;p&gt;Maybe it bothers me a bit because I&amp;#x2019;ve been using simple photos of my daily life as a replacement for status updates for my family and friends. We&amp;#x2019;ll see. Perhaps I&amp;#x2019;ll post status updates again. Or I&amp;#x2019;ll abandon Facebook. Or resume the use of Instagram.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.flickr.com/photos/kensanata/8361623336/" class="url http"&gt;&lt;img class="url http" src="http://farm9.staticflickr.com/8324/8361623336_2a0c20b3ac_m.jpg" alt="http://farm9.staticflickr.com/8324/8361623336_2a0c20b3ac_m.jpg" /&gt;&lt;/a&gt; &lt;a href="http://www.flickr.com/photos/kensanata/8349494004/" class="url http"&gt;&lt;img class="url http" src="http://farm9.staticflickr.com/8046/8349494004_a65d7c1f1e_n.jpg" alt="http://farm9.staticflickr.com/8046/8349494004_a65d7c1f1e_n.jpg" /&gt;&lt;/a&gt; &lt;a href="http://www.flickr.com/photos/kensanata/8344704179/" class="url http"&gt;&lt;img class="url http" src="http://farm9.staticflickr.com/8498/8344704179_37787e214f_m.jpg" alt="http://farm9.staticflickr.com/8498/8344704179_37787e214f_m.jpg" /&gt;&lt;/a&gt; &lt;a href="http://www.flickr.com/photos/kensanata/8324968293/" class="url http"&gt;&lt;img class="url http" src="http://farm9.staticflickr.com/8082/8324968293_acd56ba786_n.jpg" alt="http://farm9.staticflickr.com/8082/8324968293_acd56ba786_n.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Tags: &lt;a class="outside tag" title="Tag" rel="tag" href="http://alexschroeder.ch/wiki?action=tag;id=Pictures"&gt;Pictures&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/Pictures"&gt;&lt;img src="http://alexschroeder.ch/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt; &lt;a class="outside tag" title="Tag" rel="tag" href="http://alexschroeder.ch/wiki?action=tag;id=Software"&gt;Software&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/Software"&gt;&lt;img src="http://alexschroeder.ch/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt; &lt;a class="outside tag" title="Tag" rel="tag" href="http://alexschroeder.ch/wiki?action=tag;id=Web"&gt;Web&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/Web"&gt;&lt;img src="http://alexschroeder.ch/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt;&lt;/p&gt;</description>
<pubDate>Tue, 08 Jan 2013 15:46:53 GMT</pubDate>
<comments>http://alexschroeder.ch/wiki/Comments_on_2013-01-08_Online_Photos</comments>
<dc:contributor>AlexSchroeder</dc:contributor>
<wiki:status>new</wiki:status>
<wiki:importance>major</wiki:importance>
<wiki:version>1</wiki:version>
<wiki:history>http://alexschroeder.ch/wiki?action=history;id=2013-01-08_Online_Photos</wiki:history>
<wiki:diff>http://alexschroeder.ch/wiki?action=browse;diff=1;id=2013-01-08_Online_Photos</wiki:diff>
<category>Pictures</category>
<category>Software</category>
<category>Web</category>
</item>

<item>
<title>awk</title>
<link>http://alexschroeder.ch/wiki/2012-10-17_awk</link>
<guid>http://alexschroeder.ch/wiki/2012-10-17_awk</guid>
<description>&lt;p&gt;Sometimes it&amp;#x2019;s hard to remember how cool &lt;code&gt;awk&lt;/code&gt; used to be – I haven&amp;#x2019;t used &lt;code&gt;awk&lt;/code&gt; ever since I switched to Perl about 15 years ago. &lt;img class="smiley" src="http://www.emacswiki.org/pics/smile.png" alt=":)" /&gt;&lt;/p&gt;&lt;p&gt;Today I wondered who had so many sleeping php-cgi processes on the server hosting &lt;a class="near" title="Names" href="http://www.campaignwiki.org/"&gt;Campaign Wiki&lt;/a&gt;:&lt;/p&gt;&lt;pre class="real"&gt;ps aux | awk '/php-cgi$/ { user[$1]++} END { for (u in user) { print u, user[u] }}'
1231 233
greywulf 1&lt;/pre&gt;&lt;p&gt;Thanks, &lt;code&gt;awk&lt;/code&gt;. You might be awkward to use, but you get the job done. Now we just need to figure out who this user 1231 is. Who needs 233 php-cgi processes running?&lt;/p&gt;&lt;p&gt;Tags: &lt;a class="outside tag" title="Tag" rel="tag" href="http://www.emacswiki.org/alex?action=tag;id=Software"&gt;Software&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://www.emacswiki.org/alex/feed/full/Software"&gt;&lt;img src="http://www.emacswiki.org/alex/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt;&lt;/p&gt;</description>
<pubDate>Wed, 17 Oct 2012 19:26:26 GMT</pubDate>
<comments>http://alexschroeder.ch/wiki/Comments_on_2012-10-17_awk</comments>
<dc:contributor>AlexSchroeder</dc:contributor>
<wiki:status>new</wiki:status>
<wiki:importance>major</wiki:importance>
<wiki:version>1</wiki:version>
<wiki:history>http://alexschroeder.ch/wiki?action=history;id=2012-10-17_awk</wiki:history>
<wiki:diff>http://alexschroeder.ch/wiki?action=browse;diff=1;id=2012-10-17_awk</wiki:diff>
<category>Software</category>
</item>

<item>
<title>External Fonts for SVG Files</title>
<link>http://alexschroeder.ch/wiki/2012-09-29_External_Fonts_for_SVG_Files</link>
<guid>http://alexschroeder.ch/wiki/2012-09-29_External_Fonts_for_SVG_Files</guid>
<description>&lt;p&gt;I was writing &lt;a class="url http outside" href="http://campaignwiki.org/halberdsnhelmets"&gt;a Perl CGI&lt;/a&gt; script that takes a SVG file I created with Inkscape, replaces a few placeholders and serves it via the web. How to supply this SVG file with an external &lt;a class="near" title="Wikipedia" href="http://en.wikipedia.org/wiki/TrueType"&gt;TrueType&lt;/a&gt; font?&lt;/p&gt;&lt;p&gt;&lt;b&gt;Upload the font&lt;/b&gt; &amp;#x2013; &lt;a class="url http" href="http://campaignwiki.org/Purisa.ttf"&gt;http://campaignwiki.org/Purisa.ttf&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Add an appropriate MIME type&lt;/b&gt; &amp;#x2013; in the directory where the font file is, register an appropriate MIME type in your .htaccess file:&lt;/p&gt;&lt;pre class="real"&gt;AddType application/x-font-ttf        .ttf&lt;/pre&gt;&lt;p&gt;If you are creating a new &lt;code&gt;.htaccess&lt;/code&gt; file, remember it needs a permission like &lt;code&gt;-rw-r--r--&lt;/code&gt;.&lt;/p&gt;&lt;p&gt;&lt;b&gt;Add an external style sheet to the SVG file&lt;/b&gt; &amp;#x2013; it is not obvious how to do this in Inkscape. I guess you can open the XML Editor and add an svg:style element. I just pasted the following into the beginning of my SVG file:&lt;/p&gt;&lt;pre class="real"&gt;  &amp;lt;style
     type="text/css"&amp;gt;
      @font-face {
          font-family: 'Purisa';
          src: local('Purisa'),
               url('/Purisa.ttf') format('truetype');
      }
  &amp;lt;/style&amp;gt;&lt;/pre&gt;&lt;p&gt;&lt;b&gt;Care about Internet Explorer?&lt;/b&gt; I don&amp;#x2019;t have access to IE at the moment. I read that you might need to add an &lt;code&gt;.eot&lt;/code&gt; file to &lt;a class="url http outside" href="http://www.bitvolution.com/using-the-purisa-light-font-on-a-website"&gt;support IE&lt;/a&gt;, and that would also require &lt;a class="url http outside" href="http://stackoverflow.com/questions/7415640/correct-apache-addtype-directives-for-font-mime-types"&gt;another MIME type&lt;/a&gt; to be added. You can convert a &lt;code&gt;.ttf&lt;/code&gt; font to an &lt;code&gt;.eot&lt;/code&gt; font &lt;a class="url http outside" href="http://www.kirsle.net/wizards/ttf2eot.cgi"&gt;using ttf2eot on the web&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Tags: &lt;a class="outside tag" title="Tag" rel="tag" href="http://alexschroeder.ch/wiki?action=tag;id=Software"&gt;Software&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/Software"&gt;&lt;img src="http://alexschroeder.ch/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt; &lt;a class="outside tag" title="Tag" rel="tag" href="http://alexschroeder.ch/wiki?action=tag;id=Web"&gt;Web&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/Web"&gt;&lt;img src="http://alexschroeder.ch/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt;&lt;/p&gt;</description>
<pubDate>Sat, 29 Sep 2012 09:06:28 GMT</pubDate>
<comments>http://alexschroeder.ch/wiki/Comments_on_2012-09-29_External_Fonts_for_SVG_Files</comments>
<dc:contributor>AlexSchroeder</dc:contributor>
<wiki:status>new</wiki:status>
<wiki:importance>major</wiki:importance>
<wiki:version>1</wiki:version>
<wiki:history>http://alexschroeder.ch/wiki?action=history;id=2012-09-29_External_Fonts_for_SVG_Files</wiki:history>
<wiki:diff>http://alexschroeder.ch/wiki?action=browse;diff=1;id=2012-09-29_External_Fonts_for_SVG_Files</wiki:diff>
<category>Software</category>
<category>Web</category>
</item>

<item>
<title>Free French OCR for Mac</title>
<link>http://alexschroeder.ch/wiki/2012-08-03_Free_French_OCR_for_Mac</link>
<guid>http://alexschroeder.ch/wiki/2012-08-03_Free_French_OCR_for_Mac</guid>
<description>&lt;p&gt;Once again I&amp;#x2019;ve decided I needed to work on the memoirs of my grandfather &lt;a class="local" href="http://alexschroeder.ch/wiki/Roland_Li-Marchetti"&gt;Roland Li-Marchetti&lt;/a&gt;. I had digitized 16 pages many years ago but his memoirs contain a total of 45 pages of typed text. The last time I worked on this, I was using the OCR software that came with my scanner (a cheap Canon LiDE 25) – but today the scanner was no longer recognized by the operating system. I faintly remember having experienced this before when I upgraded my system. Bit rot!&lt;/p&gt;&lt;p&gt;Anyway, I was in the mood to try something new. Free Software?&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;a class="url http outside" href="http://code.google.com/p/tesseract-ocr/"&gt;Tesseract&lt;/a&gt;&lt;/li&gt;&lt;li&gt;requires &lt;a class="url http outside" href="http://www.leptonica.com/"&gt;Leptonica&lt;/a&gt;&lt;/li&gt;&lt;li&gt;and I needed to install &lt;a class="url http outside" href="http://www.gnu.org/software/libtool/"&gt;GNU Libtool&lt;/a&gt; because I was getting an error: &amp;#x201c;Libtool library used but `LIBTOOL&amp;#x2019; is undefined. The usual way to define `LIBTOOL&amp;#x2019; is to add `AC_PROG_LIBTOOL&amp;#x2019; to `configure.ac&amp;#x2019; and run `aclocal&amp;#x2019; and `autoconf&amp;#x2019; again. If `AC_PROG_LIBTOOL&amp;#x2019; is in `configure.ac&amp;#x2019;, make sure its definition is in aclocal&amp;#x2019;s search path.&amp;#x201d;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;(While the stuff is compiling, I am in fact using a &lt;a class="url http outside" href="http://www.free-ocr.com/"&gt;free online OCR&lt;/a&gt; service.)&lt;/p&gt;&lt;p&gt;Here is the original, taken with my Pentax K100D, loaded into Gimp, rotated, cropped, and auto-adjusted levels.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.flickr.com/photos/kensanata/7703476934/" class="url http"&gt;&lt;img class="url http" src="http://farm9.staticflickr.com/8154/7703476934_8e4cde0f8b_z.jpg" alt="http://farm9.staticflickr.com/8154/7703476934_8e4cde0f8b_z.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;The tesseract output is pretty cool:&lt;/p&gt;&lt;pre class="real"&gt;que mes vingt prochaines années soient aussi riches d'aventures
et de bonheur auprès des miens, main dans la main avec Agnès mon
inséparable complice qui a beaucoup sacrifié et que j'espère
pouvoir encore rendre heureuse.&lt;/pre&gt;&lt;p&gt;(When I tried it on a direct photo of the page the result was far less pleasing.)&lt;/p&gt;&lt;p&gt;Yay!&lt;/p&gt;&lt;pre class="real"&gt;for ((i=20; i&amp;lt;=46; i++)); do
    tesseract IMGP$((5210+$i)).JPG "page-$i" -l fra
done&lt;/pre&gt;&lt;p&gt;Tags: &lt;a class="outside tag" title="Tag" rel="tag" href="http://www.emacswiki.org/alex?action=tag;id=OCR"&gt;OCR&lt;/a&gt; &lt;a class="feed tag" title="Feed für diesen Tag" rel="feed" href="http://www.emacswiki.org/alex/feed/full/OCR"&gt;&lt;img src="http://www.emacswiki.org/alex/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt; &lt;a class="outside tag" title="Tag" rel="tag" href="http://www.emacswiki.org/alex?action=tag;id=Software"&gt;Software&lt;/a&gt; &lt;a class="feed tag" title="Feed für diesen Tag" rel="feed" href="http://www.emacswiki.org/alex/feed/full/Software"&gt;&lt;img src="http://www.emacswiki.org/alex/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt;&lt;/p&gt;</description>
<pubDate>Fri, 03 Aug 2012 10:06:28 GMT</pubDate>
<comments>http://alexschroeder.ch/wiki/Comments_on_2012-08-03_Free_French_OCR_for_Mac</comments>
<dc:contributor>AlexSchroeder</dc:contributor>
<wiki:status>new</wiki:status>
<wiki:importance>major</wiki:importance>
<wiki:version>1</wiki:version>
<wiki:history>http://alexschroeder.ch/wiki?action=history;id=2012-08-03_Free_French_OCR_for_Mac</wiki:history>
<wiki:diff>http://alexschroeder.ch/wiki?action=browse;diff=1;id=2012-08-03_Free_French_OCR_for_Mac</wiki:diff>
<category>OCR</category>
<category>Software</category>
</item>

<item>
<title>rsync backups</title>
<link>http://alexschroeder.ch/wiki/2012-07-20_rsync_backups</link>
<guid>http://alexschroeder.ch/wiki/2012-07-20_rsync_backups</guid>
<description>&lt;p&gt;I have a job that creates backups of my sites using &lt;a class="near" title="Names" href="http://samba.anu.edu.au/rsync/"&gt;rsync&lt;/a&gt;. My sites are in Germany and the USA, the backups are in Canada and Chile. The point was to protect myself against hosting services disappearing and my sites getting lost. Recently I was thinking about data corruption, however. As soon as the cronjob writes the corrupted data to the backups, there is no way to retrieve my data. (There is in fact a third backup: every few weeks I use rsync to copy the remote sites to one of a rotating set of mobile disks, one of which is always outside our apartment.)&lt;/p&gt;&lt;p&gt;There is in fact an option for rsync which will allow you to create copies of your file tree at certain intervals using hard links for the files that haven&amp;#x2019;t changed. I found a tutorial on how to do it: &lt;a class="url http outside" href="http://blog.interlinked.org/tutorials/rsync_time_machine.html"&gt;Time Machine for every Unix out there&lt;/a&gt; subtitled &amp;#x201c;Using rsync to mimic the behavior of Apple&amp;#x2019;s Time Machine feature.&amp;#x201d;&lt;/p&gt;&lt;p&gt;And that&amp;#x2019;s &lt;a class="url http outside" href="http://emacswiki.org/scripts/backup"&gt;exactly what I did&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Tags: &lt;a class="outside tag" title="Tag" rel="tag" href="http://www.emacswiki.org/alex?action=tag;id=Backup"&gt;Backup&lt;/a&gt; &lt;a class="feed tag" title="Feed für diesen Tag" rel="feed" href="http://www.emacswiki.org/alex/feed/full/Backup"&gt;&lt;img src="http://www.emacswiki.org/alex/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt; &lt;a class="outside tag" title="Tag" rel="tag" href="http://www.emacswiki.org/alex?action=tag;id=Software"&gt;Software&lt;/a&gt; &lt;a class="feed tag" title="Feed für diesen Tag" rel="feed" href="http://www.emacswiki.org/alex/feed/full/Software"&gt;&lt;img src="http://www.emacswiki.org/alex/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt;&lt;/p&gt;</description>
<pubDate>Fri, 20 Jul 2012 14:43:09 GMT</pubDate>
<comments>http://alexschroeder.ch/wiki/Comments_on_2012-07-20_rsync_backups</comments>
<dc:contributor>AlexSchroeder</dc:contributor>
<wiki:status>new</wiki:status>
<wiki:importance>major</wiki:importance>
<wiki:version>1</wiki:version>
<wiki:history>http://alexschroeder.ch/wiki?action=history;id=2012-07-20_rsync_backups</wiki:history>
<wiki:diff>http://alexschroeder.ch/wiki?action=browse;diff=1;id=2012-07-20_rsync_backups</wiki:diff>
<category>Backup</category>
<category>Software</category>
</item>

<item>
<title>Perl and UTF-8</title>
<link>http://alexschroeder.ch/wiki/2012-07-20_Perl_and_UTF-8</link>
<guid>http://alexschroeder.ch/wiki/2012-07-20_Perl_and_UTF-8</guid>
<description>&lt;p&gt;I maintain a wiki engine called &lt;a class="local" href="http://alexschroeder.ch/wiki/Oddmuse"&gt;Oddmuse&lt;/a&gt;. It&amp;#x2019;s the software used to run my blog, for example. It is written in an older scripting language called &lt;em style="font-style: normal; letter-spacing: 0.125em; padding-left: 0.125em;"&gt;Perl&lt;/em&gt;. &lt;a class="near" title="Wikipedia" href="http://en.wikipedia.org/wiki/Perl"&gt;Perl&lt;/a&gt; predates &lt;a class="near" title="Wikipedia" href="http://en.wikipedia.org/wiki/Unicode"&gt;Unicode&lt;/a&gt;. That&amp;#x2019;s why the use of &lt;a class="near" title="Wikipedia" href="http://en.wikipedia.org/wiki/UTF-8"&gt;UTF-8&lt;/a&gt; or &lt;a class="near" title="Wikipedia" href="http://en.wikipedia.org/wiki/UTF-16"&gt;UTF-16&lt;/a&gt; is not mandated. That, in turn, means that usually bytes are interpreted as an UTF-8 encoded character is only visible as two bytes.&lt;/p&gt;&lt;p&gt;Consider this regular expression to match WikiWords: &lt;code&gt;[A-Z][a-z]+[A-Z][a-z]+&lt;/code&gt;&lt;/p&gt;&lt;p&gt;How would you extend it to parse &lt;em style="font-style: normal; letter-spacing: 0.125em; padding-left: 0.125em;"&gt;ÖlPlattform&lt;/em&gt;?&lt;/p&gt;&lt;p&gt;Assume the following Perl code was written in a source file that was UTF-8 encoded:&lt;/p&gt;&lt;pre class="real"&gt;$str = "OelPlattform";
print "OelPlattform YES\n" if $str =~ /[[:upper:]][[:lower:]]+[[:upper:]]\w+/;
$str = "ÖlPlattform";
print "ÖlPlattform YES\n" if $str =~ /[[:upper:]][[:lower:]]+[[:upper:]]\w+/;&lt;/pre&gt;&lt;p&gt;This will just print &lt;code&gt;OelPlattform YES&lt;/code&gt; because what looks like &amp;#x201c;ÖlPlattform&amp;#x201d; actually starts with the bytes C3 96 and C3 is not an upper case letter. It&amp;#x2019;s actually unclear what it is. In a Latin-1 environment the C3 would print as Ã&amp;#x2014;the dreaded sign of encoding errors!&lt;/p&gt;&lt;p&gt;I wanted to keep Oddmuse encoding agnostic. Users could specify a different encoding which would be served together with the page HTML such that they could have wikis using &lt;a class="near" title="Wikipedia" href="http://en.wikipedia.org/wiki/GB%202312"&gt;GB 2312&lt;/a&gt;. This is why Oddmuse contained the following line and similar code:&lt;/p&gt;&lt;pre class="real"&gt;# we treat input and output as bytes
eval { local $SIG{__DIE__}; binmode(STDOUT, ":raw"); };&lt;/pre&gt;&lt;p&gt;This resulted in problems when some packages I was using did in fact produce UTF-8 and so I had to use code as follows:&lt;/p&gt;&lt;pre class="real"&gt;eval { local $SIG{__DIE__}; binmode(STDOUT, ":utf8"); } if $HttpCharset eq 'UTF-8';
print RSS($3 ? $3 : 15, split(/\s+/, UnquoteHtml($4)));
eval { local $SIG{__DIE__}; binmode(STDOUT, ":raw"); };&lt;/pre&gt;&lt;p&gt;I&amp;#x2019;m not sure why I surrounded it all with an eval&amp;#x2014;I assume it was to support an older version of Perl but I&amp;#x2019;m not sure.&lt;/p&gt;&lt;p&gt;Ok, so I wanted to get rid of all that.&lt;/p&gt;&lt;p&gt;The solution seems deceptively simple: add &lt;code&gt;use utf8;&lt;/code&gt; to the source files and open all files using the UTF-8 encoding layer.&lt;/p&gt;&lt;p&gt;When printing UTF-8 to STDOUT, you need to tell Perl that STDOUT can in fact handle multi-byte characters. Since the HTML produced is UTF-8 encoded, I know that this is true. If you don&amp;#x2019;t, you&amp;#x2019;ll get &amp;#x201c;wide character in print&amp;#x201d; warnings.&lt;/p&gt;&lt;pre class="real"&gt;binmode(STDOUT, ':utf8');&lt;/pre&gt;&lt;p&gt;You need to be careful with all input and output, however.&lt;/p&gt;&lt;pre class="real"&gt;open(F, '&amp;lt;:encoding(UTF-8)', $RcFile);&lt;/pre&gt;&lt;p&gt;The same is true for output:&lt;/p&gt;&lt;pre class="real"&gt;open(OUT, '&amp;gt;:encoding(UTF-8)', $file)
  or ReportError(Ts('Cannot write %s', $file) . ": $!", '500 INTERNAL SERVER ERROR');&lt;/pre&gt;&lt;p&gt;Oddmuse also offers the ability to &lt;em style="font-style: normal; letter-spacing: 0.125em; padding-left: 0.125em;"&gt;include&lt;/em&gt; other pages (&lt;a class="near" title="Wikipedia" href="http://en.wikipedia.org/wiki/Transclusion"&gt;Transclusion&lt;/a&gt;) and to produce feeds. This can be a problem. The default page processing is to parse the raw text and start printing HTML as soon as possible because I have always felt that it was more expedient to start printing the top of the page while the rest was still being parsed. What happens when I don&amp;#x2019;t want to do this, eg. I&amp;#x2019;m in the middle of building the RSS feed?&lt;/p&gt;&lt;p&gt;The solution I had been using was to redirect STDOUT to a variable. Perl calls this a &amp;#x201c;memory file.&amp;#x201d; The problem is the encoding of this memory file:&lt;/p&gt;&lt;p&gt;Here&amp;#x2019;s what I had to write:&lt;/p&gt;&lt;pre class="real"&gt;open(STDOUT, '&amp;gt;', \$page) or die "Can't open memory file: $!";
binmode(STDOUT, ":utf8");
PrintPageHtml();
utf8::decode($page);&lt;/pre&gt;&lt;p&gt;I think this works because &lt;code&gt;binmode&lt;/code&gt; tells all the &lt;code&gt;print&lt;/code&gt; instructions that it&amp;#x2019;s ok to print multi-byte characters and &lt;code&gt;utf8::decode&lt;/code&gt; makes sure that all those bytes are in fact decoded back to Perl&amp;#x2019;s internal representation.&lt;/p&gt;&lt;p&gt;Then I discovered that I needed to look at the &lt;em style="font-style: normal; letter-spacing: 0.125em; padding-left: 0.125em;"&gt;bytes&lt;/em&gt; if I wanted to URL-encode strings:&lt;/p&gt;&lt;pre class="real"&gt;utf8::encode($str); # turn to byte string
my @letters = split(//, $str);
my %safe = map {$_ =&amp;gt; 1} ('a' .. 'z', 'A' .. 'Z', '0' .. '9', '-', '_', '.', '!', '~', '*', "'", '(', ')', '#');
foreach my $letter (@letters) {
  $letter = sprintf("%%%02x", ord($letter)) unless $safe{$letter};
}&lt;/pre&gt;&lt;p&gt;Now that I&amp;#x2019;m looking at the above I wonder what sort of bugs I&amp;#x2019;m introducing with the inverse operation that I haven&amp;#x2019;t changed:&lt;/p&gt;&lt;pre class="real"&gt;$str =~ s/%([0-9a-f][0-9a-f])/chr(hex($1))/ge;&lt;/pre&gt;&lt;p&gt;I feel that this requires a call to &lt;code&gt;utf8::decode&lt;/code&gt; when done! Strangely enough none of my tests have picked this up. &lt;img class="smiley" src="http://www.emacswiki.org/pics/question.png" alt="question" /&gt;&lt;/p&gt;&lt;p&gt;(Actually I think I know why I haven&amp;#x2019;t stumbled across this problem: I only use the function to decode the Cookie, and all the functions accessing the cookie go through an extra encoding/decoding step that would not be necessary if I had fixed the URL-decoding function. &lt;img class="smiley" src="http://www.emacswiki.org/pics/lightbulb.png" alt="lightbulb" /&gt;)&lt;/p&gt;&lt;p&gt;Another problem I stumbled upon: directories. Directories often ended up Latin-1 encoded.&lt;/p&gt;&lt;pre class="real"&gt;utf8::encode($newdir);
return if -d $newdir;
mkdir($newdir, 0775)
  or ReportError(Ts('Cannot create %s', $newdir) . ": $!", '500 INTERNAL SERVER ERROR');&lt;/pre&gt;&lt;p&gt;The reason I didn&amp;#x2019;t discover I had the same problem with filenames was that I&amp;#x2019;m using a compatibility layer on my Mac when I do my developments. The Mac uses UTF-8 NFD instead of UTF-8 NFC as is the standard on the web. Thus if you take bytes encoding a filename from the web and create the file, or if you go the other way, you have a problem. I store the index of all pages in a files. When a new page is created, I get the page name (NCF encoded) from the web, and store it in a file. When I read the file, the content contains the NFC bytes and with these, I cannot find the NFD encoded file (because the filesystem changed the encoding as it wrote the file). I hated it so much. Thus, the Mac compatibility layer does an extra encoding and decoding to get everything from NFD to NFC&amp;#x2014;and thereby protected me from this error.&lt;/p&gt;&lt;p&gt;As soon as I installed it on my sites, however&amp;#x2014;they all use Debian and ext3 filesystems, I think&amp;#x2014;I had a problem.&lt;/p&gt;&lt;p&gt;The necessary fix:&lt;/p&gt;&lt;pre class="real"&gt;utf8::encode($file);
if (open(IN, '&amp;lt;:encoding(UTF-8)', $file)) {
  local $/ = undef;   # Read complete files
  my $data=&amp;lt;IN&amp;gt;;
  close IN;
  return (1, $data);
}&lt;/pre&gt;&lt;p&gt;And:&lt;/p&gt;&lt;pre class="real"&gt;utf8::encode($file);
open(OUT, '&amp;gt;:encoding(UTF-8)', $file)
  or ReportError(Ts('Cannot write %s', $file) . ": $!", '500 INTERNAL SERVER ERROR');
print OUT  $string;
close(OUT);&lt;/pre&gt;&lt;p&gt;Another stumbling block was that the non-breaking space was no longer just a byte sequence like any other, namely C2 A0. Perl suddenly recognized it as &lt;em style="font-style: normal; letter-spacing: 0.125em; padding-left: 0.125em;"&gt;whitespace&lt;/em&gt;! This is a problem if a path contains non-breaking spaces! The old code translated spaces to underscore characters, so that wasn&amp;#x2019;t really a possibility. But whenever I had been &amp;#x201c;smart&amp;#x201d; and used a non-breaking space, I now had a problem. The &lt;code&gt;glob&lt;/code&gt; function splits its arguments on &lt;em style="text-decoration: underline; font-style: normal;"&gt;whitespace&lt;/em&gt;. Where there was one pattern, I now had two broken patterns!&lt;/p&gt;&lt;p&gt;Here&amp;#x2019;s an example:&lt;/p&gt;&lt;pre class="real"&gt;glob(GetKeepDir(shift) . '/*.kp'); # files such as 1.kp, 2.kp, etc.&lt;/pre&gt;&lt;p&gt;Here&amp;#x2019;s another example:&lt;/p&gt;&lt;pre class="real"&gt;foreach (glob("$PageDir/*/*.pg $PageDir/*/.*.pg"))&lt;/pre&gt;&lt;p&gt;The solution is to &lt;code&gt;use File::Glob ':glob'&lt;/code&gt; and replace every occurence of &lt;code&gt;glob&lt;/code&gt; with &lt;code&gt;bsd_glob&lt;/code&gt;. Wow, my application was very much unsuited to filenames containing whitespace and I hadn&amp;#x2019;t even realized it!&lt;/p&gt;&lt;pre class="real"&gt;foreach (bsd_glob("$PageDir/*/*.pg"), bsd_glob("$PageDir/*/.*.pg"))&lt;/pre&gt;&lt;p&gt;Remember the regular expression to detect wiki words I used at the top? This was the actual regular expression I had been using:&lt;/p&gt;&lt;pre class="real"&gt;$WikiWord = '[A-Z]+[a-z\x80-\xff]+[A-Z][A-Za-z\x80-\xff]*';&lt;/pre&gt;&lt;p&gt;Essentially wiki words only worked for a first letter containing an ASCII upper case letter.&lt;/p&gt;&lt;p&gt;At first, I switched this to the following regular expression (trying to minimize changes):&lt;/p&gt;&lt;pre class="real"&gt;$WikiWord = '[A-Z]+[a-z\x{0080}-\x{ffff}]+[A-Z][A-Za-z\x{0080}-\x{ffff}]*';&lt;/pre&gt;&lt;p&gt;It turns out that Perl 5.8 chokes on this regular expression, howeveer. FFFE and FFFF are noncharacters. I had to change the regular expression.&lt;/p&gt;&lt;pre class="real"&gt;$WikiWord = '[A-Z]+[a-z\x{0080}-\x{fffd}]+[A-Z][A-Za-z\x{0080}-\x{fffd}]*'; # exclude noncharacters FFFE and FFFF&lt;/pre&gt;&lt;p&gt;I&amp;#x2019;m sure this list isn&amp;#x2019;t complete but I&amp;#x2019;m sure it&amp;#x2019;s long enough to illustrate my main point: this is painful. It&amp;#x2019;s HTML quoting all over again.&lt;/p&gt;&lt;p&gt;Tags: &lt;a class="outside tag" title="Tag" rel="tag" href="http://www.emacswiki.org/alex?action=tag;id=Perl"&gt;Perl&lt;/a&gt; &lt;a class="feed tag" title="Feed für diesen Tag" rel="feed" href="http://www.emacswiki.org/alex/feed/full/Perl"&gt;&lt;img src="http://www.emacswiki.org/alex/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt; &lt;a class="outside tag" title="Tag" rel="tag" href="http://www.emacswiki.org/alex?action=tag;id=Software"&gt;Software&lt;/a&gt; &lt;a class="feed tag" title="Feed für diesen Tag" rel="feed" href="http://www.emacswiki.org/alex/feed/full/Software"&gt;&lt;img src="http://www.emacswiki.org/alex/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt;&lt;/p&gt;</description>
<pubDate>Fri, 20 Jul 2012 16:10:25 GMT</pubDate>
<comments>http://alexschroeder.ch/wiki/Comments_on_2012-07-20_Perl_and_UTF-8</comments>
<dc:contributor>AlexSchroeder</dc:contributor>
<wiki:status>new</wiki:status>
<wiki:importance>major</wiki:importance>
<wiki:version>1</wiki:version>
<wiki:history>http://alexschroeder.ch/wiki?action=history;id=2012-07-20_Perl_and_UTF-8</wiki:history>
<wiki:diff>http://alexschroeder.ch/wiki?action=browse;diff=1;id=2012-07-20_Perl_and_UTF-8</wiki:diff>
<category>Perl</category>
<category>Software</category>
</item>
</channel>
</rss>
