<?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>Stochastic Geometry &#187; C</title>
	<atom:link href="http://www.stochasticgeometry.ie/category/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stochasticgeometry.ie</link>
	<description>Articles on random topics in Programming, Systems Administration, Academia and Industry by Mark Dennehy</description>
	<lastBuildDate>Fri, 27 Jan 2012 17:38:25 +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>andi-servo</title>
		<link>http://www.stochasticgeometry.ie/2010/07/07/andi-servo/</link>
		<comments>http://www.stochasticgeometry.ie/2010/07/07/andi-servo/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 20:11:28 +0000</pubDate>
		<dc:creator>Mark Dennehy</dc:creator>
				<category><![CDATA[Academia]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Robotics]]></category>
		<category><![CDATA[Thesis]]></category>

		<guid isPermaLink="false">http://www.stochasticgeometry.ie/?p=1193</guid>
		<description><![CDATA[<p>﻿ Finally released my linux driver for the Ajeco ANDI-SERVO motion control board.<a href="http://www.stochasticgeometry.ie/wp-content/uploads/2010/06/andi-ser.jpg"><img class="alignleft" style="margin-top: 2px; margin-bottom: 2px; margin-left: 4px; margin-right: 4px;" title="ANDI-SERVO motion control board" src="http://www.stochasticgeometry.ie/wp-content/uploads/2010/06/andi-ser.jpg" alt="ANDI-SERVO motion control board" width="149" height="143" /></a></p>
]]></description>
		<wfw:commentRss>http://www.stochasticgeometry.ie/2010/07/07/andi-servo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VisTablet under Debian Squeeze</title>
		<link>http://www.stochasticgeometry.ie/2009/10/06/vistablet-under-debian-squeeze/</link>
		<comments>http://www.stochasticgeometry.ie/2009/10/06/vistablet-under-debian-squeeze/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 14:00:57 +0000</pubDate>
		<dc:creator>Mark Dennehy</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[600u]]></category>
		<category><![CDATA[aiptek]]></category>
		<category><![CDATA[amd64]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[Gimp]]></category>
		<category><![CDATA[medion]]></category>
		<category><![CDATA[R61]]></category>
		<category><![CDATA[squeeze]]></category>
		<category><![CDATA[tablet]]></category>
		<category><![CDATA[Thinkpad]]></category>
		<category><![CDATA[vistablet]]></category>
		<category><![CDATA[wacom]]></category>
		<category><![CDATA[waltop]]></category>
		<category><![CDATA[X.org]]></category>

		<guid isPermaLink="false">http://stochasticgeometry.wordpress.com/?p=345</guid>
		<description><![CDATA[<!--S-ButtonZ 1.1.5 Start--><!--S-ButtonZ 1.1.5 End--><p><img class="size-full wp-image-348 alignnone" style="border: 1px solid black; margin: 2px;" title="DSCF5570b" src="http://www.stochasticgeometry.ie/wp-content/uploads/2009/10/dscf5570b.jpg" alt="DSCF5570b" width="510" height="379" /></p>
<p>A new toy arrived today &#8211; the VisTablet, which is just a rebadged Aiptek 600U (model number WCK-C121). They sell as Aiptek or Waltop or Medion or any one of a few other names for about €65 on ebay.ie at the moment, so I thought what the heck, I do a fair bit of stuff in Gimp so maybe it&#8217;s worth a look. A few clicks and a week or so later and it arrives. Cue tearing open the box and unwrapping!</p>
<p>Plugging it into the laptop (Thinkpad R61 running Debian Squeeze amd64) got an instant result in that it found the device and allowed cursor movement&#8230; but no actual buttons or pressure sensor stuff, so it couldn&#8217;t work as a tablet. So off to google we go and after trying some frustrating messing about with udev rules (to create <span style="color: #339966;">/dev/apitektablet </span>- which isn&#8217;t necessary it turns out) and hal fdi files (to set up X.org options, which are needed) and I&#8217;d advanced in a posterior direction.</p>
<p>By now we were through the phase where plugging in the device crashed X and had reached the phase where plugging the device <em>out</em> crashed X. At this point, I found that the problem lay in the wacom drivers. See, just because it&#8217;s aiptek hardware doesn&#8217;t mean the aiptek drivers actually work &#8211; in this case, the wacom driver works much better.</p>
<p>But, just to be annoying, the new version of the wacom driver doesn&#8217;t work because it picks up that it&#8217;s not a wacom device and commits seppku to avoid being of any use. Note to the coder who thought that was a good idea &#8211; go choke on a hairball please.</p>
<p>Solution? Go to <a href="http://linuxwacom.sourceforge.net/" target="_blank">linuxwacom</a> and download the latest driver, then untar the tarball, go into <span style="color: #339966;">linuxwacom-0.8.4-2/src/xdrv</span> and edit <span style="color: #339966;">wcmUSB.c</span>. &#8230; <a href="http://www.stochasticgeometry.ie/2009/10/06/vistablet-under-debian-squeeze/" class="read_more">Read the rest</a></p>]]></description>
		<wfw:commentRss>http://www.stochasticgeometry.ie/2009/10/06/vistablet-under-debian-squeeze/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>New CS7004 hardware arrives&#8230;</title>
		<link>http://www.stochasticgeometry.ie/2009/10/06/new-cs7004-hardware-arrives/</link>
		<comments>http://www.stochasticgeometry.ie/2009/10/06/new-cs7004-hardware-arrives/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 14:00:20 +0000</pubDate>
		<dc:creator>Mark Dennehy</dc:creator>
				<category><![CDATA[Academia]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[CS7004]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[New Toys!]]></category>

		<guid isPermaLink="false">http://stochasticgeometry.wordpress.com/?p=355</guid>
		<description><![CDATA[<!--S-ButtonZ 1.1.5 Start--><!--S-ButtonZ 1.1.5 End--><p> So for CS7004&#8242;s labs, I wanted to have one large-ish, deep-ish, multi-step, <em>interesting</em> project. And I&#8217;ve thought of one and I&#8217;ll write it up as we go through it (no fair readers here learning before the students!).</p>
<p>But here&#8217;s a sneak peek at the hardware they&#8217;ll be using <img src='http://www.stochasticgeometry.ie/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>(Assuming, of course, that I can get the sodding thing to do what it needs to do!)</p>
<p><img class="alignnone size-full wp-image-347" style="border:1px solid black;margin:5px;" title="DSCF5577b" src="http://stochasticgeometry.files.wordpress.com/2009/10/dscf5577b.jpg" alt="DSCF5577b" width="512" height="664" /></p>
<div style="clear:both;">&#160;&#8230; <a href="http://www.stochasticgeometry.ie/2009/10/06/new-cs7004-hardware-arrives/" class="read_more">Read the rest</a></div>]]></description>
		<wfw:commentRss>http://www.stochasticgeometry.ie/2009/10/06/new-cs7004-hardware-arrives/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Duct tape considered harmful</title>
		<link>http://www.stochasticgeometry.ie/2009/09/25/duct-tape-considered-harmful/</link>
		<comments>http://www.stochasticgeometry.ie/2009/09/25/duct-tape-considered-harmful/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 14:59:59 +0000</pubDate>
		<dc:creator>Mark Dennehy</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[CS7004]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://stochasticgeometry.wordpress.com/?p=330</guid>
		<description><![CDATA[<img class="alignleft" style="margin-left: 2px; margin-right: 2px;" src="http://www.stochasticgeometry.ie/wp-content/uploads/2009/09/duct-tape-prohibited.png" alt="Duct tape prohibited" width="80" height="80" />Why Joel Spolsky was wrong about 'duct tape programmers' being good programmers.]]></description>
		<wfw:commentRss>http://www.stochasticgeometry.ie/2009/09/25/duct-tape-considered-harmful/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>30 years of C</title>
		<link>http://www.stochasticgeometry.ie/2009/09/22/30-years-of-c/</link>
		<comments>http://www.stochasticgeometry.ie/2009/09/22/30-years-of-c/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 20:52:10 +0000</pubDate>
		<dc:creator>Mark Dennehy</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://stochasticgeometry.wordpress.com/?p=326</guid>
		<description><![CDATA[<!--S-ButtonZ 1.1.5 Start--><!--S-ButtonZ 1.1.5 End--><p>Stop reading here, <a href="http://www.dadhacker.com/blog/?p=1132" target="_blank">go read this</a>.<br />
That is all&#8230;</p>
<div style="clear:both;">&#160;&#8230; <a href="http://www.stochasticgeometry.ie/2009/09/22/30-years-of-c/" class="read_more">Read the rest</a></div>]]></description>
		<wfw:commentRss>http://www.stochasticgeometry.ie/2009/09/22/30-years-of-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DerBlinkenLightenWorken</title>
		<link>http://www.stochasticgeometry.ie/2009/09/16/derblinkenlightenworken/</link>
		<comments>http://www.stochasticgeometry.ie/2009/09/16/derblinkenlightenworken/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 22:26:35 +0000</pubDate>
		<dc:creator>Mark Dennehy</dc:creator>
				<category><![CDATA[Academia]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[CS7004]]></category>

		<guid isPermaLink="false">http://stochasticgeometry.wordpress.com/?p=322</guid>
		<description><![CDATA[<!--S-ButtonZ 1.1.5 Start--><!--S-ButtonZ 1.1.5 End--><p>Okay, I&#8217;ll grant you, it doesn&#8217;t <em>look</em> that impressive. That&#8217;s just the basic &#8216;Blinky&#8217; first-step demo for the Keil MPC2400 board. Basic light chaser using the pot to set the speed of the blinking.</p>
<p>However, it&#8217;s a bit more fun when I note that the Keil environment was run from within Virtualbox on my Debian laptop and it still used the USB JTAG connection to connect to the board and it all worked without a hitch on the first try.</p>
<p>Apart from the obvious convienence this means to me (I don&#8217;t have to dual-boot to programme the board, I can run the exercises from within Linux, which I prefer), it&#8217;s just downright impressive that Virtualbox is that far along.</p>
<p>Well, maybe not to you young kids, but to someone who was in college when the web came along, this is impressive <img src='http://www.stochasticgeometry.ie/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<div style="clear:both;">&#160;&#8230; <a href="http://www.stochasticgeometry.ie/2009/09/16/derblinkenlightenworken/" class="read_more">Read the rest</a></div>]]></description>
		<wfw:commentRss>http://www.stochasticgeometry.ie/2009/09/16/derblinkenlightenworken/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maximum Password Length in Coova-Chilli</title>
		<link>http://www.stochasticgeometry.ie/2009/09/09/maximum-password-length-in-coova-chilli/</link>
		<comments>http://www.stochasticgeometry.ie/2009/09/09/maximum-password-length-in-coova-chilli/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 17:43:19 +0000</pubDate>
		<dc:creator>Mark Dennehy</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://stochasticgeometry.wordpress.com/?p=287</guid>
		<description><![CDATA[<!--S-ButtonZ 1.1.5 Start--><!--S-ButtonZ 1.1.5 End--><p><img class="alignleft size-full wp-image-295" title="Bad Day" src="http://www.stochasticgeometry.ie/wp-content/uploads/2009/09/bad_day.gif" alt="Bad Day" width="150" height="107" />  So for the last few days I&#8217;ve been banging my head up against the same problem in the lab. We currently use <a href="http://chillispot.info/index.html">Chillispot</a> to run our access points for the Metakall user trials, which is grand, but it&#8217;s also fairly out of date &#8211; it hasn&#8217;t been actively developed on since 1997 &#8211; and it has some serious security issues. So with the new academic year looming, we&#8217;re moving over to its successor, <a href="http://www.coova.org/CoovaChilli" target="_blank">Coova-Chilli. </a></p>
<p>Coova has a few neat features we like, and it&#8217;s also being actively maintained, which is important. So I took our testbed server, installed FreeRADIUS and MySQL and Apache and all the custom stuff we&#8217;ve written and generally got things set up, and then went to install the latest version of coova-chilli (1.0.14). There was an hour of swearing at iptables as usual (I really am coming to hate that program), and then I thought that&#8217;d be that.</p>
<p>But of course not.<span id="more-287"></span> The Metakall client wouldn&#8217;t log in. At first I thought the iptables setup was wrong, but no, all&#8217;s well there. FreeRADIUS was fine, so it had to be something in Coova-Chilli. Ah-ha, says I, it&#8217;s that new-fangled JSON captive portal setup, that&#8217;s the problem, I&#8217;ll dig into that. A day and a half later, and I&#8217;ve gone through the JSON portal stuff and can&#8217;t find anything wrong.</p>
<p>Exasperated, I switch Coova back to the old Chillispot configuration files (which are compatible), bypassing all the new JSON stuff and still there&#8217;s a problem.</p>
<p>It&#8217;s at this point that I try to log in manually, which no-one&#8217;s done on the system since we got the client working. And I notice that usernames are passed perfectly to FreeRADIUS. And so are passwords&#8230; up until you feed in more than 15 characters to the password field. Ah-ha. Check &#8230; <a href="http://www.stochasticgeometry.ie/2009/09/09/maximum-password-length-in-coova-chilli/" class="read_more">Read the rest</a></p>]]></description>
		<wfw:commentRss>http://www.stochasticgeometry.ie/2009/09/09/maximum-password-length-in-coova-chilli/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Metakall User Trial</title>
		<link>http://www.stochasticgeometry.ie/2009/04/11/metakall-user-trial/</link>
		<comments>http://www.stochasticgeometry.ie/2009/04/11/metakall-user-trial/#comments</comments>
		<pubDate>Sat, 11 Apr 2009 03:28:18 +0000</pubDate>
		<dc:creator>Mark Dennehy</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://stochasticgeometry.wordpress.com/?p=182</guid>
		<description><![CDATA[<!--S-ButtonZ 1.1.5 Start--><!--S-ButtonZ 1.1.5 End--><p> So this is what I&#8217;ve been up to for the last year; building this pretty much from scratch (rebuilding it in fact) and getting it to the launched stage. Everything from low-level C code for custom servers, to custom freeRADIUS modules (again in C) to the MacOS and iPhone/iPod Touch clients I&#8217;m writing at the moment (Will, if you&#8217;re reading this, I&#8217;m finally using Objective C again <img src='http://www.stochasticgeometry.ie/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  ), and all the project management and dogsbody stuff you&#8217;d expect.</p>
<p>Fingers crossed it works properly <img src='http://www.stochasticgeometry.ie/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p style="padding-left:60px;"><span class="title"><a href="http://metakall.dsg.cs.tcd.ie/Press/UserTrial.txt">METAKALL USER TRIAL KICKS OFF IN TRINITY COLLEGE DUBLIN</a><br />
<img src="http://metakall.dsg.cs.tcd.ie/images/metakall-logo-v3.png" alt="" /></span></p>
<p style="padding-left:60px;"><em>For Immediate Release</em></p>
<p style="padding-left:60px;"><strong>METAKALL USER TRIAL KICKS OFF IN TRINITY COLLEGE DUBLIN</strong></p>
<p style="padding-left:60px;">Dublin, April 10 &#8212; Metakall, a WiFi authentication and metering system, has begun its second user trial in Trinity College Dublin this week for students and staff, allowing access to the internet from mobile devices and allowing them to make phone calls over the internet in cooperation with <a href="http://www.freespeech.ie/">FreeSpeech.ie.</a></p>
<p style="padding-left:60px;">Metakall, which is funded by an Enterprise Ireland grant, may be among the first of 300 companies to spin out under the new joint TCD/UCD Innovation Academy announced last month by the two colleges along with the Taoiseach, Tanaiste, Minster for Finance and Minister for Education.</p>
<p style="padding-left:60px;">Headed up by Dr.Hitesh Tewari, an expert in internet micropayments, the project has a working system but is still working on usability, testing, and on creating new clients for different platforms. Several companies including Eircom and O2 have expressed interest in the technology developed by Metakall, and talks are ongoing regarding a possible installation in San Jose.</p>
<p style="padding-left:60px;">The Metakall system was initially trialled in August last year in TCD. Significant changes have since been made to the technology, which consists of a client which runs on the user&#8217;s laptop or mobile phone, connecting them to the wireless internet system on the &#8230; <a href="http://www.stochasticgeometry.ie/2009/04/11/metakall-user-trial/" class="read_more">Read the rest</a></p>]]></description>
		<wfw:commentRss>http://www.stochasticgeometry.ie/2009/04/11/metakall-user-trial/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>gethostbyname_r()</title>
		<link>http://www.stochasticgeometry.ie/2009/01/29/gethostbyname_r/</link>
		<comments>http://www.stochasticgeometry.ie/2009/01/29/gethostbyname_r/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 15:10:43 +0000</pubDate>
		<dc:creator>Mark Dennehy</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://stochasticgeometry.wordpress.com/?p=110</guid>
		<description><![CDATA[<!--S-ButtonZ 1.1.5 Start--><!--S-ButtonZ 1.1.5 End--><p> Okay, so I can&#8217;t really go into too much of the big picture since this is from the day job, but I can certainly tear into <em>gethostbyname_r()</em> a bit.</p>
<p>For part of what we&#8217;re doing, we&#8217;re sending a RADIUS message using the freeradius project&#8217;s radius client library. So, nice and simple (after you&#8217;ve done some setup):</p>
<div class="codecolorer-container c dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">result <span style="color: #339933;">=</span> rc_acct<span style="color: #009900;">&#40;</span>rh<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> send<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>Easy enough, right? So it fails. Specifically, it segfaults and since it&#8217;s in a multithreaded server, it&#8217;s a pain to track down. And I mean a <em>pain</em>. Hours of fun with DDD, gdb, nana and finally printf() lead to here:</p>
<div class="codecolorer-container c dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">res <span style="color: #339933;">=</span> gethostbyname_r<span style="color: #009900;">&#40;</span>hostname<span style="color: #339933;">,</span> <span style="color: #339933;">&#38;</span>hostbuf<span style="color: #339933;">,</span> tmphostbuf<span style="color: #339933;">,</span> hostbuflen<span style="color: #339933;">,</span> <span style="color: #339933;">&#38;</span>hp<span style="color: #339933;">,</span> <span style="color: #339933;">&#38;</span>herr<span style="color: #009900;">&#41;</span></div></div>
<p>Ah. <em>gethostbyname_r()</em>, the glibc2-reentrant thread-safe version of <em>gethostbyname()</em>. Except that it&#8217;s deprecated, and has the unique property of working differently on just about every machine out there.</p>
<p>And of course, in my machine, and the server, it&#8217;s going nuts. Not because of a dodgy parameter or anything like that, though that took a while to confirm, it&#8217;s going nuts because of the way <em>/etc/nsswitch.conf</em> is written:</p>
<pre>hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4</pre>
<p>That&#8217;s the standard way to write nsswitch.conf in ubuntu &#8211; it first checks the <em> /etc/hosts</em> file, then uses the avahi daemon, then the DNS system.</p>
<p>Only that&#8217;s not good enough for <em>gethostbyname_r()</em>. Grrr. So after a full day bug-chasing through two codebases, the fix is to change a configuration file to this:</p>
<pre>#hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4
hosts:          dns files</pre>
<p>What a waste of a day! Gah!</p>
<p>I&#8217;m going to rewrite the radius-client library to use <em>getaddrinfo() </em>over the next while. I already have to make some changes to it to cope with other things, I may &#8230; <a href="http://www.stochasticgeometry.ie/2009/01/29/gethostbyname_r/" class="read_more">Read the rest</a></p>]]></description>
		<wfw:commentRss>http://www.stochasticgeometry.ie/2009/01/29/gethostbyname_r/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

