<?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>Thomas Løcke Being Incoherent</title>
	<atom:link href="http://blogs.fsfe.org/thomaslocke/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.fsfe.org/thomaslocke</link>
	<description>Just another FSFE Fellowship Blogs site</description>
	<lastBuildDate>Mon, 06 Feb 2012 14:31:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Functional Comprehension</title>
		<link>http://blogs.fsfe.org/thomaslocke/2012/02/01/functional-comprehension/</link>
		<comments>http://blogs.fsfe.org/thomaslocke/2012/02/01/functional-comprehension/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 21:32:11 +0000</pubDate>
		<dc:creator>Thomas Løcke</dc:creator>
				<category><![CDATA[Haskell Programming]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[list comprehension]]></category>

		<guid isPermaLink="false">http://blogs.fsfe.org/thomaslocke/?p=162</guid>
		<description><![CDATA[I&#8217;m currently reading (and thoroughly enjoying!) a fantastic book called Learn you a Haskell for great good. The author is Miran Lipovača, and I gotta say that he&#8217;s one of the most entertaining writers I&#8217;ve ever come across. If you like programming, then get this book. It&#8217;s worth every cent. Oh, and because Miran is [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently reading (and thoroughly enjoying!) a fantastic book called <a href="http://learnyouahaskell.com/">Learn you a Haskell for great good</a>. The author is Miran Lipovača, and I gotta say that he&#8217;s one of the most entertaining writers I&#8217;ve ever come across. If you like programming, then get this book. It&#8217;s worth every cent. Oh, and because Miran is such a nice guy, you can read the book for <a href="http://learnyouahaskell.com/chapters">free</a> on the website. Awesome. But please don&#8217;t let that deter you from actually buying it. We want him to write more books like this, and people gotta eat you know.</p>
<p>I started reading this book because I wanted to dip my toes in the hot waters of functional programming, and <a href="http://en.wikipedia.org/wiki/Haskell_%28programming_language%29">Haskell</a> appealed to me, primarily because I&#8217;ve wanted to start using the <a href="http://xmonad.org/">xmonad</a> tiling window manager on my Slackware box. I came at Haskell with a very imperative mindset, knowing little to nothing about functional programming. I had some vague ideas about what I was getting into, but for the most part I believed it to be a matter of learning a new syntax.</p>
<p>Boy was I wrong.</p>
<p>Obviously you have to learn a new syntax, but you also have to learn to think in a completely new way. And to be honest, I&#8217;m finding it pretty darn hard, in a very pleasurable way. Haskell is nothing like anything else I&#8217;ve ever encountered. Let me give you an example. Early in the book the concept of list comprehensions are introduced, and alongside these a cute little task:</p>
<blockquote><p>
Which right triangle that has integers for all sides and all sides equal to or smaller than 10 has a perimeter of 24?
</p></blockquote>
<p>While this task is by no means rocket science, it does require a bit of effort to solve in a typical imperative language, and you&#8217;d probably end up with some less than pretty nested loops, perhaps something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="ada" style="font-family:monospace;"><span style="color: #46aa03; font-weight:bold;">with</span> Ada.<span style="color: #202020;">Text_IO</span>;
&nbsp;
<span style="color: #46aa03; font-weight:bold;">procedure</span> Triangle <span style="color: #00007f;">is</span>
   <span style="color: #46aa03; font-weight:bold;">use</span> Ada.<span style="color: #202020;">Text_IO</span>;
&nbsp;
   Max_Length : <span style="color: #46aa03; font-weight:bold;">constant</span> Positive := <span style="color: #ff0000;">10</span>;
   Perimeter  : <span style="color: #46aa03; font-weight:bold;">constant</span> Positive := <span style="color: #ff0000;">24</span>;
<span style="color: #00007f;">begin</span>
   <span style="color: #00007f;">for</span> A <span style="color: #46aa03; font-weight:bold;">in</span> <span style="color: #ff0000;">1</span> .. <span style="color: #202020;">Max_Length</span> <span style="color: #00007f;">loop</span>
      <span style="color: #00007f;">for</span> B <span style="color: #46aa03; font-weight:bold;">in</span> A + <span style="color: #ff0000;">1</span> .. <span style="color: #202020;">Max_Length</span> <span style="color: #00007f;">loop</span>
         <span style="color: #00007f;">for</span> C <span style="color: #46aa03; font-weight:bold;">in</span> B + <span style="color: #ff0000;">1</span> .. <span style="color: #202020;">Max_Length</span> <span style="color: #00007f;">loop</span>
            <span style="color: #00007f;">if</span> <span style="color: #66cc66;">&#40;</span>A*A<span style="color: #66cc66;">&#41;</span> + <span style="color: #66cc66;">&#40;</span>B*B<span style="color: #66cc66;">&#41;</span> = C*C <span style="color: #0000ff;">and</span> <span style="color: #00007f;">then</span> A+B+C = <span style="color: #ff0000;">24</span> <span style="color: #00007f;">then</span>
               Put <span style="color: #66cc66;">&#40;</span>A'Img &amp; B'Img &amp; C'Img<span style="color: #66cc66;">&#41;</span>;
            <span style="color: #00007f;">end</span> <span style="color: #00007f;">if</span>;
         <span style="color: #00007f;">end</span> <span style="color: #00007f;">loop</span>;
      <span style="color: #00007f;">end</span> <span style="color: #00007f;">loop</span>;
   <span style="color: #00007f;">end</span> <span style="color: #00007f;">loop</span>;
<span style="color: #00007f;">end</span> Triangle;</pre></div></div>

<p>Yea I know &#8211; not pretty, but there it is and the result when running this little marvel is </p>
<pre>
6 8 10
</pre>
<p>as expected.</p>
<p>Now lets see the Haskell way:</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: green;">&#91;</span><span style="color: green;">&#40;</span>a<span style="color: #339933; font-weight: bold;">,</span>b<span style="color: #339933; font-weight: bold;">,</span>c<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">|</span> c<span style="color: #339933; font-weight: bold;">&lt;-</span><span style="color: green;">&#91;</span><span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">..</span><span style="color: red;">10</span><span style="color: green;">&#93;</span><span style="color: #339933; font-weight: bold;">,</span> b<span style="color: #339933; font-weight: bold;">&lt;-</span><span style="color: green;">&#91;</span><span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">..</span>c<span style="color: green;">&#93;</span><span style="color: #339933; font-weight: bold;">,</span> a<span style="color: #339933; font-weight: bold;">&lt;-</span><span style="color: green;">&#91;</span><span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">..</span>b<span style="color: green;">&#93;</span><span style="color: #339933; font-weight: bold;">,</span> a<span style="color: #339933; font-weight: bold;">^</span><span style="color: red;">2</span><span style="color: #339933; font-weight: bold;">+</span>b<span style="color: #339933; font-weight: bold;">^</span><span style="color: red;">2</span><span style="color: #339933; font-weight: bold;">==</span>c<span style="color: #339933; font-weight: bold;">^</span><span style="color: red;">2</span><span style="color: #339933; font-weight: bold;">,</span> a<span style="color: #339933; font-weight: bold;">+</span>b<span style="color: #339933; font-weight: bold;">+</span>c<span style="color: #339933; font-weight: bold;">==</span><span style="color: red;">24</span><span style="color: green;">&#93;</span></pre></div></div>

<p>Simply enter the above in <code>ghci</code> (Haskell interactive mode), and you&#8217;ll get</p>
<pre>
[(6,8,10)]
</pre>
<p>Solved using one line. How awesome is that? And it&#8217;s very readable to boot! The three lists feed into the <code>(a,b,c)</code> triple according to the two predicates <code>a^2+b^2==c^2</code> and <code>a+b+c==24</code>. And that&#8217;s it! Lets try and remove the last predicate</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: green;">&#91;</span><span style="color: green;">&#40;</span>a<span style="color: #339933; font-weight: bold;">,</span>b<span style="color: #339933; font-weight: bold;">,</span>c<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">|</span> c<span style="color: #339933; font-weight: bold;">&lt;-</span><span style="color: green;">&#91;</span><span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">..</span><span style="color: red;">10</span><span style="color: green;">&#93;</span><span style="color: #339933; font-weight: bold;">,</span> b<span style="color: #339933; font-weight: bold;">&lt;-</span><span style="color: green;">&#91;</span><span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">..</span>c<span style="color: green;">&#93;</span><span style="color: #339933; font-weight: bold;">,</span> a<span style="color: #339933; font-weight: bold;">&lt;-</span><span style="color: green;">&#91;</span><span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">..</span>b<span style="color: green;">&#93;</span><span style="color: #339933; font-weight: bold;">,</span> a<span style="color: #339933; font-weight: bold;">^</span><span style="color: red;">2</span><span style="color: #339933; font-weight: bold;">+</span>b<span style="color: #339933; font-weight: bold;">^</span><span style="color: red;">2</span><span style="color: #339933; font-weight: bold;">==</span>c<span style="color: #339933; font-weight: bold;">^</span><span style="color: red;">2</span><span style="color: green;">&#93;</span></pre></div></div>

<p>and see what we get:</p>
<pre>
[(3,4,5),(6,8,10)]
</pre>
<p>Those two triangles are the only Pythagorean triples within the range of 1..10. Very neat.</p>
<p>If you&#8217;re up for some fun, I can highly recommend taking a look at Haskell. It&#8217;s a language that appears to be jam-packed with all sorts of great/cool features and as if that wasn&#8217;t enough, you also get to use words like monads, zippers, monoids and functors. Get your Haskell groove on <a href="http://www.haskell.org/haskellwiki/Haskell">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.fsfe.org/thomaslocke/2012/02/01/functional-comprehension/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why I Love Free and Open Source Software</title>
		<link>http://blogs.fsfe.org/thomaslocke/2012/01/18/why-i-love-free-and-open-source-software/</link>
		<comments>http://blogs.fsfe.org/thomaslocke/2012/01/18/why-i-love-free-and-open-source-software/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 21:40:16 +0000</pubDate>
		<dc:creator>Thomas Løcke</dc:creator>
				<category><![CDATA[Free Software]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://blogs.fsfe.org/thomaslocke/?p=154</guid>
		<description><![CDATA[My love for, and interest in, Free and Open Source software comes from two fairly different perspectives. One perspective is that of me as a programmer, a geek and a freedom loving individual. Another, equally important, perspective is me as a businessman and entrepreneur. The Geeky Me I love Free and Open Source software, because [...]]]></description>
			<content:encoded><![CDATA[<p>My love for, and interest in, Free and Open Source software comes from two fairly different perspectives. One perspective is that of me as a programmer, a geek and a freedom loving individual. Another, equally important, perspective is me as a businessman and entrepreneur.</p>
<h3>The Geeky Me</h3>
<p>I love Free and Open Source software, because it sets people free and enables them to tinker and learn. I hate black boxes with a passion, because they keep us from expanding our horizons, and they enable power monopolies to control the free flow of knowledge and information. The whole concept of keeping knowledge hidden is alien to me &#8211; it only benefits the few, where an open world benefit the many.</p>
<p>There&#8217;s also the complicated matter of who to trust? Can we really trust software that wont let us see what it is doing with our data? In this day and age, where everybody is connected to everybody, should we, as consumers of software, accept that we have no clue what our data is being used to? Of course not. Free and Open Source software enables us, the users, to confirm that no evil is being done with our data. I&#8217;d much rather trust an army of Open Source programmers over big business and government. Any day.</p>
<p>A free society requires Free and Open Source software. The only thing that has historically set people free, is knowledge. Today technology play a key role in making sure people all over the world can gain knowledge. Free and Open Source software is at the heart of this.</p>
<p>So the main attractions of Free and Open Source software to me as a geek, programmer and human being is that it&#8217;s a whole lot more trustworthy. It allows knowledge to be shared and it guarantees freedom for both developers and users alike. Free and Open Source software is at the very core of a free society and it is the spear with which ordinary people can destroy power monopolies. And there are still many power monopolies that needs to be completely eradicated from the face of our planet.</p>
<p>We will have our freedom.</p>
<h3>The Entrepreneurial Me</h3>
<p>From the perspective of a businessman (going on +20 years), the concept of Free and Open Source software is great primarily because of one thing: It enables me to <strong>take</strong> and <strong>maintain</strong> control of <strong>my</strong> business.</p>
<p>I have first hand experience with proprietary products and the companies that develop them. Since 1995 my business have suffered two serious setbacks solely because of proprietary software.</p>
<p>The first time was in 1999 where a vendor claimed I had to invest in a new software package, or my systems would fail due to Y2K issues. The new software would cost me $40K. I moaned and complained about this, as I had already bought and paid for the previous version of this software, only 2 years earlier. But the vendor was adamant: I had to buy the new package. And so I did. My entire business depended on this software, so I really had no choice. To this day I&#8217;m not at all convinced that the software even needed the upgrade, because the vendor not only installed the new package, they also completely removed the old hard drives from the server. I had no way of verifying that I actually needed the &#8220;upgrade&#8221;. The vendor took control of my company and my money. They literally had me by the balls.</p>
<p>The second time was in 2009 where I was suddenly told by a vendor, that they would no longer support and develop the software I had bought from them, despite the fact that I had paid almost $100K in license fees over the years. They just pulled the plug. No development has been done since, and in the summer of 2011 the vendor went bankrupt.</p>
<p>So now I&#8217;m stuck with a dead platform, that only works on Windows (ARGH!), and for which no further development and bug/security fixes are done.</p>
<p>Wonderful.</p>
<p>Had these critical pieces of software been Free and Open Source, I could&#8217;ve hired programmers of my own and kept the software viable. Had the software been Free and Open Source, chances are there would&#8217;ve been other vendors in the market. But alas it wasn&#8217;t (and isn&#8217;t) Free and Open Source, so now the software will go to it&#8217;s grave alongside the dead vendor.</p>
<p>I&#8217;ve learned an important lesson from these experiences: Never ever trust companies that aren&#8217;t willing to open source their product. If the product is closed source, run for the hills. If your business depends on software, as mine does, you better make sure it&#8217;s Free and Open Source.</p>
<p>Do. Not. Trust. Companies. That. Only. Deliver. Closed. Products.</p>
<p>Sooner or later they will f*ck you up.</p>
<p>Just as you would never build a house on a foundation you don&#8217;t know anything about, you should never build a business around software that is a black box, and over which you have zero control, because if <strong>you</strong> have zero control, then that means <strong>strangers</strong> potentially have 100% control &#8211; over <strong>YOUR</strong> business. That is not good. Trust me, I&#8217;ve lived through it.</p>
<p>So even if you don&#8217;t buy into the Free and Open Source software ideology in general, you should still only ever base a business on Free and Open Source software, simply because it is the only sane thing to do. Free and Open Source software enables you to run your business how you envision it, not how random vendor X decides. That alone is worth a lot. And &#8220;worth a lot&#8221; is sweet music to any businessman.</p>
<p>If you&#8217;d like to help make the world a better place, then consider joining one of the FSF&#8217;s: <a href="http://fsf.org">Free Software Foundation</a> or <a href="http://fsfe.org">Free Software Foundation Europe</a>. I&#8217;m a member of the latter, as the URL of this blog might already have given away.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.fsfe.org/thomaslocke/2012/01/18/why-i-love-free-and-open-source-software/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Ada Programming on Slackware</title>
		<link>http://blogs.fsfe.org/thomaslocke/2012/01/08/ada-programming-on-slackware/</link>
		<comments>http://blogs.fsfe.org/thomaslocke/2012/01/08/ada-programming-on-slackware/#comments</comments>
		<pubDate>Sun, 08 Jan 2012 19:59:15 +0000</pubDate>
		<dc:creator>Thomas Løcke</dc:creator>
				<category><![CDATA[Ada Programming]]></category>
		<category><![CDATA[Slackware]]></category>
		<category><![CDATA[Ada]]></category>
		<category><![CDATA[AWS]]></category>
		<category><![CDATA[Florist]]></category>
		<category><![CDATA[GNATColl]]></category>
		<category><![CDATA[XML/Ada]]></category>

		<guid isPermaLink="false">http://blogs.fsfe.org/thomaslocke/?p=102</guid>
		<description><![CDATA[Over the past few months, I&#8217;ve received a whooping 4 requests for an article about how to install some basic Ada packages on a Linux system, and since 4 is a high number in my world, I decided I&#8217;d best get cracking on it. And so I did. Now we all know that Linux system [...]]]></description>
			<content:encoded><![CDATA[<p>Over the past few months, I&#8217;ve received a whooping 4 requests for an article about how to install some basic Ada packages on a Linux system, and since 4 is a high number in my world, I decided I&#8217;d best get cracking on it.</p>
<p>And so I did.</p>
<p>Now we all know that <em>Linux system</em> is a very broad term, what with the abundance of versions available, but to me there&#8217;s really only one that counts, and that is <a href="http://slackware.org">Slackware</a>, so that&#8217;s what I&#8217;m going to base this article on. Also I&#8217;m guessing that all you <a href="http://debian.org">Debian</a>, <a href="http://redhat.com">Red Hat</a> and <a href="http://opensuse.org">openSUSE</a> folks already have much of this software readily available in your fancy package repositories. At least I know that there&#8217;s an <a href="http://people.debian.org/~lbrenta/debian-ada-policy.html">Ada Policy for Debian</a>, which usually equals some packages also.</p>
<p>We&#8217;ll be installing 5 Ada packages on a Slackware64 13.37 box. The 5 packages are:</p>
<ul>
<li><a href="http://libre.adacore.com/libre/tools/gnat-gpl-edition/">GNAT GPL</a> (Ada compiler and IDE)</li>
<li><a href="http://libre.adacore.com/libre/download/">Florist </a>(POSIX library)</li>
<li><a href="http://libre.adacore.com/libre/tools/xmlada/">XML/Ada</a> (XML library)</li>
<li><a href="http://libre.adacore.com/libre/tools/gnat-component-collection/">GNATcoll</a> (Various utilities library)</li>
<li><a href="http://libre.adacore.com/libre/tools/aws/">Ada Web Server</a> (AWS)</li>
</ul>
<p>All of these can be found at the <a href="http://libre.adacore.com">libre.adacore.com</a> website. We&#8217;ll be working with a full install of Slackware, with <a href="http://postgresql.org">PostgreSQL</a> and <a href="http://texlive.org">TeX Live</a> added to the default Slackware packages. Also a regular user named <em>thomas</em> has been created. Only the compiler will be installed as <em>root</em>, the rest of the libraries will be installed as <em>thomas</em>. Obviously you should substitute all references to <em>thomas</em> according to your own setup. </p>
<p>This article will not deal with how to install Slackware, nor how to obtain the above Ada packages from <a href="http://libre.adacore.com">libre.adacore.com</a>.</p>
<h3>Movies You Say?</h3>
<p>When I decided to write this article, I also decided I wanted to do 5 short videos to accompany it. &#8220;Why?&#8221; you might ask, and that would of course be a completely valid question. The answer is simple: </p>
<p>Because it&#8217;s fun!</p>
<p>Also these 5 videos grant me the opportunity to get the phrase &#8220;Ada programming&#8221; on YouTube. Whether or not that actually <a href="http://lang-index.sourceforge.net/">help Ada&#8217;s search rank</a> is yet to be seen, but it properly wont make it any worse. I hope.</p>
<p>Please bear in mind that I know zero about making videos, English is not my first language, and I&#8217;ve not done anything like this before. These videos are at best an amateurs feeble attempts at making something useful. One thing they do document, despite their less than stellar quality, is the fact that the commands you&#8217;ll read in this article actually works in real life.</p>
<p>Each video will be linked in the headline for the appropriate section below.</p>
<h3>The Commands</h3>
<p>Those of you who really can&#8217;t be bothered with videos will of course not be left behind. All the commands necessary to compile and install these Ada tools are made available in this article. Basically what you&#8217;re getting is my Bash history, with one little addition: Whenever I type something in a program such as an installer or in emacs, the typed text is indented 4 spaces, like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ emacs somefile
    Stuff added to somefile
$ .<span style="color: #000000; font-weight: bold;">/</span>installer
    RETURN</pre></div></div>

<p>In the first example some stuff is added to <em>somefile</em> using emacs, and in the second example <em>RETURN</em> is clicked while running the <em>installer</em> program. I hope this makes sense. Else watch the videos, as you&#8217;ll be able to see exactly what&#8217;s going on. Hey, I&#8217;m already getting pretty good at shamelessly plugging my own videos! I&#8217;m <a href="http://en.wikipedia.org/wiki/Search_engine_optimization">SEO</a> personified. Or not.</p>
<p>Also when you see the year 2011 in file names and commands, you should of course substitute it with whatever edition you might&#8217;ve downloaded, be it newer or older. The same goes for obvious version numbers, such as 4.1 for XML/Ada.</p>
<p>Lets get to it..</p>
<h4><a href="http://youtu.be/9LcDyUG2loE">Ada Programming on Slackware &#8211; Part 1: The GNAT GPL Compiler</a></h4>
<p>Even though Slackware64 13.37 comes equipped with an Ada compiler out of the box, it&#8217;s really a rather old one and it&#8217;s not very suited as compiler for any remotely new Ada projects, and I know for a fact that it simply cannot compile <a href="http://libre.adacore.com/libre/tools/aws/">AWS</a>, so the first step is getting a new compiler on the system. My choice is the <a href="http://libre.adacore.com/libre/tools/gnat-gpl-edition/">GNAT GPL</a> compiler from AdaCore. </p>
<p>This is the file I&#8217;ve downloaded:</p>
<pre>gnat-gpl-2011-x86_64-pc-linux-gnu-bin.tar.gz</pre>
<p>As <em>root</em> do:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf gnat-gpl-<span style="color: #000000;">2011</span>-x86_64-pc-linux-gnu-bin.tar.gz
$ <span style="color: #7a0874; font-weight: bold;">cd</span> gnat-<span style="color: #000000;">2011</span>-x86_64-pc-linux-gnu-bin<span style="color: #000000; font-weight: bold;">/</span>
$ .<span style="color: #000000; font-weight: bold;">/</span>doinstall
    RETURN
    RETURN
    Y
    Y
$ <span style="color: #7a0874; font-weight: bold;">cd</span>
$ emacs .bashrc
&nbsp;
    <span style="color: #007800;">PATH</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>gnat<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #007800;">$PATH</span>
    <span style="color: #7a0874; font-weight: bold;">export</span> PATH
&nbsp;
    <span style="color: #007800;">GPR_PROJECT_PATH</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>gnat<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>gnat
    <span style="color: #7a0874; font-weight: bold;">export</span> GPR_PROJECT_PATH
&nbsp;
    <span style="color: #007800;">ADA_PROJECT_PATH</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>gnat<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>gnat
    <span style="color: #7a0874; font-weight: bold;">export</span> ADA_PROJECT_PATH
$ <span style="color: #7a0874; font-weight: bold;">source</span> .bashrc
$ <span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> thomas:<span style="color: #c20cb9; font-weight: bold;">users</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>gnat</pre></div></div>

<p>Now, you can either re-type the <em>.bashrc</em> stuff into the <em>/home/thomas/.bashrc</em> file, or you can use this little trick:</p>
<pre>
$ tail -n 9 .bashrc &gt;&gt; /home/thomas/.bashrc
</pre>
<p>That simply moves the last 9 lines from the <em>/root/.bashrc</em> to <em>/home/thomas/.bashrc</em>. Quite nifty eh&#8217;? You must of course adjust the 9 to suit your needs. It should be less if you haven&#8217;t added the same amount of line breaks as I have.</p>
<p>Note that the Slackware system does not come with <em>.bashrc</em> setup by default, so you&#8217;re going to have to create it yourself, if haven&#8217;t already, and then source it manually. Or you can create a <em>.bash_profile</em> file to have it source automatically on login:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bashrc <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
   . ~<span style="color: #000000; font-weight: bold;">/</span>.bashrc;
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

<p>And with that you now have a brand spanking new Ada compiler in <em>/usr/gnat/</em> on your Slackware box:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ gnatmake <span style="color: #660033;">--version</span>
GNATMAKE GPL <span style="color: #000000;">2011</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">20110419</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Copyright <span style="color: #7a0874; font-weight: bold;">&#40;</span>C<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">1995</span>-<span style="color: #000000;">2011</span>, Free Software Foundation, Inc.
...</pre></div></div>

<p>Awesome eh?</p>
<h4><a href="http://youtu.be/IZCLBKn9-7o">Ada Programming on Slackware &#8211; Part 2: The Florist POSIX Library</a></h4>
<p>Compiling and installing Florist is about as easy as it can get. This is the file I&#8217;ve downloaded and placed in <em>/home/thomas</em>:</p>
<pre>florist-gpl-2011-src.tgz</pre>
<p>As <em>root</em> do:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">su</span> - thomas
$ <span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf florist-gpl-<span style="color: #000000;">2011</span>-src.tgz
$ <span style="color: #7a0874; font-weight: bold;">cd</span> florist-gpl-<span style="color: #000000;">2011</span>-src
$ .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>gnat<span style="color: #000000; font-weight: bold;">/</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #660033;">-j</span> <span style="color: #000000;">4</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
$ <span style="color: #7a0874; font-weight: bold;">cd</span></pre></div></div>

<p>There are no tests nor demos available in the Florist source package, so the only way to test it, is to start using it. Simply add <em>with florist;</em> to your project file, and get cracking.</p>
<h4><a href="http://youtu.be/N27lK6Fg8Ek">Ada Programming on Slackware &#8211; Part 3: The XML/Ada Library</a></h4>
<p>If you&#8217;re looking for a deep and intensive challenge, then this section is not going to please you: XML/Ada is dead-simple to compile and install. </p>
<p>This is the file I&#8217;ve downloaded:</p>
<pre>xmlada-gpl-4.1-src.tgz</pre>
<p>As <em>thomas</em> do:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf xmlada-gpl-<span style="color: #000000;">4.1</span>-src.tgz
$ <span style="color: #7a0874; font-weight: bold;">cd</span> xmlada-<span style="color: #000000;">4.1</span>-src<span style="color: #000000; font-weight: bold;">/</span>
$ .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>gnat
$ <span style="color: #007800;">PROCESSORS</span>=<span style="color: #000000;">4</span> <span style="color: #c20cb9; font-weight: bold;">make</span> all
$ <span style="color: #c20cb9; font-weight: bold;">make</span> docs
$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #7a0874; font-weight: bold;">test</span>
$ <span style="color: #7a0874; font-weight: bold;">cd</span> dom<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">test</span>
$ .<span style="color: #000000; font-weight: bold;">/</span>tostring
$ <span style="color: #7a0874; font-weight: bold;">cd</span></pre></div></div>

<p>With the <em>GPR_PROJECT_PATH</em> environment variable in place, all you have to do to use XML/Ada is <em>with</em> the necessary packages in your program, for example <em>with DOM.Core.Documents;</em> or <em>with Sax.Readers;</em>.</p>
<h4><a href="http://youtu.be/tVFRK2nIPRw">Ada Programming on Slackware &#8211; Part 4: The GNATcoll Library</a></h4>
<p>GNATcoll is the first of these libraries where you actually have to make some decisions. It&#8217;s possible to enable/disable various components in GNATcoll, for example if you don&#8217;t ever plan on using the facilities to handle project files or SQLite databases, then you can disable them in the configure step. Use <em>./configure &#8211;help</em> to see your options.</p>
<p>This is the file I&#8217;ve downloaded:</p>
<pre>gnatcoll-gpl-2011-src.tgz</pre>
<p>As <em>thomas</em> do:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf gnatcoll-gpl-<span style="color: #000000;">2011</span>-src.tgz
$ .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>gnat<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">--disable-projects</span> <span style="color: #660033;">--disable-pygtk</span>
$ <span style="color: #007800;">PROCESSORS</span>=<span style="color: #000000;">4</span> <span style="color: #c20cb9; font-weight: bold;">make</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
$ <span style="color: #7a0874; font-weight: bold;">cd</span> examples
$ <span style="color: #c20cb9; font-weight: bold;">make</span>
$ <span style="color: #7a0874; font-weight: bold;">cd</span> gmp<span style="color: #000000; font-weight: bold;">/</span>
$ .<span style="color: #000000; font-weight: bold;">/</span>isprime
    <span style="color: #7a0874; font-weight: bold;">&#40;</span>try a few numbers<span style="color: #7a0874; font-weight: bold;">&#41;</span>
$ <span style="color: #7a0874; font-weight: bold;">cd</span></pre></div></div>

<p>Usage is as usual: <em>with gnatcoll;</em> or <em>with gnatcoll_postgresql</em> or, well, you get the point.</p>
<p>So far so good. 4 down, only one to go.</p>
<h4><a href="http://youtu.be/wzbKDaLb76s">Ada Programming on Slackware &#8211; Part 5: The Ada Web Server (AWS) Library</a></h4>
<p>Last, but not least: The Ada Web Server. A marvelous piece of software that enables you to add HTTP(S) functionality to your Ada programs. And luckily it&#8217;s just as easy to compile and install as all the other libraries.</p>
<p>This is the file I&#8217;ve downloaded:</p>
<pre>aws-gpl-2.10.0-src.tgz</pre>
<p>As <em>thomas</em> do:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf aws-gpl-2.10.0-src.tgz
$ <span style="color: #7a0874; font-weight: bold;">cd</span> aws-gpl-2.10.0-src
$ <span style="color: #c20cb9; font-weight: bold;">make</span> setup
$ emacs makefile.setup
    <span style="color: #007800;">LDAP</span>=<span style="color: #c20cb9; font-weight: bold;">true</span>
    <span style="color: #007800;">PROCESSORS</span>=<span style="color: #000000;">4</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span> build
$ <span style="color: #c20cb9; font-weight: bold;">make</span> build_doc
$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
$ <span style="color: #7a0874; font-weight: bold;">cd</span> demos<span style="color: #000000; font-weight: bold;">/</span>test_ldap
$ <span style="color: #c20cb9; font-weight: bold;">make</span>
$ .<span style="color: #000000; font-weight: bold;">/</span>test_ldap</pre></div></div>

<p>Note the missing <em>./configure</em> step. Instead of that you edit the <em>makefile.setup</em> file to enable/disable various components and to define where AWS is installed.</p>
<p>With&#8217;ing <em>aws</em> in your project file is all you have to do to make use of its powerful facilities. Be sure to check the <a href="http://www.adacore.com/wp-content/files/auto_update/aws-docs/aws.html">documentation</a>, as there&#8217;s a lot of very interesting stuff in there.</p>
<h3>One Final Note</h3>
<p>In the above we&#8217;ve installed the latest official versions of the software (as per the time of writing), but that might not be the best solution. Actually I&#8217;ll go as far as to say that it isn&#8217;t the best solution, since AdaCore only release once each year. What I usually do is opt for the developer versions. There are usually fewer bugs in them, and you get to try some of the new stuff the AdaCore wizards are working on.</p>
<p>So, where might you find these fabled developer versions? Here of course:</p>
<ul>
<li><a href="http://svn.eu.adacore.com/anonsvn/Dev/trunk/xmlada/">XML/Ada Subversion repository</a></li>
<li><a href="http://svn.eu.adacore.com/anonsvn/Dev/trunk/gps/gnatlib/">GNATcoll Subversion repository</a></li>
<li><a href="http://forge.open-do.org/anonscm/git/aws/aws.git">AWS Git repository</a></li>
</ul>
<p>I haven&#8217;t been able to track down a dev repo for Florist, and so far I&#8217;ve never had any need to upgrade GNAT GPL more than once a year.</p>
<p>I hope you&#8217;ve enjoyed this little ride through Ada land, and as usual: If you find any errors in my scribblings, please let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.fsfe.org/thomaslocke/2012/01/08/ada-programming-on-slackware/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Deleting remote tags with Git</title>
		<link>http://blogs.fsfe.org/thomaslocke/2011/11/28/92/</link>
		<comments>http://blogs.fsfe.org/thomaslocke/2011/11/28/92/#comments</comments>
		<pubDate>Mon, 28 Nov 2011 20:53:36 +0000</pubDate>
		<dc:creator>Thomas Løcke</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Git]]></category>

		<guid isPermaLink="false">http://blogs.fsfe.org/thomaslocke/?p=92</guid>
		<description><![CDATA[I really like Git. It is an awesome tool, and since it&#8217;s also the VCS that got me into managing my source code (and other stuff), I&#8217;ve never really felt it was that hard to learn. But then the other day I suddenly needed to delete a remote tag. Deleting tags locally is dead simple: [...]]]></description>
			<content:encoded><![CDATA[<p>I really like <a href="http://git-scm.com/">Git</a>. It is an awesome tool, and since it&#8217;s also the VCS that got me into managing my source code (and other stuff), I&#8217;ve never really felt it was that hard to learn.</p>
<p>But then the other day I suddenly needed to delete a remote tag.</p>
<p>Deleting tags locally is dead simple:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">git</span> tag <span style="color: #660033;">-d</span> some_tag</pre></div></div>

<p>There. Simple, logical and straightforward. Deleting tags on a remote on the other hand, is a bit more &#8220;confusing&#8221;, first and foremost because you&#8217;re not going to be using the <em>git tag</em> command at all. Instead you&#8217;ll be using <em>git push</em>.</p>
<p>Yea, that makes a lot of sense to me. It might make perfect sense to a hardcore Git user, but to someone like me it feels a bit &#8220;meh&#8221;.</p>
<p>In the manual for git push we find this little gem:</p>
<blockquote><p>
git push origin :experimental<br />
    Find a ref that matches experimental in the origin repository (e.g.  refs/heads/experimental), and delete it.
</p></blockquote>
<p>Aha! Since our tag is &#8220;a ref&#8221; all we apparently have to do is push nothing to the ref, and Git will delete the ref on the remote. YAY! So in order to delete some_tag, we do:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">git</span> push origin :some_tag</pre></div></div>

<p>And I can report that it does indeed work. The tag is removed from the remote, and all is well. I can&#8217;t say I really like this method. I would have much preferred that remote tags were deleted using the <em>git tag</em> command, perhaps by adding a <em>&#8211;remote</em> option or something like that, but hey, what do I know.</p>
<p>At least now I&#8217;ve learned that in order to delete remote tags, I need to push nothing over the wire. No delete options or delete commands. Just pure and utter emptiness. I&#8217;ve learned my lesson.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.fsfe.org/thomaslocke/2011/11/28/92/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ada with a side of JSON</title>
		<link>http://blogs.fsfe.org/thomaslocke/2011/11/18/ada-with-a-side-of-json/</link>
		<comments>http://blogs.fsfe.org/thomaslocke/2011/11/18/ada-with-a-side-of-json/#comments</comments>
		<pubDate>Fri, 18 Nov 2011 19:57:28 +0000</pubDate>
		<dc:creator>Thomas Løcke</dc:creator>
				<category><![CDATA[Ada Programming]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Ada]]></category>
		<category><![CDATA[GNATColl]]></category>
		<category><![CDATA[JSON]]></category>

		<guid isPermaLink="false">http://blogs.fsfe.org/thomaslocke/?p=29</guid>
		<description><![CDATA[So, you&#8217;ve got Ada and you need to handle some JSON data, but you&#8217;re not quite sure if there are tools available, or if you&#8217;re going to have to come up with a homegrown solution. Well, as luck will have it, you need look no further than to the excellent GNATColl library from libre.adacore.com: The [...]]]></description>
			<content:encoded><![CDATA[<p>So, you&#8217;ve got <a href="http://en.wikipedia.org/wiki/Ada_%28programming_language%29">Ada</a> and you need to handle some <a href="http://json.org/">JSON</a> data, but you&#8217;re not quite sure if there are tools available, or if you&#8217;re going to have to come up with a homegrown solution. Well, as luck will have it, you need look no further than to the excellent <a href="http://libre.adacore.com/libre/tools/gnat-component-collection/">GNATColl</a> library from <a href="http://libre.adacore.com">libre.adacore.com</a>:</p>
<blockquote><p>
The GNAT Component Collection is a suite of reusable software components and utilities. It has been used by AdaCore in developing the GNAT tool set, the GPS Integrated Development Environment, and GNAT Tracker, its web-based customer support interface.
</p></blockquote>
<p>There&#8217;s a lot of really nice stuff in GNATColl, but today I&#8217;ll focus on the very new and shiny JSON features. Actually, at the time of writing, the GNATColl JSON facilities are so new that they haven&#8217;t even made it into the <a href="https://www.adacore.com/wp-content/files/auto_update/gnatcoll-docs/">GNATColl manual</a> yet, but that&#8217;s not really a problem, since they are so very easy to grasp.</p>
<p>But before we can get cracking on the actual Ada code, we need to install GNATColl. My personal preference is to go with the latest development snapshot:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #c20cb9; font-weight: bold;">co</span> http:<span style="color: #000000; font-weight: bold;">//</span>svn.eu.adacore.com<span style="color: #000000; font-weight: bold;">/</span>anonsvn<span style="color: #000000; font-weight: bold;">/</span>Dev<span style="color: #000000; font-weight: bold;">/</span>trunk<span style="color: #000000; font-weight: bold;">/</span>gps<span style="color: #000000; font-weight: bold;">/</span>gnatlib<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> gnatlib<span style="color: #000000; font-weight: bold;">/</span>
.<span style="color: #000000; font-weight: bold;">/</span>configure ....
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>Obviously you should take a look at the configure options, so you don&#8217;t end up trying to compile features you don&#8217;t want/need. Also it&#8217;s worth noting that if you want to be sure of success, then it&#8217;s probably best to use the <a href="http://libre.adacore.com/libre/tools/gnat-gpl-edition/">GNAT GPL compiler</a> from AdaCore. Once you&#8217;ve made it work with that, you can start experimenting with the FSF GCC compiler. I&#8217;ve compiled GNATColl with GCC 4.6.2, so I can at least attest to the fact that GNATColl compiled with that specific version at the time of writing.</p>
<p>So, now that we have GNATColl available, lets get down and dirty with some JSON. </p>
<p>Step one is to initialize an empty <code>JSON_Value</code> variable:</p>

<div class="wp_syntax"><div class="code"><pre class="ada" style="font-family:monospace;"><span style="color: #46aa03; font-weight:bold;">with</span> Ada.<span style="color: #202020;">Text_IO</span>;
<span style="color: #46aa03; font-weight:bold;">with</span> GNATCOLL.<span style="color: #202020;">JSON</span>;
&nbsp;
<span style="color: #46aa03; font-weight:bold;">procedure</span> JSON_Fun <span style="color: #00007f;">is</span>
   <span style="color: #46aa03; font-weight:bold;">use</span> Ada.<span style="color: #202020;">Text_IO</span>;
   <span style="color: #46aa03; font-weight:bold;">use</span> GNATCOLL.<span style="color: #202020;">JSON</span>;
&nbsp;
   Penguin : <span style="color: #46aa03; font-weight:bold;">constant</span> JSON_Value := Create_Object;
<span style="color: #00007f;">begin</span>
   <span style="color: #00007f;">if</span> Kind <span style="color: #66cc66;">&#40;</span>Penguin<span style="color: #66cc66;">&#41;</span> = JSON_Object_Type <span style="color: #00007f;">then</span>
      Put_Line <span style="color: #66cc66;">&#40;</span><span style="color: #7f007f;">&quot;Yes, Penguin is a JSON object&quot;</span><span style="color: #66cc66;">&#41;</span>;
   <span style="color: #00007f;">end</span> <span style="color: #00007f;">if</span>;
<span style="color: #00007f;">end</span> JSON_Fun;</pre></div></div>

<p>Running that should give you this output:</p>
<p><code>Yes, Penguin is a JSON object</code></p>
<p>The Create_Object call is where the magic is at. This gives us an empty JSON object, to which we can add values using the <code>Set_Field</code> procedure. The <code>Kind</code> function returns the kind of <code>JSON_Value</code> we&#8217;re dealing with. There are 7 kinds:</p>

<div class="wp_syntax"><div class="code"><pre class="ada" style="font-family:monospace;"><span style="color: #46aa03; font-weight:bold;">type</span> JSON_Value_Type <span style="color: #00007f;">is</span>
     <span style="color: #66cc66;">&#40;</span>JSON_Null_Type,
      JSON_Boolean_Type,
      JSON_Int_Type,
      JSON_Float_Type,
      JSON_String_Type,
      JSON_Array_Type,
      JSON_Object_Type<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>It should be obvious what kinds of data the different types contain.</p>
<p>So, currently we&#8217;ve got an empty Penguin JSON object, next step is naming the cute little fellow. Add this to the JSON_Fun program:</p>

<div class="wp_syntax"><div class="code"><pre class="ada" style="font-family:monospace;">Set_Field <span style="color: #66cc66;">&#40;</span>Val        =&gt; Penguin,
           Field_Name =&gt; <span style="color: #7f007f;">&quot;name&quot;</span>,
           Field      =&gt; <span style="color: #7f007f;">&quot;Linux&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #00007f;">if</span> Has_Field <span style="color: #66cc66;">&#40;</span>Penguin, <span style="color: #7f007f;">&quot;name&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #00007f;">then</span>
   Put_Line <span style="color: #66cc66;">&#40;</span><span style="color: #7f007f;">&quot;Our Penguin is named &quot;</span> &amp; Get <span style="color: #66cc66;">&#40;</span>Penguin, <span style="color: #7f007f;">&quot;name&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #00007f;">end</span> <span style="color: #00007f;">if</span>;</pre></div></div>

<p>And voila! We&#8217;ve got a penguin named Linux. Amazing stuff eh? In the above snippet we encounter two key subprograms in the <code>GNATCOLL.JSON</code> package: <code>Set_Field</code> and <code>Get</code>. The former adds data to a <code>JSON_Value</code> object, while the latter retrieves data. There are <code>Set_Field</code> and <code>Get</code> subprograms for all the available <code>JSON_Value_Type's</code>.</p>
<p>Moving on, lets give our penguin some parents. As we all know, Linux got a lot of parents, but we&#8217;ll settle on adding three of those to a <code>JSON_Array</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="ada" style="font-family:monospace;">   ...
   <span style="color: #202020;">Parents</span> : JSON_Array;
<span style="color: #00007f;">begin</span>
   ...
   <span style="color: #202020;">Append</span> <span style="color: #66cc66;">&#40;</span>Arr =&gt; Parents,
           Val =&gt; Create <span style="color: #66cc66;">&#40;</span><span style="color: #7f007f;">&quot;Linus Torvalds&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
   Append <span style="color: #66cc66;">&#40;</span>Arr =&gt; Parents,
           Val =&gt; Create <span style="color: #66cc66;">&#40;</span><span style="color: #7f007f;">&quot;Alan Cox&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
   Append <span style="color: #66cc66;">&#40;</span>Arr =&gt; Parents,
           Val =&gt; Create <span style="color: #66cc66;">&#40;</span><span style="color: #7f007f;">&quot;Greg Kroah-Hartman&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
   Set_Field <span style="color: #66cc66;">&#40;</span>Val        =&gt; Penguin,
              Field_Name =&gt; <span style="color: #7f007f;">&quot;parents&quot;</span>,
              Field      =&gt; Parents<span style="color: #66cc66;">&#41;</span>;
&nbsp;
   Put_Line <span style="color: #66cc66;">&#40;</span><span style="color: #7f007f;">&quot;Linux got&quot;</span> 
             &amp; Natural'Image <span style="color: #66cc66;">&#40;</span>Length <span style="color: #66cc66;">&#40;</span>Parents<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> 
             &amp; <span style="color: #7f007f;">&quot; parents.&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
   Put_Line <span style="color: #66cc66;">&#40;</span><span style="color: #7f007f;">&quot;They are:&quot;</span><span style="color: #66cc66;">&#41;</span>;
   <span style="color: #00007f;">for</span> J <span style="color: #46aa03; font-weight:bold;">in</span> <span style="color: #ff0000;">1</span> ..  <span style="color: #202020;">Length</span> <span style="color: #66cc66;">&#40;</span>Parents<span style="color: #66cc66;">&#41;</span> <span style="color: #00007f;">loop</span>
      Put_Line <span style="color: #66cc66;">&#40;</span><span style="color: #7f007f;">&quot; &quot;</span> &amp; Get <span style="color: #66cc66;">&#40;</span>Get <span style="color: #66cc66;">&#40;</span>Parents, J<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
   <span style="color: #00007f;">end</span> <span style="color: #00007f;">loop</span>;</pre></div></div>

<p>Woah! Lots of new stuff going on here. Lets take it from the top. First we declare a new <code>JSON_Array</code> object: <code>Parents</code>. We then append <code>JSON_Value</code> objects to <code>Parents</code> using the <code>Append</code> procedure, which takes a <code>JSON_Array</code> as its first parameter and a <code>JSON_Value</code> as its second. If you&#8217;ve programmed for more than 2 weeks, you should already have guessed that the value of the second parameter is appended to the <code>JSON_Array</code> given as the first parameter. There&#8217;s an alternative method: Using the &#8220;&amp;&#8221; function. It&#8217;s slower, but to some the code is more readable:</p>

<div class="wp_syntax"><div class="code"><pre class="ada" style="font-family:monospace;">Parents := Parents &amp; Create <span style="color: #66cc66;">&#40;</span><span style="color: #7f007f;">&quot;Linus Torvalds&quot;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>I personally like the <code>Append</code> approach, but you can use whatever floats your boat. Naturally you can append both <code>JSON_Value's</code> and <code>JSON_Array's</code>.</p>
<p>Next we have the <code>Create</code> function. There&#8217;s a series of <code>Create</code> functions in the GNATCOLL.JSON package, each returning a <code>JSON_Value</code> containing the data given in its sole parameter. In our case we give <code>Create</code> a <code>String</code>, so it returns a <code>JSON_Value</code> where the <code>JSON_Value_Type</code> is <code>JSON_String_Type</code>.</p>
<p>The <code>Length (Parents)</code> call returns the amount (<code>Natural</code>) of items in the <code>Parents</code> array, and in the loop we make use of that number to set the range. It would&#8217;ve been nice to not have to define the lower bound of the range with an actual number. I would&#8217;ve much preferred something like <code>Parents'Range</code>, but hey, you can&#8217;t have it all.</p>
<p>In the loop we stumble on a less than pretty construction:</p>

<div class="wp_syntax"><div class="code"><pre class="ada" style="font-family:monospace;">   Put_Line <span style="color: #66cc66;">&#40;</span><span style="color: #7f007f;">&quot; &quot;</span> &amp; Get <span style="color: #66cc66;">&#40;</span>Get <span style="color: #66cc66;">&#40;</span>Parents, J<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Gaggle! Lots of Get&#8217;ing going on there. But before you tear your hair out in frustration, lets take a look at the specification for the two <code>Get</code> functions used here:</p>

<div class="wp_syntax"><div class="code"><pre class="ada" style="font-family:monospace;"><span style="color: #46aa03; font-weight:bold;">function</span> Get 
  <span style="color: #66cc66;">&#40;</span>Arr : JSON_Array; Index : Positive<span style="color: #66cc66;">&#41;</span> 
  <span style="color: #00007f;">return</span> JSON_Value;
&nbsp;
<span style="color: #46aa03; font-weight:bold;">function</span> Get 
  <span style="color: #66cc66;">&#40;</span>Val : JSON_Value<span style="color: #66cc66;">&#41;</span> 
  <span style="color: #00007f;">return</span> UTF8_String;</pre></div></div>

<p>Aha! Suddenly everything makes sense again. One could argue that readability could&#8217;ve been improved slighty, had the innermost call been named differently, but since that&#8217;s not the case, we&#8217;re just going to have to live with Get&#8217;ing twice.</p>
<p>Finally we output the JSON we&#8217;ve created:</p>

<div class="wp_syntax"><div class="code"><pre class="ada" style="font-family:monospace;">Put_Line <span style="color: #66cc66;">&#40;</span>Write <span style="color: #66cc66;">&#40;</span>Penguin<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Executing the program results in this:</p>
<p><code>Yes, Penguin is a JSON object<br />
Our Penguin is named Linux<br />
Linux got 3 parents.<br />
They are:<br />
 Linus Torvalds<br />
 Alan Cox<br />
 Greg Kroah-Hartman<br />
{"parents":["Linus Torvalds", "Alan Cox", "Greg Kroah-Hartman"], "name":"Linux"}</code></p>
<p>Amazing! Now, just as there&#8217;s a <code>Write</code> function for turning a JSON object into a <code>String</code>, there&#8217;s also a <code>Read</code> function to turn a JSON <code>String</code> into a <code>JSON_Value</code> object:</p>

<div class="wp_syntax"><div class="code"><pre class="ada" style="font-family:monospace;">   ...
   <span style="color: #202020;">Pingu</span> : JSON_Value;
<span style="color: #00007f;">begin</span>
   ...
   <span style="color: #202020;">Pingu</span> := Read <span style="color: #66cc66;">&#40;</span>Strm     =&gt; Write <span style="color: #66cc66;">&#40;</span>Penguin<span style="color: #66cc66;">&#41;</span>,
                  Filename =&gt; <span style="color: #7f007f;">&quot;debug.file&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
   Set_Field <span style="color: #66cc66;">&#40;</span>Val        =&gt; Pingu,
              Field_Name =&gt; <span style="color: #7f007f;">&quot;name&quot;</span>,
              Field      =&gt; <span style="color: #7f007f;">&quot;Pingu&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
   Set_Field <span style="color: #66cc66;">&#40;</span>Val        =&gt; Pingu,
              Field_Name =&gt; <span style="color: #7f007f;">&quot;parents&quot;</span>,
              Field      =&gt; <span style="color: #7f007f;">&quot;Otmar Gutmann&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
   Put_Line <span style="color: #66cc66;">&#40;</span>Write <span style="color: #66cc66;">&#40;</span>Pingu<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>We <code>Read</code> the JSON <code>String</code> generated by the <code>Write (Penguin)</code> call into our newly declared <code>Pingu</code> object. The <code>Filename</code> parameter gives a file to where error messages are written, in case the given JSON <code>String</code> is mangled in some way. The two <code>Set_Field</code> calls overwrite the <code>name</code> and <code>parents</code> fields with new values (another famous penguin!), and finally we output the new JSON <code>String</code>, adding this to the previous output:</p>
<p><code>{"parents":"Otmar Gutmann", "name":"Pingu"}</code></p>
<p>Neat eh?</p>
<p>Using the <code>Map_JSON_Object</code> procedure it is also possible to iterate a <code>JSON_Value</code> object:</p>

<div class="wp_syntax"><div class="code"><pre class="ada" style="font-family:monospace;"><span style="color: #46aa03; font-weight:bold;">procedure</span> Map_JSON_Object
  <span style="color: #66cc66;">&#40;</span>Val : JSON_Value;
   CB  : <span style="color: #46aa03; font-weight:bold;">access</span> <span style="color: #46aa03; font-weight:bold;">procedure</span> <span style="color: #66cc66;">&#40;</span>Name : UTF8_String; Value : JSON_Value<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>So as you can see, you can do most everything with the tools available in GNATCOLL.JSON &#8211; there is though one thing I feel is missing: Facilities to delete fields in a <code>JSON_Value</code> object, but I&#8217;m sure these will come as the package matures.</p>
<p>For the sake of completeness, here&#8217;s the full listing of our penguin example:</p>

<div class="wp_syntax"><div class="code"><pre class="ada" style="font-family:monospace;"><span style="color: #46aa03; font-weight:bold;">with</span> Ada.<span style="color: #202020;">Text_IO</span>;
<span style="color: #46aa03; font-weight:bold;">with</span> GNATCOLL.<span style="color: #202020;">JSON</span>;
&nbsp;
<span style="color: #46aa03; font-weight:bold;">procedure</span> JSON_Fun <span style="color: #00007f;">is</span>
   <span style="color: #46aa03; font-weight:bold;">use</span> Ada.<span style="color: #202020;">Text_IO</span>;
   <span style="color: #46aa03; font-weight:bold;">use</span> GNATCOLL.<span style="color: #202020;">JSON</span>;
&nbsp;
   Penguin : <span style="color: #46aa03; font-weight:bold;">constant</span> JSON_Value := Create_Object;
   Pingu   : JSON_Value;
   Parents : JSON_Array;
<span style="color: #00007f;">begin</span>
   <span style="color: #00007f;">if</span> Kind <span style="color: #66cc66;">&#40;</span>Penguin<span style="color: #66cc66;">&#41;</span> = JSON_Object_Type <span style="color: #00007f;">then</span>
      Put_Line <span style="color: #66cc66;">&#40;</span><span style="color: #7f007f;">&quot;Yes, Penguin is a JSON object&quot;</span><span style="color: #66cc66;">&#41;</span>;
   <span style="color: #00007f;">end</span> <span style="color: #00007f;">if</span>;
&nbsp;
   Set_Field <span style="color: #66cc66;">&#40;</span>Val        =&gt; Penguin,
              Field_Name =&gt; <span style="color: #7f007f;">&quot;name&quot;</span>,
              Field      =&gt; <span style="color: #7f007f;">&quot;Linux&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
   <span style="color: #00007f;">if</span> Has_Field <span style="color: #66cc66;">&#40;</span>Penguin, <span style="color: #7f007f;">&quot;name&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #00007f;">then</span>
      Put_Line <span style="color: #66cc66;">&#40;</span><span style="color: #7f007f;">&quot;Our Penguin is named &quot;</span> &amp; Get <span style="color: #66cc66;">&#40;</span>Penguin, <span style="color: #7f007f;">&quot;name&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
   <span style="color: #00007f;">end</span> <span style="color: #00007f;">if</span>;
&nbsp;
   Append <span style="color: #66cc66;">&#40;</span>Arr =&gt; Parents,
           Val =&gt; Create <span style="color: #66cc66;">&#40;</span><span style="color: #7f007f;">&quot;Linus Torvalds&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
   Append <span style="color: #66cc66;">&#40;</span>Arr =&gt; Parents,
           Val =&gt; Create <span style="color: #66cc66;">&#40;</span><span style="color: #7f007f;">&quot;Alan Cox&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
   Append <span style="color: #66cc66;">&#40;</span>Arr =&gt; Parents,
           Val =&gt; Create <span style="color: #66cc66;">&#40;</span><span style="color: #7f007f;">&quot;Greg Kroah-Hartman&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
   Set_Field <span style="color: #66cc66;">&#40;</span>Val        =&gt; Penguin,
              Field_Name =&gt; <span style="color: #7f007f;">&quot;parents&quot;</span>,
              Field      =&gt; Parents<span style="color: #66cc66;">&#41;</span>;
&nbsp;
   Put_Line <span style="color: #66cc66;">&#40;</span><span style="color: #7f007f;">&quot;Linux got&quot;</span> 
             &amp; Natural'Image <span style="color: #66cc66;">&#40;</span>Length <span style="color: #66cc66;">&#40;</span>Parents<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> 
             &amp; <span style="color: #7f007f;">&quot; parents.&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
   Put_Line <span style="color: #66cc66;">&#40;</span><span style="color: #7f007f;">&quot;They are:&quot;</span><span style="color: #66cc66;">&#41;</span>;
   <span style="color: #00007f;">for</span> J <span style="color: #46aa03; font-weight:bold;">in</span> <span style="color: #ff0000;">1</span> ..  <span style="color: #202020;">Length</span> <span style="color: #66cc66;">&#40;</span>Parents<span style="color: #66cc66;">&#41;</span> <span style="color: #00007f;">loop</span>
      Put_Line <span style="color: #66cc66;">&#40;</span><span style="color: #7f007f;">&quot; &quot;</span> &amp; Get <span style="color: #66cc66;">&#40;</span>Get <span style="color: #66cc66;">&#40;</span>Parents, J<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
   <span style="color: #00007f;">end</span> <span style="color: #00007f;">loop</span>;
&nbsp;
   Put_Line <span style="color: #66cc66;">&#40;</span>Write <span style="color: #66cc66;">&#40;</span>Penguin<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
   Pingu := Read <span style="color: #66cc66;">&#40;</span>Strm     =&gt; Write <span style="color: #66cc66;">&#40;</span>Penguin<span style="color: #66cc66;">&#41;</span>,
                  Filename =&gt; <span style="color: #7f007f;">&quot;debug.file&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
   Set_Field <span style="color: #66cc66;">&#40;</span>Val        =&gt; Pingu,
              Field_Name =&gt; <span style="color: #7f007f;">&quot;name&quot;</span>,
              Field      =&gt; <span style="color: #7f007f;">&quot;Pingu&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
   Set_Field <span style="color: #66cc66;">&#40;</span>Val        =&gt; Pingu,
              Field_Name =&gt; <span style="color: #7f007f;">&quot;parents&quot;</span>,
              Field      =&gt; <span style="color: #7f007f;">&quot;Otmar Gutmann&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
   Put_Line <span style="color: #66cc66;">&#40;</span>Write <span style="color: #66cc66;">&#40;</span>Pingu<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #00007f;">end</span> JSON_Fun;</pre></div></div>

<p>I hope you&#8217;ve enjoyed reading this short introduction to the GNATCOLL.JSON package. Ada and JSON is a pretty good match, so if you don&#8217;t need or want all the complexities of XML, then give JSON a chance. The tools are available and they are pretty good.</p>
<p>If you&#8217;d like to see some more Ada and GNATCOLL.JSON code, try grabbing the <a href="https://github.com/ThomasLocke/JSON_test">JSON_Test project</a> from my GitHub page, or you can read about it at the <a href="http://wiki.ada-dk.org/index.php/Handling_JSON_Using_GNATColl">Ada-DK Wiki</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.fsfe.org/thomaslocke/2011/11/18/ada-with-a-side-of-json/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Stop the Internet Blacklist Legislation!</title>
		<link>http://blogs.fsfe.org/thomaslocke/2011/11/05/stop-the-internet-blacklist-legislation/</link>
		<comments>http://blogs.fsfe.org/thomaslocke/2011/11/05/stop-the-internet-blacklist-legislation/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 20:50:07 +0000</pubDate>
		<dc:creator>Thomas Løcke</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://blogs.fsfe.org/thomaslocke/?p=22</guid>
		<description><![CDATA[Today I g+&#8217;ed about the crap that is the PROTECT IP Act, but I feel the links deserve to be copied on this blog also, so without further ado: wiredforchange.com petition fightforthefuture.org petition (great video here) demandprogress.org petition Please go sign those petitions. Make your voice heard. I know it might not seem all that [...]]]></description>
			<content:encoded><![CDATA[<p>Today I <a href="https://plus.google.com/u/0/112815721307813813920/posts/FKAd3X3ewBz" title="Stop the PROTECT IP Act">g+&#8217;ed</a> about the crap that is the PROTECT IP Act, but I feel the links deserve to be copied on this blog also, so without further ado:</p>
<ul>
<li><a href="https://wfc2.wiredforchange.com/o/9042/p/dia/action/public/?action_KEY=%208173" title="wiredforchange.com petition">wiredforchange.com petition</a></li>
<li><a href="http://fightforthefuture.org/pipa/" title="fightforthefuture.org petition">fightforthefuture.org petition</a> (great video here)</li>
<li><a href="http://act.demandprogress.org/sign/protectip_docs" title="demandprogress.org petition">demandprogress.org petition</a></li>
</ul>
<p>Please go sign those petitions. Make your voice heard. I know it might not seem all that important, but believe me, it is. Every little inch of freedom we surrender is lost forever. We have to fight back now, else we&#8217;ll end up surrendering our digital lives completely to [insert random power monopoly here]. And we don&#8217;t want that. We really don&#8217;t.</p>
<p>The internet is a marvelous tool. It is a thing of wonder. It is worth fighting for. For the first time in the history of man have we made a tool that globally enables people to connect and share. We have built a wondrous thing that can both enlighten the oppressed and help loosen and cut the chains of the downtrodden. We should not relinquish this tool to anybody. Not big media, not government, not any business.</p>
<p>Fight back now. Spread those links. Make sure everybody you know signs them. Your voice matters. The internet belongs to us.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.fsfe.org/thomaslocke/2011/11/05/stop-the-internet-blacklist-legislation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello world!</title>
		<link>http://blogs.fsfe.org/thomaslocke/2011/10/12/hello-world/</link>
		<comments>http://blogs.fsfe.org/thomaslocke/2011/10/12/hello-world/#comments</comments>
		<pubDate>Wed, 12 Oct 2011 20:53:27 +0000</pubDate>
		<dc:creator>Thomas Løcke</dc:creator>
				<category><![CDATA[Ada Programming]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Ada]]></category>

		<guid isPermaLink="false">http://blogs.fsfe.org/thomaslocke/?p=1</guid>
		<description><![CDATA[Yes, the title of this post is sorely missing in the creative department, but it is fitting for the first ever blog post of mine. At this point I don&#8217;t even know what to do with this blog, nor what language to use. Should I go with Danish, or fight my way through poorly spelled [...]]]></description>
			<content:encoded><![CDATA[<p>Yes, the title of this post is sorely missing in the creative department, but it is fitting for the first ever blog post of mine. At this point I don&#8217;t even know what to do with this blog, nor what language to use. Should I go with Danish, or fight my way through poorly spelled and grammatically disastrous English posts?</p>
<p>Who knows. For now I&#8217;m thinking I&#8217;ll go with English, as I&#8217;ll probably be writing mostly about technology, with a strong emphasis on programming and software in general. But I might sneak in a post in Danish once in a while, if the subject gets to complicated for my English vocabulary.</p>
<p>I&#8217;m going to end this introductory post with an Ada code snippet. I do so love the Ada programming language, so it&#8217;s only fitting that she&#8217;s also allowed a quick hello.</p>

<div class="wp_syntax"><div class="code"><pre class="ada" style="font-family:monospace;"><span style="color: #46aa03; font-weight:bold;">with</span> Ada.<span style="color: #202020;">Text_IO</span>;
&nbsp;
<span style="color: #46aa03; font-weight:bold;">procedure</span> Hello <span style="color: #00007f;">is</span>
<span style="color: #00007f;">begin</span>
&nbsp;
   Ada.<span style="color: #202020;">Text_IO</span>.<span style="color: #202020;">Put_Line</span> <span style="color: #66cc66;">&#40;</span><span style="color: #7f007f;">&quot;Hello, world!&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #00007f;">end</span> Hello;</pre></div></div>

<p>Ahh, she&#8217;s a beauty isn&#8217;t she? The source code highlighting plugin in WP3 could though use a bit of work, or rather the CSS that goes along with it. What&#8217;s up with that massive empty area after the code?</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.fsfe.org/thomaslocke/2011/10/12/hello-world/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

