<?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>Timetric Blog</title>
	<atom:link href="http://blog.timetric.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.timetric.com</link>
	<description>Let&#039;s move back to words...</description>
	<lastBuildDate>Mon, 08 Feb 2010 17:08:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Sunburnt: a python-solr interface</title>
		<link>http://blog.timetric.com/2010/02/sunburnt-a-python-solr-interface/</link>
		<comments>http://blog.timetric.com/2010/02/sunburnt-a-python-solr-interface/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 17:08:33 +0000</pubDate>
		<dc:creator>toby</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.timetric.com/?p=231</guid>
		<description><![CDATA[Over the last few months, we&#8217;ve been hard at work behind the scenes at Timetric, and a few of the results are now to be seen on the website. If you&#8217;ve been paying close attention, you might have noticed the appearance of machine tags, and of the ability to search series by value.
These are both [...]]]></description>
			<content:encoded><![CDATA[<p>Over the last few months, we&#8217;ve been hard at work behind the scenes at Timetric, and a few of the results are now to be seen on the website. If you&#8217;ve been paying close attention, you might have noticed the appearance of machine tags, and of the ability to search series by value.</p>
<p>These are both reflections of one of the biggest changes we&#8217;ve made – we&#8217;ve entirely replaced the search infrastructure the site runs on. We&#8217;re now backed by <a href="http://lucene.apache.org/solr/">Apache Solr</a>, and we&#8217;ve written a new Python-Solr interface, called <a href="http://github.com/tow/sunburnt/">sunburnt</a>.</p>
<p>We let users search using both free text search and drill-down tagging &mdash; we used to run these on a combination of <a href="http://code.google.com/p/djangosearch/">postgres-backed full-search text</a> and <a href="http://code.google.com/p/django-tagging/">django-tagging</a>, but this combination <a href="#shortcomings">wasn&#8217;t particularly satisfactory</a>. Unsurprisingly, when you&#8217;re trying to add search infrastructure to a site, what you really want is a proper search-engine backend.</p>
<p>For a mature, full-featured, well-supported open-source search engine, the choice boils down to <a href="http://lucene.apache.org/solr/">Solr</a> or <a href="http://xapian.org">Xapian</a>. We were strongly tempted by the latter &mdash; there&#8217;s no shortage of Xapian expertise around Cambridge, but we were swayed by the Apache licensing of Solr, rather than Xapian&#8217;s GPL.</p>
<p>And although there are <a href="http://eaddrinu.se/blog/2010/sunburnt.html">a number of existing Python-Solr interfaces</a>, none of them did what we wanted, which was to provide an intelligent and robust Pythonic API, which lets you pass arbitrary objects in and out of Solr. So we built our own, and called it <a href="http://tow.github.com/sunburnt/">sunburnt</a>.</p>
<p>Sunburnt is most directly comparable to <a href="http://haystacksearch.org">Haystack</a>, but with a couple of major differences. Firstly, it&#8217;s not <a href="http://haystacksearch.org/docs/faq.html#when-should-i-not-be-using-haystack">restricted to Django model data</a>, and secondly, it&#8217;s schema-driven rather than schema-generating &mdash; it lets you construct your own Solr schema, and automatically derives all the type-checking/conversion/coercion code necessary to map your objects to and from the Solr index, when constructing queries and exchanging data.</p>
<p>The only documentation at the moment is the examples below, but the code is all <a href="http://github.com/tow/sunburnt/">up on Github</a>. Patches and contributions are more than welcome!</p>
<h4>Sunburnt in use</h4>
<p>To start indexing &#038; querying, you initialize a <tt>SolrInterface</tt> with your schema. At the moment, you need to do this by passing in the schema xml &mdash; sunburnt won&#8217;t query the Solr server for its schema.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">solr_interface = sunburnt.<span style="color: black;">SolrInterface</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;http://localhost:8983&quot;</span>, <span style="color: #483d8b;">&quot;schema.xml&quot;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>To index objects, <tt>add()</tt> them to the interface. sunburnt doesn&#8217;t care what form the data comes in, so long as</p>
<ul>
<li>if it looks like an object, it has attributes named according to fields defined in the schema</li>
<li>if it looks like a dictionary, it has keys named according to fields defined in the schema</li>
</ul>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">class</span> Document<span style="color: black;">&#40;</span><span style="color: #008000;">object</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, title, contents<span style="color: black;">&#41;</span>:
        <span style="color: #008000;">self</span>.<span style="color: black;">title</span> = title
        <span style="color: #008000;">self</span>.<span style="color: black;">contents</span> = contents
&nbsp;
documents = <span style="color: black;">&#91;</span>
   <span style="color: black;">&#123;</span><span style="color: #483d8b;">&quot;title&quot;</span>:<span style="color: #483d8b;">&quot;This is a dictionary&quot;</span>, <span style="color: #483d8b;">&quot;contents&quot;</span>:<span style="color: #483d8b;">&quot;Lorem ipsum&quot;</span><span style="color: black;">&#125;</span>,
   Document<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;This is an object&quot;</span>, <span style="color: #483d8b;">&quot;dolor&quot;</span><span style="color: black;">&#41;</span>
<span style="color: black;">&#93;</span>
&nbsp;
solr_interface.<span style="color: black;">add</span><span style="color: black;">&#40;</span>documents<span style="color: black;">&#41;</span></pre></div></div>

<p>If you haven&#8217;t set your Solr instance up to do <a href="http://wiki.apache.org/solr/SolrConfigXml/#Update_Handler_Section">autocommit</a>, then you might want to commit your documents to the index:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">solr_interface.<span style="color: black;">commit</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>after which the documents are searchable. The API is fairly close to that offered by Haystack (and indeed <a href="http://docs.djangoproject.com/en/dev/ref/models/querysets/">Django&#8217;s QuerySet</a>) &#8211; unsurprisingly, since they&#8217;re solving similar problems.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">solr_interface.<span style="color: black;">query</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;This&quot;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>does what you might expect, searching on the default field.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">solr_interface.<span style="color: black;">query</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;This&quot;</span><span style="color: black;">&#41;</span>.<span style="color: #008000;">filter</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;dictionary&quot;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>while chaining with <tt>filter()</tt> allows you to choose <a href="http://wiki.apache.org/solr/CommonQueryParameters#fq">which parts of your queries are cached by Solr</a>.</p>
<p>For fields representing numbers, or dates, then searching by range is useful, for example</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">solr_interface.<span style="color: black;">query</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;This&quot;</span>, last_modified__gt=<span style="color: #483d8b;">&quot;2009-01-01&quot;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>if you have a last_modified field in your schema. Queries <a href="http://wiki.apache.org/solr/SolrFacetingOverview">can be faceted</a> &#8211; if you had tags on your objects, you might do this:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">solr_interface.<span style="color: black;">query</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;This&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">facet_by</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;tags&quot;</span>, limit=<span style="color: #ff4500;">20</span>, mincount=<span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span></pre></div></div>

<p>and if you wanted to search for similar documents, you can do a <a href="http://wiki.apache.org/solr/MoreLikeThis">more-like-this query</a> (in this case, looking for similarity in the tags field)</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">solr_interface.<span style="color: black;">query</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;This&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">mlt</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;tags&quot;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>sunburnt doesn&#8217;t support all of the Solr API, but it gives you access to a goodly portion, and all of these operations are chainable.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">solr_interface.<span style="color: black;">query</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;This&quot;</span><span style="color: black;">&#41;</span>.<span style="color: #008000;">filter</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;dictionary&quot;</span><span style="color: black;">&#41;</span>.\
    facet_by<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;tags&quot;</span>, limit=<span style="color: #ff4500;">20</span>, mincount=<span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>.\
    query<span style="color: black;">&#40;</span>last_modified__gt=<span style="color: #483d8b;">&quot;2009-01-01&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">paginate</span><span style="color: black;">&#40;</span>rows=<span style="color: #ff4500;">10</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Finally, having set up a query, you can get a result object back by <tt>execute()</tt>ing the query. This bit of the API is still a bit rough around the edges, but</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">r = solr_interface.<span style="color: black;">query</span><span style="color: black;">&#40;</span>...<span style="color: black;">&#41;</span>.<span style="color: black;">execute</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
r.<span style="color: black;">result</span> <span style="color: #808080; font-style: italic;"># has the main query results</span>
r.<span style="color: black;">facet_counts</span> <span style="color: #808080; font-style: italic;"># has the faceting results</span>
r.<span style="color: black;">more_like_these</span> <span style="color: #808080; font-style: italic;"># has any more_like_these results</span></pre></div></div>

<p>and if you poke around in that object, it has all the rest of the information that Solr provides.</p>
<h4>Sunburnt in practice</h4>
<p>The code is now running live on Timetric, and is problem-free for us. We&#8217;ve been able to throw away scads of code working around <a href="#shortcomings">djangosearch/django-tagging shortcomings</a>, and performance is significantly faster all round, especially for anything regarding tagging. Most usefully though, it&#8217;s provided us with a platform to start experimenting with new navigation features much more rapidly.</p>
<p><a name="shortcomings"></a></p>
<h5>Postscript: djangosearch/django-tagging shortcomings</h5>
<p>djangosearch, though easy to set up (if you&#8217;re already using postgres), offers very little in the way of control over various parameters and options you might want to tune, and requires filtering/escaping of some queries. (Searching for a string with &#8220;£&#8221; in it causes interesting errors!)</p>
<p>django-tagging had slightly more serious issues;</p>
<ul>
<li>we had to maintain our own fork of the codebase due to a couple of long-standing issues; corner cases which upstream weren&#8217;t interested   in fixing (One that kept biting us was its lack of support for models with non-integer primary keys. Easily fixed, but <a href="http://code.google.com/p/django-tagging/issues/detail?id=15">support is still not included in upstream django-tagging</a>).</li>
<li>extending its functionality turned out to involve writing a lot of  hand-tuned and often inherently slow SQL. Writing related-tags functionality was particularly painful &#8211; it involves inverting the  index, which is very time-consuming &#8211; we had to do that offline.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.timetric.com/2010/02/sunburnt-a-python-solr-interface/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Government 2010</title>
		<link>http://blog.timetric.com/2009/10/government-2010/</link>
		<comments>http://blog.timetric.com/2009/10/government-2010/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 06:19:01 +0000</pubDate>
		<dc:creator>andrew</dc:creator>
				<category><![CDATA[politics]]></category>

		<guid isPermaLink="false">http://blog.timetric.com/?p=226</guid>
		<description><![CDATA[Good morning! Andrew here.
At Timetric, we’re on a mission to get the world’s statistics to you in a form which you can use. A lot of those numbers start their lives in local and national governments, so part of the job is talking, and working, with people in government.
Today is the Government 2010 conference in [...]]]></description>
			<content:encoded><![CDATA[<p>Good morning! Andrew here.</p>
<p>At Timetric, we’re on a mission to get the world’s statistics to you in a form which you can use. <a href="http://www.statistics.gov.uk">A lot of those numbers</a> <a href="http://data.gov/">start their lives</a> in <a href="http://datasf.org/">local</a> and national governments, so part of the job is talking, and working, with people in government.</p>
<p>Today is the <a href="http://www.g2010.co.uk/">Government 2010</a> conference in London, and I&#8217;m going to be there. What&#8217;s more, I&#8217;m going to be covering it live all day <a href="http://twitter.com/walkingshaw">on Twitter at @walkingshaw</a> and over on <a href="http://davepress.net/">Davepress</a>. It&#8217;ll be much easier with your help, though! <a href="http://davepress.net/2009/10/22/government-2010-agenda/">Have a look at the agenda</a>, and if you&#8217;ve got anything you&#8217;d like me to cover in more detail or to relay to the conference, please get in touch.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.timetric.com/2009/10/government-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OAuth 1.0a and autodiscovery</title>
		<link>http://blog.timetric.com/2009/09/oauth-1-0a-and-autodiscovery/</link>
		<comments>http://blog.timetric.com/2009/09/oauth-1-0a-and-autodiscovery/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 13:59:59 +0000</pubDate>
		<dc:creator>toby</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.timetric.com/?p=213</guid>
		<description><![CDATA[OAuth 1.0a
As of last Monday, we&#8217;ve upgraded timetric.com to cope with the OAuth 1.0a workflow.
If you follow these things, you can hardly have avoided noticing that there was a big fuss in April this year, when a vulnerability in the OAuth protocol was discovered. When it was made public, it turned out to be less [...]]]></description>
			<content:encoded><![CDATA[<h5>OAuth 1.0a</h5>
<p>As of last Monday, we&#8217;ve upgraded timetric.com to cope with the <a href="http://oauth.net/core/1.0a">OAuth 1.0a</a> workflow.</p>
<p>If you follow these things, you can hardly have avoided noticing that there was a <a href="http://news.cnet.com/8301-13577_3-10225103-36.html">big fuss</a> in April this year, when a vulnerability in the OAuth protocol was discovered. When it was <a href="http://oauth.net/advisories/2009-1">made public</a>, it turned out to be less a technical than a social vulnerability. The OAuth workflow involves several transactions, and the exchange of multiple tokens. In version 1.0, there was an opportunity for a malicious third party to step into the exchange, and by tricking the end user (essentially, by phishing them into clicking a link) gain their credentials.</p>
<p>Still, social vulnerabilities are as important as technical ones, and the OAuth team rapidly developed version 1.0a of the workflow which avoids the problem. In the interim, and since upgrading existing servers and clients is hard work, and since the issue can be mitigated by anti-phishing provisions, it&#8217;s been standard practice to carry on supporting the 1.0 workflow, while attaching big warnings everywhere, and that&#8217;s what we&#8217;ve been doing.</p>
<p>However, we&#8217;ve now finished implementing a 1.0a-compliant server for timetric, so that 1.0a-capable clients can take advantage of the improved workflow. But because most clients don&#8217;t yet support 1.0a, our server currently supports both 1.0 and 1.0a transactions. Doing this has involved borrowing from, and extending, both <a href="http://oauth.googlecode.com/svn/code/python/oauth/">python-oauth</a> &#038; <a href="http://code.welldev.org/django-oauth/">django-oauth</a>. We&#8217;ve fed our changes to both the upstream authors of both projects, we&#8217;ve tested our codebase, and it&#8217;s now running live on timetric.</p>
<p>(As of writing, our changes haven&#8217;t yet made it into the upstream version of django-oauth, but you can get a hold of what we&#8217;ve done from our <a href="http://github.com/timetric/django-oauth/">fork on github</a>.)</p>
<p>We&#8217;ll continue to support the 1.0 workflow for the immediately-foreseeable future, but obviously at some point we&#8217;ll want to retire it in favour of the more secure 1.0a. For those of you who&#8217;ve written OAuth clients , I can highly recommend <a href="http://mojodna.net/2009/05/20/an-idiots-guide-to-oauth-10a.html">this blog post</a> as a very nice overview of the changes in the workflow, and what you need to do to 1.0a-enable a client.</p>
<h5>OAuth autodiscovery</h5>
<p>While I was poking around with the OAuth code, I also managed to address a niggle I&#8217;ve had for a long time with OAuth. Oauth uses three separate URL endpoints to manage the token request/exchange process. These need to be published somewhere, and then any OAuth clients need to know these service-specific URLs. This is annoying; practically, because it makes it hard to write a generic OAuth client framework, and also it offends the RESTian purist in me &#8211; resources should be machine-discoverable, dammit.</p>
<p>Anyway, it turns out that there is an experimental <a href="http://oauth.net/discovery/">OAuth auto-discovery spec</a>, which piggybacks off the XRDS resource discovery scheme. It&#8217;s not final, and it seems there&#8217;s not a lot of active development on it, but I thought I&#8217;d try it out anyway. Having implemented it as an experiment, I&#8217;m actually quite happy with it. All timetric OAuth resources are now completely auto-discoverable, knowing nothing but the xrds mimetype.</p>
<p>The workflow goes like this: firstly, ask for the location of the XRDS resource description, by using content-negotiation on whatever OAuth-protected resource you&#8217;re trying to gain access to:</p>
<p>Request:<br />
<code>GET /resource-of-interest<br />
Accept: application/xrds+xml</code></p>
<p>Response:<br />
<code>HTTP/1.1 302 Found<br />
X-XRDS-Location: /xrds.xrds<br />
Location: http://timetric.com/xrds.xrds<br />
[...]</code></p>
<p>then follow the redirect;</p>
<p>Request:<br />
<code>GET /xrds.xrds</code></p>
<p>Response:<br />
<code>HTTP/1.1 200 OK<br />
Content-Type: application/xrds+xml<br />
[...]</p>
<p>&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br />
&lt;XRDS xmlns="xri://$xrds"&gt;<br />
 [...]</code></p>
<p>The XRDS file has a well-defined XML format, and the client can parse it to pull out the location of the OAuth endpoints. This means that you can write a very generic OAuth client library; all the library needs to be told is the location of any interesting oauth-protected resources, and now it can find out everything it needs to negotiate the OAuth workflow. Helpfully, you can also use the XRDS file to advertise which forms of OAuth negotiation you support &#8211; parameters in the URI, or as HTTP headers, different signature schemes, and so on.</p>
<p>I&#8217;ve had an immediate benefit, because now it&#8217;s made my test framework much simpler &#8211; I don&#8217;t need to store arbitrary strings denoting my OAuth URLs, nor manipulate them every time I run tests against differently-named test servers. Since the spec isn&#8217;t final, this scheme is obviously liable to change &#8211; but it&#8217;s a nice example of how to make a service machine-discoverable.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.timetric.com/2009/09/oauth-1-0a-and-autodiscovery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>API improvements</title>
		<link>http://blog.timetric.com/2009/08/api-improvements/</link>
		<comments>http://blog.timetric.com/2009/08/api-improvements/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 18:24:54 +0000</pubDate>
		<dc:creator>toby</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.timetric.com/?p=204</guid>
		<description><![CDATA[As Dan alluded to yesterday, this week we made a new API release.
Previously our API was basically only let you add and retrieve data. This has been useful to a whole lot of people, but there&#8217;s much more that you can do with Timetric.
The new release involves several features. There&#8217;s a bit of improvement to [...]]]></description>
			<content:encoded><![CDATA[<p>As Dan <a href="http://blog.timetric.com/2009/08/new-dashboard/">alluded to yesterday</a>, this week we made a new API release.</p>
<p>Previously our API was basically only let you add and retrieve data. This has been useful to a whole lot of people, but there&#8217;s much more that you can do with Timetric.</p>
<p>The new release involves several features. There&#8217;s a bit of improvement to existing functionality to make life a bit easier when uploading data; but more excitingly, we&#8217;ve opened up access to even more of the capabilities of the timetric platform.</p>
<h3>Search endpoints</h3>
<p>When building applications on top of Timetric, one of things we&#8217;ve been asked for is the ability to retrieve lists of relevant data. This might simply be to get hold of all of your own series, or it might be a list of tagged series, or it might be a complex search query.</p>
<p>For all of these, we&#8217;ve <a href="http://timetric.com/help/httpapi-query/">exposed search endpoints</a> that let you do powerful queries across our data. You can search through the full text of our titles and descriptions, over tags, and by user. This means you can build much more useful interactive interfaces on top of Timetric. In fact, these are exactly the same endpoints that timetric.com uses internally when you browse our data.</p>
<h3>Calculated series</h3>
<p>Through the timetric.com website, you&#8217;ve always had the ability to build model calculations, and to filter series. We&#8217;ve now <a href="http://timetric.com/help/httpapi-models/">exposed this at the API level</a> as well, so you can build these models and filters programmatically.</p>
<h3>Cross-domain requests</h3>
<p>If you&#8217;re a web developer, you&#8217;ll be all too familiar with the headaches of restrictions on cross-domain requests. In many cases, there are perfectly good security-related reasons for them, but these restrictions make writing some web applications much harder than it ought to be.</p>
<p>Fortunately, the newest generation of browsers (Firefox 3.5, IE8, and Safari 4) let you make secure cross-domain requests directly — so long as the server supports it (see <a href="https://developer.mozilla.org/en/HTTP_access_control">https://developer.mozilla.org/en/HTTP_access_control</a>). Since this is such a useful feature — for us as much as anyone else &#8211; we&#8217;ve enabled it so you can use it too, and build much more exciting Timetric mashups in modern browsers.</p>
<h3>Easier uploading</h3>
<p>And finally, we had feedback from several people about ways in which we could make pushing data into the platform through the API a bit easier. The details are probably uninteresting unless you like constructing HTTP messages yourself (which I do, but it&#8217;s not everyone&#8217;s cup of tea!) so I&#8217;ll simply point you at the <a href="http://timetric.com/help/httpapi-data/">new documentation</a>. In short, you can POST data directly, rather than having to multipart-encode it.</p>
<h3>So &#8230;</h3>
<p>If you&#8217;re a developer, get out there and play! We&#8217;re always happy to <a href="http://getsatisfaction.com/inklingsoftware/">get any feedback</a> &#8211; positive or negative!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.timetric.com/2009/08/api-improvements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Dashboard</title>
		<link>http://blog.timetric.com/2009/08/new-dashboard/</link>
		<comments>http://blog.timetric.com/2009/08/new-dashboard/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 13:59:27 +0000</pubDate>
		<dc:creator>dan</dc:creator>
				<category><![CDATA[user interface]]></category>

		<guid isPermaLink="false">http://blog.timetric.com/?p=195</guid>
		<description><![CDATA[Yesterday we rolled out an exciting update to the Dashboard, which now looks something like this:

More important than the lick of paint, though, is all the new stuff you can do with it! Though it might sound boring, the Dashboard is all about lists. The old Dashboard had only one — a list of series [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday we rolled out an exciting update to the Dashboard, which now looks something like this:</p>
<p style="text-align: center;"><img class="aligncenter size-large wp-image-196" title="Dashboard v2" src="http://blog.timetric.com/wp-content/uploads/2009/08/new-dash-1024x672.png" alt="Dashboard v2" width="553" height="363" /></p>
<p>More important than the lick of paint, though, is all the new stuff you can do with it! Though it might sound boring, the Dashboard is all about <strong>lists</strong>. The old Dashboard had only one — a list of series you&#8217;ve &#8217;starred&#8217;. We&#8217;ve added two others: &#8221;My Series&#8221; for series you&#8217;ve created yourself and &#8220;Recently Viewed&#8221; which shows you the last few series you&#8217;ve looked at. Soon we&#8217;ll let you create your own custom lists too.</p>
<p>Now that you have all those series at your fingertips, you&#8217;ll want to compare and analyze them, right? Just select the ones you&#8217;re interested in, and click &#8216;Build&#8217;, &#8216;Overlay&#8217; or &#8216;Versus&#8217; at the top!</p>
<p>Talking about building&#8230; If you&#8217;re a developer, you can now build models through our API as well — Toby&#8217;ll be blogging about that very soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.timetric.com/2009/08/new-dashboard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Timetric&#8217;s New Logo</title>
		<link>http://blog.timetric.com/2009/08/timetrics-new-logo/</link>
		<comments>http://blog.timetric.com/2009/08/timetrics-new-logo/#comments</comments>
		<pubDate>Fri, 07 Aug 2009 14:48:01 +0000</pubDate>
		<dc:creator>dan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.timetric.com/?p=183</guid>
		<description><![CDATA[It&#8217;s been a busy month in Timetric Towers, so this post is waaay overdue, but I really want to highlight the excellent new logos designed for us by Kate Abbass (@kateabbass).
 
We love them — they&#8217;re simple yet distinctive. And Andrew&#8217;s happy that we finally have some Helvetica in the site! Look out for them [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a busy month in Timetric Towers, so this post is waaay overdue, but I really want to highlight the excellent new logos designed for us by <a href="http://www.kateabbass.co.uk/">Kate Abbass</a> (<a href="http://twitter.com/kateabbass">@kateabbass</a>).</p>
<div style="text-align: center;"><img class="alignnone size-full wp-image-184" title="Timetric Logo" src="http://blog.timetric.com/wp-content/uploads/2009/08/Timetric-Logo.png" alt="Timetric Logo" width="171" height="69" /> <img class="alignnone size-full wp-image-185" title="Timetric Mark" src="http://blog.timetric.com/wp-content/uploads/2009/08/Timetric-Marks.png" alt="Timetric Mark" width="74" height="73" /></div>
<p><div style="text-align: left;">We love them — they&#8217;re simple yet distinctive. And Andrew&#8217;s happy that we finally have some Helvetica in the site! Look out for them on a blog near you soon&#8230;</div>
<p>
]]></content:encoded>
			<wfw:commentRss>http://blog.timetric.com/2009/08/timetrics-new-logo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oxford Geek Night #13</title>
		<link>http://blog.timetric.com/2009/07/oxford-geek-night-13/</link>
		<comments>http://blog.timetric.com/2009/07/oxford-geek-night-13/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 13:21:04 +0000</pubDate>
		<dc:creator>andrew</dc:creator>
				<category><![CDATA[about us]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[news]]></category>

		<guid isPermaLink="false">http://blog.timetric.com/?p=180</guid>
		<description><![CDATA[Andrew here. I was recently invited to be one of the keynote speakers at Oxford Geek Nights #13. Thanks to everyone there! It was a real treat to get a chance to talk about what we&#8217;re doing.
I took the opportunity to discuss some of, if it&#8217;s not too pretentious a way of phrasing it, the [...]]]></description>
			<content:encoded><![CDATA[<p>Andrew here. I was recently invited to be one of the keynote speakers at <a href="http://oxford.geeknights.net/2009/jul-15th/">Oxford Geek Nights #13</a>. Thanks to everyone there! It was a real treat to get a chance to talk about what we&#8217;re doing.</p>
<p>I took the opportunity to discuss some of, if it&#8217;s not too pretentious a way of phrasing it, the philosophy behind Timetric and some of the work we&#8217;ve been doing with <a href="http://www.guardian.co.uk/datablog">the Guardian</a>. The talk was videoed – see it for yourself:</p>
<p><a href="http://ogn.s3.amazonaws.com/13-AndrewWalkingshaw.mp4">Right-click here to download the talk (41MB).</a></p>
<p>If you&#8217;d rather read than watch, though, <a href="http://blog.lexical.org.uk/2009/07/23/oxford-geek-night-keynote/">my speaker notes are over on my blog</a>.</p>
<p>Once again, thank you to <a href="http://jpstacey.info/">J-P</a> and his co-conspirators for inviting us! </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.timetric.com/2009/07/oxford-geek-night-13/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://ogn.s3.amazonaws.com/13-AndrewWalkingshaw.mp4" length="42287309" type="video/mp4" />
		</item>
		<item>
		<title>On journalism</title>
		<link>http://blog.timetric.com/2009/07/on-journalism/</link>
		<comments>http://blog.timetric.com/2009/07/on-journalism/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 22:44:40 +0000</pubDate>
		<dc:creator>andrew</dc:creator>
				<category><![CDATA[about us]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://blog.timetric.com/?p=172</guid>
		<description><![CDATA[
Andrew Walkingshaw of Timetric at News Innovation from Martin Belam on Vimeo.
From News Innovation: London. Thank you to Martin Belam for his very sympathetic editing!
Andrew here; Dan and I took part in NewsInnovation:London at NESTA on Friday 10th July (just under a week ago). I spoke alongside Tom Loosemore of 4iP about building tools to [...]]]></description>
			<content:encoded><![CDATA[<p><object width="600" height="345"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=5583442&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=01AAEA&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=5583442&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=01AAEA&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="600" height="345"></embed></object>
<p><a href="http://vimeo.com/5583442">Andrew Walkingshaw of Timetric at News Innovation</a> from <a href="http://vimeo.com/currybet">Martin Belam</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>From <a href="http://newsinnovationlondon.eventbrite.com/">News Innovation: London</a>. Thank you to <a href="http://currybet.net/">Martin Belam</a> for <a href="http://www.currybet.net/cbet_blog/2009/07/andrew_walkinshaw_timetric.php">his very sympathetic editing</a>!</p>
<p><a href="http://www.lexical.org.uk/">Andrew</a> here; <a href="http://dan-wilson.co.uk">Dan</a> and I took part in NewsInnovation:London at <a href="http://www.nesta.org.uk">NESTA</a> on Friday 10th July (just under a week ago). I spoke alongside <a href="http://www.tomski.com">Tom Loosemore</a> of <a href="http://www.4ip.org.uk/">4iP</a> about building tools to help journalists, and members of the public, get more out of public data.</p>
<p>If you&#8217;ve wondered what we&#8217;re doing with <a href="http://www.guardian.co.uk/datablog">the Guardian</a>, and more importantly <em>why</em> we&#8217;re doing it, here are some of the things we&#8217;ve been doing and the reasons why we&#8217;ve been doing them. </p>
<p>The video&#8217;s about four minutes long, and if nothing else, it&#8217;s a good opportunity to see (and poke fun at) what one of us on the Timetric team looks like! There is a serious point here, though: to give people better tools to find, view, share and analyse data is to empower people to make better-informed, more considered, smarter judgements — and it occurs to us that the best journalism has the same goal: to help people to understand and to decide. That&#8217;s something which <em>really</em> matters.</p>
<p>Thank you to <a href="http://www.markng.co.uk/">Mark</a> and the other organisers for putting on such an inspirational event.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.timetric.com/2009/07/on-journalism/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Easier Embedding</title>
		<link>http://blog.timetric.com/2009/06/easier-embedding/</link>
		<comments>http://blog.timetric.com/2009/06/easier-embedding/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 17:04:06 +0000</pubDate>
		<dc:creator>dan</dc:creator>
				<category><![CDATA[user interface]]></category>
		<category><![CDATA[embedding]]></category>
		<category><![CDATA[ui]]></category>

		<guid isPermaLink="false">http://blog.timetric.com/?p=167</guid>
		<description><![CDATA[One of the key features of Timetric is that we let you embed our data into your own site. We want to be the place to go when you&#8217;re looking for data to view and analyze, but we reckon that when it comes to layering interpretation over the top, the best place for that is [...]]]></description>
			<content:encoded><![CDATA[<p>One of the key features of Timetric is that we let you embed our data into your own site. We want to be <strong>the</strong> place to go when you&#8217;re looking for data to view and analyze, but we reckon that when it comes to layering interpretation over the top, the best place for that is on your own blog or website.</p>
<p>To make this easier, we&#8217;ve put a big &#8216;<em>Share this series</em>&#8216; button on the pages of all public series, which when clicked will reveal:</p>
<p style="text-align: center;"><img class="size-full wp-image-168  aligncenter" title="New Embed UI" src="http://blog.timetric.com/wp-content/uploads/2009/06/embedui.png" alt="New Embed UI" width="377" height="292" /></p>
<p style="text-align: left;">The immediate benefits are that you now have access to the code which will give you a sparkline (a common request!), and that either bit of code can be quickly copied to your clipboard using the little button at the side (thanks to Tom Preston-Werner&#8217;s <a href="http://github.com/mojombo/clippy/">Clippy</a>). We don&#8217;t plan to stop here though — look out for more advanced features over the coming months!</p>
<p style="text-align: left;">For some high-profile examples of our graphs in the wild, check out the fascinating <a href="http://www.guardian.co.uk/datablog">Guardian Data Blog</a>:</p>
<p style="text-align: left;"><a href="http://www.guardian.co.uk/news/datablog/2009/mar/01/government-borrowing-economy1">http://www.guardian.co.uk/news/datablog/2009/mar/01/government-borrowing-economy1</a></p>
<p style="text-align: left;"><a href="http://www.guardian.co.uk/news/datablog/2009/mar/02/unemployment-and-employment-statistics-economics">http://www.guardian.co.uk/news/datablog/2009/mar/02/unemployment-and-employment-statistics-economics</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.timetric.com/2009/06/easier-embedding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>API tokens for Timetric</title>
		<link>http://blog.timetric.com/2009/06/api-tokens-for-timetric/</link>
		<comments>http://blog.timetric.com/2009/06/api-tokens-for-timetric/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 18:37:06 +0000</pubDate>
		<dc:creator>toby</dc:creator>
				<category><![CDATA[api]]></category>
		<category><![CDATA[infrastructure]]></category>

		<guid isPermaLink="false">http://blog.timetric.com/?p=135</guid>
		<description><![CDATA[With the newest release of our API, we&#8217;ve launched a feature to make life easier for developers — API tokens.
From the beginning, we&#8217;ve been focussed as much on the developer experience as the user experience, and so our API has been the focus of just as much TLC as the website. One unavoidable issue in using any web [...]]]></description>
			<content:encoded><![CDATA[<p>With the newest release of our <a href="http://timetric.com/help/httpapi">API</a>, we&#8217;ve launched a feature to make life easier for developers — API tokens.</p>
<p>From the beginning, we&#8217;ve been focussed as much on the developer experience as the user experience, and so our API has been the focus of just as much <abbr title="tender loving care">TLC</abbr> as the website. One unavoidable issue in using any web API is dealing with authentication, and it&#8217;s especially hard to deal with it in a way that simultaneously satisfies</p>
<ul>
<li>security concerns</li>
<li>ease-of-use for the developer</li>
<li>ease-of-use for the end-user of any third-party apps.</li>
</ul>
<p>At launch, we supported <a href="http://oauth.net">OAuth</a>, which is a relatively new standard, designed for web services. It tries to solve all three of these problems, particularly with respect to letting end-users use third-party applications safely.</p>
<p>However, OAuth can be quite complex for developers to get started with. And in particular, if you&#8217;re just trying to write scripts to experiment with, for your own use, there&#8217;s an awful lot of hoops to jump through, even in understanding the <a href="http://oauth.net/core/diagram.png" rel="lightbox[135]">basic OAuth workflow</a>.</p>
<p>We also allowed developers to fallback to using their username and password over <a href="http://tools.ietf.org/html/rfc2617">HTTP Basic Auth</a> — but with strong caveats around it. Using your login credentials for this sort of purpose is a very bad idea. </p>
<p>Basic Auth (over http, rather than https) has almost no security &#8211; it&#8217;s easy to sniff over insecure connections. And when using login credentials for anything except logging in through a web-browser, you have to leave your password lying around embedded in scripts, or give it to applications, either of which makes it prone to leakage, whether by accidental loss, or by deliberate attempts to steal.</p>
<p>Worse, you can&#8217;t revoke your login credentials easily; once someone has stolen them, the only way to prevent them being used is to change your password — and worse still even that that, since they are your primary login credentials, any attacker can change your password before you do, thus completely denying you access to your account.</p>
<p>So, we&#8217;ve made a new authentication scheme publically available. This is designed to be much easier for developers to get going with. Our API tokens still use Basic Auth — despite its drawbacks, it&#8217;s got two major advantages over OAuth</p>
<ul>
<li>it&#8217;s supported by almost every http library out there. Whatever your favourite programming language, chances are its http libraries do HTTP Basic already. (This even includes shell script &#8211; <a href="http://curl.haxx.se">curl</a> supports Basic Auth out of the box, see below!)
  </li>
<li>it involves a single set of credentials which are basically stateless; unlike OAuth you don&#8217;t have to worry about going through a dance to set up your tokens.</li>
</ul>
<p>Essentially, our API tokens can be used as replacement username/password combinations for certain, limited, operations. You can leave these embedded in scripts, or pass them to applications without fear of the consequences; they can&#8217;t be used to change your login password, and they are easily revoked if they do leak out.</p>
<p>Our help pages have proper documentation, both on how to <a href="http://timetric.com/help/external_applications/#granting-permission-with-api-toke">generate API tokens</a> and how to <a href="http://timetric.com/help/authentication/#api-tokens">use them</a>, but here&#8217;s a quick overview. To create an API token, you go to your <a href="http://timetric.com/settings/#apps">settings page</a>, where you&#8217;ll see this:</p>
<p><img src="http://blog.timetric.com/wp-content/uploads/2009/06/apitoken_before.png" alt="apitoken_before" title="apitoken_before" width="550" class="alignnone size-full wp-image-137" /></p>
<p>If you follow the &#8220;Create new&#8221; link, you&#8217;ll be prompted for a name for the API token (here, I&#8217;ll call it &#8220;shell script&#8221;, since I&#8217;m going to use it with a shell script). </p>
<p> <br />
<img src="http://blog.timetric.com/wp-content/uploads/2009/06/apitoken_name.png" alt="apitoken_name" title="apitoken_name" width="550" class="alignnone size-full wp-image-139" /></p>
<p>And after you&#8217;ve created it, the API token will appear in the list on the page.</p>
<p><img src="http://blog.timetric.com/wp-content/uploads/2009/06/apitoken_got.png" alt="apitoken_got" title="apitoken_got" width="550" class="alignnone size-full wp-image-138" /></p>
<p>As you can see, your API token consists of a Key and a Secret, to be used like a Username and Password. These can be used for authenticating with your http library.</p>
<p>If you&#8217;re using Python, we&#8217;d recommend <a href="http://code.google.com/p/httplib2/">httplib2</a>. (If you want to restrict yourself to using the Python standard library, see <a href="http://www.voidspace.org.uk/python/articles/authentication.shtml">this article</a>)</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> httplib2
h = httplib2.<span style="color: black;">Http</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
h.<span style="color: black;">add_credentials</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'APITOKEN_KEY'</span>, <span style="color: #483d8b;">'APITOKEN_SECRET'</span><span style="color: black;">&#41;</span>
url = <span style="color: #483d8b;">&quot;https://timetric.com/series/pk6PiWcpTpimhozf0FTjmA/iso.csv&quot;</span>
resp, content = h.<span style="color: black;">request</span><span style="color: black;">&#40;</span>url<span style="color: black;">&#41;</span></pre></div></div>

<p> <br />
And in shell script you would do this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">curl http:<span style="color: #000000; font-weight: bold;">//</span>APITOKEN_KEY:APITOKEN_SECRET<span style="color: #000000; font-weight: bold;">@</span>timetric.com<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>To get you started, there&#8217;s a couple of libraries out there already for talking to timetric using the API tokens. You can use these directly, or as examples for your own scripts.</p>
<p><a href="http://jacobian.org">Jacob Kaplan-Moss</a> published his <a href="http://pypi.python.org/pypi/timetric">timetric library</a> sometime ago, using OAuth. We&#8217;ve adapted it to use API tokens as well; until our patches make their way upstream, you can use <a href="http://github.com/timetric/timetric/">our fork</a>.</p>
<p>I&#8217;ve been playing around with <a href="http://clojure.org">Clojure</a> recently, and my first project has been a library to retrieve data from timetric. You can see it <a href="http://github.com/tow/timetric-clojure">on github</a>, as another example of how to use the API tokens. (But probably not an example of how to write Clojure &#8211; any criticisms of my style are welcome, I&#8217;m only learning!)</p>
<p>But the great advantage of API tokens is that you don&#8217;t really need to go to the hassle of building a whole library or application to query a web service &#8211; sometimes all you want is a script. So here&#8217;s a shellscript which will poll timetric every 60 seconds for the latest value of a given timeseries (in this case, the <a href="http://timetric.com/series/pk6PiWcpTpimhozf0FTjmA/">Euro/Rupee exchange rate</a>).</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">KEY</span>=<span style="color: #ff0000;">&quot;APITOKEN_KEY&quot;</span>
<span style="color: #007800;">SECRET</span>=<span style="color: #ff0000;">&quot;APITOKEN_SECRET&quot;</span>
<span style="color: #007800;">URL</span>=https:<span style="color: #000000; font-weight: bold;">//</span><span style="color: #007800;">$KEY</span>:<span style="color: #007800;">$SECRET</span><span style="color: #000000; font-weight: bold;">@</span>timetric.com<span style="color: #000000; font-weight: bold;">/</span>series<span style="color: #000000; font-weight: bold;">/</span>pk6PiWcpTpimhozf0FTjmA<span style="color: #000000; font-weight: bold;">/</span>value<span style="color: #000000; font-weight: bold;">/</span>json<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #000000;">1</span>; <span style="color: #000000; font-weight: bold;">do</span>
  curl <span style="color: #007800;">$URL</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span>
  <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">60</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>We&#8217;ve found the ability to explore web-services from the command-line like this is invaluable in developing applications on top of them — we&#8217;ve been using these API tokens for some time internally, and we&#8217;re happy we can finally make them available to you.</p>
<p>I&#8217;ll be following this post up shortly with a couple of exciting things we&#8217;ve done in building services on Timetric with API tokens — we&#8217;re looking forward to seeing what the rest of the world does with them.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.timetric.com/2009/06/api-tokens-for-timetric/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
