<?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: oddmuse</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>Fri, 24 May 2013 08:41:53 GMT</pubDate>
<lastBuildDate>Fri, 24 May 2013 08:41:53 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: oddmuse</title>
<link>http://alexschroeder.ch/wiki</link>
</image>

<item>
<title>Javascript</title>
<link>http://alexschroeder.ch/wiki/2013-01-14_Javascript</link>
<guid>http://alexschroeder.ch/wiki/2013-01-14_Javascript</guid>
<description>&lt;p&gt;I just rewrote my &lt;a class="inter Self outside" href="/wiki?action=tagcloud"&gt;Tag Cloud&lt;/a&gt; to use the &lt;a class="url http outside" href="https://developers.google.com/chart/interactive/docs/gallery/treemap"&gt;Google Treemap&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;What it does is the following:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;The &lt;code&gt;cloud&lt;/code&gt; action runs the old code (text representation).&lt;/li&gt;&lt;li&gt;The &lt;code&gt;tagcloud&lt;/code&gt; action runs the new code.&lt;/li&gt;&lt;li&gt;The new code basically takes the example &lt;a class="url http outside" href="https://developers.google.com/chart/interactive/docs/gallery/treemap"&gt;Google Treemap&lt;/a&gt; and replaces the data with my tags. These tags are not nested.&lt;/li&gt;&lt;li&gt;On click, we call the &lt;code&gt;tag&lt;/code&gt; action which shows the last blog pages with that tag.&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;Try it! &amp;#x2192;&amp;#x00a0;&lt;a class="inter Self outside" href="/wiki?action=tagcloud"&gt;Tag Cloud&lt;/a&gt;. (I realize that the tag cloud isn&amp;#x2019;t very interesting in and of itself. I just enjoyed using the Google tools and learning a little bit of Javascript on the way.)&lt;/p&gt;&lt;pre class="real"&gt;$Action{cloud} = $Action{tagcloud};
$Action{tagcloud} = \&amp;amp;MyTagCloud;

