<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Tim’s Bandwagon</title>
  
  <subtitle>Hitch your wagon to a chicken</subtitle>
  <link href="/atom.xml" rel="self"/>
  
  <link href="https://twisty.com/"/>
  <updated>2020-04-18T20:57:17.000Z</updated>
  <id>https://twisty.com/</id>
  
  <author>
    <name>Tim Brayshaw</name>
    
  </author>
  
  <generator uri="https://hexo.io/">Hexo</generator>
  
  <entry>
    <title>How to set up Syntastic to check JSON files</title>
    <link href="https://twisty.com/bandwagon/archives/2016/06/28/syntastic-json-setup/"/>
    <id>https://twisty.com/bandwagon/archives/2016/06/28/syntastic-json-setup/</id>
    <published>2016-06-28T21:26:06.000Z</published>
    <updated>2020-04-18T20:57:17.000Z</updated>
    
    <content type="html"><![CDATA[<p>Assuming you’ve got <a href="https://github.com/scrooloose/syntastic">Syntastic</a> installed and operating…</p><ol><li><p>Edit your <code>vimrc</code> so <a href="http://www.vim.org/">vim</a> recognises <a href="http://www.json.org/">JSON</a> files.</p><figure class="highlight vim"><figcaption><span>~/.vimrc</span></figcaption><table><tr><td class="code"><pre><span class="line"><span class="keyword">autocmd</span> BufNewFile,BufReadPost *.json <span class="keyword">set</span> <span class="keyword">filetype</span>=json</span><br></pre></td></tr></table></figure></li><li><p>Install the <a href="https://github.com/zaach/jsonlint">JSON linter</a>:</p><figure class="highlight sh"><table><tr><td class="code"><pre><span class="line">npm install -g jsonlint</span><br></pre></td></tr></table></figure></li><li><p>There’s no step three.</p></li></ol><hr><p>Actually, I wasn’t completely honest about step three. Setting <code>filetype=json</code> killed syntax highlighting for JSON files for me, so I installed <a href="https://github.com/elzr/vim-json">elzr/vim-json</a>. (Previously JSON was being detected and highlighted as Javascript – possibly via <a href="https://github.com/pangloss/vim-javascript">pangloss/vim-javascript</a>; a “stock” vim on a different machine managed to detect and highlight JSON out-of-the-box.)</p>]]></content>
    
    <summary type="html">
    
      
      
        &lt;p&gt;Assuming you’ve got &lt;a href=&quot;https://github.com/scrooloose/syntastic&quot;&gt;Syntastic&lt;/a&gt; installed and operating…&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Edit your &lt;c
      
    
    </summary>
    
    
    
      <category term="Software" scheme="https://twisty.com/bandwagon/archives/categories/software/"/>
    
  </entry>
  
  <entry>
    <title>Hello (again) world</title>
    <link href="https://twisty.com/bandwagon/archives/2016/06/21/hello-world/"/>
    <id>https://twisty.com/bandwagon/archives/2016/06/21/hello-world/</id>
    <published>2016-06-20T23:00:00.000Z</published>
    <updated>2020-04-18T20:57:17.000Z</updated>
    
    <content type="html"><![CDATA[<p>After a brief hiatus, I’ve rebooted this weblog. Let’s see if I can do better than the single entry I’ve posted over the past eight years.</p><p>On a whim, I’ve moved the site over from <a href="https://wordpress.org">Wordpress</a> to <a href="https://hexo.io/">Hexo</a>. I never grew to love Wordpress, although the new direction they’re taking with <a href="https://developer.wordpress.com/calypso/">calypso</a> looks intriguing, so I may live to regret this decision. Hexo is a static site generator akin to <a href="https://jekyllrb.com/">Jekyll</a>. It is pretty good: quick to get up-and-running (if you’re used to wrangling <a href="https://www.npmjs.com/">npm</a>), and I’ve enjoyed playing about with <a href="https://mozilla.github.io/nunjucks/">nunjucks</a>.</p>]]></content>
    
    <summary type="html">
    
      
      
        &lt;p&gt;After a brief hiatus, I’ve rebooted this weblog. Let’s see if I can do better than the single entry I’ve posted over the past eight years
      
    
    </summary>
    
    
    
  </entry>
  
  <entry>
    <title>PHPUnit: How to show more info in testdox output when using data providers</title>
    <link href="https://twisty.com/bandwagon/archives/2011/07/16/141959/"/>
    <id>https://twisty.com/bandwagon/archives/2011/07/16/141959/</id>
    <published>2011-07-16T13:19:59.000Z</published>
    <updated>2020-04-18T20:57:17.000Z</updated>
    
    <content type="html"><![CDATA[<p>Probably the geekiest and most obscure blog post title I’ll ever write, but we’ll see!</p><figure class="highlight php"><table><tr><td class="code"><pre><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">DataProviderExampleTest</span> <span class="keyword">extends</span> <span class="title">PHPUnit_Framework_TestCase</span></span></span><br><span class="line"><span class="class"></span>&#123;</span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@dataProvider</span> colourStatementsProvider</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="keyword">public</span> <span class="function"><span class="keyword">function</span> <span class="title">testItemIsCorrectColour</span><span class="params">($statement, $item, $colour)</span></span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line">        $parts = explode(<span class="string">' is '</span>, $statement);</span><br><span class="line">        <span class="keyword">$this</span>-&gt;assertEquals($parts[<span class="number">0</span>], $item);</span><br><span class="line">        <span class="keyword">$this</span>-&gt;assertEquals($parts[<span class="number">1</span>], $colour);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="function"><span class="keyword">function</span> <span class="title">colourStatementsProvider</span><span class="params">()</span></span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> <span class="keyword">array</span>(</span><br><span class="line">            <span class="string">'apple-is-green'</span> =&gt; <span class="keyword">array</span>(<span class="string">'apple is green'</span>, <span class="string">'apple'</span>, <span class="string">'green'</span>),</span><br><span class="line">            <span class="string">'apple-is-red'</span>   =&gt; <span class="keyword">array</span>(<span class="string">'apple is red'</span>, <span class="string">'apple'</span>, <span class="string">'red'</span>),</span><br><span class="line">            <span class="string">'sky-is-blue'</span>    =&gt; <span class="keyword">array</span>(<span class="string">'sky is blue'</span>, <span class="string">'sky'</span>, <span class="string">'grey'</span>),</span><br><span class="line">        );</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p>Now run the test:</p><figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">% phpunit DataProviderExampleTest.php</span><br><span class="line">PHPUnit 3.4.3 by Sebastian Bergmann.</span><br><span class="line"></span><br><span class="line">..F</span><br><span class="line"></span><br><span class="line">Time: 0 seconds</span><br><span class="line"></span><br><span class="line">There was 1 failure:</span><br><span class="line"></span><br><span class="line">1) DataProviderExampleTest::testItemIsCorrectColour with data set &quot;sky-is-blue&quot; (&#39;sky is blue&#39;, &#39;sky&#39;, &#39;grey&#39;)</span><br><span class="line">Failed asserting that two strings are equal.</span><br><span class="line">--- Expected</span><br><span class="line">+++ Actual</span><br><span class="line">@@ @@</span><br><span class="line">-blue</span><br><span class="line">+grey</span><br><span class="line"></span><br><span class="line">&#x2F;Users&#x2F;tim&#x2F;Desktop&#x2F;DataProviderExampleTest.php:12</span><br><span class="line"></span><br><span class="line">FAILURES!</span><br><span class="line">Tests: 3, Assertions: 6, Failures: 1.</span><br></pre></td></tr></table></figure><p>Here’s the testdox output:</p><figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">% phpunit --testdox DataProviderExampleTest.php</span><br><span class="line">PHPUnit 3.4.3 by Sebastian Bergmann.</span><br><span class="line"></span><br><span class="line">DataProviderExample</span><br><span class="line"> [ ] Item is correct colour</span><br></pre></td></tr></table></figure><p>In previous versions of PHPUnit there used to be more info…</p><p>in <code>PHPUnit_Util_TestDox_ResultPrinter</code> change the following line (246) from (part of the startTest function)</p><p>from:</p><figure class="highlight php"><table><tr><td class="code"><pre><span class="line"><span class="keyword">$this</span>-&gt;currentTestMethodPrettified = <span class="keyword">$this</span>-&gt;prettifier-&gt;prettifyTestMethod($test-&gt;getName(<span class="keyword">FALSE</span>));</span><br></pre></td></tr></table></figure><p>to:</p><figure class="highlight php"><table><tr><td class="code"><pre><span class="line"><span class="keyword">$this</span>-&gt;currentTestMethodPrettified = <span class="keyword">$this</span>-&gt;prettifier-&gt;prettifyTestMethod($test-&gt;getName());</span><br></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">% phpunit --testdox DataProviderExampleTest.php</span><br><span class="line">PHPUnit 3.4.3 by Sebastian Bergmann.</span><br><span class="line"></span><br><span class="line">DataProviderExample</span><br><span class="line"> [x] Item is correct colour with data set &quot;apple-is-green&quot;</span><br><span class="line"> [x] Item is correct colour with data set &quot;apple-is-red&quot;</span><br><span class="line"> [ ] Item is correct colour with data set &quot;sky-is-blue&quot;</span><br></pre></td></tr></table></figure><p>much better.</p>]]></content>
    
    <summary type="html">
    
      
      
        &lt;p&gt;Probably the geekiest and most obscure blog post title I’ll ever write, but we’ll see!&lt;/p&gt;
&lt;figure class=&quot;highlight php&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td c
      
    
    </summary>
    
    
    
      <category term="PHP" scheme="https://twisty.com/bandwagon/archives/categories/php/"/>
    
  </entry>
  
  <entry>
    <title>Import Ricoh GX100 RAW files into Apple’s Aperture in MacOS 10.5 Leopard</title>
    <link href="https://twisty.com/bandwagon/archives/2007/11/16/175701/"/>
    <id>https://twisty.com/bandwagon/archives/2007/11/16/175701/</id>
    <published>2007-11-16T17:57:01.000Z</published>
    <updated>2020-04-18T20:57:17.000Z</updated>
    
    <content type="html"><![CDATA[<p>Here’s a little hack to enable you to use Ricoh GX100 RAW files in Apple’s Aperture.</p><p>Make a backup of the following file:</p><figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">&#x2F;System&#x2F;Library&#x2F;CoreServices&#x2F;RawCamera.bundle&#x2F;Contents&#x2F;Resources&#x2F;Raw.plist</span><br></pre></td></tr></table></figure><p>Find the key for the Leica D-LUX 3 (line 3316 in MacOS 10.5.1):</p><figure class="highlight xml"><table><tr><td class="code"><pre><span class="line">3316: <span class="tag">&lt;<span class="name">key</span>&gt;</span>Leica D-LUX 3<span class="tag">&lt;/<span class="name">key</span>&gt;</span> <span class="tag">&lt;<span class="name">string</span>&gt;</span>Panasonic DMC-LX2<span class="tag">&lt;/<span class="name">string</span>&gt;</span> <span class="comment">&lt;!-- 10.4.10 --&gt;</span></span><br></pre></td></tr></table></figure><p>Then insert the following line before the line showing the Leica D-LUX 3:</p><figure class="highlight xml"><table><tr><td class="code"><pre><span class="line">3316: <span class="tag">&lt;<span class="name">key</span>&gt;</span>RICOH Caplio GX100<span class="tag">&lt;/<span class="name">key</span>&gt;</span> <span class="tag">&lt;<span class="name">string</span>&gt;</span>Panasonic DMC-LX2<span class="tag">&lt;/<span class="name">string</span>&gt;</span></span><br><span class="line">3317: <span class="tag">&lt;<span class="name">key</span>&gt;</span>Leica D-LUX 3<span class="tag">&lt;/<span class="name">key</span>&gt;</span> <span class="tag">&lt;<span class="name">string</span>&gt;</span>Panasonic DMC-LX2<span class="tag">&lt;/<span class="name">string</span>&gt;</span> <span class="comment">&lt;!-- 10.4.10 --&gt;</span></span><br></pre></td></tr></table></figure><p>You should now be able to use the Ricoh’s RAW files in Aperture.</p><p>This is based on a previous hack (<a href="http://forums.dpreview.com/forums/read.asp?forum=1013&amp;message=23723763">detailed here</a>), which doesn&#8217;t apply to Leopard.</p>]]></content>
    
    <summary type="html">
    
      
      
        &lt;p&gt;Here’s a little hack to enable you to use Ricoh GX100 RAW files in Apple’s Aperture.&lt;/p&gt;
&lt;p&gt;Make a backup of the following file:&lt;/p&gt;
&lt;fig
      
    
    </summary>
    
    
    
      <category term="Mac" scheme="https://twisty.com/bandwagon/archives/categories/mac-os-x/"/>
    
      <category term="Apple" scheme="https://twisty.com/bandwagon/archives/categories/apple/"/>
    
  </entry>
  
  <entry>
    <title>Bristol City Council’s Planning application documents only viewable using Internet Explorer</title>
    <link href="https://twisty.com/bandwagon/archives/2007/08/01/104320/"/>
    <id>https://twisty.com/bandwagon/archives/2007/08/01/104320/</id>
    <published>2007-08-01T09:43:20.000Z</published>
    <updated>2020-04-18T20:57:17.000Z</updated>
    
    <content type="html"><![CDATA[<p>From Britol City Council’s <a href="http://www.bristol.gov.uk/ccm/content/Environment-Planning/Planning/publicaccess-for-planning.en">PublicAccess for Planning</a> page:</p><blockquote><p>Please note that the documents within PublicAccess can only be accessed by using Internet Explorer. This is due to a limitation within the system which has been raised with the suppliers.</p></blockquote><p>Not good enough. Here’s form I knocked-up in about 2 minutes that gives users of other browsers access to associated planning documents. The associated documents are things like supporting letters, photographs, a copy of the application form etc.</p><p>Enter a planning application number to view any supporting documents.</p><form action="http://e2edocs.bristol-city.gov.uk/WAM/findCaseFile.do" method="get" accept-charset="utf-8"><input type="hidden" name="appName" value="planning" id="appName"/><label for="appNumber">Application number</label><input type="text" name="appNumber" value="" id="appNumber" placeholder="e.g. 02/00001/FUL" /><input type="submit" value="Show Documents" /></form><hr><p><strong>Update: 21 June 2016.</strong> Unsurprisingly, this search box doesn’t work any more. There is now an updated “<a href="http://planningonline.bristol.gov.uk/online-applications/search.do?action=simple">Simple Search</a>” form that works okay on desktop browsers.</p><p>Here is the original code for posterity.</p><figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">form</span> <span class="attr">action</span>=<span class="string">"http://e2edocs.bristol-city.gov.uk/WAM/findCaseFile.do"</span> <span class="attr">method</span>=<span class="string">"get"</span> <span class="attr">accept-charset</span>=<span class="string">"utf-8"</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">"hidden"</span> <span class="attr">name</span>=<span class="string">"appName"</span> <span class="attr">value</span>=<span class="string">"planning"</span> <span class="attr">id</span>=<span class="string">"appName"</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">label</span> <span class="attr">for</span>=<span class="string">"appNumber"</span>&gt;</span>Application number<span class="tag">&lt;/<span class="name">label</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">"text"</span> <span class="attr">name</span>=<span class="string">"appNumber"</span> <span class="attr">value</span>=<span class="string">""</span> <span class="attr">id</span>=<span class="string">"appNumber"</span> <span class="attr">placeholder</span>=<span class="string">"e.g. 02/00001/FUL"</span> /&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">"submit"</span> <span class="attr">value</span>=<span class="string">"Show Documents"</span> /&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">form</span>&gt;</span></span><br></pre></td></tr></table></figure>]]></content>
    
    <summary type="html">
    
      
      
        &lt;p&gt;From Britol City Council’s &lt;a href=&quot;http://www.bristol.gov.uk/ccm/content/Environment-Planning/Planning/publicaccess-for-planning.en&quot;&gt;Pub
      
    
    </summary>
    
    
    
      <category term="Bristol" scheme="https://twisty.com/bandwagon/archives/categories/bristol/"/>
    
  </entry>
  
  <entry>
    <title>ActionScript trim function</title>
    <link href="https://twisty.com/bandwagon/archives/2007/07/23/162642/"/>
    <id>https://twisty.com/bandwagon/archives/2007/07/23/162642/</id>
    <published>2007-07-23T15:26:42.000Z</published>
    <updated>2020-04-18T20:57:17.000Z</updated>
    
    <content type="html"><![CDATA[<p>ActionScript 2.0 doesn’t have a <code>trim</code> function to strip whitespace from the start and end of a string. Here’s a simple function I wrote because I couldn’t find a satisfactory example on Google!</p><figure class="highlight actionscript"><table><tr><td class="code"><pre><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">trim</span><span class="params">(str:String)</span>:String</span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">    <span class="keyword">var</span> stripCharCodes = &#123;</span><br><span class="line">        code_9  : <span class="literal">true</span>, <span class="comment">// tab</span></span><br><span class="line">        code_10 : <span class="literal">true</span>, <span class="comment">// linefeed</span></span><br><span class="line">        code_13 : <span class="literal">true</span>, <span class="comment">// return</span></span><br><span class="line">        code_32 : <span class="literal">true</span>  <span class="comment">// space</span></span><br><span class="line">    &#125;;</span><br><span class="line">    <span class="keyword">while</span>(stripCharCodes[<span class="string">"code_"</span> + str.charCodeAt(<span class="number">0</span>)] == <span class="literal">true</span>) &#123;</span><br><span class="line">        str = str.substring(<span class="number">1</span>, str.length);</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">while</span>(stripCharCodes[<span class="string">"code_"</span> + str.charCodeAt(str.length - <span class="number">1</span>)] == <span class="literal">true</span>) &#123;</span><br><span class="line">        str = str.substring(<span class="number">0</span>, str.length - <span class="number">1</span>);</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">return</span> str;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p>The horrible <code>&quot;code_&quot;</code> prefix hack is there because I don’t think there’s a native way to search an array or object for a key or value in ActionScript.</p><p><ins>Update:</ins> just found this function at: <a href="http://www.frogstyle.ch/p.cfm?s=18">frogstyle.ch</a>. This one does a similar thing, but strips more characters.</p><figure class="highlight actionscript"><table><tr><td class="code"><pre><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">trim</span><span class="params">(str:String)</span>:String</span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">    <span class="keyword">for</span>(<span class="keyword">var</span> i = <span class="number">0</span>; str.charCodeAt(i) &lt; <span class="number">33</span>; i++);</span><br><span class="line">    <span class="keyword">for</span>(<span class="keyword">var</span> j = str.length<span class="number">-1</span>; str.charCodeAt(j) &lt; <span class="number">33</span>; j--);</span><br><span class="line">    <span class="keyword">return</span> str.substring(i, j+<span class="number">1</span>);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p><ins>Update:</ins> <a href="http://code.google.com/p/as3corelib/">as3corelib</a> has a static trim method in <code>com.adobe.utils.StringUtil</code>.</p>]]></content>
    
    <summary type="html">
    
      
      
        &lt;p&gt;ActionScript 2.0 doesn’t have a &lt;code&gt;trim&lt;/code&gt; function to strip whitespace from the start and end of a string. Here’s a simple functi
      
    
    </summary>
    
    
    
      <category term="Flash" scheme="https://twisty.com/bandwagon/archives/categories/flash/"/>
    
  </entry>
  
  <entry>
    <title>array_mode</title>
    <link href="https://twisty.com/bandwagon/archives/2007/05/03/104903/"/>
    <id>https://twisty.com/bandwagon/archives/2007/05/03/104903/</id>
    <published>2007-05-03T09:49:03.000Z</published>
    <updated>2020-04-18T20:57:17.000Z</updated>
    
    <content type="html"><![CDATA[<p>If you’ve ever needed to get calculate a mode value in php, you’ll notice that there isn’t a native function to do so.</p><p>I couldn’t get the function in Pear’s <a href="http://pear.php.net/package/Math_Stats/" title="PEAR :: Package :: Math_Stats">Math_Statistics</a> to work with non-numeric values, so here’s a function that does.</p><figure class="highlight php"><table><tr><td class="code"><pre><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * Calculates the frequently occuring value(s) in an array.</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span>  array $data</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span> array</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">array_mode</span><span class="params">($data)</span></span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">    <span class="keyword">if</span>(!is_array($data)) &#123;</span><br><span class="line">        <span class="keyword">throw</span> <span class="keyword">new</span> <span class="keyword">Exception</span>(<span class="string">'First argument $data must be an array.'</span>);</span><br><span class="line">    &#125;</span><br><span class="line">    $frequencies = array_count_values($data);</span><br><span class="line">    <span class="comment">// Double-check that frequencies are sorted in reverse order,</span></span><br><span class="line">    <span class="comment">// I think array_count_values actually returns in this format</span></span><br><span class="line">    <span class="comment">// already, but the manual doesn't mention it.</span></span><br><span class="line">    arsort($frequencies);</span><br><span class="line">    $isFirst = <span class="keyword">true</span>; <span class="comment">// Yuk</span></span><br><span class="line">    $mode = <span class="keyword">array</span>();</span><br><span class="line">    <span class="keyword">foreach</span> ($frequencies <span class="keyword">as</span> $thisValue=&gt;$thisFrequency) &#123;</span><br><span class="line">        <span class="keyword">if</span> ($isFirst == <span class="keyword">true</span>) &#123;</span><br><span class="line">            $isFirst = <span class="keyword">false</span>; <span class="comment">// Wince</span></span><br><span class="line">            $mode[] = $thisValue;</span><br><span class="line">            $modeFrequency = $thisFrequency;</span><br><span class="line">            <span class="keyword">continue</span>;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">if</span> ($modeFrequency == $thisFrequency) &#123;</span><br><span class="line">            $mode[] = $thisValue;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">if</span> ($modeFrequency &gt; $thisFrequency) &#123;</span><br><span class="line">            <span class="keyword">break</span>;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">return</span> $mode;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">var_dump(array_mode(<span class="keyword">array</span>(<span class="string">'a'</span>, <span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>, <span class="string">'d'</span>)));</span><br><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">array(1) &#123;</span></span><br><span class="line"><span class="comment">  [0]=&gt;</span></span><br><span class="line"><span class="comment">  string(1) "a"</span></span><br><span class="line"><span class="comment">&#125;</span></span><br><span class="line"><span class="comment">*/</span></span><br><span class="line"></span><br><span class="line">var_dump(array_mode(<span class="keyword">array</span>(<span class="string">'a'</span>, <span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>)));</span><br><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">array(2) &#123;</span></span><br><span class="line"><span class="comment">  [0]=&gt;</span></span><br><span class="line"><span class="comment">  string(1) "a"</span></span><br><span class="line"><span class="comment">  [1]=&gt;</span></span><br><span class="line"><span class="comment">  string(1) "b"</span></span><br><span class="line"><span class="comment">&#125;</span></span><br><span class="line"><span class="comment">*/</span></span><br></pre></td></tr></table></figure>]]></content>
    
    <summary type="html">
    
      
      
        &lt;p&gt;If you’ve ever needed to get calculate a mode value in php, you’ll notice that there isn’t a native function to do so.&lt;/p&gt;
&lt;p&gt;I couldn’t 
      
    
    </summary>
    
    
    
      <category term="PHP" scheme="https://twisty.com/bandwagon/archives/categories/php/"/>
    
  </entry>
  
  <entry>
    <title>Magners</title>
    <link href="https://twisty.com/bandwagon/archives/2007/04/29/103203/"/>
    <id>https://twisty.com/bandwagon/archives/2007/04/29/103203/</id>
    <published>2007-04-29T09:32:03.000Z</published>
    <updated>2020-04-18T20:57:17.000Z</updated>
    
    <content type="html"><![CDATA[<p><a href="http://www.flickr.com/photos/i_y_e_r_s/474471473/" title="photo sharing"><img src="http://farm1.static.flickr.com/178/474471473_febbb1e3c8.jpg" alt=""></a></p><p><a href="http://www.flickr.com/photos/i_y_e_r_s/474471473/">mankners…</a>, originally uploaded by <a href="http://www.flickr.com/people/i_y_e_r_s/">i y e r s</a>.</p><p>My thoughts precisely. It’s depressing how this stuff has become so popular when there’s such a variety of decent local cider producers within a 25 mile radius of Bristol.</p><p>Given the food-miles accumulated importing apples from the <a href="http://news.independent.co.uk/business/news/article1269438.ece">UK, France and the Netherlands</a> to Ireland and shipping them back as cider, its a tad ironic that they have to <a href="http://www.dailymail.co.uk/pages/live/articles/news/news.html?in_article_id=394737&amp;in_page_id=1770">import CO<sub>2</sub> from Poland</a> to make it fizzy.</p>]]></content>
    
    <summary type="html">
    
      
      
        &lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/i_y_e_r_s/474471473/&quot; title=&quot;photo sharing&quot;&gt;&lt;img src=&quot;http://farm1.static.flickr.com/178/474471473_
      
    
    </summary>
    
    
    
      <category term="Bristol" scheme="https://twisty.com/bandwagon/archives/categories/bristol/"/>
    
  </entry>
  
  <entry>
    <title>iPhone</title>
    <link href="https://twisty.com/bandwagon/archives/2007/01/12/021649/"/>
    <id>https://twisty.com/bandwagon/archives/2007/01/12/021649/</id>
    <published>2007-01-12T02:16:49.000Z</published>
    <updated>2020-04-18T20:57:17.000Z</updated>
    
    <content type="html"><![CDATA[<p>Remove the phone cruft; add some sensible storage for a media player, and I’ll buy one!</p><hr><p><strong>Update: June 21, 2016.</strong> This was posted 3 days after the iPhone was <em>announced</em> in 2007 (it was released 8 months later in the UK, exclusively with a contract on o2). By then, Apple had released the <a href="https://en.wikipedia.org/wiki/IPod_Touch">iPod Touch</a>, which was just what I was after: an iPhone without the phone, better storage, thinner, lighter and less expensive. I bought one.</p><p>Steve Jobs remarked that the iPod Touch was “training wheels for iPhone”, and sure enough I eventually graduated to an iPhone. I bought a two-year-old iPhone 4S in 2013 and while it’s getting a bit long in the tooth, it’s still going strong.</p>]]></content>
    
    <summary type="html">
    
      
      
        &lt;p&gt;Remove the phone cruft; add some sensible storage for a media player, and I’ll buy one!&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Update: June 21, 2016.&lt;/stron
      
    
    </summary>
    
    
    
      <category term="Mac" scheme="https://twisty.com/bandwagon/archives/categories/mac-os-x/"/>
    
      <category term="Apple" scheme="https://twisty.com/bandwagon/archives/categories/apple/"/>
    
  </entry>
  
  <entry>
    <title>My Macworld Wishes</title>
    <link href="https://twisty.com/bandwagon/archives/2007/01/08/011553/"/>
    <id>https://twisty.com/bandwagon/archives/2007/01/08/011553/</id>
    <published>2007-01-08T01:15:53.000Z</published>
    <updated>2020-04-18T20:57:17.000Z</updated>
    
    <content type="html"><![CDATA[<p>Everyone seems to be up to it at the moment, so here’s what I’d like to see announced at Macworld Expo this year…</p><ol><li>A refund to anyone that has ever paid money for .mac<br>That’s all.</li></ol>]]></content>
    
    <summary type="html">
    
      
      
        &lt;p&gt;Everyone seems to be up to it at the moment, so here’s what I’d like to see announced at Macworld Expo this year…&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;A refund t
      
    
    </summary>
    
    
    
      <category term="Mac" scheme="https://twisty.com/bandwagon/archives/categories/mac-os-x/"/>
    
  </entry>
  
  <entry>
    <title>Happy Day of Slav Letters in Bulgaria</title>
    <link href="https://twisty.com/bandwagon/archives/2006/05/24/114740/"/>
    <id>https://twisty.com/bandwagon/archives/2006/05/24/114740/</id>
    <published>2006-05-24T10:47:40.000Z</published>
    <updated>2020-04-18T20:57:17.000Z</updated>
    
    <content type="html"><![CDATA[<p>Today is the “Day of Slav Letters in Bulgaria”. I’m not Bulgarian, and have never been there, and definitely can’t spell your name in Bulgarian for a school project. I just like the idea of holding a national holiday to celebrate letter-forms and <a href="http://en.wikipedia.org/wiki/Saints_Cyril_and_Methodius">their creators</a>, like <a href="http://www.twisty.com/bandwagon/archives/2003/10/09/200339">Korean Alphabet Day</a>.</p>]]></content>
    
    <summary type="html">
    
      
      
        &lt;p&gt;Today is the “Day of Slav Letters in Bulgaria”. I’m not Bulgarian, and have never been there, and definitely can’t spell your name in Bul
      
    
    </summary>
    
    
    
      <category term="Foo" scheme="https://twisty.com/bandwagon/archives/categories/foo/"/>
    
      <category term="Typography" scheme="https://twisty.com/bandwagon/archives/categories/typography/"/>
    
  </entry>
  
  <entry>
    <title>Preview Markdown Documents in BBEdit</title>
    <link href="https://twisty.com/bandwagon/archives/2005/10/31/195241/"/>
    <id>https://twisty.com/bandwagon/archives/2005/10/31/195241/</id>
    <published>2005-10-31T19:52:41.000Z</published>
    <updated>2020-04-18T20:57:17.000Z</updated>
    
    <content type="html"><![CDATA[<p>A quickie: here&#8217;s a way of directly previewing <a href="http://daringfireball.net/projects/markdown/">Markdown</a> documents in the <a href="http://www.barebones.com/products/bbedit/">BBEdit</a> preview window using <a href="http://www.php.net/">PHP</a>. (Inspired by this <a href="http://blog.mostrom.pp.se/?p=63" title="Preview Markdown documents using BBEdit">Python method</a> that does the same thing).</p><ol><li>Make a template file (you&#8217;ll probably want to add some styles to this).</li></ol><figure class="highlight html"><figcaption><span>~/Sites/markdown-preview/template.html</span></figcaption><table><tr><td class="code"><pre><span class="line"><span class="meta">&lt;!DOCTYPE <span class="meta-keyword">html</span> <span class="meta-keyword">PUBLIC</span> <span class="meta-string">"-//W3C//DTD XHTML 1.1//EN"</span></span></span><br><span class="line"><span class="meta">        <span class="meta-string">"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">html</span> <span class="attr">xmlns</span>=<span class="string">"http://www.w3.org/1999/xhtml"</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">head</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">"content-type"</span> <span class="attr">content</span>=<span class="string">"text/html; charset=utf-8"</span> /&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">title</span>&gt;</span>Markdown Preview<span class="tag">&lt;/<span class="name">title</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">head</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">body</span>&gt;</span></span><br><span class="line">##markdown##</span><br><span class="line"><span class="tag">&lt;/<span class="name">body</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">html</span>&gt;</span></span><br></pre></td></tr></table></figure><ol start="2"><li>Make the php file, and follow the instructions in the PHP comments.</li></ol><figure class="highlight php"><figcaption><span>~/Sites/markdown-preview/index.php</span></figcaption><table><tr><td class="code"><pre><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line"></span><br><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment"> * Download these and put them somewhere in your php path:</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> *     [http://www.michelf.com/projects/php-markdown/](http://www.michelf.com/projects/php-markdown/)</span></span><br><span class="line"><span class="comment"> *     [http://www.michelf.com/projects/php-smartypants/](http://www.michelf.com/projects/php-smartypants/)</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">include_once</span> <span class="string">'markdown.php'</span>;</span><br><span class="line"><span class="keyword">include_once</span> <span class="string">'smartypants.php'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment"> * You'll need to change this:</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line">$markdownDocsDir = <span class="keyword">isset</span> ($_SERVER[<span class="string">'MARKDOWN_DOCS_DIR'</span>]) ? $_SERVER[<span class="string">'MARKDOWN_DOCS_DIR'</span>] : <span class="string">'/Users/username/Documents'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment"> * You'll need to set up BBEdit to use something like this as the Preview Server URL:</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> *     http://localhost/markdown-preview/?file=/</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line">$file = $_GET[<span class="string">'file'</span>];</span><br><span class="line">$text = file_get_contents ($markdownDocsDir . $file);</span><br><span class="line">$formatted = SmartyPants(Markdown($text), <span class="string">'2'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment"> * Display the formatted text via a simple template.</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line">$templateFile = <span class="string">'./template.html'</span>;</span><br><span class="line">$templateText = file_exists ($templateFile) ? file_get_contents ($templateFile) : <span class="string">"##markdown##"</span>;</span><br><span class="line"><span class="keyword">echo</span> (str_replace (<span class="string">'##markdown##'</span>, $formatted, $templateText));</span><br><span class="line"></span><br><span class="line"><span class="meta">?&gt;</span></span><br></pre></td></tr></table></figure>]]></content>
    
    <summary type="html">
    
      
      
        &lt;p&gt;A quickie: here&amp;#8217;s a way of directly previewing &lt;a href=&quot;http://daringfireball.net/projects/markdown/&quot;&gt;Markdown&lt;/a&gt; documents in the
      
    
    </summary>
    
    
    
      <category term="Mac" scheme="https://twisty.com/bandwagon/archives/categories/mac-os-x/"/>
    
      <category term="Markup and CSS" scheme="https://twisty.com/bandwagon/archives/categories/markup-and-css/"/>
    
      <category term="PHP" scheme="https://twisty.com/bandwagon/archives/categories/php/"/>
    
  </entry>
  
  <entry>
    <title>Finding Time to Exercise</title>
    <link href="https://twisty.com/bandwagon/archives/2005/08/23/014337/"/>
    <id>https://twisty.com/bandwagon/archives/2005/08/23/014337/</id>
    <published>2005-08-23T00:43:37.000Z</published>
    <updated>2020-04-18T20:57:17.000Z</updated>
    
    <content type="html"><![CDATA[<p>I&#8217;m down to less than 200 feeds in NetNewsWire now after culling a few <a href="http://ranchero.com/netnewswire/features/dinosaurs.php">dinosaurs</a> and thinning-out a few sorry specimens.</p><p>I&#8217;ve just <a href="http://www.gyford.com/phil/writing/2005/08/01/slimming_for_aug.php">unsubscribed</a> from the increasingly inane <a href="http://www.lifehacker.com/">Lifehacker</a> (cf. <a href="http://www.lifehacker.com/software/life-hacks/findingyourcar-hacks-118196.php">Finding-Your-Car</a> and <a href="http://www.lifehacker.com/software/food/c8h10n4o2-and-all-that-117989.php">Coffee tips</a>) after reading <a href="http://www.lifehacker.com/software/health/finding-time-to-exercise-118251.php">this little gem</a>:</p><blockquote><p>You’re busy. Your life is a hectic mess. How do you find time to get some exercise? Here are a few tips from Maria Gracia of GetOrganizedNow.com.</p><blockquote><ul><li>Skip the escalator and elevator. Take the stairs.</li><li>Park at least a block away from work or get off the bus/train a few stops early. Walk the rest of the way.</li><li>Rather than meeting with a friend for lunch, consider going biking, roller blading or swimming together instead.</li><li>Do some calisthenics or ride a stationary bike while watching your favorite television program.</li><li>Do some simple stretches, while you’re on the telephone and you’re on hold.</li><li>Schedule just 10 minutes of exercise per day on your calendar. By the time to month is over, you will have exercised over 300 minutes!</li></ul></blockquote></blockquote><p>If your life was a &#8220;hectic mess&#8221;, and you were <em>riding a stationary bike</em> while watching your favourite television program, would you really feel any better about getting your busy hectic mess of a life under control? Well, that&#8217;s almost irrelevant because you&#8217;ve got at least <em>10 minutes</em> of exercise scheduled for tomorrow and you can enjoy as many <em>simple stretches</em> as you&rsquo;ve got minutes on-hold.</p>]]></content>
    
    <summary type="html">
    
      
      
        &lt;p&gt;I&amp;#8217;m down to less than 200 feeds in NetNewsWire now after culling a few &lt;a href=&quot;http://ranchero.com/netnewswire/features/dinosaurs.
      
    
    </summary>
    
    
    
      <category term="Foo" scheme="https://twisty.com/bandwagon/archives/categories/foo/"/>
    
      <category term="GTD" scheme="https://twisty.com/bandwagon/archives/categories/productivity/"/>
    
  </entry>
  
  <entry>
    <title>Quicksilver and Mac OS 10.4’s Dictionary</title>
    <link href="https://twisty.com/bandwagon/archives/2005/08/22/172703/"/>
    <id>https://twisty.com/bandwagon/archives/2005/08/22/172703/</id>
    <published>2005-08-22T16:27:03.000Z</published>
    <updated>2020-04-18T20:57:17.000Z</updated>
    
    <content type="html"><![CDATA[<p>A little tip: how to use Quicksilver to look-up words in Tiger&#8217;s Dictionary app.</p><p>First install and configure the software:</p><ol><li>Install <a href="http://www.apple.com/macosx/">Tiger</a> and <a href="http://quicksilver.blacktree.com/">Quicksilver</a></li><li>In Quicksilver&#8217;s preferences, install the &#8220;Services Menu Module&#8221;</li></ol><p>Then, whenever you want to look-up a word in the dictionary, do this:</p><ol><li>Summon Quicksilver (usually with <kbd title="Command">&#8984;</kbd> + <kbd>Space</kbd>).</li><li>Type &#8220;<kbd lang="en-gb" title="Full point">.</kbd>&#8221; to start typing into the variable input field.</li><li>Type or paste the word you want to look-up and then <kbd>tab</kbd> to the next pane.</li><li>Start typing &#8220;dictionary&#8221; until &#8220;Look up in Dictionary&#8221; is active.</li><li>Press <kbd>return</kbd>.</li></ol><p>At this point the Dictionary application should launch and try to find your word.</p><p>If you&#8217;ve made it to here you might enjoy Merlin Mann&#8217;s <a href="http://www.43folders.com/quicksilver/index.html">Quicksilver tips</a> at <a href="http://www.43folders.com/">43 Folders</a> and John Gruber&rsquo;s <a href="http://daringfireball.net/2005/05/dictionary_bbedit">in-depth tips about invoking the Dictionary</a> at <a href="http://daringfireball.net/">Daring Fireball</a>.</p>]]></content>
    
    <summary type="html">
    
      
      
        &lt;p&gt;A little tip: how to use Quicksilver to look-up words in Tiger&amp;#8217;s Dictionary app.&lt;/p&gt;
&lt;p&gt;First install and configure the software:&lt;/
      
    
    </summary>
    
    
    
      <category term="Mac" scheme="https://twisty.com/bandwagon/archives/categories/mac-os-x/"/>
    
      <category term="GTD" scheme="https://twisty.com/bandwagon/archives/categories/productivity/"/>
    
  </entry>
  
  <entry>
    <title>Weird Google Comment Spam</title>
    <link href="https://twisty.com/bandwagon/archives/2005/08/18/113730/"/>
    <id>https://twisty.com/bandwagon/archives/2005/08/18/113730/</id>
    <published>2005-08-18T10:37:30.000Z</published>
    <updated>2020-04-18T20:57:17.000Z</updated>
    
    <content type="html"><![CDATA[<p>Some of the comment spam I get on this site is bewildering, but this one takes the biscuit. Given that most comment spam attempts to boost the spammer’s Google <a href="http://www.google.com/intl/en/technology/">PageRank</a><acronym title="Totally Meaningless">â„¢</acronym> by inserting links to their own sites, I just can’t see the motivation for this:</p><blockquote><pre class="wrap">IP Address: 205.236.34.1Name: search engineEmail Address: google@yahoo.nlURL: http://www.google.comComment:i come from [best search engine](http://www.google.com) http://www.google.com</pre></blockquote>]]></content>
    
    <summary type="html">
    
      
      
        &lt;p&gt;Some of the comment spam I get on this site is bewildering, but this one takes the biscuit. Given that most comment spam attempts to boos
      
    
    </summary>
    
    
    
      <category term="Personal Publishing" scheme="https://twisty.com/bandwagon/archives/categories/personal-publishing/"/>
    
  </entry>
  
  <entry>
    <title>Balloons</title>
    <link href="https://twisty.com/bandwagon/archives/2005/08/15/113312/"/>
    <id>https://twisty.com/bandwagon/archives/2005/08/15/113312/</id>
    <published>2005-08-15T10:33:12.000Z</published>
    <updated>2020-04-18T20:57:17.000Z</updated>
    
    <content type="html"><![CDATA[<p>It was <a href="http://www.bristolfiesta.co.uk/">Bristol International Balloon Fiesta</a> this week. I’ve uploaded a <a href="http://www.ourmedia.org/node/42567">time-lapse video clip of hot air balloons</a> floating past my kitchen window (don’t worry it’s only 18 seconds long!).</p><p>I used <a href="http://www.ourmedia.org/">Ourmedia.org</a> to host it:</p><blockquote><p>[…] free storage and free bandwidth for your videos, audio files, photos, text or software. Forever. No catches.</p></blockquote><p>(Their video embedding code <a href="http://www.ourmedia.org/node/26042">is broken</a> for all of the browsers on my Mac. Hopefully they should have it fixed soon. Here’s a <a href="http://www.archive.org/download/Hotair_balloon_timelapse/balloons.mp4">direct link to the video</a>.)</p>]]></content>
    
    <summary type="html">
    
      
      
        &lt;p&gt;It was &lt;a href=&quot;http://www.bristolfiesta.co.uk/&quot;&gt;Bristol International Balloon Fiesta&lt;/a&gt; this week. I’ve uploaded a &lt;a href=&quot;http://www.
      
    
    </summary>
    
    
    
      <category term="Bristol" scheme="https://twisty.com/bandwagon/archives/categories/bristol/"/>
    
      <category term="Personal Publishing" scheme="https://twisty.com/bandwagon/archives/categories/personal-publishing/"/>
    
  </entry>
  
  <entry>
    <title>How to run a script to do useful stuff when you plug-in your iPod</title>
    <link href="https://twisty.com/bandwagon/archives/2005/07/03/010802/"/>
    <id>https://twisty.com/bandwagon/archives/2005/07/03/010802/</id>
    <published>2005-07-03T00:08:02.000Z</published>
    <updated>2020-04-18T20:57:17.000Z</updated>
    
    <content type="html"><![CDATA[<pre><code>&lt;span class=&quot;comment&quot;&gt;-- This is a Folder Actions AppleScript that triggers an-- event when a disk (like an iPod) is mounted by the-- System. I use it to run a compiled Automator workflow that-- backs-up my Keychains, and copies my GTD lists to the-- iPod notes folder.-- -- To run it you should tweak the script accordingly, and add it-- as a Folder Action to the &quot;/Volumes&quot; folder. It isn&apos;t-- exactly obvious how to do this, so here&apos;s how:-- -- 1\. Open the &quot;Folder Actions Setup&quot; app.-- 2\. Click the &apos;+&apos; button to add a new Folder Action.-- 3\. The &quot;/Volumes&quot; directory is hidden from view. Don&apos;t click--    anything, type &quot;/Volumes&quot; to get to it.-- 4\. Add this script as a Folder Action.&lt;/span&gt;&lt;span class=&quot;language-keywords&quot;&gt;on&lt;/span&gt; &lt;span class=&quot;application-keywords&quot;&gt;adding folder items to&lt;/span&gt; &lt;var&gt;thisFolder&lt;/var&gt; &lt;span class=&quot;application-keywords&quot;&gt;after receiving&lt;/span&gt; &lt;var&gt;addedItems&lt;/var&gt;    &lt;span class=&quot;language-keywords&quot;&gt;set&lt;/span&gt; &lt;var&gt;volumeName&lt;/var&gt; &lt;span class=&quot;language-keywords&quot;&gt;to&lt;/span&gt;&lt;span&gt; &quot;Tim Brayshaw&apos;s iPod&quot;&lt;/span&gt; &lt;span class=&quot;comment&quot;&gt;-- change this!&lt;/span&gt;    &lt;span class=&quot;language-keywords&quot;&gt;repeat&lt;/span&gt; &lt;span class=&quot;language-keywords&quot;&gt;with&lt;/span&gt; &lt;var&gt;addedItem&lt;/var&gt; &lt;span class=&quot;language-keywords&quot;&gt;in&lt;/span&gt; &lt;var&gt;addedItems&lt;/var&gt;        &lt;span class=&quot;language-keywords&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;language-keywords&quot;&gt;the&lt;/span&gt; &lt;span class=&quot;application-keywords&quot;&gt;displayed name&lt;/span&gt; &lt;span class=&quot;language-keywords&quot;&gt;of&lt;/span&gt; &lt;span class=&quot;operator&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;application-keywords&quot;&gt;info for&lt;/span&gt; &lt;var&gt;addedItem&lt;/var&gt;&lt;span class=&quot;operator&quot;&gt;)&lt;/span&gt; &amp;not;            &lt;span class=&quot;language-keywords&quot;&gt;is&lt;/span&gt; &lt;span class=&quot;language-keywords&quot;&gt;equal to&lt;/span&gt; &lt;var&gt;volumeName&lt;/var&gt; &lt;span class=&quot;language-keywords&quot;&gt;then&lt;/span&gt;            &lt;var&gt;volumeMounted&lt;/var&gt;&lt;span class=&quot;operator&quot;&gt;()&lt;/span&gt;            &lt;span class=&quot;language-keywords&quot;&gt;exit&lt;/span&gt; &lt;span class=&quot;language-keywords&quot;&gt;repeat&lt;/span&gt;        &lt;span class=&quot;language-keywords&quot;&gt;end&lt;/span&gt; &lt;span class=&quot;language-keywords&quot;&gt;if&lt;/span&gt;    &lt;span class=&quot;language-keywords&quot;&gt;end&lt;/span&gt; &lt;span class=&quot;language-keywords&quot;&gt;repeat&lt;/span&gt;    &lt;span class=&quot;comment&quot;&gt;-- System Events seems to keep file references open to each of    -- the &quot;addedItems&quot; above, this means you can&apos;t eject these    -- volumes. This bodge quits System Events, so you can eject    -- the added volumes. (System Events gets launched immediately    -- again.)&lt;/span&gt;    &lt;span class=&quot;application-keywords&quot;&gt;quit application&lt;/span&gt; &quot;System Events&quot;&lt;span class=&quot;language-keywords&quot;&gt;end&lt;/span&gt; &lt;span class=&quot;application-keywords&quot;&gt;adding folder items to&lt;/span&gt;&lt;span class=&quot;language-keywords&quot;&gt;on&lt;/span&gt; &lt;var&gt;volumeMounted&lt;/var&gt;&lt;span class=&quot;operator&quot;&gt;()&lt;/span&gt;    &lt;span class=&quot;language-keywords&quot;&gt;tell&lt;/span&gt; &lt;span class=&quot;application-keywords&quot;&gt;application&lt;/span&gt;&lt;span&gt; &quot;Finder&quot;&lt;/span&gt;        &lt;span class=&quot;application-keywords&quot;&gt;open&lt;/span&gt; &lt;span class=&quot;application-keywords&quot;&gt;application&lt;/span&gt;&lt;span&gt; &quot;Update iPod&quot;&lt;/span&gt;    &lt;span class=&quot;language-keywords&quot;&gt;end&lt;/span&gt; &lt;span class=&quot;language-keywords&quot;&gt;tell&lt;/span&gt;&lt;span class=&quot;language-keywords&quot;&gt;end&lt;/span&gt; &lt;var&gt;volumeMounted&lt;/var&gt;</code></pre><p>This should world for other devices like USB thumbdrives, external FireWire disks, Digital Cameras etc. I futzed around trying to figure out how to do this with launchd, but gave up. If anyone knows a better or other way, post a comment!</p><p>I’ve found this useful because it’s removed some backup anxieties, and means I’ve always got my shopping and out-and-about errands lists (and so on) with me when I’m away for the computer. There’s probably a better way of doing this, but it took me an inordinate amount of time to figure it out, so I thought I’d post a code snippet here for like-minded dabblers.</p>]]></content>
    
    <summary type="html">
    
      
      
        &lt;pre&gt;&lt;code&gt;&amp;lt;span class=&amp;quot;comment&amp;quot;&amp;gt;-- This is a Folder Actions AppleScript that triggers an
-- event when a disk (like an iPod
      
    
    </summary>
    
    
    
      <category term="Mac" scheme="https://twisty.com/bandwagon/archives/categories/mac-os-x/"/>
    
      <category term="Software" scheme="https://twisty.com/bandwagon/archives/categories/software/"/>
    
      <category term="GTD" scheme="https://twisty.com/bandwagon/archives/categories/productivity/"/>
    
  </entry>
  
  <entry>
    <title>Google Maps Stockist Finder</title>
    <link href="https://twisty.com/bandwagon/archives/2005/06/30/181525/"/>
    <id>https://twisty.com/bandwagon/archives/2005/06/30/181525/</id>
    <published>2005-06-30T17:15:25.000Z</published>
    <updated>2020-04-18T20:57:17.000Z</updated>
    
    <content type="html"><![CDATA[<p>I&rsquo;ve been playing with the <a href="http://www.google.com/apis/maps/documentation/">Google Maps API</a> this afternoon, and it looks pretty good. I&rsquo;ve knocked-up a <a href="http://www.cardtastic.co.uk/stockists/map/">stockist map</a> for Cardtastic. (For those who don’t know me, Cardtastic is a greeting card company run by my partner, Helen.)</p><p>One problem encountered was <a href="http://groups-beta.google.com/group/Google-Maps-API/browse_thread/thread/fe446d27a0391ac4/f5c6cfcb227df88f">performance is bad when adding lots of markers</a>, we&rsquo;re only adding about 180 markers to the map, and my browser kept alerting that a script was running slowly and asking if I wanted to abort it or continue. Not ideal.</p><p>I&rsquo;ve worked around it by adding a little time between adding the markers to the map so the browser catch its breath again. I&rsquo;ve also grown to quite like the gimmicky animated effect while stockists start popping-up all over the country!</p>]]></content>
    
    <summary type="html">
    
      
      
        &lt;p&gt;I&amp;rsquo;ve been playing with the &lt;a href=&quot;http://www.google.com/apis/maps/documentation/&quot;&gt;Google Maps API&lt;/a&gt; this afternoon, and it look
      
    
    </summary>
    
    
    
      <category term="Markup and CSS" scheme="https://twisty.com/bandwagon/archives/categories/markup-and-css/"/>
    
      <category term="Software" scheme="https://twisty.com/bandwagon/archives/categories/software/"/>
    
  </entry>
  
  <entry>
    <title>Keep on rolling: 3rd June 2005</title>
    <link href="https://twisty.com/bandwagon/archives/2005/06/03/174904/"/>
    <id>https://twisty.com/bandwagon/archives/2005/06/03/174904/</id>
    <published>2005-06-03T16:49:04.000Z</published>
    <updated>2020-04-18T20:57:17.000Z</updated>
    
    <content type="html"><![CDATA[<p>A few links about <acronym title="User Interface">UI</acronym> trends and changes in Tiger.</p><p>Brent Simmons:</p><ul><li><a href="http://inessential.com/?comments=1&amp;postid=3098">OS X user interface trend: goodbye stripes</a></li><li><a href="http://inessential.com/?comments=1&#38;postid=3103">Smart things</a> &ndash; about the lack of convention for creating Smart Lists.</li><li><a href="http://inessential.com/?comments=1&#38;postid=3100">Splitters gone wild</a> &ndash; about the inconsistancy of Window Splitters user interface.</li><li><a href="http://inessential.com/?comments=1&#38;postid=3102">The inexplicable pressed state of the round textured button</a></li><li><a href="http://inessential.com/?comments=1&#38;postid=3099">What I think happened to Mail</a> &ndash; includes some interesting comments about the usability pros and cons of the new toolbar icons.</li><li><a href="http://inessential.com/?comments=1&#38;postid=3104">Capsules are the new new new thing</a></li><li><a href="http://inessential.com/?comments=1&#38;postid=3106">Focus madness</a></li><li><a href="http://inessential.com/?comments=1&#38;postid=3107">Mail and click-through</a></li></ul><p>Michael McCracken:</p><ul><li><a href="http://michael-mccracken.net/blog/blosxom.pl/computers/mac/hypertextLinksAsNativeUI.html">Using Hypertext Links in Native UI</a></li><li><a href="http://michael-mccracken.net/blog/blosxom.pl/computers/mac/TheUIQuestion.html">The Mac UI Question</a></li></ul><p>And more&#8230;</p><ul><li>John Siracusa: <a href="http://arstechnica.com/reviews/os/macosx-10.4.ars/3">Tiger&#8217;s new look</a> &ndash; more about Mail&#8217;s toolbar icons.</li><li>maczealots.com: <a href="http://maczealots.com/reviews/tiger/whats-different/">Mac OS X Tiger: What’s Different</a></li><li>Sven-S. Porst on Apple&#8217;s use <a href="http://earthlingsoft.net/ssp/blog/2005/05/source_lists">Source Lists</a>.</li><li>Rob Griffith: <a href="http://www.robservatory.com/archives/2005/05/17/consistency-of-design/">The many faces of Apple&#8217;s OS X applications</a> &ndash; about Tiger&#8217;s six types of interface (metal, aqua, smooth platinum, pro, etc.)</li><li>Khoi Vinh: <a href="http://www.subtraction.com/archives/2005/0602_window_dress.php">Window Dress for Success</a> &ndash; more about Tiger&#8217;s different window types &ndash; &#8220;a brief and dramatically unscientific table that outlines my interpretation of each usage&#8221;</li><li>Chris McElligott: <a href="http://www.theflanneleffect.com/blog/window-states-mania/">Window States Mania</a> about the 3 toolbar states for the new &#8220;Unified Toolbar&#8221; window style.</li><li>Michael Dupuis: <a href="http://www.advenio.com/weblogs/2005/05/on-software-design-new-inconsistencies.html">The New Inconsistencies of OS X. Or, How Mac OS X Can Become Windows</a></li></ul>]]></content>
    
    <summary type="html">
    
      
      
        &lt;p&gt;A few links about &lt;acronym title=&quot;User Interface&quot;&gt;UI&lt;/acronym&gt; trends and changes in Tiger.&lt;/p&gt;
&lt;p&gt;Brent Simmons:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;h
      
    
    </summary>
    
    
    
      <category term="Mac" scheme="https://twisty.com/bandwagon/archives/categories/mac-os-x/"/>
    
      <category term="User Interface" scheme="https://twisty.com/bandwagon/archives/categories/user-interface/"/>
    
  </entry>
  
  <entry>
    <title>NetNewsWire 2.0</title>
    <link href="https://twisty.com/bandwagon/archives/2005/05/13/015457/"/>
    <id>https://twisty.com/bandwagon/archives/2005/05/13/015457/</id>
    <published>2005-05-13T00:54:57.000Z</published>
    <updated>2020-04-18T20:57:17.000Z</updated>
    
    <content type="html"><![CDATA[<p>Congratulations to the <a href="http://ranchero.com/">Ranchero</a> crew on the release of <a href="http://ranchero.com/netnewswire/">NetNewsWire 2.0</a> – a major update to the popular Mac feed-reader. I’ve been beta testing it for a while (actually, a <em>scary</em> amount of time). It’s been really interesting watching the development of this release over the beta period – there’s been loads of attention to detail in the UI and performance that might get overlooked by all the <a href="http://ranchero.com/netnewswire/whatsnew/netnewswire20.php">new features</a>. Syncing is a welcome addition, as is <a href="http://ranchero.com/netnewswire/features/podcasting.php">Podcasting support</a>; but there’s a ton of new stuff in there that I’ve probably “just got used to” by now (<a href="http://ranchero.com/netnewswire/features/flaggedItems.php">flagged items</a>, <a href="http://ranchero.com/netnewswire/features/atom.php">Atom feeds</a>). What can I say? I like it, you should try it!</p>]]></content>
    
    <summary type="html">
    
      
      
        &lt;p&gt;Congratulations to the &lt;a href=&quot;http://ranchero.com/&quot;&gt;Ranchero&lt;/a&gt; crew on the release of &lt;a href=&quot;http://ranchero.com/netnewswire/&quot;&gt;NetN
      
    
    </summary>
    
    
    
      <category term="Mac" scheme="https://twisty.com/bandwagon/archives/categories/mac-os-x/"/>
    
      <category term="User Interface" scheme="https://twisty.com/bandwagon/archives/categories/user-interface/"/>
    
      <category term="Software" scheme="https://twisty.com/bandwagon/archives/categories/software/"/>
    
  </entry>
  
</feed>
