<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/rss-style.xsl" type="text/xsl"?>
<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>dabr &#8211; Terence Eden’s Blog</title>
	<atom:link href="https://shkspr.mobi/blog/tag/dabr/feed/" rel="self" type="application/rss+xml" />
	<link>https://shkspr.mobi/blog</link>
	<description>Regular nonsense about tech and its effects 🙃</description>
	<lastBuildDate>Fri, 10 Apr 2026 08:26:39 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://shkspr.mobi/blog/wp-content/uploads/2023/07/cropped-avatar-32x32.jpeg</url>
	<title>dabr &#8211; Terence Eden’s Blog</title>
	<link>https://shkspr.mobi/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title><![CDATA[How Twitter Developers Can Combat Abuse]]></title>
		<link>https://shkspr.mobi/blog/2016/04/how-twitter-developers-can-combat-abuse/</link>
					<comments>https://shkspr.mobi/blog/2016/04/how-twitter-developers-can-combat-abuse/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Sun, 10 Apr 2016 08:54:50 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[dabr]]></category>
		<category><![CDATA[twitter]]></category>
		<guid isPermaLink="false">https://shkspr.mobi/blog/?p=22725</guid>

					<description><![CDATA[Here&#039;s a simple step that Twitter App Developers can do to reduce the amount of abuse which is generated on the platform.  A few friends of mine regularly receive harassment on Twitter.  Typically, there are two ways to deal with it:       Mute the offending user.  This means their tweets to you never show up in your replies.     Block the offending user. The same as muting, except the offender…]]></description>
										<content:encoded><![CDATA[<p>Here's a simple step that Twitter App Developers can do to reduce the amount of abuse which is generated on the platform.</p>

<p>A few friends of mine regularly receive harassment on Twitter.  Typically, there are two ways to deal with it:</p>

<ol>
    <li>Mute the offending user.  This means their tweets to you never show up in your replies.</li>
    <li>Block the offending user. The same as muting, except the offender is also prevented from <em>seeing</em> your Tweets while they're logged in.</li>
</ol>

<p>There's a flaw with both of these tactics - the miscreant <strong>can still target messages at you</strong>.</p>

<p>For example, a journalist I know has blocked a particularly persistent griefer.  This sad-sack continually mentions the journalist and repeatedly links to her articles.  This means the abuse appears whenever the journalist searches for people linking to her articles and inevitably, when her followers get drawn in to replying on her behalf.</p>

<p>So, here's a radical solution - if you're blocked by a user, you shouldn't be able to @mention them.</p>

<p>As <a href="https://twittercommunity.com/t/should-blocked-users-be-able-to-the-person-blocking-them/64674">I suggested to Twitter</a></p>

<blockquote>
<p>Alice is blocking Bob.

</p><p>Bob cannot see Alice's Tweets.

</p><p>Bob can still send @ replies to Alice.

</p><p>Should our clients block Bob from sending a Tweet containing an @ reply to Alice?

</p><p>Should the Twitter API block these messages from being sent?</p></blockquote>

<p>Until Twitter gets around to implementing this at the API level, here's a way that app developers can add the functionality.</p>

<h2 id="friendship-api"><a href="https://shkspr.mobi/blog/2016/04/how-twitter-developers-can-combat-abuse/#friendship-api">Friendship API</a></h2>

<p>Using <a href="https://dev.twitter.com/rest/reference/get/friendships/show"><code>GET friendships/show</code></a> we can determine if the logged in user is being blocked by a specific user.</p>

<p>In this example, I (@edent) have blocked the well known troll @monkey.  The app can perform this request every time @monkey attempts to send a tweet containing "@edent".</p>

<pre>https://api.twitter.com/1.1/friendships/show.json?
   source_screen_name=monkey
  &amp;target_screen_name=edent</pre>

<p>In return we get a message showing if the user is being blocked.</p>

<pre lang="json">{
  "relationship": {
    "source": {
      …
      "screen_name": "monkey",
      …
      "blocking": false,
      "blocked_by": true,
      …
    },
    "target": {
      …
      "screen_name": "edent",
      …
    }
  }
}
</pre>

<p>The app can then either refuse to send the message or tell the user why it has been blocked.</p>

<h2 id="drawbacks"><a href="https://shkspr.mobi/blog/2016/04/how-twitter-developers-can-combat-abuse/#drawbacks">Drawbacks</a></h2>

<p>If enough popular apps start doing this, it might act as a small disincentive - letting abusers know that their messages are no longer welcome.</p>

<p>But until Twitter adopt this as the standard for their API, it will be possible for a harasser to simply switch to using the official apps.</p>

<p>The real change, of course, has to come from within.  People have to learn that no means no - if someone chooses to ignore your messages, that's <a href="https://xkcd.com/1357/">not an infringement of your right to free speech</a>.</p>

<p>I'll be implementing this in <a href="https://github.com/edent/Dabr">Dabr</a> over the next week.  I'd be interested to hear from any other developers who make this change.</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=22725&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2016/04/how-twitter-developers-can-combat-abuse/feed/</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[New Year - New Dabr]]></title>
		<link>https://shkspr.mobi/blog/2015/01/new-year-new-dabr/</link>
					<comments>https://shkspr.mobi/blog/2015/01/new-year-new-dabr/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Sun, 04 Jan 2015 11:48:41 +0000</pubDate>
				<category><![CDATA[mobile]]></category>
		<category><![CDATA[dabr]]></category>
		<guid isPermaLink="false">https://shkspr.mobi/blog/?p=20410</guid>

					<description><![CDATA[Way back in 2008, David Carrington created Dabr - a really simple mobile website for accessing Twitter.  Dabr@dabrFact of the month: @dabr is now 5 years old! Born in August 2008 when @davidcarrington was inspired by @Whatleydude.❤️ 7💬 10🔁 013:59 - Mon 16 September 2013  In those days, Twitter had a kick-arse API and were happy for people to build exciting new services on it.  I was eager to contr…]]></description>
										<content:encoded><![CDATA[<p>Way back in 2008, David Carrington created Dabr - a really simple mobile website for accessing Twitter.</p>

<blockquote class="social-embed" id="social-embed-379605424255041537" lang="en" itemscope="" itemtype="https://schema.org/SocialMediaPosting"><header class="social-embed-header" itemprop="author" itemscope="" itemtype="https://schema.org/Person"><a href="https://twitter.com/dabr" class="social-embed-user" itemprop="url"><img class="social-embed-avatar social-embed-avatar-circle" src="data:image/webp;base64,UklGRpQDAABXRUJQVlA4WAoAAAAQAAAALwAALwAAQUxQSH4BAAABkATbtmk7+9u2bdu2bcS2bTvp2bZt27ZtO7txzrnvZkfdiJgA+C/XGXH2eD9zOVSN7b1C4lNTU1M8pCnNR0S81UCgae2dVNtt7NzNR288fPXpJ7IfFxtK8fnOIG70U/VtNnn3xec/Uc4ZUjJR+PbUV5T/taWE4G+CX1wvQfMqjXUSYDqNtw48s967n9PAZhznK0h2FWc+0n1szlwjhBnMYUqDmSaUNjEwnNAdPQZyLpL54MkBo/NUMJcHq8j0FUwls4YXdo/MNX0m5iGS/eQOAAmvkXAagPkDpNwcoBRJDyO3AsDiPqljygAxJyndMwcA9cIN38h88QNu0GUqmMWDIWTaC6K/UhkvsHlOZRVPdwNSPctRmo1kn3J8vtO5zolBBT8+u3Ph6JaFk/q0LKp6o0hbjsk90c+BBUkBLlaGaiBsIunTvgbAz3wm2AiKzxK8397JCyQ6VJ1kvkfKoLcXEZ+vbuoMiiZ+RMRJIKd24wHVViBnzKzlTVRl+ecFVlA4IPABAAAQCwCdASowADAAPrFKnUmnJKKhLjv8yOAWCWgAwP1zdl/EVod5U7AvSoNKHggCoZDsvanR2XbicAobbxuJA2ZALfnv1hNkUk6CPHhQoNgUk5K+vuiDaTxHeBYbg5SprBgAAP7wfDfn2oZqcjxo5A7URlPN/aklvWUDpETW/agrC2KdqTIz0UvmjGdLbeO/g7xbme3aYALvOAqzZepBDp1kTQlgHixJTn+5gE7L3VAPnc7w7Ykpgxcf8u/g5+9w43Ce6+Fu9C1fV+5wYeX71CzcZR9iYlBISMGVf1kpTwXeszD9Nikoy9miGV+8SatJL+mdHFDXI9235TxEsvlk4qdLTnbYa+++/N95YdiCR/bsqydXdPoSobb64nZs2ps7iPeneN54Q50VXMMbmHwHBpnz5/4sHR5O0VrbVxue60iy6RUneCJwzXhLWbZxDmAXs6XRvrIJYZKKmT+ft2fmd/s5MU/H+phzcT935kSXc/zkSX35Ilvno/yj2SC5917ZU1pq/aOj4LCC4wXFsp0woUpIUjo3Rncbap+BrWHtKy64IxWOZNN3ttPvH3pXY4JjKSrBzYUZm/MfUXGlohEd7r1aGU+NeF7HxQHovKn9vy+4cLWr+k221QN23hbvw1xe1X/uv/2xeruBgugFeTdEpAAA" alt="" itemprop="image"><div class="social-embed-user-names"><p class="social-embed-user-names-name" itemprop="name">Dabr</p>@dabr</div></a><img class="social-embed-logo" alt="Twitter" src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%0Aaria-label%3D%22Twitter%22%20role%3D%22img%22%0AviewBox%3D%220%200%20512%20512%22%3E%3Cpath%0Ad%3D%22m0%200H512V512H0%22%0Afill%3D%22%23fff%22%2F%3E%3Cpath%20fill%3D%22%231d9bf0%22%20d%3D%22m458%20140q-23%2010-45%2012%2025-15%2034-43-24%2014-50%2019a79%2079%200%2000-135%2072q-101-7-163-83a80%2080%200%200024%20106q-17%200-36-10s-3%2062%2064%2079q-19%205-36%201s15%2053%2074%2055q-50%2040-117%2033a224%20224%200%2000346-200q23-16%2040-41%22%2F%3E%3C%2Fsvg%3E"></header><section class="social-embed-text" itemprop="articleBody">Fact of the month: <a href="https://twitter.com/dabr">@dabr</a> is now 5 years old! Born in August 2008 when <a href="https://twitter.com/davidcarrington">@davidcarrington</a> was inspired by <a href="https://twitter.com/Whatleydude">@Whatleydude</a>.</section><hr class="social-embed-hr"><footer class="social-embed-footer"><a href="https://twitter.com/dabr/status/379605424255041537"><span aria-label="7 likes" class="social-embed-meta">❤️ 7</span><span aria-label="10 replies" class="social-embed-meta">💬 10</span><span aria-label="0 reposts" class="social-embed-meta">🔁 0</span><time datetime="2013-09-16T13:59:20.000Z" itemprop="datePublished">13:59 - Mon 16 September 2013</time></a></footer></blockquote>

<p>In those days, Twitter had a kick-arse API and were happy for people to build exciting new services on it.  I was eager to contribute and got stuck in to improving it.</p>

<p>Dabr was fast - much faster than the original mobile Twitter site.  It had hashtag searching, reply-to-all, thumbnail previews of links, Twitpic integration, and a whole bunch of other interesting features.  It was used by <a href="https://shkspr.mobi/blog/2011/06/dabr-helps-ai-weiwei/" title="Dabr Helps Ai Weiwei!">Chinese political dissidents</a> to get around the Great Firewall, and <a href="https://shkspr.mobi/blog/2011/03/dabr-dabr-everywhere/">some of the most popular Twitter users</a>.</p>

<p>But, over the last few years, the project stagnated.  Partly because Twitter didn't really release anything new with its API, partly because Dabr was complete.  It did everything it was supposed to, and ran quite happily.  The <a href="https://code.google.com/p/dabr/source/list">last significant code update was in 2013</a>.  Sure, there were a few bugs hanging around, but no one really had the motivation to do much about it.</p>

<p>Until now.</p>

<p>I thought it'd be a fun(!) Xmas project to resurrect Dabr, give the code-base a spring clean, a new lick of paint, squash some bugs, and improve the functionality.  So I did.</p>

<p>You can log in to <a href="https://dabr.eu/">https://dabr.eu/</a> for the latest and greatest version.  All the <a href="https://github.com/edent/Dabr">Dabr code is Open Source on GitHub</a> - please raise bug reports there, and feel free to send pull requests.
<a href="https://dabr.eu/"><img src="https://shkspr.mobi/blog/wp-content/uploads/2015/01/Dabr-Previews.png" alt="Dabr Previews" width="1024" height="629" class="aligncenter size-full wp-image-20411"></a></p>

<h2 id="whats-new"><a href="https://shkspr.mobi/blog/2015/01/new-year-new-dabr/#whats-new">What's New</a></h2>

<p>This is a fairly comprehensive list of all the improvements.</p>

<ul>
    <li>Image upload.</li>
    <li>Menus now use CSS fonts from <a href="http://fontello.com/">Fontello</a>. Looks nicer &amp; faster to download.</li>
    <li>Much better pagination support.</li>
    <li>Twitter API via <a href="https://github.com/jublonet/codebird-php">CodeBird</a>.</li>
    <li>Better embedding thanks to <a href="https://web.archive.org/web/20150105035208/https://embedkit.com/">EmbedKit</a>.</li>
    <li>Layout changes &amp; improvements.</li>
    <li>Cleaner HTML. Should be lighter to download.</li>
    <li>More options, including a new colour theme.</li>
    <li>Better accessibility (Thanks <a href="http://pigsonthewing.org.uk/">Andy</a>!)</li>
    <li>JavaScript only used for character counter - nothing else.</li>
    <li>HTTP Status messages display useful information.</li>
    <li>...lots more bug fixes :-)</li>
</ul>

<h3 id="to-do"><a href="https://shkspr.mobi/blog/2015/01/new-year-new-dabr/#to-do">To Do</a></h3>

<p>There are still some kinks to work out.  Feel free to <a href="https://github.com/edent/Dabr/issues">add to the issues list</a> or submit some code.</p>

<ul>
    <li>Hashtag linking is still dodgy - and doesn't work in bios.</li>
    <li>Lists aren't available. Does anyone use them?</li>
    <li>Image sending in Direct Messages doesn't work.</li>
    <li>Conversation threading (made harder by lack of API).</li>
    <li>Counter doesn't recognise URLs - gives misleading character count.</li>
    <li>Translation text files.  Currently everything is inline.</li>
    <li>Better 404 handling.</li>
    <li>General slimming down of HTML and CSS.</li>
</ul>

<p>If you want to experience the new Dabr, point your phone, tablet, or desktop browser at <a href="https://dabr.eu/">https://dabr.eu/</a>.</p>

<p>Dabr is designed to be simple to deploy on your own website. Visit <a href="https://github.com/edent/Dabr">Dabr on GitHub</a> to find out more.</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=20410&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2015/01/new-year-new-dabr/feed/</wfw:commentRss>
			<slash:comments>11</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[Dabr Helps Ai Weiwei!]]></title>
		<link>https://shkspr.mobi/blog/2011/06/dabr-helps-ai-weiwei/</link>
					<comments>https://shkspr.mobi/blog/2011/06/dabr-helps-ai-weiwei/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Thu, 23 Jun 2011 09:38:02 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[ai weiwei]]></category>
		<category><![CDATA[china]]></category>
		<category><![CDATA[dabr]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=4212</guid>

					<description><![CDATA[I&#039;ve written before about Dabr, the Twitter client I code for.  Dabr helps people around the world and is used by some of Twitter&#039;s most influential users.  Today, I am pleased to announce that Chinese artist, political prisoner, and sower of porcelain sunflower seed, Ai Weiwei uses dabr!  On last night&#039;s Newsnight, as part of a package on Ai Weiwei&#039;s release, they showed him using Twitter. …]]></description>
										<content:encoded><![CDATA[<p>I've written before about <a href="http://code.google.com/p/dabr/">Dabr</a>, the Twitter client I code for.  Dabr helps people around the world and is used by some of <a href="https://shkspr.mobi/blog/2011/03/dabr-dabr-everywhere/">Twitter's most influential users</a>.</p>

<p>Today, I am pleased to announce that Chinese artist, political prisoner, and sower of porcelain sunflower seed, <strong><a href="http://en.wikipedia.org/wiki/Ai_Weiwei">Ai Weiwei</a> uses dabr!</strong></p>

<p>On <a href="http://www.bbc.co.uk/iplayer/episode/b0125h2m/Newsnight_22_06_2011/">last night's Newsnight</a>, as part of a package on Ai Weiwei's release, they showed him using Twitter.  Here's a screenshot.
</p><div id="attachment_4213" style="width: 310px" class="wp-caption aligncenter"><a href="https://shkspr.mobi/blog/wp-content/uploads/2011/06/ai-weiwei-dabr-screenshot-large.jpg"><img aria-describedby="caption-attachment-4213" src="https://shkspr.mobi/blog/wp-content/uploads/2011/06/ai-weiwei-dabr-screenshot-large-300x180.jpg" alt="ai weiwei dabr screenshot large" title="ai weiwei dabr screenshot large" width="300" height="180" class="size-medium wp-image-4213"></a><p id="caption-attachment-4213" class="wp-caption-text">Click for larger image</p></div>
That's Dabr! I'd recognise the orange colour scheme anywhere!  It looks like he's using one of the many hundreds of installs of Dabr - this one looks like it has been localised to Chinese.<p></p>

<p>One interesting thing, none of the user's avatars appear.  That's because, at a guess, the images are retrieved from Twitter's servers which are blocked by the <a href="http://en.wikipedia.org/wiki/Golden_Shield_Project">Great Firewall of China</a>.</p>

<p>Indeed, if we zoom in on the text we can see the letters "GFW".
<img src="https://shkspr.mobi/blog/wp-content/uploads/2011/06/ai-weiwei-dabr-GFW.jpg" alt="ai weiwei dabr GFW" title="ai weiwei dabr GFW" width="271" height="153" class="aligncenter size-full wp-image-4214">
My Mandarin is too rusty to translate the rest - can anyone else help?</p>

<p>So, looks like my next addition to Dabr will be to use an image proxy to ensure avatar images make it through China's firewall!</p>

<p>Thanks to <a href="http://twitter.com/Kristiansblog ">Kristian Carter</a> for alerting me.</p>

<p><a href="https://twitter.com/kristiancarter/status/83659275024601088"><img src="https://shkspr.mobi/blog/wp-content/uploads/2011/06/aiweiwei.png" alt="Ai Weiwei uses @dabr! #Newsnight" width="558" height="175" class="aligncenter size-full wp-image-51339"></a></p>

<p>Awesome!</p>

<iframe title="Ai WeiWei Using Dabr" width="620" height="349" src="https://www.youtube.com/embed/AFdciadSMbk?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen=""></iframe>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=4212&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2011/06/dabr-helps-ai-weiwei/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[Displaying Twitter Photos via Entities]]></title>
		<link>https://shkspr.mobi/blog/2011/06/displaying-twitter-photos-via-entities/</link>
					<comments>https://shkspr.mobi/blog/2011/06/displaying-twitter-photos-via-entities/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Fri, 03 Jun 2011 15:43:19 +0000</pubDate>
				<category><![CDATA[mobile]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[dabr]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[twitter]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=4150</guid>

					<description><![CDATA[Twitter has announced that it will soon open up a native photo sharing service.  Rather than using an external service like Embed.ly to retrieve thumbnails, all the data is embedded within Twitter Entities.  So, if you request a status using &#34;include_entities=true&#34;, you will be able to grab the image and display the thumbnail using the following code.  function twitter_get_media($status) {   …]]></description>
										<content:encoded><![CDATA[<p>Twitter has announced that it will soon open up a <a href="http://groups.google.com/group/twitter-development-talk/browse_thread/thread/99b451ce5d8259ce#">native photo sharing service</a>.</p>

<p>Rather than using an external service like Embed.ly to retrieve thumbnails, all the data is embedded within <a href="https://web.archive.org/web/20110611123536/http://dev.twitter.com/pages/tweet_entities">Twitter Entities</a>.</p>

<p>So, if you request a status using "<em>include_entities=true</em>", you will be able to grab the image and display the thumbnail using the following code.</p>

<pre><code class="language-php">function twitter_get_media($status) {
   if($status-&gt;entities-&gt;media) {

      $url = $status-&gt;entities-&gt;media[0]-&gt;media_url_https;

      $width = $status-&gt;entities-&gt;media[0]-&gt;sizes-&gt;thumb-&gt;w;
      $height = $status-&gt;entities-&gt;media[0]-&gt;sizes-&gt;thumb-&gt;h;

      $media_html = "&lt;a href="" . $url . "" target='_blank'&gt;";
      $media_html .=  "&lt;img src="" . $url . ":thumb" width="" . $width .
         "" height="" . $height . "" /&gt;";
      $media_html .= "&lt;/a&gt;&lt;br /&gt;";

      return $media_html;
   }
}
</code></pre>

<p>So, a tweet like this:
<a href="https://web.archive.org/web/20181224040939/https://twitter.com/twitter/status/76360760606986241">https://twitter.com/twitter/status/76360760606986241</a>
Will render like this (in Dabr):
<img src="https://shkspr.mobi/blog/wp-content/uploads/2011/06/Twitter-Dabr-Images.jpg" alt="Twitter Dabr Images" title="Twitter Dabr Images" width="317" height="528" class="aligncenter size-full wp-image-4154"></p>

<h2 id="notes"><a href="https://shkspr.mobi/blog/2011/06/displaying-twitter-photos-via-entities/#notes">Notes</a></h2>

<p>This is very rough and ready proof of concept code.  Beware of the following:</p>

<ul>
    <li>This will only take the first image from the tweet.</li>
    <li>Only images are supported - I'm not sure how their proposed video sharing will work.</li>
    <li>There's no error checking.</li>
    <li>In the above code, the https URL is used - if you want a non-SSL link, you'll need to remove the "_https"</li>
</ul>

<p>Enjoy!</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=4150&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2011/06/displaying-twitter-photos-via-entities/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[Dabr, Dabr, Everywhere...]]></title>
		<link>https://shkspr.mobi/blog/2011/03/dabr-dabr-everywhere/</link>
					<comments>https://shkspr.mobi/blog/2011/03/dabr-dabr-everywhere/#respond</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Fri, 25 Mar 2011 11:30:35 +0000</pubDate>
				<category><![CDATA[mobile]]></category>
		<category><![CDATA[dabr]]></category>
		<category><![CDATA[twitter]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=3763</guid>

					<description><![CDATA[I contribute code to Dabr - a mobile twitter client.  It&#039;s a great project to keep my hand in the world of PHP, APIs, SVN, and all the other tools that are essential to the modern online world.  Dabr&#039;s strength for developers is two-fold       Dead easy to install.  Unzip the files, fill in your API key(s), upload, done.     It&#039;s under an incredibly permissive Open Source MIT License. Essentially …]]></description>
										<content:encoded><![CDATA[<p>I contribute code to<a href="http://code.google.com/p/dabr/"> Dabr - a mobile twitter client</a>.  It's a great project to keep my hand in the world of PHP, APIs, SVN, and all the other tools that are essential to the modern online world.</p>

<p>Dabr's strength for developers is two-fold</p>

<ol>
    <li>Dead easy to install.  Unzip the files, fill in your API key(s), upload, done.</li>
    <li>It's under an incredibly permissive Open Source <a href="http://www.opensource.org/licenses/mit-license.php">MIT License</a>. Essentially anyone can do anything with the code and they don't need to ask permission, nor contribute anything back to the code base.</li>
</ol>

<p>It's a really popular tool.  Although it's hard to count how many users are on the main Dabr server - not to mention all the clones - it's obvious that many people find it an indispensable way to access Twitter.</p>

<p>According to the New York Times, <a href="http://6thfloor.blogs.nytimes.com/2011/03/24/a-better-way-to-measure-twitter-influence/">Rafinha Bastos is the most influential person on Twitter</a>.  Guess what client he uses?
<img src="https://shkspr.mobi/blog/wp-content/uploads/2011/03/rafinhabastos-uses-Dabr.jpg" alt="rafinhabastos uses Dabr" title="rafinhabastos uses Dabr" width="345" height="769" class="aligncenter size-full wp-image-3772">
<span id="more-3763"></span>
So, with a kick-arse product and no silly "Intellectual Property" restrictions, we have let a thousand flowers bloom. There are clients deployed all over the world.  Including on my secure server - <a href="https://web.archive.org/web/20110628102418/https://shkspr.mobi/dabr/">SSL Dabr</a>.  And here's one more...</p>

<h2 id="welcome-ubersocial"><a href="https://shkspr.mobi/blog/2011/03/dabr-dabr-everywhere/#welcome-ubersocial">Welcome UberSocial!</a></h2>

<p>The most recent flower is <a href="http://www.ubersocial.com/">UberSocial</a>. As well as having the most popular BlackBerry Twitter client, and an iPhone client - they've now beta-launched a <a href="https://web.archive.org/web/20110325001805/https://m.ubersocial.com/">mobile web client</a> - based on Dabr!</p>

<p><img class="alignleft size-full wp-image-3764" title="munch_2011_03_24_153355" src="https://shkspr.mobi/blog/wp-content/uploads/2011/03/munch_2011_03_24_153355.jpg" alt="UberSocial Dabr" width="252" height="336"><img class="alignright size-full wp-image-3765" title="munch_2011_03_24_153106" src="https://shkspr.mobi/blog/wp-content/uploads/2011/03/munch_2011_03_24_153106.jpg" alt="UberSocial Dabr" width="252" height="336"></p>

<div style="clear: both">
It looks like UberSocial are running a slightly out of date version of the code - but I'm sure they'll be up to the latest version shortly.
</div>

<p>I'm really excited to see Dabr spreading far and wide.  The intention - for me - has never been to make pots of money from it.  The adverts on SSL Dabr just about cover the hosting costs.</p>

<p>What I like seeing is my code being used far and wide - and helping people.  I know it's corny, but seeing my code being used by Twitter users in Egypt during the uprising was overwhelming.  In a tiny, almost insignificant way, I helped.</p>

<p>I don't think my coding is good enough to get something into a really important project - like <a href="http://www.kernel.org/">the Linux Kernel</a>, or <a href="http://spaceflight.nasa.gov/">the International Space Station</a> - but seeing millions of users is personally edifying.</p>

<p>So, long live Open Source and long live Dabr!</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=3763&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2011/03/dabr-dabr-everywhere/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[Getting Images from a Foursquare Checkin]]></title>
		<link>https://shkspr.mobi/blog/2011/03/getting-images-from-a-foursquare-checkin/</link>
					<comments>https://shkspr.mobi/blog/2011/03/getting-images-from-a-foursquare-checkin/#respond</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Tue, 15 Mar 2011 12:35:22 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[4SQ]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[bit.ly]]></category>
		<category><![CDATA[dabr]]></category>
		<category><![CDATA[FourSquare]]></category>
		<category><![CDATA[programming]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=3749</guid>

					<description><![CDATA[&#34;Oi!&#34; shouted Whatleydude, &#34;Get Dabr to show images from foursquare checkins!&#34; &#34;Righty-ho sir!&#34; I said.  I started coding furiously.  Of course, things are never quite as simple as I first thought....  So, how do we go from http://4sq.com/fgIWov to   1 Expand the URL  Get your Bit.ly API Key.  http://api.bitly.com/v3/expand    ?shortUrl=http://4sq.com/fgIWov    &#38;login=YOUR_BIT_LY_USERNAME   …]]></description>
										<content:encoded><![CDATA[<p>"Oi!" shouted <a href="http://whatleydude.com/">Whatleydude</a>, "Get Dabr to show images from foursquare checkins!"
"Righty-ho sir!" I said.  I started coding furiously.  Of course, things are never quite as simple as I first thought....</p>

<p>So, how do we go from <a href="http://4sq.com/fgIWov">http://4sq.com/fgIWov</a>
to
<img src="https://shkspr.mobi/blog/wp-content/uploads/2011/03/4sq.jpg" alt="Photo of a MacBook. The decal sticker is of Iron Man. His hand blaster is replaced with the Apple logo." width="236" height="329" class="aligncenter size-full wp-image-47785"></p>

<h2 id="1-expand-the-url"><a href="https://shkspr.mobi/blog/2011/03/getting-images-from-a-foursquare-checkin/#1-expand-the-url">1 Expand the URL</a></h2>

<p>Get your <a href="http://bit.ly/a/your_api_key/">Bit.ly API Key</a>.</p>

<pre>http://api.bitly.com/v3/expand
   ?shortUrl=http://4sq.com/fgIWov
   &amp;login=YOUR_BIT_LY_USERNAME
   &amp;apiKey=YOUR_BIT_LY_API_KEY
   &amp;format=txt
</pre>

<p>You can, if you prefer, get the info back in JSON or XML. See the <a href="http://code.google.com/p/bitly-api/wiki/ApiDocumentation#/v3/expand">Bit.ly API Expand Documentation</a>.</p>

<h2 id="2-the-foursquare-url"><a href="https://shkspr.mobi/blog/2011/03/getting-images-from-a-foursquare-checkin/#2-the-foursquare-url">2 The Foursquare URL</a></h2>

<p>Bit.ly gives us the URL which includes a checkin ID and a signature.</p>

<pre>http://foursquare.com/edent/checkin/4d7e5b4f9df3f04d7400c394
   ?s=afH3jJg3L9HpLqVIwiqp-YpNL5k
</pre>

<h2 id="3-the-foursquare-api-call"><a href="https://shkspr.mobi/blog/2011/03/getting-images-from-a-foursquare-checkin/#3-the-foursquare-api-call">3 The Foursquare API Call</a></h2>

<p>From this, we construct an API call to Foursquare.  It looks like this</p>

<pre>https://api.foursquare.com/v2/checkins/4d7e5b4f9df3f04d7400c394
   ?signature=afH3jJg3L9HpLqVIwiqp-YpNL5k
   &amp;oauth_token=YOUR_FOURSQUARE_OAUTH_TOKEN
</pre>

<p><strong>NOTE</strong> the Foursquare URL says <em>?s=</em> whereas the API call requires <em>?signature=</em>
That caused me more frustration than it should...</p>

<p>Getting your OAuth token is a little cumbersome - follow the steps at the <a href="http://developer.foursquare.com/docs/oauth.html">Foursquare Developers site</a>.</p>

<h2 id="4-the-json-response"><a href="https://shkspr.mobi/blog/2011/03/getting-images-from-a-foursquare-checkin/#4-the-json-response">4 The JSON Response</a></h2>

<p>I'll cut the cruft out of here, so you only see what you need to display images.
The response gives us the link to the full sized image - as well as several different sizes should you wish to display thumbnails.</p>

<pre lang="json">{
  "meta":{
     "code":200
  },
  "response":{
     "checkin":{
        },
   ...
   "photos":{
      "count":1,
      "items":[
         {
            "id":"4d7e5b4f9df3f04d7400c394",
            "createdAt":1300184596,
            "url":"http://playfoursquare.s3.amazonaws.com/pix/A.jpg",
            "sizes":{
               "count":4,
               "items":[
                  {
                     "url":"http://playfoursquare.s3.amazonaws.com/pix/B.jpg",
                     "width":720,"height":540
                  },
                  {
                     "url":"http://playfoursquare.s3.amazonaws.com/derived_pix/C.jpg",
                     "width":300,"height":300
                  },
                  {
                     "url":"http://playfoursquare.s3.amazonaws.com/derived_pix/D.jpg",
                     "width":100,"height":100
                  },
                  {
                     "url":"http://playfoursquare.s3.amazonaws.com/derived_pix/E.jpg",
                     "width":36,
                     "height":36
                  }
               ]
            },
</pre>

<h2 id="5-gotchas"><a href="https://shkspr.mobi/blog/2011/03/getting-images-from-a-foursquare-checkin/#5-gotchas">5 Gotchas</a></h2>

<p>Again, nothing in life is easy.  Not all foursquare checkins have an image associated with them.  In which case, we can do one of three things.</p>

<ol>
    <li>Display no image</li>
    <li>Display the user's avatar - if it's public</li>
    <li>Display an image of the venue - or one of the icons associated with it.</li>
</ol>

<h2 id="6-embed-ly"><a href="https://shkspr.mobi/blog/2011/03/getting-images-from-a-foursquare-checkin/#6-embed-ly">6 Embed.ly</a></h2>

<p>Dabr uses the <a href="http://embed.ly/">awesome Embedly service</a>.  Rather than having hundreds of different regular expressions and API calls to get embedded images, Embed.ly gives us a single end point to call.
So, rather than rewrite huge chunks of Dabr's code, I've submitted this to the clever-clogs behind Embed.ly - that way, everyone can benefit.</p>

<p>Any questions, comments, or clarifications - please let me know in the comments box.</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=3749&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2011/03/getting-images-from-a-foursquare-checkin/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[Twitter API - pagination and IDs]]></title>
		<link>https://shkspr.mobi/blog/2010/06/twitter-api-pagination-and-ids/</link>
					<comments>https://shkspr.mobi/blog/2010/06/twitter-api-pagination-and-ids/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Sun, 27 Jun 2010 07:54:36 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[dabr]]></category>
		<category><![CDATA[twitter]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=2121</guid>

					<description><![CDATA[Looking for some Twitter API help.  Bit of a geeky post, this...  Pagination is the act of splitting data into logical  pages. Suppose I had a list of item, numbered 0 - 99.  If I want 20 items per page, it&#039;s trivial to see that pagination looks like:  p1 = 0-19 p2 = 20-40 p3 = 41-61 p4 = 62-82 p5 = 83-99   If I wanted to start at, say, page 55 - pagination would look like:  p1 = 55-75 p2 = 76-96 …]]></description>
										<content:encoded><![CDATA[<p>Looking for some Twitter API help.&nbsp; Bit of a geeky post, this...</p>

<p>Pagination is the act of splitting data into logical&nbsp; pages. Suppose I had a list of item, numbered 0 - 99.&nbsp; If I want 20 items per page, it's trivial to see that pagination looks like:</p>

<pre>p1 = 0-19
p2 = 20-40
p3 = 41-61
p4 = 62-82
p5 = 83-99
</pre>

<p>If I wanted to start at, say, page 55 - pagination would look like:</p>

<pre>p1 = 55-75
p2 = 76-96
p3 = 97-99</pre>

<p>Easy, right?&nbsp; So why am I telling you this?</p>

<h2 id="twitter-timeline"><a href="https://shkspr.mobi/blog/2010/06/twitter-api-pagination-and-ids/#twitter-timeline">Twitter Timeline</a></h2>

<p>Imagine that those items are Twitter Status ID.&nbsp; Each one represents a tweet in your timeline.</p>

<p>Twitter will allow us to "page" back and forth through our timeline. If we say status ID 80 is the most recent post in our timeline, and we want to see 20 tweets at a time, pagination would look like this.</p>

<pre>p1 = 80-60
p2 = 60-40
... etc.</pre>

<p>Normally, that would be fine.</p>

<p>The only issue is that friends are posting <em>all the time</em>.&nbsp; Imagine we start with tweets 80-60.&nbsp; We go to page 2, but in the meantime, 5 new tweets have been made.</p>

<pre>p1 = 80-60
p2 = 65-45</pre>

<p>The user sees 5 tweets she has already read.&nbsp; Not desirable.</p>

<p>If 20 tweets had been made before clicking on the "next" button, this is what happens.</p>

<pre>p1 = 80-60
p2 = 80-60</pre>

<h2 id="max_id-to-the-rescue-aka-the-easy-bit"><a href="https://shkspr.mobi/blog/2010/06/twitter-api-pagination-and-ids/#max_id-to-the-rescue-aka-the-easy-bit">Max_ID To The Rescue (AKA, the easy bit)</a></h2>

<p>Luckily, Twitter allows us to use a max_id parameter in our API calls.&nbsp; This says "Get the tweets <strong>older</strong> than this number."</p>

<pre>http://api.twitter.com/1/statuses/home_timeline.json?max_id=123465789</pre>

<p>So, using max_id we can ensure that the user never has to read the same tweet twice.&nbsp; Instead of dumbly using pages, we call the specific tweets we want.</p>

<pre><span style="text-decoration: line-through;">p1</span> max_id=80 = 80-60</pre>

<pre><span style="text-decoration: line-through;">p2</span> max_id=60 = 60-40</pre>

<p>Easy!&nbsp; We just use the oldest tweet on the page as the max_id parameter when we call the next page.</p>

<h2 id="looking-to-the-future-aka-where-it-all-goes-horribly-wrong"><a href="https://shkspr.mobi/blog/2010/06/twitter-api-pagination-and-ids/#looking-to-the-future-aka-where-it-all-goes-horribly-wrong">Looking To The Future (AKA, where it all goes horribly wrong)</a></h2>

<p>So far, we've looked at stepping back in time.&nbsp; Seeing older tweets.&nbsp; Suppose we want to see newer tweets?</p>

<p>Twitter provides us with a since_id parameter for API calls.&nbsp; This says "Get the tweets <strong>newer</strong> than this number."</p>

<p>Unfortunately, it doesn't work.&nbsp; Well, it <em>works</em> but not the way I expected it to!</p>

<p>Suppose our user is deep down in her tweets, this is how I would expect since_id to work</p>

<pre>max_id=60&nbsp; = 60-40</pre>

<pre> (So, let's show any more recent tweets)</pre>

<pre>since_id=60 = 80-60</pre>

<p>We see the 20 tweets that occured <em>since</em> the since_id.&nbsp; Right?&nbsp; Wrong!&nbsp; This is what happens?</p>

<pre>max_id=60&nbsp; = 60-40</pre>

<pre>(So, let's show any more recent tweets)</pre>

<pre>since_id=60 = 100-80</pre>

<p><strong>What?</strong></p>

<h2 id="an-explanation"><a href="https://shkspr.mobi/blog/2010/06/twitter-api-pagination-and-ids/#an-explanation">An Explanation</a></h2>

<p>The since_id retrieves tweets <em>starting with the most recent</em>.&nbsp; It stops when it reaches the since_id.</p>

<p>I don't know the max_id that I'm looking for, so I can't call that.</p>

<p>I could call the most recent 200 tweets and look for the 20 I need.&nbsp; That's wasteful in terms of bandwidth and processing - there's also no guarantee that the since_id will be in there.</p>

<p>So, I have a problem.&nbsp; The "Older" link in my Twitter application will work.&nbsp; The "Newer" links won't.</p>

<p>Any suggestions?</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=2121&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2010/06/twitter-api-pagination-and-ids/feed/</wfw:commentRss>
			<slash:comments>11</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[HOWTO: Twitpic and OAuth]]></title>
		<link>https://shkspr.mobi/blog/2010/05/howto-twitpic-and-oauth/</link>
					<comments>https://shkspr.mobi/blog/2010/05/howto-twitpic-and-oauth/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Mon, 31 May 2010 17:07:29 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[dabr]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[twitpic]]></category>
		<category><![CDATA[twitter]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=2084</guid>

					<description><![CDATA[I am no longer confused!  Here is a quick tutorial in how to post images to Twitpic and Twitter when using OAuth.  I&#039;m indebted to Steve Corona of Twitpic, for his help with this.  You can see the full code on Dabr&#039;s Google Code page.  First of all, you&#039;ll need to have enabled OAuth for your Twitter client.  I use Abraham&#039;s excellent OAuth libraries for PHP.  This tutorial assumes you already…]]></description>
										<content:encoded><![CDATA[<p>I am no longer <a href="https://shkspr.mobi/blog/2010/05/twitpic-oauth-im-stuck">confused</a>!  Here is a quick tutorial in how to post images to Twitpic and Twitter when using OAuth.  I'm indebted to <a href="http://twitter.com/stevencorona">Steve Corona of Twitpic</a>, for his help with this.</p>

<p>You can see the full code on <a href="http://code.google.com/p/dabr/source/detail?r=318">Dabr's Google Code page</a>.</p>

<p>First of all, you'll need to have enabled OAuth for your Twitter client.  I use Abraham's excellent <a href="http://github.com/abraham/twitteroauth/tree/master/twitteroauth/">OAuth libraries for PHP</a>.</p>

<p>This tutorial assumes you already have OAuth working.  I'll attempt to explain what I'm doing as I go along - but the code should be pretty readable.</p>

<p>Start by reading the <a href="https://web.archive.org/web/20100522065016/http://dev.twitpic.com/docs/2/upload/">Twitpic API documentation</a>.  You will also need to register for an API key - this only takes a few seconds.</p>

<p>We start by setting CURL's headers to those required by Twitpic</p>

<pre><code class="language-php">//Has the user submitted an image and message?
if ($_POST['message'])
{
    $twitpicURL = 'http://api.twitpic.com/2/upload.json';

    //Set the initial headers
    $header = array(
                            'X-Auth-Service-Provider: https://api.twitter.com/1/account/verify_credentials.json',
                            'X-Verify-Credentials-Authorization: OAuth realm="http://api.twitter.com/"'
                        );
</code></pre>

<p>Next, we create the OAuth credentials that we need.  Essentially, we're signing a URL request. We then pass that on to Twitpic and they verify it with Twitter.  We <em>never</em> pass our OAUTH_CONSUMER_SECRET - so Twitpic can't impersonate us.</p>

<pre><code class="language-php">    //Using Abraham's OAuth library
    require_once('OAuth.php');

    // instantiating OAuth customer
    $consumer = new OAuthConsumer(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET);

    // instantiating signer
    $sha1_method = new OAuthSignatureMethod_HMAC_SHA1();

    // user's token
    list($oauth_token, $oauth_token_secret) = explode('|', $GLOBALS['user']['password']);
    $token = new OAuthConsumer($oauth_token, $oauth_token_secret);

    // Generate all the OAuth parameters needed
    $signingURL = 'https://api.twitter.com/1/account/verify_credentials.json';

    $request = OAuthRequest::from_consumer_and_token($consumer, $token, 'GET', $signingURL, array());

    $request-&gt;sign_request($sha1_method, $consumer, $token);
</code></pre>

<p>We add these generated credentials into the header.</p>

<pre><code class="language-php">    $header[1] .= ", oauth_consumer_key=\"" . $request-&gt;get_parameter('oauth_consumer_key') ."\"";
    $header[1] .= ", oauth_signature_method=\"" . $request-&gt;get_parameter('oauth_signature_method') ."\"";
    $header[1] .= ", oauth_token=\"" . $request-&gt;get_parameter('oauth_token') ."\"";
    $header[1] .= ", oauth_timestamp=\"" . $request-&gt;get_parameter('oauth_timestamp') ."\"";
    $header[1] .= ", oauth_nonce=\"" . $request-&gt;get_parameter('oauth_nonce') ."\"";
    $header[1] .= ", oauth_version=\"" . $request-&gt;get_parameter('oauth_version') ."\"";
    $header[1] .= ", oauth_signature=\"" . urlencode($request-&gt;get_parameter('oauth_signature')) ."\"";
</code></pre>

<p>Add everything into CURL</p>

<pre><code class="language-php">    //open connection
    $ch = curl_init();

    //Set paramaters
    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

    //set the url, number of POST vars, POST data
    curl_setopt($ch,CURLOPT_URL,$twitpicURL);
</code></pre>

<p>The data we send to Twitpic (message text, image and key) have to go via POST.</p>

<pre><code class="language-php">    //TwitPic requires the data to be sent as POST
    $media_data = array(
                            'media' =&gt; '@'.$_FILES['media']['tmp_name'],
                          'message' =&gt; ' ' . stripslashes($_POST['message']), //A space is needed because twitpic b0rks if first char is an @
                          'key'=&gt;TWITPIC_API_KEY
                        );

    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch,CURLOPT_POSTFIELDS,$media_data);
</code></pre>

<p>All done, we now send the data to Twitpic.</p>

<pre><code class="language-php">    //execute post
    $result = curl_exec($ch);
    $response_info=curl_getinfo($ch);

    //close connection
    curl_close($ch);
</code></pre>

<p>If this has worked, Twitpic will pass back the URL of the image we posted.  We then need to post the entire message to Twitter ourselves (Twitpic can't do it for us).</p>

<pre><code class="language-php">    if ($response_info['http_code'] == 200) //Success
    {
        //Decode the response
        $json = json_decode($result);
        $id = $json-&gt;id;
        $twitpicURL = $json-&gt;url;
        $text = $json-&gt;text;
        $message = trim($text) . " " . $twitpicURL;
</code></pre>

<p>This next part is specific to Dabr - your client may post things differently.</p>

<pre><code class="language-php">        //Send the user's message to twitter
        $request = API_URL.'statuses/update.json';

        $post_data = array('source' =&gt; 'dabr', 'status' =&gt; $message);
        $status = twitter_process($request, $post_data);

        //Back to the timeline
        twitter_refresh("twitpic/confirm/$id");
    }
</code></pre>

<p>If it didn't work, Twitpic will tell us why.</p>

<pre><code class="language-php">    else
    {
        $content = "&lt;p&gt;Twitpic upload failed. No idea why!&lt;/p&gt;";
        $json = json_decode($result);
        $content .= "&lt;br /&gt;&lt;b&gt;message&lt;/b&gt; " . urlencode($_POST['message']);
        $content .= "&lt;br /&gt;&lt;b&gt;json&lt;/b&gt; " . print_r($json);
        $content .= "&lt;br /&gt;&lt;b&gt;Response&lt;/b&gt; " . print_r($response_info);
        $content .= "&lt;br /&gt;&lt;b&gt;header&lt;/b&gt; " . print_r($header);
        $content .= "&lt;br /&gt;&lt;b&gt;media_data&lt;/b&gt; " . print_r($media_data);
        $content .= "&lt;br /&gt;&lt;b&gt;URL was&lt;/b&gt; " . $twitpicURL;
        $content .= "&lt;br /&gt;&lt;b&gt;File uploaded was&lt;/b&gt; " . $_FILES['media']['tmp_name'];
    }
}
</code></pre>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=2084&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2010/05/howto-twitpic-and-oauth/feed/</wfw:commentRss>
			<slash:comments>25</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[Bugs in Twitter Text Libraries]]></title>
		<link>https://shkspr.mobi/blog/2010/03/bugs-in-twitter-text-libraries/</link>
					<comments>https://shkspr.mobi/blog/2010/03/bugs-in-twitter-text-libraries/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Wed, 31 Mar 2010 10:27:50 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[dabr]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[urls]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=1924</guid>

					<description><![CDATA[The Twitter Engineering Team have a set of text processing classes which are meant to simplify and standardise the recognition of URLs, screen names, and hashtags.  Dabr makes use of them to keep in conformance with Twitter&#039;s style.  One of the advantages of the text processing is that it will recognise that www.example.com is a URL and automatically create a hyperlink. Considering that dropping…]]></description>
										<content:encoded><![CDATA[<p>The <a href="https://blog.twitter.com/engineering/en_us/a/2010/introducing-the-open-source-twitter-text-libraries">Twitter Engineering Team have a set of text processing classes</a> which are meant to simplify and standardise the recognition of URLs, screen names, and hashtags.  Dabr makes use of them to keep in conformance with Twitter's style.</p>

<p>One of the advantages of the text processing is that it will recognise that www.example.com is a URL and automatically create a hyperlink. Considering that dropping the "http://" represents 5% saving on Twitter's 140 character limit for messages, this is great.</p>

<p>So, I was mightily surprised to get <a href="http://twitter.com/schmmuck/status/11352406573">this bug report</a> from user "schmmuck"</p>

<p></p><div id="attachment_1927" style="width: 490px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-1927" class="size-full wp-image-1927" title="Dabr rendering error" src="https://shkspr.mobi/blog/wp-content/uploads/2010/03/Capture8_19_22.jpg" alt="Dabr rendering error" width="480" height="320"><p id="caption-attachment-1927" class="wp-caption-text">Dabr rendering error</p></div><p></p>

<p>How very odd...  This is how it looks on <a href="http://m.twitter.com/">m.twitter.com</a>.</p>

<p></p><div id="attachment_1926" style="width: 490px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-1926" class="size-full wp-image-1926" title="m.twitter rendering error" src="https://shkspr.mobi/blog/wp-content/uploads/2010/03/Capture8_20_48.jpg" alt="m.twitter rendering error" width="480" height="320"><p id="caption-attachment-1926" class="wp-caption-text">m.twitter rendering error</p></div><p></p>

<p>Twitter also use <a href="http://mobile.twitter.com/">mobile.twitter.com</a> for smartphones.  Here's how that site renders the text.</p>

<p></p><div id="attachment_1925" style="width: 490px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-1925" class="size-full wp-image-1925" title="mobile.twitter rendering error" src="https://shkspr.mobi/blog/wp-content/uploads/2010/03/Capture8_21_54.jpg" alt="mobile.twitter rendering error" width="480" height="320"><p id="caption-attachment-1925" class="wp-caption-text">mobile.twitter rendering error</p></div><p></p>

<p>Finally, let's take a look at the "canonical" rendering at Twitter.com</p>

<p></p><div id="attachment_1928" style="width: 410px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-1928" class="size-full wp-image-1928" title="Twitter rendering error" src="https://shkspr.mobi/blog/wp-content/uploads/2010/03/Twitter-rendering-error.jpg" alt="Twitter rendering error" width="400" height="213"><p id="caption-attachment-1928" class="wp-caption-text">Twitter rendering error</p></div><p></p>

<h2 id="the-problems"><a href="https://shkspr.mobi/blog/2010/03/bugs-in-twitter-text-libraries/#the-problems">The Problem(s)</a></h2>

<p>The first issue is inconsistency.&nbsp; Twitter ought to be using the same regex for each of its sites.&nbsp; It doesn't.&nbsp; This means that different developers will get divergent experiences.&nbsp; This leads to confusion, which leads to fear, which, as we all know, leads to anger.... and so forth.</p>

<p>Secondly, and more importantly, parsing is <em>hard</em>.&nbsp; There are so many edge cases that errors inevitably creep in.&nbsp; My post about hashtags explains the problems in defining what <em>should</em> be recognised.</p>

<p>So, based on what we've seen, should Twitter recognise any of the following as URLs?</p>

<p>news.bbc.co.uk - no www there.</p>

<p>invalid.name - a silly URL, but a valid one.</p>

<p>खोज.com - International domains contain more than just ASCII</p>

<p>All the above are valid - yet they're not recognised by Twitter.</p>

<h2 id="a-simple-solution"><a href="https://shkspr.mobi/blog/2010/03/bugs-in-twitter-text-libraries/#a-simple-solution">A (Simple) Solution?</a></h2>

<p>There is a <a href="http://www.iana.org/domains/root/db/">canonical list of TLDs</a> which is also available as a <a href="http://data.iana.org/TLD/tlds-alpha-by-domain.txt">plain text list</a>.</p>

<p>Any string containing a "." followed by a valid TLD, then followed by a space or "/" should be treated as a URL.</p>

<p>Your thoughts?</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=1924&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2010/03/bugs-in-twitter-text-libraries/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[Dabr - Reply to all and Geotagging]]></title>
		<link>https://shkspr.mobi/blog/2010/03/dabr-reply-to-all-and-geotagging/</link>
					<comments>https://shkspr.mobi/blog/2010/03/dabr-reply-to-all-and-geotagging/#respond</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Wed, 24 Mar 2010 11:36:39 +0000</pubDate>
				<category><![CDATA[mobile]]></category>
		<category><![CDATA[dabr]]></category>
		<category><![CDATA[geotagging]]></category>
		<category><![CDATA[twitter]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=1881</guid>

					<description><![CDATA[People have been very excited to see some new functionality in Dabr - the mobile Twitter client I develop for.  But what is it and how does it work?  @@ and geotag  Reply to All  The @@ symbol allows you to reply to all the people mentioned within the tweet. It only shows up on tweets which mention other users - so you should only ever see it when it can be used.  Hitting @@ on the above tweet…]]></description>
										<content:encoded><![CDATA[<p>People have been very excited to see some new functionality in <a href="http://m.dabr.co.uk/">Dabr</a> - the mobile Twitter client I develop for.  But what is it and how does it work?</p>

<p></p><div id="attachment_1882" style="width: 456px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-1882" class="size-full wp-image-1882" title="@@ and geotag" src="https://shkspr.mobi/blog/wp-content/uploads/2010/03/@@-and-geotag.png" alt="@@ and geotag" width="446" height="60"><p id="caption-attachment-1882" class="wp-caption-text">@@ and geotag</p></div><p></p>

<h2 id="reply-to-all"><a href="https://shkspr.mobi/blog/2010/03/dabr-reply-to-all-and-geotagging/#reply-to-all">Reply to All</a></h2>

<p>The <strong>@@</strong> symbol allows you to reply to all the people mentioned within the tweet.
It only shows up on tweets which mention other users - so you should only ever see it when it can be used.</p>

<p>Hitting <strong>@@</strong> on the above tweet will pre-populate the text box with "@topgold @whatleydude @dabr".</p>

<p>It should remove any duplicates and should also remove your username.</p>

<h2 id="geotagging"><a href="https://shkspr.mobi/blog/2010/03/dabr-reply-to-all-and-geotagging/#geotagging">Geotagging</a></h2>

<p>Twitter recently allowed the geotagging of tweets.  This allows you to set the longitude and latitude of where you are when you wrote your message.
Clicking on the green globe (it just looks like a dot at that size!) takes you to a mobile mapping service.</p>

<p></p><div id="attachment_1884" style="width: 330px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-1884" class="size-full wp-image-1884" title="Google Maps Mobile" src="https://shkspr.mobi/blog/wp-content/uploads/2010/03/snap20100324_110828.png" alt="Google Maps Mobile" width="320" height="480"><p id="caption-attachment-1884" class="wp-caption-text">Google Maps Mobile</p></div><p></p>

<p>It only shows up on tweets which are geotagged - so you should only ever see it when it can be used.</p>

<h2 id="how-does-it-work"><a href="https://shkspr.mobi/blog/2010/03/dabr-reply-to-all-and-geotagging/#how-does-it-work">How Does It Work?</a></h2>

<p>You can see <a href="http://code.google.com/p/dabr/source/list">all the code in the SVN</a>, but here's a quick rundown.</p>

<p>Geotagging is very simple.&nbsp; Statuses now have a &lt;geo&gt; field.&nbsp; If this is populated, it will contain a longitude and latitude.</p>

<p>﻿We can take those values and pass them to Google Maps Mobile (or your favourite mobile mapping service).</p>

<pre>if ($geo !== null)
{
   $latlong = $geo-&gt;coordinates;
   $lat = $latlong[0];
   $long = $latlong[1];
   $actions[] = theme('action_icon', "http://maps.google.co.uk/m?q={$lat},{$long}", 'images/map.png', 'MAP');
}</pre>

<p>Reply to all is a little more involved.
Twitter provide an <a href="https://blog.x.com/engineering/en_us/a/2010/introducing-the-open-source-twitter-text-libraries">excellent set of Text Libraries</a>.  These provide officially sanctioned regular expressions to help your project find URLs, hashtags and usernames.</p>

<p>Using the <a href="http://github.com/mzsanford/twitter-text-php/">Twitter Text Extractor class</a> we can determine how many usernames are mentioned in a tweet.  Any duplicates are removed - as is the user's username.</p>

<p>Any questions - just ask!</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=1881&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2010/03/dabr-reply-to-all-and-geotagging/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[Hashtags and Implicit Knowledge]]></title>
		<link>https://shkspr.mobi/blog/2010/02/hashtags-and-implicit-knowledge/</link>
					<comments>https://shkspr.mobi/blog/2010/02/hashtags-and-implicit-knowledge/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Wed, 24 Feb 2010 16:58:27 +0000</pubDate>
				<category><![CDATA[usability]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[dabr]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[hashtags]]></category>
		<category><![CDATA[tags]]></category>
		<category><![CDATA[twitter]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=1706</guid>

					<description><![CDATA[What is &#34;Implicit Knowledge&#34;?  Essentially it&#039;s stuff that everyone knows, but no one has written down.  Usually it&#039;s something that people have worked out through their own experiences.  This sort of knowledge is common in life - but is fatal in computing and design.  Take the following tweet I received.                                                          Mark Hawkins                        …]]></description>
										<content:encoded><![CDATA[<p>What is "Implicit Knowledge"?  Essentially it's stuff that everyone knows, but no one has written down.  Usually it's something that people have worked out through their own experiences.</p>

<p>This sort of knowledge is common in life - but is fatal in computing and design.  Take the following tweet I received.</p>

<blockquote class="social-embed" id="social-embed-9582463562" lang="">        <header class="social-embed-header">        <a href="https://twitter.com/Mawkins" class="social-embed-user">            <img class="social-embed-avatar social-embed-avatar-circle" src="data:image/webp;base64,UklGRj4BAABXRUJQVlA4IDIBAACwCACdASowADAAPrVQnksnJKKhpy7Y4BaJaQAOhlZvKiBqWlTYfwY+/LT+Lr5GJ/LTTHAXHYvchgLKHbRDRdOqggYmnAPtwwh0GxPZnwAA/v4S5nB6XBake6jr/oaDTDP110md+xvy6nksvzgV20eOUH6fpGTw4t3wpALwpA5aKpsOwfGzu10bRgYjZZUnbxXbVLI9m2/ANnDtVW+VJzoAzv9rszKR6KcCdNq1hoAkc5QfsfonHp8FpBy9g2AewNUVW8wvUI+ektZlY5690ryOfeTPUkAqRlOakdEUKMz7oRL2oPvRphgw47TMfV77XcPgWjz4aReffwKrJhby4swi8nMhQWo8typProOSYoZ9UrhZ/Nz9pNVJXu/On60EPpAT6yfxkJfBqvPC1EjksYAAAAA=" alt="">            <div class="social-embed-user-names">                <p class="social-embed-user-names-name">Mark Hawkins                </p>                @Mawkins            </div>        </a>        <img class="social-embed-logo" alt="Twitter" src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%0Aaria-label%3D%22Twitter%22%20role%3D%22img%22%0AviewBox%3D%220%200%20512%20512%22%3E%3Cpath%0Ad%3D%22m0%200H512V512H0%22%0Afill%3D%22%23fff%22%2F%3E%3Cpath%20fill%3D%22%231d9bf0%22%20d%3D%22m458%20140q-23%2010-45%2012%2025-15%2034-43-24%2014-50%2019a79%2079%200%2000-135%2072q-101-7-163-83a80%2080%200%200024%20106q-17%200-36-10s-3%2062%2064%2079q-19%205-36%201s15%2053%2074%2055q-50%2040-117%2033a224%20224%200%2000346-200q23-16%2040-41%22%2F%3E%3C%2Fsvg%3E">    </header>    <section class="social-embed-text">                    <small class="social-embed-reply"><a href="https://twitter.com/edent/status/9581804744">Replying to @edent</a></small>                <a href="https://twitter.com/edent">@edent</a> <a href="https://twitter.com/dabr">@dabr</a> you folks aware ampersands / &amp;s don't seem to work as part of hashtag links?                            </section>    <hr class="social-embed-hr">    <footer class="social-embed-footer">        <a href="">            <span aria-label="0 likes" class="social-embed-meta">❤️ 0</span>            <span aria-label="0 replies" class="social-embed-meta">💬 0</span>            <span aria-label="0 reposts" class="social-embed-meta">🔁 0</span>            <time datetime="{tweet_date}">16:27 - Wed 24 February 2010</time>        </a>    </footer></blockquote>

<p>The complaint was that #tfm&amp;a should be rendered as <span style="text-decoration: underline;">#tfm&amp;a</span> not <span style="text-decoration: underline;">#tfm</span>&amp;a.</p>

<h2 id="everyone-knows-thats-how-hashtags-work"><a href="https://shkspr.mobi/blog/2010/02/hashtags-and-implicit-knowledge/#everyone-knows-thats-how-hashtags-work">Everyone knows that's how hashtags work!</a></h2>

<p>On Twitter's website, find the page which discusses hashtag syntax.  Find where they explain how they should be styled.</p>

<p><strong>You can't.</strong></p>

<p>And thus implicit knowledge is born.  Dabr only looks at letters and numbers in a hashtag.  It assumes that any other character is the end of the tag.</p>

<p></p><div id="attachment_1708" style="width: 490px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-1708" class="size-full wp-image-1708" title="Dabr's Hashtag" src="https://shkspr.mobi/blog/wp-content/uploads/2010/02/Capture16_35_30.jpg" alt="Dabr's Hashtag" width="480" height="320"><p id="caption-attachment-1708" class="wp-caption-text">Dabr's Hashtag</p></div><p></p>

<p>Without official guidance - implicit knowledge develops.</p>

<h2 id="has-dabr-got-it-wrong"><a href="https://shkspr.mobi/blog/2010/02/hashtags-and-implicit-knowledge/#has-dabr-got-it-wrong">Has Dabr Got It Wrong?</a></h2>

<p>No.  I don't think so.  Take a look at how Twitter on the web renders hashtags...</p>

<p></p><div id="attachment_1710" style="width: 392px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-1710" class="size-full wp-image-1710" title="Twitter's Web Site" src="https://shkspr.mobi/blog/wp-content/uploads/2010/02/Twitters-Web-Site.png" alt="Twitter's Web Site" width="382" height="312"><p id="caption-attachment-1710" class="wp-caption-text">Twitter's Web Site</p></div><p></p>

<p>...and on the mobile.</p>

<p></p><div id="attachment_1707" style="width: 490px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-1707" class="size-full wp-image-1707" title="Twitter Mobile" src="https://shkspr.mobi/blog/wp-content/uploads/2010/02/Capture16_34_33.jpg" alt="Twitter Mobile" width="480" height="320"><p id="caption-attachment-1707" class="wp-caption-text">Twitter Mobile</p></div><p></p>

<h2 id="so-where-does-render-the-full-tag"><a href="https://shkspr.mobi/blog/2010/02/hashtags-and-implicit-knowledge/#so-where-does-render-the-full-tag">So Where Does Render The Full Tag?</a></h2>

<p>Several applications don't render tags in the same way as Twitter.  Take a look at SocialScope</p>

<p></p><div id="attachment_1709" style="width: 490px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-1709" class="size-full wp-image-1709" title="SocialScope Hashtags" src="https://shkspr.mobi/blog/wp-content/uploads/2010/02/Capture16_34_56.jpg" alt="SocialScope Hashtags" width="480" height="320"><p id="caption-attachment-1709" class="wp-caption-text">SocialScope Hashtags</p></div><p></p>

<p></p><div id="attachment_1727" style="width: 330px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-1727" src="https://shkspr.mobi/blog/wp-content/uploads/2010/02/jsfe.jpg" alt="Tweetie2" title="Tweetie2" width="320" height="480" class="size-full wp-image-1727"><p id="caption-attachment-1727" class="wp-caption-text">Tweetie2</p></div><p></p>

<p>I'll upload more screenshots if I find examples of "badly behaved" hashtags.&nbsp; Please let me know if you find any.</p>

<h2 id="what-does-twitter-say"><a href="https://shkspr.mobi/blog/2010/02/hashtags-and-implicit-knowledge/#what-does-twitter-say">What Does Twitter Say?</a></h2>

<p>Twitter has one page devoted to hashtags.&nbsp; It is a <a href="https://web.archive.org/web/20100212023033/http://help.twitter.com/forums/10711/entries/49309-what-are-hashtags-the-symbol">support page for hashtags</a>.&nbsp; This explains to people what hashtags are.&nbsp; There's no detail on valid characters, maximum length, or any of the things which might be useful for a developer or designer.</p>

<h3 id="edit-2010-02-25"><a href="https://shkspr.mobi/blog/2010/02/hashtags-and-implicit-knowledge/#edit-2010-02-25">Edit 2010-02-25</a></h3>

<p>David Dorward has <a href="https://web.archive.org/web/20150523002321/https://twitter.com/dorward/status/9584777039">pointed out that there is an official resource</a>. On the Twitter Engineering blog - which isn't linked to from the developer site - there is a <a href="https://web.archive.org/web/20100209102432/http://engineering.twitter.com/2010/02/introducing-open-source-twitter-text.html">page discussing hashtags and how to validate them</a>.  You'll notice that they are rather circumspect on what should constitute a hashtag.</p>

<h2 id="conclusion"><a href="https://shkspr.mobi/blog/2010/02/hashtags-and-implicit-knowledge/#conclusion">Conclusion</a></h2>

<p>Standards and guidelines allow developers to create compatible applications.</p>

<p>Without explicit recommendations, developers will diverge as widely as possible.&nbsp; Twitter - and everyone with an interest in compatibility and usability - needs to ensure that the knowledge they impart is <em>explicit</em>.</p>

<p>Letting people make it up as they go along leads to confusion.</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=1706&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2010/02/hashtags-and-implicit-knowledge/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[Don't Let Users Do Things They Can't Do]]></title>
		<link>https://shkspr.mobi/blog/2010/02/dont-let-users-do-things-they-cant-do/</link>
					<comments>https://shkspr.mobi/blog/2010/02/dont-let-users-do-things-they-cant-do/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Mon, 22 Feb 2010 15:05:42 +0000</pubDate>
				<category><![CDATA[usability]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[dabr]]></category>
		<category><![CDATA[twitter]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=1682</guid>

					<description><![CDATA[There are many &#34;rules&#34; when it comes to User Interface / User Experience design.  One that I try to stick to is &#34;Don&#039;t let users do things they can&#039;t do.&#34;  It&#039;s one of my gripes with Linux.  If you&#039;re editing a configuration file, you are relying on yourself to sanity check your input - often without knowing what the limits are.  Take these two different examples.  In a text file, we might have:  …]]></description>
										<content:encoded><![CDATA[<p>There are many "rules" when it comes to User Interface / User Experience design.&nbsp; One that I try to stick to is "Don't let users do things they can't do."</p>

<p>It's one of my gripes with Linux.&nbsp; If you're editing a configuration file, you are relying on yourself to sanity check your input - often without knowing what the limits are.</p>

<p>Take these two different examples.</p>

<p>In a text file, we might have:</p>

<pre lang="ini" toolbar="false">#Maximum Widgets to fidget
maxW_to-F = 0
</pre>

<p>Whereas a GUI would show</p>

<p>How many Widgets do you want to fidget? <select style="width:5em"> <option>1</option> <option>2</option> <option>3</option> <option>5</option> </select></p>

<p>Even if you don't know the rules behind Widget fidgetting (must be a prime number lower than 7), the GUI won't let you choose a value that you can't select.  The GUI doesn't prevent you setting an innapropriate value - just an illegal one. Your config file, however, could be set to any crazy value that a user type - often resulting in "unpredictable" results.</p>

<pre lang="ini" toolbar="false">#Maximum Widgets to fidget
maxW_to-F = seventeen
</pre>

<p>It's with this in mind that I've made the following <a href="http://code.google.com/p/dabr/source/detail?r=279">change to Dabr</a> - the mobile Twitter client.</p>

<h2 id="to-auth-or-not-to-auth-that-is-the-question"><a href="https://shkspr.mobi/blog/2010/02/dont-let-users-do-things-they-cant-do/#to-auth-or-not-to-auth-that-is-the-question">To Auth or Not To Auth? That Is The Question</a></h2>

<p>Twitter's API has bug / peculiarity (<a href="http://groups.google.com/group/twitter-development-talk/browse_thread/thread/318a5e820ee73765#">reported to their discussion board</a>) which causes Dabr to log a user out.  Let me explain the steps</p>

<ul>
    <li>User 1 (@private) has set her tweets to "protected".</li>
    <li>This means no one can see @private's tweet unless she allows them.</li>
    <li>@private has not allowed User 2 (@edent) to view her tweets.&nbsp; She is protect from his view.</li>
    <li>@edent clicks to view @private's profile.</li>
    <li>@edent can see that @private has 42 friends, 17 followers and 3 favourites.</li>
</ul>

<p>So far, this is the same behaviour on Twitter's website as it is through their API.&nbsp; Here's the difference</p>

<h3 id="web"><a href="https://shkspr.mobi/blog/2010/02/dont-let-users-do-things-they-cant-do/#web">Web</a></h3>

<ul>
    <li>@edent tries to see @private's followers and can see their names, profile pictures etc.</li>
    <li>@edent can also see @private's friends</li>
    <li>@edent <strong>cannot</strong> see @private's favourites (or even how many favourites she has)</li>
</ul>

<h3 id="api"><a href="https://shkspr.mobi/blog/2010/02/dont-let-users-do-things-they-cant-do/#api">API</a></h3>

<ul>
    <li>@edent tries to see @private's followers, friends or favourites</li>
    <li>Because @edent isn't allowed to see @private's info, the API returns <a href="http://apiwiki.twitter.com/HTTP-Response-Codes-and-Errors">401 Authorisation Required</a>.</li>
</ul>

<p>This is where things get tricky. Dabr sees the 401 and concludes that the user has invalid credentials.&nbsp; It then, as a security measure, clears the user's cookie and logs them out.</p>

<p>This may be a little harsh, but <a href="http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_Client_Error">HTTP 401 essentially says that the authorisation has failed</a>.</p>

<h2 id="fixing-it"><a href="https://shkspr.mobi/blog/2010/02/dont-let-users-do-things-they-cant-do/#fixing-it">Fixing It</a></h2>

<p>There are 3 ways that this could be fixed</p>

<ol>
    <li>Twitter could rationalise the API to allow access to the same content that a web user gets.</li>
    <li>Twitter could return a different status code.</li>
    <li>Dabr needs fixing.</li>
</ol>

<p>So, how do we get Dabr not to log out when it receives a 401 <em>only</em> under these specific circumstances?</p>

<p><a href="http://code.google.com/p/dabr/source/browse/trunk/common/twitter.php?r=274#293">Looking at the code</a>, we can see that Dabr simply sees the HTTP response code.&nbsp; To fix it we'll need to pass extra parameters, check where the code was called from, investigate all the edge cases, add more logic to the system, futz around breaking things, etc... etc...</p>

<p>What a pain in the...</p>

<h2 id="or"><a href="https://shkspr.mobi/blog/2010/02/dont-let-users-do-things-they-cant-do/#or">Or</a></h2>

<p><em>Don't let users do things they </em>can't<em> do.</em></p>

<p>If a user can't see the information - why do we even let them <em>try</em> to see the information?&nbsp; Why can't we just get rid of the link?</p>

<p>This is what a user currently sees:</p>

<p></p><div id="attachment_1688" style="width: 364px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-1688" class="size-full wp-image-1688" title="Old Style" src="https://shkspr.mobi/blog/wp-content/uploads/2010/02/Old-Style.png" alt="Old Style" width="354" height="73"><p id="caption-attachment-1688" class="wp-caption-text">Old Style</p></div><p></p>

<p>We've established that they can't view followers, friends and favourites.&nbsp; So we can get rid of those links (but not the information).</p>

<p></p><div id="attachment_1687" style="width: 364px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-1687" class="size-full wp-image-1687" title="New Style" src="https://shkspr.mobi/blog/wp-content/uploads/2010/02/New-Style.png" alt="New Style" width="354" height="73"><p id="caption-attachment-1687" class="wp-caption-text">New Style</p></div><p></p>

<p>(Incidentally, I've changed the order of the links.&nbsp; I've tried to group together similar items.&nbsp; Followers, friends, favourites and lists go together. Then DM. Finally, follow, block, report spam.)</p>

<p>Now a user cannot click through to an unwanted error message.</p>

<h2 id="or"><a href="https://shkspr.mobi/blog/2010/02/dont-let-users-do-things-they-cant-do/#or">Or</a></h2>

<p>There is another way round this.&nbsp; With "Direct Messages" we could do the same thing - simply remove the link if you're not able to send that user a DM.</p>

<p>Instead, we've taken the approach of displaying a suitable error message.</p>

<p></p><div id="attachment_1689" style="width: 455px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-1689" class="size-full wp-image-1689" title="Direct Message Warning" src="https://shkspr.mobi/blog/wp-content/uploads/2010/02/Direct-Message-Warning.png" alt="Direct Message Warning" width="445" height="194"><p id="caption-attachment-1689" class="wp-caption-text">Direct Message Warning</p></div><p></p>

<p>The advantage of this is that the user gets an explanation as to <em>why</em> they are unable to complete an action.</p>

<h2 id="your-thought"><a href="https://shkspr.mobi/blog/2010/02/dont-let-users-do-things-they-cant-do/#your-thought">Your Thought?</a></h2>

<p>Which do you prefer? Being unable to click on a link (with no explanation) or clicking on a link only to be given a warning message?</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=1682&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2010/02/dont-let-users-do-things-they-cant-do/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[Twitter and Linebreaks]]></title>
		<link>https://shkspr.mobi/blog/2010/02/twitter-and-linebreaks/</link>
					<comments>https://shkspr.mobi/blog/2010/02/twitter-and-linebreaks/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Wed, 17 Feb 2010 11:45:21 +0000</pubDate>
				<category><![CDATA[mobile]]></category>
		<category><![CDATA[aral]]></category>
		<category><![CDATA[dabr]]></category>
		<category><![CDATA[feathers]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[twitter]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=1642</guid>

					<description><![CDATA[As any student of computer science knows, line breaks are confusing. There are styles of line breaks unique to Unix, Mac and Windows - so what should a web renderer do when faced with a newline command?  In HTML, it&#039;s simple, they should be ignored.  But what when it is user generated text, not HTML?  This was a problem I faced when trying to get Dabr to render the ASCII art produced by Aral…]]></description>
										<content:encoded><![CDATA[<p>As any student of computer science knows, <a href="http://en.wikipedia.org/wiki/Newline">line breaks are confusing</a>. There are styles of line breaks unique to Unix, Mac and Windows - so what should a web renderer do when faced with a newline command?  In HTML, it's simple, they should be ignored.  But what when it is user generated text, not HTML?</p>

<p>This was a problem I faced when trying to get Dabr to render the <a href="http://en.wikipedia.org/wiki/ASCII_art">ASCII art</a><sup id="fnref:ascii"><a href="https://shkspr.mobi/blog/2010/02/twitter-and-linebreaks/#fn:ascii" class="footnote-ref" title="Technically, Unicode Art. But that doesn't have the same ring to it." role="doc-noteref">0</a></sup> produced by <a href="http://aralbalkan.com/">Aral Balkan</a>'s <a href="https://web.archive.org/web/20100215193137/https://feathersapp.com/">Feathers App</a>.  Feathers uses line breaks to achieve images like...</p>

<pre>〰❀❃ Introducing ❃❀〰
My new iPhone app,
░░░▒█ Feathers █▒░░░
</pre>

<p>What's confusing to me, as a developer is the inconsistent way Twitter handles line breaks.  For example...</p>

<p>Twitter's website ignores line breaks.</p>

<p></p><div id="attachment_1643" style="width: 410px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-1643" class="size-full wp-image-1643" title="Desktop Spacing" src="https://shkspr.mobi/blog/wp-content/uploads/2010/02/Desktop-Spacing.png" alt="Desktop Spacing" width="400" height="178"><p id="caption-attachment-1643" class="wp-caption-text">Desktop Spacing</p></div><p></p>

<p>Twitter Mobile, however, does line breaking correctly.</p>

<p></p><div id="attachment_1644" style="width: 330px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-1644" class="size-full wp-image-1644" title="Android Spacing" src="https://shkspr.mobi/blog/wp-content/uploads/2010/02/Android-Spacing.png" alt="Android Spacing" width="320" height="480"><p id="caption-attachment-1644" class="wp-caption-text">Android Spacing</p></div><p></p>

<p>Twitter has no style guide for rendering and - if it did - appears to render inconsistently.  So, what's the correct thing to do?</p>

<p>In my opinion, <strong>respect the user</strong>. If a user has indicted that they want something, it is a developer's role to implement it (unless it causes severe problems for the system).</p>

<h2 id="how-to-achieve-it"><a href="https://shkspr.mobi/blog/2010/02/twitter-and-linebreaks/#how-to-achieve-it">How to achieve it?</a></h2>

<p>You could use all sorts of complex regular expressions to get line breaks and convert them.
Thankfully, PHP has this function built in with <a href="http://uk.php.net/manual/en/function.nl2br.php">nl2br()</a> which will give you (X)HTML line breaks wherever a break occurs in the text.</p>

<div id="footnotes" role="doc-endnotes">
<hr>
<ol start="0">

<li id="fn:ascii">
<p>Technically, Unicode Art. But that doesn't have the same ring to it.&nbsp;<a href="https://shkspr.mobi/blog/2010/02/twitter-and-linebreaks/#fnref:ascii" class="footnote-backref" role="doc-backlink">↩︎</a></p>
</li>

</ol>
</div>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=1642&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2010/02/twitter-and-linebreaks/feed/</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[Twitter's new OAuth Problem]]></title>
		<link>https://shkspr.mobi/blog/2010/02/twitter-oauth-problem/</link>
					<comments>https://shkspr.mobi/blog/2010/02/twitter-oauth-problem/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Fri, 12 Feb 2010 12:10:07 +0000</pubDate>
				<category><![CDATA[mobile]]></category>
		<category><![CDATA[politics]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[dabr]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[twitter]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=1627</guid>

					<description><![CDATA[Twitter have announced that all third party site will have to use OAuth.  You will no longer be able to just type in your username and password to get access to Twitter via your favourite web client.  Usually, I would be a big fan of this move - especially if it forces password anti-pattern sites like TwitPic to implement the new, secure standard.  This means that you won&#039;t be able to log in to a …]]></description>
										<content:encoded><![CDATA[<p><a href="http://groups.google.com/group/twitter-api-announce/browse_thread/thread/c2c4963061422f28?hl=en&amp;pli=1">Twitter have announced that all third party site will have to use OAuth</a>.&nbsp; You will no longer be able to just type in your username and password to get access to Twitter via your favourite web client.</p>

<p>Usually, I would be a big fan of this move - especially if it forces <a href="http://adactio.com/journal/1357">password anti-pattern</a> sites like <a href="https://web.archive.org/web/20090804173730/https://getsatisfaction.com/twitpic/topics/when_will_twitpic_implement_oauth">TwitPic to implement the new, secure standard</a>.</p>

<p>This means that you won't be able to log in to a third party site by giving them your username and&nbsp; password.&nbsp; You will have to use OAuth to securely validate with the main Twitter site.</p>

<p>But - as ever - there's a dark side to OAuth.</p>

<h2 id="repressive-regimes"><a href="https://shkspr.mobi/blog/2010/02/twitter-oauth-problem/#repressive-regimes">Repressive Regimes</a></h2>

<p>One of the joys of Twitter is that its clients are decentralised from the main site.</p>

<p>This means that if Twitter is blocked in your country, you can use a third party client (like <a href="http://dabr.co.uk/">Dabr</a>) to access it.</p>

<p><code>Twitter User -&gt; Dabr -&gt; Twitter API -&gt; Dabr -&gt; User</code></p>

<p>If Dabr became sufficiently popular to be blocked by an oppressive regime, you can switch to any one of the thousands of Twitter web clients.</p>

<p>OAuth <strong>forces </strong>you to the main Twitter site.&nbsp; While you may visit Dabr to start with, you would be redirected to Twitter to complete OAuth.&nbsp; If Twitter is blocked, you can't connect.</p>

<h3 id="at-a-stroke-twitter-has-shut-itself-off-to-anyone-in-a-repressive-country"><a href="https://shkspr.mobi/blog/2010/02/twitter-oauth-problem/#at-a-stroke-twitter-has-shut-itself-off-to-anyone-in-a-repressive-country">At a stroke, Twitter has shut itself off to anyone in a repressive country.</a></h3>

<p><a href="http://groups.google.com/group/twitter-development-talk/browse_thread/thread/39b8b326d8b679c6">This has been picked up by some concerned users</a>.</p>

<h2 id="a-hacky-way-around-it"><a href="https://shkspr.mobi/blog/2010/02/twitter-oauth-problem/#a-hacky-way-around-it">A (Hacky) Way Around It</a></h2>

<p>There's really only one way around this problem.&nbsp; The third party web client has to act as a man-in-the-middle.&nbsp; There's a patch for Dabr - developed by <a href="https://web.archive.org/web/20100408033613/http://code.google.com/u/cnyegle/">cnyegle</a> - which will ask for a username and password, then proxy it to Twitter, get the OAuth token and tweet on behalf of the user.</p>

<p>From the user's point of view, they are still giving the (potentially untrusted) site the username and password.</p>

<h2 id="challenge-response"><a href="https://shkspr.mobi/blog/2010/02/twitter-oauth-problem/#challenge-response">Challenge Response</a></h2>

<p>This could be solved by implemented a challenge / response system.</p>

<ol>
    <li>Alice visits the Dabr website.</li>
    <li>Dabr asks Alice for her username (and <em>only</em> her username)</li>
    <li>Dabr asks Twitter for the challenge associated with Alice's username.</li>
    <li>Twitter checks that Dabr is an authorised website (i.e. has signed up for OAuth).</li>
    <li>Twitter returns the response:&nbsp; A secret phrase which Alice has previously chosen.</li>
    <li>Dabr displays this phrase to Alice.</li>
    <li>Alice knows that Twitter trusts Dabr</li>
    <li>Dabr asks Twitter for the password challenge.</li>
    <li>Twitter returns that it requires the 3rd, 5th and last character from Alice's password (the characters requested change randomly).</li>
    <li>Dabr asks Alice for <em>only</em> those characters.</li>
    <li>If Alice provides the correct characters, an OAuth token is granted to Dabr to tweet on behalf of Alice.</li>
</ol>

<p>This has the advantage of proving that Dabr is trusted (by displaying Alice's pre-defined secret phrase) and mitigating the risk that Dabr is untrusted (by only revealing part of the password).</p>

<h2 id="conclusion"><a href="https://shkspr.mobi/blog/2010/02/twitter-oauth-problem/#conclusion">Conclusion</a></h2>

<p>This is a very new area, and I've not had a chance to read through all of the proposals.&nbsp; Nevertheless, it remains a fundamental problem that, if you can't access a site, you need to delegate your trust to someone else.</p>

<p>I'm not a security expert - so I would appreciate someone pointing out the flaws in my reasoning.</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=1627&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2010/02/twitter-oauth-problem/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[Twitter OAuth - Mobile Failures]]></title>
		<link>https://shkspr.mobi/blog/2010/02/twitter-oauth-mobile-failures/</link>
					<comments>https://shkspr.mobi/blog/2010/02/twitter-oauth-mobile-failures/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Sun, 07 Feb 2010 15:06:26 +0000</pubDate>
				<category><![CDATA[mobile]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[dabr]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[twitter]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=1606</guid>

					<description><![CDATA[I&#039;m a big fan of OAuth - despite some claims to the contrary.  It&#039;s an excellent way of teaching people not to stick their username and password into any old site which asks for it.  Which is why I&#039;m so incredibly disappointed in Twitter&#039;s implementation of mobile OAuth.  For a service which started out operating by SMS, Twitter takes a surprisingly unenlightened view of mobile.  It&#039;s main mobile …]]></description>
										<content:encoded><![CDATA[<p>I'm a big fan of OAuth - <a href="http://www.theregister.co.uk/2009/11/04/oauth_dark_side/">despite some claims to the contrary</a>.  It's an excellent way of teaching people not to stick their username and password into any old site which asks for it.  Which is why I'm so incredibly disappointed in Twitter's implementation of mobile OAuth.</p>

<p>For a service which started out operating by SMS, Twitter takes a surprisingly unenlightened view of mobile.  It's main mobile service - <a href="http://m.twitter.com/">http://m.twitter.com/</a> - is almost completely devoid of useful features.  That's one of the main impetuses behind the development of <a href="http://dabr.co.uk/">Dabr</a>.  Their latest mobile site - <a href="http://mobile.twitter.com/">http://mobile.twitter.com/</a> - is really only suitable for the tiny minority of people who have smartphones.</p>

<p>So, understandably, many people use 3rd party sites like Dabr.  They are now faced with a dilemma - give an untrusted site their username and password or try to use OAuth on the mobile.</p>

<p>A few weeks ago came the <a href="http://groups.google.com/group/twitter-development-talk/browse_thread/thread/084f57349587b3d2/">announcement that OAuth was finally ready for mobile</a>... Was it? No.  Once again a "mobile friendly" site designed with masses of JavaScript and guaranteed not to work with the majority of phones on the market.</p>

<p>Here's how mobile OAuth looks on a variety of popular mobile phones.</p>

<h2 id="blackberry"><a href="https://shkspr.mobi/blog/2010/02/twitter-oauth-mobile-failures/#blackberry">BlackBerry</a></h2>

<p></p><div id="attachment_1607" style="width: 480px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-1607" class="size-full wp-image-1607" title="BlackBerry Twitter OAuth" src="https://shkspr.mobi/blog/wp-content/uploads/2010/02/BlackBerry-Twitter-OAuth.png" alt="BlackBerry Twitter OAuth" width="470" height="695"><p id="caption-attachment-1607" class="wp-caption-text">BlackBerry Twitter OAuth</p></div><p></p>

<p>While this looks pretty enough, it doesn't work.  The buttons <em>aren't clickable</em>.  I've tried with and without JavaScript.  No matter where I click, nothing happens.</p>

<h2 id="android"><a href="https://shkspr.mobi/blog/2010/02/twitter-oauth-mobile-failures/#android">Android</a></h2>

<p>The Android's User-Agent isn't detected by Twitter as being a mobile phone.  While it's true that the browser is very capable - the OAuth screen is a lot more usable when it's in mobile mode.</p>

<p></p><div id="attachment_1610" style="width: 330px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-1610" class="size-full wp-image-1610" title="Android Twitter OAuth" src="https://shkspr.mobi/blog/wp-content/uploads/2010/02/android2.png" alt="Android Twitter OAuth" width="320" height="480"><p id="caption-attachment-1610" class="wp-caption-text">Android Twitter OAuth</p></div><p></p>

<p>So, it works, but it doesn't look nice.</p>

<h2 id="n95"><a href="https://shkspr.mobi/blog/2010/02/twitter-oauth-mobile-failures/#n95">N95</a></h2>

<p>The N95 makes a good test phone because it's popular.  Probably more popular than the iPhone.</p>

<p></p><div id="attachment_1612" style="width: 250px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-1612" class="size-full wp-image-1612" title="N95 Twitter OAuth" src="https://shkspr.mobi/blog/wp-content/uploads/2010/02/Screenshot0106.png" alt="N95 Twitter OAuth" width="240" height="320"><p id="caption-attachment-1612" class="wp-caption-text">N95 Twitter OAuth</p></div><p></p>

<p></p><div id="attachment_1613" style="width: 250px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-1613" class="size-full wp-image-1613" title="N95 Twitter OAuth" src="https://shkspr.mobi/blog/wp-content/uploads/2010/02/Screenshot0108.png" alt="N95 Twitter OAuth" width="240" height="320"><p id="caption-attachment-1613" class="wp-caption-text">N95 Twitter OAuth</p></div><p></p>

<p>It's not pretty - but at least it works.</p>

<h2 id="others"><a href="https://shkspr.mobi/blog/2010/02/twitter-oauth-mobile-failures/#others">Others</a></h2>

<p>The Sharp GX-10 is my default test phone.  One of the first phones with a colour HTML browser.  If your site can work on this phone, it will work on any phone.  There are no screenshot capabilities for this phone - but rest assured, it does not work.</p>

<p>The three phones I've demo'd above are very popular modern phones - AKA the minority.  If they don't work well, what chance for the people using older phones?</p>

<p>Useless!  How hard can it be?  All it needs is a username field, a password field and a button.  That's just about the most basic page imaginable.  It should be child's play to make it work on mobile.</p>

<p>This was <a href="http://code.google.com/p/twitter-api/issues/detail?id=395">first raised in March 2009 on Twitter's issues list</a>. It's currently the <em>most popular</em> bug.</p>

<p>So, we're stuck in a dire situation.  Third-Party mobile sites get access to Twitter users' passwords because Twitter are unable or unwilling to develop a <em>simple</em> OAuth form.  It would be fascinating to know how many of Twitter's security breaches are down to corrupt or insecure 3rd party sites which leak passwords.</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=1606&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2010/02/twitter-oauth-mobile-failures/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[Dabr Widget for 360 H1]]></title>
		<link>https://shkspr.mobi/blog/2010/01/dabr-widget-for-360-h1/</link>
					<comments>https://shkspr.mobi/blog/2010/01/dabr-widget-for-360-h1/#respond</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Thu, 21 Jan 2010 11:30:38 +0000</pubDate>
				<category><![CDATA[mobile]]></category>
		<category><![CDATA[360]]></category>
		<category><![CDATA[dabr]]></category>
		<category><![CDATA[jil]]></category>
		<category><![CDATA[limo]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[vodafone]]></category>
		<category><![CDATA[widgets]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=1557</guid>

					<description><![CDATA[I&#039;ve written a very basic JIL widget to launch dabr.  You can grab it from shkspr.mobi/Dabr.wgt    I&#039;ve tested this to work on the Vodafone 360 H1 - but it should work with any JIL handset.  Because it isn&#039;t certified, you may need to dial *#35767# to remove the H1&#039;s security check.  The code is very simple.  The JIL SDK allows you to call specific phone application - in this case, all I&#039;ve done i…]]></description>
										<content:encoded><![CDATA[<p>I've written a very basic JIL widget to launch <a href="http://m.dabr.co.uk/">dabr</a>.&nbsp; You can grab it from <a href="https://web.archive.org/web/20110628200457/https://shkspr.mobi/Dabr.wgt">shkspr.mobi/Dabr.wgt</a></p>

<img class="aligncenter size-full wp-image-1559" title="Dabr on 360" src="https://shkspr.mobi/blog/wp-content/uploads/2010/01/Dabr-on-360.jpg" alt="Dabr on the 360 phone" width="400" height="315">

<p>I've tested this to work on the Vodafone 360 H1 - but it should work with any <a href="http://www.jil.org/">JIL</a> handset.</p>

<p>Because it isn't certified, you may need to dial <code>*#35767#</code> to remove the <a href="https://web.archive.org/web/20091024071028/http://www.jil.org/jil-forums/posts/list/176.page#525">H1's security check</a>.</p>

<p>The code is very simple.&nbsp; The JIL SDK allows you to call specific phone application - in this case, all I've done is invoked the browser.</p>

<pre><code class="language-html">&lt;body&gt;
   &lt;script type="text/javascript"&gt;
      Widget.openURL("http://m.dabr.co.uk/");
   &lt;/script&gt;
   &lt;div&gt;
      Launching Dabr!
   &lt;/div&gt;
&lt;/body&gt;
</code></pre>

<p>One thing to note, if you're deploying the widgets from your website, ensure you have set the MIME type to "application/widget" - as per the <a href="http://www.w3.org/TR/widgets/#media-type-registration-for-applicationw">W3C standards</a> - otherwise many devices won't recognise it as a valid widget.</p>

<p>If you're interest in developing for this platform, there's a <a href="https://web.archive.org/web/20100127072901/http://widget.developer.vodafone.com/en/">€1,000,000 bounty up for grabs</a>.&nbsp; There's also a <a href="https://web.archive.org/web/20100125221148/http://jil.vodafone.com/app_planet/">Dev Camp at Mobile World Congress</a> this year.</p>

<p>I work for Vodafone - this is my personal blog, I don't to speak for them.&nbsp; All opinions, claims and mistakes are my own.</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=1557&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2010/01/dabr-widget-for-360-h1/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[Integrating AudioBoo and Phreadz with Dabr]]></title>
		<link>https://shkspr.mobi/blog/2009/12/integrating-audioboo-phreadz-dabr/</link>
					<comments>https://shkspr.mobi/blog/2009/12/integrating-audioboo-phreadz-dabr/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Wed, 30 Dec 2009 14:33:58 +0000</pubDate>
				<category><![CDATA[mobile]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[audioboo]]></category>
		<category><![CDATA[dabr]]></category>
		<category><![CDATA[phreadz]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=1492</guid>

					<description><![CDATA[A quick explanation of how I integrated AudioBoo and Phreadz with Dabr.  I&#039;m a big fan of AudioBoo - for those who don&#039;t know it,  AudioBoo allows you to record some audio on your phone and then publish it to the web.  It&#039;s like instant podcasting.  Originally only for the iPhone, AudioBoo now works on Android and there&#039;s an S60 version comeing out &#34;soon&#34;.  I&#039;m very proud to announce that as of r2…]]></description>
										<content:encoded><![CDATA[<p>A quick explanation of how I integrated AudioBoo and Phreadz with Dabr.</p>

<p>I'm a big fan of <a href="http://audioboo.fm/">AudioBoo</a> - for those who don't know it,&nbsp; AudioBoo allows you to record some audio on your phone and then publish it to the web.&nbsp; It's like instant podcasting.&nbsp; Originally only for the iPhone, AudioBoo now works on Android and there's an S60 version comeing out "soon".</p>

<p>I'm very proud to announce that as of <a href="http://code.google.com/p/dabr/source/detail?r=260">r260</a> - Dabr now support AudioBoo!</p>

<p>It all started with a tweet from David Carrington (creator of Dabr) asking how one would go about linking directly to a tweeted 'boo.</p>

<p>So - how do I turn a tweeted 'boo like <code>http://boo.fm/b73803</code> to the associated MP3 of <code>http://audioboo.fm/boos/73803-rockbandboo.mp3</code>?</p>

<h2 id="bring-me-the-api"><a href="https://shkspr.mobi/blog/2009/12/integrating-audioboo-phreadz-dabr/#bring-me-the-api">Bring Me The API!</a></h2>

<p>An API is a way for two computers to talk to each other.&nbsp; The client (dabr) asks the server (AudioBoo) a question.&nbsp; The server replies with some data and the client then does something with it.</p>

<p><a href="https://web.archive.org/web/20091213062905/http://code.google.com/p/audioboo-api/">AudioBoo's API</a> is a "work in progress" - that's the polite term for "not quite finished".
There are various APIs to get information about a 'boo.  However, it's not particularly intuitive.  For example, if I use /audio_clips/
<code>http://api.audioboo.fm/audio_clips/b73803.mp3</code>
I get an error.
I have to drop the b to get
<code>http://api.audioboo.fm/audio_clips/73803.mp3</code></p>

<p>I asked <del datetime="2024-12-30T07:14:32+00:00"><a href="http://groups.google.com/group/audioboo-api-discuss/browse_thread/thread/2c9a8d5694c0c8cd">on the AudioBoo forums</a></del> if there was a better way but I didn't get a quick response - so I turned to twitter.  One of the top AudioBoo bods, Mark Rock, is an active twitterer (seriously - isn't there a better word than that?)</p>

<style>.social-embed {all: unset;display: block;}.social-embed * {all: unset;display: revert;}.social-embed::after {all: unset;}.social-embed::before {all: unset;}blockquote:not(*) {all: unset;}.social-embed a {cursor: pointer;}blockquote.social-embed {box-sizing: border-box;border: .5px solid;width: 550px;max-width: 100%;font-family: sans-serif;margin: 0;margin-bottom: .5em;padding: 1em;border-radius: 1em;background-color: white;color: black;display: block;}.social-embed-header {display: flex;justify-content: space-between;}.social-embed-user {display: flex;position: relative;align-items: center;text-decoration: none;color: inherit;}.social-embed-avatar {width: 3em;height: 3em;margin-right: .5em;}.social-embed-avatar-circle {border-radius: 50%;}.social-embed-avatar-square {border-radius: 5%;}.social-embed-user-names-name {display: flex;align-items: center;font-weight: bold;margin: 0;}.social-embed-text {margin-top: .5em;}.social-embed-footer {display: flex;align-items: center;justify-content: space-between;}.social-embed-logo {width: 3em;}.social-embed-hr {border: .1px solid;margin: .5em 0 .5em 0;}.social-embed-meta {text-decoration: none !important;color: unset !important;}.social-embed-reply {display: block;}.social-embed-text a, .social-embed-footer time {color: blue;text-decoration: underline;}.social-embed-media, .social-embed-video {border-radius:1em;max-width:100%;}.social-embed-reply{font-size:.75em;display:block;}.social-embed-meter{width: 100%;background: #0005;}</style>

<blockquote class="social-embed" id="social-embed-6891551616" lang="en"><header class="social-embed-header"><a href="https://twitter.com/markrock" class="social-embed-user"><img class="social-embed-avatar social-embed-avatar-circle" src="data:image/webp;base64,UklGRnIBAABXRUJQVlA4IGYBAADwCACdASowADAAPrVOo04nI6MiJzgJIOAWiWkACCC4yTCMYIunxokM/b+N/Pp9re6o3hS5iwBY5IkM3LgDNyw8Q/nxRQXv+QLR9acXcUicAAD+/bxqAJJ2SMi/3CcYPVAoO7eyzHN6VlpBGLz9HJRLsoT/uRwjaxmsUUW62rqTyVxPl/YRHIPkwNxEvGcbHI3ICHFR2vg9MHA4Zq+Ru1Stqj4u7D2TxGy3ZC3g8v8FjErNiKfnwB+WuwGSHdBS8eFmeIVL8oKOA48yuKx9AaymBStwI2aJPEQvSalmGoh6fUkIUopCMXSstpwhTXI2EMkSQ6XNh7qXWIHCKIMsrsxzL3Le/qUrpGEGyNDe3su1IH6An8cKo5OU9olyDhbIlXX+a2LwEF5AleO6tEPEK8B93HLC6sW3Q6aU0RSii45/FXOnUQXwPS4a5UNVgTTwGBh+vwyK9WPDoGgAh/dl+M3idLGlVVAA" alt=""><div class="social-embed-user-names"><p class="social-embed-user-names-name">Mark Rock</p>@markrock</div></a><img class="social-embed-logo" alt="" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCmFyaWEtbGFiZWw9IlR3aXR0ZXIiIHJvbGU9ImltZyIKdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoCmQ9Im0wIDBINTEyVjUxMkgwIgpmaWxsPSIjZmZmIi8+PHBhdGggZmlsbD0iIzFkOWJmMCIgZD0ibTQ1OCAxNDBxLTIzIDEwLTQ1IDEyIDI1LTE1IDM0LTQzLTI0IDE0LTUwIDE5YTc5IDc5IDAgMDAtMTM1IDcycS0xMDEtNy0xNjMtODNhODAgODAgMCAwMDI0IDEwNnEtMTcgMC0zNi0xMHMtMyA2MiA2NCA3OXEtMTkgNS0zNiAxczE1IDUzIDc0IDU1cS01MCA0MC0xMTcgMzNhMjI0IDIyNCAwIDAwMzQ2LTIwMHEyMy0xNiA0MC00MSIvPjwvc3ZnPg=="></header><section class="social-embed-text"><small class="social-embed-reply"><a href="https://twitter.com/davidcarrington">Replying to @davidcarrington</a></small><a href="https://twitter.com/davidcarrington">@davidcarrington</a> <a href="https://twitter.com/edent">@edent</a> just updated server so this works - http://boo.fm/b1234.mp3</section><hr class="social-embed-hr"><footer class="social-embed-footer"><a href="https://twitter.com/markrock/status/6891551616" aria-label="0 likes" class="social-embed-meta">❤️ 0</a><a href="https://twitter.com/markrock/status/6891551616" aria-label="0 replies" class="social-embed-meta">💬 0</a><a href="https://twitter.com/markrock/status/6891551616" aria-label="0 retweets" class="social-embed-meta">♻️ 0</a><a href="https://twitter.com/markrock/status/6891551616"><time datetime="2009-12-21T12:12:59.000Z">12:12 - Mon 21 December 2009</time></a></footer></blockquote>

<p>So, now I can link <code>http://boo.fm/b73803</code> to <code>http://boo.fm/b73803.mp3</code> - simple.  Here's what it looks like in the browser.</p>

<p></p><div id="attachment_1497" style="width: 309px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-1497" src="https://shkspr.mobi/blog/wp-content/uploads/2009/12/Screenshot-shkspr.mobi-Search-Mozilla-Firefox-e1262183483383.png" alt="AudioBoo" title="AudioBoo" width="299" height="296" class="size-full wp-image-1497"><p id="caption-attachment-1497" class="wp-caption-text">AudioBoo</p></div><p></p>

<h2 id="phreadz"><a href="https://shkspr.mobi/blog/2009/12/integrating-audioboo-phreadz-dabr/#phreadz">Phreadz</a></h2>

<p><a href="https://web.archive.org/web/20091231045531/http://phreadz.com/">Phreadz</a> is a service which allows you to post VITAL - Video Images Text Audio Links - it's a fantastic service, so when Kosso (its founder) asked me to integrate it into Dabr, I was keen to take on the challenge.</p>

<p>The code was quite simple and can be seen in <a href="http://code.google.com/p/dabr/source/detail?r=261">r261</a>.  But there was one small complication - image sizes.</p>

<p>The thumbnail images from Phreadz aren't always suitable for mobiles.  If images are too large, it will slow download speeds and potentially cost people money.</p>

<p>So, I used <a href="https://web.archive.org/web/20091224002557/http://tinysrc.mobi/">tinysrc.mobi</a>. Tinysrc is a very simple API which will resize any image to a mobile friendly format.  It detects the phone's user-agent string and creates a suitable sized image.</p>

<p>Here's what it looks like.</p>

<p></p><div id="attachment_1498" style="width: 410px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-1498" class="size-full wp-image-1498" title="Phreadz" src="https://shkspr.mobi/blog/wp-content/uploads/2009/12/vodaclone_1261744837_400.jpg" alt="Phreadz" width="400" height="955"><p id="caption-attachment-1498" class="wp-caption-text">Phreadz</p></div><p></p>

<h2 id="conclusions"><a href="https://shkspr.mobi/blog/2009/12/integrating-audioboo-phreadz-dabr/#conclusions">Conclusions</a></h2>

<p>I've used 4 separate APIs here - twitter, AudioBoo, Phreadz, tinysrc - the joy of Web 2.0 is that all those disparate services can combine to create something new and magical.</p>

<p>API designers often need to think about how their products will be used "in the wild".  It's very easy to create something that works very well for your requirements - but much harder to think about what others will need.</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=1492&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2009/12/integrating-audioboo-phreadz-dabr/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		<enclosure url="http://audioboo.fm/boos/73803-rockbandboo.mp3" length="0" type="audio/mpeg" />
<enclosure url="http://boo.fm/b1234.mp3" length="0" type="audio/mpeg" />
<enclosure url="http://boo.fm/b73803.mp3" length="0" type="audio/mpeg" />

			</item>
		<item>
		<title><![CDATA[Seesmic Twitter Client for BlackBerry]]></title>
		<link>https://shkspr.mobi/blog/2009/11/seesmic-twitter-client-for-blackberry/</link>
					<comments>https://shkspr.mobi/blog/2009/11/seesmic-twitter-client-for-blackberry/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Sun, 22 Nov 2009 07:00:04 +0000</pubDate>
				<category><![CDATA[mobile]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[blackberry]]></category>
		<category><![CDATA[dabr]]></category>
		<category><![CDATA[NaBloPoMo]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[ubertwitter]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=1232</guid>

					<description><![CDATA[Seesmic, a service I&#039;ve not tried before, have released a Twitter client for the BlackBerry.  Is it any good? How does it compare with the features of Dabr or the usability of UberTwitter? Find out!  Getting the client was fairly simple, but could be better.  Simply visiting http://seesmic.com was enough to bring up a mobile friendly page with download instructions.  However, scrolling down…]]></description>
										<content:encoded><![CDATA[<p><a href="http://seesmic.com/">Seesmic</a>, a service I've not tried before, have released a Twitter client for the BlackBerry.  Is it any good? How does it compare with the features of <a href="http://m.dabr.co.uk/">Dabr</a> or the usability of <a href="https://web.archive.org/web/20091121194019/http://www.ubertwitter.com/">UberTwitter</a>? Find out!</p>

<p>Getting the client was fairly simple, but could be better.  Simply visiting <a href="http://seesmic.com">http://seesmic.com</a> was enough to bring up a mobile friendly page with download instructions.
<a href="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_25_27.jpg"><img class="aligncenter size-full wp-image-1233" title="Capture9_25_27" src="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_25_27.jpg" alt="Capture9_25_27" width="480" height="320"></a>
However, scrolling down presented this mess.
<a href="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_25_41.jpg"><img class="aligncenter size-full wp-image-1234" title="Capture9_25_41" src="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_25_41.jpg" alt="Capture9_25_41" width="480" height="320"></a>
You simply can't rely on users to know what make, model or firmware version they have.  Use the user-agent string to do as much of the hard work as possible.  If a user tries to install an incompatible version, it won't work and they'll blame you.</p>

<p>The download itself is a sprightly 172KB and installs very quickly - it also doesn't require a reboot.
<a href="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_26_9.jpg"><img class="aligncenter size-full wp-image-1235" title="Capture9_26_9" src="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_26_9.jpg" alt="Capture9_26_9" width="480" height="320"></a>
Once you've signed in, the main interface is very simple.  UberTwitter, for example, presents the user with complex set-up options on the first run.  Seesmic gets straight to the action.
<a href="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_27_55.jpg"><img class="aligncenter size-full wp-image-1236" title="Capture9_27_55" src="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_27_55.jpg" alt="Capture9_27_55" width="480" height="320"></a>
Seesmic is entirely menu driven - there are no shortcut keys.  UberTwitter allows me to hit R for reply - on Seesmic, I have to delve into the menus.  Luckily, they're short and have obvious names.
<a href="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_28_1.jpg"><img class="aligncenter size-full wp-image-1237" title="Capture9_28_1" src="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_28_1.jpg" alt="Capture9_28_1" width="480" height="320"></a>
Reading a tweet gives the usual option, hashtags and @s are hyperlinked - as are web addresses.
<a href="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_29_20.jpg"><img class="aligncenter size-full wp-image-1238" title="Capture9_29_20" src="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_29_20.jpg" alt="Capture9_29_20" width="480" height="320"></a>
On usability flaw, the cursor is at the top of the screen.  A user has to scroll through the "Web" hyperlink before getting to the links within the tweet.</p>

<p>Again, because there are no keyboard shortcuts, everything has to go through the menu.
<a href="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_29_46.jpg"><img class="aligncenter size-full wp-image-1240" title="Capture9_29_46" src="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_29_46.jpg" alt="Capture9_29_46" width="480" height="320"></a>
Searching is problematic.
<a href="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_31_8.jpg"><img class="aligncenter size-full wp-image-1241" title="Capture9_31_8" src="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_31_8.jpg" alt="Capture9_31_8" width="480" height="320"></a>
Pressing enter doesn't start a search, it inserts a new line.
The search button isn't the first thing you get to when you scroll down.
While the results are standard, this odd error message kept popping up.
<a href="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_31_27.jpg"><img class="aligncenter size-full wp-image-1242" title="Capture9_31_27" src="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_31_27.jpg" alt="Capture9_31_27" width="480" height="320"></a>
I encountered this error several times.</p>

<p>Writing new tweet has some great usability touches - and some real clunkers.
<a href="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_42_13.jpg"><img class="aligncenter size-full wp-image-1245" title="Capture9_42_13" src="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_42_13.jpg" alt="Capture9_42_13" width="480" height="320"></a>
The closer a user gets to filling the 140 characters, the more red the screen turns.
<a href="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_42_35.jpg"><img class="aligncenter size-full wp-image-1246" title="Capture9_42_35" src="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_42_35.jpg" alt="Capture9_42_35" width="480" height="320"></a><a href="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_47_4.jpg"><img class="aligncenter size-full wp-image-1252" title="Capture9_47_4" src="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_47_4.jpg" alt="Capture9_47_4" width="480" height="320"></a>
URLs can be automatically shortened and images can be added.  This shows one of the great usability failures of Seesmic.
<a href="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_38_58.jpg"><img class="aligncenter size-full wp-image-1243" title="Capture9_38_58" src="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_38_58.jpg" alt="Capture9_38_58" width="480" height="320"></a>
Rather than use the BlackBerry's file select utility, it uses its own - and it's dreadful.  Ugly looking, no ability to search, slow, no preview.  Overall, a real let-down.</p>

<p>I don't know why companies often insist on creating their own versions of well established system functions.  Especially when they add nothing and remove plenty.</p>

<p>Sending a tweet was continually problematic for me.
<a href="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_43_55.jpg"><img class="aligncenter size-full wp-image-1250" title="Capture9_43_55" src="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_43_55.jpg" alt="Capture9_43_55" width="480" height="320"></a>
Although it eventually relented.
<a href="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_44_18.jpg"><img class="aligncenter size-full wp-image-1251" title="Capture9_44_18" src="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_44_18.jpg" alt="Capture9_44_18" width="480" height="320"></a>
Seesmic also makes great use of notifies, showing you on your home screen how many unread tweets you have.
<a href="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_40_42.jpg"><img class="aligncenter size-full wp-image-1244" title="Capture9_40_42" src="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_40_42.jpg" alt="Capture9_40_42" width="480" height="320"></a>
Overall, Seesmic isn't a bad client.  There are a few rough-around-the-edges bugs and the file selection is atrocious but other than that, it works.  Power users like me will miss the shortcut keys of UberTwitter, and UT's system-wide integration (uploading photos, capturing hashtags in emails etc.).&nbsp; It lacks other features such as in-line photos, ability to see followers and friends, it also has no way of marking a tweet as a favourite or seeing favourites.</p>

<p>One feature it does have - a first in mobile twitter clients - is the ability to view lists.&nbsp; You can't add, edit or create - but you can see the lists you have created or are following.</p>

<p><a href="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_32_49.jpg"><img class="aligncenter size-full wp-image-1266" title="Capture9_32_49" src="https://shkspr.mobi/blog/wp-content/uploads/2009/11/Capture9_32_49.jpg" alt="Capture9_32_49" width="480" height="320"></a></p>

<h2 id="conclusion"><a href="https://shkspr.mobi/blog/2009/11/seesmic-twitter-client-for-blackberry/#conclusion">Conclusion</a></h2>

<p>Seesmic works well enough as a basic twitter client for BlackBerry - but there's nothing exciting about it.</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=1232&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2009/11/seesmic-twitter-client-for-blackberry/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[Embedding Mobile YouTube in Dabr / Twitter]]></title>
		<link>https://shkspr.mobi/blog/2009/09/embedding-mobile-youtube-in-dabr-twitter/</link>
					<comments>https://shkspr.mobi/blog/2009/09/embedding-mobile-youtube-in-dabr-twitter/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Sun, 27 Sep 2009 10:15:14 +0000</pubDate>
				<category><![CDATA[mobile]]></category>
		<category><![CDATA[dabr]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[YouTube]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=554</guid>

					<description><![CDATA[I&#039;ve decided to add a preview of YouTube videos into Dabr, the mobile Twitter service.  The code is fairly simple - although I still suck at regular expressions.  if (preg_match_all(&#039;#youtube.com/watch?v=([_-dw]+)#&#039;, $tmp, $matches, PREG_PATTERN_ORDER) &#62; 0)  {   foreach ($matches[1] as $match)   {   $images[] = theme(&#039;external_link&#039;, &#34;http://m.youtube.com/watch?v={$match}&#34;, &#34;&#60;img…]]></description>
										<content:encoded><![CDATA[<p>I've decided to add a preview of <a href="http://www.youtube.com/">YouTube</a> videos into <a href="http://m.dabr.co.uk/">Dabr</a>, the mobile <a href="http://twitter.com">Twitter</a> service.</p>

<p>The <a href="http://code.google.com/p/dabr/source/detail?r=192">code is fairly simple</a> - although I still suck at regular expressions.</p>

<pre><code class="language-php">if (preg_match_all('#youtube.com/watch?v=([_-dw]+)#', $tmp, $matches, PREG_PATTERN_ORDER) &gt; 0)
 {
  foreach ($matches[1] as $match)
  {
  $images[] = theme('external_link', "http://m.youtube.com/watch?v={$match}", "&lt;img src='http://i.ytimg.com/vi/{$match}/1.jpg' class='twitpic' /&gt;");
  }
 }
</code></pre>

<p>Here's how it looks.&nbsp; A user writes a tweet which contains a YouTube URL</p>

<p></p><div id="attachment_555" style="width: 490px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-555" class="size-full wp-image-555" title="Capture7_55_25" src="https://shkspr.mobi/blog/wp-content/uploads/2009/09/Capture7_55_25.jpg" alt="A thumbnail embedded in a tweet" width="480" height="320"><p id="caption-attachment-555" class="wp-caption-text">A thumbnail embedded in a tweet</p></div><p></p>

<p>The thumbnail is displayed and hyperlinked to the <a href="http://m.youtube.com/">mobile version of YouTube</a></p>

<p></p><div id="attachment_556" style="width: 490px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-556" class="size-full wp-image-556" title="Capture7_55_41" src="https://shkspr.mobi/blog/wp-content/uploads/2009/09/Capture7_55_41.jpg" alt="Pointing to Mobile YouTube" width="480" height="320"><p id="caption-attachment-556" class="wp-caption-text">Pointing to Mobile YouTube</p></div><p></p>

<p>When clicked on, the user is taken straight to the video's page.</p>

<p></p><div id="attachment_557" style="width: 490px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-557" class="size-full wp-image-557" title="Capture8_35_37" src="https://shkspr.mobi/blog/wp-content/uploads/2009/09/Capture8_35_37.jpg" alt="The Destination" width="480" height="320"><p id="caption-attachment-557" class="wp-caption-text">The Destination</p></div><p></p>

<p>There were three main issues with this code</p>

<ol>
    <li>How do we extract the video's ID from the URL? YouTube video IDs contain alphanumeric character and the - and _ characters. They can also have other parameters passed.&nbsp; There can also be text <em>after</em> the URL.&nbsp; The regular expression above takes care of them.</li>
    <li>How do we get the thumbnail?&nbsp; Previously, I had been using the image URL given in the m.YouTube page - something like http://i.ytimg.com/vi/plvE4882B7Y/default.jpg?w=80&amp;h=60 - however those URLs now need signing. So, using the <a href="http://code.google.com/apis/youtube/2.0/reference.html">YouTube API</a>, I took a look at the Video Information XML file - http://gdata.youtube.com/feeds/api/videos/plvE4882B7Y - it showed that all videos have a full sized thumbnail - http://i.ytimg.com/vi/plvE4882B7Y/0.jpg and a mobile friendly thumbnail - http://i.ytimg.com/vi/plvE4882B7Y/1.jpg</li>
    <li>How do we link to the mobile version of YouTube?&nbsp; There are two ways to do this - either allow YouTube to detect the User-Agent and redirect based on that, or simply point to the mobile version.&nbsp; While a regular YouTube link looks like http://<strong>www</strong>.youtube.com/watch?v=plvE4882B7Y the mobile one simply substitutes www for m : http://<strong>m</strong>.youtube.com/watch?v=plvE4882B7Y</li>
</ol>

<p>TODO</p>

<p>For phones which support playing YouTube videos inline (Android, some Nokias etc) I may actually embed the video, rather than just link to it.&nbsp; I may also detect Desktop Browsers and send them to the regular version of YouTube.</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=554&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2009/09/embedding-mobile-youtube-in-dabr-twitter/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[Expanding URLs in Dabr / Twitter]]></title>
		<link>https://shkspr.mobi/blog/2009/09/expanding-urls-in-dabr-twitter/</link>
					<comments>https://shkspr.mobi/blog/2009/09/expanding-urls-in-dabr-twitter/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Tue, 08 Sep 2009 11:46:55 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[bit.ly]]></category>
		<category><![CDATA[dabr]]></category>
		<category><![CDATA[longurlplease]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[url]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=461</guid>

					<description><![CDATA[I hate shortened URLs with a passion.  It makes it hard to see what a link is and whether I&#039;ve visited it before.  If they fail - like tr.im threatened to do - you lose your links with no way to see where they once went.  So, hurrah for LongURLPlease - a service which takes those horrid little links and turns them in to full sized URLs.  Here&#039;s the basic code in PHP to use the service.  function l…]]></description>
										<content:encoded><![CDATA[<p>I hate shortened URLs with a passion.&nbsp; It makes it hard to see what a link is and whether I've visited it before.&nbsp; If they fail - <a href="https://web.archive.org/web/20090815224130/http://blog.tr.im:80/post/159369789/tr-im-r-i-p">like tr.im threatened to do</a> - you lose your links with no way to see where they once went.</p>

<p>So, hurrah for <a href="https://web.archive.org/web/20090912162632/http://www.longurlplease.com/">LongURLPlease</a> - a service which takes those horrid little links and turns them in to full sized URLs.</p>

<p>Here's the basic code in PHP to use the service.</p>

<pre>function long_url($shortURL)
{
 //Use the LongURLPlease API
 $url = "http://www.longurlplease.com/api/v1.1?q=" . $shortURL;

 //Set up CURL
 $curl_handle=curl_init();
 curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
 curl_setopt($curl_handle,CURLOPT_URL,$url);

 //Get the JSON response
 $url_json = curl_exec($curl_handle);

 //Close the connection
 curl_close($curl_handle);

 //Decode the JSON
 $url_array = json_decode($url_json,true);

 //Get the Long URL out of the array
 $url_long = $url_array["$shortURL"];

 if ($url_long == null) //The service couldn't find a long URL
 {
 return $shortURL;
 }

 return $url_long;
}
</pre>

<p>So, how should this be displayed to the user in Dabr?</p>

<p>There are three possibilities.</p>

<h2 id="display"><a href="https://shkspr.mobi/blog/2009/09/expanding-urls-in-dabr-twitter/#display">Display</a></h2>

<p><code>&lt;a href="short.url/foo"&gt;VeryVeryLong.Url/Bar&lt;/a&gt;</code></p>

<p>This keeps the redirect, but it displays the full URL for the user.</p>

<h3 id="pros"><a href="https://shkspr.mobi/blog/2009/09/expanding-urls-in-dabr-twitter/#pros">Pros.</a></h3>

<ul>
    <li>Get to see what the content is.</li>
    <li>Allows the short URL service to record hits etc.</li>
</ul>

<h3 id="cons"><a href="https://shkspr.mobi/blog/2009/09/expanding-urls-in-dabr-twitter/#cons">Cons.</a></h3>

<ul>
    <li>Won't highlight if you've already visited it.</li>
    <li>May cause problems if the VeryLong.Url is too long for the screen.</li>
</ul>

<h2 id="all-change"><a href="https://shkspr.mobi/blog/2009/09/expanding-urls-in-dabr-twitter/#all-change">All Change</a></h2>

<p><code>&lt;a href="VeryVeryLong.Url/Bar"&gt;VeryVeryLong.Url/Bar&lt;/a&gt;</code>
This completely replaces the short URL.</p>

<h3 id="pros"><a href="https://shkspr.mobi/blog/2009/09/expanding-urls-in-dabr-twitter/#pros">Pros.</a></h3>

<ul>
    <li>Hurrah! No more silly URLs.</li>
    <li>Will highlight if you've already visited it.</li>
    <li>You can seen what you're about to click on.</li>
</ul>

<h3 id="cons"><a href="https://shkspr.mobi/blog/2009/09/expanding-urls-in-dabr-twitter/#cons">Cons.</a></h3>

<ul>
    <li>Breaks any statistics management the short URL service was performing (is this a con? Surely the receiving website should be recording such details?)</li>
    <li>May cause problems if the VeryLong.Url is too long for the screen.</li>
</ul>

<h2 id="background"><a href="https://shkspr.mobi/blog/2009/09/expanding-urls-in-dabr-twitter/#background">Background</a></h2>

<p><code>&lt;a href="VeryVeryLong.Url/Bar"&gt;short.url/foo&lt;/a&gt;</code></p>

<h3 id="pros"><a href="https://shkspr.mobi/blog/2009/09/expanding-urls-in-dabr-twitter/#pros">Pros.</a></h3>

<ul>
    <li>Will highlight if you've already visited it.</li>
    <li>You can seen what you're about to click on if you hover over the URL.</li>
    <li>Won't cause problems if the URL is too long for the screen.</li>
</ul>

<h3 id="cons"><a href="https://shkspr.mobi/blog/2009/09/expanding-urls-in-dabr-twitter/#cons">Cons.</a></h3>

<ul>
    <li>Breaks any statistics management the short URL service was performing (is this a con? Surely the receiving website should be recording such details?)</li>
    <li>User can't immediately see what they're about to click on.</li>
</ul>

<h2 id="conclusions"><a href="https://shkspr.mobi/blog/2009/09/expanding-urls-in-dabr-twitter/#conclusions">Conclusions</a></h2>

<p>I prefer replacing the URL completely.&nbsp; I see no value in the various short URL services.&nbsp; The stats that they gather don't seem any better that those your webserver can provide.</p>

<p>However, long URLs can be messy - especially on small screened devices.</p>

<p></p><div id="attachment_467" style="width: 490px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-467" class="size-full wp-image-467" title="Capture12_17_3" src="https://shkspr.mobi/blog/wp-content/uploads/2009/09/Capture12_17_3.jpg" alt="Long URLs on a BlackBerry" width="480" height="320"><p id="caption-attachment-467" class="wp-caption-text">Long URLs on a BlackBerry</p></div><p></p>

<p>So, which do you prefer?</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=461&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2009/09/expanding-urls-in-dabr-twitter/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
			</item>
	</channel>
</rss>
