<?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>Elvis Stansvik &#187; Uncategorized</title>
	<atom:link href="http://estan.dose.se/category/uncategorized/feed" rel="self" type="application/rss+xml" />
	<link>http://estan.dose.se</link>
	<description>Random stuff on my mind, or reports from my trips</description>
	<lastBuildDate>Fri, 11 Nov 2011 19:36:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
		<item>
		<title>A Story with a Happy Ending</title>
		<link>http://estan.dose.se/2011/07/a-story-with-a-happy-ending</link>
		<comments>http://estan.dose.se/2011/07/a-story-with-a-happy-ending#comments</comments>
		<pubDate>Fri, 08 Jul 2011 13:18:44 +0000</pubDate>
		<dc:creator>estan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gsoc]]></category>
		<category><![CDATA[planetkde]]></category>
		<category><![CDATA[scribus]]></category>
		<category><![CDATA[tables]]></category>

		<guid isPermaLink="false">http://estan.dose.se/?p=204</guid>
		<description><![CDATA[Hi again, Just a quick follow-up post to give a happy end to my previous woes. Without further ado, I give you Scribus rendering all 43 cases of border joins mentioned in the previous post (I had forgot two of &#8230; <a href="http://estan.dose.se/2011/07/a-story-with-a-happy-ending">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Hi again,</p>
<p>Just a quick follow-up post to give a happy end to my <a href="http://estan.dose.se/2011/07/bordering-on-the-insane-a-story-of-a-near-collapse">previous woes</a>. Without further ado, I give you Scribus rendering all 43 cases of border joins mentioned in the previous post (I had forgot two of them before):</p>
<p><a href="http://estan.dose.se/wp-content/uploads/2011/07/43_cases.png"><img src="http://estan.dose.se/wp-content/uploads/2011/07/43_cases-331x300.png" alt="The 43 Cases of Border Joins in Scribus" title="The 43 Cases of Border Joins in Scribus" width="331" height="300" class="aligncenter size-medium wp-image-217" /></a></p>
<p>Cheers.</p>
]]></content:encoded>
			<wfw:commentRss>http://estan.dose.se/2011/07/a-story-with-a-happy-ending/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>990 Service Engine Error</title>
		<link>http://estan.dose.se/2008/12/990-service-engine-error</link>
		<comments>http://estan.dose.se/2008/12/990-service-engine-error#comments</comments>
		<pubDate>Thu, 18 Dec 2008 17:09:59 +0000</pubDate>
		<dc:creator>estan</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[c710]]></category>
		<category><![CDATA[engine]]></category>
		<category><![CDATA[printer]]></category>

		<guid isPermaLink="false">http://estan.dose.se/?p=72</guid>
		<description><![CDATA[Today I was bored at the office so I decided to do something different. In my dad&#8217;s office stands an old Lexmark Optra C710 which we leased for a while and eventually bought. It has costed us a small fortune, &#8230; <a href="http://estan.dose.se/2008/12/990-service-engine-error">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Today I was bored at the office so I decided to do something different. In my dad&#8217;s office stands an old Lexmark Optra C710 which we leased for a while and eventually bought. It has costed us a small fortune, but has never really been used much. My dad always complains that it&#8217;s so slow and the quality is really crappy. Now I know that this is mostly because it&#8217;s been hooked up to his machine using a slow parallel port, even though it has a 100Mbit/s ethernet connection, and that the quality problem is probably because it&#8217;s running out of Yellow.</p>
<p>So I asked Tomas to help me, and together we heaved this beast onto a pallet wagon and dragged it over to my office and lifted in onto a desk. It weighs about 35-40 kg! I hooked it up to the network, installed some drivers and tried to print a test page. After half an hour of looking at &#8220;Busy&#8221; on the printer LCD, I turned it off and then back on and was greeted with &#8220;990 Service Engine Error&#8221;.</p>
<p>This error sounded really grave to me, and I considered giving up and send this thing to the printer graveyard. But first I googled the error, and got a hit on some site for amateur printer repairing. After reading a bit, I decided to open the thing up. This is what it looks like:</p>
<div id="attachment_74" class="wp-caption aligncenter" style="width: 310px"><a href="http://estan.dose.se/wp-content/uploads/2008/12/20081218611.jpg"><img src="http://estan.dose.se/wp-content/uploads/2008/12/20081218611-300x225.jpg" alt="Innards of the C710" title="20081218611" width="300" height="225" class="size-medium wp-image-74" /></a><p class="wp-caption-text">Innards of the C710</p></div>
<p>From a bit of reading and manually playing around with the &#8220;clutch&#8221; for the service engine during start-up, which you can do by turning a green little knob, and also measuring the resistance of the service motor itself, I&#8217;ve decided that something must be wrong with the engine controller. I love how that green little knob has been put in there just for debugging. Now the best option seems to be to replace the entire engine block, marked on the picture below:</p>
<div id="attachment_75" class="wp-caption aligncenter" style="width: 310px"><a href="http://estan.dose.se/wp-content/uploads/2008/12/20081218611-engine-block.jpg"><img src="http://estan.dose.se/wp-content/uploads/2008/12/20081218611-engine-block-300x225.jpg" alt="Service engine block" title="20081218611-engine-block" width="300" height="225" class="size-medium wp-image-75" /></a><p class="wp-caption-text">Service engine block</p></div>
<p>After some more googling I found a pirated service manual and parts catalog, and I&#8217;ve asked a dealer to quote a price for me for the part I need (#12G1225 BLOCK ASM OPC/COUPLING DRIVE). It seems hard to find these kind of things since the printer is pretty old.</p>
<p>Anyway, I&#8217;ll post more when I&#8217;ve found the part and tried to fix it. Gotto catch a bus now. BBL.</p>
]]></content:encoded>
			<wfw:commentRss>http://estan.dose.se/2008/12/990-service-engine-error/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MediaWiki Hack; Automatic API links in source code</title>
		<link>http://estan.dose.se/2008/11/mediawiki-hack-automatic-api-links-in-source-code</link>
		<comments>http://estan.dose.se/2008/11/mediawiki-hack-automatic-api-links-in-source-code#comments</comments>
		<pubDate>Wed, 12 Nov 2008 14:28:40 +0000</pubDate>
		<dc:creator>estan</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mediawiki libxml2]]></category>
		<category><![CDATA[planetkde]]></category>

		<guid isPermaLink="false">http://estan.dose.se/?p=54</guid>
		<description><![CDATA[The last few days I&#8217;ve been working on setting up a MediaWiki installation for the libxml2 project. One thing that I wanted to do was add a tag extension that would allow editors to write e.g. &#60;api&#62;xmlNode&#60;/api&#62; and get a &#8230; <a href="http://estan.dose.se/2008/11/mediawiki-hack-automatic-api-links-in-source-code">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The last few days I&#8217;ve been working on setting up a <a title="MediaWiki" href="http://www.mediawiki.org">MediaWiki</a> installation for the <a title="libxml2 project" href="http://xmlsoft.org">libxml2 project</a>. One thing that I wanted to do was add a <a title="tag extension" href="http://www.mediawiki.org/wiki/Manual:Tag_extensions">tag extension</a> that would allow editors to write e.g. &lt;api&gt;xmlNode&lt;/api&gt; and get a link to the API documentation for the xmlNode structure at the libxml2 web site. This turned out to be trivial enough and I soon had it working.</p>
<p>One small problem arised though. I installed the <a title="SyntaxHighlight_GeSHi" href="http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi">SyntaxHighlight_GeSHi</a> extension to allow source code to be marked up and highlighted using &lt;source /&gt;, and my &lt;api /&gt; tag extension would not work inside a &lt;source /&gt; as another extension was already in effect. Not only that; even if it had worked, having to mark up all occurances of libxml2 API symbols inside source code would be cumbersome and it would be hard to discern the source code when editing the wiki markup with all those &lt;api /&gt; tags littered about.</p>
<p>So I figured I&#8217;d just patch the SyntaxHighlight_GeSHi extension to do automatic identification and linkifying of libxml2 API symbols instead. It turned out to be easier than I thought. The API symbols for libxml2 can be obtained as an XML file by running the <tt>doc/apibuild.py</tt> script in the libxml2 source tree. This file has the following format (condensed example excerpt):</p>
<pre lang="xml">
<?xml version="1.0" encoding="ISO-8859-1"?>
<api name='libxml2'>
  <files>
    <file name='DOCBparser'>
      <exports symbol='docbParserInputPtr' type='typedef'/>
      <exports symbol='docbParserCtxt' type='typedef'/>
      ...
    </file>
    <file name='HTMLparser'>
      <exports symbol='htmlDefaultSubelement' type='macro'/>
      <exports symbol='htmlElementAllowedHereDesc' type='macro'/>
      ...
    </file>
    ...
  </files>
</api>
</pre>
<p>So I first made the following PHP script that takes this XML and generates a PHP associative array definition with <tt>[symbol] => [url]</tt> mappings.</p>
<pre lang="php">
<?php
/*
 * This script reads 'libxml-api.xml' from the current directory
 * generates a PHP array definition on standard output.
 *
 * The array will have the format (symbol => url, ... ).
 *
 * Usage: php
 */

$apibase = 'http://xmlsoft.org/html'; // The base for the API URLs.

// Open input
$xml = new XMLReader();
$xml->open('libxml2-api.xml');

if ($xml == FALSE) {
  echo "Unable to open libxml2-api.xml\n";
  exit(FALSE);
}

$file = NULL;
$symbol = NULL;
$type = NULL;

echo "<?php\n\n\$libxml2ApiSymbols = array (\n";
while ($xml->read()) {
  if ($xml->nodeType == XMLReader::ELEMENT &#038;&#038; $xml->name == 'file')
    while($xml->moveToNextAttribute())
      if ($xml->name == 'name')
        $file = $xml->value;
  if ($xml->nodeType == XMLReader::ELEMENT &#038;&#038; $xml->name == 'exports')
    while($xml->moveToNextAttribute())
      if ($xml->name == 'symbol')
        $symbol = $xml->value;
      elseif ($xml->name == 'type')
        $type = $xml->value;
  if ($file != NULL &#038;&#038; $symbol != NULL &#038;&#038; $type != NULL) {
    echo "  \"$symbol\" => \"$apibase/libxml-$file.html#$symbol\",\n";
    $symbol = NULL;
  }
}
echo ");\n\n?>";

$xml->close();
?>
</pre>
<p>I ran this script against the <tt>libxml2-api.xml</tt> from libxml2 2.7.2 and put the output into <tt>extensions/Libxml2ApiSymbols.php</tt>. Then it was just a matter of patching the <tt>SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php</tt> slightly to make it do automatic detection and linkifying of API symbols. I also took the opportunity to patch it to default to the C language when highlighting, as it will be the most common one at the libxml2 wiki. Below is the full diff.</p>
<pre lang="diff">
--- SyntaxHighlight_GeSHi.class.php.orig        2008-11-11 17:13:09.000000000 +0100
+++ SyntaxHighlight_GeSHi.class.php     2008-11-11 17:56:36.000000000 +0100
@@ -1,5 +1,7 @@
 <?php

+require_once('extensions/Libxml2ApiSymbols.php');
+
 class SyntaxHighlight_GeSHi {

        /**
@@ -21,6 +23,7 @@
         * @return string
         */
        public static function parserHook( $text, $args = array(), $parser ) {
+    global $libxml2ApiSymbols;
                self::initialise();
                $text = rtrim( $text );
                // Don't trim leading spaces away, just the linefeeds
@@ -29,7 +32,8 @@
                if( isset( $args['lang'] ) ) {
                        $lang = strtolower( $args['lang'] );
                } else {
-                       return self::formatError( htmlspecialchars( wfMsgForContent( 'syntaxhighlight-err-language' ) ) );
+      $lang = 'c'; // Default to C language
+                       //return self::formatError( htmlspecialchars( wfMsgForContent( 'syntaxhighlight-err-language' ) ) );
                }
                if( !preg_match( '/^[a-z_0-9-]*$/', $lang ) )
                        return self::formatError( htmlspecialchars( wfMsgForContent( 'syntaxhighlight-err-language' ) ) );
@@ -67,6 +71,11 @@
                                $out = str_replace( "\n", '', $out );
                        // Register CSS
                        $parser->mOutput->addHeadItem( self::buildHeadItem( $geshi ), "source-{$lang}" );
+      // Add libxml2 API links
+      if ($lang == 'c')
+        foreach ($libxml2ApiSymbols as $symbol => $url) {
+          $out = preg_replace("/$symbol([^a-zA-Z0-9_])/", "<a class=\"libxml2-symbol\" href=\"$url\">$symbol</a>$1", $out);
+        }
                        if ( $enclose === GESHI_HEADER_NONE ) {
                                return '<span class="'.$lang.' source-'.$lang.'"> '.$out . '</span>';
                        } else {
</pre>
<p>The last thing I did was a bit of styling of the links in the MediaWiki:Geshi.css:</p>
<pre lang="css">
a.libxml2-symbol {
  color: #a06060;
  text-decoration: none;
}
a.libxml2-symbol:visited {
  color: #a06060;
}
</pre>
<p>The result can be seen <a href="http://libxml2wiki.dose.se">here</a>. Hope someone finds this useful. If anyone feels like helping out with the wiki by the way; please register and edit away!</p>
]]></content:encoded>
			<wfw:commentRss>http://estan.dose.se/2008/11/mediawiki-hack-automatic-api-links-in-source-code/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

