<?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>(b)logophile &#187; geek</title>
	<atom:link href="http://www.logophile.org/blog/tags/geek/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.logophile.org/blog</link>
	<description>blog of a logophile (not "logos", but "λόγος")</description>
	<lastBuildDate>Sun, 05 Feb 2012 08:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>The Notion Ink Adam</title>
		<link>http://www.logophile.org/blog/2012/02/05/the-notion-ink-adam/</link>
		<comments>http://www.logophile.org/blog/2012/02/05/the-notion-ink-adam/#comments</comments>
		<pubDate>Sun, 05 Feb 2012 08:00:00 +0000</pubDate>
		<dc:creator>tikitu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[lust]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://www.logophile.org/blog/?p=1236</guid>
		<description><![CDATA[Some time ago I began questing for a movie-playing device. I may have found one, but unfortunately not one which I necessarily should be buying. The potential solution is the Adam, by Notion Ink. It&#8217;s an Android tablet with a Pixel Qi display and (significantly for my quest) both USB and HDMI ports. That means [...]]]></description>
			<content:encoded><![CDATA[<p>Some time ago I began <a href="http://www.logophile.org/blog/2011/05/29/a-gadget-i-would-like/">questing for a movie-playing device</a>. I may have found one, but unfortunately not one which I necessarily should be buying.</p>

<p><span id="more-1236"></span></p>

<p>The potential solution is the Adam, by <a href="http://www.notionink.com/">Notion Ink</a>. It&#8217;s an Android tablet with a Pixel Qi display and (significantly for my quest) both USB and HDMI ports. That means I can carry my library on a portable drive (meaning there&#8217;s basically no upper limit to file size: I can store them as ISOs) and plug the thing into a big screen if such is available (our cheapo movie-watching screen at home via an HDMI-to-DVI plug, for instance, unless I mean DVI-to-HDMI).</p>

<p>There are some downsides. The most significant is that Notion Ink reeks of nerdery. Not that I don&#8217;t fit the demographic, but my experience with the <a href="http://en.wikipedia.org/wiki/ILiad">iLiad by iRex</a> has made me cautious of these bleeding-edge hacker products. The iLiad was a device built on cutting-edge hardware, with open software intended to attract hacking, all put together by a small company. The exact same description fits the Adam. In the case of the iLiad, this led to various problems:</p>

<ul>
<li>The cutting-edge hardware quickly got overtaken by new developments (driven by larger companies with larger R&amp;D budgets, one assumes);</li>
<li>The cutting-edge hardware also required custom software support, which meant that almost no standard software could be easily ported to the device (this will be less of a problem with the Adam, because the display technology is <em>more</em> standard, although not entirely);</li>
<li>Because of a small but devoted user community of hackers, the company themselves didn&#8217;t need to polish their software to gleaming perfection: they made clunky but working solutions, which the users either put up with or hacked around;</li>
<li>Similarly, the physical design of the device had all sorts of minor issues that a larger company with more time (and money) for design cycles would have eliminated; again the hacker-ish ethos of much of the user base means that there wasn&#8217;t any strong pressure to improve on these problems;</li>
<li>The company went out of business in 2010; you can&#8217;t get iLiad components any more, and lots of the connectors (being somewhat prototypy) were decidedly non-standard.</li>
</ul>

<p>The end result was a product that was at the same time incredibly exciting and incredibly frustrating. You could spend hours messing about with hacked versions of the OS and basic utilities &#8212; and I did. (If you were hardcore, of course, you contributed to these projects. I wasn&#8217;t hardcore.) At the same time, you <em>had</em> to spend hours installing hacked versions of the utilities if you wanted a usable device; or when you found the latest Cool Thing (&#8220;a web browser!&#8221;) that would work if you just installed someone&#8217;s hacked connection manager, which however didn&#8217;t include someone else&#8217;s additions to the connection manager so you had to compile a merged version yourself, etc etc. All wonderful fun, but also taking an incredible amount of time.</p>

<p>And now, the battery of my iLiad no longer holds a charge; the AC cable, though, only works if you prop it up at the right angle (said angle being inconsistent with comfortable reading). Since the company went bust, the proprietory cloud-based content management stuff presumably doesn&#8217;t work any more, so you need the cable hub which (again) needs careful positioning to make it work. And so on and so on: the first-generation hardware design has meant that the device hasn&#8217;t really survived the death of its support company.</p>

<p>Which brings me to Notion Ink. They&#8217;re a small independent company, competing with the iPad and the increasing number of increasingly slick Android tablets on the market: going up against giants like Apple and Samsung. They&#8217;re writing custom software to make things go, which <a href="http://notionink.wordpress.com/2012/01/14/here-is-the-alpha/">doesn&#8217;t always run smoothly</a>: as long as the company is in business you&#8217;ll get support, but if they go under then you&#8217;re on your own.</p>

<p>As for my original needs, there&#8217;s one sticking point: I&#8217;m still not aware of any ISO player for Android. (<a href="http://en.daroonsoft.com/">Daroon Player</a> reportedly plays unconverted DVD folders, which is probably close enough, but I haven&#8217;t put it to the test.)</p>

<p>And then there&#8217;s one more problem. The Adam is a tablet. I already have an Android tablet (the Samsung Galaxy Tab, ridiculously overpriced and bought in a moment of foolishness: I use it every day, and it doesn&#8217;t need replacing). I&#8217;m going to buy an iPad (lured by various apps only available on iOS), although possibly secondhand. It&#8217;s hard to justify the idea of owning <em>three</em> of these things&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.logophile.org/blog/2012/02/05/the-notion-ink-adam/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Some tips for Osmos</title>
		<link>http://www.logophile.org/blog/2012/01/23/some-tips-for-osmos/</link>
		<comments>http://www.logophile.org/blog/2012/01/23/some-tips-for-osmos/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 16:00:00 +0000</pubDate>
		<dc:creator>tikitu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[physics]]></category>

		<guid isPermaLink="false">http://www.logophile.org/blog/?p=1223</guid>
		<description><![CDATA[The fantastic game Osmos has finally come to Android. In celebration of which, here are a couple of tips for playing it well. They are based on some similar remarks by Mat Jarvis. The first tip expands on Mat&#8217;s &#8220;Vidiian Technique&#8221;: using ejecta to push a mote that&#8217;s too big to absorb into an even [...]]]></description>
			<content:encoded><![CDATA[<p>The fantastic game <a href="http://www.hemispheregames.com/osmos/"><em>Osmos</em></a> has finally come to Android. In celebration of which, here are a couple of tips for playing it well. They are based on <a href="http://www.microscopics.co.uk/blog/2012/osmos-tips-for-a-long-and-happy-life/">some similar remarks by Mat Jarvis</a>.</p>

<p><span id="more-1223"></span></p>

<p>The first tip expands on Mat&#8217;s &#8220;Vidiian Technique&#8221;: using ejecta to push a mote that&#8217;s too big to absorb into an even bigger mote, thus cutting it down to size. My addition here is <em>patience</em>: use the bare minimum force necessary to get the thing moving (most likely a single push). When it gets small enough and you plow into it, it will start shrinking from your side; if this happens quickly enough, the shrinkage will make it lose contact with the larger mote that was absorbing it on the other side, so you&#8217;re no longer competing with Big Daddy for dinner.</p>

<p>The other tips are about orbital mechanics, and they come from reading science fiction.<sup>1</sup> The good news is, they&#8217;re not restricted to <em>Osmos</em>: if you ever find yourself in freefall orbit, they&#8217;ll come in handy in real life!<sup>2</sup></p>

<p>The first thing you have to get straight is the connection between your orbit and the speed you travel at. Any motes on exactly the same orbit will move with exactly the same speed. That means if your path-projection stays glued to some particular mote, you&#8217;ll never catch it. You can catch up on motes &#8220;above&#8221; you (farther from the &#8220;sun&#8221;), and ones &#8220;below&#8221; you will catch up on you (but so long as the orbits stay fairly circular, &#8220;catching up&#8221; doesn&#8217;t mean you&#8217;ll touch, just that at some point you&#8217;ll have the same angular position).</p>

<p>To understand how your speed depends on the size of your orbit you need to note the difference between angular speed (measured by how long it takes you to make one complete revolution around the &#8220;sun&#8221;: shorter means faster, in &#8220;rounds per second&#8221;) and speed <em>simpliciter</em> (measured by how long it takes to cover a fixed distance, e.g. in km/h). A high speed gives you a large orbit, which (counterintuitively) means a <em>lower</em> angular speed (by going <em>faster</em> you make a wider circle, which takes <em>longer</em> to complete one revolution around the &#8220;sun&#8221;).</p>

<p>So how do you catch up on that juicy mote sitting exactly in your orbit, tantalisingly close ahead of you? <em>Not</em> by jetting yourself towards it: speeding up will move you into a higher orbit, and you&#8217;ll see your target creep away from you (although you&#8217;re moving faster than you were, your angular speed has decreased so the angle between you and your target is widening).<sup>3</sup> Instead, you expel mass <em>towards</em> your target: you jet directly away from it. That drops you into a lower orbit, which lets you close the angular gap; when you&#8217;re directly below your target, or perhaps a little ahead, speed up again (in the direction of your orbit) to raise your orbit to meet it.</p>

<p>Likewise, to catch a mote in your orbit but behind you, you <em>speed up</em> (jetting yourself away from it). This pushes you into a higher orbit, which is slower (in angular terms): your target catches up on your angular position, and when the time comes you slow yourself again to drop down on it from above.</p>

<p>The other thing to note about orbital mechanics is that they don&#8217;t work in circles but in ellipses. When you slow down you don&#8217;t, in fact, drop into a lower <em>circular</em> orbit. Your orbit from any point <em>x</em> will pass again through <em>x</em> (barring interruptions on the way &#8212; and only on single-attractor levels!), but if you slow down at <em>x</em> (starting from a circular orbit) then you&#8217;ll reach your lowest point directly across from <em>x</em>, on the opposite side of the &#8220;sun&#8221;. Such cometary orbits (elongated ellipses) are risky if they cut through the (roughly circular) orbits of larger motes (if your orbital periods don&#8217;t match, there&#8217;s a good chance that after some number of revolutions you&#8217;ll collide). Luckily, returning yourself to a roughly circular orbit is easy: when you reach the lowest point of your orbit, slow down again by the same amount you used to first deform your original orbit. Similarly, going to a larger circular orbit requires speeding up twice: first transforming your circle to an ellipse, then at the ellipse&#8217;s <em>largest</em> point (opposite your first jet) you speed up again, transforming the ellipse back to a circle. With your orbital prediction path turned on it&#8217;s very easy to see whether you&#8217;ve got this right or not.</p>

<p>You can use these orbital mechanics to devious effect. If the only remaining mote is bigger than you and close to the sun, you haven&#8217;t necessarily lost yet. Use your ejecta to <em>slow it down</em>, and it will fall into lower and lower orbits. (For best effect, time your missiles to catch it at the high point of its orbit: a change in speed has its most extreme effects at the orbital position opposite to where the change occurs, so to make its low end lower you hit it at its high end.) With a bit of care (don&#8217;t forget that these missiles change your orbit too!) you can send it to die in the sun, leaving you the winner by default.</p>

<p>In conclusion, as I have argued above, you should play <em>Osmos</em> because it&#8217;s educational. If you ever drift away from the station during an EVA, it might even save your life.</p>
<p>Notes:</p><ol class="footnotes"><li id="footnote_0_1223" class="footnote">Possibly Neal Stephenson&#8217;s <a href="http://www.librarything.com/work/5116802"><em>Anathem</em></a>, although I wouldn&#8217;t swear to it &#8212; they might just be an amalgamation of a infodumps from a whole <em>host</em> of bad sf novels and shorts.</li><li id="footnote_1_1223" class="footnote">Although things are much more complicated in three dimensions: you have to deal not just with speed but with velocity &#8211;speed plus direction&#8211; since objects orbiting in different planes can quickly spread apart or &#8211;catastrophically&#8211; come together as their orbital planes diverge and converge.</li><li id="footnote_2_1223" class="footnote">This is like overtaking on a corner: you have more distance to cover, so you have to drive faster just to keep level. Only here the road is all corner, and as you go faster they handicap you by moving you to the outer lanes.</li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.logophile.org/blog/2012/01/23/some-tips-for-osmos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Virtualbox guest additions on vagrant-ised CentOS box</title>
		<link>http://www.logophile.org/blog/2011/10/18/virtualbox-guest-additions-on-vagrant-ised-centos-box/</link>
		<comments>http://www.logophile.org/blog/2011/10/18/virtualbox-guest-additions-on-vagrant-ised-centos-box/#comments</comments>
		<pubDate>Tue, 18 Oct 2011 14:22:32 +0000</pubDate>
		<dc:creator>tikitu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[frustration]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[triumph]]></category>

		<guid isPermaLink="false">http://www.logophile.org/blog/?p=1125</guid>
		<description><![CDATA[Hoping this might be useful for someone else, since Google didn&#8217;t turn up the answer for me. I got a vagrant-packaged CentOS box from a colleague, and starting it up warned me that the VirtualBox Guest Additions were out of date. Fixing things involved these steps: Get VirtualBox to &#8220;Install Guest Additions&#8221; (from the Devices [...]]]></description>
			<content:encoded><![CDATA[<p>Hoping this might be useful for someone else, since Google didn&#8217;t turn up the answer for me.</p>

<p>I got a vagrant-packaged CentOS box from a colleague, and starting it up warned me that the VirtualBox Guest Additions were out of date. Fixing things involved these steps:</p>

<ol>
<li>Get VirtualBox to &#8220;Install Guest Additions&#8221; (from the Devices menu of the running VM). Don&#8217;t be fooled: VirtualBox has not, in fact, installed the guest additions at this point.<sup>1</sup></li>
<li>What it has done is added the ISO as if it were a cdrom device: you have to mount it and run an install script. This is in the VirtualBox docs, but everything I found assumed the ISO would be on device <code>/dev/cdrom</code>. In my case, though, <code>/dev/cdrom</code> was very handily attached to the cdrom device on my host machine. (Vagrant setup did it? VirtualBox did it by default? Not sure.)</li>
<li>Turns out the device you want is <code>/dev/cdrom1</code> (yeah, obvious in retrospect). Mount that, run the install script, done.</li>
</ol>
<p>Notes:</p><ol class="footnotes"><li id="footnote_0_1125" class="footnote">Yes, this is a rather astonishing failure of UI design. But one that is fairly well-known, googlable, and not the root of the problem here.</li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.logophile.org/blog/2011/10/18/virtualbox-guest-additions-on-vagrant-ised-centos-box/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Subtleties of Turing machines</title>
		<link>http://www.logophile.org/blog/2011/05/07/subtleties-of-turing-machines/</link>
		<comments>http://www.logophile.org/blog/2011/05/07/subtleties-of-turing-machines/#comments</comments>
		<pubDate>Sat, 07 May 2011 14:07:46 +0000</pubDate>
		<dc:creator>tikitu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[ramblings]]></category>
		<category><![CDATA[theory]]></category>

		<guid isPermaLink="false">http://www.logophile.org/blog/?p=1058</guid>
		<description><![CDATA[During a discussion with Boaz at work about Turing machines,1 I realised something new about them that I find rather fascinating. As a slogan: &#8220;The Read/Write Head Matters&#8221;; you don&#8217;t get Turing-equivalence just by adding unbounded memory to a state machine, you need just the right kind of addressing into that memory as well.2 If [...]]]></description>
			<content:encoded><![CDATA[<p>During a discussion with Boaz at work about Turing machines,<sup>1</sup> I realised something new about them that I find rather fascinating. As a slogan: &#8220;The Read/Write Head Matters&#8221;; you don&#8217;t get Turing-equivalence just by adding unbounded memory to a state machine, you need <em>just the right kind of addressing</em> into that memory as well.<sup>2</sup> If you grok this like I did, it&#8217;s almost obvious. Judging by Boaz&#8217;s reaction, if you don&#8217;t grok it like I did then it&#8217;s either wrong or uninteresting (or both). So here&#8217;s my attempt to enworden this little epiphany; hopefully someone else somewhere might get that sensation of little lights going on when they read it.</p>

<p><span id="more-1058"></span></p>

<p>The naïve picture of a Turing machine, that I had until this discussion, is that it&#8217;s just a state machine with an unlimited memory store attached. Since we&#8217;re so familiar with random-access memory these days, it&#8217;s natural to picture this as a memory array, indexed by (say) integers. If you&#8217;ve simulated a Turing machine, that&#8217;s probably how you did it. (At least, it&#8217;s how I did it.) The &#8220;read/write head&#8221; is implemented as an index variable (giving the current position in the &#8220;tape&#8221; array), and &#8220;moving it&#8221; means incrementing or decrementing it.</p>

<p>Now of course if you intend this to completely represent a Turing machine, you run into unboundedness problems. Since a TM running a program can require unbounded tape space, there is some program out there that will require your TM to index into the array beyond the limit of the integer representation of whatever language you&#8217;re using for your simulation.<sup>3</sup> &#8220;Of course,&#8221; you say at that point, &#8220;but it&#8217;s not a <em>real</em> Turing machine because our memory is limited.&#8221;</p>

<p>My epiphany is that <em>this is not the same problem</em>.</p>

<p>To get there, imagine that we decide to &#8220;improve&#8221; our TM simulation by allowing it random access to the memory. Instead of the operations <em>shift left/right</em> on the index register, we have simply <em>goto</em> (whichever value the index register currently holds). We should be able to access the same range of tape, without all that tiresome shuttling left and right! Once we work out how to put values into the index register.</p>

<p>Here&#8217;s where it falls apart. If those values come purely from the state machine component, then only boundedly many elements of the memory tape can be accessed: the memoryless state machine can only generate boundedly many distinct indices.<sup>4</sup> This is still true even if you allow the state machine to use the current memory-cell value in generating its index, although that&#8217;s slightly trickier.<sup>5</sup> What <em>does</em> work is to let the index calculation depend on the state machine <em>plus the current index</em>. (It&#8217;s easy to implement a shift-left/shift-right function, and then you&#8217;re back where you started from.) But that seems to be cheating: now you&#8217;ve got <em>two</em> unbounded memory stores, one for the tape and one for the index into the tape.<sup>6</sup></p>

<p>Now here&#8217;s the interesting question: Where is this extra memory hiding in Turing&#8217;s formulation of the machine? And the answer: It&#8217;s in the position of the read/write head. That gives an arbitrary index into the unbounded memory. The crucial point is that this index is <em>remembered</em> (and can be operated on): it&#8217;s an extra kind of memory the machine has. And although the operations are bounded (left-shift/right-shift by only one cell), they are <em>local</em> to the current position (a relative addressing scheme) so given the persistence of the index they can accumulate unboundedly.</p>

<p><em>PS</em> So how <em>should</em> you simulate your Turing machine to avoid this conceptual trap? Boaz suggested using a block of wood as the &#8220;pointer&#8221;, which works if you have a reliable supply of paper for the tape<sup>7</sup> and don&#8217;t mind emigrating if the pointer crosses a national border at some point during your computation. If you prefer to stay digital, a <a href="http://en.wikipedia.org/wiki/Counter_machine#Step_1:_A_Turing_machine_can_be_simulated_by_two_stacks.">two-stack machine</a> does away with the implicit array-index in exactly the right way.</p>
<p>Notes:</p><ol class="footnotes"><li id="footnote_0_1058" class="footnote">It started with news of a <a href="http://e6h.de/post/7/">Turing machine implemented in Django&#8217;s templating language</a>. Boaz was unimpressed: &#8220;Turing completeness isn&#8217;t that hard, Minesweeper is Turing-complete.&#8221; That can&#8217;t be right, I said, you mean <a href="http://for.mat.bham.ac.uk/R.W.Kaye/minesw/ordmsw.htm">Minesweeper is NP-complete</a>. A game of Minesweeper is a problem to be solved, not a computational system. <a href="http://web.mat.bham.ac.uk/R.W.Kaye/minesw/infmsw.pdf">But I was wrong</a>.</li><li id="footnote_1_1058" class="footnote">Spoiler: what you need is a <em>second</em> unbounded memory for indexing, and bounded operations on that memory to manipulate it. Which is exactly what the read/write head gives you. Clever old Al&#8217;.</li><li id="footnote_2_1058" class="footnote">Assuming you&#8217;re not using LISP or Python or whatever. Work with me here, I&#8217;m trying to make a rhetorical point, all right?</li><li id="footnote_3_1058" class="footnote">Bounded by some calculation based on the number of states of the machine and the size of the alphabet.</li><li id="footnote_4_1058" class="footnote">It seems as if there is potential for recursion: as you index more memory you can use it to store more state, thus allowing to index yet more memory. In fact, though, this isn&#8217;t the case. It&#8217;s easiest to see if you imagine a separate TM doing the address calculation. Its tape always starts blank: the only way it can vary its computation is based on which state the original machine is in, and what value the original machine is reading at that moment. But there are a fixed number of possibilities, based on the number of states the machine has and the size of the alphabet: that number is how many distinct computations the &#8220;address machine&#8221; can run on the empty tape, which is then the maximum number of distinct addresses it can generate.</li><li id="footnote_5_1058" class="footnote">To formulate this precisely, imagine as in the previous note that we have an &#8220;address machine&#8221; that generates an address whenever the &#8220;main machine&#8221; requests one for a <em>goto</em>. If you spell out carefully how the two machines communicate, the argument of the previous note shows that the tape of the address machine must contain <em>some</em> kind of variable initial information when it is run. The previous address is just the most obvious candidate &#8212; you could also imagine the main machine &#8220;priming&#8221; the tape somehow &#8212;given a much more complicated control relationship between the two, since in this simple formulation the address machine runs a computation for every step the main machine takes&#8212; but this trivialises quickly into the main machine simply asking the address machine to perform the main machine&#8217;s own computation then reading off the result from the address it jumps to!</li><li id="footnote_6_1058" class="footnote">You don&#8217;t have to start with an infinite tape, just arrange a contract with a paper factory guaranteeing to supply you with more whenever you need it.</li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.logophile.org/blog/2011/05/07/subtleties-of-turing-machines/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python datetime conversions</title>
		<link>http://www.logophile.org/blog/2010/08/15/python-datetime-conversions/</link>
		<comments>http://www.logophile.org/blog/2010/08/15/python-datetime-conversions/#comments</comments>
		<pubDate>Sun, 15 Aug 2010 15:21:59 +0000</pubDate>
		<dc:creator>tikitu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[(La)TeX]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[tikz]]></category>

		<guid isPermaLink="false">http://www.logophile.org/blog/?p=964</guid>
		<description><![CDATA[Recently for my work I had to do some date/time-wrangling in Python. We have a database containing unix timestamp values, and the front-end application needs to talk local time. The necessary conversions aren&#8217;t so complicated, but Python makes life a bit harder by having three relevant modules, three relevant data types (not matching the modules), [...]]]></description>
			<content:encoded><![CDATA[<p>Recently for my work I had to do some date/time-wrangling in Python. We have a database containing unix timestamp values, and the front-end application needs to talk local time. The necessary conversions aren&#8217;t so complicated, but Python makes life a bit harder by having three relevant modules, three relevant data types (not matching the modules), and a complicated web of conversion possibilities between them.</p>

<p>For instance:</p>

<ul>
<li>the <code>datetime</code> class lives in the <code>datetime</code> module; careful with your imports, you will want both!</li>
<li>the <code>datetime</code> module has a <code>time</code> class, but there&#8217;s also a <code>time</code> module</li>
<li>the documentation talks at different places about &#8220;time tuples&#8221; and also about &#8220;<code>time.struct_time</code>&#8221; objects; they&#8217;re the same thing</li>
<li>to convert a unix timestamp to a time tuple representing UTC time, you use <code>time.gmtime()</code>; for the reverse conversion, you use <code>calendar.timegm()</code> (this is the only place you&#8217;ll use the <code>calendar</code> module)</li>
<li>to get <em>now</em> you use:

<ul>
<li><code>time.localtime()</code> if you want a timetuple</li>
<li><code>time.time()</code> if you want a unix timestamp</li>
<li><code>datetime.now()</code> if you want a datetime object</li>
<li><code>time.gmtime()</code> if you want a timetuple representing UTC time</li>
<li><code>datetime.utcnow()</code> if you want a datetime object representing UTC time</li>
<li>a crowbar if necessary</li>
</ul></li>
<li>to build a <code>datetime</code> object from a time-tuple, you can set the fields one-by-one&#8230; or you can slice the time-tuple and unpack the list: <code>datetime(*a_time_tuple[:6])</code></li>
</ul>

<p>In other words, there&#8217;s a lot of fiddly detail to remember. So I made a chart.</p>

<div id="attachment_969" class="wp-caption aligncenter" style="width: 610px"><a href="http://www.logophile.org/blog/wp-content/uploads/2010/08/python-date.pdf"><img src="http://www.logophile.org/blog/wp-content/uploads/2010/08/python-date.jpg" alt="Blurry overview of python date/time wrangling" title="python-date-img" width="600" height="424" class="size-full wp-image-969" /></a><p class="wp-caption-text">Click through for (non-blurry) PDF.</p></div>

<p>It&#8217;s formatted for a4 paper and prints nicely. I used the incredible LaTeX drawing system <a href="http://www.texample.net/tikz/examples/">TikZ</a>. (On my screen the arrows have a little glitch at start and finish, but it doesn&#8217;t appear in my printout. Possibly a TikZ bug? Not sure.)</p>

<p>Note that it doesn&#8217;t show <em>everything</em> you can do; apart from the more egregious omissions (like timezone handling on <code>datetime</code> objects, which actually seems quite straight-forward but didn&#8217;t fit nicely into the design), I didn&#8217;t include arrows for nonsensical operations. For example you could feed a UTC time-tuple into <code>time.mktime()</code> (which takes a <em>localtime</em> time-tuple to a unix timestamp), but the result would be nonsense: the number of seconds since a date similar to, but probably not quite the same as, the unix epoch.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.logophile.org/blog/2010/08/15/python-datetime-conversions/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Ubuntu on Dell Precision: driver problems with easy fixes</title>
		<link>http://www.logophile.org/blog/2010/06/05/ubuntu-on-dell-precision-driver-problems-with-easy-fixes/</link>
		<comments>http://www.logophile.org/blog/2010/06/05/ubuntu-on-dell-precision-driver-problems-with-easy-fixes/#comments</comments>
		<pubDate>Sat, 05 Jun 2010 11:57:07 +0000</pubDate>
		<dc:creator>tikitu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.logophile.org/blog/?p=916</guid>
		<description><![CDATA[Yesterday I installed Ubuntu 10.04 (&#8220;Lucid Lynx&#8221;) on my brand-new Dell Precision M4500. Not everything went smoothly: I had driver problems that left me with a blank screen and no wireless. There are simple fixes for these problems but Google was only giving me more complicated technical ones. Maybe this post will help someone in [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I installed Ubuntu 10.04 (&#8220;Lucid Lynx&#8221;) on my brand-new Dell Precision M4500. Not everything went smoothly: I had driver problems that left me with a blank screen and no wireless. There are <em>simple</em> fixes for these problems but Google was only giving me more complicated technical ones. Maybe this post will help someone in a similar situation.</p>

<p><span id="more-916"></span></p>

<p>First the blank screen. From <a href="http://ubuntu-tutorials.com/2010/05/06/ubuntu-10-04-lucid-blank-screen-at-startup-workaround/">these instructions</a> I added the option <code>nomodeset</code> for the install, and that went swimmingly. But of course on normal startup I had the same problem; I don&#8217;t even know what <code>nomodeset</code> means, but should I be setting it as a grub option or something? No, the answer is simpler than that: plug in a second (DVI) monitor.<sup>1</sup> Assuming <em>that</em> doesn&#8217;t have any driver problems, you&#8217;ll be able to see what you&#8217;re doing and can move on to the next hitch&#8230;</p>

<p>Wireless. Without a driver, wireless is completely disabled; the network manager applet doesn&#8217;t even see it as turned off, it&#8217;s simply absent. Solution: plug in a network cable instead. Duh. (It took quite some time for this blindingly obvious insight to hit.)</p>

<p>So at that point I had internet access and could see the screen. But these aren&#8217;t &#8220;solutions&#8221;, they&#8217;re temporary workarounds; from a bit of googling, the next step <em>looks</em> like it&#8217;s going to be tracking down drivers, uninstalling and reinstalling packages, and tweaking configuration settings ad nauseum.</p>

<p>Nope. <code>System -&gt; Administration -&gt; Hardward Drivers</code>, it found the missing two correctly, they activated without a hitch, and now I&#8217;m good to go (the extra monitor and network cable can go back into storage).</p>
<p>Notes:</p><ol class="footnotes"><li id="footnote_0_916" class="footnote">I happen to have one lying around because my previous laptop is a netbook.</li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.logophile.org/blog/2010/06/05/ubuntu-on-dell-precision-driver-problems-with-easy-fixes/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Emacs 23 magic</title>
		<link>http://www.logophile.org/blog/2009/12/03/emacs-23-magic/</link>
		<comments>http://www.logophile.org/blog/2009/12/03/emacs-23-magic/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 13:12:53 +0000</pubDate>
		<dc:creator>tikitu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[accidental]]></category>
		<category><![CDATA[awesome]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[geek]]></category>

		<guid isPermaLink="false">http://www.logophile.org/blog/?p=788</guid>
		<description><![CDATA[Anyone else using emacs 23 yet? Here&#8217;s something awesome I stumbled on by accident: try to open a pdf from inside emacs. Go on, go and try, I&#8217;ll wait. Neato, huh?]]></description>
			<content:encoded><![CDATA[<p>Anyone else using emacs 23 yet? Here&#8217;s something <em>awesome</em> I stumbled on by accident: try to open a pdf from inside emacs. Go on, go and try, I&#8217;ll wait.</p>

<p>Neato, huh?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.logophile.org/blog/2009/12/03/emacs-23-magic/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Another typogeek tee</title>
		<link>http://www.logophile.org/blog/2009/10/28/another-typogeek-tee/</link>
		<comments>http://www.logophile.org/blog/2009/10/28/another-typogeek-tee/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 13:24:29 +0000</pubDate>
		<dc:creator>tikitu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[funny]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[tshirt]]></category>
		<category><![CDATA[typography]]></category>

		<guid isPermaLink="false">http://www.logophile.org/blog/?p=771</guid>
		<description><![CDATA[Mule design studio have a design I like: Pretty funny if the association is familiar. Otherwise, probably pretty incomprehensible. [via]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.muledesign.com/">Mule design studio</a> have a <a href="http://store.muledesign.com/featured/el-vetica.php">design I like</a>:</p>

<p><a href="http://store.muledesign.com/featured/el-vetica.php"><img src="http://store.muledesign.com/product_images/elvetica_lg.jpg" alt="El Vetica tshirt by Mule design studio" /></a></p>

<p>Pretty funny if the <a href="http://en.wikipedia.org/wiki/Luchador">association</a> is familiar. Otherwise, probably pretty incomprehensible. [<a href="http://laughingsquid.com/el-vetica-mexicos-only-typographerluchador/">via</a>]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.logophile.org/blog/2009/10/28/another-typogeek-tee/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Discoveries: stumpwm and screen-profiles</title>
		<link>http://www.logophile.org/blog/2009/05/16/discoveries-stumpwm-and-screen-profiles/</link>
		<comments>http://www.logophile.org/blog/2009/05/16/discoveries-stumpwm-and-screen-profiles/#comments</comments>
		<pubDate>Fri, 15 May 2009 22:14:09 +0000</pubDate>
		<dc:creator>tikitu</dc:creator>
				<category><![CDATA[non-transient]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[beautiful]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://www.logophile.org/blog/?p=682</guid>
		<description><![CDATA[Apparently my family don&#8217;t understand anything I write on this blog any more. This post isn&#8217;t going to help. The good news is, I&#8217;ve got a bundle of photos from Stockholm which I hope to put up sometime over the weekend. Travels in Scandinavia, that&#8217;s not geeky at all, right? This, on the other hand, [...]]]></description>
			<content:encoded><![CDATA[<p>Apparently my family don&#8217;t understand anything I write on this blog any more. This post isn&#8217;t going to help. The good news is, I&#8217;ve got a bundle of photos from Stockholm which I hope to put up sometime over the weekend. Travels in Scandinavia, that&#8217;s not geeky at all, right?</p>

<p>This, on the other hand, is.</p>

<p><span id="more-682"></span></p>

<p>I&#8217;ve used <a href="http://www.gnu.org/software/screen/">GNU <code>screen</code></a> for ages to keep my working environment set up the way I like it, wherever I am. I have a screen session permanently running on my office linux box, which I ssh to from wherever I happen to be.</p>

<p>That all changed this week, when my branch of our research institute moved to a new building. My linux box was taken offline and loaded into a truck; when it arrived at its new home, due to various cock-ups among the administration, it had no network access. (Word is they&#8217;re not going to let us ssh in anyway, sigh.)</p>

<p>So I&#8217;ve been playing around trying to set up my eee pc as a useful working environment. Step 1 was just copying all my configs from the desktop over to the netbook, and running everything from there instead. Imagine my surprise when some applications <em>did not work the same way as they used to!</em></p>

<p>Specifically, screen has gained a purely awesome addition: <a href="https://launchpad.net/byobu"><code>screen-profiles</code></a> provides something like the mode bar in emacs, configurable to add all sorts of goodies (battery monitor, wifi strength, lots of bits and pieces).</p>

<p>My other new discovery, which rather overshadows the first, is <a href="http://www.nongnu.org/stumpwm/index.html">StumpWM</a>. If screen and emacs had a baby, and brought it up to be a window manager, that would be stumpwm.</p>

<p>It&#8217;s a window manager written in lisp, like emacs,<sup>1</sup> and like emacs it&#8217;s configurable on-the-fly by lisp hacking.<sup>2</sup> Also like emacs it&#8217;s highly keyboard-driven, but more along the lines of screen: there&#8217;s a prefix key that diverts input to the stumpwm keymaps. (Actually I never realised before how similar the emacs and screen models are here; the only real difference is that screen gets away with only one keymap, hence only one prefix command. Stumpwm lets you define more if you need to, naturally.) Like screen, and unlike most window managers, you only see whatever you&#8217;re using at the moment (although you can tile windows the same way you can split emacs frames).<sup>3</sup></p>

<p>I started messing around with stumpwm because the display of the eee is so tiny, and I was frustrated with the amount of space being wasted on menu bars and panels and whatever.<sup>4</sup> I didn&#8217;t get very far at first, because I was trying to do everything by hand: shut down the Gnome display manager and restart X, pointing it at stumpwm. Of course all sorts of things stopped working, most importantly audio. But then I followed <a href="http://www.xsteve.at/prg/stumpwm/">XSteve&#8217;s instructions</a> for adding stumpwm as a session type under ubuntu, and magically <em>everything worked</em>.<sup>5</sup></p>

<p>By &#8220;everything&#8221;, I mean <em>everything</em>. Audio works (I&#8217;m listening to Bettye Lavette in Amarok right now). Two-finger touch-pad scrolling works. I can split a stumpwm screen into two panes, pull firefox into one pane and emacs into the other, mouse-select text in firefox and <em>drag and drop</em> it into emacs. It not only works, it shows the text being dragged (otherwise I never would have tried the experiment). Global shortcut keys defined in Gnome work (so I can control the volume Amarok plays at).</p>

<p>I am a complete convert: stumpwm is fantastic.</p>

<p>I have two complaints.</p>

<p>The first is that I want better ways to switch windows: a list across all groups, that works like <a href="http://www.emacswiki.org/emacs/InteractivelyDoThings"><code>ido</code> in emacs</a>: filter the list of possible targets by any sort of match, rather than just prefix-matching and tab-completion.<sup>6</sup></p>

<p>My second complaint is that both stumpwm and ido are written in (dialects of) lisp. Meaning that it&#8217;s conceivable that someone could hack bits of one into the other. Meaning that I&#8217;m <em>awfully</em> tempted to give it a try, instead of working on my dissertation. Shame on you, developers, for not protecting me from my instincts.</p>
<p>Notes:</p><ol class="footnotes"><li id="footnote_0_682" class="footnote">Well, stumpwm is written in what emacs would call an <em>inferior</em> brand of lisp&#8230;</li><li id="footnote_1_682" class="footnote">Yes, you can change the source code of your window manager while it&#8217;s running. And yes, once you can do this you&#8217;ll discover <em>all sorts</em> of reasons why you might want to.</li><li id="footnote_2_682" class="footnote">And just like screen, now that screen-profiles exists, there&#8217;s a configurable mode line.</li><li id="footnote_3_682" class="footnote">Emacs with no scrollbars and the font set to 8pt fits 80 characters twice, in a two-column split, which is <em>magical</em> for LaTeX. Viewing the pdf in Okular is less pleasant.</li><li id="footnote_4_682" class="footnote">XSteve is the author of the <a href="http://www.xsteve.at/prg/emacs/index.html"><code>psvn</code> package</a> (which adds excellent subversion support to emacs), among many other software projects. His config tips are worth checking out too.</li><li id="footnote_5_682" class="footnote">Ido (&#8216;interactively do things&#8217;) is another recent discovery; I&#8217;m <em>completely</em> sold on buffer-switching, and the fact that it lets me prefer <code>.tex</code> over <code>.aux</code> when opening files might be enough of a draw card to force me to get used to the way it treats backspace and tab.</li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.logophile.org/blog/2009/05/16/discoveries-stumpwm-and-screen-profiles/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>In which I learn things about TeX</title>
		<link>http://www.logophile.org/blog/2009/04/27/in-which-i-learn-things-about-tex/</link>
		<comments>http://www.logophile.org/blog/2009/04/27/in-which-i-learn-things-about-tex/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 13:26:55 +0000</pubDate>
		<dc:creator>tikitu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[(La)TeX]]></category>
		<category><![CDATA[epiphany]]></category>
		<category><![CDATA[geek]]></category>

		<guid isPermaLink="false">http://www.logophile.org/blog/?p=652</guid>
		<description><![CDATA[Apparently a local texmf tree no longer requires the ls-R file. Since how long, I know not, nor care I particularly. Nor expect I you to care, particularly, but I was tickled by it. Yet another piece of obscurity and complication getting slightly simpler in the LaTeX world. (Thanks to Micha &#8212; I discovered this [...]]]></description>
			<content:encoded><![CDATA[<p>Apparently a local texmf tree no longer requires the <code>ls-R</code> file. Since how long, I know not, nor care I particularly. Nor expect I you to care, particularly, but I was tickled by it. Yet another piece of obscurity and complication getting slightly simpler in the LaTeX world.</p>

<p>(Thanks to Micha &#8212; I discovered this while helping him tidy up his texmf tree. And yes, I guess this is less down to (La)TeX and more down to my distribution, details jargon technicalities disclaimer.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.logophile.org/blog/2009/04/27/in-which-i-learn-things-about-tex/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