sub MyTagCloud {
  print GetHeader('', T('Tag Cloud'), '');
  # open the DB file
  require DB_File;
  tie %h, "DB_File", $TagFile;
  my $max = 0;
  my $min = 0;
  my %count = ();
  foreach my $tag (grep !/^_/, keys %h) {
    $count{$tag} = split(/$FS/, $h{$tag});
    $max = $count{$tag} if $count{$tag} &amp;gt; $max;
    $min = $count{$tag} if not $min or $count{$tag} &amp;lt; $min;
  }
  untie %h;
  # ignore 90% of all tags
  my @values = sort values %count;
  $min = GetParam('min', $values[int($#values * 0.9)]);
  # https://developers.google.com/chart/interactive/docs/gallery/treemap
  print &amp;lt;&amp;lt;EOT;
    &amp;lt;script type="text/javascript" src="https://www.google.com/jsapi"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script type="text/javascript"&amp;gt;
      google.load("visualization", "1", {packages:["treemap"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        // Create and populate the data table.
        var data = google.visualization.arrayToDataTable([
          ['Location', 'Parent', 'Mentions', ''],
          ['Tags', null, 0, 0],
EOT
  foreach my $tag (sort keys %count) {
    my $n = $count{$tag};
    next unless $n &amp;gt; $min;
    print "          ['$tag', 'Tags', $n, 0],\n";
  }
  print &amp;lt;&amp;lt;EOT;
        ]);
        // Create and draw the visualization.
        var tree = new google.visualization.TreeMap(document.getElementById('treemap'));
        tree.draw(data);
        google.visualization.events.addListener(tree, 'select', selectHandler);
        function selectHandler() {
          var selection = tree.getSelection();
          var item = selection[0];
          window.location = "/alex?action=tag;id=" + data.getValue(item.row,0);
        }
      }
    &amp;lt;/script&amp;gt;
EOT
  print $q-&amp;gt;start_div({-class=&amp;gt;'content cloud'});
  print $q-&amp;gt;p(ScriptLink('action=tagcloud;min=0', T('Include all tags')),
              Ts('(currently showing tags with more than %s occurences)', $min));
  print $q-&amp;gt;p(Ts('Or switch to a %s.', ScriptLink('action=cloud', T('text format'))));
  print $q-&amp;gt;start_div({-id=&amp;gt;'treemap', -style=&amp;gt;'height: 1000px;'});
  print $q-&amp;gt;end_div();
  print $q-&amp;gt;end_div();
  PrintFooter();
}&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=Oddmuse"&gt;Oddmuse&lt;/a&gt; &lt;a class="feed tag" title="Feed für diesen Tag" rel="feed" href="http://www.emacswiki.org/alex/feed/full/Oddmuse"&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=Javascript"&gt;Javascript&lt;/a&gt; &lt;a class="feed tag" title="Feed für diesen Tag" rel="feed" href="http://www.emacswiki.org/alex/feed/full/Javascript"&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=Google"&gt;Google&lt;/a&gt; &lt;a class="feed tag" title="Feed für diesen Tag" rel="feed" href="http://www.emacswiki.org/alex/feed/full/Google"&gt;&lt;img src="http://www.emacswiki.org/alex/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt;&lt;/p&gt;</description>
<pubDate>Mon, 14 Jan 2013 10:02:00 GMT</pubDate>
<comments>http://alexschroeder.ch/wiki/Comments_on_2013-01-14_Javascript</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-14_Javascript</wiki:history>
<wiki:diff>http://alexschroeder.ch/wiki?action=browse;diff=1;id=2013-01-14_Javascript</wiki:diff>
<category>Oddmuse</category>
<category>Javascript</category>
<category>Google</category>
</item>

<item>
<title>Two-step verification</title>
<link>http://alexschroeder.ch/wiki/2012-08-14_Two-step_verification</link>
<guid>http://alexschroeder.ch/wiki/2012-08-14_Two-step_verification</guid>
<description>&lt;p&gt;My websites have not been sending any email notifications out to people who had subscribed to page edits. The reason was that I had switched my Google account to use &lt;a class="url http outside" href="http://support.google.com/accounts/bin/answer.py?hl=en&amp;amp;answer=180744"&gt;2-step verification&lt;/a&gt;. Only today did I realize that the error messages were trying to tell me that I needed an &lt;em style="font-style: normal; letter-spacing: 0.125em; padding-left: 0.125em;"&gt;application specific password&lt;/em&gt; for my script.&lt;/p&gt;&lt;p&gt;Everything should be back in working order. &lt;img class="smiley" src="http://www.emacswiki.org/pics/smile.png" alt=":)" /&gt;&lt;/p&gt;&lt;p&gt;I feel relieved. For a while I thought I&amp;#x2019;d have to &lt;a class="local" href="http://alexschroeder.ch/wiki/2009-10-02_I_hate_the_Perl_SMTP_libraries"&gt;dig around in the Perl SMTP libraries&lt;/a&gt;. Ugh!&lt;/p&gt;&lt;p&gt;And I feel much better with 2-step verification. The &lt;a class="url http outside" href="http://www.wired.com/gadgetlab/2012/08/apple-amazon-mat-honan-hacking/"&gt;Mat Honan story&lt;/a&gt; was scary.&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=Oddmuse"&gt;Oddmuse&lt;/a&gt; &lt;a class="feed tag" title="Feed für diesen Tag" rel="feed" href="http://www.emacswiki.org/alex/feed/full/Oddmuse"&gt;&lt;img src="http://www.emacswiki.org/alex/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt;&lt;/p&gt;</description>
<pubDate>Tue, 14 Aug 2012 12:28:27 GMT</pubDate>
<comments>http://alexschroeder.ch/wiki/Comments_on_2012-08-14_Two-step_verification</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-14_Two-step_verification</wiki:history>
<wiki:diff>http://alexschroeder.ch/wiki?action=browse;diff=1;id=2012-08-14_Two-step_verification</wiki:diff>
<category>Oddmuse</category>
</item>

<item>
<title>Tinkering with the CSS</title>
<link>http://alexschroeder.ch/wiki/2012-03-07_Tinkering_with_the_CSS</link>
<guid>http://alexschroeder.ch/wiki/2012-03-07_Tinkering_with_the_CSS</guid>
<description>&lt;p&gt;I&amp;#x2019;ve started tinkering with the CSS again. No more secret theme switching by clicking on my face up there. &lt;img class="smiley" src="http://www.emacswiki.org/pics/smile.png" alt=":)" /&gt;&lt;/p&gt;&lt;p&gt;I&amp;#x2019;m going for black and white and the default blue for all links. The previous classification for site links, links to sister sites, links to Wikipedia and all other links didn&amp;#x2019;t really work with all the redirections I had implemented. Thus, be gone!&lt;/p&gt;&lt;p&gt;I&amp;#x2019;m sticking to &lt;a class="near" title="Wikipedia" href="http://en.wikipedia.org/wiki/Garamond"&gt;Garamond&lt;/a&gt; as my favorite font even though I must admit it looks absolutely horrible when viewed on Windows without &lt;a class="url http outside" href="https://www.microsoft.com/typography/cleartypeinfo.mspx"&gt;Clear Type&lt;/a&gt;. Oh well! Most people will be reading the site via a feed reader anyway, I guess.&lt;/p&gt;&lt;p&gt;I&amp;#x2019;ll also try to stick to a larger than average font-size. I haven&amp;#x2019;t decided whether I should be using &lt;a class="url http outside" href="https://www.google.com/webfonts#ChoosePlace:select"&gt;Google Web Fonts&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Let me know if there is something you&amp;#x2019;d like to see changed. &lt;img class="smiley" src="http://www.emacswiki.org/pics/smile.png" alt=":)" /&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=Oddmuse"&gt;Oddmuse&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/Oddmuse"&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=CSS"&gt;CSS&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/CSS"&gt;&lt;img src="http://alexschroeder.ch/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt;&lt;/p&gt;</description>
<pubDate>Wed, 07 Mar 2012 17:52:04 GMT</pubDate>
<comments>http://alexschroeder.ch/wiki/Comments_on_2012-03-07_Tinkering_with_the_CSS</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-03-07_Tinkering_with_the_CSS</wiki:history>
<wiki:diff>http://alexschroeder.ch/wiki?action=browse;diff=1;id=2012-03-07_Tinkering_with_the_CSS</wiki:diff>
<category>Oddmuse</category>
<category>CSS</category>
</item>

<item>
<title>Oddmuse Channel</title>
<link>http://alexschroeder.ch/wiki/2012-02-02_Oddmuse_Channel</link>
<guid>http://alexschroeder.ch/wiki/2012-02-02_Oddmuse_Channel</guid>
<description>&lt;p&gt;This is why I like the Oddmuse channel on Freenode so much&amp;#x2026; &lt;img class="smiley" src="http://www.emacswiki.org/pics/smile.png" alt=":)" /&gt;&lt;/p&gt;&lt;dl class="irc"&gt;&lt;dt&gt;&lt;span class="time"&gt;16:51  &lt;/span&gt;&lt;b&gt;CapnDan&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;Honestly I don&amp;#x2019;t understand why people get so religious about different versions of Unix. &lt;/dd&gt;&lt;dt&gt;&lt;span class="time"&gt;16:52  &lt;/span&gt;&lt;b&gt;kensanata&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;Everybody likes to imagine that their decision was rational. &lt;/dd&gt;&lt;dt&gt;&lt;span class="time"&gt;16:52  &lt;/span&gt;&lt;b&gt;kensanata&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;Therefore they infuse the first decision and the facts that influenced it with overproportional importance. &lt;/dd&gt;&lt;dt&gt;&lt;span class="time"&gt;16:52  &lt;/span&gt;&lt;b&gt;kensanata&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;NETBSD IS THE ONLY SECURE OPERATING SYSTEM!!!! &lt;/dd&gt;&lt;dt&gt;&lt;span class="time"&gt;16:53  &lt;/span&gt;&lt;b&gt;CapnDan&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;yeah, there&amp;#x2019;s a name for that, I was reading about it a few months ago. &lt;/dd&gt;&lt;dt&gt;&lt;span class="time"&gt;16:53  &lt;/span&gt;&lt;b&gt;CapnDan&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;A popular psychology word from last year. &lt;/dd&gt;&lt;dt&gt;&lt;span class="time"&gt;16:53  &lt;/span&gt;&lt;b&gt;kensanata&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;&amp;#x201c;Moron Syndrome&amp;#x201d;? &lt;/dd&gt;&lt;dt&gt;&lt;span class="time"&gt;16:53  &lt;/span&gt;&lt;b&gt;CapnDan&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;lol&lt;/dd&gt;&lt;/dl&gt;&lt;p&gt;(Dan later discovers that the term he was looking for is &lt;a class="near" title="Wikipedia" href="http://en.wikipedia.org/wiki/cognitive_inertia"&gt;cognitive inertia&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=Oddmuse"&gt;Oddmuse&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/Oddmuse"&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=IRC"&gt;IRC&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/IRC"&gt;&lt;img src="http://alexschroeder.ch/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt;&lt;/p&gt;</description>
<pubDate>Thu, 02 Feb 2012 15:55:15 GMT</pubDate>
<comments>http://alexschroeder.ch/wiki/Comments_on_2012-02-02_Oddmuse_Channel</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-02-02_Oddmuse_Channel</wiki:history>
<wiki:diff>http://alexschroeder.ch/wiki?action=browse;diff=1;id=2012-02-02_Oddmuse_Channel</wiki:diff>
<category>Oddmuse</category>
<category>IRC</category>
</item>

<item>
<title>Oddmuse, Venus and Perl</title>
<link>http://alexschroeder.ch/wiki/2011-10-07_Oddmuse%2c_Venus_and_Perl</link>
<guid>http://alexschroeder.ch/wiki/2011-10-07_Oddmuse%2c_Venus_and_Perl</guid>
<description>&lt;div class="right" style="float: right"&gt;&lt;p&gt;&lt;img class="url http" src="http://www.emacswiki.org/pics/oddmuse-logo.png" alt="http://www.emacswiki.org/pics/oddmuse-logo.png" /&gt;&lt;/p&gt;&lt;/div&gt;&lt;p&gt;I&amp;#x2019;ve been working on a &lt;a class="url http outside" href="http://campaignwiki.org/submit"&gt;submission form&lt;/a&gt; for the &lt;a class="near" title="Names" href="http://campaignwiki.org/planet"&gt;Old School RPG Planet&lt;/a&gt;. Today I added another little feature. This is how I like to develop code. No time pressure. One little step at a time. Keep polishing it.&lt;/p&gt;&lt;p&gt;The planet uses &lt;a class="url http outside" href="http://intertwingly.net/code/venus/"&gt;Planet Venus&lt;/a&gt; to collect the RSS and Atom feeds of many of the Old School RPG blogs out there. Planet Venus allows you to get the list of feeds via an URL. I&amp;#x2019;m hosting the &lt;a class="url http outside" href="http://campaignwiki.org/wiki/Planet/Feeds"&gt;list of feeds on Campaign Wiki&lt;/a&gt; itself (&lt;a class="url http outside" href="http://campaignwiki.org/wiki/Planet/raw/Feeds"&gt;raw format&lt;/a&gt;). As you can see, it the format doesn&amp;#x2019;t look nice.&lt;/p&gt;&lt;p&gt;The thing I did, therefore, was to write a script that makes it easy for people who are not into the technical details to submit new blogs. It also makes it easier for me to submit new blogs!&lt;/p&gt;&lt;p&gt;The things it handles:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;If you submit an invalid URL, it will prepend &lt;code&gt;http://&lt;/code&gt; and try again.&lt;/li&gt;&lt;li&gt;If it looks like we already have a similar looking feed on our page, it requires a confirmation by the user.&lt;/li&gt;&lt;li&gt;If you submit a web page, it will look for alternative links with MIME types &lt;code&gt;application/rss+xml&lt;/code&gt;, &lt;code&gt;application/atom+xml&lt;/code&gt;, &lt;code&gt;application/xml&lt;/code&gt; (yeah) and &lt;code&gt;text/xml&lt;/code&gt; (just making sure) and allow the user to pick one of them.&lt;/li&gt;&lt;li&gt;If you submitted a feed directly instead of a web page, it it uses that instead.&lt;/li&gt;&lt;li&gt;If the feed you picked is served with an invalid content type, it is rejected.&lt;/li&gt;&lt;li&gt;It extracts the title of the feed and adds it to the wiki page, sorting all the entries alphabetically.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;I think it&amp;#x2019;s pretty cool.&lt;/p&gt;&lt;p&gt;If you look at the interface, you&amp;#x2019;ll note that it has &lt;a class="url http outside" href="http://campaignwiki.org/submit/source"&gt;a link to its own source code&lt;/a&gt;. I love this little Perl trick:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Add &lt;code&gt;__DATA__&lt;/code&gt; at the end of the source file. Usually you would add actual data at the end. The script could read it using the DATA file handle.&lt;/li&gt;&lt;li&gt;Serve source code using &lt;code&gt;seek DATA, 0, 0; print "Content-type: text/plain; charset=UTF-8\r\n\r\n", &amp;lt;DATA&amp;gt;;&lt;/code&gt; This resets the current position of the DATA file handle to the beginning of the source file. Tadaa! &lt;img class="smiley" src="http://www.emacswiki.org/pics/smile.png" alt=":)" /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;Tags: &lt;a class="outside tag" title="Tag" rel="tag" href="http://www.emacswiki.org/alex?action=tag;id=Oddmuse"&gt;Oddmuse&lt;/a&gt; &lt;a class="feed tag" title="Feed für diesen Tag" rel="feed" href="http://www.emacswiki.org/alex/feed/full/Oddmuse"&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=Venus"&gt;Venus&lt;/a&gt; &lt;a class="feed tag" title="Feed für diesen Tag" rel="feed" href="http://www.emacswiki.org/alex/feed/full/Venus"&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=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=Wiki"&gt;Wiki&lt;/a&gt; &lt;a class="feed tag" title="Feed für diesen Tag" rel="feed" href="http://www.emacswiki.org/alex/feed/full/Wiki"&gt;&lt;img src="http://www.emacswiki.org/alex/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt;&lt;/p&gt;</description>
<pubDate>Fri, 07 Oct 2011 20:10:58 GMT</pubDate>
<comments>http://alexschroeder.ch/wiki/Comments_on_2011-10-07_Oddmuse%2c_Venus_and_Perl</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=2011-10-07_Oddmuse%2c_Venus_and_Perl</wiki:history>
<wiki:diff>http://alexschroeder.ch/wiki?action=browse;diff=1;id=2011-10-07_Oddmuse%2c_Venus_and_Perl</wiki:diff>
<category>Oddmuse</category>
<category>Venus</category>
<category>Perl</category>
<category>Wiki</category>
</item>

<item>
<title>Regular Expression To Validate Id Attributes</title>
<link>http://alexschroeder.ch/wiki/2011-07-06_Regular_Expression_To_Validate_Id_Attributes</link>
<guid>http://alexschroeder.ch/wiki/2011-07-06_Regular_Expression_To_Validate_Id_Attributes</guid>
<description>&lt;p&gt;I noticed that my blog no longer validated as XHTML 1.0 and I started investigating. On the &lt;a class="local" href="http://alexschroeder.ch/wiki/Diary"&gt;Diary&lt;/a&gt; page, you can click on the comment links of the various blog posts (such as &lt;em style="text-decoration: underline; font-style: normal;"&gt;Comments on 2011-07-05 Google Plus&lt;/em&gt;) and you&amp;#x2019;ll get the comments &lt;em&gt;inlined&lt;/em&gt;. This uses a tiny piece of javascript (and some CSS):&lt;/p&gt;&lt;pre class="real"&gt;function togglecomments (id) {
   var elem = document.getElementById(id);
   if (elem.className=="commentshown") {
      elem.className="commenthidden";
   }
   else {
      elem.className="commentshown";
   }
}&lt;/pre&gt;&lt;p&gt;Thus, the HTML source already includes the comments in an appropriate div:&lt;/p&gt;&lt;pre class="real"&gt;&amp;lt;div class="commenthidden" id="Comments_on_2011-07-05_Google_Plus"&amp;gt;
…
&amp;lt;/div&amp;gt;&lt;/pre&gt;&lt;p&gt;Links such as &lt;em style="text-decoration: underline; font-style: normal;"&gt;Comments on 2011-07-05 Google Plus&lt;/em&gt; will simply call the javascript function defined above and pass the &lt;b&gt;id&lt;/b&gt; of the div to toggle:&lt;/p&gt;&lt;pre class="real"&gt;&amp;lt;a href="javascript:togglecomments('Comments_on_2011-07-05_Google_Plus')"&amp;gt;Comments on 2011-07-05 Google Plus&amp;lt;/a&amp;gt;&lt;/pre&gt;&lt;p&gt;That&amp;#x2019;s why the id attribute is important. The trivial solution is to simply use the blog post title (&amp;#x201c;2011-07-05 Google Plus&amp;#x201d;) but soon enough you&amp;#x2019;ll note that there are some interesting restrictions on the values of id attributes:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;may start with a colon, a letter, or underscore&lt;/li&gt;&lt;li&gt;the rest of the name may contain the above and dashes, periods, and numbers&lt;/li&gt;&lt;li&gt;brackets, braces, and parenthesis are not allowed&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Now—how exactly is this defined? See the definition of &lt;a class="url http outside" href="http://www.w3.org/TR/xml/#NT-Name"&gt;Name&lt;/a&gt; in the XML spec:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;code&gt;NameStartChar	   ::=   	":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;NameChar	   ::=   	NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;Name	   ::=   	NameStartChar (NameChar)*&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Now, those are Unicode code points. But sadly, &lt;a class="local" href="http://alexschroeder.ch/wiki/Oddmuse"&gt;Oddmuse&lt;/a&gt; tries to be encoding &lt;em&gt;agnostic&lt;/em&gt;. (I will have to revisit this decision, soon!)&lt;/p&gt;&lt;p&gt;Here&amp;#x2019;s a simple beginning of a regular expression that would identify well-formed names: &lt;code&gt;/^[:_A-Za-z][-.:_A-Za-z0-9]*/&lt;/code&gt;&lt;/p&gt;&lt;p&gt;Now to extend it using the information above:&lt;/p&gt;&lt;pre class="real"&gt;   Unicode Codepoint   UTF-8 encoding
   [#xC0-#xD6]              c3 80 - c3 96
   [#xD8-#xF6]              c3 98 - c3 b6
   [#xF8-#x2FF]             c3 b8 - cb bf
   [#x370-#x37D]            cd b0 - cd bd
   [#x37F-#x1FFF]           cd bf - e1 bf bf
   [#x200C-#x200D]       e2 80 8c - e2 80 8d
   [#x2070-#x218F]       e2 81 b0 - e2 86 8f
   [#x2C00-#x2FEF]       e2 b0 80 - e2 bf af
   [#x3001-#xD7FF]       e3 80 81 - ed 9f bf
   [#xF900-#xFDCF]       ef a4 80 - ef b7 8f
   [#xFDF0-#xFFFD]       ef b7 b0 - ef bf bd
   [#x10000-#xEFFFF]  f0 90 80 80 - f3 af bf bf&lt;/pre&gt;&lt;p&gt;I started writing the following regular expression:&lt;/p&gt;&lt;pre class="real"&gt;$regexp = "|\xc3[\x80-\x96\x98-\xb6\xb8-\xff]|[\xc4-\xca].|\xcb[\x00-\xbf]"
        . "|\xcd[\xb0-\xbd\xbf-\xff]|[\xce-\xDF].|\xe0..|\xe1[\x00-\xbe]."
        . "|\xe1\xbf[\x00-\xbf]|\xe2\x80[\x8c\x8d]"
    if $HttpCharset eq 'UTF-8';
$id = ":$id" unless $id =~ /^[:_A-Za-z]$regexp/;
return join('', $id =~ m/([-.:_A-Za-z0-9]$regexp)/g);&lt;/pre&gt;&lt;p&gt;Then I got tired and though, &amp;#x201c;if anybody reports an error, I&amp;#x2019;ll add the rest…&amp;#x201d;&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=Web"&gt;Web&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://www.emacswiki.org/alex/feed/full/Web"&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=XML"&gt;XML&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://www.emacswiki.org/alex/feed/full/XML"&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=Oddmuse"&gt;Oddmuse&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://www.emacswiki.org/alex/feed/full/Oddmuse"&gt;&lt;img src="http://www.emacswiki.org/alex/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt;&lt;/p&gt;</description>
<pubDate>Wed, 06 Jul 2011 19:20:56 GMT</pubDate>
<comments>http://alexschroeder.ch/wiki/Comments_on_2011-07-06_Regular_Expression_To_Validate_Id_Attributes</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=2011-07-06_Regular_Expression_To_Validate_Id_Attributes</wiki:history>
<wiki:diff>http://alexschroeder.ch/wiki?action=browse;diff=1;id=2011-07-06_Regular_Expression_To_Validate_Id_Attributes</wiki:diff>
<category>Web</category>
<category>XML</category>
<category>Oddmuse</category>
</item>

<item>
<title>Spam</title>
<link>http://alexschroeder.ch/wiki/2011-01-24_Spam</link>
<guid>http://alexschroeder.ch/wiki/2011-01-24_Spam</guid>
<description>&lt;p&gt;Wow, what a spam storm! I rolled back all those changes and locked the wiki for the moment. There&amp;#x2019;s no fighting a bot manually. &lt;img class="smiley" src="http://www.emacswiki.org/pics/smile.png" alt=":)" /&gt;&lt;/p&gt;&lt;p&gt;I&amp;#x2019;ll look into what allowed this to happen later today and hopefully enable page editing and commenting again. &lt;img class="smiley" src="http://www.emacswiki.org/pics/blink.png" alt=";-)" /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Update&lt;/b&gt;: IP number blocked, lock removed. That was weird. &lt;img class="smiley" src="http://www.emacswiki.org/pics/vee.png" alt="vee" /&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=Spam"&gt;Spam&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/Spam"&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=Wiki"&gt;Wiki&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/Wiki"&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=Oddmuse"&gt;Oddmuse&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/Oddmuse"&gt;&lt;img src="http://alexschroeder.ch/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt;&lt;/p&gt;</description>
<pubDate>Mon, 24 Jan 2011 08:33:23 GMT</pubDate>
<comments>http://alexschroeder.ch/wiki/Comments_on_2011-01-24_Spam</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=2011-01-24_Spam</wiki:history>
<wiki:diff>http://alexschroeder.ch/wiki?action=browse;diff=1;id=2011-01-24_Spam</wiki:diff>
<category>Spam</category>
<category>Wiki</category>
<category>Oddmuse</category>
</item>

<item>
<title>Postprocessing Twitter Feeds</title>
<link>http://alexschroeder.ch/wiki/2009-08-31_Postprocessing_Twitter_Feeds</link>
<guid>http://alexschroeder.ch/wiki/2009-08-31_Postprocessing_Twitter_Feeds</guid>
<description>&lt;p&gt;On &lt;a class="inter Community" href="http://www.communitywiki.org/cw/AlexSchroeder"&gt;&lt;span class="site"&gt;Community&lt;/span&gt;&lt;span class="separator"&gt;:&lt;/span&gt;&lt;span class="page"&gt;AlexSchroeder&lt;/span&gt;&lt;/a&gt; I include my Twitter feed. In order to strip the unfortunate duplication of title and description, and in order to strip my username from the feed, I wrote &lt;a class="url http outside" href="http://emacswiki.org/scripts/twitter"&gt;a little proxy&lt;/a&gt; which will remove the description if it matches the title and which will remove the username if possible.&lt;/p&gt;&lt;p&gt;Compare:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;a class="url http outside" href="http://twitter.com/statuses/user_timeline/14477433.rss"&gt;my Twitter feed as-is&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class="url http outside" href="http://emacswiki.org/cgi-bin/twitter?url=http%3A%2F%2Ftwitter.com%2Fstatuses%2Fuser_timeline%2F14477433.rss&amp;amp;Strip+username=on"&gt;the same feed, stripped&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;Cheers. &lt;img class="smiley" src="http://www.emacswiki.org/pics/smile.png" alt=":)" /&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=Oddmuse"&gt;Oddmuse&lt;/a&gt; &lt;a class="feed tag" title="Feed für diesen Tag" rel="feed" href="http://www.emacswiki.org/alex?action=journal;full=1;search=tag:Oddmuse"&gt;&lt;img src="http://www.emacswiki.org/alex/pics/rss.png" /&gt;&lt;/a&gt;&lt;/p&gt;</description>
<pubDate>Mon, 31 Aug 2009 10:45:21 GMT</pubDate>
<comments>http://alexschroeder.ch/wiki/Comments_on_2009-08-31_Postprocessing_Twitter_Feeds</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=2009-08-31_Postprocessing_Twitter_Feeds</wiki:history>
<wiki:diff>http://alexschroeder.ch/wiki?action=browse;diff=1;id=2009-08-31_Postprocessing_Twitter_Feeds</wiki:diff>
<category>Oddmuse</category>
</item>

<item>
<title>Oddmuse Footer</title>
<link>http://alexschroeder.ch/wiki/2009-08-26_Oddmuse_Footer</link>
<guid>http://alexschroeder.ch/wiki/2009-08-26_Oddmuse_Footer</guid>
<description>&lt;p&gt;I&amp;#x2019;m thinking about not using a goto bar at the bottom of my pages:&lt;/p&gt;&lt;pre class="real"&gt;# show goto bar only once                                                       
*MyOldGetGotoBar = *GetGotoBar;
*GetGotoBar = *MyNewGetGotoBar;
my $MyGetGotoBar = 0;
sub MyNewGetGotoBar {
  return MyOldGetGotoBar(@_) unless $MyGetGotoBar++;
  return '';
}
# get rid of extra break                                                        
*MyOldGetFooterLinks = *GetFooterLinks;
*GetFooterLinks = *MyNewGetFooterLinks;
sub MyNewGetFooterLinks {
  my $html = MyOldGetFooterLinks(@_);
  $html =~ s!&amp;lt;br /&amp;gt;!!;
  return $html;
}&lt;/pre&gt;&lt;p&gt;The reason I started thinking about it is a. I hardly use the links in the footer and b. the link to the &lt;em style="text-decoration: underline; font-style: normal;"&gt;comments&lt;/em&gt; tends to get lost, visually.&lt;/p&gt;&lt;p&gt;What do you think?&lt;/p&gt;&lt;p&gt;Tags: &lt;a class="outside tag" title="Tag" rel="tag" href="http://alexschroeder.ch/wiki?action=tag;id=Oddmuse"&gt;Oddmuse&lt;/a&gt; &lt;a class="feed tag" title="Feed for this tag" rel="feed" href="http://alexschroeder.ch/wiki/feed/full/Oddmuse"&gt;&lt;img src="http://alexschroeder.ch/pics/rss.png" alt="RSS" /&gt;&lt;/a&gt;&lt;/p&gt;</description>
<pubDate>Wed, 26 Aug 2009 16:54:44 GMT</pubDate>
<comments>http://alexschroeder.ch/wiki/Comments_on_2009-08-26_Oddmuse_Footer</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=2009-08-26_Oddmuse_Footer</wiki:history>
<wiki:diff>http://alexschroeder.ch/wiki?action=browse;diff=1;id=2009-08-26_Oddmuse_Footer</wiki:diff>
<category>Oddmuse</category>
</item>

<item>
<title>Strange Perl Issue</title>
<link>http://alexschroeder.ch/wiki/2009-08-03_Strange_Perl_Issue</link>
<guid>http://alexschroeder.ch/wiki/2009-08-03_Strange_Perl_Issue</guid>
<description>&lt;p&gt;Today I had to make the following change to &lt;a class="local" href="http://alexschroeder.ch/wiki/Oddmuse"&gt;Oddmuse&lt;/a&gt; because that fixes an image upload issue on my dad&amp;#x2019;s blog. What&amp;#x2019;s going on? He&amp;#x2019;s using the following:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Apache/2.2.3 (Debian) DAV/2 SVN/1.4.2 mod_jk/1.2.18 mod_ssl/2.2.3 OpenSSL/0.9.8c mod_wsgi/2.3 Python/2.5&lt;/li&gt;&lt;li&gt;Perl v5.8.8&lt;/li&gt;&lt;li&gt;CGI: 3.15&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Any ideas? The net result was that &lt;code&gt;&amp;lt;$file&amp;gt;&lt;/code&gt; resulted in no content if run within the eval block.&lt;/p&gt;&lt;pre class="real"&gt;*** wiki.pl.~1.925.~	Fri Jul  3 11:23:01 2009
--- wiki.pl	Tue Aug  4 00:20:26 2009
***************
*** 3548,3554 ****
      $type = $q-&amp;gt;uploadInfo($filename)-&amp;gt;{'Content-Type'};
      ReportError(T('Browser reports no file type.'), '415 UNSUPPORTED MEDIA TYPE') unless $type;
      local $/ = undef;   # Read complete files
!     eval { require MIME::Base64; $_ = MIME::Base64::encode(&amp;lt;$file&amp;gt;) };
      $string = '#FILE ' . $type . "\n" . $_;
    } else {
      $string = AddComment($old, $comment) if $comment;
--- 3548,3555 ----
      $type = $q-&amp;gt;uploadInfo($filename)-&amp;gt;{'Content-Type'};
      ReportError(T('Browser reports no file type.'), '415 UNSUPPORTED MEDIA TYPE') unless $type;
      local $/ = undef;   # Read complete files
!     my $content = &amp;lt;$file&amp;gt;; # Apparently we cannot count on &amp;lt;$file&amp;gt; to always work within the eval!?
!     eval { require MIME::Base64; $_ = MIME::Base64::encode($content) };
      $string = '#FILE ' . $type . "\n" . $_;
    } else {
      $string = AddComment($old, $comment) if $comment;&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=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?action=journal;full=1;search=tag:Perl"&gt;&lt;img src="http://www.emacswiki.org/alex/pics/rss.png" /&gt;&lt;/a&gt; &lt;a class="outside tag" title="Tag" rel="tag" href="http://www.emacswiki.org/alex?action=tag;id=Oddmuse"&gt;Oddmuse&lt;/a&gt; &lt;a class="feed tag" title="Feed für diesen Tag" rel="feed" href="http://www.emacswiki.org/alex?action=journal;full=1;search=tag:Oddmuse"&gt;&lt;img src="http://www.emacswiki.org/alex/pics/rss.png" /&gt;&lt;/a&gt;&lt;/p&gt;</description>
<pubDate>Mon, 03 Aug 2009 22:29:18 GMT</pubDate>
<comments>http://alexschroeder.ch/wiki/Comments_on_2009-08-03_Strange_Perl_Issue</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=2009-08-03_Strange_Perl_Issue</wiki:history>
<wiki:diff>http://alexschroeder.ch/wiki?action=browse;diff=1;id=2009-08-03_Strange_Perl_Issue</wiki:diff>
<category>Perl</category>
<category>Oddmuse</category>
</item>
</channel>
</rss>
