<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>as days pass by: a weblog by Stuart Langridge</title>
	
	<link>http://kryogenix.org/days</link>
	<description>scratched tallies on the prison wall</description>
	<lastBuildDate>Thu, 11 Apr 2013 01:58:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/kryogenix" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="kryogenix" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Gmail, the web, and yak shaving</title>
		<link>http://kryogenix.org/days/2013/04/10/gmail-the-web-and-yak-shaving</link>
		<comments>http://kryogenix.org/days/2013/04/10/gmail-the-web-and-yak-shaving#comments</comments>
		<pubDate>Wed, 10 Apr 2013 21:46:08 +0000</pubDate>
		<dc:creator>sil</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://kryogenix.org/days/?p=1802</guid>
		<description><![CDATA[A couple of days ago, someone asked me whether the Gmail website was any good on mobile. I said: it seems so, the couple of times I&#8217;ve used it, but I&#8217;m not really sure. I&#8217;ll find out, I said. You&#8217;d think I&#8217;d know better by now. once more into the breach, dear enemies The way [...]]]></description>
				<content:encoded><![CDATA[<p>A couple of days ago, someone asked me whether the Gmail website was any good on mobile. I said: it seems so, the couple of times I&#8217;ve used it, but I&#8217;m not really sure. I&#8217;ll find out, I said.</p>
<p>You&#8217;d think I&#8217;d know better by now.</p>
<h4>once more into the breach, dear enemies</h4>
<p>The way to actually find out whether it&#8217;s any good, with the gmail web app as with all things, is to use it for real for a bit. So I decided that what I&#8217;d do is exclusively use the web app to read my mail on my phone for a week.</p>
<p>There are two base criteria here which must be met. First: I have to be able to get at gmail from an icon on my iPhone&#8217;s home screen, and second I have to get notifications when I get a new mail. Those two things are axioms, here: if they&#8217;re not possible, then my answer is &#8220;the gmail web app is crap&#8221; because I can&#8217;t use it. The easy bit first.</p>
<h4>the easy bit</h4>
<p>Go to gmail.com in the browser: press the share button, press &#8220;add to home screen&#8221;. Done.</p>
<h4>notifications for a new email</h4>
<p>Web apps have a notification API, but it&#8217;s not useful on mobiles, because the whole point of a new mail notification is that you get it even if you&#8217;re not looking at your mail app. You wouldn&#8217;t want to keep the gmail web page open all the time, even if you were allowed to do so on a phone, which you are not. (The Nokia N9 allowed this. No-one else does; mobile platforms routinely decide to quietly kill your app and then raise it from the dead again when you want it back, and while it&#8217;s dead it&#8217;s not notifying anybody of anything, because it&#8217;s dead). So, we need a way for me to get a notification that I have a new email. This requires some sort of native app on the phone, fine, OK, but I didn&#8217;t want to have to <em>write</em> a native app to do it; someone must have written an app which can handle notifications and then open up gmail in the web browser. And indeed it is so: on the iPhone there&#8217;s Boxcar and Prowl. (I assume there are similar for Android.) Prowl costs money, so I looked at Boxcar first. Boxcar does, indeed, allow you to have it get notifications when you get a new email and then do some sort of user-specified activity when a notification comes in, hooray! (It does this by giving you a magic email address: you tell gmail to forward all your mail to that email address, and when it gets an email, it sends your phone a notification and then deletes the email. This requires trusting the Boxcar people, I agree, but the purpose of this exercise was to see if this could be done at all. If you want security, run your own webmail server, or your own server which monitors gmail and then send the notifications yourself, that&#8217;s fine; Boxcar can help with that too via their API.)</p>
<h4>the easy bit&hellip; is never <em>that</em> easy</h4>
<p>So, at this point, when I get an email, Boxcar shows a notification: I press the notification, and it opens my configured URL, which is gmail.com. This is great and I should be done by now, except&#8230;Boxcar opens my chosen address in a little in-built web view rather than my browser. Lots of iPhone apps do this &#8212; build in a webview rather than using the browser &#8212; and it really, really irritates me. There is no option to say &#8220;open this in the browser, damn you!&#8221; Grr. </p>
<p>But, after some poking around, I notice that the <a href="http://blog.boxcar.io/post/8699108879/boxcar-4-2-1-whats-new">Boxcar changelog</a> says &#8220;NEW: Add ability to open custom safari:// URLs in MobileSafari.&#8221; Aha! That sounds like what I want. So&#8230; I configure my custom URL to be <code>safari://mail.google.com</code>, right?</p>
<p>That doesn&#8217;t work. Nor does <code>safari://http://mail.google.com</code>, or any other combination I could think of. There is no documentation other than the above changelog line. Frustrated.</p>
<p>Then I thought: well, it doesn&#8217;t have to be <em>Safari</em>, per se. I have Google Chrome on the phone too. Maybe I can use that. The iPhone is set up so that apps routinely register custom URL schemes: it&#8217;s how they communicate. Is there, wondered I, some sort of custom URL scheme that I can use to force an https link to open in Chrome rather than Safari?</p>
<p><a href="https://developers.google.com/chrome/mobile/docs/ios-links">Indeed there is</a>. Well done Chrome people. If I open <code>googlechromes://mail.google.com</code> it opens <code>https://mail.google.com</code> in Chrome. Yay! So I configure <strong>that</strong> as my link in Boxcar. Now when I get an email, I touch the notification, and gmail opens in Chrome! Hooray! We&#8217;re done!</p>
<p>We&#8217;re not done. Now, you see, my home screen link opens in Safari, and my Boxcar link opens in Chrome. That&#8217;s annoying and wrong. So, how do I edit the home screen link to be to <code>googlechromes://mail.google.com</code>?</p>
<p>You can&#8217;t. You can&#8217;t edit a home screen bookmark once it&#8217;s created. Bah. So, how do I make Chrome bookmark something to the home screen?</p>
<p>You can&#8217;t. Only Safari can do that, because it&#8217;s allowed the magic secret APIs and no-one else is.</p>
<p>So how do I put a Chrome bookmark on my home screen? Well, one way would be to have an HTML file which meta refreshes to the <code>googlechromes:</code> URL, and bookmark the HTML file in Safari. That way, I&#8217;ll press the home screen icon, that&#8217;ll start Safari, Safari will instantly start Chrome, and I&#8217;ll have a bookmark. Slightly inelegant, but not too bad.</p>
<p>I stuck the HTML page on my site, and tried it. Minor problem: the page refreshes before I can bookmark it! So, remove the meta refresh, open the page in Safari, bookmark it, put the meta refresh back in again. Ha! That works. (And add a nice home screen icon with <code>&lt;link rel="apple-touch-icon"&gt;</code>.</p>
<p>New problem. Every time I hit the home screen bookmark, or the link from Boxcar, we open a new tab in Chrome with gmail in it. After ten minutes of testing this, I&#8217;ve got fifteen gmail tabs in Chrome. That&#8217;s no good. The <a href="https://developers.google.com/chrome/mobile/docs/ios-links">Chrome links</a> doc dictates how to explicitly say &#8220;I want a new tab&#8221;, but <em>not</em> how to say &#8220;I don&#8217;t want a new tab: reuse the previous one&#8221;. After a bit more poking around, though, you can use an <a href="http://x-callback-url.com/specifications/"><code>x-callback-url</code></a>-style URL with Chrome, and that lets you specify a source. So, instead of making my bookmark and my Boxcar URL be <code>googlechromes://mail.google.com</code>, I&#8217;ll make it be <code>googlechrome-x-callback://x-callback-url/open/?x-source=boxcar&amp;&amp;url=https%3A%2F%2Fmail.google.com</code>. That way, when you open that link a second time, it stays in the same tab as the first time! Hooray!</p>
<p>It&#8217;s not perfect. I can&#8217;t get Boxcar links and the home screen link to share a tab <em>between</em> them, so I end up with two Gmail tabs in Chrome. That&#8217;s annoying but not a total crisis. And this is now clean enough that I can stand to use it for a week. Now I get to actually try using the Gmail web app for a week and see what it&#8217;s like!</p>
<h4>how annoying is the iPhone?</h4>
<p>This all seems like a great big faff to me. Is that all the iPhone&#8217;s fault? Well&hellip; certainly some of it is. All that crap with Safari being the only thing that can bookmark to the home screen? You can&#8217;t add home screen bookmarks that aren&#8217;t to real URLs? Sure, these things are fairly technical, but they don&#8217;t seem like they&#8217;d get in anyone&#8217;s way if they did exist. Apparently in older versions of iOS you could bookmark (via a roundabout data URL procedure) weird URLs such as <code>pref:something</code> to open a Settings page directly, and Apple took that away. So that&#8217;s annoying.</p>
<p>But in general, I think that the approach of having a server monitor my email and then use the platform&#8217;s push notification service to tell me about it and open the webmail client&#8230;seems like a good approach. Android does seem to have a couple of IMAP notify apps in the Play Store, but they aren&#8217;t reviewed very well, and I don&#8217;t really <em>want</em> my phone to hang on an IMAP IDLE socket 24 hours a day. Avoiding that is precisely what push notifications (Google&#8217;s &#8220;Cloud to Device Messaging&#8221;) were <em>invented</em> for. (Note: there are lots of mail notification apps, but they poll. I don&#8217;t want polling. When I get an email, I want a notification. Not five minutes later.)</p>
<p>So, then&#8230; is this doable on Android? Is there an app like Boxcar where there&#8217;s a server component which can (somehow) monitor my gmail account and notify my Android phone, and then pressing the notification on my Android phone will open up <code>https://mail.google.com</code> in the phone&#8217;s browser? I&#8217;d be interested in hearing the answer to this, Android-using readers. </p>
<p>What about other platforms? How will Firefox OS handle this? (Maybe because they&#8217;re all web, they&#8217;ll just keep the web page open without ever suspending it, and let it use the web notification API?) I&#8217;d like to hear about other approaches. (I <em>don&#8217;t</em> want to hear &#8220;just use the native app&#8221;. Of <em>course</em> that&#8217;s the logical thing to do. The point here is to see whether I can set up my life so using a web app for email on my phone is a doable thing. If your answer is &#8220;you need to use the native app&#8221;, then I&#8217;ll take that as you saying &#8220;you can&#8217;t use web apps for this; you have to go native&#8221;. That&#8217;s a perfectly reasonable argument, but this post is not directed at you if that&#8217;s how you feel.)</p>
<p>Fun little project of gluing together technical bits, I must say. Constraints are the mother of inventiveness!</p>
]]></content:encoded>
			<wfw:commentRss>http://kryogenix.org/days/2013/04/10/gmail-the-web-and-yak-shaving/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Watching films on Ubuntu (in England)</title>
		<link>http://kryogenix.org/days/2013/04/09/watching-films-on-ubuntu-in-england</link>
		<comments>http://kryogenix.org/days/2013/04/09/watching-films-on-ubuntu-in-england#comments</comments>
		<pubDate>Tue, 09 Apr 2013 18:15:37 +0000</pubDate>
		<dc:creator>sil</dc:creator>
				<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://kryogenix.org/days/?p=1752</guid>
		<description><![CDATA[So there I was last week at my parents&#8217; house, and my dad said: I am thinking of getting Netflix. &#8220;Oh?&#8221;, says I. &#8220;What brought this on?&#8221; Questions like that end up turning into long discussions, and this was no exception. Those of you with the attention span of a four-year-old will find a summary [...]]]></description>
				<content:encoded><![CDATA[<p>So there I was last week at my parents&#8217; house, and my dad said: I am thinking of getting Netflix.</p>
<p>&#8220;Oh?&#8221;, says I. &#8220;What brought this on?&#8221;</p>
<p>Questions like that end up turning into long discussions, and this was no exception. Those of you with the attention span of a four-year-old will find a summary at the bottom of the post.</p>
<p>He explained (in response to my question) that he likes the idea of watching films and it&#8217;s probably easier and probably cheaper and probably less hassle to do that in your own living room rather than the cinema, especially since the nearest cinema to him is probably 15 miles away. I pointed out that the available films will lag behind the cinema releases (so if you see an ad for, say, Star Trek Into Darkness <a class="simple-footnote" title="not Star Trek: Into Darkness" id="return-note-1752-1" href="#note-1752-1"><sup>1</sup></a> on the side of a bus, you can&#8217;t <em>watch</em> it in your living room <em>now</em>) but that they lag behind a consistent amount (so all the films that hit the cinema 12 months ago <a class="simple-footnote" title="or 18 months ago, or whatever the time lag actually is" id="return-note-1752-2" href="#note-1752-2"><sup>2</sup></a> arrive online at now, roughly, so all the films which were contemporarily released with one another are <em>still</em> contemporary with one another), and that there are multiple different providers of this sort of thing (Netflix, Lovefilm, Now TV). And I pointed out <a class="simple-footnote" title="a touch shamefacedly" id="return-note-1752-3" href="#note-1752-3"><sup>3</sup></a> that this would be a bit of a problem technically, because the computer plugged into the big TV in the living room runs Ubuntu, and you can&#8217;t watch commercial streaming video on Ubuntu <a class="simple-footnote" title="he wants instant gratification: being able to go from &#8220;I want to watch a film&#8221; to &#8220;I am watching a film&#8221; in seconds. This means that a DVD rental service is no good for his use case" id="return-note-1752-4" href="#note-1752-4"><sup>4</sup></a> because it all requires MS PlayReady DRM <a class="simple-footnote" title="yes, Silverlight, but Silverlight itself is not the problem" id="return-note-1752-5" href="#note-1752-5"><sup>5</sup></a> and there&#8217;s no Ubuntu implementation of that, and so this meant that we&#8217;d need to install Windows on that TV computer instead. <a class="simple-footnote" title="yes, I know about the Netflix-under-Wine stuff in Ubuntu. Read on" id="return-note-1752-6" href="#note-1752-6"><sup>6</sup></a></p>
<h4>so, like, wassitallabout?</h4>
<p>&#8220;How does it work?&#8221;, says my dad. &#8220;Well,&#8221; said I, settling into the chair and adopting a wise look, &#8220;you pay a monthly subscription, and then pick any film you want and watch it whenever you want for free, beyond the subscription. I think if you watch the very latest films then they might charge an extra cost because it&#8217;s a really recent film, but you&#8217;re already waiting 12 months before it hits Netflix <em>at all</em>; you might as well just set your clock to 18 months behind and watch a film once it hits non-pay-per-view.&#8221; A nod from Dad. &#8220;Oh, and I think occasionally there might be a film that Netflix doesn&#8217;t have: sometimes there are little wars between them and, say, Amazon or Lovefilm <a class="simple-footnote" title="yes I know Amazon own Lovefilm" id="return-note-1752-7" href="#note-1752-7"><sup>7</sup></a> or Hulu or whatever, and a film is a &#8216;Netflix exclusive&#8217; or something.&#8221; <a class="simple-footnote" title="pause for brief explanation of how Netflix are remaking House of Cards in America" id="return-note-1752-8" href="#note-1752-8"><sup>8</sup></a></p>
<p>&#8220;We should check that,&#8221; says my dad, a man for whom &#8220;films I want to watch&#8221; has hitherto been <em>Zulu</em> and <em>The Great Escape</em>, but he&#8217;s right <a class="simple-footnote" title="and this is a massively unfair characterisation" id="return-note-1752-9" href="#note-1752-9"><sup>9</sup></a>. Now we pause here for twenty minutes while, with increasing disbelief and shrillness, I discover that <strong>Netflix don&#8217;t provide a browseable list of their films</strong>. They don&#8217;t. That&#8217;s <strong>insane</strong>. Also: you know how shops that don&#8217;t display their prices are doing so because it&#8217;s all stupidly expensive? Anyone who doesn&#8217;t display a list of their products is doing so because that list is a lot shorter and less comprehensive than you think it will be. So we poke around some more (I was honestly, properly shocked by the absence of a list) and find a website that searches Netflix and gives you a link. Commence another twenty minute block of disbelief during which my dad names film after film after film he wants to watch, or wouldn&#8217;t mind watching, or has always meant to watch&#8230; and we find, I think, three. These weren&#8217;t all new films, weren&#8217;t all obscure films, weren&#8217;t all old films: there was a good mix. And hardly any of them were there.</p>
<h4>and the rat was nowhere at all</h4>
<p>Further research establishes that the rivals &mdash; Lovefilm, Now TV, Blinkbox &mdash; are the same. I was under the impression that every one of these online movie places had basically every film you&#8217;ve ever heard of, and they compete on pricing, or access to the very latest films. It is not like that. <a class="simple-footnote" title="Maybe it is like that in America. It isn&#8217;t, here." id="return-note-1752-10" href="#note-1752-10"><sup>10</sup></a> Instead, Netflix and Lovefilm and Now TV have <em>basically no films</em> for streaming and then every now and again they might have one. That is: I thought that the model was &#8220;think on the bus of a film you fancy watching, then go home and find it on Netflix and watch it&#8221;, and the model is <em>totally not that</em>. Instead, the model is &#8220;decide you want to watch a film, and set aside two hours for film-watchy time, and then go to Netflix and choose a film from their list of films&#8221;. Or, in practice, from the subset of their list of films that you actually want to watch. That&#8217;s not necessarily a bad model &mdash; I&#8217;m sure new films come into Netflix&#8217;s list faster than you can watch them, and you could probably get quite a long way by just looking at their list and finding all the stuff on it that you like the look of &mdash; but I totally misunderstood (and so did Dad). I thought that Netflix were like Spotify but for films, and they really ain&#8217;t. <a class="simple-footnote" title="this is not necessarily a complaint. I understand that Netflix are not Spotify for films, and it is not Netflix&#8217;s fault that they are not Spotify for films. You think the music industry is full of back-alley cheating and under-the-table secret deals? Ha! You should see the movie people." id="return-note-1752-11" href="#note-1752-11"><sup>11</sup></a></p>
<h4>father, I shall bring you only the finest blank tv screens</h4>
<p>At this point he said, well, that&#8217;s crap then. I suppose I ought to go to the cinema.</p>
<p>I said: well, if you have to do the just-choose-off-the-list thing <em>anyway</em>, then why not just use a service who don&#8217;t charge a monthly subscription? What I mean is: do it all pay-per-view. So then you&#8217;re not paying when you&#8217;re not using it, and on any given day you can just do a search and see if there&#8217;s anything you fancy watching (and paying for), and if there isn&#8217;t, get in the car and go to the cinema instead. Best of both worlds. I&#8217;m sure that if you watched ten films a week that Netflix would be cheaper, but I don&#8217;t think that you&#8217;re gonna do that, daddy dearest.</p>
<p>OK, says daddy dearest. So, we do that, and put Windows on the computer, right?</p>
<p>Yep, I said. None of this stuff works on Ubuntu. Amazon Instant Video works fine, and does exactly what you want, but (check briefly on internet to confirm; briefly <a href="http://www.reddit.com/r/Ubuntu/comments/1bcq23/legal_moviewatching_on_ubuntu_in_the_uk_without/">bitch on reddit</a> about this; go back to dad) it&#8217;s US only. Soz.</p>
<h4>the sacred art of stealing</h4>
<p>We then have a little discussion about BitTorrent and theft of movies, during which I basically say: it is not the solution for you. First, it is really awkward and annoying. Popup ads, hundreds of different websites, being able to tell the difference between a &#8220;download the torrent&#8221; link which is real and one which is put there by an advert. Torrent sites are blocked by ISPs in the UK. Yes, gentle reader, stop sniggering at how this blocking approach is useless. Tt&#8217;s not meant to stop you, you filthy techie pirate: it&#8217;s meant to be a speed bump which makes it difficult for the unwashed masses to do this, to keep people like my dad out of the torrent gutter and in paid-for shiny Netflix territory&#8230; and it <strong>works</strong>. </p>
<p>I specifically recommended to dad that he not think about dealing with this stuff through theft, because theft is <em>hard</em>. Try it, next time you steal a movie: look at what you&#8217;re doing with the eyes of an inexperienced person. A person who doesn&#8217;t have Adblock Plus, who isn&#8217;t able to read through a list of search results and identify which ones &#8220;look legit&#8221; and which look like spam, who isn&#8217;t able to tell which links on a site are real and which download an exe. Theft is hard, and frankly it&#8217;s fairly close to not being worth the pain. It&#8217;s fairly close to it being easier to <em>just pay the money</em>. And that&#8217;s all the movie people want. They don&#8217;t want to make it impossible, they don&#8217;t want to studiously ignore that DRM doesn&#8217;t work, that blocking doesn&#8217;t work, that they can&#8217;t shut down every Pirate Bay proxy&#8230; all they have to do is make <strong>most</strong> people think &#8220;blimey, it&#8217;d be easier to pay the money than do this&#8221;. To me it feels like that&#8217;s now fairly close to being the case unless you&#8217;re a super techie (like most of the people reading this).</p>
<p>Also, y&#8217;know, <em>stealing</em>.</p>
<p>Also also: mkv. avi. srt. Do you really want to care about this stuff? Learn what a &#8220;BRRIP&#8221; is? Learn whether the thing you&#8217;ve got has Italian audio rather than English? Is <code>"Incepcja - Inception DVDRip.XviD AC3 - ENG / Lektor PL"</code> OK to download? <a class="simple-footnote" title="I&#8217;ll be honest: I&#8217;m not sure myself. Looks like it&#8217;s got English audio and Polish subtitles? Don&#8217;t know." id="return-note-1752-12" href="#note-1752-12"><sup>12</sup></a> Srsly, hassle. Avoid.</p>
<h4>say that my glory was I had such friends</h4>
<p>While explaining BitTorrent and why it&#8217;s not all it&#8217;s cracked up to be, a couple of very helpful people saw and commented on my Reddit post complaining about this stuff. Google Play, they said&#8230; that&#8217;s in the UK. Single-purchase pay-per-view videos, no subscription required. Dad&#8217;s got an Android phone so he&#8217;s already got a Play account&#8230; and Play Video works in Ubuntu? </p>
<p>Really?</p>
<p>It does, it turns out.</p>
<p><a href="http://kryogenix.org/days/wp-content/uploads/2013/04/Screenshot-from-2013-04-09-182810.png"><img src="http://kryogenix.org/days/wp-content/uploads/2013/04/Screenshot-from-2013-04-09-182810.png" alt="Google Play Video in the Dash" width="500" height="330" class="aligncenter size-full wp-image-1785" /></a></p>
<p><a href="http://kryogenix.org/days/wp-content/uploads/2013/04/Screenshot-from-2013-04-09-182840.png"><img src="http://kryogenix.org/days/wp-content/uploads/2013/04/Screenshot-from-2013-04-09-182840.png" alt="Google Play Video in the Dash: preview" width="500" height="323" class="aligncenter size-full wp-image-1786" /></a></p>
<p>I was quite surprised by this.</p>
<h4>he saved every one of us</h4>
<p>You have to install <code>hal</code> to make Google Play work in Ubuntu <a class="simple-footnote" title="if you don&#8217;t install hal, Flash obviously still works, but the movie just won&#8217;t play" id="return-note-1752-13" href="#note-1752-13"><sup>13</sup></a>: to do this, search for <code>hal</code> in Ubuntu Software Centre and then install it (&#8220;Hardware Abstraction Layer&#8221;) <a class="simple-footnote" title="or sudo apt-get install hal from a terminal" id="return-note-1752-14" href="#note-1752-14"><sup>14</sup></a>. This is the same thing that Amazon Instant Video in the US needs. It&#8217;s using Adobe&#8217;s Flash DRM stuff. This is good for us, we happy few, we Ubuntu users, because we <em>have</em> Flash. We do not have the PlayReady DRM which is in Silverlight <a class="simple-footnote" title="we could have. Microsoft have not &#8220;refused&#8221; to put PlayReady on Ubuntu. They just haven&#8217;t done it, and why should they? what&#8217;s their motivation? I wouldn&#8217;t do it if I were them, right now" id="return-note-1752-15" href="#note-1752-15"><sup>15</sup></a>, and which the movie studios are pressuring online video people to switch to &mdash; that&#8217;s why Netflix doesn&#8217;t work in Ubuntu, that&#8217;s why Lovefilm no longer works, why Now TV doesn&#8217;t work. Google Play, on the other hand, works fine. Dad likes the pay-just-when-you-watch-a-film model, and it works on his existing computer with his existing accounts; he didn&#8217;t even have to sign up for anything. Just click and he&#8217;s bought a film and can watch it. Right there in the web browser. No app required at all.</p>
<p>It was literally that simple.</p>
<p>People on other platforms, who are not only used to the idea that it&#8217;s that simple, but have hardly any concept that it might <em>not</em> be simple, are laughing themselves sick right now at me being so childishly, pathetically pleased by this. I personally am thinking: good work, Google Play. You made that easy.</p>
<p>The film that Dad chose to watch&#8230; was Twilight. <em>Twilight.</em> You&#8217;re not my real dad, dad.</p>
<h4>dispatch war rocket Ajax to bring back his body</h4>
<p>This is worrying. (Not the Twilight thing.) Flash still exists on Ubuntu, but Adobe have stopped making it. The DRM parts of it are already dependent on <code>hal</code>, which is basically deprecated: Adobe built the Flash DRM stuff into Flash and on Linux when <code>hal</code> was the thing, and since then <code>hal</code> has stopped being the thing, but Adobe didn&#8217;t update Flash to work with the replacement&#8230; and right at the moment it doesn&#8217;t look like they will at all, because they&#8217;ve stopped doing Flash for Linux. This means that at some point it will stop working. At the moment it is possible to legitimately, legally, happily, easily watch a Hollywood film on a stock, standard Ubuntu machine. Google Play can do it in at least the US and the UK; Amazon Instant Video can do it in the US. If Flash stops working, that goes away. </p>
<p>And HTML5 will not save us. It will not. They&#8217;re talking about putting DRM into HTML5 video right now, but either they won&#8217;t do it (and then there won&#8217;t be any commercial videos in HTML5, just like there aren&#8217;t now) or they will do it and they&#8217;ll likely pick a DRM scheme which is not implemented on Ubuntu and won&#8217;t be (highly likely to be something like PlayReady, because the whole industry is already familiar with it). A move away from Flash and towards anything else makes life measurably <em>worse</em> for Ubuntu users, because we have Flash, and don&#8217;t have anything else.</p>
<h4>fight the work per unit time</h4>
<p>But you&#8217;re missing the point, man! We must fight DRM! It doesn&#8217;t work and it&#8217;s evil and useless!</p>
<p>I agree with all that. But that&#8217;s a long-term fight. And no-one has yet convinced me that there is a way to do it without selling the whole world on the idea that they should just Stop Watching Movies until the DRM goes away. And we, the DRM-haters, have had little to no success convincing people to make that sacrifice.</p>
<p>The music industry is not a good guide here. What happened in music was that all the players fought one another with different DRM schemes, no cooperation, to try and beat out their rivals. And while they were doing that, Apple came along and built something which was slick and easy to use and had Apple-specific DRM in it and dominated the market. Then the music industry said: it is our music, you have to play by our rules&#8230; and Apple said: no we don&#8217;t. We really don&#8217;t. What are you going to do, music people? Go and sell WMAs? Not likely. Everyone&#8217;s got an iPod now. And Apple were right&#8230; and because everyone wanted to sell music to iPod owners and didn&#8217;t want to do it through Apple&#8217;s sales channel, they had to go DRM-free. Because that&#8217;s all that iPods would play. You could see this as a great victory for consumer power, if you squint a bit.</p>
<p>The movie people, though (and this is an important point) are <em>not stupid</em>. They have seen what happened to the music industry, have seen that it ended up with all viable saleable music being DRM-free, and have said: that&#8217;s not gonna happen to us. They are not going to fight and bicker amongst themselves while Apple builds a royal road to all the money. They are not going to knife one another. They&#8217;re going to get together, swallow their pride a bit, and cooperate because they recognise that one DRM system that everyone compromises a bit on is better than a million and the eventual arrival of DRM-free videos. And so they did cooperate: that&#8217;s what Ultraviolet is. And it does not matter that Ultraviolet hasn&#8217;t taken off yet: it does not matter that it is not a viable competitor to Netflix. The point is that it exists. The movie people will not be forced into offering DRM-free movies because they didn&#8217;t cooperate until it was too late. They have seen the mistakes the music industry made, and won&#8217;t get caught the same way.</p>
<p>Let&#8217;s talk about how, in the long term, the studios can be convinced to not use DRM: that&#8217;s a good conversation to have. But it&#8217;s hard to see how to do that now without telling my dad that he can&#8217;t watch Twilight on Ubuntu even if he wants to.</p>
<h4>whataboutery</h4>
<p>One of the things about this whole topic of movies and DRM and Ubuntu and stuff is that every sentence comes larded with a million caveats, oh-but-what-abouts, roads-not-taken, sidebars, and other ancilliary things. If you manage to find something where I said &#8220;and therefore X&#8221; and didn&#8217;t mention that Y and Z also exist as possibilities, do not assume that it is because I do not know about Y and Z. But tell me about them!</p>
<h4>tl; dr</h4>
<p>Summary: Google Play video works on stock Ubuntu, in your browser, and exists here in England. It is, as far as I am aware, the <strong>only</strong> legitimate, unhacky <a class="simple-footnote" title="installing a custom Wine and a PPA is hacky; using a US-based proxy is hacky. If you think it isn&#8217;t, that&#8217;s fine; continue to think so, and we&#8217;ll agree to differ." id="return-note-1752-16" href="#note-1752-16"><sup>16</sup></a> way to watch a streamed Hollywood film on a standard Ubuntu laptop in England. I like it. So does my dad.</p>
<p><a href="http://kryogenix.org/days/wp-content/uploads/2013/04/Screenshot-from-2013-04-09-181947.png"><img src="http://kryogenix.org/days/wp-content/uploads/2013/04/Screenshot-from-2013-04-09-181947.png" alt="Google Play Video" width="500" height="356" class="aligncenter size-full wp-image-1784" /></a></p>
<p><a href="http://kryogenix.org/days/wp-content/uploads/2013/04/Screenshot-from-2013-04-09-183547.png"><img src="http://kryogenix.org/days/wp-content/uploads/2013/04/Screenshot-from-2013-04-09-183547.png" alt="Watching Looper on Ubuntu" width="500" height="299" class="aligncenter size-full wp-image-1788" /></a></p>
<div class="simple-footnotes"><p class="notes">Notes:</p><ol><li id="note-1752-1">not Star Trek: Into Darkness <a href="#return-note-1752-1">&#8617;</a></li><li id="note-1752-2">or 18 months ago, or whatever the time lag actually is <a href="#return-note-1752-2">&#8617;</a></li><li id="note-1752-3">a touch shamefacedly <a href="#return-note-1752-3">&#8617;</a></li><li id="note-1752-4">he wants instant gratification: being able to go from &#8220;I want to watch a film&#8221; to &#8220;I am watching a film&#8221; in seconds. This means that a DVD rental service is no good for his use case <a href="#return-note-1752-4">&#8617;</a></li><li id="note-1752-5">yes, Silverlight, but Silverlight itself is not the problem <a href="#return-note-1752-5">&#8617;</a></li><li id="note-1752-6">yes, I know about the Netflix-under-Wine stuff in Ubuntu. Read on <a href="#return-note-1752-6">&#8617;</a></li><li id="note-1752-7">yes I know Amazon own Lovefilm <a href="#return-note-1752-7">&#8617;</a></li><li id="note-1752-8">pause for brief explanation of how Netflix are remaking <em>House of Cards</em> in America <a href="#return-note-1752-8">&#8617;</a></li><li id="note-1752-9">and this is a <em>massively</em> unfair characterisation <a href="#return-note-1752-9">&#8617;</a></li><li id="note-1752-10">Maybe it is like that in America. It isn&#8217;t, here. <a href="#return-note-1752-10">&#8617;</a></li><li id="note-1752-11">this is not necessarily a complaint. I understand that Netflix are not Spotify for films, and it is not Netflix&#8217;s fault that they are not Spotify for films. You think the <em>music industry</em> is full of back-alley cheating and under-the-table secret deals? Ha! You should see the movie people. <a href="#return-note-1752-11">&#8617;</a></li><li id="note-1752-12">I&#8217;ll be honest: I&#8217;m not sure myself. Looks like it&#8217;s got English audio and Polish subtitles? Don&#8217;t know. <a href="#return-note-1752-12">&#8617;</a></li><li id="note-1752-13">if you don&#8217;t install hal, Flash obviously still works, but the movie just won&#8217;t play <a href="#return-note-1752-13">&#8617;</a></li><li id="note-1752-14">or <code>sudo apt-get install hal</code> from a terminal <a href="#return-note-1752-14">&#8617;</a></li><li id="note-1752-15">we could have. Microsoft have not &#8220;refused&#8221; to put PlayReady on Ubuntu. They just haven&#8217;t <em>done</em> it, and why should they? what&#8217;s their motivation? I wouldn&#8217;t do it if I were them, right now <a href="#return-note-1752-15">&#8617;</a></li><li id="note-1752-16">installing a custom Wine and a PPA is hacky; using a US-based proxy is hacky. If you think it isn&#8217;t, that&#8217;s fine; continue to think so, and we&#8217;ll agree to differ. <a href="#return-note-1752-16">&#8617;</a></li></ol></div>]]></content:encoded>
			<wfw:commentRss>http://kryogenix.org/days/2013/04/09/watching-films-on-ubuntu-in-england/feed</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>Shot of Jaq (recovered)</title>
		<link>http://kryogenix.org/days/2013/02/17/shot-of-jaq-recovered</link>
		<comments>http://kryogenix.org/days/2013/02/17/shot-of-jaq-recovered#comments</comments>
		<pubDate>Sun, 17 Feb 2013 18:48:45 +0000</pubDate>
		<dc:creator>sil</dc:creator>
				<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://kryogenix.org/days/?p=1745</guid>
		<description><![CDATA[Oops. A few months ago, we (that is: Jono and I, the greatest sysadmin team the world have ever known) moved various things around on various servers. And in the course of this action, we completely forgot to put the Shot of Jaq website somewhere. So shotofjaq.org currently is down. As I say, oops. Anyway, [...]]]></description>
				<content:encoded><![CDATA[<p>Oops.<br />
A few months ago, we (that is: Jono and I, the greatest sysadmin team the world have ever known) moved various things around on various servers. And in the course of this action, we completely forgot to put the Shot of Jaq website somewhere. So shotofjaq.org currently is down.<br />
As I say, oops.<br />
Anyway, we haven&#8217;t lost the <em>audio</em> (we&#8217;re not that bad), so I trawled archive.org for all the episode descriptions and threw them together into a brief listing of all the SoJ episodes with download links. You can therefore see Shot of Jaq again at <a href="http://www.kryogenix.org/shotofjaq.html">http://www.kryogenix.org/shotofjaq.html</a>.<br />
Sorry about that, all. We&#8217;re rubbish. Let this be a lesson to you.</p>
]]></content:encoded>
			<wfw:commentRss>http://kryogenix.org/days/2013/02/17/shot-of-jaq-recovered/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>The ongoing story</title>
		<link>http://kryogenix.org/days/2013/02/08/the-ongoing-story</link>
		<comments>http://kryogenix.org/days/2013/02/08/the-ongoing-story#comments</comments>
		<pubDate>Fri, 08 Feb 2013 22:07:23 +0000</pubDate>
		<dc:creator>sil</dc:creator>
				<category><![CDATA[General musings]]></category>

		<guid isPermaLink="false">http://kryogenix.org/days/?p=1742</guid>
		<description><![CDATA[I had this idea for a little fun literary project. Tweet the first line of a story. Anyone can reply with what they want the second line to be. You choose the best one of those lines &#8212; the one which best fits your desire for how the story should go; this is what stops [...]]]></description>
				<content:encoded><![CDATA[<p>I had this idea for a little fun literary project. </p>
<p>Tweet the first line of a story. Anyone can reply with what they want the second line to be. You choose the best one of those lines &#8212; the one which best fits your desire for how the story should go; this is what stops it descending into a big game of Consequences &#8212; and retweet it. It&#8217;s a collaborative literary thing. Then people reply with their choice of a third line; repeat until the story reaches a satisfactory conclusion. </p>
<p>Anyone can read the whole story by just reading the tweet stream of the story account. The first couple of tweets should explain the game. </p>
<p>I think this&#8217;d actually work, apart from a technical flaw: when the story account retweets a second line from someone, an @-reply to that goes to the someone, not the story account. (Well, it&#8217;ll probably go to both, but that&#8217;s still annoying and shortens the tweet too much. ) </p>
<p>Nevertheless, if someone does this, I&#8217;d enjoy contributing a line now and then.</p>
]]></content:encoded>
			<wfw:commentRss>http://kryogenix.org/days/2013/02/08/the-ongoing-story/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Thirty-seven, for God’s sake, how did that happen</title>
		<link>http://kryogenix.org/days/2013/01/30/thirty-seven-for-gods-sake-how-did-that-happen</link>
		<comments>http://kryogenix.org/days/2013/01/30/thirty-seven-for-gods-sake-how-did-that-happen#comments</comments>
		<pubDate>Wed, 30 Jan 2013 01:01:03 +0000</pubDate>
		<dc:creator>sil</dc:creator>
				<category><![CDATA[General musings]]></category>

		<guid isPermaLink="false">http://kryogenix.org/days/?p=1736</guid>
		<description><![CDATA[@sil happy birthday! Also, no blog post this year? Rob &#8220;‏@dealmeida&#8221; De Almeida This will make the tenth of these little celebrations of me inching one year closer to death. And people are already being nice to me on Twitter, even though it&#8217;s after midnight and you should all be in bed before you turn [...]]]></description>
				<content:encoded><![CDATA[<blockquote><p>@sil happy birthday! Also, no blog post this year?<br />
<a href="https://twitter.com/dealmeida/status/296415977493630976">Rob &#8220;‏@dealmeida&#8221; De Almeida</a></p></blockquote>
<p>This will make the <a href="http://kryogenix.org/days/2012/01/30/a-year-goes-past" title="2012">tenth</a> <a href="http://kryogenix.org/days/2011/01/31/brave-new-age" title="2011">of</a> <a href="http://kryogenix.org/days/2009/01/30/mini-hippo-returns" title="2009">these</a> <a href="http://kryogenix.org/days/2008/01/30/another-year-passes" title="2008">little</a> <a href="http://kryogenix.org/days/2007/01/30/my-week" title="2007">celebrations</a> <a href="http://kryogenix.org/days/2006/01/30/turning-thirty" title="2006">of</a> <a href="http://kryogenix.org/days/2005/01/30/staring" title="2005">me</a> <a href="http://kryogenix.org/days/2004/01/31/birthdays" title="2004">inching</a> <a href="http://kryogenix.org/days/2003/01/30/revolution" title="2003">one</a> year closer to death.</p>
<p>And people are already being nice to me on Twitter, even though it&#8217;s after midnight and you should all be in bed before you turn back into pumpkins.</p>
<p>It&#8217;s my birthday. This year I am thirty-seven. This seems, all of a sudden, to be old. Thirty-six&#8230; well, that&#8217;s a nice mathematical number, the square of six, the number of possible dice throws, the number of gallons in a barrel of beer. All this makes it seem closer to thirty. Thirty-seven&#8230;that&#8217;s basically forty, isn&#8217;t it?</p>
<p>Forty. Dammit. At some point I wasn&#8217;t paying attention, and while I wasn&#8217;t paying attention I got all old and responsible and stuff.</p>
<p>On the other hand, this is not necessarily a bad thing. Most of the things I dreamed of when I started writing on this site have come to pass. Or, as someone famous didn&#8217;t quite put it, this isn&#8217;t victory, but you can see it from here. I have a fabulous daughter, I have a present from my girlfriend sitting in the kitchen waiting for me to open it (which I am itching to touch but I promised her I wouldn&#8217;t), my job is great, the entire world&#8217;s knowledge is at my fingertips, the internet is available to me even when standing in a field. I&#8217;ve learned that the 2003 me was mostly a moron but had the kernel of some good ideas. I&#8217;m even learning to cook. Tickets at the Arsenal cost sixty-two quid and we&#8217;re once again fighting about DRM (this time in HTML5) and weathering the storm of uneducated commentary, but in the last thirty days we&#8217;ve seen the first 3D-printed building planned, facial recognition software defeated, and the Ubuntu phone released. It&#8217;s an exciting time to be alive, even if you&#8217;re nearly forty.</p>
<p>Happy birthday to me.</p>
]]></content:encoded>
			<wfw:commentRss>http://kryogenix.org/days/2013/01/30/thirty-seven-for-gods-sake-how-did-that-happen/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Fuel pump arrows</title>
		<link>http://kryogenix.org/days/2013/01/21/fuel-pump-arrows</link>
		<comments>http://kryogenix.org/days/2013/01/21/fuel-pump-arrows#comments</comments>
		<pubDate>Mon, 21 Jan 2013 14:36:31 +0000</pubDate>
		<dc:creator>sil</dc:creator>
				<category><![CDATA[General musings]]></category>

		<guid isPermaLink="false">http://kryogenix.org/days/?p=1731</guid>
		<description><![CDATA[Well the first thing, I got me a fuel pump &#8212; Johnny Cash, One Piece At A Time Above is an icon of a petrol pump, which you will see on pretty much every car dashboard. Most (not all) modern-ish cars also have a little triangle next to the petrol pump icon. That little triangle [...]]]></description>
				<content:encoded><![CDATA[<blockquote><p>Well the first thing, I got me a fuel pump<br />
&mdash; Johnny Cash, <em>One Piece At A Time</em></p></blockquote>
<p style="text-align: center"><img src="/images/fuelpumparrow.svg" alt="A fuel pump icon from a car dashboard with a triangle pointing left"></p>
<p>Above is an icon of a petrol pump, which you will see on pretty much every car dashboard. Most (not all) modern-ish cars also have a little triangle next to the petrol pump icon. That little triangle points either right or left: it is showing on which side of the car the hole for putting petrol in is. So the one above (with the triangle arrow thing helpfully coloured in red) means that the fuel pipe is on the left-hand-side of the car.</p>
<p>I did not know this. It turns out that lots and lots of other people do not know this either. The world seems to be divided into three roughly equal-sized classes: people who already know this and are amazed that everyone did not; people who did not know this and are amazed; and people who say &#8220;my car doesn&#8217;t have that, is it a US/UK/EU-only thing?&#8221;</p>
<p>There is a lesson here, though. This is, once you know what it means, quite an elegant little solution. Now that you know it, you&#8217;ll never pull into a petrol station on the wrong side of the pump ever again. It&#8217;s clever, it&#8217;s simple, and&#8230; half the people in the world don&#8217;t know about it. There are, I&#8217;m sure, conclusions to be drawn about usability studies, iconography, and so on. I mean, spare a thought for the usability testing team on your project at this moment. How do you test this? If you show someone the icon and say &#8220;what does this mean?&#8221; most people would (probably) guess correctly. The point here is: once you know that the triangle means <em>something</em>, it&#8217;s reasonably easy to guess <em>what</em> the something is. But if you don&#8217;t know that it&#8217;s there for a reason, a goodly proportion of people (myself included) will never think to wonder about it, and so won&#8217;t ever learn that it represents a useful bit of information. This has ramifications for how you yourself do usability testing for the things you make.</p>
<p>This has been a party political broadcast on behalf of the &#8220;semiotics is useless if you don&#8217;t realise there&#8217;s a meaning there to discuss, Umberto Eco&#8221; party.</p>
]]></content:encoded>
			<wfw:commentRss>http://kryogenix.org/days/2013/01/21/fuel-pump-arrows/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Magic uploads in the Ubuntu One files REST API</title>
		<link>http://kryogenix.org/days/2013/01/10/magic-uploads-in-the-ubuntu-one-files-rest-api</link>
		<comments>http://kryogenix.org/days/2013/01/10/magic-uploads-in-the-ubuntu-one-files-rest-api#comments</comments>
		<pubDate>Thu, 10 Jan 2013 14:58:12 +0000</pubDate>
		<dc:creator>sil</dc:creator>
				<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://kryogenix.org/days/?p=1726</guid>
		<description><![CDATA[Finally I&#8217;ve had a chance to document &#8220;magic uploads&#8221; in the Ubuntu One REST API. The documentation isn&#8217;t published yet, but it&#8217;s a neat little feature &#8212; when uploading a file to U1, you can pass a couple of hashes calculated from the file content instead of the actual file content, and if that file&#8217;s [...]]]></description>
				<content:encoded><![CDATA[<p>Finally I&#8217;ve had a chance to document &#8220;magic uploads&#8221; in the Ubuntu One REST API. The documentation isn&#8217;t published yet, but it&#8217;s a neat little feature &#8212; when uploading a file to U1, you can pass a couple of hashes calculated from the file content instead of the actual file content, and if that file&#8217;s already in U1, it&#8217;ll &#8220;upload&#8221; without you having to send all the content on the wire, which is a lot quicker. I can&#8217;t do better in describing it than <a href="http://webm0nk3y.wordpress.com/2011/12/02/introducing-magic-uploads-via-ubuntu-one-rest-api/">jdo did when he first wrote about it</a> (a year ago. I know, I know, sorry.) We&#8217;ve had this for ages, and the U1 apps on mobile and so on use it, but I haven&#8217;t had a chance to document it so everyone can use it. Docs will be at <a href="https://one.ubuntu.com/developer/files/store_files/cloud">https://one.ubuntu.com/developer/files/store_files/cloud</a> fairly soon, but I thought it might be useful to add a little test Python script I wrote to confirm that I understood the thing properly.</p>
<pre><code>import os, json
try:
    from ubuntuone.platform.credentials import CredentialsManagementTool
except ImportError:
    CredentialsManagementTool = None
import urlparse, urllib
from hashlib import sha1
from ubuntuone.couch import auth

CONTENT = "This is the content of the file.\n" * 1000

_u1creds = None
def get_ubuntuone_credentials_synchronous():
    "find_credentials is async, but be sync here with a temporary mainloop"
    from gi.repository import GObject
    from dbus.mainloop.glib import DBusGMainLoop
    from ubuntuone.platform.credentials import CredentialsManagementTool

    global _u1creds

    DBusGMainLoop(set_as_default=True)
    loop = GObject.MainLoop()

    def quit(result):
        global _u1creds
        loop.quit()
        if result:
            _u1creds = result

    cd = CredentialsManagementTool()
    d = cd.find_credentials()
    d.addCallbacks(quit)
    loop.run()
    return _u1creds

def make_rest_file(path, content, creds):
    url = urlparse.urljoin("https://one.ubuntu.com/api/file_storage/v1/",
        urllib.quote(path, safe="~/"))
    # First, create file
    body = {"kind": "file"}
    result_header, result_body = auth.request(url=url, sigmeth="HMAC_SHA1",
        http_method="PUT", request_body=json.dumps(body), 
        access_token = creds["token"], token_secret=creds["token_secret"], 
        consumer_key=creds["consumer_key"],
        consumer_secret=creds["consumer_secret"])
    result_body = json.loads(result_body)
    # now, PUT the body of the file
    content_root = "https://files.one.ubuntu.com/"
    put_url = urlparse.urljoin(content_root, urllib.quote(
        result_body["content_path"], safe="~/"))
    put_result_header, put_result_body = auth.request(url=put_url, 
        sigmeth="PLAINTEXT", http_method="PUT", request_body=CONTENT, 
        access_token = creds["token"], token_secret=creds["token_secret"], 
        consumer_key=creds["consumer_key"],
        consumer_secret=creds["consumer_secret"])
    return put_result_header["status"] in ("200", "201")

def make_rest_file_by_magic(path, content, creds):
    url = urlparse.urljoin("https://one.ubuntu.com/api/file_storage/v1/",
        urllib.quote(path, safe="~/"))
    # Note that we do not actually include the CONTENT of the file 
    # here in the PUT.
    # We just upload by passing the hash and magic_hash.
    file_hash = sha1()
    magic_hash = sha1("Ubuntu One")
    file_hash.update(content)
    magic_hash.update(content)
    body = {
        "kind": "file",
        "hash": "sha1:%s" % file_hash.hexdigest(),
        "magic_hash": "magic_hash:%s" % magic_hash.hexdigest()
    }

    result_header, result_body = auth.request(url=url, sigmeth="HMAC_SHA1",
        http_method="PUT", request_body=json.dumps(body), 
        access_token = creds["token"],
        token_secret=creds["token_secret"], 
        consumer_key=creds["consumer_key"],
        consumer_secret=creds["consumer_secret"])
    result_body = json.loads(result_body)
    # if failed, will be a 400 Bad Request with body 
    # {u'error': u'The content could not be reused.'}
    return result_header["status"] in ("200", "201")


def main():
    credentials = get_ubuntuone_credentials_synchronous()
    # real strings, not dbus
    credentials = dict([(str(k),str(v)) for k,v in credentials.items()])

    print "Creating a file with the REST API"
    success = make_rest_file("~/Ubuntu One/u1-test-magic-uploads.txt", 
        CONTENT, credentials)
    if not success:
        print "Failed, somehow"
        return
    print "Succeeded."
    print ("Now, try uploading a new file, but by magic, "
        "so we will not actually upload it.")
    success = make_rest_file_by_magic(
        "~/Ubuntu One/u1-test-magic-uploads-magic-2.txt",
        CONTENT, credentials)
    if success:
        print "Successful magic upload!"
    else:
        print ("Magic upload didn't succeed; you have to "
            "upload in the normal way.")

if __name__ == "__main__":
    main()
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://kryogenix.org/days/2013/01/10/magic-uploads-in-the-ubuntu-one-files-rest-api/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple SVG sparklines</title>
		<link>http://kryogenix.org/days/2012/12/30/simple-svg-sparklines</link>
		<comments>http://kryogenix.org/days/2012/12/30/simple-svg-sparklines#comments</comments>
		<pubDate>Sun, 30 Dec 2012 20:18:27 +0000</pubDate>
		<dc:creator>sil</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://kryogenix.org/days/?p=1715</guid>
		<description><![CDATA[Jeremy Keith calls out for &#8220;a lightweight SVG solution for sparklines&#8221;, which seems like it would be a nice thing to have. Like this, kinda: Just grab http://www.kryogenix.org/random/sparkline.svg and then use it in your pages* like this: &#60;embed src="http://www.kryogenix.org/random/sparkline.svg?1,8,1,8,1,8" width=100 height=15&#62; This works by having the SVG itself contain JavaScript which parses its own querystring. [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://adactio.com/journal/5941/">Jeremy Keith calls out for &#8220;a lightweight SVG solution for sparklines&#8221;</a>, which seems like it would be a nice thing to have.</p>
<p>Like this, kinda:</p>
<p><embed src="http://www.kryogenix.org/random/sparkline.svg?5,14,5,5,9,18,0,9,18,18,9,5,14,14,9,41,9,14,14,9,14,9,50,18,27,9,23,5,18,14,27,27,9,5,5,27,32,14,14,14,36,5,0,0,14,27,9,0,0,18,27" width=100 height=15></p>
<p><embed src="http://www.kryogenix.org/random/sparkline.svg?1,2,3,4,5,6,5,4,3,2,1,2,3,4,5,6" width=100 height=15></p>
<p><embed src="http://www.kryogenix.org/random/sparkline.svg?5,5,5,5,5,5,5,5,5,5,4,10,0,6,5,5,5,5,5,5,5,5,5,5,4,10,0,6,5,5,5,5,5,5,5,5,5,5" width=100 height=15></p>
<p>Just grab <a href="http://www.kryogenix.org/random/sparkline.svg">http://www.kryogenix.org/random/sparkline.svg</a> and then use it in your pages<span style="color: red" title="save it on your own site. If you hotlink it from my site, I'll find you and beat you up">*</span> like this:</p>
<pre><code>&lt;embed src="http://www.kryogenix.org/random/sparkline.svg?1,8,1,8,1,8" 
 width=100 height=15&gt;</code></pre>
<p>This works by having the SVG itself contain JavaScript which parses its own querystring. Therefore, you need to use <code>&lt;embed&gt;</code>, not <code>&lt;img&gt;</code>, because embedded script doesn&#8217;t run in SVGs used as images.</p>
]]></content:encoded>
			<wfw:commentRss>http://kryogenix.org/days/2012/12/30/simple-svg-sparklines/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Working with Windows</title>
		<link>http://kryogenix.org/days/2012/12/27/working-with-windows</link>
		<comments>http://kryogenix.org/days/2012/12/27/working-with-windows#comments</comments>
		<pubDate>Thu, 27 Dec 2012 12:54:38 +0000</pubDate>
		<dc:creator>sil</dc:creator>
				<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://kryogenix.org/days/?p=1711</guid>
		<description><![CDATA[A friend of mine asked me for a favour &#8212; one of those favours which is actually to do some technical support for them. But he&#8217;s a good bloke and is good at the guitar, so I said &#8220;no problem&#8221;. He&#8217;s got a Roberts WM-201 internet radio; it can play mp3 streams from online radio [...]]]></description>
				<content:encoded><![CDATA[<p>A friend of mine asked me for a favour &#8212; one of those favours which is actually to do some technical support for them. But he&#8217;s a good bloke and is good at the guitar, so I said &#8220;no problem&#8221;. He&#8217;s got a Roberts WM-201 internet radio; it can play mp3 streams from online radio stations. And&#8230;it can also play your local music, streamed from a PC on your network. That&#8217;s what he wanted: the computer in the dining room with all his music on, and to play that music on the Roberts radio in the lounge. They&#8217;re both on the wifi network in his house.</p>
<p>The computer is running Windows XP. I haven&#8217;t touched Windows in Quite Some Time, but I said I&#8217;d have a look.</p>
<p>Long story short: I failed. And am annoyed about it. I&#8217;m not really looking for suggestions here: he&#8217;s not a particularly technical bloke, so I can&#8217;t really pass on the suggestions to him, and he&#8217;s a few hundred miles from me so I can&#8217;t try things out. This is more an ill-tempered rant than anything else, but if anyone&#8217;s got any ideas <strong>that do not involve him buying new stuff or installing different operating systems</strong>, I&#8217;ll listen.</p>
<p>The Roberts radio thing has two ways of playing music from a source on the network: it can connect to Windows shares, and it can connect to UPnP music sources. So I tried UPnP first.</p>
<p>Windows Media Player has the ability to share music by UPnP, and he already has that installed, with his music in it. That seemed an obvious place to start. So, I enabled music sharing, following the instructions. The radio could not see the shared UPnP source. I also had an Android tablet available, so I installed a UPnP browser on it and that couldn&#8217;t see it either. I installed a UPnP browser on the Windows machine and that <em>could</em> see the UPnP source, which suggests that the problem is not in Windows Media Player: it&#8217;s some sort of network or firewall issue. The Windows machine had at least two firewalls on it: Windows Firewall, and McAfee. I disabled both: still nothing could see the UPnP source. There is, as far as I can tell, no way to find out <em>why</em> a thing is invisible. A noddy network diagnostic tool on the Android tablet confirmed that TCP port 2869 was &#8220;open&#8221; (and other ports were &#8220;closed&#8221;); I didn&#8217;t have easy access to any other diagnostic tools (I&#8217;d have nmapped it from my Ubuntu machine if I had it, but I didn&#8217;t).</p>
<p>No idea what to try after that. I don&#8217;t know what might be causing it to be invisible from outside. A photo frame which can browse UPnP sources also failed to connect. I did think about installing a different UPnP server, but all the Windows ones I looked at (Twonky, another one I forget the name of) cost money, and there&#8217;s no MediaTomb.</p>
<p>So, I tried Windows Shares. I shared the music folder and allowed network users to alter the files therein. An SMB browser on the Android tablet <em>could</em> see and browse the share <em>if it connected as Anonymous</em>. It could not when using a username and password because I didn&#8217;t know which username and password to use! He doesn&#8217;t have a password set, and his username has a space in. I tried connecting with the Android SMB browser (AndSMB, if it makes a difference) using the username (containing a space) and an empty password: it would not connect. I don&#8217;t know how to find out what your username is on Windows; I poked around at &#8220;net user&#8221; and &#8220;net share&#8221; without enlightenment. I tried changing his username to not have a space in, and setting a password, and then connecting from AndSMB with that username and password: didn&#8217;t work. The radio did not find any shares at all. I do not know whether the radio tries connecting as Anonymous, and the documentation doesn&#8217;t say. I tried using the username and password from the radio and that didn&#8217;t work either. By the look of it, when you tell AndSMB to connect as Anonymous, it actually connects with username &#8220;guest&#8221; and password &#8220;&#8221;, so I tried that from the radio and it didn&#8217;t work.</p>
<p>So now I&#8217;m lost. And this is way too hard. And every time something like this happens, I think he gets a little closer to buying a Mac. Sigh.</p>
<p>I may take an Ubuntu CD round at some point.</p>
]]></content:encoded>
			<wfw:commentRss>http://kryogenix.org/days/2012/12/27/working-with-windows/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Why I don’t like Biscuit (not biscuits)</title>
		<link>http://kryogenix.org/days/2012/12/18/biscuit</link>
		<comments>http://kryogenix.org/days/2012/12/18/biscuit#comments</comments>
		<pubDate>Tue, 18 Dec 2012 09:28:55 +0000</pubDate>
		<dc:creator>sil</dc:creator>
				<category><![CDATA[General musings]]></category>

		<guid isPermaLink="false">http://kryogenix.org/days/?p=1702</guid>
		<description><![CDATA[Fresh from the Pastry Box reject bin! For the last year, I&#8217;ve been part of The Pastry Box, a series of short daily essays about the tech world, the web, philosophy, and similar things. For December&#8217;s essay I wrote two and couldn&#8217;t decide between them. One about creativity and the nature of being lost was [...]]]></description>
				<content:encoded><![CDATA[<p>Fresh from the <a href="http://the-pastry-box-project.net/">Pastry Box</a> reject bin! For the last year, I&#8217;ve been part of The Pastry Box, a series of short daily essays about the tech world, the web, philosophy, and similar things. For December&#8217;s essay I wrote two and couldn&#8217;t decide between them. One <a href="http://the-pastry-box-project.net/stuart-langridge/2012-december-18/">about creativity and the nature of being lost</a> was published today, and I didn&#8217;t want the other to just vanish, so here it is.</p>
<ol>
<li>While I was in my first year at university, Portishead released Dummy, the greatest album the world has ever known. Now, admittedly, I was at that point in my life as impressionable as a dollop of warm wax, but my liking was also influenced by how it is <em>the greatest album the world has ever known</em>.</li>
<li>I had a cassette copy of it made by my friend Andy which I played obsessively. All the time. Over and over again. And, for some reason, that cassette copy didn&#8217;t have <a href="http://www.youtube.com/watch?v=uiT0fBePR0Q">Biscuit</a> on it. To this day I do not know why.</li>
<li>And to this day, I don&#8217;t like Biscuit as much as the rest of the album.</li>
<li>What you say matters, but what you leave out also matters.<br /><em>If you are a designer, go to 5. If you are a public speaker, go to 6. If you are neither, go to 7. To open the door and attack the beast, go to 11.</em></li>
<li>&#8220;Perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away&#8221;, right? But Brillat-Savarin said: A dessert without cheese is like a beautiful woman with only one eye. In this age of minimalism, of stripped-down and stripped-out experiences, of getting what you need right there with no extraneous clutter, be careful we&#8217;re not serving the dessert without cheese.<br /><em>To continue, go to 8.</em></li>
<li>A philosopher once said: with great power comes great responsibility. This happens <strong>even if you don&#8217;t want the great power</strong>. It happens even if you don&#8217;t think you&#8217;ve got it. Someone looks up to you. If you leave things out when you talk to people, they&#8217;ll think it&#8217;s OK to leave them out too. They&#8217;ll think it&#8217;s not important, because you obviously don&#8217;t think it is. It doesn&#8217;t matter if in your heart you know it&#8217;s important. You have to find a way of talking about it without ruining your elegant simplicity. That&#8217;s why they pay you the big bucks. Even when they don&#8217;t.<br /><em>To continue, go to 8.</em></li>
<li>Read them both.</li>
<li>Now go back and read the other one.</li>
<li>And: don&#8217;t worry about it. Expert Persian carpet makers used to deliberately drop a stitch, because to make something of flawless perfection would be to challenge the perfection of Allah. We can&#8217;t all be right all the time. It&#8217;s only the web. It&#8217;s only our world.
<p>Not that important.</p>
<p>Right?</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://kryogenix.org/days/2012/12/18/biscuit/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss><!-- Dynamic page generated in 0.432 seconds. --><!-- Cached page generated by WP-Super-Cache on 2013-05-16 15:38:26 -->
