<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4089129643157405806</id><updated>2025-03-28T08:19:31.289+01:00</updated><category term="software"/><category term="nonsense"/><category term="france"/><category term="business"/><category term="parenting"/><category term="politics"/><category term="social networking"/><category term="recruiting"/><category term="photos"/><category term="iconfu"/><title type='text'>public interface</title><subtitle type='html'>news from conan&#39;s brain</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.conandalton.net/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>conan</name><uri>http://www.blogger.com/profile/03401726635379568413</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfwQkipN7fcLo1L09CxXGmZEftHKp-PTOF-RSd6ElP-5kZ81tT_seKNKxS3EovpoQCGed43r39qirdhmGvmpIefkjOooNH-NypZ_oDmAdimI56h8nXboyRvXR7RZTAzQ/s220/approved.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>120</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4089129643157405806.post-3932982581344586448</id><published>2023-06-07T19:57:00.006+02:00</published><updated>2023-06-07T21:48:14.630+02:00</updated><title type='text'>UK judge officially authorises Stamping on Minority People&#39;s Heads</title><content type='html'>
&lt;p&gt;
  From &lt;a href=&quot;https://www.readingchronicle.co.uk/news/23547153.transgender-woman-assaulted-oxford-road-reading-hotel/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;an article in the Reading Chronicle&lt;/a&gt; :
&lt;/p&gt;

&lt;p&gt;
&lt;cite&gt;[the victim] was left with a shoeprint mark on her face after a teenager kicked and punched her at her hotel room in Reading. Connor Young has narrowly avoided jail time after assaulting the victim at a hotel in Oxford Road on April 15, 2021.&lt;/cite&gt;
&lt;/p&gt;

&lt;p&gt;
The article makes a big deal of the victim&#39;s identity, but the judge, one Emma Nott, helpfully points out that the same considerations apply &quot;whether [the victim is] gay, transgender, a different race or religion&quot;. Presumably, if the victim was a little bit more normal, like straight cisgender white C of E male for example, she might have had to take sentencing guidelines more seriously.
&lt;/p&gt;

&lt;p&gt;
The fine article does not, unfortunately, explain how the judge was persuaded to give Connor a chance, all we can say is that he had grown and matured emotionally, after having stamped on his victim&#39;s head, and he left the court in floods of tears with his fiancée. Perhaps Emma might suggest that angry young men find some appropriate people to attack, as a form of therapy?
&lt;/p&gt;

&lt;p&gt;
So if you&#39;re in the UK and in the mood for beating people up, make sure your victim is in one of Emma&#39;s minority target groups, make sure you regret it real hard afterwards, see if you can get Emma to try you, and you can enjoy a nice dinner with your partner the same evening once you&#39;re done crying.
&lt;/p&gt;

