<?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>BigSmoke &#187; XML</title>
	<atom:link href="http://blog.bigsmoke.us/tag/xml/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.bigsmoke.us</link>
	<description>Smokes your problems, coughs fresh air.</description>
	<lastBuildDate>Sat, 04 Feb 2012 18:03:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Installing XML catalogs on Archlinux</title>
		<link>http://blog.bigsmoke.us/2010/11/07/installing-xml-catalogs-on-archlinux</link>
		<comments>http://blog.bigsmoke.us/2010/11/07/installing-xml-catalogs-on-archlinux#comments</comments>
		<pubDate>Sun, 07 Nov 2010 21:22:11 +0000</pubDate>
		<dc:creator>halfgaar</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[catalog]]></category>
		<category><![CDATA[dtd]]></category>
		<category><![CDATA[sgml]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=1676</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>
It took me forever to find the packages on Archlinux that contained the XML catalogs files for HTML and XHTML. So:
</p>

<pre class="php">aur/html-docs
aur/xhtml-docs</pre>

<p>
It installs a file in /etc/profile.d and sets SGML_CATALOG_FILES, so be sure to su &#8211; or login again.
</p>]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2010/11/07/installing-xml-catalogs-on-archlinux/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Styling XML SVN logs with CSS</title>
		<link>http://blog.bigsmoke.us/2009/05/26/styling-xml-svn-logs-with-css</link>
		<comments>http://blog.bigsmoke.us/2009/05/26/styling-xml-svn-logs-with-css#comments</comments>
		<pubDate>Tue, 26 May 2009 08:22:53 +0000</pubDate>
		<dc:creator>Rowan Rodrik</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=518</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>My friend, <a href="/author/halfgaar">Wiebe</a>, keeps <a href="http://www.halfgaar.net/">his website</a> in <a href="http://subversion.tigris.org/">Subversion</a>. (Always keep your project files in version management or you&#8217;ll be sorry.) He used to manually track the date with the last significant change in each file (because who cares about typos, right?). But, of course, he kept forgetting to update this when he actually made such changes. So, he decided that he wanted to publish the full SVN log for each page.</p>

<p>The raw SVN logs are a bit <em>raw</em>, reason enough to try to turn it in something prettier. Luckily, there&#8217;s no need to parse the log files, because <tt>svn log</tt> has a command-line option, <tt>--xml</tt>. This option causes the log file to be printed in a simple XML format:</p>

<pre class="xml"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="font-weight: bold; color: black;">?&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;log<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;logentry</span> <span style="color: #000066;">revision</span>=<span style="color: #ff0000;">&quot;345&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;author<span style="font-weight: bold; color: black;">&gt;</span></span></span>halfgaar<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/author<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;date<span style="font-weight: bold; color: black;">&gt;</span></span></span>2009-05-25T10:50:07.560914Z<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/date<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;msg<span style="font-weight: bold; color: black;">&gt;</span></span></span>Added very useful note to index about an awkward sentence.
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/msg<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/logentry<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- Snipped the rest of the logentry elements --&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/log<span style="font-weight: bold; color: black;">&gt;</span></span></span></pre>

<p>Now we can use any number of ready-to-use XML tools to process this log, but I figured that, maybe, a <em>very</em> simple solution could work: CSS. Cascasing Stylesheets can be used for more than just styling HTML. One of the few differences is that with non-HTML XML, there are no defaults for the CSS properties (and aren&#8217;t we always trying to discover and override the various browser-specific CSS defaults anyway?)</p> 

<p>First, we want to add a <tt>&lt;?xml-stylesheet?&gt;</tt> processing instruction to the log file:</p>

<pre class="bash">svn log --xml example_file.xhtml | sed -e <span style="color: #ff0000;">'/&lt;<span style="color: #000099; font-weight: bold;">\?</span>xml / a&lt;?xml-stylesheet type=&quot;text/css&quot; media=&quot;screen&quot; href=&quot;/css/svn-log.css&quot;?&gt;'</span></pre>

<p>The XML file now references the CSS file that we&#8217;re going to make:</p>

<pre class="xml"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="font-weight: bold; color: black;">?&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;?xml</span>-stylesheet <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">media</span>=<span style="color: #ff0000;">&quot;screen&quot;</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;svn-log.css&quot;</span><span style="font-weight: bold; color: black;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- snip --&gt;</span></span></pre>

<p><tt>svn-log.css:</tt></p>

<pre class="css">log <span style="color: #66cc66;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">background-color</span>: <span style="color: #993333;">white</span>;
  <span style="color: #000000; font-weight: bold;">background-image</span>: <span style="color: #993333;">url</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'http://svn.collab.net/repos/svn/trunk/notes/logo/256-colour/subversion_logo-200x173.png'</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #000000; font-weight: bold;">background-attachment</span>: <span style="color: #993333;">fixed</span>;
  <span style="color: #000000; font-weight: bold;">background-position</span>: <span style="color: #000000; font-weight: bold;">bottom</span> <span style="color: #000000; font-weight: bold;">right</span>;
  <span style="color: #000000; font-weight: bold;">background-repeat</span>: <span style="color: #993333;">no-repeat</span>;
  <span style="color: #000000; font-weight: bold;">display</span>: <span style="color: #993333;">block</span>;
  <span style="color: #000000; font-weight: bold;">margin</span>: 2em 204px 2em 5ex;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
logentry <span style="color: #66cc66;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">display</span>: <span style="color: #993333;">list-item</span>;
  <span style="color: #000000; font-weight: bold;">list-style-type</span>: <span style="color: #993333;">square</span>;
  <span style="color: #000000; font-weight: bold;">margin-bottom</span>: 1em;
  <span style="color: #000000; font-weight: bold;">font-family</span>: <span style="color: #993333;">monospace</span>;
  <span style="color: #000000; font-weight: bold;">font-size</span>: <span style="color: #993333;">normal</span>;
  <span style="color: #000000; font-weight: bold;">color</span>: #<span style="color: #cc66cc;">999</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
author <span style="color: #66cc66;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">display</span>: <span style="color: #993333;">none</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
date <span style="color: #66cc66;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">display</span>: <span style="color: #993333;">block</span>;
  <span style="color: #000000; font-weight: bold;">width</span>: 10ex;
  <span style="color: #808080; font-style: italic;">/* If Firefox would support font families even when you force a font,
     I could use 'overflow: hidden' to hide everything except the date part of &lt;date&gt;. */</span>
  <span style="color: #000000; font-weight: bold;">overflow</span>: <span style="color: #993333;">hidden</span>;
  <span style="color: #000000; font-weight: bold;">overflow</span>: <span style="color: #993333;">visible</span>; 
  <span style="color: #000000; font-weight: bold;">font-family</span>: <span style="color: #993333;">monospace</span>;
  <span style="color: #000000; font-weight: bold;">font-weight</span>: <span style="color: #993333;">bold</span>;
  <span style="color: #000000; font-weight: bold;">font-size</span>: <span style="color: #cc66cc;">110</span>%;
  <span style="color: #000000; font-weight: bold;">color</span>: #7488a7;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
msg <span style="color: #66cc66;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">display</span>: <span style="color: #993333;">block</span>;
  <span style="color: #000000; font-weight: bold;">white-space</span>: pre-wrap;
  <span style="color: #000000; font-weight: bold;">color</span>: <span style="color: #000000; font-weight: bold;">black</span>;
<span style="color: #66cc66;">&#125;</span></pre>

<p>We now have a nicely formatted log file. Other things you could do:</p>

<ul>
<li>Add styles for printing (in a separate stylesheet or by using <tt>@media</tt> blocks).</li>
<li>Display the revision author instead of hiding it.</li>
</ul>

<p>Of course, you could do all this and much more with XSLT, but that&#8217;s just all too obvious. <img src='http://blog.bigsmoke.us/wp-factory/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>

<p>If you want to see the stylesheet in action, take a look at <a href="http://www.halfgaar.net/">Wiebe&#8217;s website</a> and look for a <q>View revision log of this page</q> link in the footer of any of his pages.</p>

<div id="attachment_522" class="wp-caption alignnone" style="width: 310px"><a rel="lightbox" title="XML SVN log styled with CSS" href="http://blog.bigsmoke.us/uploads/2009/05/xml-svn-log-styled-with-css.png"><img src="http://blog.bigsmoke.us/uploads/2009/05/xml-svn-log-styled-with-css-300x207.png" alt="XML SVN log styled with CSS" title="XML SVN log styled with CSS" width="300" height="207" class="size-medium wp-image-522" /></a><p class="wp-caption-text">XML SVN log styled with CSS</p></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2009/05/26/styling-xml-svn-logs-with-css/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Moved from Mnemosyne to FlashcardDB</title>
		<link>http://blog.bigsmoke.us/2008/01/14/moved-from-mnemosyne-to-flashcarddb</link>
		<comments>http://blog.bigsmoke.us/2008/01/14/moved-from-mnemosyne-to-flashcarddb#comments</comments>
		<pubDate>Mon, 14 Jan 2008 22:26:33 +0000</pubDate>
		<dc:creator>Rowan Rodrik</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[CSV]]></category>
		<category><![CDATA[flashcard]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/2008/01/14/moved-from-mnemosyne-to-flashcarddb</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>When I was studying Spanish last year, I had to <a href="http://blog.bigsmoke.us/2007/03/02/making-flash-cards-on-line">choose a flashcard program</a> to memorize new words. At the time, I couldn&#8217;t find any on-line program that just did the job and did it well. In a <a href="http://blog.bigsmoke.us/2007/03/02/making-flash-cards-on-line#comment-7086">comment</a> on my <a href="http://blog.bigsmoke.us/2007/03/02/making-flash-cards-on-line">blog post</a> from last year, however, I was pointed by Jeff to his amazing <a href="http://flashcarddb.com/">FlashcardDB</a>.</p>

<p>The program I ended up with last year was <a href="http://mnemosyne-proj.sourceforge.net/">Mnemosyne</a>. Mnemosyne is not based on your regular <a href="http://en.wikipedia.org/wiki/Flashcard">Leitner system</a>, but rather on a concept where, after each card, you have to indicate yourself <q>how well</q> you have remembered it. I found that, in the end, having to tell the system in which box to put the card instead of just saying if my answer was right or wrong was taking me more effort than the actual recollection of the information. Also, as someone who rarely remains at one place for very long, a desktop program just isn&#8217;t as practical for me as an online program.</p>

<p style="width: 400px;"><a title="With Mnemosyne, I had to constantly remind myself of a complicated grading system." href="http://blog.bigsmoke.us/uploads/2008/01/mnemosyne-full.jpg" rel="lightbox"><img src='http://blog.bigsmoke.us/uploads/2008/01/mnemosyne1.jpg' alt='Mnemosyne' /></a><br /><small class="caption">With Mnemosyne, I had to constantly remind myself of a complicated grading system.</small></p>

<p>Now to FlashcardDB. The site is pretty social, which means that you can study (and sometimes even edit) card sets made by other users. When you sign up, you can also create card sets yourself. Card sets can be tagged and you can study these tags instead of individual card sets if you wish. If you already have cards somewhere else, import is easy as well.</p>

<p>The user interface is very slick, especially for such a new program. Thoughtful usage of AJAX means that you&#8217;re never distracted by page reloads when this would interrupt your flow of thought. Simple key bindings making studying an easier affair than in most desktop programs. The right arrow is used to show the answer, the up arrow (thumbs up) to mark the answer as correct, the down arrow (thumbs down) to mark the answer incorrect and the left arrow to go back to the previous card. Also the interface for adding cards is very pleasant. It&#8217;s just a matter of filling in the front of the card, pressing Tab, filling in the back of the card, pressing Tab, then Enter and on the next card.</p>

<p>Before going on to the conclusion, I want to add that also the Leitner system is very well implemented in FlashcardDB, including pretty diagrams to make it instantly clear to everyone how the system works. Now for my conclusion: My advice if you ever need to make flashcards yourself is that you really should take a look at <a href="http://flashcarddb.com/">FlashcardDB</a> before looking at anything else.</p>

<p>Finally, the following Ruby code is a quick hack I used to convert Mnemosyne&#8217;s XML export to CSV data which can be imported by FlashcardDB:</p>

<pre class="ruby"><span style="color:#008000; font-style:italic;">#!/usr/bin/ruby</span>
&nbsp;
<span style="color:#CC0066; font-weight:bold;">require</span> 'rexml/document'
<span style="color:#CC0066; font-weight:bold;">require</span> 'csv'
&nbsp;
xmldoc = REXML::Document.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>$stdin<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
CSV::Writer.<span style="color:#9900CC;">generate</span><span style="color:#006600; font-weight:bold;">&#40;</span>$stdout<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> |csv|
  xmldoc.<span style="color:#9900CC;">each_element</span><span style="color:#006600; font-weight:bold;">&#40;</span>'//item'<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> |el|
    csv &lt;&lt; <span style="color:#006600; font-weight:bold;">&#91;</span>  el.<span style="color:#9900CC;">elements</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span>,'Q'<span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">text</span>, el.<span style="color:#9900CC;">elements</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span>,'A'<span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">text</span>  <span style="color:#006600; font-weight:bold;">&#93;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre>

]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2008/01/14/moved-from-mnemosyne-to-flashcarddb/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