&lt;div class=&quot;blogger-post-footer&quot;&gt;copyright conan dalton 2007-2010 feel free to quote please link back&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.conandalton.net/feeds/3932982581344586448/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.conandalton.net/2023/06/uk-judge-officially-authorises-stamping.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/3932982581344586448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/3932982581344586448'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/2023/06/uk-judge-officially-authorises-stamping.html' title='UK judge officially authorises Stamping on Minority People&#39;s Heads'/><author><name>conan dalton</name><uri>http://www.blogger.com/profile/05853236806921396940</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4089129643157405806.post-7210921401453875455</id><published>2020-06-06T23:41:00.001+02:00</published><updated>2020-06-06T23:41:32.807+02:00</updated><title type='text'>Black Lives vs Flattening the Curve</title><content type='html'>&lt;p&gt;Today I was proud to participate in a Black Lives Matter protest in Waterford. I kept at least two metres&lt;br /&gt;
away from others as much as possible although this wasn&#39;t easy despite staying on the periphery. Unfortunately&lt;br /&gt;
the two-metre radius was largely ignored by most participants here. I&#39;m very grateful to local police who&lt;br /&gt;
carefully shepherded this peaceful protest despite it being officially cancelled.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Much online discussion of these global protests against the shameful behaviour of US police focusses on&lt;br /&gt;
how the protests are in violation of lockdown orders in the context of the current coronavirus pandemic.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;This perspective is entirely reasonable given what we have seen of overwhelmed hospitals and mass burials.&lt;br /&gt;
These protests will very likely delay our recovery and may lead to more avoidable coronavirus deaths.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;But the question is : what is more important for the kind of world we want to live in? How long should a&lt;br /&gt;
pandemic last? How long should racist violence last? There are two main voices in this debate:&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&quot;I think racism is disgraceful, but I didn&#39;t say anything because I didn&#39;t want to get sick. Maybe later?&quot;&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&quot;I was worried about getting sick, but I could not stay silent in the face of this injustice. (coughs).&quot;&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;I picked my side and I&#39;m sticking with it.&lt;/p&gt;&lt;br /&gt;
&lt;div class=&quot;blogger-post-footer&quot;&gt;copyright conan dalton 2007-2010 feel free to quote please link back&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.conandalton.net/feeds/7210921401453875455/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.conandalton.net/2020/06/black-lives-vs-flattening-curve.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/7210921401453875455'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/7210921401453875455'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/2020/06/black-lives-vs-flattening-curve.html' title='Black Lives vs Flattening the Curve'/><author><name>conan dalton</name><uri>http://www.blogger.com/profile/05853236806921396940</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4089129643157405806.post-689836735260467249</id><published>2018-11-14T14:41:00.002+01:00</published><updated>2018-11-14T14:41:22.412+01:00</updated><title type='text'>Foodopi: the saga continues</title><content type='html'>&lt;p&gt;You probably thought this was a joke: &lt;a href=&quot;http://www.conandalton.net/2009/11/foodopi-coming-soon-to-nation-near-you.html&quot;&gt;FOODOPI - coming soon to a nation near you!&lt;/a&gt; - but look what a dutch cheese company is trying to do - &lt;a href=&quot;https://www.bbc.com/news/world-europe-46193818&quot;&gt;EU court rules that the taste of food is not protected by copyright&lt;/a&gt;. While &quot;not protected&quot; might sound like good news for the rest of us - but in fact the court argued that it was merely &quot;impractical&quot; and not that it was &quot;an utterly stupid idea&quot;.&lt;/p&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;copyright conan dalton 2007-2010 feel free to quote please link back&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.conandalton.net/feeds/689836735260467249/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.conandalton.net/2018/11/foodopi-saga-continues.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/689836735260467249'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/689836735260467249'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/2018/11/foodopi-saga-continues.html' title='Foodopi: the saga continues'/><author><name>conan dalton</name><uri>http://www.blogger.com/profile/05853236806921396940</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4089129643157405806.post-7059324100507442168</id><published>2018-11-13T14:05:00.000+01:00</published><updated>2018-11-13T14:05:10.400+01:00</updated><title type='text'>It doesn&#39;t have to be this way</title><content type='html'>&lt;p&gt;Every time I pay for parking at Dublin airport, I&#39;m filled with optimism for the future.&lt;/p&gt;&lt;br /&gt;
&lt;a href=&quot;https://conanite.com/file/change-is-possible.png&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://conanite.com/file/change-is-possible.png&quot; width=&quot;320&quot; height=&quot;276&quot; data-original-width=&quot;720&quot; data-original-height=&quot;621&quot; alt=&quot;dublin airport parking payment with notice that change is possible&quot;/&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;&quot;Change is possible&quot; - indeed, and the sooner the better.&lt;/p&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;copyright conan dalton 2007-2010 feel free to quote please link back&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.conandalton.net/feeds/7059324100507442168/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.conandalton.net/2018/11/it-doesnt-have-to-be-this-way.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/7059324100507442168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/7059324100507442168'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/2018/11/it-doesnt-have-to-be-this-way.html' title='It doesn&#39;t have to be this way'/><author><name>conan dalton</name><uri>http://www.blogger.com/profile/05853236806921396940</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4089129643157405806.post-3452565606351572134</id><published>2017-02-06T20:51:00.000+01:00</published><updated>2017-02-06T20:51:44.031+01:00</updated><title type='text'>LibreOffice 1 -- 0 Microsoft Office</title><content type='html'>&lt;p&gt;If you have a corrupted word doc on your mac and word just refuses to open it, the Internets of course have many helps for you, including but not limited to the great advice from Microsoft itself : &lt;a href=&quot;https://support.microsoft.com/en-us/help/285393/how-to-troubleshoot-damaged-documents-in-word-for-mac&quot;&gt;how to troubleshoot damaged documents in word for mac&lt;/a&gt; (spoiler: the solution involves copy-pasting the word &quot;test&quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Actually, it&#39;s worse than that, the friendly dialog word offers says (more or less) &quot;I can&#39;t open this file because it&#39;s corrupt. You should open this file and repair it&quot;. Duh ... the problem is I can&#39;t open it in the first place.&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;In any case, none of the many helps worked for me, so here&#39;s a hare-brained scheme I hatched all by myself : mail the file to yourself, open it on your ubuntu laptop using LibreOffice. Guess what ... it worked! &quot;Save As&quot; something sensible, mail it back to yourself on your mac, open again with Word. Word complained a little about unorthodox characters (specifically, the letter &quot;V&quot; ... who knows why...) but the opening was ultimately successful.&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Anyway, this little post is another little piece of help on top of the great big pile of helps that make up the internets. I hope it helps you one day.&lt;br /&gt;
&lt;div class=&quot;blogger-post-footer&quot;&gt;copyright conan dalton 2007-2010 feel free to quote please link back&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.conandalton.net/feeds/3452565606351572134/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.conandalton.net/2017/02/libreoffice-1-0-microsoft-office.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/3452565606351572134'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/3452565606351572134'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/2017/02/libreoffice-1-0-microsoft-office.html' title='LibreOffice 1 -- 0 Microsoft Office'/><author><name>conan dalton</name><uri>http://www.blogger.com/profile/05853236806921396940</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4089129643157405806.post-908522112704469150</id><published>2017-01-22T13:39:00.001+01:00</published><updated>2017-01-22T13:41:42.908+01:00</updated><title type='text'>gem install rmagick on ubuntu</title><content type='html'>&lt;p&gt;Installing gem rmagick on ubuntu is almost worse than installing mysql gems used to be!&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;You will get a variety of errors depending on the version of ubuntu, the version of imagemagick, the various imagemagick libraries, and the version of rmagick you have installed or want to install. I mostly suffered from &quot;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;checking for wand/MagickWand.h... no&lt;/span&gt;&quot;, &quot;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Can&#39;t install RMagick 0.0.0.&lt;/span&gt;&quot; (dunno where the version number went), &quot;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;*** extconf.rb failed ***&lt;/span&gt;&quot;, among others.&lt;/p&gt;&lt;br /&gt;
This is what finally worked for me:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;fresh install of Ubuntu 14.04&lt;/li&gt;
&lt;li&gt;sudo apt-get -y install libmagickcore5 libmagickwand-dev libmagickwand5 ruby-rmagick graphicsmagick graphicsmagick-dbg&amp;nbsp; imagemagick imagemagick-common libmagick++-dev libmagick++5 libmagickcore-dev libmagickcore5 libmagickcore5-extra libmagickwand-dev libmagickwand5&lt;/li&gt;
&lt;li&gt;gem install rmagick&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;p&gt;(at time of writing, &quot;gem install rmagick&quot; installs 2.16.0 without complaint)&lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Ubuntu 14.04 supports imagemagick 6.7.7-10 and no later version.  Ubuntu 16.04, on the other hand, doesn&#39;t offer anything earlier than  6.9.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;According to &lt;a href=&quot;http://www.tellnes.it/blog/2016/05/19/ruby-on-rails-windows-imagemagick-%C2%A4/&quot;&gt;tellnes&lt;/a&gt;, newer versions of imagemagick will not work with rmagick, although the &lt;a href=&quot;https://github.com/rmagick/rmagick&quot;&gt;rmagick page&lt;/a&gt; says: &quot;&lt;span style=&quot;background-color: white; color: #333333; display: inline; float: none; font-family: , &amp;quot;blinkmacsystemfont&amp;quot; , &amp;quot;segoe ui&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif , &amp;quot;apple color emoji&amp;quot; , &amp;quot;segoe ui emoji&amp;quot; , &amp;quot;segoe ui symbol&amp;quot;; font-size: 16px; font-style: normal; font-weight: normal; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;Version 6.4.9 or later&lt;/span&gt;&quot;)&lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;I  didn&#39;t take the trouble to try the apt packages one-by-one to figure  out the minimal set of packages rmagick needs to install successfully.&lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Note, &quot;this works for me&quot; ... it probably won&#39;t work for you. Google can point you to a large number of absolutely sure fixes for this problem, all of which worked for their authors, and none of which worked for me.&lt;/p&gt;&lt;br /&gt;
&lt;div class=&quot;blogger-post-footer&quot;&gt;copyright conan dalton 2007-2010 feel free to quote please link back&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.conandalton.net/feeds/908522112704469150/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.conandalton.net/2017/01/gem-install-rmagick-on-ubuntu.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/908522112704469150'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/908522112704469150'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/2017/01/gem-install-rmagick-on-ubuntu.html' title='gem install rmagick on ubuntu'/><author><name>conan dalton</name><uri>http://www.blogger.com/profile/05853236806921396940</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4089129643157405806.post-959838850429451308</id><published>2013-12-11T00:04:00.000+01:00</published><updated>2014-02-17T16:24:02.362+01:00</updated><title type='text'>UFT8 in string literals using MySQL client over ssh</title><content type='html'>&lt;p&gt;MySQL documentation ain&#39;t what it used to be; it took some experimenting to figure out how to get a utf string into my db from the command-line client interface.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The problem is that for some reason when I run &lt;code&gt;mysql&lt;/code&gt; on my server through &lt;code&gt;ssh&lt;/code&gt;, non-latin characters just get dropped. It might be an ssh config thing, you never know, but I explored the mysql avenue first.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Here&#39;s what I found. Suppose you want to update a field containing some non-ascii character, like &quot;à&quot;, like this:&lt;/p&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;update events set timetable = &#39;de 10h à 12h&#39; where id &gt; 100000;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;p&gt;But after you paste this into your shell, the &quot;à&quot; is missing:&lt;/p&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;update events set timetable = &#39;de 10h  12h&#39; where id &gt; 100000;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;p&gt;And your data doesn&#39;t get updated the way you expect.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;This is the mysql documentation on string literals: &lt;a href=&#39;https://dev.mysql.com/doc/refman/5.0/en/string-literals.html&#39;&gt;string-literals.html&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;And here&#39;s a handy utf8 lookup table: &lt;a href=&#39;http://www.utf8-chartable.de/&#39;&gt;http://www.utf8-chartable.de/&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;And here&#39;s the solution:&lt;/p&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;update events set timetable = concat(_utf8&#39;de 10h &#39;, _utf8 0xC3A0, _utf8&#39; 12h&#39; where id &gt; 100000);&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;p&gt;To explain: &lt;code&gt;_utf8 0xC3A0&lt;/code&gt; gives you your &quot;à&quot;, you concatenate that with the rest of your string and away you go. It&#39;s ugly, but it works, so stop complaining.&lt;/p&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;copyright conan dalton 2007-2010 feel free to quote please link back&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.conandalton.net/feeds/959838850429451308/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.conandalton.net/2013/12/mysql-documentation-aint-what-it-used.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/959838850429451308'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/959838850429451308'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/2013/12/mysql-documentation-aint-what-it-used.html' title='UFT8 in string literals using MySQL client over ssh'/><author><name>conan dalton</name><uri>http://www.blogger.com/profile/05853236806921396940</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4089129643157405806.post-1188582251380379912</id><published>2013-11-13T13:55:00.001+01:00</published><updated>2014-02-17T16:23:36.793+01:00</updated><title type='text'>10k downloads</title><content type='html'>&lt;p&gt;Yo, my &lt;a href=&quot;https://rubygems.org/profiles/conanite&quot;&gt;rubygems.org&lt;/a&gt; profile has just hit 10,000 downloads!&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;I&#39;m guessing that 99% of these downloads are bots though ... &lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Although not entirely ... the gems at the bottom of the list are either very recent (&lt;a href=&quot;https://rubygems.org/gems/rspec_numbering_formatter&quot;&gt;rspec_numbering_formatter&lt;/a&gt;), or kinda utterly pointless (&lt;a href=&quot;https://rubygems.org/gems/ageism&quot;&gt;ageism&lt;/a&gt;). On average, older gems have more downloads. Top of the list is &lt;a href=&quot;https://rubygems.org/gems/protopack&quot;&gt;protopack&lt;/a&gt;, which is actually useful as a way to store objects as YAML for later resurrection, kind of like test fixtures, but in a production context, with liberal meta-data sprinkled on top. You would think that &lt;a href=&quot;https://rubygems.org/gems/sepa&quot;&gt;sepa&lt;/a&gt; would end up being most popular though, as it&#39;s made for a critical bit of business - preparing SEPA direct debits, using the ISO 20022 xml standard (also known as &quot;pain.008.001&quot;, although all banking standards are a pain so in this case &quot;pain&quot; is banking shorthand for &quot;&lt;b&gt;pa&lt;/b&gt;yments &lt;b&gt;in&lt;/b&gt;itiation&quot;). It&#39;s newer than protopack though, so time will tell.&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;One more piece of data: none of the corresponding github repositories have issues opened. There are several ways to interpret this:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;an army of bots is dedicated to downloading my stuff and archiving for posterity it all over the internet, but they don&#39;t take any more interest beyond downloading&lt;/li&gt;
&lt;li&gt;real people download my stuff, decide it&#39;s unusable, and run away fast&lt;/li&gt;
&lt;li&gt;real people download my stuff, it fits their needs perfectly and is 100% defect-free, and they&#39;re using it happily&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;p&gt;Please feel free to draw your own conclusions. Then colour them in.&lt;br /&gt;
&lt;div class=&quot;blogger-post-footer&quot;&gt;copyright conan dalton 2007-2010 feel free to quote please link back&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.conandalton.net/feeds/1188582251380379912/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.conandalton.net/2013/11/10k-downlaods.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/1188582251380379912'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/1188582251380379912'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/2013/11/10k-downlaods.html' title='10k downloads'/><author><name>conan dalton</name><uri>http://www.blogger.com/profile/05853236806921396940</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4089129643157405806.post-1673391143636353935</id><published>2013-10-03T22:51:00.000+02:00</published><updated>2013-11-12T22:05:51.685+01:00</updated><title type='text'>World Wide Web for sale (slightly used)</title><content type='html'>&lt;p&gt;An &lt;a href=&#39;https://www.eff.org/deeplinks/2013/10/lowering-your-standards&#39;&gt;EFF article&lt;/a&gt; reports that &lt;a href=&#39;http://www.w3.org/People/Berners-Lee/&#39;&gt;Tim Berners-Lee&lt;/a&gt;, director of W3C, the standards body that attempts to specify what web browsers do, approves the inclusion of DRM restrictions in a forthcoming HTML specification.&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;As the EFF article points out, this new direction is likely to damage the W3C&#39;s already less-than-stellar reputation as a respectable standards body. Which is a pity, because the web is a better place when we can all agree on interoperability standards.&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Your web browser, whether on your laptop or on your phone, behind the scenes, is called a &lt;code&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/User_agent&quot;&gt;User Agent&lt;/a&gt;&lt;/code&gt;. This means it represents you, the &quot;User&quot;, giving you much freedom in the way you experience the internet. With DRM restrictions built-in, your browser becomes a copyright-enforcement-agent, and you risk losing many of the freedoms you have enjoyed up to now. We are entering a terrifying new era where government itself is the enemy; DRM is a major piece of armour in favour of centralised power and against The People.&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Disappointing, Mr. Berners-Lee. Perhaps it&#39;s time to resign and let &lt;a href=&#39;http://www.wired.com/opinion/2013/09/why-free-software-is-more-important-now-than-ever-before/&#39;&gt;Mr. Stallman take the helm&lt;/a&gt;?&lt;div class=&quot;blogger-post-footer&quot;&gt;copyright conan dalton 2007-2010 feel free to quote please link back&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.conandalton.net/feeds/1673391143636353935/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.conandalton.net/2013/10/world-wide-web-for-sale-slightly-used.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/1673391143636353935'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/1673391143636353935'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/2013/10/world-wide-web-for-sale-slightly-used.html' title='World Wide Web for sale (slightly used)'/><author><name>conan dalton</name><uri>http://www.blogger.com/profile/05853236806921396940</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4089129643157405806.post-9101207729902984606</id><published>2012-12-28T14:13:00.000+01:00</published><updated>2012-12-28T14:13:59.776+01:00</updated><title type='text'>Book: The Talent Code, Daniel Coyle</title><content type='html'>&lt;br /&gt;
&lt;p&gt;Daniel Coyle, in The Talent Code, argues against the received concepts of &quot;born genius&quot;, &quot;you either have it or you don&#39;t&quot;, &quot;overnight success&quot;. He argues that talent grows where it is nurtured, describes how this is done, and shows how the growth of myelin is the neurological foundation of talent.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;Coyle proposes three pillars of talent growth: &quot;Deep Practice&quot;, &quot;Ignition&quot;, and &quot;Master Coaching&quot;. The concept of &quot;hotbeds&quot; also runs through the book.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;h3&gt;Myelin&lt;/h3&gt;&lt;br /&gt;
&lt;p&gt;Prior to understanding what myelin does, it is essential to understand that our movements are the results of signals sent to muscles by nerve cells along nerve fibres.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;Myelin wraps nerve fibres so that signals sent along those fibres arrive faster and more reliably. Unwrapped fibres tend to leak their signal into the surrounding mush of our bodies, so myelin works very much like electrical insulation.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;Oligodentrocyte cells do the wrapping, and they target nerve cells that fire frequently. Hence the popular wisdom that &quot;practice makes perfect&quot;. Coyle does not challenge this piece of wisdom. Myelin improves neural circuits much the way goats carve a path across a mountain, simply by following it often.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;With sufficient repetition, a performance may become automatic, like walking; under normal circumstances adults never ponder how to move the next foot forward, nor where to put it. This is the effect of myelin wrapping, and the central thesis of this book is that we can deliberately cultivate myelin in order to grow our skills.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Deep Practice&lt;/h3&gt;&lt;br /&gt;
&lt;p&gt;Deep practice is accomplished by breaking a difficult task into chunks, and sub-chunks as far as necessary, and then performing the chunk repeatedly, stopping and fixing all errors as they are encountered, until there are no more errors, and the chunk can be played flawlessly.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;This process has the effect of repeatedly firing the nerve cells that produce the desired performance, with the consequence that their fibres get myelin-wrapped, with the result that subsequent performances are superior.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;A talent hotbed has the major feature that it encourages deep practice. Brazilian footballers, for example, train by playing &quot;futsal&quot;, a kind of mini-soccer with smaller teams and smaller rooms. The result is that each player touches the ball more often than would be the case on a standard playing field with the usual team size. This increased contact frequency provides more opportunity to practice manouevres, repeat them, and correct mistakes.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;h4&gt;Research&lt;/h4&gt;&lt;br /&gt;
&lt;p&gt;Coyle cites Anders Ericsson&#39;s now-famous 10,000-hour rule and explains it in terms of how long it takes to wrap a single nerve fibre.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;He mentions Juliet Barker&#39;s study of the Brontë sisters. Her research shows that the Brontë&#39;s skill didn&#39;t simply appear overnight, as many previous biographers had supposed; instead, the sisters had practiced deeply from an early age by writing stories for each other. The entire plot of Wuthering Heights, for example, is scattered among Emily&#39;s juvenalia.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;Adriaan de Groot was perplexed by people of inferior skill who kept beating him in chess; he performed a study where he asked experts to memorize chess positions. Experts could easily remember positions from real games, but were no better than beginners at remembering random positions. De Groot used this research to show that chunking is a core feature of advanced skill - the chess experts were able to memorize positions by chunking the pieces, remembering relationships within each chunk, and relationships between chunks.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Ignition&lt;/h3&gt;&lt;br /&gt;
&lt;p&gt;Ignition is the word Coyle uses to describe the process of creating motivation. Some motivators include Group Belonging, Loss of Parent, Spartan Conditions, Birth Order, Dangerous World, Ambition, Coaching with Love.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;h4&gt;Group Belonging&lt;/h4&gt;&lt;br /&gt;
&lt;p&gt;This appears to be one of the most powerful motivators as Coyle shows several examples where an entire nation comes to prominence in a certain sport due to the example of a single player. He frequently mentions Se Ri Pak, a South Korean golf player who out of the blue won a championship in 1998. Now, South Korean golfers dominate international womens&#39; golf. Other examples include Anna Kournikova - Russian tennis (1998), and Andruw Jones - Curaçao, baseball (1996).&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;h4&gt;Loss of Parent, Dangerous World, Spartan Conditions&lt;/h4&gt;&lt;br /&gt;
&lt;p&gt;Coyle gives a large list of famous individuals who lost a parent early in life. Losing a parent, it seems, has the effect of motivating the child defensively to acquire skill. Constructing a dangerous-world hypothesis will have a similar effect on a child - the child is motivated to compensate for adverse outside conditions. Spartan Conditions, on the other hand, bring the &quot;Dangerous World&quot; right into the practice session. Coyle notes that talent hotbeds around the world share few features except Master Coaches and Spartan Conditions - run-down, ill-maintained facilities. A classical music program for children where there are not enough violins for everybody. Futsal was born because inner-city Brazil has neither the space nor the climate to maintain expensive, full-sized soccer pitches. Coyle calls this the &quot;Scrooge Principle&quot; - we are stingy with our personal energy resources, until external cues motivate us to break open the piggy bank and splurge on practice.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;h4&gt;Birth Order&lt;/h4&gt;&lt;br /&gt;
&lt;p&gt;I&#39;m not sure this translates into other fields of expertise: Coyle shows that the best runners are usually among the youngest siblings in their families.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;h4&gt;Ambition&lt;/h4&gt;&lt;br /&gt;
&lt;p&gt;At KIPP, students are continuously reminded that they&#39;re going to college, which is a big thing for US families. KIPP takes their vague wish/dream to go to college and turns it into an ever-present, burning, and (perhaps most importantly) realistic ambition.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;h4&gt;Coaching Love&lt;/h4&gt;&lt;br /&gt;
&lt;p&gt;The most important qualities of a child&#39;s first teacher in a specific discipline, are patience, rapport, likeability. If the child attaches to the teacher, they are likely to transfer that attachment to the study of their craft. Interestingly, it is not a requirement that the first coach be a top performer of the skill in question.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;h4&gt;Research&lt;/h4&gt;&lt;br /&gt;
&lt;p&gt;Carol Dweck ran the &quot;praise test&quot; and discovered that praising effort is significantly more effective than praising results, for feeding motivation.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;Gary McPherson studied the relationship between commitment, amount of practice, and externally-measured performance outcomes. He asked children to describe their commitment (number of weeks/years, or forever) to their craft, and created three groups - long-term, medium-term, and short-term commitment. Then he measured how much time on average each child would practice each week, and subdivided into low, moderate, and high levels of practice. It turns out that children with long-term commitment get far more out of each practice session regardless of their level of practice.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;Geoff Cohen ran a test to discover how group identification affects motivation by showing students a story about a mathematician and then asking them to solve a maths problem. Half of the students read the story where the mathematician&#39;s birthday was altered to match their own; for the other half the birth date was unchanged. The birthday-match group spent on average 65% more time working on the problem.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;Martin Eisenstadt is responsible for the parental-loss research; his population was the set of people eminent enough to merit at least a half-page entry in Encyclopedia Britannica.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;John Bargh proposed the idea that the run-down, derelict feel of a talent hotbed fuels motivation.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Master Coaching&lt;/h3&gt;&lt;br /&gt;
&lt;p&gt;Coaching is a entire skill unto itself; a master coach must first acquire skill in the target domain, and subsequently acquire great skill as a coach. This is why the best coaches are often quite old - the skill takes decades to master.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;Coaching sport is very different from coaching art. A master sports coach is mostly silent, whereas a master music coach delivers a lot of specific guidance.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;A soccer player, when performing, needs to adapt quickly and skillfully to rapidly and unpredictably evolving circumstances on the field. A cellist performing Bach, on the other hand, strives to reproduce as accurately as possible the exact set of movements required to re-create the music.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;Coyle argues that the neural circuitry in each of these cases in necessarily different. &quot;Ivy-vine&quot; describes the circuits for soccer, writing, and comedy; &quot;Consistent&quot;, &quot;oak-tree&quot; describe the circuits for violin, golf, and gymnastics. Because the architecture of the circuits are different, the coaching style is necessarily different.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;Coyle describes four major features of master coaches - the &quot;Matrix&quot;, Perceptiveness, GPS reflex, and Theatrical Honesty.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;h4&gt;The Matrix&lt;/h4&gt;&lt;br /&gt;
&lt;p&gt;[ I didn&#39;t understand this - the &quot;matrix&quot; seems to be another way of saying that a Master Coach skillfully and effectively combines all the other three features listed here ]&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;h4&gt;Perceptiveness&lt;/h4&gt;&lt;br /&gt;
&lt;p&gt;Perceptiveness is the ability to understand exactly what a student needs. Coaches do this first of all by investigating new students thoroughly - finding out everything there is to know about the students&#39; backgrounds, for example. Secondly, understanding comes from continuously monitoring how the student reacts to the coach&#39;s intructions - whether those words were effective, should the coach repeat or rephrase. Armed with this understanding, the coach can then deliver personalised instruction tailored specifically for the particular situation a given student is facing at any given time.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;h4&gt;GPS Reflex&lt;/h4&gt;&lt;br /&gt;
&lt;p&gt;Master Coaches deal little in reward and punishment, verbal or otherwise. Instead, most communication comes in the form of instruction, much like a GPS navigation system. A Master Coach delivers instruction consicely, clinically, in short bursts, without being dictatorial.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;h4&gt;Theatrical Honesty&lt;/h4&gt;&lt;br /&gt;
&lt;p&gt;Master Coaches exaggerate emotion - surprise, delight, warmth, shock, horror.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Notes&lt;/h3&gt;&lt;br /&gt;
&lt;p&gt;This book was an entertaining read, with tons of anecdotes, and plenty of research. It has the potential to change the way we think about learning, with implications for education, sport, art, business, and also how to deal with age-related diseases targeting the brain.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;Myelin depends on a supply of Omega-3 fatty acids, so make sure you eat plenty of oily fish, or olive oil, or nuts, or all three. The wrapping process itself is slow, but dependable for healthy, young, well-nourished individuals.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;Coyle might have usefully brought up NLP theories of motivation - according to NLP, people are either motivated &quot;away&quot; from an undesirable situation, or &quot;towards&quot; a desirable one. It might be useful to consider how &quot;Ambition&quot;, &quot;Group Belonging&quot;, &quot;Birth Order&quot; might be instances of &quot;towards&quot; motivation, and &quot;Parental Loss&quot;, &quot;Spartan Conditions&quot;, and &quot;Dangerous World&quot; might be instances of &quot;away&quot; motivation.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;I find the &quot;ivy-vine&quot; vs &quot;oak-tree&quot; neural circuit metaphors dubious, and Coyle cites no research to support this. Coyle does mention how team sports are effectively self-teaching, as players get instant reward/punishment feedback in the form of keeping or losing the ball, scoring a goal or failing to stop one, winning the game or losing it. An artistic performance on the other hand implies an external judge. It&#39;s possible that coaching style is related only to the way in which the student&#39;s performance is judged.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;It&#39;s worth noting that computers excel at some kinds of games because they can self-teach. The world&#39;s best backgammon player, for example, is a self-taught computer progam, and my telephone beats me easily at Go. There aren&#39;t any computers producing renaissance masterpieces. Even Emily Howell, a music-writing computer program by David Cope, needs a lot of feedback and guidance to produce quality music.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;div class=&quot;blogger-post-footer&quot;&gt;copyright conan dalton 2007-2010 feel free to quote please link back&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.conandalton.net/feeds/9101207729902984606/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.conandalton.net/2012/12/book-talent-code-daniel-coyle.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/9101207729902984606'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/9101207729902984606'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/2012/12/book-talent-code-daniel-coyle.html' title='Book: The Talent Code, Daniel Coyle'/><author><name>conan dalton</name><uri>http://www.blogger.com/profile/05853236806921396940</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4089129643157405806.post-5524855788265239740</id><published>2012-10-16T10:31:00.000+02:00</published><updated>2012-10-16T10:35:13.872+02:00</updated><title type='text'>One Click Only</title><content type='html'>&lt;p&gt;Normal people, quite reasonably, expect buttons and links and other clicky thingies on a web page to work the way they work in other software. For a generation brought up on windows, this means double-clicking.&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Alas, double clicking &quot;Buy Now&quot; on a web page might well mean &quot;buy now, and buy now again&quot; - your client doesn&#39;t want that, and you don&#39;t want the resulting credit card chargebacks and reputation hit.&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Enter &lt;code&gt;one_click_only&lt;/code&gt;, a teensy weensy &lt;a href=&quot;http://jquery.com/&quot;&gt;jQuery&lt;/a&gt; plugin to prevent stuff from being double-clicked. This plugin works by calling &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/DOM/event.preventDefault&quot;&gt;&lt;code&gt;event.preventDefault()&lt;/code&gt;&lt;/a&gt;, so it&#39;s not going to do the trick if you have custom javascript for submitting forms. You might need to consider something like &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/DOM/event.stopPropagation&quot;&gt;&lt;code&gt;event.stopPropagation()&lt;/code&gt;&lt;/a&gt; for that. But steal some ideas from this, you will figure something out.&lt;br /&gt;
&lt;br /&gt;
This script works by storing the last click time in the DOM node&#39;s &lt;code&gt;data&lt;/code&gt;. The first click goes through; subsequent clicks are allowed through if they are more than a threshold number of milliseconds later (here, 500ms). To prevent any subsequent clicking, just check if the &lt;code&gt;previous_click&lt;/code&gt; is not null, instead of comparing it with &lt;code&gt;now&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;&lt;script src=&quot;https://gist.github.com/3897979.js?file=one_click_only.js&quot;&gt;&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Use thusly:&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;&lt;script src=&quot;https://gist.github.com/3897979.js?file=application.js&quot;&gt;&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Enjoy.&lt;div class=&quot;blogger-post-footer&quot;&gt;copyright conan dalton 2007-2010 feel free to quote please link back&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.conandalton.net/feeds/5524855788265239740/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.conandalton.net/2012/10/one-click-only.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/5524855788265239740'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/5524855788265239740'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/2012/10/one-click-only.html' title='One Click Only'/><author><name>conan dalton</name><uri>http://www.blogger.com/profile/05853236806921396940</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4089129643157405806.post-2702649204187547922</id><published>2012-02-15T12:24:00.000+01:00</published><updated>2012-02-15T12:24:37.066+01:00</updated><title type='text'>Mixing Landscape and Portrait rendering in a Wicked PDF document</title><content type='html'>&lt;p&gt;
&lt;a href=&quot;https://github.com/mileszs/wicked_pdf&quot;&gt;Wicked&lt;/a&gt; is an awesome ruby library for
generating PDF documents from plain old HTML/CSS.
&lt;/p&gt;&lt;p&gt;
HTML and CSS are not just another language; they provide a model for representing a document,
and if you were obliged to use something else you would eventually end up representing your
documents using this model, even if your syntax layer differed from HTML (if you&#39;re really
smart, you would have ended up with &lt;a href=&#39;http://haml-lang.com/&#39;&gt;HAML/SASS&lt;/a&gt;, for example;
same model, different prettiness).
&lt;/p&gt;&lt;p&gt;
This is why other libraries fail (where &quot;fail&quot; means &quot;I don&#39;t like them&quot;) - they oblige you to learn
a whole new model for representing documents.
&lt;/p&gt;&lt;p&gt;
Anyway, the point is that you might believe from the Wicked README that you can create a document
in landscape mode, or in portrait mode, but you&#39;re out of luck if you want both in the same doc.
&lt;/p&gt;&lt;p&gt;
It turns out you&#39;re not out of luck; Wicked, as its name non-obviously suggests, ultimately relies
on WebKit (via &lt;a href=&#39;http://code.google.com/p/wkhtmltopdf/&#39;&gt;wkhtmltopdf&lt;/a&gt;) to render html pages.
With WebKit, you have access to a whole bunch of modern CSS properties, including those that rotate
your document. You don&#39;t even care that they&#39;re WebKit specific, because you don&#39;t have to care
about cross-browser support: you&#39;re using a known webkit version running on your own server which
you control.
&lt;/p&gt;&lt;p&gt;
Here&#39;s the CSS:
&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;.page {
  width:            195mm
  height:           270mm
  page-break-after: always
  overflow:         hidden
}

.page .landscape {
  position:                  relative
  margin:                    270mm 0
  width:                     270mm
  height:                    195mm
  -webkit-transform:         rotate(-90deg)
  -webkit-transform-origin:  0mm 0mm
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;
The &lt;code&gt;.page&lt;/code&gt; rules simply define an A4 page (after margins), and guarantee a page-break
at the end of each page, just in case your printer didn&#39;t understand. The CSS assumes that you
print in portrait by default. When you want landscape, nest a &lt;code&gt;&amp;lt;landscape&amp;gt;&lt;/code&gt;
element inside your &lt;code&gt;&amp;lt;page&amp;gt;&lt;/code&gt;. Here&#39;s an example:
&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;page&amp;gt;
  This is the first page. It gets printed in portrait mode
&amp;lt;/page&amp;gt;

&amp;lt;page&amp;gt;
  &amp;lt;landscape&amp;gt;
    This is the second page. It gets printed in landscape mode.
    You will have to twist your head to read it.
  &amp;lt;/landscape&amp;gt;
&amp;lt;/page&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;
Not so bad, no? Good luck!
&lt;/p&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;copyright conan dalton 2007-2010 feel free to quote please link back&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.conandalton.net/feeds/2702649204187547922/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.conandalton.net/2012/02/mixing-landscape-and-portrait-rendering.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/2702649204187547922'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/2702649204187547922'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/2012/02/mixing-landscape-and-portrait-rendering.html' title='Mixing Landscape and Portrait rendering in a Wicked PDF document'/><author><name>conan</name><uri>http://www.blogger.com/profile/03401726635379568413</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfwQkipN7fcLo1L09CxXGmZEftHKp-PTOF-RSd6ElP-5kZ81tT_seKNKxS3EovpoQCGed43r39qirdhmGvmpIefkjOooNH-NypZ_oDmAdimI56h8nXboyRvXR7RZTAzQ/s220/approved.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4089129643157405806.post-3647928107331547941</id><published>2012-02-06T23:31:00.001+01:00</published><updated>2012-02-15T12:49:00.695+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="software"/><title type='text'>MySQL &quot;LOAD DATA INFILE&quot; with no primary key</title><content type='html'>&lt;p&gt;
I&#39;m migrating a whole bunch of legacy data into mysql for a client.
I export from their system, &lt;a href=&quot;http://www.conandalton.net/2011/09/incestuous-sed.html&quot;&gt; use sed to patch the nonconforming unparseable CSV
it outputs&lt;/a&gt;, convert from macroman to UTF8, then tell MySQL to
load it all into a series of tables from which the data will later
be integrated into the standard system.
&lt;/p&gt;&lt;p&gt;
Today I realised the error of my ways: the column that I was using as a
primary key isn&#39;t a primary key at all (at least not in the modern
sense - of having a unique value - that we&#39;ve become accustomed to since Codd invented the
&lt;a href=&quot;http://en.wikipedia.org/wiki/Relational_model&quot;&gt;relational model&lt;/a&gt; in 1969).
&lt;/p&gt;&lt;p&gt;
I could have realised this earlier by just declaring it a primary key
and watching MySQL spit at me, and therefore have fixed the problem
sooner ... but no, who needs tests and constraints when assumptions
are so much faster?
&lt;/p&gt;&lt;p&gt;
Enough about me ... the problem now is to assign each row in the exported
data a unique id, and the easiest, obviousest way to do that is to include
an &lt;code&gt;id integer primary key auto_increment&lt;/code&gt; column in each table
definition, let &lt;code&gt;LOAD DATA INFILE etc etc&lt;/code&gt; shove the data into
the table, and the primary key takes care of itself.
&lt;/p&gt;&lt;p&gt;
But it wasn&#39;t obvious how to make this work without warnings about mismatched
columns. Here&#39;s the clever bit: what I did in the end was to add the &lt;code&gt;id&lt;/code&gt;
column &lt;i&gt;after&lt;/i&gt; loading the data. In other words, I imported the data
into a table with no &lt;code&gt;id&lt;/code&gt; primary key column; and added that
column afterwards. It&#39;s easy to script, it does exactly what I want, and
it produces no spurious warnings. Perfecto!
&lt;/p&gt;&lt;p&gt;
Here&#39;s the concept in code:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt; create table legacy_stuff(leg_col_1 varchar(255), leg_col_2 varchar(255), et_cetera_1 varchar(255), et_cetera_2 varchar(255));

&amp;gt; load data infile &#39;legacy_stuff.csv&#39; into table legacy_stuff; -- plus all your favourite options;

&amp;gt; show warnings;

&amp;gt; alter table legacy_stuff add column id integer primary key auto_increment;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
Good luck...
&lt;/p&gt;&lt;p&gt;
&lt;i&gt;Update&lt;/i&gt;: for another way to look at this, see the
&lt;a href=&quot;http://stackoverflow.com/questions/1657028/mysql-load-data-infile-loading-a-file-with-no-primary-key&quot;&gt;stackoverflow&lt;/a&gt;
page on this topic. It turns out you can use &lt;code&gt;load data infile&lt;/code&gt;
with the list of columns you want to import to, in which case MySQL will
match the columns of your CSV to your specified column list. This way you
can let your auto-increment primary key column simply manage itself. This
solution does not suit my particular situation as I&#39;m importing tables with
hundreds of columns (they didn&#39;t believe in normalisation where this data
comes from), and I don&#39;t want to have to maintain the column list in multiple
places.
&lt;/p&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;copyright conan dalton 2007-2010 feel free to quote please link back&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.conandalton.net/feeds/3647928107331547941/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.conandalton.net/2012/02/mysql-load-data-infile-with-no-primary.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/3647928107331547941'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/3647928107331547941'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/2012/02/mysql-load-data-infile-with-no-primary.html' title='MySQL &quot;LOAD DATA INFILE&quot; with no primary key'/><author><name>conan</name><uri>http://www.blogger.com/profile/03401726635379568413</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfwQkipN7fcLo1L09CxXGmZEftHKp-PTOF-RSd6ElP-5kZ81tT_seKNKxS3EovpoQCGed43r39qirdhmGvmpIefkjOooNH-NypZ_oDmAdimI56h8nXboyRvXR7RZTAzQ/s220/approved.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4089129643157405806.post-8145939799301491026</id><published>2012-01-30T22:48:00.000+01:00</published><updated>2012-01-30T23:38:34.713+01:00</updated><title type='text'>ActiveRecord, I18n, Date, and UX</title><content type='html'>From a usability perspective, there&#39;s a lot to be said for calendar-oriented date input
- the kind with a drop-down list for each of day, month, and year, or even a javascripty
popup that makes a calendar with pix of lovely ladies) so that your users can simply
point to the date they want without needing to think extensively. Also, it&#39;s not possible
for them to write &quot;LOL&quot; or &quot;thou villainous, clay-brained fustinarian&quot; or any other
reddit/4chan internet-meme-insult-joke kind of thing instead of an actual date.
&lt;/p&gt;&lt;p&gt;
On top of all those advantages, this approach totally avoids the issue of a certain
country habitually writing down the month and the date the wrong way around.
&lt;/p&gt;&lt;p&gt;
From a frustratability perspective though, if your clients are people who use your system
day in, day out because their business depends on it, you should probably consider them
expert users, consider them willing to learn a particular date format so they can type it
in a text box, because that&#39;s a helluva lot faster than picking your way through calendar
boxes.
&lt;/p&gt;&lt;p&gt;
Ruby&#39;s Date class will parse from a wide variety of formats:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
&gt; Date.parse &quot;december 15th, 1965&quot;
 =&gt; Wed, 15 Dec 1965
&gt; Date.parse &quot;1st jan&quot;
 =&gt; Sun, 01 Jan 2012
&gt; Date.parse &quot;1st jan 2038&quot;
 =&gt; Fri, 01 Jan 2038
&gt; Date.parse &quot;1 jul 2000&quot;
 =&gt; Sat, 01 Jul 2000
&gt; Date.parse &quot;jul 2nd 2000&quot;
 =&gt; Sun, 02 Jul 2000
&gt; Date.parse &quot;27/2/2000&quot;
 =&gt; Sun, 27 Feb 2000
&gt; Date.parse &quot;19-09-2009&quot;
 =&gt; Sat, 19 Sep 2009
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
The only problem is when your users happen to be French. (Or German, or Swedish, or any
of those crazy places that don&#39;t speak Ze English).
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
&gt; Date.parse &quot;19-fevrier-2013&quot;
 =&gt; Thu, 19 Jan 2012
&gt; Date.parse &quot;19-mars-2013&quot;
 =&gt; Tue, 19 Mar 2013
&gt; Date.parse &quot;19-avril-2013&quot;
 =&gt; Thu, 19 Jan 2012
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
Something doesn&#39;t look right here. March works because (I suppose) Ruby looks at
only the first three characters of the month token, so &quot;mars&quot; in French works out
the same as &quot;March&quot; in English.
&lt;/p&gt;&lt;p&gt;
This is all a problem, because your expert users, impatiently bristling to get their
hands on your finely-crafted app, are going to enter dates in a non-English language in a
text field in a form on a web page that you are going to feed directly to an ActiveRecord
object
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
def update
  @widget.update_attributes params[:widget]
end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
where &lt;code&gt;params[:widget][:expires]&lt;/code&gt; is &quot;30 avr 2014&quot; for example. Ouch.
Internally, ActiveRecord calls &lt;code&gt;Date._parse&lt;/code&gt; (as does
&lt;code&gt;Date.parse&lt;/code&gt; which we&#39;ve been looking at above, so you can guess what
ActiveRecord will do by looking at what &lt;code&gt;Date.parse&lt;/code&gt; does).
&lt;/p&gt;&lt;p&gt;
So, what you were really looking for was a patch for &lt;code&gt;Date._parse&lt;/code&gt; that will
automagically convert those foreigner month names so that stuff works as it should.
&lt;/p&gt;&lt;p&gt;
As it happens, I&#39;ve written a little gist that you can take home with you and enjoy.
I keep it under &lt;code&gt;config/initializers/date.rb&lt;/code&gt;. It monkey-patches
&lt;code&gt;Date._parse&lt;/code&gt; to &lt;code&gt;gsub&lt;/code&gt; anything that might be a month, before
forwarding to the original Ruby implementation, only if the current locale is not
&lt;code&gt;:en&lt;/code&gt;. It relies on translation strings that you provide via Rails&#39; I18n
library. Specifically, it looks up &lt;code&gt;date.abbr_month_names&lt;/code&gt;, and &lt;code&gt;
date.month_names&lt;/code&gt; to construct a map from $local_month_name to $month_name_in_english
that Ruby can deal with.
&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/1706871.js&quot;&gt; &lt;/script&gt;

&lt;i&gt;The code is in a &lt;a href=&quot;https://gist.github.com/1706871&quot;&gt;github gist&lt;/a&gt; in case you can&#39;t see it here in your reader&lt;/i&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;copyright conan dalton 2007-2010 feel free to quote please link back&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.conandalton.net/feeds/8145939799301491026/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.conandalton.net/2012/01/activerecord-i18n-date-and-ux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/8145939799301491026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/8145939799301491026'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/2012/01/activerecord-i18n-date-and-ux.html' title='ActiveRecord, I18n, Date, and UX'/><author><name>conan</name><uri>http://www.blogger.com/profile/03401726635379568413</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfwQkipN7fcLo1L09CxXGmZEftHKp-PTOF-RSd6ElP-5kZ81tT_seKNKxS3EovpoQCGed43r39qirdhmGvmpIefkjOooNH-NypZ_oDmAdimI56h8nXboyRvXR7RZTAzQ/s220/approved.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4089129643157405806.post-7011661763296984393</id><published>2011-11-28T09:39:00.000+01:00</published><updated>2011-11-28T09:41:43.898+01:00</updated><title type='text'>spk, or, rspec for lazies</title><content type='html'>&lt;p&gt;
My tests fail.

Fortunately, they fail, otherwise I wouldn&#39;t be sure they were really working.

Anyway, my full rspec suite is over 1600 examples now,
and it takes about 90 seconds to run
(including 20 seconds of overhead booting rails).

After tweaking my code, I want to re-run only the failing tests,
and I hate typing pathnames.

Something I would also like to do, is re-run my specs but only a very narrow subset, without having to type in the entire path to the spec in question.
&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ spk
&lt;span style=color:#080;&#39;&gt;......................................&lt;/span&gt;&lt;span style=color:#800;&#39;&gt;FFFF&lt;/span&gt;&lt;span style=color:#080;&#39;&gt;..&lt;/span&gt;&lt;span style=color:#800;&#39;&gt;F&lt;/span&gt;&lt;span style=color:#080;&#39;&gt;....&lt;/span&gt;&lt;span style=color:#800;&#39;&gt;FFF&lt;/span&gt;&lt;span style=color:#080;&#39;&gt;................................[etc]&lt;/span&gt;

/Users/conan/myproject/spec/controllers/adm&lt;span style=&#39;background:#008;&#39;&gt;in/invoices_controller_s&lt;/span&gt;pec.rb:96 Expected &#39;this&#39;, got &#39;that&#39;

1 failed, etc etc

$ spk in/invoices_controller_s
spec/controllers/admin/invoices_controller_spec.rb
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And the last line will run just the spec file that previously failed.&lt;/p&gt;

&lt;p&gt;
What&#39;s more, using rspec, I can easily choose a directory of specs to run,
like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ rspec spec/controllers/&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;
but occasionally I would like to run only a specific subset of specs, 
for example invoice-related specs, 
because I&#39;ve made big changes to my invoice class, 
and I want to check for ripples in neighbouring code:
&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ rspec spec/controllers/admin/invoices_controller_spec.rb spec/models/invoice_spec.rb spec/views/admin/invoices/* spec/helpers/admin/invoices_helper_spec.rb&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;
without having to type all that stuff.
&lt;/p&gt;

&lt;p&gt;
In other words, I want to select a horizontal subset of my specs.

For example, if I just want to run invoice-related specs:
&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ spk invoice
spec/controllers/admin/invoices_controller_spec.rb
spec/models/invoice_spec.rb
spec/views/admin/invoices/index.html.haml_spec.rb
spec/views/admin/invoices/show.html.haml_spec.rb
spec/views/admin/invoices/_form.html.haml_spec.rb
spec/helpers/admin/invoices_helper_spec.rb

&lt;span style=color:#080;&#39;&gt;....................................................................................[etc]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;The good news is: here&#39;s a wee script to do just that:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/bin/bash

if [ &quot;$1&quot; = &quot;&quot; ]
then
  time rspec spec
else
  SPK_FILES=`find spec -type f -name &quot;*_spec.rb&quot; | grep $1`
  echo $SPK_FILES
  time rspec $SPK_FILES  --format documentation
fi
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;
Call it &quot;spk&quot; or whatever you want,
put it in your path,
chmod it 755,
and use it as indicated above.
&lt;/p&gt;

Enjoy!&lt;div class=&quot;blogger-post-footer&quot;&gt;copyright conan dalton 2007-2010 feel free to quote please link back&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.conandalton.net/feeds/7011661763296984393/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.conandalton.net/2011/11/spk-or-rspec-for-lazies.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/7011661763296984393'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/7011661763296984393'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/2011/11/spk-or-rspec-for-lazies.html' title='spk, or, rspec for lazies'/><author><name>conan</name><uri>http://www.blogger.com/profile/03401726635379568413</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfwQkipN7fcLo1L09CxXGmZEftHKp-PTOF-RSd6ElP-5kZ81tT_seKNKxS3EovpoQCGed43r39qirdhmGvmpIefkjOooNH-NypZ_oDmAdimI56h8nXboyRvXR7RZTAzQ/s220/approved.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4089129643157405806.post-3116793397676096338</id><published>2011-11-12T10:52:00.001+01:00</published><updated>2011-11-12T10:54:09.552+01:00</updated><title type='text'>Lexmark considered evil</title><content type='html'>&lt;p&gt;Right, you&#39;ll tell me, they make printers, what was I expecting?
Well, I stumbled on this only today: I can&#39;t print a black/white-only document using my Lexmark S600 if the &lt;em&gt;colour&lt;/em&gt; cartridges are low.
There is no technical justification for this. Black/white printers have been printing black/white documents for many years without needing
colour cartridges. A Lexmark S600 could do the same. But Lexmark clearly cares less about you than about its bank account.&lt;/p&gt;

&lt;p&gt;I&#39;d love to say, never buy a Lexmark again, but I don&#39;t know of another manufacturer that&#39;s less crappy. Suggestions welcome.&lt;/p&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;copyright conan dalton 2007-2010 feel free to quote please link back&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.conandalton.net/feeds/3116793397676096338/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.conandalton.net/2011/11/lexmark-considered-evil.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/3116793397676096338'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/3116793397676096338'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/2011/11/lexmark-considered-evil.html' title='Lexmark considered evil'/><author><name>conan</name><uri>http://www.blogger.com/profile/03401726635379568413</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfwQkipN7fcLo1L09CxXGmZEftHKp-PTOF-RSd6ElP-5kZ81tT_seKNKxS3EovpoQCGed43r39qirdhmGvmpIefkjOooNH-NypZ_oDmAdimI56h8nXboyRvXR7RZTAzQ/s220/approved.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4089129643157405806.post-7024457721140691796</id><published>2011-09-26T14:19:00.001+02:00</published><updated>2011-09-26T15:40:31.674+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="software"/><title type='text'>Incestuous Sed, or, &#39;s_..*_s/\\&quot;&amp;\\&quot;/\\\\\\&quot;&amp;\\\\\\&quot;/g_g&#39;</title><content type='html'>&lt;p&gt;I have a CSV file to import; I have no control over the producer of this file, and its output is unfortunately non-conforming; it encloses every non-numeric field in double quotes, and fails to escape double quotes within the field. In other words, I have something like this:
&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;1,&quot;Foo&quot;,&quot;A &quot;Lord of the Rings&quot; expert&quot;,&quot;Blah&quot;,123.45
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;While it is possible to imagine a parser that might be able to cope with this, in my case I&#39;m importing into MySQL (&quot;load data infile ...&quot;) and MySQL has no plans to accommodate this kind of CSV right now today. In order to import this, I need to transform it to the following:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;1,&quot;Foo&quot;,&quot;A \&quot;Lord of the Rings\&quot; expert&quot;,&quot;Blah&quot;,123.45
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;One solution is to detect quotes that are not part of the pattern /&quot;,&quot;/, but that gets tricky for first, last, and numeric columns. Given that the data is finite and changes slowly, I decided to write down the expressions that needed fixing, and write a sed expression to fix them.&lt;/p&gt;

&lt;p&gt;To fix the above, all I need is&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cat data.csv | sed &#39;s/\&quot;Lord\ of\ the\ Rings\&quot;/\\\&quot;Lord\ of\ the\ Rings\\\&quot;/g&#39; &gt; clean-data.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;But given a list of expressions to fix, I don&#39;t want to go the error-prone way of typing out all these sed commands line-by-line, making sure to escape all the spaces and other special chars, and counting backslashes. What can I use to transform these expressions into sed commands? Why, sed, of course! Here&#39;s how I transform a list of expressions into a list of corresponding quote-escaping sed commands, for use immediately afterwards in the same script:
&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cat quoted_terms.txt | sed -e &#39;s/( |\?)/\\\&amp;/g&#39; -e &#39;s_.*_s/\\&quot;&amp;\\&quot;/\\\\\\&quot;&amp;\\\\\\&quot;/g_g&#39; &gt; clean.sed
  cat data.csv | sed -f clean.sed &gt; clean-data.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Yes, it&#39;s Backslash Hell!! The first line transforms this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Lord of the Rings
The Canterbury Tales
Ulysses
Is Anybody Home?
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;into this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;s/\&quot;Lord\ of\ the\ Rings\&quot;/\\\&quot;Lord\ of\ the\ Rings\\\&quot;/g
s/\&quot;The\ Canterbury\ Tales\&quot;/\\\&quot;The\ Canterbury\ Tales\\\&quot;/g
s/\&quot;Ulysses\&quot;/\\\&quot;Ulysses\\\&quot;/g
s/\&quot;Is\ Anybody\ Home\?\&quot;/\\\&quot;Is\ Anybody\ Home\?\\\&quot;/g
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then the second line transforms this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;1,&quot;Foo&quot;,&quot;A &quot;Lord of the Rings&quot; expert&quot;,&quot;Blah&quot;,123.45
2,&quot;Bar&quot;,&quot;Read all of &quot;The Canterbury Tales&quot;&quot;,&quot;Blah&quot;,234.56
3,&quot;Toto&quot;,&quot;&quot;Ulysses&quot;&quot;,&quot;Blah&quot;,345.67
4,&quot;Titi&quot;,&quot;Asked &quot;Is Anybody Home?&quot;&quot;,&quot;Blah&quot;,456.78
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;
into this:
&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;1,&quot;Foo&quot;,&quot;A \&quot;Lord of the Rings\&quot; expert&quot;,&quot;Blah&quot;,123.45
2,&quot;Bar&quot;,&quot;Read all of \&quot;The Canterbury Tales\&quot;&quot;,&quot;Blah&quot;,234.56
3,&quot;Toto&quot;,&quot;\&quot;Ulysses\&quot;&quot;,&quot;Blah&quot;,345.67
4,&quot;Titi&quot;,&quot;Asked \&quot;Is Anybody Home?\&quot;&quot;,&quot;Blah&quot;,456.78
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;
And voilà, clean csv all ready for import ... all thanks to the power of sed to mate with itself and generate more sed ...
&lt;/p&gt;
&lt;p&gt;
Now, you can go and enjoy &lt;a href=&quot;http://www.grymoire.com/Unix/Sed.html&quot;&gt;Sed - An Introduction and Tutorial by Bruce Barnett&lt;/a&gt;, because I&#39;m not going to try explain all those backslashes
&lt;/p&gt;
&lt;div class=&quot;blogger-post-footer&quot;&gt;copyright conan dalton 2007-2010 feel free to quote please link back&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.conandalton.net/feeds/7024457721140691796/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.conandalton.net/2011/09/incestuous-sed.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/7024457721140691796'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/7024457721140691796'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/2011/09/incestuous-sed.html' title='Incestuous Sed, or, &#39;s_..*_s/\\&quot;&amp;\\&quot;/\\\\\\&quot;&amp;\\\\\\&quot;/g_g&#39;'/><author><name>conan</name><uri>http://www.blogger.com/profile/03401726635379568413</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfwQkipN7fcLo1L09CxXGmZEftHKp-PTOF-RSd6ElP-5kZ81tT_seKNKxS3EovpoQCGed43r39qirdhmGvmpIefkjOooNH-NypZ_oDmAdimI56h8nXboyRvXR7RZTAzQ/s220/approved.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4089129643157405806.post-5610686039686915547</id><published>2011-03-03T18:46:00.003+01:00</published><updated>2011-03-03T18:55:25.854+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="software"/><title type='text'>Convert Your MYSQL Database from Latin-1 to UTF-8</title><content type='html'>&lt;p&gt;It all started when I tried upgrading to ruby 1.9.2 and learned more
than I ever wanted to know about character encodings. All of a sudden,
my site was showing text humans were never supposed to read, with
gibberish in place of recognisably foreign accented letters.&lt;p&gt;

&lt;p&gt;I tried using the &lt;code&gt;mysql2&lt;/code&gt; gem, and setting &lt;code&gt;Encoding.default_external = &#39;UTF-8&#39;&lt;/code&gt; in my &lt;code&gt;environment.rb&lt;/code&gt;, these steps were necessary but not enough.&lt;/p&gt;

&lt;p&gt; After much googling, it became evident that I had to go through each text field in each row in each table, and convert each latin-1 character to utf-8.&lt;/p&gt;

&lt;p&gt;You would think that &lt;code&gt;alter table #{table} convert to character
set utf8&lt;/code&gt; would do the trick, but no. You would be wrong. At
least, I was.&lt;/p&gt;

&lt;p&gt;Many authors have chimed in on this topic, but my hat goes off to
Derek Sivers who showed the light in an O&#39;Reilly article on &lt;a href=&quot;http://www.oreillynet.com/onlamp/blog/2006/01/turning_mysql_data_in_latin1_t.html&quot;&gt;converting
latin1 to utf-8 in mysql&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I didn&#39;t want to do all the work he did, and figured a
rails/activerecord migration
might ease the pain somewhat. Below you&#39;ll find what I came up with.
Re-use as you please. You&#39;ll need to specify the table/column names that
need converting, and you might want to make sure I&#39;ve covered all the
characters that matter to you.&lt;/p&gt;

&lt;p&gt;Basically, all this does is iterate over the tables and columns you
specify, and then iterates over all the shady latin-1 characters you
need to fix, and asks mysql to replace them with the utf-8
equivalent. Someone with stronger mysql-fu might find a cleverer way to
do this; in the meantime, here goes:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
# encoding: UTF-8

class ConvertMySqlLatin1ColumnsToUtf8 &lt; ActiveRecord::Migration
  def self.up

    execute(&quot;set names utf8&quot;)

    # change this hash for your application. This example here is for a
    # totally original blog application concept.
    keys = {
        :authors   =&gt; %w{first_name last_name},
        :blogs =&gt; %w{name description},
        :entries =&gt; %w{title content tags},
        :comments =&gt; %w{content}
    }

    conversions = {
      &#39;C383C2A1&#39;         =&gt; &#39;á&#39;, &#39;C383C2A0&#39;       =&gt; &#39;à&#39;, &#39;C383C2A4&#39;       =&gt; &#39;ä&#39;, &#39;C383C2A2&#39;   =&gt; &#39;â&#39;,
      &#39;C383C2A9&#39;         =&gt; &#39;é&#39;, &#39;C383C2A8&#39;       =&gt; &#39;è&#39;, &#39;C383C2AB&#39;       =&gt; &#39;ë&#39;, &#39;C383C2AA&#39;   =&gt; &#39;ê&#39;,
      &#39;C383C2AD&#39;         =&gt; &#39;í&#39;, &#39;C383C2AC&#39;       =&gt; &#39;ì&#39;, &#39;C383C2AF&#39;       =&gt; &#39;ï&#39;, &#39;C383C2AE&#39;   =&gt; &#39;î&#39;,
      &#39;C383C2B3&#39;         =&gt; &#39;ó&#39;, &#39;C383C2B2&#39;       =&gt; &#39;ò&#39;, &#39;C383C2B6&#39;       =&gt; &#39;ö&#39;, &#39;C383C2B4&#39;   =&gt; &#39;ô&#39;,
      &#39;C383C2BA&#39;         =&gt; &#39;ú&#39;, &#39;C383C2B9&#39;       =&gt; &#39;ù&#39;, &#39;C383C2BC&#39;       =&gt; &#39;ü&#39;, &#39;C383C2BB&#39;   =&gt; &#39;û&#39;,
      &#39;C383C281&#39;         =&gt; &#39;Á&#39;, &#39;C383E282AC&#39;     =&gt; &#39;À&#39;, &#39;C383E2809E&#39;     =&gt; &#39;Ä&#39;, &#39;C383E2809A&#39; =&gt; &#39;Â&#39;,
      &#39;C383E280B0&#39;       =&gt; &#39;É&#39;, &#39;C383CB86&#39;       =&gt; &#39;È&#39;, &#39;C383E280B9&#39;     =&gt; &#39;Ë&#39;, &#39;C383C5A0&#39;   =&gt; &#39;Ê&#39;,
      &#39;C383C28D&#39;         =&gt; &#39;Í&#39;, &#39;C383C592&#39;       =&gt; &#39;Ì&#39;, &#39;C383C28F&#39;       =&gt; &#39;Ï&#39;, &#39;C383C5BD&#39;   =&gt; &#39;Î&#39;,
      &#39;C383E2809C&#39;       =&gt; &#39;Ó&#39;, &#39;C383E28099&#39;     =&gt; &#39;Ò&#39;, &#39;C383E28093&#39;     =&gt; &#39;Ö&#39;, &#39;C383E2809D&#39; =&gt; &#39;Ô&#39;,
      &#39;C383C5A1&#39;         =&gt; &#39;Ú&#39;, &#39;C383E284A2&#39;     =&gt; &#39;Ù&#39;, &#39;C383C593&#39;       =&gt; &#39;Ü&#39;, &#39;C383E280BA&#39; =&gt; &#39;Û&#39;,
      &#39;C385C2B8&#39;         =&gt; &#39;Ÿ&#39;, &#39;C385E2809C&#39;     =&gt; &#39;œ&#39;, &#39;C383C2B8&#39;       =&gt; &#39;ø&#39;, &#39;C383C2BF&#39;   =&gt; &#39;ÿ&#39;,
      &#39;C3A2E282ACC593&#39;   =&gt; &#39;“&#39;, &#39;C3A2E282ACC29D&#39; =&gt; &#39;”&#39;, &#39;C3A2E282ACCB9C&#39; =&gt; &#39;‘&#39;,
      &#39;C3A2E282ACE284A2&#39; =&gt; &#39;’&#39;, &#39;C382C2AB&#39;       =&gt; &#39;«&#39;, &#39;C382C2BB&#39;       =&gt; &#39;»&#39;,
      &#39;C383C2A5&#39;         =&gt; &#39;å&#39;, &#39;C383E280A6&#39;     =&gt; &#39;Å&#39;, &#39;C383C5B8&#39;       =&gt; &#39;ß&#39;, &#39;C383E280A0&#39; =&gt; &#39;Æ&#39;, 
      &#39;C383C2A7&#39;         =&gt; &#39;ç&#39;, &#39;C383E280A1&#39;     =&gt; &#39;Ç&#39;, &#39;C383C2B1&#39;       =&gt; &#39;ñ&#39;, &#39;C383E28098&#39; =&gt; &#39;Ñ&#39;, 
      &#39;C383C2A3&#39;         =&gt; &#39;ã&#39;, &#39;C383C2B5&#39;       =&gt; &#39;õ&#39;, &#39;C383C692&#39;       =&gt; &#39;Ã&#39;, &#39;C383E280A2&#39; =&gt; &#39;Õ&#39;
    }

    keys.each { |table, columns|
      execute &quot;alter table #{table} convert to character set utf8&quot;
      columns.each { |column|
        conversions.each { |hex, utf8|
          execute(&quot;update #{table} set #{column} = replace(#{column}, unhex(&#39;#{hex}&#39;), &#39;#{utf8}&#39;) where #{column} regexp unhex(&#39;#{hex}&#39;);&quot;)
        }
      }
    }
  end

  def self.down
    # left as an exercise for the reader :)
  end
end
&lt;/pre&gt;&lt;/code&gt;

&lt;p&gt;The # encoding comment at the beginning is important, don&#39;t leave it
out or ruby 1.9.2 will complain.&lt;/p&gt;

&lt;p&gt;Use this to check you&#39;ve covered all the relevant text columns:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
mysql&gt; use information_schema
mysql&gt; select table_name, column_name from columns where table_schema = &#39;__YOUR_DB_NAME__&#39; and (data_type = &#39;varchar&#39; or data_type = &#39;text&#39;);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;(There might be other relevant data types, like &#39;mediumtext&#39; that you
have to deal with; don&#39;t just take my word for it)&lt;/p&gt;

&lt;p&gt;Here are some other places covering latin1/utf8 conversion:
&lt;br class=&quot;forReal&quot;&gt;&lt;a href=&quot;http://stackoverflow.com/questions/4188677&quot;&gt;http://stackoverflow.com/questions/4188677&lt;/a&gt;
&lt;br class=&quot;forReal&quot;&gt;&lt;a href=&quot;http://groups.google.com/group/rails-i18n/browse_thread/thread/0146440dbf7d23ab&quot;&gt;http://groups.google.com/group/rails-i18n/browse_thread/thread/0146440dbf7d23ab&lt;/a&gt;
&lt;br class=&quot;forReal&quot;&gt;&lt;a href=&quot;http://www.ruby-forum.com/topic/212452&quot;&gt;http://www.ruby-forum.com/topic/212452&lt;/a&gt;
&lt;br class=&quot;forReal&quot;&gt;&lt;a href=&quot;http://stackoverflow.com/questions/4453842&quot;&gt;http://stackoverflow.com/questions/4453842&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;Enjoy!&lt;/p&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;copyright conan dalton 2007-2010 feel free to quote please link back&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.conandalton.net/feeds/5610686039686915547/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.conandalton.net/2011/03/convert-your-mysql-database-from-latin.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/5610686039686915547'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/5610686039686915547'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/2011/03/convert-your-mysql-database-from-latin.html' title='Convert Your MYSQL Database from Latin-1 to UTF-8'/><author><name>conan</name><uri>http://www.blogger.com/profile/03401726635379568413</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfwQkipN7fcLo1L09CxXGmZEftHKp-PTOF-RSd6ElP-5kZ81tT_seKNKxS3EovpoQCGed43r39qirdhmGvmpIefkjOooNH-NypZ_oDmAdimI56h8nXboyRvXR7RZTAzQ/s220/approved.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4089129643157405806.post-5731217930128356324</id><published>2011-02-14T11:27:00.001+01:00</published><updated>2011-02-14T11:28:54.132+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="software"/><title type='text'>AWS SES RequestExpired</title><content type='html'>&lt;p&gt;
SendGrid tells me I need a reseller account, and Postmark won&#39;t let me send newsletter-style messages; so it&#39;s time to try Amazon&#39;s Simple Email Service. All I need is a big machine that takes care of delivering mail, the rest is fluff.
&lt;/p&gt;

&lt;p&gt;
I&#39;m using &lt;a href=&quot;https://github.com/drewblas/aws-ses&quot;&gt;drewblas/aws-ses&lt;/a&gt;. Somewhere between ActionMailer and AWS::SES, errors are swallowed and your application fails to let you know that emails aren&#39;t getting sent. By the time I had broken the &quot;fetch mail&quot; button on my mail client, it was time to run &lt;code&gt;rails console&lt;/code&gt; on the server to figure out what was going on:
&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ RAILS_ENV=staging rails console
Loading staging environment (Rails 3.0.3)
irb(main):001:0&amp;gt; require &quot;aws/ses&quot;
false
irb(main):003:0&amp;gt; ses = AWS::SES::Base.new :access_key_id =&amp;gt; &quot;your_access_key&quot;, :secret_access_key =&amp;gt; &quot;not_telling_you&quot;
=&amp;gt; #&amp;lt;AWS::SES::Base:0x7fd3607d0308 etc... &amp;gt;
irb(main):003:0&amp;gt; ses.send_email :to =&amp;gt; [&#39;me@my.domain&#39;], :source =&amp;gt; &#39;test@other.domain&#39;, :subject =&amp;gt; &#39;Testing&#39;, :text_body =&amp;gt; &#39;Yes, testing!&#39;
&lt;b&gt;AWS::SES::ResponseError: AWS::SES Response Error: RequestExpiredRequest&lt;/b&gt; timestamp: Mon, 14 Feb 2011 10:13:32 GMT expired.  It must be within 300 secs/ of server time.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;
It turns out that my server&#39;s clock was racing into the future. I like how Slicehost moves fast, but I wasn&#39;t expecting observable relativistic effects. My server was 8 whole minutes ahead of the rest of the world. If I wasn&#39;t busy building my cool new site I could have used it to game the stock market or something wicked like that ...
&lt;/p&gt;

&lt;p&gt;
Anyway, thanks to &lt;a href=&quot;https://codeghar.wordpress.com/2007/12/06/manage-time-in-ubuntu-through-command-line/&quot;&gt;Code Ghar&lt;/a&gt; here&#39;s the solution:
&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
$ date
Mon Feb 14 10:16:24 UTC 2011
$ sudo ntpdate pool.ntp.org
14 Feb 10:08:55 ntpdate[25724]: step time server 38.229.71.1 offset -639.622800 sec
$ date
Mon Feb 14 10:09:01 UTC 2011
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;
Happy mailing!
&lt;/p&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;copyright conan dalton 2007-2010 feel free to quote please link back&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.conandalton.net/feeds/5731217930128356324/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.conandalton.net/2011/02/aws-ses-requestexpired.html#comment-form' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/5731217930128356324'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/5731217930128356324'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/2011/02/aws-ses-requestexpired.html' title='AWS SES RequestExpired'/><author><name>conan</name><uri>http://www.blogger.com/profile/03401726635379568413</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfwQkipN7fcLo1L09CxXGmZEftHKp-PTOF-RSd6ElP-5kZ81tT_seKNKxS3EovpoQCGed43r39qirdhmGvmpIefkjOooNH-NypZ_oDmAdimI56h8nXboyRvXR7RZTAzQ/s220/approved.jpg'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4089129643157405806.post-2152863760007929724</id><published>2011-02-03T23:17:00.001+01:00</published><updated>2013-10-23T23:04:06.420+02:00</updated><title type='text'>Paperclip, S3, and European Buckets</title><content type='html'>&lt;p&gt;&lt;b&gt;UPDATE&lt;/b&gt; @englandpost points out that newer versions of paperclip support the :s3_host_name option, see &lt;a href=&#39;http://rubydoc.info/gems/paperclip/Paperclip/Storage/S3&#39;&gt;http://rubydoc.info/gems/paperclip/Paperclip/Storage/S3&lt;/a&gt;. Thanks @englandpost  &lt;hr/&gt;&lt;p&gt;So you have your European S3 bucket thinking how cool you can select buckets near where your customers live, you &lt;code&gt;gem install paperclip aws_s3&lt;/code&gt; and do the dances and the rails and the rituals and the &lt;code&gt;cap production deploy&lt;/code&gt;, and you get &lt;/p&gt;&lt;pre&gt;&lt;code&gt;
The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Not Fair! &lt;/p&gt;&lt;p&gt;The interblags reccomend you use &lt;code&gt;gem install s3&lt;/code&gt; instead, with appropriate monkeypatches for &lt;code&gt;Paperclip::Storage::S3&lt;/code&gt;, but you might end up with this: &lt;/p&gt;&lt;pre&gt;&lt;code&gt;
The request signature we calculated does not match the signature you provided. Check your key and signing method.
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I tried and I tried, honest, &lt;code&gt;s3&lt;/code&gt; just wouldn&#39;t play the signature game by amazon&#39;s rules ... couldn&#39;t get anything to work, until I stumbled on &lt;a href=&quot;http://www.mail-archive.com/heroku@googlegroups.com/msg05407.html&quot;&gt;http://www.mail-archive.com/heroku@googlegroups.com/msg05407.html&lt;/a&gt; in which the great and goodly &lt;strong&gt;Dan Croak&lt;/strong&gt; recommends you put this in &lt;code&gt;config/environment.rb&lt;/code&gt;: &lt;/p&gt;&lt;pre&gt;&lt;code&gt;
AWS::S3::DEFAULT_HOST = &quot;s3-eu-west-1.amazonaws.com&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Well lo and behold I was finally able to upload stuff, my pretty pictures are showing up in my AWS console. &lt;/p&gt;&lt;p&gt;But you&#39;re not done yet: you still need to generate the correct URL (&lt;code&gt;my_model.my_attachment.url&lt;/code&gt;) for your pictures and mp3s and videos and Large Objects and whatever your pushing up to the clouds there ... &lt;code&gt;Paperclip::Storage::S3&lt;/code&gt; kindly hard-codes &quot;s3.amazonaws.com&quot; for you, and it doesn&#39;t work. &lt;/p&gt;&lt;p&gt;Here&#39;s the fix: &lt;/p&gt;&lt;pre&gt;&lt;code&gt;
&lt;i&gt;# in config/initializers/something.rb&lt;/i&gt;
Paperclip.interpolates(:s3_eu_url) { |attachment, style|
  &quot;#{attachment.s3_protocol}://s3-eu-west-1.amazonaws.com/#{attachment.bucket_name}/#{attachment.path(style).gsub(%r{^/}, &quot;&quot;)}&quot;
}

&lt;i&gt;# in your model&lt;/i&gt;
has_attached_file :image, 
  :storage =&gt; :s3,
  :s3_credentials =&gt; &quot;#{Rails.root}/config/s3.yml&quot;,
  :path =&gt; &quot;for/example/:id/:style.:extension&quot;,
  &lt;b&gt;:url  =&gt; &quot;:s3_eu_url&quot;&lt;/b&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This is a big song and dance to simply tell paperclip how to construct the s3 url. Left to itself, paperclip will replace your url setting with one of its own (&lt;code&gt;&quot;:s3_path_url&quot;&lt;/code&gt;) if it doesn&#39;t match &lt;code&gt;/^:s3.*url$/&lt;/code&gt;. Hence, the interpolation above is called &quot;s3_eu_url&quot;, you can write your own for singapore or whatever far-flung place you&#39;ve dumped your bucket. &lt;/p&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;copyright conan dalton 2007-2010 feel free to quote please link back&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.conandalton.net/feeds/2152863760007929724/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.conandalton.net/2011/02/paperclip-s3-and-european-buckets.html#comment-form' title='21 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/2152863760007929724'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/2152863760007929724'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/2011/02/paperclip-s3-and-european-buckets.html' title='Paperclip, S3, and European Buckets'/><author><name>conan</name><uri>http://www.blogger.com/profile/03401726635379568413</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfwQkipN7fcLo1L09CxXGmZEftHKp-PTOF-RSd6ElP-5kZ81tT_seKNKxS3EovpoQCGed43r39qirdhmGvmpIefkjOooNH-NypZ_oDmAdimI56h8nXboyRvXR7RZTAzQ/s220/approved.jpg'/></author><thr:total>21</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4089129643157405806.post-8595142322243784293</id><published>2010-11-15T16:25:00.000+01:00</published><updated>2010-11-15T16:27:31.679+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="software"/><title type='text'>HTML5 Canvas terribly slow drawing lines [not]</title><content type='html'>&lt;p&gt;
  Quick heads-up if your canvas application is running awfully slowly, and you&#39;re using &lt;code&gt;beginPath()&lt;/code&gt;, &lt;code&gt;moveTo()&lt;/code&gt;, and/or &lt;code&gt;lineTo()&lt;/code&gt;.
&lt;/p&gt;

&lt;p&gt;
  A simple interpretation of canvas documentation suggests this is a fine way to draw a series of parallel lines (as one might do if one was for example drawing a background grid on one&#39;s canvas) ...
&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  for (var here = start; here &lt; end; here += interval) {
    cx.beginPath();
    cx.moveTo(here, top);
    cx.lineTo(here, bottom);
    cx.stroke();
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;
  &lt;b&gt;&lt;i&gt;One would be terribly, terribly wrong!&lt;/i&gt;&lt;/b&gt; Well, not &lt;i&gt;wrong&lt;/i&gt; exactly, but awfully slow ... try this instead
&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  cx.beginPath();
  for (var here = start; here &lt; end; here += interval) {
    cx.moveTo(here, top);
    cx.lineTo(here, bottom);
  }
  cx.stroke();
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;
  The &lt;code&gt;beginPath()&lt;/code&gt; and &lt;code&gt;stroke()&lt;/code&gt; calls are only needed once each per refresh. My grid drawing dropped from 40ms to 3ms with this change. Not bad ...
&lt;/p&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;copyright conan dalton 2007-2010 feel free to quote please link back&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.conandalton.net/feeds/8595142322243784293/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.conandalton.net/2010/11/html5-canvas-terribly-slow-drawing.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/8595142322243784293'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/8595142322243784293'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/2010/11/html5-canvas-terribly-slow-drawing.html' title='HTML5 Canvas terribly slow drawing lines [not]'/><author><name>conan</name><uri>http://www.blogger.com/profile/03401726635379568413</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfwQkipN7fcLo1L09CxXGmZEftHKp-PTOF-RSd6ElP-5kZ81tT_seKNKxS3EovpoQCGed43r39qirdhmGvmpIefkjOooNH-NypZ_oDmAdimI56h8nXboyRvXR7RZTAzQ/s220/approved.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4089129643157405806.post-7832966866519522954</id><published>2010-10-19T11:00:00.000+02:00</published><updated>2010-10-19T12:23:51.853+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="software"/><title type='text'>gem install mysql [--should-be-easy [--on-a-mac-anyway]]</title><content type='html'>&lt;p&gt;
So after upgrading to Ruby 1.9.2 and  Rails 3 all at once on my shiny new Snow Leopard macbook, (a foolish thing to do! One step at a time! Isolate errors!),
after patching my rails app all over the place till &lt;code&gt;rails_upgrade&lt;/code&gt; stops whining,
and after a gentle reminder to &lt;code&gt;sudo gem install mysql&lt;/code&gt;, I get this:
&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
=&gt; Booting WEBrick
=&gt; Rails 3.0.0 application starting in development on http://0.0.0.0:3000
=&gt; Call with -d to detach
=&gt; Ctrl-C to shutdown server
[2010-10-18 23:29:34] INFO  WEBrick 1.3.1
[2010-10-18 23:29:34] INFO  ruby 1.9.2 (2010-08-18) [x86_64-darwin10]
[2010-10-18 23:29:34] INFO  WEBrick::HTTPServer#start: pid=8426 port=3000
dyld: lazy symbol binding failed: Symbol not found: _mysql_init
  Referenced from: /opt/local/lib/ruby1.9/gems/1.9.1/gems/mysql-2.8.1/lib/mysql_api.bundle
  Expected in: flat namespace

dyld: Symbol not found: _mysql_init
  Referenced from: /opt/local/lib/ruby1.9/gems/1.9.1/gems/mysql-2.8.1/lib/mysql_api.bundle
  Expected in: flat namespace

Trace/BPT trap
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;
A search for &quot;lazy symbol binding failed: Symbol not found: _mysql_init&quot; yields &lt;a href=&quot;http://involution.com/category/ruby-on-rails/&quot;&gt;this&lt;/a&gt;, &lt;a href=&quot;http://blog.bmn.name/2008/02/issues-with-mysql-27-gem/&quot;&gt;this&lt;/a&gt;,
and &lt;a href=&quot;http://blog.cantremember.com/upgrading-your-rails-development-mac-to-snow-leopard/&quot;&gt;this&lt;/a&gt; ... pointing out that you don&#39;t get the wonderful mysql gem without a *little* bit of effort ... but:
&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
$ sudo env ARCHFLAGS=&quot;-arch i386&quot; &lt;b&gt;gem install mysql&lt;/b&gt; -- --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr/local/mysql/include --with-mysql-config=/usr/local/mysql/bin/mysql_config
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
 ERROR: Failed to build gem native extension.

/opt/local/bin/ruby extconf.rb --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr/local/mysql/include --with-mysql-config=/usr/local/mysql/bin/mysql_config
checking for mysql_ssl_set()... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
 --with-opt-dir
 --with-opt-include
 --without-opt-include=${opt-dir}/include
 --with-opt-lib
 --without-opt-lib=${opt-dir}/lib
 --with-make-prog
 --without-make-prog
 --srcdir=.
 --curdir
 --ruby=/opt/local/bin/ruby
 --with-mysql-config
/opt/local/lib/ruby1.9/1.9.1/mkmf.rb:368:in `try_do&#39;: The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
 from /opt/local/lib/ruby1.9/1.9.1/mkmf.rb:435:in `try_link0&#39;
 from /opt/local/lib/ruby1.9/1.9.1/mkmf.rb:440:in `try_link&#39;
 from /opt/local/lib/ruby1.9/1.9.1/mkmf.rb:552:in `try_func&#39;
 from /opt/local/lib/ruby1.9/1.9.1/mkmf.rb:797:in `block in have_func&#39;
 from /opt/local/lib/ruby1.9/1.9.1/mkmf.rb:693:in `block in checking_for&#39;
 from /opt/local/lib/ruby1.9/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone&#39;
 from /opt/local/lib/ruby1.9/1.9.1/mkmf.rb:254:in `open&#39;
 from /opt/local/lib/ruby1.9/1.9.1/mkmf.rb:280:in `block in postpone&#39;
 from /opt/local/lib/ruby1.9/1.9.1/mkmf.rb:254:in `open&#39;
 from /opt/local/lib/ruby1.9/1.9.1/mkmf.rb:276:in `postpone&#39;
 from /opt/local/lib/ruby1.9/1.9.1/mkmf.rb:692:in `checking_for&#39;
 from /opt/local/lib/ruby1.9/1.9.1/mkmf.rb:796:in `have_func&#39;
 from extconf.rb:50:in `&lt;main&gt;&#39;


Gem files will remain installed in /opt/local/lib/ruby1.9/gems/1.9.1/gems/mysql-2.8.1 for inspection.
Results logged to /opt/local/lib/ruby1.9/gems/1.9.1/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;
&quot;You have to install development tools first.&quot; ... thanks dudes ... but &lt;code&gt;sudo port instal mysql-devel&lt;/code&gt; tells me &lt;code&gt;Error: Port mysql_devel not found&lt;/code&gt;.
What are these mysterious development tools?
&lt;/p&gt;

&lt;p&gt;
Someone recommends copying the output of &lt;code&gt;mysql_config --cflags&lt;/code&gt; to the ARCHFLAGS env var, but still no go:
&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
$ mysql_config
Usage: /usr/local/mysql/bin/mysql_config [OPTIONS]
Options:
        --cflags         [-I/usr/local/mysql/include -Os -arch i386 -fno-common]
        --include        [-I/usr/local/mysql/include]
        --libs           [-L/usr/local/mysql/lib -lmysqlclient -lz -lm]
        --libs_r         [-L/usr/local/mysql/lib -lmysqlclient_r -lz -lm]
        --socket         [/tmp/mysql.sock]
        --port           [3306]
        --version        [5.0.37]
        --libmysqld-libs [-L/usr/local/mysql/lib -lmysqld -lz -lm]

$ sudo env ARCHFLAGS=&quot;&lt;b&gt;-Os -arch i386 -fno-common&lt;/b&gt;&quot; gem install mysql -- --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr/local/mysql/include --with-mysql-config=/usr/local/mysql/bin/mysql_config
&lt;b&gt;&lt;i&gt;all the same errors, all over again&lt;/i&gt;&lt;/b&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;
The usual drill, I run these commands a few times to make sure they don&#39;t change their minds if I insist politely ... no bacon. But what&#39;s the deal with &lt;code&gt;mysql_config5&lt;/code&gt;?
... it turns out that it&#39;s *not* the same as &lt;code&gt;mysql_config&lt;/code&gt; ... it&#39;s not the same thing at all, and it has completely different output:
&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
$ mysql_config5
Usage: /opt/local/bin/mysql_config5 [OPTIONS]
Options:
        --cflags         [-I/opt/local/include/mysql5/mysql  -pipe -fPIC    -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT  -DDONT_DECLARE_CXA_PURE_VIRTUAL]
        --include        [-I/opt/local/include/mysql5/mysql]
        --libs           [-L/opt/local/lib   -L/opt/local/lib/mysql5/mysql -lmysqlclient -L/opt/local/lib -lz -lm  -L/opt/local/lib/ -lssl -lcrypto]
        --libs_r         [-L/opt/local/lib   -L/opt/local/lib/mysql5/mysql -lmysqlclient_r -L/opt/local/lib -lz -lm   -L/opt/local/lib/ -lssl -lcrypto]
        --plugindir      [/opt/local/lib/mysql5/mysql/plugin]
        --socket         [/opt/local/var/run/mysql5/mysqld.sock]
        --port           [0]
        --version        [5.1.51]
        --libmysqld-libs [-L/opt/local/lib   -L/opt/local/lib/mysql5/mysql -lmysqld -ldl  -L/opt/local/lib -lz -lm     -L/opt/local/lib/ -lssl -lcrypto]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;
This looks rather serious. Let&#39;s plug these values into our &lt;code&gt;gem install&lt;/code&gt; command and see what happens:
&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
$ sudo env ARCHFLAGS=&quot;-I/opt/local/include/mysql5/mysql  -pipe -fPIC    -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT  -DDONT_DECLARE_CXA_PURE_VIRTUAL&quot; gem install mysql -- --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/opt/local/lib/mysql5/mysql --with-mysql-include=/opt/local/include/mysql5/mysql --with-mysql-config=/opt/local/bin/mysql_config5
Building native extensions.  This could take a while...
Successfully installed mysql-2.8.1
1 gem installed
Installing ri documentation for mysql-2.8.1...
Installing RDoc documentation for mysql-2.8.1...
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;
Wow! Bingo! Bring on the beer!
&lt;/p&gt;


&lt;p&gt;
Well there you go I hope this helps, or at least gives you some ideas, if you&#39;re stuck with &lt;code&gt;Symbol not found: _mysql_init&lt;/code&gt; or &lt;code&gt;extconf.rb failed&lt;/code&gt; when you can&#39;t get your mysql gem to install.
&lt;/p&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;copyright conan dalton 2007-2010 feel free to quote please link back&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.conandalton.net/feeds/7832966866519522954/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.conandalton.net/2010/10/gem-install-mysql-should-be-easy-on-mac.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/7832966866519522954'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/7832966866519522954'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/2010/10/gem-install-mysql-should-be-easy-on-mac.html' title='gem install mysql [--should-be-easy [--on-a-mac-anyway]]'/><author><name>conan</name><uri>http://www.blogger.com/profile/03401726635379568413</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfwQkipN7fcLo1L09CxXGmZEftHKp-PTOF-RSd6ElP-5kZ81tT_seKNKxS3EovpoQCGed43r39qirdhmGvmpIefkjOooNH-NypZ_oDmAdimI56h8nXboyRvXR7RZTAzQ/s220/approved.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4089129643157405806.post-4841858013419712815</id><published>2010-09-29T22:00:00.002+02:00</published><updated>2010-09-30T15:44:13.337+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="software"/><title type='text'>Fun with regex: shrinking indentation</title><content type='html'>&lt;p&gt;
Sometimes you get source code from people who believe in 4 spaces. Or 8, imagine! Or tabs ... well that&#39;s just *so* 20th century ...
&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
    function($) {
        $(&quot;#blah&quot;).toto(function(event) {
            $(this).click(function(event2) {
               $(this).goes(WAY.off(2, the(&quot;right&quot;)));
            });
        });
    };
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;
Too much indentation! 2 is enough! Let&#39;s suppose that for whatever reason, you can&#39;t or won&#39;t use your text editor&#39;s re-indent or reformat function, or you just really dig regular expressions ... here&#39;s what to do: replace &lt;b&gt;&lt;code&gt;^( +)\1&lt;/code&gt;&lt;/b&gt; with &lt;b&gt;&lt;code&gt;$1&lt;/code&gt;&lt;/b&gt;.
&lt;/p&gt;

&lt;p&gt;
&lt;b&gt;&lt;code&gt;^( +)\1&lt;/code&gt;&lt;/b&gt; means &quot;any nonzero-length sequence of spaces at the start of the line, followed by the same sequence of spaces. The &lt;b&gt;&lt;code&gt;\1&lt;/code&gt;&lt;/b&gt; in the pattern, and the &lt;b&gt;&lt;code&gt;$1&lt;/code&gt;&lt;/b&gt; in the replacement, are both back-references to the initial sequence of spaces. Result: indentation halved.
&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  function($) {
    $(&quot;#blah&quot;).toto(function(event) {
      $(this).click(function(event2) {
        $(this).goes(WAY.off(2, the(&quot;right&quot;))); // Not.
      });
    });
  };
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;There you go. Readable code.&lt;/p&gt;

&lt;small&gt;Don&#39;t tell anyone I said this, but if you want to do the opposite (increase indentation), replace &lt;b&gt;&lt;code&gt;^( +)&lt;/code&gt;&lt;/b&gt; with &lt;b&gt;&lt;code&gt;$1$1&lt;/code&gt;&lt;/b&gt; ...&lt;/small&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;copyright conan dalton 2007-2010 feel free to quote please link back&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.conandalton.net/feeds/4841858013419712815/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.conandalton.net/2010/09/fun-with-regex-shrinking-indentation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/4841858013419712815'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/4841858013419712815'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/2010/09/fun-with-regex-shrinking-indentation.html' title='Fun with regex: shrinking indentation'/><author><name>conan</name><uri>http://www.blogger.com/profile/03401726635379568413</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfwQkipN7fcLo1L09CxXGmZEftHKp-PTOF-RSd6ElP-5kZ81tT_seKNKxS3EovpoQCGed43r39qirdhmGvmpIefkjOooNH-NypZ_oDmAdimI56h8nXboyRvXR7RZTAzQ/s220/approved.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4089129643157405806.post-6526177742964516811</id><published>2010-09-28T10:58:00.004+02:00</published><updated>2010-09-28T11:51:48.942+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="business"/><category scheme="http://www.blogger.com/atom/ns#" term="nonsense"/><title type='text'>Stuck for an idea?</title><content type='html'>&lt;p&gt;
If you&#39;re a developer with an entrepreneurial bent and don&#39;t have access to a real flesh-and-blood business/marketing type, don&#39;t worry, these kinds of resources are becoming progressively more and more automated. Here are two to get you started:
&lt;/p&gt;

&lt;p&gt;
The &lt;a href=&quot;http://www.startupideagenerator.com/&quot;&gt;Startup Idea Generator&lt;/a&gt; will give you great, buzzword-compliant mission statements such as &quot;Synthesize wireless bandwidth consistently through peer-to-peer AJAX-tagging communities,&quot; &quot;Harness robust users in conjunction with crowdsourced android tagging sites,&quot; &quot;Implement global infrastructures using venture-backed social media-tracking relationships.&quot; You can&#39;t possibly lose!
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;http://itsthisforthat.com/&quot;&gt;Wait, what does your startup do?&lt;/a&gt; will help you hone your elevator pitch and optimize your marketing strategy by leveraging your next-generation wireless browser investments. &quot;So, Basically, it&#39;s like a ...&quot;
&lt;ul&gt;
  &lt;li&gt;Database Abstraction Layer For The Army!&lt;/li&gt;
  &lt;li&gt;Eco-Friendly Marketplace For Social Outcasts!&lt;/li&gt;
  &lt;li&gt;iPhone App For Ex-Girlfriends!&lt;/li&gt;
  &lt;li&gt;Match.com for Pets!&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;

&lt;p&gt;But don&#39;t take my word for it, go see for yourself. It&#39;s like an optimizer for your spare time!&lt;/p&gt;

&lt;small&gt;Thanks &lt;a href=&quot;https://twitter.com/peignoir&quot;&gt;@peignoir&lt;/a&gt; for sharing itsthisforthat&lt;/small&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;copyright conan dalton 2007-2010 feel free to quote please link back&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.conandalton.net/feeds/6526177742964516811/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.conandalton.net/2010/09/stuck-for-idea.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/6526177742964516811'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/6526177742964516811'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/2010/09/stuck-for-idea.html' title='Stuck for an idea?'/><author><name>conan</name><uri>http://www.blogger.com/profile/03401726635379568413</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfwQkipN7fcLo1L09CxXGmZEftHKp-PTOF-RSd6ElP-5kZ81tT_seKNKxS3EovpoQCGed43r39qirdhmGvmpIefkjOooNH-NypZ_oDmAdimI56h8nXboyRvXR7RZTAzQ/s220/approved.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4089129643157405806.post-1843767813922543629</id><published>2010-09-15T13:57:00.003+02:00</published><updated>2010-09-15T14:05:12.730+02:00</updated><title type='text'>Start In Paris #3</title><content type='html'>Last night was the third &lt;a href=&quot;http://www.startinparis.com/&quot;&gt;Start In Paris&lt;/a&gt;. At &lt;a href=&quot;http://lacantine.org/&quot;&gt;La Cantine&lt;/a&gt;, as usual, 5 startups presented themselves, so for those of you who couldn&#39;t make it, here you are:

&lt;h3&gt;&lt;a href=&quot;http://wizme.fr/&quot;&gt;Wizme&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;
This is a way of seeking and making recommendations from/to your personal social network. The goal is to make recommendations relevant because they&#39;re from people you trust, instead of from random strangers on the internet whose opinions are possibly biased in one direction or another.
&lt;/p&gt;

&lt;p&gt;
The plan for now is to rely on networks you&#39;ve already established in facebook and twitter. Here&#39;s a challenge though: if someone asks you what you think of your new telephone / jeans / dentist over beer, you&#39;re generally delighted to expound wisely and wittily on the subject. If you get the same request through facebook, won&#39;t it feel a little bit like work? Or am I just old-fashioned?
&lt;/p&gt;

&lt;p&gt;
The concept could be très très cool if it works. No amount of marketing will sell me the latest hot Apple product or hollywood movie if the people I know and respect are telling me it sucks. If this kind of site can successfully undermine the mass marketers, we could be moving to a better kind of world. Of at least, a better kind of France - the site is only in French so far ...
&lt;/p&gt;


&lt;h3&gt;&lt;a href=&quot;http://www.hop-cube.com/&quot;&gt;Hop-cube&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;
Hop-cube aims to exploit the growing market of environmentally- and ecologically-aware consumers. Their three services are (1) The &quot;Hop-Badge&quot; that you can show on your site to illustrate how eco-friendly your product is; (2) hop-score.com, which lists zillions of products along with their environmental-impact information; and (3) Special marketing tools based on sustainable development concepts.
&lt;/p&gt;

&lt;p&gt;
Prices and affiliate links to sellers are available immediately on a hop-score.com product page; environmental details require an extra click. Of course they have to make their money somehow, but the way information is prioritised here is surprising given their declared mission. The environmental details page shows the usual stuff - energy use, greenhouse gas emissions, and also information about the manufacturer such as their global gas emissions, water use, ISO14001 certification.
&lt;/p&gt;

&lt;p&gt;
It could be interesting to push this further to understand, for example, how much energy was used to manufacture this product, how much gas emissions, what kind of resources are mined for raw materials for this product, how many rivers are polluted, hectares of forest destroyed for this product, and how many Chinese factory slaves died for this beautiful sleek slender unibody laptop I so enjoy typing on while its mercury-free battery warms my thighs?
&lt;/p&gt;

&lt;p&gt;
On &quot;Sustainable Development Tools&quot;, from their site (&lt;a href=&quot;http://www.hop-cube.com/services/outils-marketing-durables.html&quot;&gt;http://www.hop-cube.com/services/outils-marketing-durables.html&lt;/a&gt;, roughly translated), &quot;[our] simulators take into account each of your visitor&#39;s specific behaviour and data&quot; ... &quot;besides, the simulators give you a mine of information about your visitors&quot;. Well, well. Environment++, maybe; privacy--- ...
&lt;/p&gt;

&lt;p&gt;
In any case, I&#39;ll be sure to take a peek the next time I&#39;m buying a great lump of electricity-sucking metal for my home. And delete all my cookies afterwards :)
&lt;/p&gt;

&lt;h3&gt;&lt;a href=&quot;http://www.dress-me.fr/beta&quot;&gt;Dress-Me&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;
Your problem is, you have no sense of style. And you have a major romantic dinner coming up at the end of the week. Or an interview. Or something ... something that causes you, even involuntarily, to think about what you will wear. You have the clothes, even though the few decent ones are musty from disuse. But your sense of style, your finger on the pulse of Parisien fashion, where is it? It&#39;s not where you are, and that&#39;s your problem.
&lt;/p&gt;

&lt;p&gt;
Dress-Me is a whole platform for whatever you might want to do with your clothes. Buy/sell/exchange/borrow; seek and offer fashion advice; and most useful for someone like me: hire a personal shopper who can expertly tell me what I ought to wear, because, honestly, I haven&#39;t a clue.
&lt;/p&gt;

&lt;p&gt;
I can see Dress-Me grow into an awesome community of clothing and fashion geeks, the kind of place where ideas germinate and influence the world outside. Not so sure about popular appeal to jeans-and-tshirt types. But it looks like a lot of fun.
&lt;/p&gt;

&lt;h3&gt;&lt;a href=&quot;http://www.super-marmite.com/&quot;&gt;Super Marmite&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;
If you&#39;re hungry but can&#39;t/won&#39;t cook, and you&#39;re fed up with the local macjunk, and you simply *know* your neighbours are cooking something delicious, Super-Marmite is where you need to go!
&lt;p&gt;

&lt;p&gt;
This is a social network for foodies, whatever side of the kitchen you&#39;re on. Buy meals, sell meals, meet your neighbours, and eat authentic, genuine, and (hopefully) wholesome food. Especially if your neighbours are Korean, or Japanese, or something like that. Or Senegalese, or Moroccan, or Mexican. Or Italian. You get the idea.
&lt;/p&gt;

&lt;p&gt;
They&#39;re planning for two kinds of cook: the casual, occasional kind who&#39;s in it for society and fun; and the professional kind, who sees a way to make substantial revenue from their kitchen.
&lt;/p&gt;

&lt;p&gt;
They&#39;re still in beta, but I&#39;m sure that won&#39;t stop you, go &lt;a href=&quot;http://blog.super-marmite.com/contact/&quot;&gt;request an invitation&lt;/a&gt;
&lt;/p&gt;

&lt;h3&gt;&lt;a href=&quot;http://scrumers.com/&quot;&gt;scrumers&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;
If you&#39;re unfortunate enough to know what scrum is (hint: nothing to do with rugby), this site deserves a look. One of its features is a &quot;Rich User Interface&quot;, and the ability to move tasks around just like post-it notes on a wall!
&lt;/p&gt;

&lt;p&gt;
You might be cynical and argue that you can do that with post-it notes and a wall, but since when did your wall automatically generate burn-down charts, huh? And what do you do when the wall is in another continent? Answer me that you cynical so-and-so.
&lt;/p&gt;

&lt;p&gt;
Comes with obligatory i-phone app. And, unlike every other startup presenting this evening, the folks at scrumers seem to think that somewhere in the world, hiding in a corner on the other side of the planet perhaps, there might be some customers who speak Ze English!! Radical stuff here. Here we are, in the middle of &lt;i&gt;Paris&lt;/i&gt;, and the site&#39;s entirely in English. Do they think the internet is global or something?
&lt;/p&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;copyright conan dalton 2007-2010 feel free to quote please link back&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.conandalton.net/feeds/1843767813922543629/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.conandalton.net/2010/09/start-in-paris-3.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/1843767813922543629'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4089129643157405806/posts/default/1843767813922543629'/><link rel='alternate' type='text/html' href='http://www.conandalton.net/2010/09/start-in-paris-3.html' title='Start In Paris #3'/><author><name>conan</name><uri>http://www.blogger.com/profile/03401726635379568413</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfwQkipN7fcLo1L09CxXGmZEftHKp-PTOF-RSd6ElP-5kZ81tT_seKNKxS3EovpoQCGed43r39qirdhmGvmpIefkjOooNH-NypZ_oDmAdimI56h8nXboyRvXR7RZTAzQ/s220/approved.jpg'/></author><thr:total>3</thr:total></entry></feed>