<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>A geek with a hat</title>
	
	<link>http://swizec.com/blog</link>
	<description>Drinker of tea</description>
	<lastBuildDate>Fri, 03 Feb 2012 11:33:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/AGeekWithAHat2" /><feedburner:info uri="ageekwithahat2" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Top 10 iPhone Apps for Web Designers</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/FlAxR0YYjyg/3624</link>
		<comments>http://swizec.com/blog/top-10-iphone-apps-for-web-designers/swizec/3624#comments</comments>
		<pubDate>Fri, 03 Feb 2012 11:33:53 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[Guestpost]]></category>
		<category><![CDATA[App Store]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Google Analytics]]></category>
		<category><![CDATA[Handhelds]]></category>
		<category><![CDATA[IPhone]]></category>
		<category><![CDATA[Smartphones]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3624</guid>
		<description><![CDATA[This is a guest post by Jan Pierce - a 4th grade teacher who has over 20 years of experience in the classroom. Her interests include educational technology and online learning. She also owns the site Elementary Education Degree for students interested in earning a degree in elementary education. 1. Ego – This is an essential [...]]]></description>
			<content:encoded><![CDATA[<p><em>This is a guest post by Jan Pierce - a 4th grade teacher who has over 20 years of experience in the classroom. Her interests include educational technology and online learning. She also owns the site <a href="http://www.elementaryeducationdegree.com">Elementary Education Degree</a> for students interested in earning a degree in elementary education.</em></p>
<p><strong>1. </strong><a href="http://itunes.apple.com/us/app/ego/id306785502?mt=8"><strong>Ego</strong></a><strong> – </strong>This is an essential app for anyone in the web business. Ego allows you to check statistics like visits, feed subscriptions, Twitter followers, and more on a daily or hourly basis. Instead of visiting a bunch of different websites, all you need to do is open this single application. It supports sites like Google Analytics, Twitter, Squarespace, Vimeo, and more. ($1.99)</p>
<p><strong>2. </strong><a href="http://itunes.apple.com/us/app/palettes/id297157708?mt=8"><strong>Palettes</strong></a><strong> – </strong>Don’t you wish you had a way to capture a color you see online? Now you can with this application. Take a color directly from any online image and create a palette, or import a palette from another photo program. This is a great way to use Professional color schemes without wasting time to create them for every site you make. (Free)</p>
<p><strong>3. </strong><a href="http://itunes.apple.com/us/app/whatthefont/id304304134?mt=8"><strong>WhatTheFont</strong></a><strong> – </strong>Identify fonts wherever you go with this handy application. Take a photo of a word and find out what its font is in seconds to help you gain quick inspiration for your own sites. This app has gained a cult status among web designers for a very good reason. (Free)</p>
<p><strong>4. </strong><a href="http://itunes.apple.com/us/app/ftp-on-the-go/id286479936?mt=8"><strong>FTP On The Go</strong></a><strong> – </strong>This app allows you to perform maintenance on your website, no matter where you are. You can also edit files on an FTP server and check other applications while staying in the FTP all. This is one of the most downloaded web business apps on the market. ($6.99)</p>
<p><strong>5. </strong><a href="http://itunes.apple.com/us/app/zeptopad-free-brainstorming/id299173403?mt=8"><strong>ZeptoPad</strong></a><strong> – </strong>Forget the tiny keypad on your iPhone. This app lets you draw on the screen with you finger to brainstorm and jot down notes. You can also save what you make in a JPEG format to send to your friends and colleagues. (Free)</p>
<p><strong>6. </strong><a href="http://itunes.apple.com/us/app/css-cheat-sheet/id301093674?mt=8"><strong>CSS Cheatsheet</strong></a><strong> – </strong>Even experienced developers need to look up CSS commands every once in a while. This is a reference sheet for those on the go who just need a little reminder so that they don’t have to waste their time searching online. ($0.99)</p>
<p><strong>7. </strong><a href="http://itunes.apple.com/us/app/seo-pro/id377980606?mt=8"><strong>SEO Pro</strong></a><strong> – </strong>Track the progress of all your domains by viewing various page rank factors from Google, Yahoo, and more. Since this app allows you to monitor unlimited urls, you can even track your competitors’ sites as well. ($0.99)</p>
<p><strong>8. </strong><a href="http://itunes.apple.com/us/app/worktimer/id293280857?mt=8"><strong>WorkTimer</strong></a><strong> – </strong>Do you have trouble keeping track of how many hours you work on each of your projects? This app will track them for you so that you can provide clients with accurate billing information. At the end of each month, you can send out emails with project records. ($0.99)</p>
<p><strong>9. </strong><a href="http://itunes.apple.com/us/app/cliqcliq-colors/id291725775?mt=8"><strong>CliqCliq Colors</strong></a><strong> – </strong>Find and edit colors with a precise, easy-to-use functionality. Quickly convert scales and formats that are compatible with all the major types of photo editing software. You can also extract colors from your iPhone photos or Flickr. (Free)</p>
<p><strong>10. </strong><a href="http://itunes.apple.com/us/app/analytics-app/id303689911?mt=8"><strong>Analytics</strong></a><strong> – </strong>If you already have a Google Analytics account, this app will bring all of its amazing features to your iPhone. View 55 different reports as well as information for site traffic and e-commerce. You won’t find an analytics app nearly as detail-oriented as this one. ($6.99)</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://appleissimo.com/2012/01/25/iphone-ipad-tutorial-how-to-get-settings-shortcuts-on-your-home-screen/">iPhone / iPad Tutorial &#8211; How To Get Settings Shortcuts On Your Home Screen</a> (appleissimo.com)</li>
<li class="zemanta-article-ul-li"><a href="http://hypebeast.com/2012/02/nooka-iphone-application/">Nooka iPhone Application</a> (hypebeast.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.phonehour.com/how-to/how-to-control-your-pc-with-your-iphone/">How To Control Your PC with Your iPhone</a> (phonehour.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.cultofmac.com/144193/apple-going-to-war-against-devs-who-use-white-iphones-to-advertise-apps/">Is Apple Going To War Against Devs Who Use White iPhones To Advertise Their Apps?</a> (cultofmac.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=add1a9cb-5491-48a5-8f9e-0974c3696f29" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/FlAxR0YYjyg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/top-10-iphone-apps-for-web-designers/swizec/3624/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/top-10-iphone-apps-for-web-designers/swizec/3624</feedburner:origLink></item>
		<item>
		<title>TEDxBled pitch</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/i-pMdpNjvDA/3621</link>
		<comments>http://swizec.com/blog/tedxbled-pitch/swizec/3621#comments</comments>
		<pubDate>Thu, 02 Feb 2012 13:31:32 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[Insanity]]></category>
		<category><![CDATA[Self-organization]]></category>
		<category><![CDATA[TED]]></category>
		<category><![CDATA[TEDx]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3621</guid>
		<description><![CDATA[TEDxBled is right around the corner and it&#8217;s accepting random people to come give a talk. There&#8217;s a competition going on and out of everyone who submits a video they&#8217;ll pick the best two to come dazzle the audience. Since this is a pretty cool opportunity and I almost have something worthwhile to say I [...]]]></description>
			<content:encoded><![CDATA[<p><a href="https://www.facebook.com/TEDxBled" target="_blank">TEDxBled</a> is right around the corner and it&#8217;s accepting random people to come give a talk. There&#8217;s a competition going on and out of everyone who submits a video they&#8217;ll pick the best two to come dazzle the audience.</p>
<p>Since this is a pretty cool opportunity and I almost have something worthwhile to say I decided to pitch a talk about my <a title="A message from your future self" href="http://swizec.com/blog/a-message-from-your-future-self/swizec/3377">giving your future self a voice</a> idea. It&#8217;s nowhere near the high level of altruism and awesomeness of <a href="http://challengefuture.org/quick/32" target="_blank">the other ideas pitched so far</a>, but hey &#8230; we can&#8217;t all be spectacular right?</p>
<p>Talking into a computer is insanely weird for me, I prefer a crowd &#8211; it&#8217;s somehow easier, probably because I can feel for a connection, get a few cheap laughs and generally feel how I&#8217;m doing and whether I should change the pace around or whatever.</p>
<p>After a few takes I came up with this:</p>
<p><iframe src="http://www.youtube.com/embed/CZKWoS90xC0" frameborder="0" width="480" height="360"></iframe></p>
<p>The voice is crappy, the lighting sucks because you can&#8217;t see my face well, but if I tried going for a different shot I&#8217;d have to clean my room and that just sounds too much like an excuse to avoid studying for exams.</p>
<p>It&#8217;s a long shot and I probably won&#8217;t be asked to present, but at least I tried <img src='http://swizec.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://swizec.com/blog/tedxyouth-ljubljana-report/swizec/3039">TEDxYouth Ljubljana report</a> (swizec.com)</li>
<li class="zemanta-article-ul-li"><a href="http://mumbrella.com.au/tedx-speaker-auditions-to-come-to-sydney-but-no-product-hawkers-jargon-junkies-dullards-motivator-wannabes-spouters-of-new-age-fluff-72768">TEDx speaker auditions to come to Sydney &#8211; but no product-hawkers, jargon-junkies, dullards, motivator wannabes or spouters of new-age fluff</a> (mumbrella.com.au)</li>
<li class="zemanta-article-ul-li"><a href="http://meinewalt.wordpress.com/2011/11/16/tedx-coming-to-nagpur/">TEDx coming to Nagpur</a> (meinewalt.wordpress.com)</li>
<li class="zemanta-article-ul-li"><a href="http://midd-blog.com/2011/11/05/tedx-2011-embracing-risk/">TEDx 2011: Embracing Risk (Live-Blog)</a> (midd-blog.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=55ac8aa5-50b2-4b06-99b1-f3dfd328a345" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/i-pMdpNjvDA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/tedxbled-pitch/swizec/3621/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/tedxbled-pitch/swizec/3621</feedburner:origLink></item>
		<item>
		<title>Everyone should learn [about] programming</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/QWDvhbq07Ns/3608</link>
		<comments>http://swizec.com/blog/everyone-should-learn-about-programming/swizec/3608#comments</comments>
		<pubDate>Wed, 01 Feb 2012 12:41:38 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[Insanity]]></category>
		<category><![CDATA[Inspiration]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3608</guid>
		<description><![CDATA[What use have an artist, a baker, a winemaker, a firefighter and a brewer with programming? None. Yet. An article surfaced on HackerNews yesterday arguing that Programming is the new High School Diploma, the main argument being two facts: Computers are everywhere Automation is pushing out middle-tier jobs The basic idea is really simple &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>What use have an artist, a baker, a winemaker, a firefighter and a brewer with <a class="zem_slink" title="Computer programming" href="http://en.wikipedia.org/wiki/Computer_programming" rel="wikipedia">programming</a>? None.</p>
<div class="wp-caption alignright" style="width: 356px"><img class=" " title="A brewer" src="http://swizec.com/blog/wp-content/uploads/2012/02/sissons_brewer_199710.jpg" alt="A brewer" width="346" height="246" /><p class="wp-caption-text">A brewer</p></div>
<p>Yet.</p>
<p>An article surfaced on <a class="zem_slink" title="Hacker News" href="http://news.ycombinator.com/" rel="homepage">HackerNews</a> yesterday arguing that <a href="http://news.ycombinator.com/item?id=3528940">Programming is the new High School Diploma</a>, the main argument being two facts:</p>
<ol>
<li>Computers are everywhere</li>
<li>Automation is pushing out middle-tier jobs</li>
</ol>
<p>The basic idea is really simple &#8211; in the not very distant future programming will and should be as important as basic literacy is today. Not just basic computer literacy, but programming in the sense of combining and extending apps in novel ways to fit your problem area.</p>
<p>There are a lot of professions for which automation is almost impossible to imagine &#8211; an artist, a firefighter, a winemaker, brewer, baker; the list goes on and on. In fact this was the top voted rebuttal of the whole story. A lot of professions need so much human touch it is inconceivable they would ever need programming.</p>
<h2>Someone else can do the coding</h2>
<p>And if parts of their jobs do become automated, they still won&#8217;t need programming because there will be special people to program special tools for these professions and just show them how they&#8217;re used.</p>
<div class="wp-caption alignright" style="width: 310px"><a href="http://commons.wikipedia.org/wiki/File:DC_firefighter.jpg"><img class="zemanta-img-inserted zemanta-img-configured" title="Washington, D.C. firefighter" src="http://swizec.com/blog/wp-content/uploads/2012/02/300px-DC_firefighter2.jpg" alt="Washington, D.C. firefighter" width="300" height="336" /></a><p class="wp-caption-text">Image via Wikipedia</p></div>
<p>All well and good, but that&#8217;s missing the point entirely.</p>
<p>There is no need for an artist, or a baker, or anyone working in meatspace to be a good programmer. They have no need for <a class="zem_slink" title="Pointer (computing)" href="http://en.wikipedia.org/wiki/Pointer_%28computing%29" rel="wikipedia">pointer arithmetic</a>, <a class="zem_slink" title="Functional programming" href="http://en.wikipedia.org/wiki/Functional_programming" rel="wikipedia">functional programming</a>, <a class="zem_slink" title="P versus NP problem" href="http://en.wikipedia.org/wiki/P_versus_NP_problem" rel="wikipedia">P=NP</a> or knowing javascript and python&#8217;s list comprehensions.</p>
<p>They just don&#8217;t.</p>
<p>Somebody else can do all that stuff &#8211; an actual expert. But how much does a programmer sitting at home, watching code and cat pictures all day, know about the problems of a baker or an artist? Or about fighting fires?</p>
<h2>Problem areas</h2>
<p>You can&#8217;t solve problems you don&#8217;t know exist!</p>
<p>Someone with problems who doesn&#8217;t know of a whole field of solutions can&#8217;t ask for help either.</p>
<p>And so we reach an impasse. On the one hand you have an industry full of people so hungry for problems they create better and better ways to share ever more boring stuff, and on the other hand you have &#8230; the other ~70% of the population drowning in real, hard, solvable problems.</p>
<p>While you can check foursquare to see where your friends are, there are firefighters who would (probably?) love nothing more than a real-time map of where all their buddies are in a building. And what are the best and brightest of the world doing? Nothing much, I heard there&#8217;s a meme making rounds about something or another.</p>
<p>High school is about broadness and giving pupils a little bit of everything. Some history to understand the problems with large-scale ethnicism, a little bit of biology to help you talk to the doctor, a dash of this and that. All in all, none of us become experts in every field we study in high school, but studying them gives us a better understanding of the world.</p>
<div class="wp-caption alignleft" style="width: 191px"><img title="A chef" src="http://swizec.com/blog/wp-content/uploads/2012/02/chef1.jpg" alt="A chef" width="181" height="300" /><p class="wp-caption-text">A chef</p></div>
<p>And yet high school deprives us of even the simplest knowledge of a field touching <em>everything</em> in our lives.</p>
<p>To innovate, to even begin to really use this amazing tool, we need to give the general populace the ability to begin the process of automation &#8211; that spark of <em>Hey, this is kind of repetitive, I wonder if a computer could do it.</em></p>
<p>Chances are it could.</p>
<p>In fact, we know a computer can solve any problem we consider solvable &#8230; even subsets of those that aren&#8217;t solvable. But you first need someone who knows how to actually solve a problem.</p>
<p>That&#8217;s why most problems <a class="zem_slink" title="Programmer" href="http://en.wikipedia.org/wiki/Programmer" rel="wikipedia">programmers</a> solve are those other programmers have. It&#8217;s like an echo chamber out there, nothing but better and quicker ways to make development easier. These are then used to make development even easier and suddenly it&#8217;s become <em>impossible</em> to keep up with the world of computing.</p>
<p>Most other industries innovate much more slowly. Most of them can&#8217;t solve their own problems and they don&#8217;t even realize a solution exists because they don&#8217;t realize they have a problem. The greatest handbrake on innovation is a worker with too narrow a worldview to understand their job could be made better.</p>
<h2>What you can do?</h2>
<p>Because changing how high school works is hard, I have a suggestion for something you can do <strong>right now</strong>! Only needs three steps too</p>
<ol>
<li>Find a nonprogrammer friend</li>
<li>Take them out for a beer</li>
<li>Teach them about programming</li>
</ol>
<p>Give them the bug of automation. Do it with passion. Do it well. When they start looking at the world in terms of <em>Hmm &#8230; I wonder how this could be made better, easier, more interesting. </em>They will start coming back with real problems. Problems out of their solution scope, but something <em>you</em> can work on.</p>
<p>And hey, startup opportunity! You now have somebody with a real problem looking for a real solution! Hooray.</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://www.nj.com/news/index.ssf/2012/01/firefighters_investigate_secon.html">Firefighters investigate second suspicious fire at vacant New Brunswick high school</a> (nj.com)</li>
<li class="zemanta-article-ul-li"><a href="http://zeroturnaround.com/blog/developer-productivity-report-part-1-developer-timesheet/">imabonehead: Developer Productivity Report &#8211; Part 1: Developer Timesheet | zeroturnaround.com</a> (zeroturnaround.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.answers.com/topic/corpus-answers-guides-how-to-become-a-firefighter">How to Become a Firefighter</a> (answers.com)</li>
<li class="zemanta-article-ul-li"><a href="http://swizec.com/blog/programmers-are-fucking-lazy/swizec/2648">Programmers are fucking lazy</a> (swizec.com)</li>
<li class="zemanta-article-ul-li"><a href="http://swizec.com/blog/programmers-are-born-not-made/swizec/3369">Programmers are born not made</a> (swizec.com)</li>
<li class="zemanta-article-ul-li"><a href="http://cdixon.org/2012/01/31/who-should-learn-to-program/">Who should learn to program?</a> (cdixon.org)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=663f89e2-33c8-49cd-9b31-27270739f9ab" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/QWDvhbq07Ns" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/everyone-should-learn-about-programming/swizec/3608/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/everyone-should-learn-about-programming/swizec/3608</feedburner:origLink></item>
		<item>
		<title>Three cool things</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/z_IGJ-Ng1Go/3603</link>
		<comments>http://swizec.com/blog/three-cool-things/swizec/3603#comments</comments>
		<pubDate>Tue, 31 Jan 2012 10:19:54 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[The Web]]></category>
		<category><![CDATA[Foursquare]]></category>
		<category><![CDATA[Handhelds]]></category>
		<category><![CDATA[IOS]]></category>
		<category><![CDATA[IPhone]]></category>
		<category><![CDATA[Social network]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3603</guid>
		<description><![CDATA[In lieu of a proper blogpost today you get three cool things, because I have to pass two exams an hour apart. 1) Arrivals Arrivals is an incredibly cool Foursquare app &#8211; probably the best I have ever seen. The idea is simple, take your foursquare data, turn your friends into aeroplanes, make an arrivals [...]]]></description>
			<content:encoded><![CDATA[<p>In lieu of a proper blogpost today you get three cool things, because I have to pass two exams an hour apart.</p>
<h2>1) Arrivals</h2>
<p><a href="http://www.iamdanw.com/wrote/arrivals-for-foursquare/" target="_blank">Arrivals</a> is an incredibly cool Foursquare app &#8211; probably the best I have ever seen. The idea is simple, take your foursquare data, turn your friends into aeroplanes, make an arrivals board like at an airport.</p>
<p>And that&#8217;s pretty much it. The app doesn&#8217;t do a whole lot, it runs in a browser and I love it because it does a single thing, but does it perfectly and in a cool way.</p>
<div class="wp-caption alignnone" style="width: 500px"><img class=" " title="Arrivals for Foursquare" src="http://swizec.com/blog/wp-content/uploads/2012/01/606491964bf311e1abb01231381b65e3_710.jpg" alt="Arrivals for Foursquare" width="490" height="490" /><p class="wp-caption-text">Arrivals for Foursquare</p></div>
<h2>2) Design for programmers</h2>
<p><a href="http://method.ac/" target="_blank">Method of Action</a> is something I only discovered last night and haven&#8217;t had the chance to play around with that much yet. It looks like a very promising way for programmers (people like me) to learn enough about design to hold their own in a conversation with a designer.</p>
<p>But more importantly, looks like it will enable us to throw together mockups and to at least understand what designers <em>do</em>. We love ranting on and on about how none of those stupid <a class="zem_slink" title="Luser" href="http://en.wikipedia.org/wiki/Luser" rel="wikipedia">lusers</a> understand what a programmer&#8217;s life is like &#8211; time to reciprocate <img src='http://swizec.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Oh and the <a href="http://type.method.ac/" target="_blank">Kern</a>, <a href="http://shape.method.ac/" target="_blank">Shape</a> and <a href="http://color.method.ac/" target="_blank">Color</a> games are already super fun to play.</p>
<div id="attachment_3605" class="wp-caption alignnone" style="width: 695px"><a href="http://swizec.com/blog/wp-content/uploads/2012/01/Screen-Shot-2012-01-31-at-11.18.29-AM.png"><img class=" wp-image-3605 " title="Method of Action" src="http://swizec.com/blog/wp-content/uploads/2012/01/Screen-Shot-2012-01-31-at-11.18.29-AM.png" alt="Method of Action" width="685" height="297" /></a><p class="wp-caption-text">Method of Action</p></div>
<h2>3) Buffer&#8217;s iOS app</h2>
<p>My favourite twitter tool <a href="http://blog.bufferapp.com/the-complete-guide-to-the-brand-new-buffer-iphone-app" target="_blank">Buffer has now got an iPhone app</a>. If you don&#8217;t know about Buffer yet, shame on you! It&#8217;s only the tool that played a great role in increasing my blog traffic baseline by roughly 1000% last year. Yes, that&#8217;s a thousand percent.</p>
<p>Diminishing returns aside, it&#8217;s still a very powerful tool.</p>
<div class="wp-caption alignnone" style="width: 368px"><img class="  " title="Mine was just emptied so the screenshot was lame" src="http://swizec.com/blog/wp-content/uploads/2012/01/IMG_01763.png" alt="Mine was just emptied so the screenshot was lame" width="358" height="538" /><p class="wp-caption-text">Mine was just emptied so the screenshot was lame</p></div>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://mashable.com/2012/01/30/arrivals-for-foursquare-displays-check-ins-on-old-style-airport-board/">Arrivals for Foursquare Displays Check-ins on Old-Style Airport Board</a> (mashable.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.ilounge.com/index.php/news/comments/foursquare-update-introduces-radar-for-ios-5/">News: Foursquare update introduces Radar for iOS 5</a> (ilounge.com)</li>
<li class="zemanta-article-ul-li"><a href="http://mashable.com/2012/01/30/impending-clear-interview/">Clear To Do App Has Some Surprising Design Inspirations</a> (mashable.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.lockergnome.com/social/2011/12/05/foursquare-is-a-waste-of-time/">Foursquare is a Waste of Time</a> (lockergnome.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=7c028505-7458-4a31-8f52-c2ddd33306f7" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/z_IGJ-Ng1Go" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/three-cool-things/swizec/3603/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/three-cool-things/swizec/3603</feedburner:origLink></item>
		<item>
		<title>Heroku, mongo, node.js – a problem</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/SZf_trI4ZDM/3565</link>
		<comments>http://swizec.com/blog/heroku-mongo-node-js-a-problem/swizec/3565#comments</comments>
		<pubDate>Mon, 30 Jan 2012 11:57:44 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[A tech a day]]></category>
		<category><![CDATA[Heroku]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[Node.js]]></category>
		<category><![CDATA[NoSQL]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3565</guid>
		<description><![CDATA[A couple facts about three cool technologies node.js is a powerful way of writing backend code in JavaScript; why JavaScript? Because you have the kind of problem that benefits from asynchronous code (the average web app) and you like using the same  brain for backend and frontend work mongoDB is an awesome NoSQL data store [...]]]></description>
			<content:encoded><![CDATA[<p>A couple facts about three cool technologies</p>
<div class="wp-caption alignright" style="width: 310px"><a href="http://en.wikipedia.org/wiki/File:The_Hunt_of_the_Unicorn_Tapestry_7.jpg"><img class="zemanta-img-inserted zemanta-img-configured" title="The Unicorn Is Penned, Unicorn Tapestries, c. ..." src="http://swizec.com/blog/wp-content/uploads/2012/01/300px-The_Hunt_of_the_Unicorn_Tapestry_71.jpg" alt="The Unicorn Is Penned, Unicorn Tapestries, c. ..." width="300" height="445" /></a><p class="wp-caption-text">Image via Wikipedia</p></div>
<div class="mceTemp"></div>
<ul>
<li><a class="zem_slink" title="Node.js" href="http://nodejs.org/" rel="homepage">node.js</a> is a powerful way of writing backend code in <a class="zem_slink" title="JavaScript" href="http://en.wikipedia.org/wiki/JavaScript" rel="wikipedia">JavaScript</a>; why JavaScript? Because you have the kind of problem that benefits from asynchronous code (the average web app) and you like using the same  brain for backend and frontend work</li>
<li><a class="zem_slink" title="MongoDB" href="http://www.mongodb.org/" rel="homepage">mongoDB</a> is an awesome <a class="zem_slink" title="NoSQL" href="http://en.wikipedia.org/wiki/NoSQL" rel="wikipedia">NoSQL</a> data store for objects. It is an especially great companion to JavaScript since its internal storage are <a class="zem_slink" title="JSON" href="http://json.org/" rel="homepage">JSON</a>-objects. JSON has plays particularly well with JavaScript due to certain similarities (some even think the JSON language is a subset of JavaScript, <a title="JSON: The JavaScript subset that isn't" href="http://timelessrepo.com/json-isnt-a-javascript-subset" target="_blank">although it&#8217;s not</a>)</li>
<li><a class="zem_slink" title="Heroku" href="http://www.heroku.com/" rel="homepage">Heroku</a> is the simplest way to deploy web apps. Originally designed for Ruby, it gained node.js support last spring/summer. There are <a href="http://www.joyent.com/" target="_blank">alternatives</a>, but heroku presents itself as a particularly good pick for various reasons (it <em>feels</em> right)</li>
</ul>
<p>Combining these three technologies should be a walk in the park. <a class="zem_slink" title="Sliced bread" href="http://en.wikipedia.org/wiki/Sliced_bread" rel="wikipedia">The best thing since sliced bread</a> and unicorn farts should rain down the heavens upon you for even thinking of using node.js, mongo and heroku in unison.</p>
<h2>Not so much.</h2>
<div class="mceTemp"></div>
<p>The culprit &#8211; the bleeding edge, baby!</p>
<p>Mongo&#8217;s only been widely-ish popular for a year, node.js still isn&#8217;t widely and Heroku is traditionally a <a class="zem_slink" title="Ruby on Rails" href="http://rubyonrails.org" rel="homepage">RoR</a> hosting environment so there are things that aren&#8217;t quite smooth yet.</p>
<p>Getting mongoDB support on Heroku means using an external party &#8211; what heroku calls an add-on &#8211; <a href="https://mongohq.com/home" target="_blank">MongoHQ</a>. It&#8217;s a mongoDB hosting provider that gives you access to a database and lets you loose.</p>
<p>But MongoHQ requires authentication.</p>
<p>My favourite mongoDB driver for node.js &#8230; doesn&#8217;t support authentication. At least it doesn&#8217;t support authentication easily, in fact it doesn&#8217;t support authentication so much that it isn&#8217;t officially documented. The only reference to getting this working is <a href="http://j-query.blogspot.com/2011/04/mongohq-and-node.html" target="_blank">some guy&#8217;s blogpost from April 2011</a>. This is an actively developed library by the way, the last commit to <a href="https://github.com/christkv/node-mongodb-native" target="_blank">node-mongodb-native</a>&#8216;s github was yesterday.</p>
<p>Some say I should be using <a href="https://github.com/LearnBoost/mongoose" target="_blank">mongoose</a> instead, but that would most likely require rewriting the whole application at this point. Not to mention I don&#8217;t like mongoose&#8217;s <a class="zem_slink" title="Object-relational mapping" href="http://en.wikipedia.org/wiki/Object-relational_mapping" rel="wikipedia">ORM</a>-like approach because that&#8217;s just a little too <a class="zem_slink" title="SQL" href="http://www.iso.org/iso/catalogue_detail.htm?csnumber=45498" rel="homepage">SQL</a> for my liking. Why would you force a traditional data store way of doing things onto something as refreshing as Mongo?</p>
<p>To make things worse, a while ago (about a year it seems), mongo introduced a new <a href="http://www.mongodb.org/display/DOCS/Connections" target="_blank">mongo:// url schema</a> for connecting to their database &#8230; not even all the official drivers support it yet.</p>
<p>Don&#8217;t you just love the bleeding edge? Competing libraries, standards shifting under your feet and things never quite working out!</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://r.zemanta.com/?u=http%3A//www.infoworld.com/d/application-development/nodejs-inventor-extends-javascript-programming-beyond-browsers-184963&amp;a=72148407&amp;rid=0ba152c5-e257-4f06-a4aa-d8c62e2e08c5&amp;e=0cb31b66c2e367c75b2971631959db44">Node.js inventor extends JavaScript programming beyond browsers</a> (infoworld.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.lukew.com/ff/entry.asp?1482">The Four Horsemen of JavaScript</a> (lukew.com)</li>
<li class="zemanta-article-ul-li"><a href="http://nodemanual.org/latest/">A community-driven manual for Node.js</a> (nodemanual.org)</li>
<li class="zemanta-article-ul-li"><a href="http://nosql.mypopescu.com/post/14453905385/attacking-nosql-and-node-js-server-side-javascript">Attacking NoSQL and Node.js: Server-Side JavaScript Injection (SSJS)</a> (nosql.mypopescu.com)</li>
<li class="zemanta-article-ul-li"><a href="http://stackoverflow.com/questions/8904409/running-node-js-on-a-port-other-than-port-80">Running node.js on a port other than port 80</a> (stackoverflow.com)</li>
<li class="zemanta-article-ul-li"><a href="http://joyeur.com/2012/01/23/cloud9s-plans-for-node-js-community/">Cloud9′s Plans for Node.js Community</a> (joyeur.com)</li>
<li class="zemanta-article-ul-li"><a href="http://hacks.mozilla.org/2012/01/javascript-on-the-server-growing-the-node-js-community/">JavaScript on the server: Growing the Node.js Community</a> (hacks.mozilla.org)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=0ba152c5-e257-4f06-a4aa-d8c62e2e08c5" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/SZf_trI4ZDM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/heroku-mongo-node-js-a-problem/swizec/3565/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/heroku-mongo-node-js-a-problem/swizec/3565</feedburner:origLink></item>
		<item>
		<title>Lychrel numbers</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/ttbZewW39X8/3559</link>
		<comments>http://swizec.com/blog/lychrel-numbers/swizec/3559#comments</comments>
		<pubDate>Fri, 27 Jan 2012 12:24:19 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[A tech a day]]></category>
		<category><![CDATA[Algorithm]]></category>
		<category><![CDATA[collatzconjecture]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[Number Theory]]></category>
		<category><![CDATA[Palindrome]]></category>
		<category><![CDATA[Project Euler]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3559</guid>
		<description><![CDATA[Last night I discovered another cool mathematical concept akin to the Collatz conjecture - Lychrel numbers. The idea of a lychrel number is pretty straightforward: Take a number, add its reverse, continue until you reach a palindrome number. If you never reach a palindrome, then this is a Lychrel number. Something like this: 349 + 943 = [...]]]></description>
			<content:encoded><![CDATA[<p>Last night I discovered another cool mathematical concept akin to the <a class="zem_slink" title="Collatz conjecture" href="http://en.wikipedia.org/wiki/Collatz_conjecture" rel="wikipedia">Collatz conjecture</a> - <a href="http://en.wikipedia.org/wiki/Lychrel_numbers" target="_blank">Lychrel numbers</a>.</p>
<div class="wp-caption alignright" style="width: 310px"><a href="http://commons.wikipedia.org/wiki/File:CollatzFractal.png"><img class="zemanta-img-inserted zemanta-img-configured" title="Collatz map fractal in a neighbourhood of the ..." src="http://swizec.com/blog/wp-content/uploads/2012/01/300px-CollatzFractal4.png" alt="Collatz map fractal in a neighbourhood of the ..." width="300" height="180" /></a><p class="wp-caption-text">Image via Wikipedia</p></div>
<p>The idea of a lychrel number is pretty straightforward: Take a number, add its reverse, continue until you reach a <a class="zem_slink" title="Palindromic number" href="http://en.wikipedia.org/wiki/Palindromic_number" rel="wikipedia">palindrome number</a>. If you never reach a <a class="zem_slink" title="Palindrome" href="http://en.wikipedia.org/wiki/Palindrome" rel="wikipedia">palindrome</a>, then this is a <a class="zem_slink" title="Lychrel number" href="http://en.wikipedia.org/wiki/Lychrel_number" rel="wikipedia">Lychrel number</a>.</p>
<p>Something like this:</p>
<blockquote><p>349 + 943 = 1292,<br />
1292 + 2921 = 4213<br />
4213 + 3124 = 7337<br />
not lychrel</p></blockquote>
<p>If you&#8217;ve ever done any theoretical computer science, you&#8217;ll immediately spot a problem. This isn&#8217;t a very good algorithm. Problem is with that &#8220;never&#8221; word in the description &#8211; an algorithm is a finite set of steps, when you need an infinite amount of steps to reach a conclusion that&#8217;s &#8230; not very useful.</p>
<p>Honestly I am not certain what class of problems lychrel numbers fall into. The &#8220;not a lychrel number&#8221; is a half-<a class="zem_slink" title="Decision problem" href="http://en.wikipedia.org/wiki/Decision_problem" rel="wikipedia">decidable problem</a>. It will always tell you when <em>a number is not lychrel</em> but it will never terminate when it is. If my understanding is correct, this would make &#8220;is a lychrel number&#8221; an non-decidable problem.</p>
<p><a class="zem_slink" title="Project Euler" href="http://projecteuler.net/" rel="homepage">Project Euler</a> is kind enough to limit the problem a little bit and make it a fun algorithm to write before bed when your brain is half dead. <em>Find all lychrel candidates under 10,000 assuming it should never take more than 50 iterations.</em></p>
<p>Solving <em>that</em> problem becomes rather trivial in <a class="zem_slink" title="Haskell (programming language)" href="http://haskell.org" rel="homepage">Haskell</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">&nbsp;
<span style="font-weight: bold;">reverse</span>' <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">read</span> <span style="color: #339933; font-weight: bold;">.</span> <span style="font-weight: bold;">reverse</span> <span style="color: #339933; font-weight: bold;">.</span> <span style="font-weight: bold;">show</span>
&nbsp;
palindrome n <span style="color: #339933; font-weight: bold;">=</span> n <span style="color: #339933; font-weight: bold;">==</span> <span style="font-weight: bold;">reverse</span>' n
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- max denotes max recursion depth</span>
lychrel n <span style="font-weight: bold;">max</span>
  <span style="color: #339933; font-weight: bold;">|</span> <span style="font-weight: bold;">max</span> <span style="color: #339933; font-weight: bold;">&lt;=</span> <span style="color: red;">0</span> <span style="color: #339933; font-weight: bold;">=</span> True
  <span style="color: #339933; font-weight: bold;">|</span> palindrome<span style="color: #339933; font-weight: bold;">$</span>n<span style="color: #339933; font-weight: bold;">+</span>r <span style="color: #339933; font-weight: bold;">=</span> False
  <span style="color: #339933; font-weight: bold;">|</span> <span style="font-weight: bold;">otherwise</span> <span style="color: #339933; font-weight: bold;">=</span> lychrel <span style="color: green;">&#40;</span>n<span style="color: #339933; font-weight: bold;">+</span>r<span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span>max<span style="color: #339933; font-weight: bold;">-</span><span style="color: red;">1</span><span style="color: green;">&#41;</span>
    <span style="color: #06c; font-weight: bold;">where</span> r <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">reverse</span>' n
&nbsp;
lychrels <span style="font-weight: bold;">max</span> <span style="color: #339933; font-weight: bold;">=</span>
  <span style="font-weight: bold;">length</span> <span style="color: green;">&#91;</span>x <span style="color: #339933; font-weight: bold;">|</span> x <span style="color: #339933; font-weight: bold;">&lt;-</span> <span style="color: green;">&#91;</span><span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">..</span><span style="font-weight: bold;">max</span><span style="color: green;">&#93;</span><span style="color: #339933; font-weight: bold;">,</span> lychrel x <span style="color: red;">50</span><span style="color: green;">&#93;</span></pre></div></div>

<p>Oh and actually the first number that needs more than 50 iterations to converge into a palindrome is 10677, so the problem is pretty safely stated.</p>
<p>For a final bit of fun, the number 4994, itself a palindrome, is a lychrel candidate.</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://swizec.com/blog/collatz-haskell-and-memoization/swizec/3382">Collatz, Haskell and Memoization</a> (swizec.com)</li>
<li class="zemanta-article-ul-li"><a href="http://flowingdata.com/2011/10/04/all-numbers-lead-to-one/">All numbers lead to one</a> (flowingdata.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.livescience.com/16846-rare-date-today-10-000-years-palindrome.html">Rare Date: Today Is Once-in-10,000-Years Palindrome</a> (livescience.com)</li>
<li class="zemanta-article-ul-li"><a href="http://mathsetc.wordpress.com/2011/07/23/problematic-views-futuring-maths/">problematic views, futuring maths.</a> (mathsetc.wordpress.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.msnbc.msn.com/id/45258660/ns/technology_and_science-science/">Why 11/11/11 is mathematically amazing</a> (msnbc.msn.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=cdcdcc77-5738-4067-bfc8-273be2152cda" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/ttbZewW39X8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/lychrel-numbers/swizec/3559/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/lychrel-numbers/swizec/3559</feedburner:origLink></item>
		<item>
		<title>A month wasted</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/-rypFwnqFCg/3545</link>
		<comments>http://swizec.com/blog/a-month-wasted/swizec/3545#comments</comments>
		<pubDate>Thu, 26 Jan 2012 13:26:18 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[Essays]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3545</guid>
		<description><![CDATA[This post is about exams, being in college and jumping through arbitrary hoops set up by arbitrary old men so they can feel arbitrarily important. But most of all it&#8217;s about everyone wasting a month of their lives for something that surely a better alternative exists for. I may have written about this before. I am [...]]]></description>
			<content:encoded><![CDATA[<p>This post is about exams, being in college and jumping through <a class="zem_slink" title="Arbitrariness" href="http://en.wikipedia.org/wiki/Arbitrariness" rel="wikipedia">arbitrary</a> hoops set up by arbitrary old men so they can feel arbitrarily important. But most of all it&#8217;s about everyone wasting a month of their lives for something that surely a better alternative exists for. I <a title="I suck at [formal] education or does education suck?" href="http://swizec.com/blog/i-suck-at-formal-education-or-does-education-suck/swizec/2564" target="_blank">may</a> <a title="A longboard and a school system" href="http://swizec.com/blog/a-longboard-and-a-school-system/swizec/2438" target="_blank">have</a> <a title="Doing a startup taught me the value of staying in school" href="http://swizec.com/blog/doing-a-startup-taught-me-the-value-of-staying-in-school/swizec/1819" target="_blank">written</a> about this before.</p>
<div class="wp-caption alignright" style="width: 310px"><a href="http://commons.wikipedia.org/wiki/File:University_of_Tokyo_Admittance_Celebrations_2011-03-10.JPG"><img class="zemanta-img-inserted zemanta-img-configured" title="English: A crowd has gathered to take part of ..." src="http://swizec.com/blog/wp-content/uploads/2012/01/300px-University_of_Tokyo_Admittance_Celebrations_2011-03-10.jpg" alt="English: A crowd has gathered to take part of ..." width="300" height="225" /></a><p class="wp-caption-text">Image via Wikipedia</p></div>
<p>I am notorious for sucking at passing exams. I am perhaps even more notorious for disrespecting authority and arbitrary tests of skill. There might be some bias. You have been warned.</p>
<p>My hate of tests started early, when I was doing those <a class="zem_slink" title="Test (assessment)" href="http://en.wikipedia.org/wiki/Test_%28assessment%29" rel="wikipedia">aptitude tests</a> for first grade I stopped after five minutes saying something like &#8220;Here. That&#8217;s enough for you. Bye&#8221;.</p>
<p>When you do that at six the examiner goes <em>&#8220;Oh my! What a smart little boy, so defiant and thinking for himself!&#8221;</em>, at 24 the usual reaction is more along the lines of <em>&#8220;Omg what an idiot, who let him out of grade school? The guy can&#8217;t even solve the simplest of problems!&#8221;</em></p>
<p>However, exams are upon us and it is once more time to jump through hoops and prove ourselves worthy of being allowed to jump through some more hoops. Just so old men can pat each other on the back and feel good about having taught people something.</p>
<h2>A waste of time!</h2>
<p>I don&#8217;t think there&#8217;s a single person in the world who likes exam season, not even the <a class="zem_slink" title="Professor" href="http://en.wikipedia.org/wiki/Professor" rel="wikipedia">professors</a> and <a class="zem_slink" title="Teaching assistant" href="http://en.wikipedia.org/wiki/Teaching_assistant" rel="wikipedia">teaching assistants</a>. Just a week ago everyone&#8217;s lives were better.</p>
<p>The professors were working on their <a class="zem_slink" title="Research" href="http://en.wikipedia.org/wiki/Research" rel="wikipedia">research</a> and figuring out cool ways to impart <a class="zem_slink" title="Knowledge" href="http://en.wikipedia.org/wiki/Knowledge" rel="wikipedia">knowledge</a> on young impressionable minds. The teaching assistants were also working on their research, while doing a bit of slave work for the professors, imparting knowledge on young impressionable minds and possibly grading some homework.</p>
<p>Most of the <a class="zem_slink" title="Student" href="http://en.wikipedia.org/wiki/Student" rel="wikipedia">students</a>&#8216; lives revolved around going to class and having knowledge imparted on their young impressionable minds. Some of them were doing research on the side, or some sort of pet project or another, some have jobs &#8211; most of them working on exactly the kind of thing they&#8217;ll be doing after they graduate &#8211; at least that&#8217;s how it is in my line of work.</p>
<p>The better students were also studying the more interesting subjects in more detail, because what is said in class just doesn&#8217;t feed their hunger for knowledge.</p>
<div class="wp-caption alignleft" style="width: 310px"><a href="http://commons.wikipedia.org/wiki/File:StateLibQld_1_100348.jpg"><img class="zemanta-img-inserted zemanta-img-configured" title="English: School children doing exams inside a ..." src="http://swizec.com/blog/wp-content/uploads/2012/01/300px-StateLibQld_1_1003481.jpg" alt="English: School children doing exams inside a ..." width="300" height="215" /></a><p class="wp-caption-text">Image via Wikipedia</p></div>
<p>Some of the students &#8211; there might be less of these now that I&#8217;m not a freshman anymore &#8211; had impressive WoW and <a class="zem_slink" title="The Elder Scrolls V: Skyrim" href="http://www.elderscrolls.com/" rel="homepage">Skyrim</a> characters.</p>
<p>Enter exam season, stage left, all our lives got twisted upside down.</p>
<p>Suddenly everyone&#8217;s productive lives are put on hold for a month while we take the time to jump through hoops and politely ask permission to jump through more.</p>
<p>For a month:</p>
<ul>
<li>professors have to observe students jump through hoops instead of advancing their field</li>
<li>teaching assistants must create those hoops and grade the jumping instead of doing research</li>
<li>instead of going to cool lectures, students must study</li>
<li>instead of being productive on cool projects, students must jump</li>
<li>when a hoop is presented a student must not ask &#8220;Why the fuck?&#8221;, no, they must ask &#8220;Can you please turn that on fire as well? And can I do a piruette through it please?&#8221;</li>
</ul>
<h2>It&#8217;s insane. And stupid.</h2>
<p>You come there, often times early in the morning, and are given an exam. Then you are expected to solve four tasks. Each of them must be solved perfeclty on the first try. You have 90 minutes. Good luck.</p>
<p>Remember how they say interviewing candidates should not be based on trivia knowledge or solving &#8220;simple&#8221; tasks perfectly on the first try under time and situation pressure? [<a href="http://www.joelonsoftware.com/articles/fog0000000073.html" target="_blank">Joel on Software - Guerrilla Guide to Interviewing</a>]</p>
<p>Then why is it considered a good idea to test knowledge of _a whole subject_ like that? There&#8217;s no way a normal human being even stands a chance.</p>
<p>I&#8217;m lying, of course there is.</p>
<div class="wp-caption alignright" style="width: 310px"><a href="http://commons.wikipedia.org/wiki/File:Yushima_tenmangu_ema.jpg"><img class="zemanta-img-inserted zemanta-img-configured" title="English: A wall of &quot;ema&quot; votive plat..." src="http://swizec.com/blog/wp-content/uploads/2012/01/300px-Yushima_tenmangu_ema1.jpg" alt="English: A wall of &quot;ema&quot; votive plat..." width="300" height="225" /></a><p class="wp-caption-text">Image via Wikipedia</p></div>
<p>When you dumb down the whole field into formulaic application of a few algorithms and memorizing a few equations, suddenly everything becomes testable like that. But is this really in the spirit of what we&#8217;re trying to achieve here?</p>
<p>I mean, we are, after all, trying to prove who is and who isn&#8217;t worthy of being the creme of high thought in this nation and who gets to advance the field, funding for research, stuff like that.</p>
<p>A bunch of mindless automatons following instructions and dutifully obeying authority are sure to do just that! Wait, why do we have computers again?</p>
<p>I can understand this happening in high school &#8230; a bit &#8230; but college? Seriously? Your idea of a good <a class="zem_slink" title="Higher education" href="http://en.wikipedia.org/wiki/Higher_education" rel="wikipedia">college education</a> is making sure I know how to follow instructions and apply some basic proofs/algorithms/formulas by hand?</p>
<p>Fuck. That. Shit.</p>
<p>Is there a solution? I don&#8217;t know, but I&#8217;ve always liked the idea of being given a semester to do a big project involving what we&#8217;re being taught in class. It&#8217;s a lot more interesting and a better way to learn about something.</p>
<p>PS: there are many bright exceptions to this behavior at my college, it&#8217;s just that none of those exams stick in memory because I pass them with a good grade almost without trying.</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://stcathmsrosette.wordpress.com/2012/01/25/memo-to-junior-4s-re-exams/">Memo to Junior 4s re Exams</a> (stcathmsrosette.wordpress.com)</li>
<li class="zemanta-article-ul-li"><a href="http://berbececristian.wordpress.com/2012/01/24/something-new/">Something new</a> (berbececristian.wordpress.com)</li>
<li class="zemanta-article-ul-li"><a href="https://nairanotes.wordpress.com/2011/11/22/common-mistakes-made-by-students-during-exam-period/">Common Mistakes Made By Students During Exam Period</a> (nairanotes.wordpress.com)</li>
<li class="zemanta-article-ul-li"><a href="http://thoughtofvg.wordpress.com/2012/01/17/first-postexams-and-what-they-are-good-for/">First post/exams and what they are good for</a> (thoughtofvg.wordpress.com)</li>
<li class="zemanta-article-ul-li"><a href="http://educationandstuff.wordpress.com/2012/01/25/exam-time/">Exam Time</a> (educationandstuff.wordpress.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=3a3735c0-5800-4a6a-a537-73ae48b3f53b" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/-rypFwnqFCg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/a-month-wasted/swizec/3545/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/a-month-wasted/swizec/3545</feedburner:origLink></item>
		<item>
		<title>A visit to the dentist</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/dzmFlJHFA5w/3528</link>
		<comments>http://swizec.com/blog/a-visit-to-the-dentist/swizec/3528#comments</comments>
		<pubDate>Wed, 25 Jan 2012 17:40:23 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[Insanity]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3528</guid>
		<description><![CDATA[It took me six months to work up the courage to make an appointment for the dentist. After some initial confusionI finally managed to bump into someone and magically make an appointment before I could realize what was going on. I was told to come back in a month. Today. The experience taught me two things: [...]]]></description>
			<content:encoded><![CDATA[<p>It took me six months to work up the courage to make an appointment for the <a class="zem_slink" title="Dentist" href="http://en.wikipedia.org/wiki/Dentist" rel="wikipedia">dentist</a>. After some <a title="Going to the dentist is like trying out a new opensource project" href="http://swizec.com/blog/going-to-the-dentist-is-like-trying-out-a-new-opensource-project/swizec/2881">initial confusion</a>I finally managed to bump into someone and magically make an appointment before I could realize what was going on.</p>
<div class="wp-caption alignright" style="width: 310px"><a href="http://commons.wikipedia.org/wiki/File:Medieval_dentistry.jpg"><img class="zemanta-img-inserted zemanta-img-configured" title="An image from 1300s (A.D.) England depicting a..." src="http://swizec.com/blog/wp-content/uploads/2012/01/300px-Medieval_dentistry3.jpg" alt="An image from 1300s (A.D.) England depicting a..." width="300" height="300" /></a><p class="wp-caption-text">Image via Wikipedia</p></div>
<p>I was told to come back in a month.</p>
<p><em style="font-size: 1.2em;">Today.</em></p>
<p>The experience taught me two things:</p>
<ol>
<li>My teeth are made of magic</li>
<li>I am far more afraid of dentists than I had thought</li>
</ol>
<p>Ever heard of the expression <em>white with fear</em>? Turns out it can actually happen. Just like Tom turns completely white when a train is rushing towards him, so too my face turned white when I was sitting in that damn chair. Nearly fainted too.</p>
<p>I never did like dentists much &#8211; seven years since my last appointment after all &#8211;  but to <em>nearly faint</em> from fear? Nausea, tunnel vision, white face; the whole shebang! Didn&#8217;t even feel that bad, but you know shit&#8217;s going down when the dentist removes your glasses &#8220;just in case&#8221; and puts a wet rag on your forehead.</p>
<p>Lucky for me, I have magical teeth and the tally from all the years of neglect is just:</p>
<ul>
<li>one broken filling</li>
<li>three <a class="zem_slink" title="Wisdom tooth" href="http://en.wikipedia.org/wiki/Wisdom_tooth" rel="wikipedia">wisdom teeth</a> with some caries</li>
<li>inflamed gums</li>
</ul>
<p>None of that <em>OMG my wisdom teeth are breaking my head and trying to destroy everything!!!</em> I honestly expected much worse, but hey, I&#8217;ll take the deal <img src='http://swizec.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>It also turns out I suck at keeping my mouth open and will be having much fun the next time I visit &#8230; something about working on the back teeth and not being able to get the drill completely vertical and maybe not even being able to work on them &#8230;</p>
<p>Now my face feels funny from the injection, the <em>optional</em> injection. Can&#8217;t imagine the amounts of pain there would be had I not told them that yes, yes I do want that injection thing. You did notice I almost fainted when you were just <em>cleaning</em> my teeth right? WHY ARE YOU ASKING ME THIS!?</p>
<p>Those things take a while to really kick in. She was almost done drilling before I stopped feeling everything and even then just the air blowing over my teeth hurt like <em>hell.</em> Not to even mention the disinfectant.</p>
<p>Another appointment in a few weeks and then I guess I&#8217;m good to go for another seven years. Right?</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://www.bellasugar.com/Crest-Weekly-Intensive-Cleaning-Toothpaste-Review-2627319">No Dentist Appointment? No Problem.</a> (bellasugar.com)</li>
<li class="zemanta-article-ul-li"><a href="http://uclaislamicstudies.com/2012/01/17/wisdom-teeth-extraction-complications/">Wisdom Teeth Extraction Complications</a> (uclaislamicstudies.com)</li>
<li class="zemanta-article-ul-li"><a href="http://ask.metafilter.com/204770/Should-my-sevenyearold-sons-dentist-knock-him-out">Should my seven-year-old son&#8217;s dentist knock him out?</a> (ask.metafilter.com)</li>
<li class="zemanta-article-ul-li"><a href="https://kilnviews.wordpress.com/2012/01/24/hiding-from-the-hygienist/">Hiding from the hygienist</a> (kilnviews.wordpress.com)</li>
<li class="zemanta-article-ul-li"><a href="http://oppathfinder.com/2012/01/18/military-dentists/">Military Dentists</a> (oppathfinder.com)</li>
<li class="zemanta-article-ul-li"><a href="http://ask.metafilter.com/205838/weird-feelings-in-my-teeth">weird feelings in my teeth!</a> (ask.metafilter.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=37822309-8d88-4a79-bbd3-f8614d613f94" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/dzmFlJHFA5w" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/a-visit-to-the-dentist/swizec/3528/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/a-visit-to-the-dentist/swizec/3528</feedburner:origLink></item>
		<item>
		<title>I Don’t Know</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/SU9bowPLWYg/3517</link>
		<comments>http://swizec.com/blog/i-dont-know/swizec/3517#comments</comments>
		<pubDate>Tue, 24 Jan 2012 12:09:51 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[Insanity]]></category>
		<category><![CDATA[Inspiration]]></category>
		<category><![CDATA[Albert Einstein]]></category>
		<category><![CDATA[BBC]]></category>
		<category><![CDATA[Feynman]]></category>
		<category><![CDATA[Knowledge]]></category>
		<category><![CDATA[Richard Feynman]]></category>
		<category><![CDATA[YouTube]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3517</guid>
		<description><![CDATA[I. Don&#8217;t. Know. Three simple words. Almost impossible to say. As developers, as entrepreneurs, as men we never want to admit we don&#8217;t know. If you don&#8217;t know, you are weak and an army of angry huns will come to steal your women, your business and your honor. When founders don&#8217;t know what the hell they&#8217;re [...]]]></description>
			<content:encoded><![CDATA[<p><iframe src="http://www.youtube.com/embed/Na-KzVwu6es" frameborder="0" width="420" height="315"></iframe></p>
<p>I. Don&#8217;t. Know.</p>
<p>Three simple words. Almost impossible to say. As developers, as entrepreneurs, as <em>men</em> we never want to admit we don&#8217;t know. If you don&#8217;t know, you are weak and an army of angry huns will come to steal your women, your business and your honor.</p>
<p>When founders don&#8217;t know what the hell they&#8217;re doing, people leave, investors say &#8220;maybe&#8221; and users aren&#8217;t showing up. <em>Especially</em> if they openly admit they don&#8217;t know.</p>
<div class="mceTemp"></div>
<div class="mceTemp"></div>
<p>But just as some consider not knowing a sign of weakness, <em>always</em> knowing is definitely a sign of weakness. Selling your best guess as absolute fact works very well in the short term, in fact it works spectacularly well &#8211; there&#8217;s a reason there are whole books devoted to the practice of eliminating excuses from your speech. Phrases like  <em>I think,</em> <em>in my opinion</em> et cetera.</p>
<div class="wp-caption alignright" style="width: 382px"><img class=" " title="Island of knowledge" src="http://swizec.com/blog/wp-content/uploads/2012/01/Maldives-Island_1111082i1.jpg" alt="Island of knowledge" width="372" height="240" /><p class="wp-caption-text">Island of knowledge</p></div>
<p>While it&#8217;s important to commit to what you say without hedging and ways to weasel out when you&#8217;re proven wrong. It&#8217;s even more important to admit when you don&#8217;t know. In fact all that hedging just defends you from admitting you are wrong and <em>don&#8217;t know.</em></p>
<div class="mceTemp"></div>
<p>The best thinkers of our species, like <a class="zem_slink" title="Richard Feynman" href="http://en.wikipedia.org/wiki/Richard_Feynman" rel="wikipedia">Feynman</a>, <a class="zem_slink" title="Albert Einstein" href="http://en.wikipedia.org/wiki/Albert_Einstein" rel="wikipedia">Einstein</a> and others, are <em>glorified</em> for their ability to embrace what they don&#8217;t know. To look <a class="zem_slink" title="Ignorance" href="http://en.wikipedia.org/wiki/Ignorance" rel="wikipedia">ignorance</a> straight in the face and spit in its eye. Most of us cower from such an opportunity, we like nothing more than to stand firmly in the middle of what we know and never looking beyond the horizon lest there be monsters.</p>
<div class="mceTemp"></div>
<p>Someone once said <em>Every man lives on an island of knowledge in a sea of ignorance. The bigger your island, the longer the shore of ignorance</em>.</p>
<p>Most people can&#8217;t even comprehend how much they don&#8217;t know about a subject, because the more you know about something, the more you understand the intricacies involved. A common saying amongst developers is <em>What the fuck man!? How can That Startup spend so much money on that simple problem, it&#8217;s just &lt;x&gt;, &lt;y&gt;, &lt;z&gt; and you&#8217;re done. I could do it in a week!</em></p>
<p>Chances are, you don&#8217;t know what the hell you are talking about. The hardest problems seem the simplest when given only a cursory glance. So put down the ego for a moment and <em>prove it.</em> Prove that the problem is simple.</p>
<p>You can&#8217;t learn what you already know. <img src='http://swizec.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://www.brainpickings.org/index.php/2011/10/07/richard-feynman-on-beauty-honors-and-curiosity/">Richard Feynman on Beauty, Honors, and Curiosity</a> (brainpickings.org)</li>
<li class="zemanta-article-ul-li"><a href="http://crcpastorchad.wordpress.com/2011/10/04/beauty-and-doubt/">Beauty and doubt</a> (crcpastorchad.wordpress.com)</li>
<li class="zemanta-article-ul-li"><a href="http://callumjameshackett.wordpress.com/2011/12/27/physicists-and-artists/">Physicists and Artists</a> (callumjameshackett.wordpress.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.brainpickings.org/index.php/2011/12/14/bbcs-richard-feynman-no-ordinary-genius/">No Ordinary Genius: BBC Captures Richard Feynman&#8217;s Legacy</a> (brainpickings.org)</li>
<li class="zemanta-article-ul-li"><a href="http://iantimberlake.wordpress.com/2011/12/29/inspiring-and-powerful-science-quotes/">Inspiring and Powerful Science Quotes</a> (iantimberlake.wordpress.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.quantumdiaries.org/2011/10/10/quantum-man-richard-feynmans-life-in-science/">Quantum Man: Richard Feynman&#8217;s Life in Science</a> (quantumdiaries.org)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=7a25ffe7-e8f9-437e-bb23-543e63b1c4e9" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/SU9bowPLWYg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/i-dont-know/swizec/3517/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/i-dont-know/swizec/3517</feedburner:origLink></item>
		<item>
		<title>Appcelerator Titanium might’ve made it to my toolbox</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/WDRBhJRWU3Q/3506</link>
		<comments>http://swizec.com/blog/appcelerator-titanium-mightve-made-it-to-my-toolbox/swizec/3506#comments</comments>
		<pubDate>Mon, 23 Jan 2012 12:09:29 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[A tech a day]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Appcelerator]]></category>
		<category><![CDATA[Appcelerator Titanium]]></category>
		<category><![CDATA[Integrated development environment]]></category>
		<category><![CDATA[IOS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Titanium]]></category>
		<category><![CDATA[User interface]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3506</guid>
		<description><![CDATA[Last time I played around with Appcelerator Titanium I didn&#8217;t get a chance to really put it through its paces. Mostly because I wasn&#8217;t getting anywhere &#8230; I remember spending hours, even days, just figuring out how to get a Hello World to run in a simulator. Yesterday was my lucky day! Not only did I [...]]]></description>
			<content:encoded><![CDATA[<p>Last time I played around with <a class="zem_slink" title="Appcelerator Titanium" href="http://www.appcelerator.com/" rel="homepage">Appcelerator Titanium</a> I didn&#8217;t get a chance to <a href="http://swizec.com/blog/i-learned-two-things-today-11-8/swizec/2150">really put it through its paces</a>. Mostly because I wasn&#8217;t getting anywhere &#8230; I remember spending hours, even days, just figuring out how to get a <a class="zem_slink" title="Hello world program" href="http://en.wikipedia.org/wiki/Hello_world_program" rel="wikipedia">Hello World</a> to run in a simulator.</p>
<div class="wp-caption alignright" style="width: 250px"><a href="http://www.flickr.com/photos/91198056@N00/5638371774"><img class="zemanta-img-inserted zemanta-img-configured" title="MoBods Scoop! Development ;-)" src="http://swizec.com/blog/wp-content/uploads/2012/01/5638371774_324ec18c31_m4.jpg" alt="MoBods Scoop! Development ;-)" width="240" height="179" /></a><p class="wp-caption-text">Image by Podknox via Flickr</p></div>
<div class="mceTemp"></div>
<p>Yesterday was my lucky day! Not only did I get something to run, I actually made something useful. Or rather, I was given a working app and told to add some features and generally make it better a tiny little bit.</p>
<p>Took me way too long &#8211; expected when dealing with technology you know <em>nothing</em> about &#8211; but at 6am today I had <a href="http://www.pickup.io/" target="_blank">Pickup</a> connecting to the server on the user&#8217;s own private channel and talking nicely to the <a class="zem_slink" title="Chrome extension" href="http://googlevoiceblog.blogspot.com/2010/01/new-google-voice-extension-for-chrome.html" rel="homepage">Chrome extension</a>.</p>
<p>By the way this isn&#8217;t my project, I just helped out, but from what I saw last night, you <em>want</em> to sign up for the beta. Promise!</p>
<h2>Titanium good</h2>
<ol>
<li>It&#8217;s <a class="zem_slink" title="JavaScript" href="http://en.wikipedia.org/wiki/JavaScript" rel="wikipedia">Javascript</a>, if you haven&#8217;t noticed I <em>love</em> javascript</li>
<li>The same app works both on android and <a class="zem_slink" title="IOS" href="http://www.apple.com/ios" rel="homepage">iOS</a></li>
<li>Titanium API&#8217;s are generally simpler than what I&#8217;ve seen of native iOS</li>
<li>Properly using the <a class="zem_slink" title="User interface" href="http://en.wikipedia.org/wiki/User_interface" rel="wikipedia">user interface</a> API&#8217;s gives you a native look&amp;feel</li>
</ol>
<h2>Titanium bad</h2>
<ol>
<li>The <a class="zem_slink" title="Integrated development environment" href="http://en.wikipedia.org/wiki/Integrated_development_environment" rel="wikipedia">IDE</a>; I don&#8217;t like being forced to use an IDE and I very much hate being forced to use a <em>crappy</em> IDE.</li>
<li>Everything looks like it would be pretty much impossible to develop with my usual <a class="zem_slink" title="Text editor" href="http://en.wikipedia.org/wiki/Text_editor" rel="wikipedia">text editor</a> method</li>
<li>Code once, run everywhere is good in principle, but it usually ends up lacking the polish of a real native app, especially since android and iOS have slightly different <a class="zem_slink" title="User interface" href="http://en.wikipedia.org/wiki/User_interface" rel="wikipedia">UI</a> guidelines and traditions</li>
</ol>
<h2>Conclusion</h2>
<p>All in all,  there&#8217;s a lot of potential in this Titanium stuff despite the shortcomings. I might just start adding a mobile part to my future projects &#8230; there&#8217;s certainly some that could use it.</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://www.mobile-ent.biz/news/read/appcelerator-bags-15m-series-c-round/016007">Appcelerator bags $15m series C round</a> (mobile-ent.biz)</li>
<li class="zemanta-article-ul-li"><a href="http://blog.elemdage.com/technology/one-mans-html5-developer-workflow">One Man&#8217;s HTML5 Developer Workflow</a> (elemdage.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.fiercedeveloper.com/story/appcelerator-acquires-html5-development-platform-particle-code/2011-10-24">Appcelerator acquires HTML5 development platform Particle Code</a> (fiercedeveloper.com)</li>
<li class="zemanta-article-ul-li"><a href="http://venturebeat.com/2011/11/01/appcelerator-raises-15m/">Appcelerator raises $15M, now largest third-party app publisher on iOS, Android</a> (venturebeat.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=41f5b6aa-6958-4ac1-95b3-78f47d955e65" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/WDRBhJRWU3Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/appcelerator-titanium-mightve-made-it-to-my-toolbox/swizec/3506/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/appcelerator-titanium-mightve-made-it-to-my-toolbox/swizec/3506</feedburner:origLink></item>
		<item>
		<title>This Haskell is wrong. Why?</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/RdloDhIPROc/3489</link>
		<comments>http://swizec.com/blog/this-haskell-is-wrong-why/swizec/3489#comments</comments>
		<pubDate>Fri, 20 Jan 2012 17:47:23 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[A tech a day]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Puzzle]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3489</guid>
		<description><![CDATA[The problem I&#8217;m trying to solve is the simple but lovely euler 62. The cube, 41063625 (3453), can be permuted to produce two other cubes: 56623104 (3843) and 66430125 (4053). In fact, 41063625 is the smallest cube which has exactly three permutations of its digits which are also cube. Find the smallest cube for which [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignright" style="width: 310px"><a href="http://en.wikipedia.org/wiki/File:5-cube_scrambled.png"><img class="zemanta-img-inserted zemanta-img-configured" title="English: 5D virtual 3^5 sequential move puzzle..." src="http://swizec.com/blog/wp-content/uploads/2012/01/300px-5-cube_scrambled2.png" alt="English: 5D virtual 3^5 sequential move puzzle..." width="300" height="293" /></a><p class="wp-caption-text">Image via Wikipedia</p></div>
<p>The problem I&#8217;m trying to solve is the simple but lovely <a href="http://projecteuler.net/problem=62" target="_blank">euler 62</a>.</p>
<blockquote><p>The cube, 41063625 (345<sup>3</sup>), can be permuted to produce two other cubes: 56623104 (384<sup>3</sup>) and 66430125 (405<sup>3</sup>). In fact, 41063625 is the smallest cube which has exactly three permutations of its digits which are also cube.</p>
<p>Find the smallest cube for which exactly five permutations of its digits are cube.</p></blockquote>
<p>A bit of fun coding after a statistics midterm last night and the solution should be in the bag. Except it isn&#8217;t, I am doing something wrong somehow and I can&#8217;t figure out what! Hopefully someone a bit better than me can shed some light whether my proposed solution is wrong or I just suck at <a class="zem_slink" title="Haskell (programming language)" href="http://haskell.org" rel="homepage">Haskell</a>.</p>
<h2>Algorithm</h2>
<ol>
<li>Generate cubes up to 10,000</li>
<li>Every cube is a pair of a digit-ordered string <em>n^3</em> and <em>n, </em>for instance <em>(&#8220;279&#8243;,9)</em></li>
<li>Order cubes by the string number presentation</li>
<li>Group together all cubes with the same <em>n^3</em></li>
<li>Pick out groups with the size of 5</li>
<li>Sort by <em>n</em></li>
<li>Pick the smallest number</li>
</ol>
<p>Should work in principle right? So why doesn&#8217;t the website accept my answer <em>(5027)</em>? My guess is I&#8217;m doing something wrong in the sorting and grouping department and I was hoping someone with a bit more knowledge of Haskell could point out where I&#8217;m being stupid.</p>
<h2>Code</h2>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: #06c; font-weight: bold;">import</span> Data<span style="color: #339933; font-weight: bold;">.</span>List
&nbsp;
cubes<span style="color: #339933; font-weight: bold;">::</span><span style="color: green;">&#40;</span><span style="color: #cccc00; font-weight: bold;">Num</span> a<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">=&gt;</span> a <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: green;">&#91;</span><span style="color: green;">&#40;</span><span style="color: #cccc00; font-weight: bold;">String</span><span style="color: #339933; font-weight: bold;">,</span> a<span style="color: green;">&#41;</span><span style="color: green;">&#93;</span>
cubes <span style="color: red;">1</span> <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="color: green;">&#40;</span><span style="font-weight: bold;">show</span> <span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">,</span> <span style="color: red;">1</span><span style="color: green;">&#41;</span><span style="color: green;">&#93;</span>
cubes n <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#40;</span>sort<span style="color: #339933; font-weight: bold;">$</span>show<span style="color: green;">&#40;</span>n<span style="color: #339933; font-weight: bold;">^</span><span style="color: red;">3</span><span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> n<span style="color: green;">&#41;</span>:<span style="color: green;">&#40;</span>cubes <span style="color: #339933; font-weight: bold;">$</span> n<span style="color: #339933; font-weight: bold;">-</span><span style="color: red;">1</span><span style="color: green;">&#41;</span>
&nbsp;
sortStrNum <span style="color: green;">&#40;</span>s1<span style="color: #339933; font-weight: bold;">,</span> n1<span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span>s2<span style="color: #339933; font-weight: bold;">,</span> n2<span style="color: green;">&#41;</span>
  <span style="color: #339933; font-weight: bold;">|</span> <span style="font-weight: bold;">length</span> s1 <span style="color: #339933; font-weight: bold;">==</span> <span style="font-weight: bold;">length</span> s2 <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">compare</span> s1 s2
  <span style="color: #339933; font-weight: bold;">|</span> <span style="font-weight: bold;">otherwise</span> <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">compare</span> <span style="color: green;">&#40;</span><span style="font-weight: bold;">length</span> s1<span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span><span style="font-weight: bold;">length</span> s2<span style="color: green;">&#41;</span>
&nbsp;
permuted<span style="color: #339933; font-weight: bold;">_</span>cubes n <span style="color: #339933; font-weight: bold;">=</span>
  groupBy <span style="color: green;">&#40;</span>\a b <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="font-weight: bold;">fst</span> a <span style="color: #339933; font-weight: bold;">==</span> <span style="font-weight: bold;">fst</span> b<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">$</span> sortBy sortStrNum <span style="color: #339933; font-weight: bold;">$</span> cubes n
&nbsp;
fives n <span style="color: #339933; font-weight: bold;">=</span>
  <span style="font-weight: bold;">filter</span> <span style="color: green;">&#40;</span>\xs <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="font-weight: bold;">length</span> xs <span style="color: #339933; font-weight: bold;">==</span> <span style="color: red;">5</span><span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">$</span> permuted<span style="color: #339933; font-weight: bold;">_</span>cubes n
&nbsp;
comparing p x y <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">compare</span> <span style="color: green;">&#40;</span>p x<span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span>p y<span style="color: green;">&#41;</span>
&nbsp;
smallest <span style="color: #339933; font-weight: bold;">=</span>
  <span style="font-weight: bold;">head</span> <span style="color: #339933; font-weight: bold;">$</span> sortBy <span style="color: green;">&#40;</span>comparing <span style="font-weight: bold;">snd</span><span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">head</span> <span style="color: #339933; font-weight: bold;">$</span> fives <span style="color: red;">100000</span></pre></div></div>

<p>The whole thing looks kind of alright to me, no matter how much I poke around it doesn&#8217;t seem like something is misbehaving &#8230; but it still is.</p>
<p>Ideas?</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://swizec.com/blog/collatz-haskell-and-memoization/swizec/3382">Collatz, Haskell and Memoization</a> (swizec.com)</li>
<li class="zemanta-article-ul-li"><a href="http://swizec.com/blog/learning-me-a-haskell/swizec/3272">Learning me a Haskell</a> (swizec.com)</li>
<li class="zemanta-article-ul-li"><a href="http://stackoverflow.com/questions/8905037/converting-haskell-polymorphic-cosine-function-to-f">Converting Haskell Polymorphic Cosine function to F#</a> (stackoverflow.com)</li>
<li class="zemanta-article-ul-li"><a href="http://stackoverflow.com/questions/8155929/mutable-possibly-parallel-haskell-code-and-performance-tuning">Mutable, (possibly parallel) Haskell code and performance tuning</a> (stackoverflow.com)</li>
<li class="zemanta-article-ul-li"><a href="http://stackoverflow.com/questions/8275171/will-this-haskell-code-take-too-much-memory">Will this Haskell code take too much memory?</a> (stackoverflow.com)</li>
<li class="zemanta-article-ul-li"><a href="http://stackoverflow.com/questions/8751188/exceptions-in-haskell">Exceptions in Haskell</a> (stackoverflow.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=727c4e4d-a97d-47a9-a6d5-d7017d2e3bfe" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/RdloDhIPROc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/this-haskell-is-wrong-why/swizec/3489/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/this-haskell-is-wrong-why/swizec/3489</feedburner:origLink></item>
		<item>
		<title>Blogging, hats, stuff</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/dBFmcb_B2ro/3483</link>
		<comments>http://swizec.com/blog/blogging-hats-stuff/swizec/3483#comments</comments>
		<pubDate>Thu, 19 Jan 2012 10:59:19 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[Insanity]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3483</guid>
		<description><![CDATA[Yesterday I gave a talk at Kiberpipa on the awesome #wwwh weekly event. The talk was about this blog and how after that one insanely popular posteveryone suddenly decided I know what I&#8217;m doing and should tell others how its done. Video at bottom It&#8217;s funny how difficult coming up with a talk is when [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignright" style="width: 386px"><img class=" " title="Presenting" src="http://swizec.com/blog/wp-content/uploads/2012/01/5AVGVH1VUM5DXZFON5TXZN4EWVHI1EK5D5AMTZIUON1SQBHW1.jpg" alt="Presenting" width="376" height="504" /><p class="wp-caption-text">Presenting</p></div>
<p>Yesterday I gave a talk at <a class="zem_slink" title="Kiberpipa" href="http://maps.google.com/maps?ll=46.056184,14.503798&amp;spn=0.005,0.005&amp;q=46.056184,14.503798 (Kiberpipa)&amp;t=h" rel="geolocation">Kiberpipa</a> on the awesome <a href="https://twitter.com/#!/search?q=%23wwwh" target="_blank">#wwwh</a> weekly event. The talk was about this blog and how after <a title="Why programmers work at night" href="http://swizec.com/blog/why-programmers-work-at-night/swizec/3198">that one insanely popular post</a>everyone suddenly decided I know what I&#8217;m doing and should tell others how its done.</p>
<p><em style="font-size: 1.4em;">Video at bottom</em></p>
<p>It&#8217;s funny how difficult coming up with a talk is when somebody tweets you <em>Hey, you should totally come give a talk about blogging.</em> The problem with these kinds of talk is that you don&#8217;t really know what you&#8217;ll be trying to say. Every time you&#8217;re up there on stage you should have a message &#8211; something to convince the audience of.</p>
<p>Just giving a general talk <em>sucks</em> for that. It invariably turns into something a bit like this post &#8211; a rambling conglomerate of sentences that sort of go together. Always reminds me of that one line in a movie: <em>You talk a lot, but you don&#8217;t say much.</em></p>
<p>I guess the overall message of my talk was this:</p>
<p><em style="font-size: 1.3em;">Patience! It takes a lot of patience and sticking-to-it-ness, don&#8217;t do if it isn&#8217;t inherently fun for you.</em></p>
<p>Despite all of that I think the talk was a smashing success. Sure I forgot to even mention hats &#8211; was supposed to mention changing the blog&#8217;s name from Cthulhu and Other Crazies to A Geek With a Hat &#8230; oops? In general the talk ended up a bit rambley, even finished with &#8220;Wait, there was something else I wanted to say &#8230; oh well. Questions?&#8221;</p>
<p>That&#8217;s not a very strong ending. The originally planned ending was: <em>But hey, at least I&#8217;m no longer The Author on hackernews, but Swizec</em></p>
<p>All in all, rhetoric sucked, body language was attrocious, hands found their way into pockets several times, but people laughed a few times, asked a bunch of questions and I think everyone had fun. This one girl even asked for actual advice and I thank her for thinking I know enough to give advice about this stuff.</p>
<p>The slides for <a href="http://speakerdeck.com/u/swizec/p/blogging-hats-stuff" target="_blank">Blogging, hats, stuff</a> are over at Speakerdeck whose embeds don&#8217;t work with WordPress &#8230; there is also a video.</p>
<p><iframe src="http://kiberpipa.openlectures.net/SU_Swizec_Teller-Bloganje_klobuki/video/1/iframe/" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="100%" height="270px"></iframe></p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://brian.kingsonline.net/talk/2011/10/web-hour-zemanta-mozilla-success/">Web Hour + Zemanta + Mozilla = Success</a> (brian.kingsonline.net)</li>
<li class="zemanta-article-ul-li"><a href="http://r.zemanta.com/?u=http%3A//money.cnn.com/2012/01/13/technology/sal_khan_best_advice.fortune/index.htm&amp;a=71417522&amp;rid=d059e249-7cef-4f9a-9287-844dce83e91a&amp;e=23df49d4c5da66b3b023eda0ebdb9d56">Sal Khan: The best advice I ever got</a> (money.cnn.com)</li>
<li class="zemanta-article-ul-li"><a href="http://markos.gaivo.net/blog/?p=807">6th anniversary of wwwh</a> (markos.gaivo.net)</li>
<li class="zemanta-article-ul-li"><a href="http://doingthewritething.wordpress.com/2012/01/17/odd-like-us/">Odd Like Us</a> (doingthewritething.wordpress.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.tablix.org/~avian/blog/archives/2012/01/video_of_my_433_mhz_receiver_talk/">Video of my 433 MHz receiver talk</a> (tablix.org)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=d059e249-7cef-4f9a-9287-844dce83e91a" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/dBFmcb_B2ro" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/blogging-hats-stuff/swizec/3483/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/blogging-hats-stuff/swizec/3483</feedburner:origLink></item>
		<item>
		<title>Are you a boy scout coder?</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/Nav-bzi8oAA/3471</link>
		<comments>http://swizec.com/blog/are-you-a-boy-scout-coder/swizec/3471#comments</comments>
		<pubDate>Tue, 17 Jan 2012 11:14:08 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[Opinion]]></category>
		<category><![CDATA[Boy Scout]]></category>
		<category><![CDATA[Scout]]></category>
		<category><![CDATA[Source code]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3471</guid>
		<description><![CDATA[The Boy Scouts have a rule: &#8220;Always leave the campground cleaner than you found it.&#8221; If you find a mess on the ground, you clean it up regardless of who might have made the mess. /../ the original form by Robert Stephenson Smyth Baden-Powell, was &#8220;Try and leave this world a little better than you [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>The Boy Scouts have a rule: &#8220;Always leave the campground cleaner than you found it.&#8221; If you find a mess on the ground, you clean it up regardless of who might have made the mess. /../ the original form by Robert Stephenson Smyth Baden-Powell, was &#8220;Try and leave this world a little better than you found it.&#8221;</p>
<p>What if we followed a similar rule in our code: &#8220;Always check a module in cleaner than when you checked it out.&#8221; No matter who the original author was, what if we always made some effort, no matter how small, to improve the module. What would be the result?</p>
<p>by <a title="Uncle Bob" href="http://programmer.97things.oreilly.com/wiki/index.php/Uncle_Bob">Uncle Bob</a> at <a href="http://programmer.97things.oreilly.com/wiki/index.php/The_Boy_Scout_Rule">O&#8217;Reilly commons</a></p></blockquote>
<div class="wp-caption alignright" style="width: 281px"><a href="http://commons.wikipedia.org/wiki/File:Baden-Powell_family_%281917%29.jpg"><img class="zemanta-img-inserted zemanta-img-configured" title="Lieut. Gen. Robert Stephenson Smyth Baden-Powe..." src="http://swizec.com/blog/wp-content/uploads/2012/01/Baden-Powell_family_%281917%29.jpg" alt="Lieut. Gen. Robert Stephenson Smyth Baden-Powe..." width="271" height="296" /></a><p class="wp-caption-text">Image via Wikipedia</p></div>
<p>When I first saw this rule in Clean Code I loved it! It&#8217;s just such an awesome rule. You come into a file, you clean it up a little bit. Remove a stupid comment, indent something better &#8230; anything.</p>
<p>It makes the world a better place and everyone a happy camper right?</p>
<p>Well, this might be great in theory and work well when you are employed by a company where you will spend the next few years of your life. The software you&#8217;re working on will live and grow with you, with your team. <em>You</em> are the guy shouting &#8220;Fuck this! Who the fuck made this code! This is bloody impossible to maintain!&#8221; a year from now.</p>
<p>For a freelancer the situation is a bit different.</p>
<p>Here you are, plomped into the middle of an ongoing project. Decisions have been made, rabbit holes have been followed. The deadline is in a month and as a crack team of one specialist on a tight deadline, you&#8217;re making nice gold per hour.</p>
<p>Right there in front of you. A mess. Code so ugly, so horrible, it would make a grown man cry. You&#8217;re just supposed to add a feature. Figure out the mess, add two or three lines of code, cross your fingers and hope for the best.</p>
<p>Or should you rewrite the whole function?</p>
<p>Rewriting would be the Right Thing &#8482; to do. The code will be more maintainable, easier to test, it will save your client a bunch of money down the line. You won&#8217;t be maintaining this so you have a responsible towards everyone coming after you to fix something.</p>
<p>But, right now, right this very instance, you are strong-arming the poor client to pay more. Sure, you&#8217;re making the code better, but they care about that one feature. Should you really spend three hours rewriting the code instead of one hour adding something and hoping for the best?</p>
<p>On the other hand: When the messy code breaks, and it <em>will</em> break, it will be your fault. You&#8217;re the last guy who touched it. Not rewriting will come back to haunt you. The guy who maintains your code will curse you in their sleep and dream of delicious murder. And it&#8217;s not even your code!</p>
<p>So what do you do?</p>
<p>Personally I always try to rewrite crappy code. Add testing suites. Anything I can do to make the <a class="zem_slink" title="Codebase" href="http://en.wikipedia.org/wiki/Codebase" rel="wikipedia">codebase</a> better. But I always carefully explain the situation to my client. <em>Why</em> am I doing this, <em>how</em> is it benefiting <strong>the client</strong>. It&#8217;s important to make them understand I&#8217;m not just inventing work to rake in more gold.</p>
<p>Clients are surprisingly permissive most of the time and I can sleep better at night. win-win!</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://www.swaroopch.com/blog/coders-at-work/">Two nuggets from Coders at Work book</a> (swaroopch.com)</li>
<li class="zemanta-article-ul-li"><a href="http://majorknitter.typepad.com/major_knitter/2012/01/boy-scout-popcorn-for-the-troops.html">Boy Scout Popcorn for the Troops</a> (majorknitter.typepad.com)</li>
<li class="zemanta-article-ul-li"><a href="http://arstechnica.com/gaming/news/2012/01/maniac-tentacle-mindbenders-of-atlantis-how-scummvm-kept-adventure-gaming-alive.ars">Feature: Maniac Tentacle Mindbenders: How ScummVM&#8217;s unpaid coders kept adventure gaming alive</a> (arstechnica.com)</li>
<li class="zemanta-article-ul-li"><a href="http://developers.slashdot.org/story/12/01/14/008236/code-cleanup-culls-libreoffice-cruft">Code Cleanup Culls LibreOffice Cruft</a> (developers.slashdot.org)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=cd0845b8-94e0-47d9-ae15-be9f3afa1482" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/Nav-bzi8oAA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/are-you-a-boy-scout-coder/swizec/3471/feed</wfw:commentRss>
		<slash:comments>22</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/are-you-a-boy-scout-coder/swizec/3471</feedburner:origLink></item>
		<item>
		<title>Shoes</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/E2vacvy5-70/3466</link>
		<comments>http://swizec.com/blog/shoes/swizec/3466#comments</comments>
		<pubDate>Mon, 16 Jan 2012 17:41:46 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[A tech a day]]></category>
		<category><![CDATA[Athletic shoe]]></category>
		<category><![CDATA[Clothing]]></category>
		<category><![CDATA[Footwear]]></category>
		<category><![CDATA[Hiking boot]]></category>
		<category><![CDATA[Shoe]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3466</guid>
		<description><![CDATA[Shoes are wonderful technology, they protect our feet, they make us look good and there&#8217;s a whole culture associated with wearing those things. A culture I, as a man, will never understand. Apparently there is a million and one way to wear the wrong kind of shoes to the wrong kind of outfit. For instance, my [...]]]></description>
			<content:encoded><![CDATA[<p>Shoes are wonderful technology, they protect our feet, they make us look good and there&#8217;s a whole culture associated with wearing those things. A culture I, as a man, will <em>never</em> understand.</p>
<div class="wp-caption alignright" style="width: 377px"><img class=" " title="Shoes on their deathbed" src="http://swizec.com/blog/wp-content/uploads/2012/01/5764ba26406311e180c9123138016265_74.jpg" alt="Shoes on their deathbed" width="367" height="367" /><p class="wp-caption-text">Shoes on their deathbed</p></div>
<p>Apparently there is a million and one way to wear the wrong kind of shoes to the wrong kind of outfit. For instance, my scruffy shoes &#8230; don&#8217;t go with any outfit. Or so I&#8217;ve been told. I like to think they go with every outfit exactly <em>because</em> they&#8217;re scruffy and falling apart. Gives them a bit of character.</p>
<p>But, they are about to die, so I have to find a replacement this week. The thing I don&#8217;t understand is: Why do women need so many? A good pair of black leather sneakers covers pretty much every occasion.</p>
<ol>
<li>They&#8217;re comfy, so you can use them for walking to places</li>
<li>Because they&#8217;re black leather, they look nice when clean and can be used for business</li>
<li>Because they look kinda nice, they can be used for <a class="zem_slink" title="Semi-formal" href="http://en.wikipedia.org/wiki/Semi-formal" rel="wikipedia">semi-formal</a> stuff too. Anything that isn&#8217;t black- or white- tie really.</li>
<li>If you aren&#8217;t a sissy most sport can be done in them as well</li>
</ol>
<p>The only other pair of shoes you might need is a pair of <a class="zem_slink" title="Sandal" href="http://en.wikipedia.org/wiki/Sandal" rel="wikipedia">sandals</a>, if you&#8217;re too sissy to go barefoot at the beach in the summer. And while some advocate using a pair of <a class="zem_slink" title="Waterproofing" href="http://en.wikipedia.org/wiki/Waterproofing" rel="wikipedia">water-proof</a> shoes for special weather, you don&#8217;t actually need that. Shoes dry out over night and pretty much all types of shoe I&#8217;ve seen gets soaking wet the moment you start thinking of them as being water-proof.</p>
<p><a class="zem_slink" title="Wellington boot" href="http://en.wikipedia.org/wiki/Wellington_boot" rel="wikipedia">Rubber boots</a> old people use for gardening might be an exception, but those get soaking wet from the inside anyway, so what&#8217;s the point?</p>
<p>Last night I asked an internet about the need for multiple shoes and got a rather interesting answer from some girl:</p>
<blockquote><p>For me I think I have</p>
<p>3 pairs of heeled sandals (to wear with skirts, dresses, or summer clothes)<br />
2 pairs of flip flops<br />
4 pairs of black boots<br />
1 pair of grey boots (for when black doesn&#8217;t work with what I&#8217;m wearing)<br />
2 pairs of black heels (for dress or black dress pants, ones more business then the other)<br />
2 pairs of black low heeled shoes (business or going somewhere that might include walking)<br />
1 pair of tennis shoes<br />
1 pair of pink heels<br />
1 pair of cobalt blue heels<br />
1 pair of teal heels<br />
2 pairs of low heeled dance shoes<br />
2 pair of latin heeled dance shoes<br />
1 pair of jazz<br />
1 pair of highland<br />
1 pair of low heeled sandals</p>
<p>Those are the ones I can think of off hand.</p></blockquote>
<p>That&#8217;s just too many shoes! Where does she even keep them all? And who has time to buy all those things anyway? And the mental energy it takes to go out and look for shoes &#8230; women are truly insane.</p>
<p>An answer from the most well-dressed guy I know was far better in my view:</p>
<blockquote><p>In general, men don&#8217;t need too many shoes short of shoes needed for hobbies. I have two pairs of black shoes, two pairs of brown shoes, and a pair of evening shoes; the rest are activity-specific. Riding boots, hiking boots, dance shoes, boat shoes, cold/wet-climate hiking boots, and so on are only necessary for specific purposes.</p></blockquote>
<p>That makes sense, having shoes for specific purposes doesn&#8217;t really count as having another pair of shoes does it? I certainly wouldn&#8217;t think of listing my diving fins or rollerblades under &#8220;pairs of shoes&#8221; even though they are technically footwear &#8230;</p>
<p>Now excuse me while I go meditate on my misery of having to buy a new pair of shoes this week.</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://www.fabsugar.com/Shop-Leopard-Print-Shoes-19318554">Fierce Obsession -15 Pairs of Irresistible Leopard-Print Shoes</a> (fabsugar.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.savingsjunction.com/the-2011-autumn-guide-to-good-value-and-in-style-shoes/">The 2011 Autumn Guide to Good Value and In Style Shoes</a> (savingsjunction.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.savings.com/blog/post/Wardrobe-Oxygen-Fall-Fashion-Footwear-Trends-Splurge-or-Save.html">Wardrobe Oxygen: Fall Fashion Footwear Trends &#8211; Splurge or Save?</a> (savings.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.fabsugar.com/Shoe-Buying-Tips-8512313">If the Shoe Fits</a> (fabsugar.com)</li>
<li class="zemanta-article-ul-li"><a href="http://anexerciseindiscipline.wordpress.com/2011/12/10/look-they-got-toes/">Look! They Got Toes!</a> (anexerciseindiscipline.wordpress.com)</li>
<li class="zemanta-article-ul-li"><a href="http://autumnsunshineandgabrielleangel.wordpress.com/2011/10/01/shoes-in-my-closet-by-gabrielle-angel/">Shoes in my Closet&#8230;~By Gabrielle Angel</a> (autumnsunshineandgabrielleangel.wordpress.com)</li>
<li class="zemanta-article-ul-li"><a href="http://ask.metafilter.com/205313/Which-Shoes-Were-Made-For-Walking">Which Shoes Were Made For Walking?</a> (ask.metafilter.com)</li>
<li class="zemanta-article-ul-li"><a href="http://fortyoneplease.wordpress.com/2012/01/15/giuseppe-zanotti-no-heel-crystal-studded-sandal/">Giuseppe Zanotti No Heel Crystal-Studded Sandal</a> (fortyoneplease.wordpress.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=8f0ffbb0-31f3-4acd-957e-2aba17284718" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/E2vacvy5-70" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/shoes/swizec/3466/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/shoes/swizec/3466</feedburner:origLink></item>
		<item>
		<title>Why you don’t exercise every day</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/-A1cGw62DM0/3456</link>
		<comments>http://swizec.com/blog/why-you-dont-exercise-every-day/swizec/3456#comments</comments>
		<pubDate>Sun, 15 Jan 2012 13:34:41 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[Insanity]]></category>
		<category><![CDATA[Opinion]]></category>
		<category><![CDATA[Gym]]></category>
		<category><![CDATA[Motivation]]></category>
		<category><![CDATA[Physical exercise]]></category>
		<category><![CDATA[Richard Branson]]></category>
		<category><![CDATA[Tim Ferriss]]></category>
		<category><![CDATA[Timothy Ferriss]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3456</guid>
		<description><![CDATA[Because you are an idiot. But that&#8217;s harsh, so let me explain why this makes you an idiot. There was an article posted to HN yesterdayabout why people don&#8217;t go to the gym, it included a simple motivational technique of paying yourself to go. After commenting that the only thing it takes to go to [...]]]></description>
			<content:encoded><![CDATA[<p><em style="font-size: 1.2em;">Because you are an idiot.</em></p>
<div class="wp-caption alignright" style="width: 317px"><img class=" " title="Can you save a life?" src="http://swizec.com/blog/wp-content/uploads/2012/01/savelife22.png" alt="Can you save a life?" width="307" height="366" /><p class="wp-caption-text">Can you save a life?</p></div>
<p>But that&#8217;s harsh, so let me explain why this makes you an idiot. There was <a href="http://news.ycombinator.com/item?id=3464853" target="_blank">an article posted to HN yesterday</a>about why people don&#8217;t go to the gym, it included a simple motivational technique of paying yourself to go.</p>
<p>After commenting that the only thing it takes to go to the gym every day is <em>to go to the gym every day</em>, I was downvoted to oblivion. But there&#8217;s really nothing more to it than that. You can sugar coat it whichever way you want, you can come up with dozens of motivational techniques &#8211; in the end, all it takes is going.</p>
<p>Even if you don&#8217;t go to the gym every day, you should still make sure to exercise daily. Here&#8217;s how you do it:</p>
<ol>
<li>Day 1 &#8211; exercise when you wake up</li>
<li>Day 2 &#8211; exercise when you wake up</li>
<li>Day 3 &#8211; exercise when you wake up</li>
<li>Day 4 &#8211; eh you&#8217;ve exercised three days in a row, might as well do it again</li>
<li>Day N &#8211; do the default thing [of exercising]</li>
</ol>
<p>After a couple of days you have to make a conscius <em>effort</em> not to exercise. The default action is simply to exercise and as humans we love nothing more than not having to make a decision. This is also known as the <a href="http://theclosetentrepreneur.com/seinfelds-secret-motivational-technique" target="_blank">Seinfeld motivational technique</a> by the way.</p>
<p>Exercise also does a better job of waking you up than coffee, thought I&#8217;d mention that.</p>
<p>BUT!</p>
<h2>I don&#8217;t have time</h2>
<p><a class="zem_slink" title="Richard Branson" href="http://www.crunchbase.com/person/richard-branson" rel="crunchbase">Richard Branson</a> is one of the busiest humans alive, this is what he has to say about exercising daily:</p>
<blockquote><p><a class="zem_slink" title="Timothy Ferriss" href="http://www.fourhourworkweek.com/" rel="homepage">Tim Ferriss</a> tells this story about how Richard Branson was once asked the single biggest thing most people could do to increase productivity. Due to the fact that he&#8217;s one of the busiest men on the planet, every single person in the audience leaned forward with bated breath. His answer? Exercise daily. It improves the quality of your sleep, so you need less. It makes you more emotionally stable, so you&#8217;re more motivated. And most importantly, it increases mental clarity, so you&#8217;re more focused through-out the day. Branson said that it gives him multiple hours more productivity every day. It&#8217;s bull to say you don&#8217;t have enough time every day to exercise; if you&#8217;re that busy then in fact you don&#8217;t have enough time to NOT exercise.</p></blockquote>
<p>And if you&#8217;re anything like the average person who spends a bunch of time commuting, watching television and browsing the online &#8230; you have no right to complain about lack of time.</p>
<h2>It cuts into family time</h2>
<p>A popular complaint in the HN discussion was that exercise cuts into quality time with their families.</p>
<p>Sure &#8230; but one day your building will catch fire, or you&#8217;ll have a car crash, or _something_. Can you be there for your family when family time involves saving the people you love from death?</p>
<p>No, your flabby office worker muscles won&#8217;t cut it and that beer+pizza belly won&#8217;t help either. <a href="http://artofmanliness.com/2009/09/15/every-man-should-be-able-to-save-his-own-life-5-fitness-benchmarks-a-man-must-master/" target="_blank">Every man should be able to save his life</a>, and the lives of those he loves! Since this is the 21st century, women should too.</p>
<h2>Exercise is hard!</h2>
<p>Nobody cares. You&#8217;re fat, you&#8217;re flabby and you are useless in an emergency. Spending 30 minutes every day doing some basic exercises is <em>nothing</em> compared to the dividends it pays in pretty much all areas of your life.</p>
<p>And if you don&#8217;t care about any of that, then do it to make the world a prettier place, one flabby human at a time.</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://www.lifehack.org/articles/productivity/how-to-supercharge-your-productivity-the-richard-branson-way.html">How to Supercharge your Productivity the Richard Branson Way</a> (lifehack.org)</li>
<li class="zemanta-article-ul-li"><a href="http://www.webmd.com/fitness-exercise/features/exercise-motivation?src=RSS_PUBLIC">Exercise Motivation: How to Get It, How to Keep It</a> (webmd.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.fitsugar.com/Low-Impact-Exercises-Morning-Workouts-19414062">5 Low-Impact Exercises to Jump-Start Your Day</a> (fitsugar.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.joyofspa.com/mind-body-exercise-and-emergence">Mind, Body, Exercise and Emergence</a> (joyofspa.com)</li>
<li class="zemanta-article-ul-li"><a href="http://nanapamela.wordpress.com/2012/01/14/some-call-it-cheating-i-call-it-staying-warm-and-dry/">Some call it cheating. I call it staying warm and dry</a> (nanapamela.wordpress.com)</li>
<li class="zemanta-article-ul-li"><a href="http://coachcalvert.wordpress.com/2012/01/06/exercise-workshop/">Exercise workshop&#8230;</a> (coachcalvert.wordpress.com)</li>
<li class="zemanta-article-ul-li"><a href="http://trainingdaily.runnersworld.com/2012/01/why-exercise-is-healthy-for-mice-at-least/">Why Exercise Is Healthy&#8230;for Mice, at Least</a> (trainingdaily.runnersworld.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=e93f614a-7984-4f7c-bf86-7653bd2218bd" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/-A1cGw62DM0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/why-you-dont-exercise-every-day/swizec/3456/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/why-you-dont-exercise-every-day/swizec/3456</feedburner:origLink></item>
		<item>
		<title>Geeks of america, please start fighting SOPA</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/oxBG-hhi5fM/3426</link>
		<comments>http://swizec.com/blog/geeks-of-america-please-start-fighting-sopa/swizec/3426#comments</comments>
		<pubDate>Thu, 12 Jan 2012 11:41:32 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[Opinion]]></category>
		<category><![CDATA[Copyright]]></category>
		<category><![CDATA[Go Daddy]]></category>
		<category><![CDATA[GoDaddy]]></category>
		<category><![CDATA[Internet service provider]]></category>
		<category><![CDATA[Namecheap]]></category>
		<category><![CDATA[PayPal]]></category>
		<category><![CDATA[United States]]></category>
		<category><![CDATA[United States Department of Justice]]></category>
		<category><![CDATA[Wikipedia]]></category>
		<category><![CDATA[YouTube]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3426</guid>
		<description><![CDATA[The Stop Online Piracy Act is a bill in the US aimed at protecting intellectual property online. As originally proposed the bill would (skip to Something Useful if you know this stuff) /../ allow the U.S. Department of Justice, as well as copyright holders, to seek court orders against websites accused of enabling or facilitating copyright infringement. [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://en.wikipedia.org/wiki/SOPA" target="_blank">Stop Online Piracy Act</a> is a bill in the US aimed at protecting intellectual property online. As originally proposed the bill would <em>(skip to <a href="#something_useful">Something Useful</a> if you know this stuff)</em></p>
<div class="wp-caption alignright" style="width: 310px"><a href="http://commons.wikipedia.org/wiki/File:1891_New_Orleans_Italian_lynching.jpg"><img class="zemanta-img-inserted zemanta-img-configured" title="An episode of the lynching of the Italians in ..." src="http://swizec.com/blog/wp-content/uploads/2012/01/300px-1891_New_Orleans_Italian_lynching5.jpg" alt="An episode of the lynching of the Italians in ..." width="300" height="421" /></a><p class="wp-caption-text">Image via Wikipedia</p></div>
<blockquote><p>/../ allow the U.S. Department of Justice, as well as <strong>copyright holders</strong>, to seek <strong>court orders</strong> against websites accused of enabling or facilitating <strong>copyright infringement</strong>. Depending on who requests the court orders, the actions could include <strong>barring online advertising</strong> networks and <strong>payment facilitators</strong> such as PayPal from <strong>doing business</strong> with the <strong>allegedly infringing</strong> website, barring <strong>search engines from linking</strong> to such sites, and requiring <strong>Internet service providers</strong> to <strong>block access</strong> to such sites. The bill would make <strong>unauthorized streaming</strong> of copyrighted content <strong>a crime</strong>, with a maximum penalty of five years in prison for 10 pieces of music or movies within six months. The bill also <strong>gives immunity</strong> to Internet services that <strong>voluntarily take action</strong> against websites dedicated to infringement, while <strong>making liable</strong> for damages any <strong>copyright holder</strong> who knowingly <strong>misrepresents</strong> that a website is dedicated to infringement</p></blockquote>
<p>Not too bad, if you have a site dedicated to copyright infringement you pretty much get taken offline and put out of business. However, according to The Internet, it is extremely easy to fall under that definition. All it takes is a single piece of user generated content to be infringing and BAM! the whole website goes down.</p>
<p>You know all those videos of cute kittens with a copyrighted song in the background that you see on <a class="zem_slink" title="YouTube" href="http://www.youtube.com/" rel="homepage">YouTube</a>? Yeah, that means youtube.com is put out of business.</p>
<p>Oops.</p>
<p>As a European there isn&#8217;t really anything I can do about this. But <em>americans</em> can and should!</p>
<h2>The lynch mob</h2>
<div class="wp-caption alignleft" style="width: 310px"><a href="http://en.wikipedia.org/wiki/File:WillJamesMob.gif"><img class="zemanta-img-inserted zemanta-img-configured" title="The crowd at the lynching of Will James in Cai..." src="http://swizec.com/blog/wp-content/uploads/2012/01/300px-WillJamesMob4.gif" alt="The crowd at the lynching of Will James in Cai..." width="300" height="190" /></a><p class="wp-caption-text">Image via Wikipedia</p></div>
<p>The internet lynch mob has been mobilized. The angle of attack? Boycott supporters of SOPA. A month ago <a class="zem_slink" title="Go Daddy" href="http://www.godaddy.com/" rel="homepage">GoDaddy</a> suffered a mass exoddus of users and <a class="zem_slink" title="Namecheap" href="http://www.namecheap.com/" rel="homepage">Namecheap</a> turned it into one of the most brilliant marketing stunts I have ever seen.</p>
<p>Also GoDaddy has made surprising strides in their UI/UX design over the last month, more changes for the better and awesomer than I have seen in the last &#8230; five? Six? years.</p>
<p>On January 18th reddit.com is going into a blackout, briefly even Wikipedia considered blacking itself out. There is talk google.com and facebook.com will/should be doing the same. Isn&#8217;t that awesome? All these huge sites are against SOPA and are doing <em>something</em>.</p>
<p>Fighting against rich 50-somethings who don&#8217;t care about the internet beyond what their grandchildren tell them about cute kitten memes by disabling various parts of it? &#8230; yeah, very effective, you can only imagine!</p>
<p>So a few sites are blacked out, and on the next family gathering the congressperson will hear that their granddaughter was kind of upset for a day because she couldn&#8217;t feed an electronic sheep or something.</p>
<p>Even if traditional media manages to throw a big hullabaloo about it &#8230; what do you think a mexican standof between the government and the internet will look like? All these companies bleeding <em>millions of dollars</em> every single day, while the congresspeople play golf and chat about how awesome winter break was and plotting how to backstab all the big players next time &#8217;round.</p>
<p>By the time they have to be re-elected again the whole thing will have blown over and no damage will have been done. Well except for the big sites, who now have a bunch of influental people angry at them.</p>
<p><a name="something_useful"></a></p>
<h2>Do something useful instead</h2>
<p>Instead of being a tempest in a teacup, how about all you american geeks start <em>actually fighting</em> this thing eh? You should!</p>
<div class="wp-caption alignright" style="width: 310px"><a href="http://en.wikipedia.org/wiki/File:Lobbying_Data.png"><img class="zemanta-img-inserted zemanta-img-configured" title="Direct lobbying statistics in the United State..." src="http://swizec.com/blog/wp-content/uploads/2012/01/300px-Lobbying_Data3.png" alt="Direct lobbying statistics in the United State..." width="300" height="184" /></a><p class="wp-caption-text">Image via Wikipedia</p></div>
<p>Here&#8217;s a small tip I got from a guy who was old enough to pay attention when geeks of Europe fought against software patents and won</p>
<ol>
<li>Go to Washington</li>
<li>Find names of congresspeople</li>
<li>Find out their habits</li>
<li>Crash their lunches, crash their breakfast, crash their golf game, crash every social event they have</li>
<li>Tell them SOPA sucks (perhaps in more eloquent words)</li>
</ol>
<p>The RIAA and MPAA are <em>doing this</em>. They are taking people out to lunches, they are telling them how awesome SOPA is, they are telling them how this will save the economy, their precious sportscar and how it will make everyone happy to give them even more money.</p>
<p>Geeks aren&#8217;t, at least not enough that anyone would know about it.</p>
<p>We can all agree the internet is an awesome and great communication tool. But <em>real</em> change, <em>real</em> influence &#8230; that happens face-to-face. So go out there and be face-to-face with the people who think the internet is a novelty.</p>
<p>Please, for everyone. Do it.</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="https://www.pcworld.com/article/247037/why_arent_other_sopa_supporters_being_punished_like_godaddy.html">Why Aren&#8217;t Other SOPA Supporters Being Punished Like GoDaddy?</a> (pcworld.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.wired.com/threatlevel/2012/01/geeks-sopa/">Geeks to Testify (Finally!) About SOPA Blacklisting Implications</a> (wired.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.intomobile.com/2012/01/10/boycott-sopa-for-android-app-challenges-all-who-oppose/">Boycott SOPA for Android app challenges all who oppose</a> (intomobile.com)</li>
<li class="zemanta-article-ul-li"><a href="http://mashable.com/2011/12/23/breaking-godaddy-no-longer-supports-sopa/">BREAKING: GoDaddy No Longer Supports SOPA</a> (mashable.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.macworld.com/article/164512/2011/12/godaddy_pulls_its_support_from_sopa.html">GoDaddy pulls its support from SOPA</a> (macworld.com)</li>
<li class="zemanta-article-ul-li"><a href="http://arstechnica.com/tech-policy/news/2012/01/reddit-going-dark-for-a-day-to-protest-sopa-online-censorship-bill.ars">Reddit going dark for a day to protest SOPA online censorship bill</a> (arstechnica.com)</li>
<li class="zemanta-article-ul-li"><a href="http://danwin.com/2012/01/the-sopa-debate-and-how-its-affected-by-congresss-understanding-of-child-porn/">The SOPA Debate and Congress&#8217;s Understanding of Child Porn</a> (danwin.com)</li>
<li class="zemanta-article-ul-li"><a href="http://r.zemanta.com/?u=http%3A//www.cbsnews.com/8301-205_162-57348677/godaddy-stumbles-into-an-anti-sopa-brushfire/&amp;a=68314600&amp;rid=c0333579-3c54-45c4-afb8-e207bf955e27&amp;e=f8ac8c34d79d8415718f2c5c986a6d9b">GoDaddy stumbles into an anti-SOPA brushfire</a> (cbsnews.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.readwriteweb.com/archives/how_sopa_would_kill_art_creativity_online.php">How SOPA Would Kill Art &amp; Creativity Online</a> (readwriteweb.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=c0333579-3c54-45c4-afb8-e207bf955e27" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/oxBG-hhi5fM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/geeks-of-america-please-start-fighting-sopa/swizec/3426/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/geeks-of-america-please-start-fighting-sopa/swizec/3426</feedburner:origLink></item>
		<item>
		<title>Minimum substring cover problem</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/6Zu2QKVoXDQ/3406</link>
		<comments>http://swizec.com/blog/minimum-substring-cover-problem/swizec/3406#comments</comments>
		<pubDate>Wed, 11 Jan 2012 19:48:20 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[A tech a day]]></category>
		<category><![CDATA[Science Wednesday]]></category>
		<category><![CDATA[Algorithm]]></category>
		<category><![CDATA[Approximation algorithm]]></category>
		<category><![CDATA[Combinatorics]]></category>
		<category><![CDATA[Linear programming]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[NP-hard]]></category>
		<category><![CDATA[Substring]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3406</guid>
		<description><![CDATA[A major part of my thesisinvolves finding an algorithm to discover a good substring cover of text in order to properly syllabify said text. But what is the substring cover problem anyway and what does it entail? The Minimum Substring Cover Problem paper from Hermelin, Rawitz, Rizzi and Vialette dating back to 2007 (judging by [...]]]></description>
			<content:encoded><![CDATA[<p>A major part of <a href="https://github.com/Swizec/Le-Thesis">my thesis</a>involves finding an algorithm to discover a good substring cover of text in order to properly syllabify said text. But what is the substring cover problem anyway and what does it entail?</p>
<div class="wp-caption alignright" style="width: 223px"><a href="http://www.flickr.com/photos/94416001@N00/11259239"><img class="zemanta-img-inserted zemanta-img-configured" title="algorithms doodle" src="http://swizec.com/blog/wp-content/uploads/2012/01/11259239_fe6b60af02_m5.jpg" alt="algorithms doodle" width="213" height="240" /></a><p class="wp-caption-text">Image by Shreyans Bhansali via Flickr</p></div>
<p><a href="http://cs.haifa.ac.il/~dhermeli/Publications/WAOA2007.pdf" target="_blank">The Minimum Substring Cover Problem</a> paper from Hermelin, Rawitz, Rizzi and Vialette dating back to 2007 (judging by the filename) serves as a good entry point into this topic.</p>
<p>There are actually a lot of cover problems, the most famous being Minimum <a class="zem_slink" title="Set cover problem" href="http://en.wikipedia.org/wiki/Set_cover_problem" rel="wikipedia">Set Cover</a> and <a class="zem_slink" title="Vertex cover" href="http://en.wikipedia.org/wiki/Vertex_cover" rel="wikipedia">Minimum Vertex Cover</a> problems. In this type of problems we are faced with two sets of elements and we want to cover one of the sets with another, by using the &#8220;least&#8221; elements from the covering set. I put &#8220;least&#8221; in quotes because the definition depends on what we want &#8211; maybe we want to use the least number of elements, perhaps we want the shortest elements &#8230; whatever.</p>
<p>For an example consider this:</p>
<pre>S = ['a', 'aab', 'aba']
C(S) = ['a', 'b', 'aa', 'ab', 'ba', 'aab', 'aba']</pre>
<p>We can easily see that <em>C(S)</em> is a set of all the possible coverings of S &#8211; using a combination of strings from C we can construct every string in S. This part isn&#8217;t very difficult to calculate.</p>
<p>Everything gets slightly hairier when you look for minimum covers:</p>
<pre>C_1 = ['a', 'b']  # 3-cover (need 3 strings to cover the longest string in S)
C_2 = ['a', 'ab'] # 2-cover (need 2 strings to cover the longest string in S)</pre>
<p>Depending on how you choose the weight, both C_1 and C_2 are <em>minimum substring covers</em> of S. Considering &#8220;least&#8221; to mean <em> least amount of strings</em> then both are of weight 2, but if you consider &#8220;least&#8221; to mean <em>the total length of strings</em> then C_1 is better.</p>
<p>You could easily argue C_2 is better, because it uses the least amount of elements to cover the whole set S. 1+3+3 = 7 for C_1 and 1+2+2 = 5 for C_2.</p>
<p>Ok, so now we know that finding the minimum substring cover of a set of strings depends a whole lot on what you actually want. Always a good sign, having a well-known problem where people can&#8217;t even agree on what the best solution looks like.</p>
<p>The paper goes on to explain in great theoretical detail that, because this problem is similar to minimum vertex cover, minimum set cover and similar problems, it is <a class="zem_slink" title="NP-hard" href="http://en.wikipedia.org/wiki/NP-hard" rel="wikipedia">NP-hard</a> to approximate. This means that the problem is at least as hard as the hardest problems in NP, but it doesn&#8217;t necessarily mean that there is no polynomial solution &#8211; it just hasn&#8217;t been found yet.</p>
<p>Luckily, if we constrain some parameters of the problem, it becomes/remains <a class="zem_slink" title="APX" href="http://en.wikipedia.org/wiki/APX" rel="wikipedia">APX-hard</a> &#8211; <em>problems in this class have efficient algorithms that can find an answer within some fixed percentage of the optimal answer. </em></p>
<p>The article then proposes two <a class="zem_slink" title="Approximation algorithm" href="http://en.wikipedia.org/wiki/Approximation_algorithm" rel="wikipedia">approximation algorithms</a> for finding minimum substring covers of S.</p>
<h2>Local-Ratio Algorithms</h2>
<p>This algorithm follows from the local-ratio lemma, which in the case of substring cover means</p>
<blockquote><p>Let C be a cover for S, and let w_1 and w_2 be weight functions for C(S). If C is an alpha-approximate, both with respect to w_1 and with respect to w_2, then C is also alpha-approximate with respect to w_1+w_2.</p></blockquote>

<div class="wp_syntax"><div class="code"><pre class="pseudocode" style="font-family:monospace;">Data: A set of strings S, a weight function w:C(S) -&gt; Q+, an integer l &gt;= 2
Result: An l-cover C for S (l is the number of substrings covering the longest s in S)
begin
&nbsp;
C &lt;- {c in C(S) : w(c) = 0}.
if C is an l-cover of S then return C.
Let s in S be a string not l-covered by C of maximum length.
C_s &lt;- {c in C(S)\C : c is a substring of s}.
Set eps = min{w)(c_  c in C_s}.
Define w_1(c) = eps if c in C_s, 0 otherwise.
C &lt;- LR(S, w_2, l).
if C\{s} is an l-cover for S then C &lt;- C\{s}.
return C.
&nbsp;
end</pre></div></div>

<p>This algorithm is guaranteed to terminate after a polynomial amount of recursive calls and it returns a (((m+1) binomial 2) &#8211; 1)-approximate l-cover of S.</p>
<p>In sensible terms the algorithm basically does this: Add everything with zero weight to a partial solution, if this isn&#8217;t the solution, it selects an uncovered substring in S and tries to cover it by examining all substrings in C_s.</p>
<h2><a class="zem_slink" title="Linear programming" href="http://en.wikipedia.org/wiki/Linear_programming" rel="wikipedia">Linear Programming</a> Rounding</h2>
<p>Originally the linear programming rounding algorithm was developed by Hajiaghayi et all. for the Minimum Multicolored Subgraph problem when l=2. It has now been expanded for any constant value of l.</p>
<p>This section is extremely light on practical results and just shows a bunch of mathematics that supposedly prove how the algorithm can be extended and that the final result is an O(log^(1/l) n * m^((l/1)^2/l))-approximate algorithm.</p>
<p>From what I can understand this algorithm approaches the problem with the idea that they are basically looking for l-factorizations of strings.</p>
<p>According to this section, the minimum substring cover can be formulated using the following integer linear program:</p>
<pre>
min    SUM_(c in C(s)) w(c)x_c
s.t.   SUM_(f in F_l(s)) y_f >= 1          every s in S
       SUM_(c in f in F_l(s)) y_f <= x_c   every s in S, every c substring of s
       x_c, y_f in {0,1}                   every c in C(S), every f in F_l(S)

# F_l(S) is the set of all factorizations of S
</pre>
<p>Then there are a bunch of proofs that this algorithm works and is indeed very awesome ... but by this time my eyes started glazing over and the September deadline for my thesis started looking <em>very</em> near.</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://stackoverflow.com/questions/7467186/apply-substring-on-values-in-linq">Apply substring on values in LINQ</a> (stackoverflow.com)</li>
<li class="zemanta-article-ul-li"><a href="http://stackoverflow.com/questions/8046107/objective-c-substring-range-exception">Objective-c Substring Range Exception</a> (stackoverflow.com)</li>
<li class="zemanta-article-ul-li"><a href="http://stackoverflow.com/questions/7904270/substr-and-explode-in-javascript">Substr and explode in JavaScript</a> (stackoverflow.com)</li>
<li class="zemanta-article-ul-li"><a href="http://spokutta.wordpress.com/2012/01/05/1311/">On linear programming formulations for the TSP polytope</a> (spokutta.wordpress.com)</li>
<li class="zemanta-article-ul-li"><a href="http://ntz-develop.blogspot.com/2011/03/fuzzy-string-search.html">Fuzzy string search</a> (ntz-develop.blogspot.com)</li>
<li class="zemanta-article-ul-li"><a href="http://11011110.livejournal.com/238766.html">Top ten algorithms preprints of 2011</a> (11011110.livejournal.com)</li>
<li class="zemanta-article-ul-li"><a href="http://stackoverflow.com/questions/8456010/efficiently-replace-a-fixed-position-substring-with-a-string-of-equal-or-larger">Efficiently replace a fixed position substring with a string of equal or larger length</a> (stackoverflow.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=a0995159-d508-465f-9dd9-b53632d16b06" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/6Zu2QKVoXDQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/minimum-substring-cover-problem/swizec/3406/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/minimum-substring-cover-problem/swizec/3406</feedburner:origLink></item>
		<item>
		<title>The No brown M&amp;M’s rule</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/nTeOYxvkxqM/3390</link>
		<comments>http://swizec.com/blog/the-no-brown-mms-rule/swizec/3390#comments</comments>
		<pubDate>Tue, 10 Jan 2012 15:44:07 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[Insanity]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Revision control]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Van Halen]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3390</guid>
		<description><![CDATA[There once was a band, let&#8217;s call them Van Halen, who had a very long and complex contract for venues. Partly because they were famous and venues would do anything to get them, partly because people could literally die. The contract was full of useful things like &#8220;The floor should support such and such weight&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>There once was a band, let&#8217;s call them <a class="zem_slink" title="Van Halen" href="http://www.van-halen.com" rel="homepage">Van Halen</a>, who had a very long and complex contract for venues. Partly because they were famous and venues would do anything to get them, partly because people could literally die.</p>
<div class="wp-caption alignright" style="width: 310px"><a href="http://commons.wikipedia.org/wiki/File:Van_Halen_-_Jump_2007-11-10.jpg"><img class="zemanta-img-inserted zemanta-img-configured" title="Van Halen performs their song &quot;Jump&quot;..." src="http://swizec.com/blog/wp-content/uploads/2012/01/300px-Van_Halen_-_Jump_2007-11-102.jpg" alt="Van Halen performs their song &quot;Jump&quot;..." width="300" height="225" /></a><p class="wp-caption-text">Image via Wikipedia</p></div>
<div class="mceTemp"></div>
<p>The contract was full of useful things like &#8220;The floor should support such and such weight&#8221; and &#8220;We need power outlets there and there and there [or our guitars won't work and you'll have a shitty show]&#8221;</p>
<p>In the middle of nowhere was a demand for <em>a bowl of M&amp;M&#8217;s backstage, without any brown pieces</em>.</p>
<p>An outlandish request, by flamboyant rockstars stretching their decadence? Not really, just a very good way to make sure the contract was followed to the letter and, you know, they&#8217;d survive the show. Find a brown piece &#8211; go check over the whole production. You <em>will</em> find something wrong.</p>
<p>With the current startup climate developers are the modern rockstars. We may not get all the groupies and we may be quite well behaved for the most part &#8211; but it&#8217;s time we started making fun outlandish requests don&#8217;t you think?</p>
<p>Designers are usually seen as the extravagant bit of the startup world, getting all the cool toys, working from rooms filled with inspiration and mojo &#8230; developers concern themselves much less with these things &#8211; give us a good set of monitors, free reign on our computer, some peace and quiet and we&#8217;ll be happy.</p>
<p>But when there are so many opportunities out there, you need a brown M&amp;M so you don&#8217;t end up wasting even a day at a company that doesn&#8217;t quite live up to expectations.</p>
<p>For me, the brown M&amp;M is <a class="zem_slink" title="Revision control" href="http://en.wikipedia.org/wiki/Revision_control" rel="wikipedia">version control</a>.</p>
<p>If a company isn&#8217;t using git or mercurial, I can be pretty certain there will be other problems as well. Everything from a shoddy codebase, to expecting my physical presence before my brain has had a chance to boot in the morning.</p>
<p>Usually the use of old-ish tools also correlates with a corporate feel to the company, which goes directly against <a href="http://swizec.com/blog/why-i-only-work-with-startups/swizec/2936">my rule of only working with [small] startups</a>. Plus it usually means I won&#8217;t be given freedom in choosing the best technology stack for the job, but will have something mandated from above.</p>
<p>I could probably go on, but you can imagine the rest. Use of <a class="zem_slink" title="Apache Subversion" href="http://subversion.apache.org/" rel="homepage">SVN</a> or, god forbid, nothing, is a deal breaker for me and it&#8217;s the symptom I can discover very early in the process &#8230; haven&#8217;t gone so far as putting it in the contract yet.</p>
<p>Do you use a brown M&amp;M technique to assess potential clients?</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://www.fourhourworkweek.com/blog/2012/01/01/no-brown-mms-david-lee-roth-and-the-power-of-checklists/">No Brown M&amp;M&#8217;s! David Lee Roth and the Power of Checklists</a> (fourhourworkweek.com)</li>
<li class="zemanta-article-ul-li"><a href="http://r.zemanta.com/?u=http%3A//www.guardian.co.uk/music/musicblog/2012/jan/04/valen-halen-david-lee-roth&amp;a=69445001&amp;rid=b1fa680b-accb-4c9c-9a28-6e4812ae6347&amp;e=f775e713b9d76aa8a86b40cca9fd4251">A classic interview with Van Halen</a> (guardian.co.uk)</li>
<li class="zemanta-article-ul-li"><a href="http://www.noisecreep.com/2011/11/30/van-halens-brown-M-Ms-rider-demand/">Van Halen&#8217;s &#8216;No Brown M&amp;Ms&#8217; Rider Demand Explained by Promoter</a> (noisecreep.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=b1fa680b-accb-4c9c-9a28-6e4812ae6347" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/nTeOYxvkxqM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/the-no-brown-mms-rule/swizec/3390/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/the-no-brown-mms-rule/swizec/3390</feedburner:origLink></item>
		<item>
		<title>Collatz, Haskell and Memoization</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/8glxtTMjPGQ/3382</link>
		<comments>http://swizec.com/blog/collatz-haskell-and-memoization/swizec/3382#comments</comments>
		<pubDate>Mon, 09 Jan 2012 11:43:22 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[A tech a day]]></category>
		<category><![CDATA[collatzconjecture]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[Languages]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[Memoization]]></category>
		<category><![CDATA[Number Theory]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Project Euler]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3382</guid>
		<description><![CDATA[After an awesome longboarding session yesterday afternoon I decided to play around with infinite sequences in Haskell &#8211; it&#8217;s supposed to be one of the more (most?) powerful features of Haskell &#8211; because it&#8217;s a lazy language apparently. My first impulse of creating a primes generator was nipped in the bud by a long page [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignright" style="width: 321px"><a href="http://xkcd.com/710/"><img title="xkcd collatz conjecture" src="http://swizec.com/blog/wp-content/uploads/2012/01/collatz_conjecture3.png" alt="xkcd collatz conjecture" width="311" height="452" /></a><p class="wp-caption-text">xkcd collatz conjecture</p></div>
<p>After an awesome <a class="zem_slink" title="Longboarding" href="http://en.wikipedia.org/wiki/Longboarding" rel="wikipedia">longboarding</a> session yesterday afternoon I decided to play around with <a class="zem_slink" title="Sequence" href="http://en.wikipedia.org/wiki/Sequence" rel="wikipedia">infinite sequences</a> in <a class="zem_slink" title="Haskell (programming language)" href="http://haskell.org" rel="homepage">Haskell</a> &#8211; it&#8217;s supposed to be one of the more (most?) powerful features of Haskell &#8211; because it&#8217;s a <a class="zem_slink" title="Evaluation strategy" href="http://en.wikipedia.org/wiki/Evaluation_strategy" rel="wikipedia">lazy language</a> apparently.</p>
<p>My first impulse of creating a primes generator was nipped in the bud by a long page of <a href="http://www.haskell.org/haskellwiki/Prime_numbers" target="_blank">prime number generators in Haskell</a>. Scary, complex, mindboggling.</p>
<p><a class="zem_slink" title="Project Euler" href="http://projecteuler.net/" rel="homepage">Project Euler</a> posed a much better challenge: <em>Which starting number, under one million, produces the longest collatz chain?</em></p>
<p>The solution I came up with was a simple brute force generator of infinitely many collatz sequences. Then I would take the first 1,000,000 find the maximum and that&#8217;s that.</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">collatz <span style="color: #339933; font-weight: bold;">::</span> <span style="color: #cccc00; font-weight: bold;">Integer</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: green;">&#91;</span><span style="color: #cccc00; font-weight: bold;">Integer</span><span style="color: green;">&#93;</span>
collatz <span style="color: red;">1</span> <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="color: green;">&#93;</span>
collatz n
    <span style="color: #339933; font-weight: bold;">|</span> <span style="font-weight: bold;">odd</span> n <span style="color: #339933; font-weight: bold;">=</span> <span style="color: red;">3</span><span style="color: #339933; font-weight: bold;">*</span>n<span style="color: #339933; font-weight: bold;">+</span><span style="color: red;">1</span>:collatz<span style="color: green;">&#40;</span><span style="color: red;">3</span><span style="color: #339933; font-weight: bold;">*</span>n<span style="color: #339933; font-weight: bold;">+</span><span style="color: red;">1</span><span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">|</span> <span style="font-weight: bold;">even</span> n <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">div</span> n <span style="color: red;">2</span>:collatz<span style="color: green;">&#40;</span><span style="font-weight: bold;">div</span> n <span style="color: red;">2</span><span style="color: green;">&#41;</span>
&nbsp;
chains <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span>collatz x <span style="color: #339933; font-weight: bold;">|</span> x <span style="color: #339933; font-weight: bold;">&lt;-</span> <span style="color: green;">&#91;</span><span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">..</span><span style="color: green;">&#93;</span><span style="color: green;">&#93;</span></pre></div></div>

<p>Didn&#8217;t help.</p>
<p>So I started looking for the maximum a bit differently &#8211; take all the sequences, sort them by length and take the last one.</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">longest <span style="font-weight: bold;">max</span> <span style="color: #339933; font-weight: bold;">=</span>
  <span style="font-weight: bold;">last</span> <span style="color: #339933; font-weight: bold;">$</span> sortBy <span style="color: green;">&#40;</span>comparing <span style="font-weight: bold;">snd</span><span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">zip</span> <span style="color: green;">&#91;</span><span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">..</span><span style="color: green;">&#93;</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">map</span> <span style="font-weight: bold;">length</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">take</span> <span style="font-weight: bold;">max</span> chains</pre></div></div>

<p>Great! It worked! But it takes ~26 seconds!</p>
<p>Well sorting maybe isn&#8217;t the best idea ever, so let&#8217;s try creating a list of sequences where the list&#8217;s tail only contains those sequences that are longer than the head. A sprinkle of dropWhile and it was done.</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">longest' <span style="color: green;">&#40;</span>max<span style="color: #339933; font-weight: bold;">_</span>i<span style="color: #339933; font-weight: bold;">,</span> max<span style="color: #339933; font-weight: bold;">_</span>l<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">=</span>
  <span style="color: #06c; font-weight: bold;">let</span> l <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">head</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">dropWhile</span> <span style="color: green;">&#40;</span>\<span style="color: green;">&#40;</span>i<span style="color: #339933; font-weight: bold;">,</span>l<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> l <span style="color: #339933; font-weight: bold;">&lt;=</span> max<span style="color: #339933; font-weight: bold;">_</span>l<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">zip</span> <span style="color: green;">&#91;</span>max<span style="color: #339933; font-weight: bold;">_</span>i<span style="color: #339933; font-weight: bold;">..</span><span style="color: green;">&#93;</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">map</span> <span style="font-weight: bold;">length</span> <span style="color: #339933; font-weight: bold;">$</span> chains' max<span style="color: #339933; font-weight: bold;">_</span>i
  <span style="color: #06c; font-weight: bold;">in</span> l:longest' l</pre></div></div>

<p>~25 seconds!</p>
<p>That&#8217;s odd &#8230; even odder still is running both algorithms one after another only takes 33 seconds. Huh?</p>
<p>It would seem I&#8217;m using <a class="zem_slink" title="Memoization" href="http://en.wikipedia.org/wiki/Memoization" rel="wikipedia">memoization</a> incorrectly. I&#8217;ve heard it performs funny in recursive functions. The theory I formulated last night was that because haskell was lazy each execution chain was constructed to its end and the intermittent memoized values never got used until the whole function was called again.</p>
<p>Looking at the code samples this morning, though, I discovered this:</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">collatz <span style="color: #339933; font-weight: bold;">::</span> <span style="color: #cccc00; font-weight: bold;">Integer</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: green;">&#91;</span><span style="color: #cccc00; font-weight: bold;">Integer</span><span style="color: green;">&#93;</span>
collatz <span style="color: #339933; font-weight: bold;">=</span> memoize col <span style="color: #06c; font-weight: bold;">where</span>
  col <span style="color: red;">1</span> <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="color: green;">&#93;</span>
  col n
    <span style="color: #339933; font-weight: bold;">|</span> <span style="font-weight: bold;">odd</span> n <span style="color: #339933; font-weight: bold;">=</span> <span style="color: red;">3</span><span style="color: #339933; font-weight: bold;">*</span>n<span style="color: #339933; font-weight: bold;">+</span><span style="color: red;">1</span>:collatz<span style="color: green;">&#40;</span><span style="color: red;">3</span><span style="color: #339933; font-weight: bold;">*</span>n<span style="color: #339933; font-weight: bold;">+</span><span style="color: red;">1</span><span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">|</span> <span style="font-weight: bold;">even</span> n <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">div</span> n <span style="color: red;">2</span>:collatz<span style="color: green;">&#40;</span><span style="font-weight: bold;">div</span> n <span style="color: red;">2</span><span style="color: green;">&#41;</span></pre></div></div>

<p>As you can see, I don&#8217;t call the memoized function internally. Just goes to show what a night&#8217;s sleep can do to one&#8217;s coding abilities. I bashed my head against this problem for four hours yesterday and I never noticed I was recursing to the wrong function!</p>
<p>Interestingly enough, fixing that makes the algorithm spaz out and die after 16 seconds. The only output I get is &#8220;Killed&#8221;. Curious.</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://mrhonner.com/2011/11/18/graphing-the-collatz-conjecture/">Graphing the Collatz Conjecture</a> (mrhonner.com)</li>
<li class="zemanta-article-ul-li"><a href="http://existentialtype.wordpress.com/2011/04/24/the-real-point-of-laziness/">The Point of Laziness in Programing Languages</a> (existentialtype.wordpress.com)</li>
<li class="zemanta-article-ul-li"><a href="http://swizec.com/blog/learning-me-a-haskell/swizec/3272">Learning me a Haskell</a> (swizec.com)</li>
<li class="zemanta-article-ul-li"><a href="http://geeklogs.posterous.com/what-is-memoization">Memoization explained using a python implementation of fibonacci</a> (geeklogs.posterous.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=6f7c0838-57e3-4b8a-a0c3-3ef0dc670559" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/8glxtTMjPGQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/collatz-haskell-and-memoization/swizec/3382/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/collatz-haskell-and-memoization/swizec/3382</feedburner:origLink></item>
		<item>
		<title>A message from your future self</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/gGDZg77ZRT8/3377</link>
		<comments>http://swizec.com/blog/a-message-from-your-future-self/swizec/3377#comments</comments>
		<pubDate>Fri, 06 Jan 2012 12:00:02 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[A tech a day]]></category>
		<category><![CDATA[Functional programming]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[Implementations]]></category>
		<category><![CDATA[Moving average]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3377</guid>
		<description><![CDATA[About two weeks ago I watched a TED talk on the battle between one&#8217;s present and future self. The idea being that a lot of our problems can be summed up to this: Your present self is here, he wants cool things, your future self is greatly affected by these decisions, but he can&#8217;t do [...]]]></description>
			<content:encoded><![CDATA[<p>About two weeks ago I watched a TED talk on the battle between one&#8217;s present and future self. The idea being that a lot of our problems can be summed up to this: Your present self is here, he wants cool things, your future self is greatly affected by these decisions, but he can&#8217;t do anything about it.</p>
<p><object width="526" height="374" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="wmode" value="transparent" /><param name="bgColor" value="#ffffff" /><param name="flashvars" value="vu=http://video.ted.com/talk/stream/2011S/Blank/DanielGoldstein_2011S-320k.mp4&amp;su=http://images.ted.com/images/ted/tedindex/embed-posters/DanielGoldstein_2011S-embed.jpg&amp;vw=512&amp;vh=288&amp;ap=0&amp;ti=1310&amp;lang=&amp;introDuration=15330&amp;adDuration=4000&amp;postAdDuration=830&amp;adKeys=talk=daniel_goldstein_the_battle_between_your_present_and_fu;year=2011;theme=how_the_mind_works;theme=what_makes_us_happy;event=TEDSalon+NY2011;tag=Behavioral+Economics;tag=Business;tag=Culture;tag=economics;tag=finance;tag=self;&amp;preAdTag=tconf.ted/embed;tile=1;sz=512x288;" /><param name="src" value="http://video.ted.com/assets/player/swf/EmbedPlayer.swf" /><param name="pluginspace" value="http://www.macromedia.com/go/getflashplayer" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><embed width="526" height="374" type="application/x-shockwave-flash" src="http://video.ted.com/assets/player/swf/EmbedPlayer.swf" allowFullScreen="true" allowScriptAccess="always" wmode="transparent" bgColor="#ffffff" flashvars="vu=http://video.ted.com/talk/stream/2011S/Blank/DanielGoldstein_2011S-320k.mp4&amp;su=http://images.ted.com/images/ted/tedindex/embed-posters/DanielGoldstein_2011S-embed.jpg&amp;vw=512&amp;vh=288&amp;ap=0&amp;ti=1310&amp;lang=&amp;introDuration=15330&amp;adDuration=4000&amp;postAdDuration=830&amp;adKeys=talk=daniel_goldstein_the_battle_between_your_present_and_fu;year=2011;theme=how_the_mind_works;theme=what_makes_us_happy;event=TEDSalon+NY2011;tag=Behavioral+Economics;tag=Business;tag=Culture;tag=economics;tag=finance;tag=self;&amp;preAdTag=tconf.ted/embed;tile=1;sz=512x288;" pluginspace="http://www.macromedia.com/go/getflashplayer" allowfullscreen="true" allowscriptaccess="always" /></object></p>
<p>Over the holidays I gave Future Swizec a voice. Every three days he sends me an email to tell me what sort of financial situation he will find himself in after two weeks of Present Swizec doing stupid shit. That&#8217;s not very far into the future, but it&#8217;s just enough to do something about it, while not being too far away to think <em>Meh, that&#8217;s in ten years, I&#8217;ll deal with it nine years from now.</em></p>
<p>If you want to give Future You this kind of voice have a look at my <a href="https://github.com/Swizec/Personal-Runway" target="_blank">Personal Runway project on github</a>. If you think this is a cool idea, but don&#8217;t want to set it up yourself &#8211; email me! I might just make this <a class="zem_slink" title="Proof of concept" href="http://en.wikipedia.org/wiki/Proof_of_concept" rel="wikipedia">proof of concept</a> into a minimum viable product if there is any interest <img src='http://swizec.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I first ran it when I had just finished paying all my bills, which was a huge expense, so Future Swizec sent me this email:</p>
<div id="attachment_3379" class="wp-caption alignnone" style="width: 587px"><a href="http://swizec.com/blog/wp-content/uploads/2012/01/Selection_047.png"><img class="wp-image-3379 " title="Future Swizec" src="http://swizec.com/blog/wp-content/uploads/2012/01/Selection_047.png" alt="Future Swizec" width="577" height="302" /></a><p class="wp-caption-text">Future Swizec</p></div>
<p>Maybe he should be less happy about only having 5euro, but right now he&#8217;s super every time his balance isn&#8217;t negative. Perhaps Future Swizec needs a gray area.</p>
<h2>How it works</h2>
<p>Right now the predictions are somewhat rudimentary, for instance I don&#8217;t take into account the fact money doesn&#8217;t magically show up in my account after every billable hour. Another thing not taken into account are periodic expenses, super large spikes also throw it off somewhat.</p>
<p>The basic idea is this:</p>
<ol>
<li>Smooth out the data with a <a class="zem_slink" title="Moving average" href="http://en.wikipedia.org/wiki/Moving_average" rel="wikipedia">rolling average</a> to get a curve</li>
<li>Calculate an <a class="zem_slink" title="Expected value" href="http://en.wikipedia.org/wiki/Expected_value" rel="wikipedia">expected value</a> for the next day after known data</li>
<li>Expand the window for expected value by two (one into the future, one into the past) and calculate the next expected value</li>
</ol>
<p>Weights are calculated according to the simplest <a class="zem_slink" title="Series (mathematics)" href="http://en.wikipedia.org/wiki/Series_%28mathematics%29" rel="wikipedia">infinite series</a> I could think of that always sums to one no matter how many elements are needed. But I also split it in half and shuffle it about at the pivot, so the strongest weight is moved back in the data when calculating days. So in a sense, when calculating the 1st unknown value, the last known has highest weight. Then the penultimate known and so forth.</p>
<p>The algorithm is pretty simple in <a class="zem_slink" title="Haskell (programming language)" href="http://haskell.org" rel="homepage">Haskell</a></p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">&nbsp;
<span style="color: #5d478b; font-style: italic;">-- ((n-i)*2)/((n-1)*n)</span>
weights <span style="color: #339933; font-weight: bold;">::</span> <span style="color: green;">&#40;</span><span style="color: #cccc00; font-weight: bold;">Num</span> b<span style="color: #339933; font-weight: bold;">,</span> <span style="color: #cccc00; font-weight: bold;">Fractional</span> b<span style="color: #339933; font-weight: bold;">,</span> <span style="color: #cccc00; font-weight: bold;">Enum</span> b<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">=&gt;</span> b <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: green;">&#91;</span>b<span style="color: green;">&#93;</span>
weights n <span style="color: #339933; font-weight: bold;">=</span>
  <span style="font-weight: bold;">map</span> <span style="color: green;">&#40;</span>\i <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>n<span style="color: #339933; font-weight: bold;">-</span>i<span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">*</span><span style="color: red;">2</span><span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">/</span><span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>n<span style="color: #339933; font-weight: bold;">-</span><span style="color: red;">1</span><span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">*</span>n<span style="color: green;">&#41;</span><span style="color: green;">&#41;</span> <span style="color: green;">&#91;</span><span style="color: red;">1.0</span><span style="color: #339933; font-weight: bold;">..</span>n<span style="color: green;">&#93;</span>
&nbsp;
rotate <span style="color: #339933; font-weight: bold;">::</span> <span style="color: #cccc00; font-weight: bold;">Int</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: green;">&#91;</span>a<span style="color: green;">&#93;</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: green;">&#91;</span>a<span style="color: green;">&#93;</span>
rotate n l <span style="color: #339933; font-weight: bold;">=</span> t<span style="color: #339933; font-weight: bold;">++</span>h
  <span style="color: #06c; font-weight: bold;">where</span> <span style="color: green;">&#40;</span>h<span style="color: #339933; font-weight: bold;">,</span>t<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">splitAt</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span><span style="font-weight: bold;">length</span> l<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">-</span> n<span style="color: green;">&#41;</span> l
&nbsp;
expected <span style="color: #339933; font-weight: bold;">::</span> <span style="color: green;">&#40;</span><span style="color: #cccc00; font-weight: bold;">Fractional</span> a<span style="color: #339933; font-weight: bold;">,</span> <span style="color: #cccc00; font-weight: bold;">Enum</span> a<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">=&gt;</span> <span style="color: #cccc00; font-weight: bold;">Int</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: green;">&#91;</span>a<span style="color: green;">&#93;</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> a
expected pivot xs <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">sum</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">map</span> <span style="color: green;">&#40;</span>\<span style="color: green;">&#40;</span>w<span style="color: #339933; font-weight: bold;">,</span>v<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> w<span style="color: #339933; font-weight: bold;">*</span>v<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">zip</span> <span style="color: green;">&#40;</span>rotate pivot <span style="color: green;">&#40;</span>weights <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">fromIntegral</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">length</span> xs<span style="color: green;">&#41;</span><span style="color: green;">&#41;</span> xs</pre></div></div>

<p>Of course someone who actually knows Haskell would write it much better.</p>
<p>And there you have it, a simple way to talk with Future Swizec. There is still some tweaking to do and hopefully I can find more people to run this on and see how it works out for them as well.</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://www.roadrunnerrecords.com/blabbermouth.net/news.aspx?mode=Article&amp;newsitemID=167732">DEVIN TOWNSEND: &#8216;I&#8217;m More On Autopilot Than Ever Before Now&#8217;</a> (roadrunnerrecords.com)</li>
<li class="zemanta-article-ul-li"><a href="http://swizec.com/blog/sabbatical-week-day-3-raining-datatypes/swizec/3293">Sabbatical week day 3: Raining datatypes</a> (swizec.com)</li>
<li class="zemanta-article-ul-li"><a href="http://news.ycombinator.com/item?id=3428195">Ask HN: What&#8217;s your experience with remote working? as employees/employers?</a> (news.ycombinator.com)</li>
<li class="zemanta-article-ul-li"><a href="http://swizec.com/blog/making-a-mobius-cake/ponywithhiccups/2737">Making a Möbius cake</a> (swizec.com)</li>
<li class="zemanta-article-ul-li"><a href="http://stackoverflow.com/questions/8664411/haskell-the-last-statement-in-a-do-construct-must-be-an-expression">Haskell : &#8220;The last statement in a &#8216;do&#8217; construct must be an expression&#8221;</a> (stackoverflow.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=44227b78-3df1-44c8-9c91-6dde805ece94" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/gGDZg77ZRT8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/a-message-from-your-future-self/swizec/3377/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/a-message-from-your-future-self/swizec/3377</feedburner:origLink></item>
		<item>
		<title>Programmers are born not made</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/PwqoR8i5taA/3369</link>
		<comments>http://swizec.com/blog/programmers-are-born-not-made/swizec/3369#comments</comments>
		<pubDate>Thu, 05 Jan 2012 15:51:38 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[Insanity]]></category>
		<category><![CDATA[Opinion]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3369</guid>
		<description><![CDATA[Programmers are a special breed, good programmers especially &#8211; our craft is more an art than we like to admit when trying to wrestle it into a Hard Engineering Discipline &#8482;. It&#8217;s actually more like mathematics, music or the wizardry Kaylee does in Firefly. Good programmers have a special feel, a talent that is difficult [...]]]></description>
			<content:encoded><![CDATA[<p>Programmers are a special breed, <em>good</em> <a class="zem_slink" title="Programmer" href="http://en.wikipedia.org/wiki/Programmer" rel="wikipedia">programmers</a> especially &#8211; our craft is more an art than we like to admit when trying to wrestle it into a Hard Engineering Discipline &#8482;. It&#8217;s actually more like mathematics, music or the wizardry Kaylee does in <a class="zem_slink" title="Firefly (TV series)" href="http://en.wikipedia.org/wiki/Firefly_%28TV_series%29" rel="wikipedia">Firefly</a>.</p>
<div class="wp-caption alignright" style="width: 230px"><a href="http://en.wikipedia.org/wiki/File:Passion_cover.jpg"><img class="zemanta-img-inserted zemanta-img-configured" title="Passion (novel)" src="http://swizec.com/blog/wp-content/uploads/2012/01/Passion_cover3.jpg" alt="Passion (novel)" width="220" height="333" /></a><p class="wp-caption-text">Image via Wikipedia</p></div>
<p>Good programmers have a special feel, a talent that is difficult to explain and even harder to attain.</p>
<p>A few weeks ago <a href="https://twitter.com/#!/zidarsk8" target="_blank">@zidarsk8</a> came rushing to me <em>&#8220;Dude! There&#8217;s this guy! I&#8217;ve been teaching him coding! He&#8217;s already better than me! Hasn&#8217;t even heard of a variable before a month ago! It&#8217;s so frikkin&#8217; awesome!&#8221;</em></p>
<p>He made me promise to blog about it. Why is it some people just <em>get</em> it? What&#8217;s so special about them? Can anybody be taught to program or does it really take a special breed to become even a competent programmer, let alone a good one?</p>
<p>I remember tutoring a high school kid about a year ago. About to fail his <a class="zem_slink" title="Computer programming" href="http://en.wikipedia.org/wiki/Computer_programming" rel="wikipedia">programming</a> class (CE high school, we have those), he came running to me. In a month I was to teach him everything I know, or at least enough to pass the class.</p>
<p>Come end of the month and he knew everything about loops, variable assignment, even understood that functions are packets of code that can do stuff. My parting words to his father were <em>&#8220;Yeah, he knows everything. Just needs a bit of practice to get it.&#8221;</em></p>
<p>I doubt he ever passed the class. Or if he did it was the teacher&#8217;s mercy &#8230; and that teacher isn&#8217;t very merciful from what I remember of her in my high school times.</p>
<div class="mceTemp"></div>
<p>But this isn&#8217;t just because I&#8217;m a bad teacher &#8211; others came to me after that one kid on his recommendation and I got a <em>&#8220;Thank you! I bloody passed! yay!&#8221;</em> email from all of them &#8211; there are people who simply aren&#8217;t programmers. Never <em>will</em> be programmers. Not even mediocre ones.</p>
<h2>The non-programming sheep</h2>
<p><a class="zem_slink" title="Jeff Atwood" href="http://www.codinghorror.com/" rel="homepage">Jeff Atwood</a> wrote about <em><a href="http://www.codinghorror.com/blog/2006/07/separating-programming-sheep-from-non-programming-goats.html" target="_blank">Separating Programming Sheep from Non-Programming Goats</a></em>in 2006 where he mentions a study that claims to have found a test to predict future programming ability.</p>
<div class="mceTemp"></div>
<p>The test is really simple:</p>
<pre>a = 5
b = 20
a = b

What are a and be now?</pre>
<p>And some more questions like that. Only <strong>44%</strong> of the students formed a consistent <a class="zem_slink" title="Mental model" href="http://en.wikipedia.org/wiki/Mental_model" rel="wikipedia">mental model</a> of assignment &#8211; even a wrong one. The rest failed or didn&#8217;t answer the questions.</p>
<p>Worse still, after a semester of learning to program, the numbers were the same. Only 44% of the students understood how assignment works.</p>
<p>Some people just dont <em>get</em> it. Apparently.</p>
<p>But I think there&#8217;s an even simpler test -&gt;</p>
<h2>Passion.</h2>
<div class="wp-caption alignleft" style="width: 310px"><a href="http://commons.wikipedia.org/wiki/File:Sheep.jpg"><img class="zemanta-img-inserted zemanta-img-configured" title="Sheep" src="http://swizec.com/blog/wp-content/uploads/2012/01/300px-Sheep1.jpg" alt="Sheep" width="300" height="233" /></a><p class="wp-caption-text">Image via Wikipedia</p></div>
<p>Sometimes when you give an impressionable young mind (anybody deciding to learn to code, age is irrelevant) two tools and a problem, they will use the two tools to create four more tools. Then they will get on the internets and find some more tools &#8230; soon they have twenty tools and what was the problem you wanted me to solve again?</p>
<p>That&#8217;s passion!</p>
<p>Pure unadulterated passion for programming. When you can be fascinated, even excited, about this stuff without a need to solve a problem. Hell, even if you <em>are</em> solving a problem that you know is a meaningless exercise &#8230; that&#8217;s where greatness lies.</p>
<p>It doesn&#8217;t matter what age you started coding at &#8211; many studies have shown experience is not a predictor of quality in our world &#8211; what matters is that you have a passion for this stuff.</p>
<p>Because if you&#8217;ve got the passion, then you probably have everything else you need as well.</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://swizec.com/blog/programmers-are-fucking-lazy/swizec/2648">Programmers are fucking lazy</a> (swizec.com)</li>
<li class="zemanta-article-ul-li"><a href="http://bob-roberts.net/2012/01/01/becoming-a-better-developer/">Becoming a better Developer</a> (bob-roberts.net)</li>
<li class="zemanta-article-ul-li"><a href="http://jaredcosulich.wordpress.com/2011/12/11/programmer-the-best-profession/">Programmer &#8211; The Best Professsion?</a> (jaredcosulich.wordpress.com)</li>
<li class="zemanta-article-ul-li"><a href="http://bob-roberts.net/2011/11/06/whats-in-a-name-programmer-or-developer/">What&#8217;s in a name? Programmer or Developer</a> (bob-roberts.net)</li>
<li class="zemanta-article-ul-li"><a href="http://news.ycombinator.com/item?id=3032943">Today a programmer was born. And you are my mother.</a> (news.ycombinator.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=8bbc9c9d-90c1-4e04-9492-66f28a485b8b" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/PwqoR8i5taA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/programmers-are-born-not-made/swizec/3369/feed</wfw:commentRss>
		<slash:comments>14</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/programmers-are-born-not-made/swizec/3369</feedburner:origLink></item>
		<item>
		<title>Deca – a cool systems programming language</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/9qumcM_x90E/3323</link>
		<comments>http://swizec.com/blog/deca-a-cool-systems-programming-language/swizec/3323#comments</comments>
		<pubDate>Wed, 04 Jan 2012 19:36:39 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[Science Wednesday]]></category>
		<category><![CDATA[Bjarne Stroustrup]]></category>
		<category><![CDATA[Deca]]></category>
		<category><![CDATA[Eli Gottlieb]]></category>
		<category><![CDATA[High-level programming language]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Object-oriented programming]]></category>
		<category><![CDATA[Pointer (computing)]]></category>
		<category><![CDATA[Type system]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3323</guid>
		<description><![CDATA[This post is a summary of  Eli Gottlieb&#8217;s thesis on the Deca programming language from May 2011. In short Deca is a language designed to provide the advanced features of sophisticated, high-level programming languageswhile still programming as close as possible to the bare metal. It brings in the functional, object-oriented and generic programming paradigms without requiring [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignright" style="width: 202px"><a href="http://www.flickr.com/photos/28486074@N08/4972036859"><img class="zemanta-img-inserted zemanta-img-configured" title="DeCA partners with military to help promote su..." src="http://swizec.com/blog/wp-content/uploads/2012/01/4972036859_feeca3b936_m8.jpg" alt="DeCA partners with military to help promote su..." width="192" height="240" /></a><p class="wp-caption-text">Image by Morning Calm News via Flickr</p></div>
<p>This post is a summary of  Eli Gottlieb&#8217;s thesis on the <a href="http://decac.googlecode.com/files/Deca%20Thesis.pdf">Deca programming language</a> from May 2011. In short <em>Deca is a language designed to provide the advanced features of sophisticated, <a class="zem_slink" title="High-level programming language" href="http://en.wikipedia.org/wiki/High-level_programming_language" rel="wikipedia">high-level programming languages</a>while still programming as close as possible to the bare metal. It brings in the functional, object-oriented and generic programming paradigms without requiring a garbage collector or a threading system.</em></p>
<blockquote><p>Since it is a programming-language thesis, it is also dedicated to every programmer who ever wanted a better language but could not use a virtual machine or a run-time library. To them I dedicate this thesis and say: <em>I am become type theory, destroyer of minds.</em></p></blockquote>
<h2>Problems of systems programming</h2>
<p>I once contemplated doing some Linux kernel hacking, but decided to lie down until the feeling passes. That is my closest brush with systems programming and after reading this thesis &#8211; yikes.</p>
<p>Essentially the problems are what you&#8217;d expect when dealing with hardware-imposed limitations, lacking useful abstractions and safety features &#8211; in fact, you&#8217;re usually the one creating these.</p>
<ol>
<li><strong>precise data representation</strong> - working so close to bare metal means datatypes must correspond directly to their hardware representations. You can&#8217;t just have a magical List datatype<em>,</em> you <em>can</em> have a block of memory though</li>
<li><strong>safety properties and confined unsafety </strong>- the most common form of safety is <em>
<div class="wp-caption alignleft" style="width: 310px"><a href="http://commons.wikipedia.org/wiki/File:Kernel-panic.jpg"><img class="zemanta-img-inserted zemanta-img-configured" title="English: Kernel panic Magyar: &quot;Kernel pan..." src="http://swizec.com/blog/wp-content/uploads/2012/01/300px-Kernel-panic6.jpg" alt="English: Kernel panic Magyar: &quot;Kernel pan..." width="300" height="200" /></a><p class="wp-caption-text">Panic</p></div>
<p><a class="zem_slink" title="Type safety" href="http://en.wikipedia.org/wiki/Type_safety" rel="wikipedia">type safety</a>, </em>the idea being that the compiler makes sure you aren&#8217;t trying to multiply a sack of potates with a banana. But other safety features a good language should provide according to Gottlieb are <em><a href="http://en.wikipedia.org/wiki/Escape_analysis" target="_blank">escape analysis</a></em> for pointers, <em><a class="zem_slink" title="Region-based memory management" href="http://en.wikipedia.org/wiki/Region-based_memory_management" rel="wikipedia">region-based memory management</a></em> and<em> <a href="http://en.wikipedia.org/wiki/Type_safety#Definitions" target="_blank">preservation and progress</a></em> (well-typedness)</li>
<li><strong>abstraction, encapsulation, modularity </strong>- most modern languages provide ways of packaging code so it can be reused and encapsulated. For instance: when you are using a stack structure, you don&#8217;t really care whether it&#8217;s implemented as a list or a memory vector.</li>
<li><strong>extensibility </strong>- a way to extend the language itself with new features (for example, making the + operator work with new data types). So far possible solutions for this exist as <a class="zem_slink" title="Object-oriented programming" href="http://en.wikipedia.org/wiki/Object-oriented_programming" rel="wikipedia">OOP</a>, ad-hoc polymorphism, macros and so on, but it remains an open question and the perfect solution might not even exist</li>
<li><strong>Stroustroup&#8217;s rule </strong>- the lead designer of C++ <a class="zem_slink" title="Bjarne Stroustrup" href="http://www.research.att.com/~bs/homepage.html" rel="homepage">Bjarne Stroustrup</a> once presented a rule that <em>What you don&#8217;t use, you don&#8217;t pay for.</em> But in many high-level languages automatic memory management runs whether you need it or not, or every function needs exception handling &#8230; all big problems in the limited confines of bare metal programming.</li>
</ol>
<h2>Deca&#8217;s solutions</h2>
<div class="wp-caption alignright" style="width: 310px"><a href="http://commons.wikipedia.org/wiki/File:Safety.JPG"><img class="zemanta-img-inserted zemanta-img-configured" title="English: Safety" src="http://swizec.com/blog/wp-content/uploads/2012/01/300px-Safety6.jpg" alt="English: Safety" width="300" height="450" /></a><p class="wp-caption-text">Image via Wikipedia</p></div>
<ol>
<li><strong>unboxed data types </strong>- for those of us who didn&#8217;t know, <a href="http://www.haskell.org/ghc/docs/latest/html/users_guide/primitives.html" target="_blank">boxed types</a> are represented by a point to an object; in Deca all types are compiled down to raw unboxed representations &#8211; just a value &#8211; so when the code is running there&#8217;s no more overhead. There are also two kinds of pointers (scoped and referenced) that allow you to use a pointer as if it was a variable, which sounds pretty cool from my experience with explicit pointers.</li>
<li><strong>type safety </strong>- admittedly, this section went a bit over my head, but Deca uses a magical combination of static type inference (static typing where the compiler guesses stuff for you) and bit-casting &#8211; this is a system that allows you to eschew type safety under certain conditions because systems programmers apparently need that. If you care for this sort of thing -&gt; Deca uses a modified <a class="zem_slink" title="Type inference" href="http://en.wikipedia.org/wiki/Type_inference" rel="wikipedia">Hindley-Milner</a> inference algorithm that also allows subtyping</li>
<li><strong>module system </strong>- just as you&#8217;d expect of any modern language, you can package things into modules and modules into modules</li>
<li><strong>encapsulated <a class="zem_slink" title="Type system" href="http://en.wikipedia.org/wiki/Type_system" rel="wikipedia">existential types</a> </strong>- these are best known as the type-theoretic encoding of abstract data types &#8211; giving us the ability to use data structures without knowing all the internal logic. In Deca these exist as a language extension and the whole thing works out just like it did for Caml</li>
<li><strong>extensible types </strong>- Deca provides two ways of extending data types. The internal way of &#8220;open-sum variant types&#8221;, which I don&#8217;t understand and the thesis isn&#8217;t very specific as to what thi means. The other are good old friendly classes, which we all understand and love from object-oriented languages</li>
<li><strong>symmetric multiple dispatch </strong>- dynamic dispatch is a way to dynamically decide which method to call in order to process a particular message (polymorphism, pattern matching etc.) Deca does this by having a partially ordered list of possible methods, walking through it and when it finds something that can execute the given arguments, it is the most specific binding.</li>
<li><strong>low-level encodings of high-level features </strong>- this section of the thesis is a bit longer, but it essentially boils down to the idea of using the <a href="http://en.wikipedia.org/wiki/LLVM" target="_blank">LLVM</a> to run compiled code and making sure all the features explained above are compiled to their most basic incarnations. According to another section of the thesis this also ensures adherence to Stroustrup&#8217;s rule</li>
</ol>
<h2>An example</h2>
<p>I would love to personally produce an example of what Deca looks like, but I&#8217;m already having enough <a title="Learning me a Haskell" href="http://swizec.com/blog/learning-me-a-haskell/swizec/3272">fun learning Haskell</a>, so here&#8217;s an official example of a List implementation.</p>

<div class="wp_syntax"><div class="code"><pre class="deca" style="font-family:monospace;">&nbsp;
module list
&nbsp;
import malloc
&nbsp;
type List&lt;a&gt; = class(e,n) extends Sequence&lt;a&gt; {
  element: a:= e;
  next: @List:= n;
}
&nbsp;
function cons(element,next) {
  malloc.malloc(pool =&gt; new(pool)(List(element,next)))
}
&nbsp;
function car(lst: @List) {
  match *lst {
    case Cons(head,tail) =&gt; Some(head)
    case Nil =&gt; None
  }
}
&nbsp;
function cdr(lst: @List) {
  match *lst {
    case Cons(head,tail) =&gt; tail
    case Nil =&gt; Nil
  }
}
&nbsp;
end</pre></div></div>

<h2>Conclusion</h2>
<p>The thesis itself also compares Deca to other modern high-level languages for systems programming like <a href="http://lambda-the-ultimate.org/node/4023" target="_blank">Clay</a>, <a class="zem_slink" title="BitC" href="http://www.bitc-lang.org/" rel="homepage">BitC</a>, <a href="http://en.wikipedia.org/wiki/Cyclone_programming_language" target="_blank">Cyclone</a> and Java &#8220;with magic&#8221;. That section didn&#8217;t feel too important, the resolution is simply that Deca is <em>better</em>.</p>
<p>Unfortunately though, Deca itself doesn&#8217;t look to be ready for real-world use just yet. Even though the language itself is pretty much defined and its grammar is known, no complete compiler yet exists. The <a href="http://code.google.com/p/decac/" target="_blank">official compiler, decac,</a> developed by Gottlieb doesn&#8217;t yet support all the features and I&#8217;ve heard rumors it has been scrapped and is being developed anew because some fundamental issues were discovered.</p>
<p>All in all, this looks like an interesting language to keep an eye on if you&#8217;re a systems programmer, but I feel C will be the king for a long while yet.</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://americannationnews.wordpress.com/2012/01/02/are-you-a-programming-freek/">Are you a programming freek?</a> (americannationnews.wordpress.com)</li>
<li class="zemanta-article-ul-li"><a href="http://wiki.answers.com/Q/What_is_meant_by_high_level_language_in_IT">What is meant by high level language in IT</a> (wiki.answers.com)</li>
<li class="zemanta-article-ul-li"><a href="http://stackoverflow.com/questions/8697033/is-it-possible-to-make-a-high-level-compiled-language">Is it possible to make a high level compiled language?</a> (stackoverflow.com)</li>
<li class="zemanta-article-ul-li"><a href="http://wiki.answers.com/Q/What_are_different_application_areas_of_programming_language">What are different application areas of programming language</a> (wiki.answers.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=da758ab3-ef49-445c-82e5-d0740a42b9a2" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/9qumcM_x90E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/deca-a-cool-systems-programming-language/swizec/3323/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/deca-a-cool-systems-programming-language/swizec/3323</feedburner:origLink></item>
		<item>
		<title>Stypi – the perfect blogging tool</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/1_R2wUP_eUQ/3312</link>
		<comments>http://swizec.com/blog/stypi-the-perfect-blogging-tool/swizec/3312#comments</comments>
		<pubDate>Tue, 03 Jan 2012 15:29:56 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[A startup a week]]></category>
		<category><![CDATA[Review]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Google Wave]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MacOS]]></category>
		<category><![CDATA[Paul Graham]]></category>
		<category><![CDATA[Stypi]]></category>
		<category><![CDATA[Y Combinator]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3312</guid>
		<description><![CDATA[Stypi is a collaborative text editing tool that came out of YCombinator a couple months ago. It&#8217;s supposed to be filling a blank left behind Etherpad when it chewed up by Google and spat out as Wave. Though I&#8217;ve never used Etherpad and have only seen Piratepad once or twice I&#8217;ve come to rely on [...]]]></description>
			<content:encoded><![CDATA[<p>Stypi is a collaborative text editing tool that came out of <a class="zem_slink" title="Y Combinator" href="http://www.ycombinator.com" rel="homepage">YCombinator</a> a couple months ago. It&#8217;s supposed to be filling a blank left behind <a class="zem_slink" title="Etherpad test" href="http://etherpad.com/" rel="homepage">Etherpad</a> when it chewed up by Google and spat out as <a class="zem_slink" title="Google Wave" href="http://wave.google.com/" rel="homepage">Wave</a>.</p>
<div id="attachment_3320" class="wp-caption alignright" style="width: 310px"><a href="http://swizec.com/blog/wp-content/uploads/2012/01/Screen-Shot-2012-01-03-at-4.25.36-PM.png"><img class="size-medium wp-image-3320" title="This post in Stypi" src="http://swizec.com/blog/wp-content/uploads/2012/01/Screen-Shot-2012-01-03-at-4.25.36-PM-300x214.png" alt="This post in Stypi" width="300" height="214" /></a><p class="wp-caption-text">This post in Stypi</p></div>
<p>Though I&#8217;ve never used Etherpad and have only seen <a class="zem_slink" title="PiratePad" href="http://piratepad.net/" rel="homepage">Piratepad</a> once or twice I&#8217;ve come to rely on Stypi to produce blogposts.</p>
<p>The first time I saw Stypi in action was when <a class="zem_slink" title="Paul Graham (computer programmer)" href="http://paulgraham.com" rel="homepage">Paul Graham</a> posted a &#8220;Watch me write&#8221; on hackernews. It was a fascinating look into the way he writes because through Stypi&#8217;s magic we got to watch a playback of one of his essays coming together.</p>
<p>I remember being amazed by how often he typos not words, but whole paragraphs and started wondering how often I do something similar &#8211; off to Stypi! Been looking for a way to stop using WordPress for content creation for a while anyway.</p>
<p>At first I watched playbacks of my writing, but soon realised this was about as fun as watching a replay of your rally game &#8211; takes just as long, is super passive and kind of boring &#8230; except in Stypi there aren&#8217;t even any spectacular crashes!</p>
<p>However, I&#8217;ve come to love Stypi for a different reason &#8211; it&#8217;s the cleanest, most lightweight way to write. Nothing but me and my text.</p>
<p>&#8230; and anybody who guesses the url I&#8217;m writing at &#8230; One of the main selling points is collaborative editing, but I like to be alone when I write. Sorry Stypi <img src='http://swizec.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Another big selling point for me is that it works _everywhere_. The only contender so far has been iA Writer, but that only works on <a class="zem_slink" title="Mac OS" href="http://www.apple.com/macosx/" rel="homepage">MacOS</a> and costs money. But I really enjoy writing on my <a class="zem_slink" title="Linux" href="http://www.kernel.org/" rel="homepage">Linux box</a> as well.</p>
<p>All in all it&#8217;s the perfect drafting tool that really encourages good drafting and rewriting principles. Especially because my better posts take about two or three rewrites before they&#8217;re good enough.</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://venturebeat.com/2011/09/26/stypi/">Stypi founders have a plan to reinvent Google Wave (video)</a> (venturebeat.com)</li>
<li class="zemanta-article-ul-li"><a href="http://radar.oreilly.com/2011/11/four-short-links-10-november-2-2.html">Four short links: 10 November 2011</a> (radar.oreilly.com)</li>
<li class="zemanta-article-ul-li"><a href="http://techcrunch.com/2011/08/23/y-combinator-demo-day-the-ultimate-roundup/">Y Combinator Demo Day (S11): The Ultimate Roundup</a> (techcrunch.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.businessinsider.com/y-combinator-unveils-its-biggest-ever-batch-of-startups-63-companies-2011-8">Silicon Alley Insider: Y Combinator Unveils Its Biggest-Ever Batch Of Startups: 63 Companies</a> (businessinsider.com)</li>
<li class="zemanta-article-ul-li"><a href="http://emkaytsg.wordpress.com/2011/10/30/cool-tools/">Cool Tools</a> (emkaytsg.wordpress.com)</li>
<li class="zemanta-article-ul-li"><a href="http://etherpad.org/2011/12/06/etherpad-international-hackathon-2012/">Etherpad hackathon announced for early 2012</a> (etherpad.org)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=b930305a-c73b-4500-9936-c43925223b20" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/1_R2wUP_eUQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/stypi-the-perfect-blogging-tool/swizec/3312/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/stypi-the-perfect-blogging-tool/swizec/3312</feedburner:origLink></item>
		<item>
		<title>We take Carpe Diem too seriously</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/jU7XcsItmuQ/3304</link>
		<comments>http://swizec.com/blog/we-take-carpe-diem-too-seriously/swizec/3304#comments</comments>
		<pubDate>Mon, 02 Jan 2012 11:41:50 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[Insanity]]></category>
		<category><![CDATA[Inspiration]]></category>
		<category><![CDATA[Carpe Diem]]></category>
		<category><![CDATA[Daytum]]></category>
		<category><![CDATA[Holidays]]></category>
		<category><![CDATA[New Year]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3304</guid>
		<description><![CDATA[Yesterday I received the best gift ever &#8211; a day completely off. Free. What&#8217;s so special about a day off, you might think, I have like two every week! Or if you&#8217;re more like me, you&#8217;re thinking Psh! Dude, I get a day off almost every month. This was different &#8211; I had a day [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I received the best gift ever &#8211; a day completely off. Free.</p>
<div class="wp-caption alignright" style="width: 190px"><a href="http://www.flickr.com/photos/43661283@N00/4956218218"><img class="zemanta-img-inserted zemanta-img-configured" title="Carpe Diem" src="http://swizec.com/blog/wp-content/uploads/2012/01/4956218218_903039baa1_m2.jpg" alt="Carpe Diem" width="180" height="240" /></a><p class="wp-caption-text">Image by m.gifford via Flickr</p></div>
<p><em>What&#8217;s so special about a day off</em>, you might think, <em>I have like two every week!</em> Or if you&#8217;re more like me, you&#8217;re thinking <em>Psh! Dude, I get a day off almost every month.</em></p>
<p>This was different &#8211; I had a day off from <em>me</em>.</p>
<p>None of my little rituals. No exercise in the morning. Not a single cup of tea. No jotting down random-ish actions into <a class="zem_slink" title="Daytum" href="http://www.daytum.com/" rel="homepage">Daytum</a>. No tweeting. No instagraming. No marking down every bite into <a href="http://www.myfitnesspal.com/" target="_blank">myfitnesspal</a>. No time trackers. No email. Nothing.</p>
<p>Even wrote the <a href="http://750words.com/" target="_blank">750words</a> at almost midnight.</p>
<p>For a whole day I completely threw away every little thing I do day after day that doesn&#8217;t bring a rush of oxytocin there and then. Yes, I will continue doing all those things today, no, none of it is particularly useful, yes, they all tickle the nerd inside me.</p>
<p>I took one more step. I didn&#8217;t worry about the pile of email I&#8217;d return to. The day&#8217;s lull in my data, or the delay in stuff I&#8217;m working on.</p>
<p>A day like there&#8217;s no tomorrow! Carpe Diem is fine and all, but dear god we all take it so seriously. When did we collectively forget to <em>enjoy ourselves</em>? That Carpe Diem wasn&#8217;t [just] about working day and night to get the upper hand on your competition &#8230;</p>
<p>It felt great and against all expectations, my life is not a barren wasteland today.</p>
<p>I didn&#8217;t devolve into a fumbling beast, all my good [and bad] habits are still there. I&#8217;m still posting my daily blog. Still tweeting like mad. And still dutifully recording all the useless data about my life. I will even do some work despite Jan 2nd being a public holiday.</p>
<p>If you didn&#8217;t do anything even remotely like this yesterday &#8211; shame on you! You&#8217;re an even bigger nutcase than I am!</p>
<p>Give it a try tomorrow, I dare you.</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://hopenrecovery.wordpress.com/2011/12/30/carpe-diem-2012/">Carpé Diem 2012</a> (hopenrecovery.wordpress.com)</li>
<li class="zemanta-article-ul-li"><a href="http://stephenhilder.wordpress.com/2011/12/30/carpediem/">Carpe Diem</a> (stephenhilder.wordpress.com)</li>
<li class="zemanta-article-ul-li"><a href="http://rd2recovery.wordpress.com/2011/12/30/carpe-diem-2012/">Carpé Diem 2012</a> (rd2recovery.wordpress.com)</li>
<li class="zemanta-article-ul-li"><a href="http://jpshealthylivingblog.wordpress.com/2011/12/30/2012-goals/">2012 Goals</a> (jpshealthylivingblog.wordpress.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=3b8af50e-bc08-48b8-af2f-82f257294ca0" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/jU7XcsItmuQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/we-take-carpe-diem-too-seriously/swizec/3304/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/we-take-carpe-diem-too-seriously/swizec/3304</feedburner:origLink></item>
		<item>
		<title>Sabbatical week day 3: Raining datatypes</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/gjFr8Ay6AbI/3293</link>
		<comments>http://swizec.com/blog/sabbatical-week-day-3-raining-datatypes/swizec/3293#comments</comments>
		<pubDate>Thu, 29 Dec 2011 14:22:22 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[A tech a day]]></category>
		<category><![CDATA[sabbatical]]></category>
		<category><![CDATA[Artificial intelligence]]></category>
		<category><![CDATA[Data type]]></category>
		<category><![CDATA[Functional programming]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[Languages]]></category>
		<category><![CDATA[Machine learning]]></category>
		<category><![CDATA[Neural Networks]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3293</guid>
		<description><![CDATA[I’m taking a sabbatical week over the holidays. This week’s posts will serve as a sort of report of what I got up to the previous day instead of the usual schedule – wish me luck that I achieve even half of what I’d like to. As I sit here slowly sipping on my tea [...]]]></description>
			<content:encoded><![CDATA[<p><em>I’m taking a sabbatical week over the holidays. This week’s posts will serve as a sort of report of what I got up to the previous day instead of the usual schedule – wish me luck that I achieve even half of what I’d like to.</em></p>
<div class="wp-caption alignright" style="width: 242px"><a href="http://www.flickr.com/photos/13757887@N00/5479666205"><img class="zemanta-img-inserted zemanta-img-configured" title="Data Points" src="http://swizec.com/blog/wp-content/uploads/2011/12/5479666205_e74e748bf0_m3.jpg" alt="Data Points" width="232" height="240" /></a><p class="wp-caption-text">Image by Voxphoto via Flickr</p></div>
<p>As I sit here slowly sipping on my tea I realize it may have been an incredibly bad idea to stay up until 8am trying to convince <a class="zem_slink" title="Haskell (programming language)" href="http://haskell.org" rel="homepage">Haskell</a>that I really honestly don&#8217;t care about types as much as it seems to.</p>
<p>It&#8217;s really quite funny how weird a <a class="zem_slink" title="Type system" href="http://en.wikipedia.org/wiki/Type_system" rel="wikipedia">statically typed language</a> feels after many years of dynamic languages. <em>Yes, I know, this is a <a class="zem_slink" title="Number" href="http://en.wikipedia.org/wiki/Number" rel="wikipedia">Numerical</a> and that is a <a href="http://en.wikipedia.org/wiki/Floating_point" target="_blank">Double</a>, figure it the fuck out man! It&#8217;s not that difficult!</em> You&#8217;d think the hardest part about Haskell would be that it is incredibly strict about the <a class="zem_slink" title="Functional programming" href="http://en.wikipedia.org/wiki/Functional_programming" rel="wikipedia">functional programming</a> thing, but no, here I am, having trouble with the most basic of concepts.</p>
<p>But! I prevailed!</p>
<p>I had in my hands <a href="https://github.com/Swizec/Personal-Runway/blob/master/implementation/window.hs" target="_blank">a lovely algorithm</a> that can in theory perform rudimentary predictions of how my spending is going to behave in the next few days.  During my morning exercise I realized the implementation doesn&#8217;t actually do what I think it does, but hey, at least I have the algorithm figured out <img src='http://swizec.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The idea is really quite simple:</p>
<ol>
<li>Smoothen data with a <a class="zem_slink" title="Moving average" href="http://en.wikipedia.org/wiki/Moving_average" rel="wikipedia">rolling average</a> (a 7 day window seems to produce the nicest curve)</li>
<li>The first unknown <a class="zem_slink" title="Data point" href="http://en.wikipedia.org/wiki/Data_point" rel="wikipedia">data point</a> is simply the <a class="zem_slink" title="Expected value" href="http://en.wikipedia.org/wiki/Expected_value" rel="wikipedia">expected value</a> (weighed average) of the last few points</li>
<li>Expand weighed average window to include the new data point</li>
<li>Calculate next one</li>
<li>Repeat for as long as it makes sense &#8211; the more into the future you go, the more wrong you are</li>
</ol>
<p>After reading a bunch of papers on data mining time series yesterday I realized that I&#8217;m thinking way too much into this. Sure <a class="zem_slink" title="Support vector machine" href="http://en.wikipedia.org/wiki/Support_vector_machine" rel="wikipedia">SVM</a>&#8216;s are the best at predicting financial time series and people have extremely good results with backpropagation neural networks &#8211; somehow &#8211; but I honestly don&#8217;t need this complexity. I&#8217;m just making a simple tool for myself and it&#8217;s more important to have <em>some</em> result than the <em>optimal</em> result.</p>
<p>And either way, according to the papers a neural network is only marginally better than the <a class="zem_slink" title="Sliding window protocol" href="http://en.wikipedia.org/wiki/Sliding_window_protocol" rel="wikipedia">sliding window</a> approach, and even then only when you&#8217;re dealing with data when far-away points have a lot of impact on the future and/or there is a lot of repetition &#8211; none of which happens here.</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://www.tbray.org/ongoing/When/201x/2011/12/27/Type-Systems">Type-System Criteria</a> (tbray.org)</li>
<li class="zemanta-article-ul-li"><a href="http://swizec.com/blog/sabbatical-week-day-2-i-fail-at-octave/swizec/3282">Sabbatical week day 2: I fail at Octave</a> (swizec.com)</li>
<li class="zemanta-article-ul-li"><a href="http://swizec.com/blog/learning-me-a-haskell/swizec/3272">Learning me a Haskell</a> (swizec.com)</li>
<li class="zemanta-article-ul-li"><a href="http://ringingtrue.net/2011/12/27/non-sabbatical/">Non-Sabbatical</a> (ringingtrue.net)</li>
<li class="zemanta-article-ul-li"><a href="http://stackoverflow.com/questions/8178445/how-to-insert-a-file-to-an-image-datatype-in-sql-server-2005">How to insert a file to an Image datatype in sql2005</a> (stackoverflow.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=ce282cd2-9d04-4814-b93d-219c7e073a5d" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/gjFr8Ay6AbI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/sabbatical-week-day-3-raining-datatypes/swizec/3293/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/sabbatical-week-day-3-raining-datatypes/swizec/3293</feedburner:origLink></item>
		<item>
		<title>Sabbatical week day 2: I fail at Octave</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/agQQYKnaX8c/3282</link>
		<comments>http://swizec.com/blog/sabbatical-week-day-2-i-fail-at-octave/swizec/3282#comments</comments>
		<pubDate>Wed, 28 Dec 2011 13:09:16 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[A tech a day]]></category>
		<category><![CDATA[sabbatical]]></category>
		<category><![CDATA[Artificial intelligence]]></category>
		<category><![CDATA[GNU Octave]]></category>
		<category><![CDATA[Machine learning]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[MATLAB]]></category>
		<category><![CDATA[Matrix (mathematics)]]></category>
		<category><![CDATA[Octave]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3282</guid>
		<description><![CDATA[I’m taking a sabbatical week over the holidays. This week’s posts will serve as a sort of report of what I got up to the previous day instead of the usual schedule – wish me luck that I achieve even half of what I’d like to. After I managed to get the toggl and toshl [...]]]></description>
			<content:encoded><![CDATA[<p><em>I’m taking a sabbatical week over the holidays. This week’s posts will serve as a sort of report of what I got up to the previous day instead of the usual schedule – wish me luck that I achieve even half of what I’d like to.</em></p>
<div class="wp-caption alignright" style="width: 310px"><a href="http://commons.wikipedia.org/wiki/File:Programming_language_textbooks.jpg"><img class="zemanta-img-inserted zemanta-img-configured" title="English: A selection of programming language t..." src="http://swizec.com/blog/wp-content/uploads/2011/12/300px-Programming_language_textbooks1.jpg" alt="English: A selection of programming language t..." width="300" height="204" /></a><p class="wp-caption-text">Image via Wikipedia</p></div>
<p>After I managed to get the <a title="Sabbatical week day 1: Toshl and Toggl datasets" href="http://swizec.com/blog/sabbatical-week-day-1-toshl-and-toggl-datasets/swizec/3277">toggl and toshl datasets</a> on Monday it was time to do something useful with them yesterday. Turns out, I&#8217;m not very good at doing useful things with datasets because my biggest achievement of the day was coming up with a plot of the data.</p>
<p>You know that all awesome <a class="zem_slink" title="Data" href="http://en.wikipedia.org/wiki/Data" rel="wikipedia">data format</a> that is <a class="zem_slink" title="JSON" href="http://json.org" rel="homepage">JSON</a>? Every <a class="zem_slink" title="Programming language" href="http://en.wikipedia.org/wiki/Programming_language" rel="wikipedia">programming language</a> except Java has a nice and easy interface for loading and saving right into native <a class="zem_slink" title="Data structure" href="http://en.wikipedia.org/wiki/Data_structure" rel="wikipedia">data structures</a>. This makes it perfect and all &#8217;round awesome! So it seemed only natural that my node.js scripts for fetching data would be storing it in JSON for future use.</p>
<p>Or so I thought.</p>
<p>If there is one thing I learned in <a href="http://ml-class.com">ml-class</a> it&#8217;s that one should always take some time to first model their <a class="zem_slink" title="Machine learning" href="http://en.wikipedia.org/wiki/Machine_learning" rel="wikipedia">machine learning algorithm</a> in a mathematical language like matlab/octave before implementing in a production-like language. Something about how all those <a class="zem_slink" title="Matrix (mathematics)" href="http://en.wikipedia.org/wiki/Matrix_%28mathematics%29" rel="wikipedia">matrix operations</a> are easier and how having a language created especially for the task makes it all that easier to play around.</p>
<p>I guess octave is to machine learning as <a class="zem_slink" title="Adobe InDesign" href="http://www.adobe.com/products/indesign/main.html" rel="homepage">InDesign</a> or Illustrator are to web design?</p>
<p>Turns out not only doesn&#8217;t <a class="zem_slink" title="GNU Octave" href="http://www.gnu.org/software/octave/" rel="homepage">Octave</a> have a native way of reading JSON, but even when you find a library it is <em>impossible</em> to say <em>Here is a file, make it a string yo!</em> Just doesn&#8217;t work. All files need to have a format or something &#8230; it&#8217;s really quite silly.</p>
<p>Luckily there was a simple solution &#8211; just dump the data as a column of numbers and Octave couldn&#8217;t have been happier about it.</p>
<p>As mentioned, I didn&#8217;t get very far, this graph is the extent of my achievements yesterday:</p>
<div id="attachment_3283" class="wp-caption alignnone" style="width: 727px"><a href="http://swizec.com/blog/wp-content/uploads/2011/12/Selection_046.png"><img class=" wp-image-3283 " title="Toshl and Toggl plotted" src="http://swizec.com/blog/wp-content/uploads/2011/12/Selection_046-1024x345.png" alt="Toshl and Toggl plotted" width="717" height="241" /></a><p class="wp-caption-text">Toshl and Toggl plotted</p></div>
<p>Just for fun I tried running linear regression on this data and, as expected, it failed horribly. The lowest cost is a function along the lines of <em>y = </em><em>-6.5541e+88*x + </em><em> -4.8840e+90</em> &#8230; I&#8217;m not even sure coming up with fake-ish quadratic and cubic function elements would do much good in this case and since I only have a single parameter neural networks wouldn&#8217;t do much good either.</p>
<p>And either way, anything that comes even close to modeling this data will suffer from horrible overfitting and won&#8217;t be much use anyway &#8230; luckily I have some other ideas I can try.</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://swizec.com/blog/sabbatical-week-day-1-toshl-and-toggl-datasets/swizec/3277">Sabbatical week day 1: Toshl and Toggl datasets</a> (swizec.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.r-bloggers.com/visualizing-gestures-as-paths/">Visualizing Gestures as Paths</a> (r-bloggers.com)</li>
<li class="zemanta-article-ul-li"><a href="http://wiki.answers.com/Q/Why_is_a_harp_shaped_how_it_is">Why is a harp shaped how it is</a> (wiki.answers.com)</li>
<li class="zemanta-article-ul-li"><a href="http://stackoverflow.com/questions/7451757/octave-select-a-file">Octave select a file?</a> (stackoverflow.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.tablix.org/~avian/blog/archives/2011/11/plotting_a_density_map/">Plotting a density map</a> (tablix.org)</li>
<li class="zemanta-article-ul-li"><a href="http://flowingmotion.jojordan.org/2011/10/16/12-steps-to-running-gradient-descent-in-octave/">12 steps to running gradient descent in Octave</a> (flowingmotion.jojordan.org)</li>
<li class="zemanta-article-ul-li"><a href="http://flowingmotion.jojordan.org/2011/12/04/down-to-earth-principal-components-analysis-in-5-steps/">Down-to-earth principal components analysis in 5 steps</a> (flowingmotion.jojordan.org)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=037d18ab-29b7-4c83-99e3-02ae84f3b1f3" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/agQQYKnaX8c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/sabbatical-week-day-2-i-fail-at-octave/swizec/3282/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/sabbatical-week-day-2-i-fail-at-octave/swizec/3282</feedburner:origLink></item>
		<item>
		<title>Sabbatical week day 1: Toshl and Toggl datasets</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/oByynw_VeaY/3277</link>
		<comments>http://swizec.com/blog/sabbatical-week-day-1-toshl-and-toggl-datasets/swizec/3277#comments</comments>
		<pubDate>Tue, 27 Dec 2011 12:48:15 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[A tech a day]]></category>
		<category><![CDATA[sabbatical]]></category>
		<category><![CDATA[Accounting]]></category>
		<category><![CDATA[Apps]]></category>
		<category><![CDATA[Klok]]></category>
		<category><![CDATA[Machine learning]]></category>
		<category><![CDATA[Time Tracking]]></category>
		<category><![CDATA[Toshl]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3277</guid>
		<description><![CDATA[I&#8217;m taking a sabbatical week over the holidays. This week&#8217;s posts will serve as a sort of report of what I got up to the previous day instead of the usual schedule &#8211; wish me luck that I achieve even half of what I&#8217;d like to. Toshl is a cool expense tracking app from Slovenia, [...]]]></description>
			<content:encoded><![CDATA[<p><em>I&#8217;m taking a sabbatical week over the holidays. This week&#8217;s posts will serve as a sort of report of what I got up to the previous day instead of the usual schedule &#8211; wish me luck that I achieve even half of what I&#8217;d like to.</em></p>
<div class="wp-caption alignright" style="width: 260px"><a href="http://www.crunchbase.com/product/toshl"><img class="zemanta-img-inserted zemanta-img-configured" title="Image representing Toshl as depicted in CrunchBase" src="http://swizec.com/blog/wp-content/uploads/2011/12/65197v5-max-250x2503.jpg" alt="Image representing Toshl as depicted in CrunchBase" width="250" height="216" /></a><p class="wp-caption-text">Image via CrunchBase</p></div>
<p><a class="zem_slink" title="Toshl" href="http://toshl.com" rel="homepage">Toshl</a> is a cool expense tracking app from Slovenia, that I have been using since November last year as it turns out. I just love collecting data that I never really look at &#8211; I think the only times when I actually went back to inspect my Toshl data were those <em>holy fuck, why am I suddenly out of money, where&#8217;d it all go!?</em> moments.</p>
<p>It was never the bank&#8217;s mistake <img src='http://swizec.com/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p><a class="zem_slink" title="Toggl.com" href="http://www.toggl.com" rel="homepage">Toggl</a> is perhaps more widely known &#8211; possibly the simplest time tracker I have come across. Started using it in early June as a companion app to my <a class="zem_slink" title="Klok" href="http://klok.mcgraphix.com/klok/index.htm" rel="homepage">Klok</a> data for tracking productive productive time (the definition for Klok also includes things like exercise and chores for instance). In September or October I tightened up my use a bit further so Toggl only includes my billable time now.</p>
<p>Combined Toshl and Toggl give me this awesome dataset to play with &#8211; a near daily report of my expected income and my actual expenses.</p>
<p>The next step is obvious &#8211; I&#8217;m making a service for myself that, once a week:</p>
<ul>
<li>fetches toshl and toggl data</li>
<li>runs a simple <a class="zem_slink" title="Machine learning" href="http://en.wikipedia.org/wiki/Machine_learning" rel="wikipedia">machine learning algorithm</a></li>
<li>sends me an email along the lines of <em>Hey dude, you&#8217;re gonna run out of money in two weeks. Just thought I&#8217;d mention that</em></li>
</ul>
<p>Yesterday I made the fetching part in <a class="zem_slink" title="Node.js" href="http://nodejs.org/" rel="homepage">node.js</a> &#8211; a surprisingly difficult task when there&#8217;s no ready-made Toggl library and Toshl doesn&#8217;t even have an official API &#8211; and I&#8217;m tackling the learning bit today &#8230; perhaps even in <a class="zem_slink" title="Haskell (programming language)" href="http://haskell.org" rel="homepage">Haskell</a>. That should be interesting and couldn&#8217;t possibly fail right?</p>
<p>Oh and if you ever find yourself in a situation where you have to reverse engineer an API from web forms make sure to send the <em>&#8216;Content-Type&#8217;: &#8216;application/x-www-form-urlencoded&#8217;</em> header. Wasted at least an hour trying to figure out why my requests worked perfectly with Curl but not in Node.js.</p>
<p>Of course it also helps if your target doesn&#8217;t have csrf protection; thanks for that Toshl team. You guys are awesome <img src='http://swizec.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>PS: ping me if you think this sort of service could be useful to you too</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://markos.gaivo.net/blog/?p=604">Review of expense tracker Toshl</a> (markos.gaivo.net)</li>
<li class="zemanta-article-ul-li"><a href="http://www.alwayssaving.com/money-saving-smartphone-apps/">Money-saving smartphone apps</a> (alwayssaving.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.makeuseof.com/tag/toggl-helps-discover-time/">Toggl Helps You Discover Where Your Time Goes</a> (makeuseof.com)</li>
<li class="zemanta-article-ul-li"><a href="http://theworkathomewife.com/top-10-freelance-time-tracking-tools/">Top 10 Freelance Time Tracking Tools</a> (theworkathomewife.com)</li>
<li class="zemanta-article-ul-li"><a href="http://mashable.com/2011/12/10/time-keeping-apps/">5 Timekeeping Apps for Your Small Business</a> (mashable.com)</li>
<li class="zemanta-article-ul-li"><a href="http://stackoverflow.com/questions/8490093/node-js-share-sockets-between-processes">node.js &#8211; share sockets between processes</a> (stackoverflow.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.intomobile.com/2011/11/04/mobile-expense-tracking-service-toshl-gets-brand-new-android-app/">Mobile expense tracking service Toshl gets a brand new Android app</a> (intomobile.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=75f5e7d0-daac-4773-870d-c83333331ef0" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/oByynw_VeaY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/sabbatical-week-day-1-toshl-and-toggl-datasets/swizec/3277/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/sabbatical-week-day-1-toshl-and-toggl-datasets/swizec/3277</feedburner:origLink></item>
		<item>
		<title>Learning me a Haskell</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/wrTejbLbdXQ/3272</link>
		<comments>http://swizec.com/blog/learning-me-a-haskell/swizec/3272#comments</comments>
		<pubDate>Fri, 23 Dec 2011 18:02:46 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[A tech a day]]></category>
		<category><![CDATA[Clojure]]></category>
		<category><![CDATA[Functional programming]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Languages]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3272</guid>
		<description><![CDATA[A couple of days ago I decided that doing my graduation thesis on a topic that, when suggested, brought a sparkle to my mentor&#8217;s eye and made him suggest I might want to think about picking a co-mentor just wasn&#8217;t hard enough &#8211; so I decided to do the whole thing in Haskell. I want [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignright" style="width: 310px"><a href="http://commons.wikipedia.org/wiki/File:Haskell-Logo.svg"><img class="zemanta-img-inserted zemanta-img-configured" title="English: The Haskell Logo, a stylized &gt;λ= . Th..." src="http://swizec.com/blog/wp-content/uploads/2011/12/300px-Haskell-Logo.svg_4.png" alt="English: The Haskell Logo, a stylized &gt;λ= . Th..." width="300" height="212" /></a><p class="wp-caption-text">Image via Wikipedia</p></div>
<p>A couple of days ago I decided that doing my graduation thesis on a topic that, when suggested, brought a sparkle to my mentor&#8217;s eye and made him suggest I might want to think about picking a co-mentor just wasn&#8217;t hard enough &#8211; so I decided to do the whole thing in <a class="zem_slink" title="Haskell (programming language)" href="http://haskell.org" rel="homepage">Haskell</a>.</p>
<p>I want to show you what I&#8217;ve learned of Haskell in just a few hours, you can skip the next five-ish paragraphs to get to the juicy code examples <img src='http://swizec.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Now I&#8217;ve never done Haskell before, I&#8217;ve heard about how awesome it is and that it&#8217;s super fast and super awesome and utterly and strictly functional and did I mention I&#8217;ve heard it&#8217;s awesome? Until a couple of days ago I didn&#8217;t even really know what Haskell looked like!</p>
<p>The graduation thesis really seemed like the perfect excuse to get into Haskell &#8211; and I&#8217;ve been looking for one for a while. Somehow when I started out learning <a class="zem_slink" title="Functional programming" href="http://en.wikipedia.org/wiki/Functional_programming" rel="wikipedia">functional programming</a> with <a class="zem_slink" title="Clojure" href="http://clojure.org" rel="homepage">Clojure</a> it didn&#8217;t really reel me in, Haskell so far looks like it might capture my heart.</p>
<p>Maybe it&#8217;s just the cool writing of Miran Lipovaca who published <em><a href="http://learnyouahaskell.com/" target="_blank">Learn you a Haskell</a></em> in April this year (and made it available for free on the great wide interwebs), that&#8217;s making the learning curve slightly easier to digest than it was when I was doing Clojure. (he was also my classmate in high school and is my sort-of classmate now in college, which makes the whole thing that much awesomer)</p>
<p>The first thing I noticed is just how bloody expressive Haskell is, it feels like I&#8217;m writing much less code than I&#8217;m used to in both <a class="zem_slink" title="JavaScript" href="http://en.wikipedia.org/wiki/JavaScript" rel="wikipedia">JavaScript</a> and <a class="zem_slink" title="Python (programming language)" href="http://www.python.org/" rel="homepage">Python</a> to achieve cool stuff. Definitely less than when I was trying to learn Clojure by just perusing the docs.</p>
<p>After 3 hours of learning Haskell, here&#8217;s how it compares to my Python and Javascript &#8211; I had originally wanted to compare to Clojure, but that was just embarrasing <img src='http://swizec.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>Sum multiples of 3 and 5 under 1000</h2>
<p>Haskell:</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="font-weight: bold;">sum</span> <span style="color: green;">&#91;</span>x <span style="color: #339933; font-weight: bold;">|</span> x <span style="color: #339933; font-weight: bold;">&lt;-</span> <span style="color: green;">&#91;</span><span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">..</span><span style="color: red;">999</span><span style="color: green;">&#93;</span><span style="color: #339933; font-weight: bold;">,</span> <span style="font-weight: bold;">mod</span> x <span style="color: red;">5</span> <span style="color: #339933; font-weight: bold;">==</span> <span style="color: red;">0</span> <span style="color: #339933; font-weight: bold;">||</span> <span style="font-weight: bold;">mod</span> x <span style="color: red;">3</span> <span style="color: #339933; font-weight: bold;">==</span> <span style="color: red;">0</span><span style="color: green;">&#93;</span></pre></div></div>

<p>Python:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #008000;">sum</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span>x <span style="color: #ff7700;font-weight:bold;">for</span> x <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1000</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">if</span> x<span style="color: #66cc66;">%</span>3 == <span style="color: #ff4500;">0</span> <span style="color: #ff7700;font-weight:bold;">or</span> x<span style="color: #66cc66;">%</span>5 == <span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Javascript:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> x<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span>s<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> x <span style="color: #339933;">&lt;</span> <span style="color: #CC0000;">1000</span><span style="color: #339933;">;</span> x<span style="color: #339933;">++,</span> <span style="color: #009900;">&#40;</span>x<span style="color: #339933;">%</span>3<span style="color: #339933;">==</span><span style="color: #CC0000;">0</span> <span style="color: #339933;">||</span> x<span style="color: #339933;">%</span>5<span style="color: #339933;">==</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> s<span style="color: #339933;">+=</span>x <span style="color: #339933;">:</span> s<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
s</pre></div></div>

<h2>Sum of even fibonacci terms under 4,000,000</h2>
<p>Haskell:</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">fib <span style="color: #339933; font-weight: bold;">::</span> <span style="color: green;">&#91;</span><span style="color: #cccc00; font-weight: bold;">Int</span><span style="color: green;">&#93;</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: green;">&#91;</span><span style="color: #cccc00; font-weight: bold;">Int</span><span style="color: green;">&#93;</span>
fib terms
  <span style="color: #339933; font-weight: bold;">|</span> <span style="font-weight: bold;">head</span> terms <span style="color: #339933; font-weight: bold;">&lt;</span> <span style="font-weight: bold;">max</span>' <span style="color: #339933; font-weight: bold;">=</span> fib <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span><span style="font-weight: bold;">sum</span> <span style="color: green;">&#40;</span><span style="font-weight: bold;">take</span> <span style="color: red;">2</span> terms<span style="color: green;">&#41;</span><span style="color: green;">&#41;</span>:terms<span style="color: green;">&#41;</span>
  <span style="color: #339933; font-weight: bold;">|</span> <span style="font-weight: bold;">otherwise</span> <span style="color: #339933; font-weight: bold;">=</span> terms
  <span style="color: #06c; font-weight: bold;">where</span> <span style="font-weight: bold;">max</span>' <span style="color: #339933; font-weight: bold;">=</span> <span style="color: red;">4000000</span>
&nbsp;
<span style="font-weight: bold;">sum</span> <span style="color: green;">&#91;</span>x <span style="color: #339933; font-weight: bold;">|</span> x <span style="color: #339933; font-weight: bold;">&lt;-</span> fib <span style="color: green;">&#91;</span><span style="color: red;">1</span><span style="color: green;">&#93;</span><span style="color: #339933; font-weight: bold;">,</span> <span style="font-weight: bold;">mod</span> x <span style="color: red;">2</span> <span style="color: #339933; font-weight: bold;">==</span> <span style="color: red;">0</span><span style="color: green;">&#93;</span></pre></div></div>

<p>Python:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> fib<span style="color: black;">&#40;</span>terms<span style="color: black;">&#41;</span>:
     <span style="color: #ff7700;font-weight:bold;">return</span> terms <span style="color: #ff7700;font-weight:bold;">if</span> terms<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">&gt;</span>= <span style="color: #ff4500;">4000000</span> <span style="color: #ff7700;font-weight:bold;">else</span> fib<span style="color: black;">&#40;</span><span style="color: black;">&#91;</span>terms<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>+terms<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#93;</span>+terms<span style="color: black;">&#41;</span>
<span style="color: #008000;">sum</span><span style="color: black;">&#40;</span><span style="color: #008000;">filter</span><span style="color: black;">&#40;</span><span style="color: #ff7700;font-weight:bold;">lambda</span> x: x<span style="color: #66cc66;">%</span>2 == <span style="color: #ff4500;">0</span>, fib<span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span>,<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Javascript:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> fib<span style="color: #009900;">&#40;</span>l<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span>l<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;=</span> <span style="color: #CC0000;">4000000</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> l <span style="color: #339933;">:</span> fib<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span>l<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span>l<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">concat</span><span style="color: #009900;">&#40;</span>l<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#125;</span>
fib<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">filter</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> a<span style="color: #339933;">%</span>2 <span style="color: #339933;">==</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">reduce</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span>b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> a<span style="color: #339933;">+</span>b <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>I was writing the python and javascript examples directly in the console, hence less new lines. But the point is, even after just very little time, haskell is proving to be pretty much as expressive as my two primary languages where I know <del datetime="2011-12-23T16:55:53+00:00">all</del> a lot of the tricks.</p>
<p>This looks like the beginning of a long relationship.</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://swizec.com/blog/crowdsourcing-elegance/swizec/2608">Crowdsourcing elegance</a> (swizec.com)</li>
<li class="zemanta-article-ul-li"><a href="http://mathias-biilmann.net/posts/2011/10/is-haskell-the-cure">Is Haskell the Cure?</a> (mathias-biilmann.net)</li>
<li class="zemanta-article-ul-li"><a href="http://drknucklehead.wordpress.com/2011/10/11/solving-problems-using-clojure-sequences/">Solving Problems Using Clojure Sequences</a> (drknucklehead.wordpress.com)</li>
<li class="zemanta-article-ul-li"><a href="http://blog.raynes.me/blog/2011/11/27/the-clojure-community-and-me/">The Clojure Community and Me</a> (raynes.me)</li>
<li class="zemanta-article-ul-li"><a href="http://stackoverflow.com/questions/7854040/haskell-inefficient-fibonacci-implementation">haskell inefficient fibonacci implementation</a> (stackoverflow.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.yellosoft.us/evilgenius/">Haskell for the Evil Genius</a> (yellosoft.us)</li>
<li class="zemanta-article-ul-li"><a href="http://stackoverflow.com/questions/8366093/heading-a-file-one-line-at-a-time-in-haskell">Heading a file one line at a time in Haskell</a> (stackoverflow.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=9436ee3b-db83-41f4-bece-a7b4eb989080" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/wrTejbLbdXQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/learning-me-a-haskell/swizec/3272/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/learning-me-a-haskell/swizec/3272</feedburner:origLink></item>
		<item>
		<title>Today I nearly died … four times</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/mXubG2coynQ/3251</link>
		<comments>http://swizec.com/blog/today-i-nearly-died-four-times/swizec/3251#comments</comments>
		<pubDate>Wed, 21 Dec 2011 22:31:57 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[Insanity]]></category>
		<category><![CDATA[Longboard]]></category>
		<category><![CDATA[Pedestrian]]></category>
		<category><![CDATA[Recreation]]></category>
		<category><![CDATA[skateboards]]></category>
		<category><![CDATA[Sports]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3251</guid>
		<description><![CDATA[Today has been such an epically clumsy day &#8211; knocking over everything I touch, nearly killing random people in the street and myself in the process &#8211; that I just had to share with everyone. Reading this might give you a good chuckle at my expense Let&#8217;s start at the beginning then, shall we? The [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignright" style="width: 310px"><img class="  " title="My longboard" src="http://swizec.com/blog/wp-content/uploads/2011/12/313552641a8b11e19896123138142014_73.jpg" alt="My longboard" width="300" height="300" /><p class="wp-caption-text">My longboard</p></div>
<p>Today has been such an epically clumsy day &#8211; knocking over everything I touch, nearly killing random people in the street and myself in the process &#8211; that I just had to share with everyone. Reading this might give you a good chuckle at my expense <img src='http://swizec.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Let&#8217;s start at the beginning then, shall we?</p>
<p>The day started out as any other day would. I woke up, looked at the internet, exercised, had a shower, ate some breakfast &#8230; pretty normal stuff right there.</p>
<p>Then I had a friend come over and I somehow managed to apply my knee to her ankle in what looked like an extremely painful manner. Judging from her shriek and holding her leg like the best football star in the champion&#8217;s league.</p>
<p>On my way to class I nearly tripped over an unwitting pedestrian. But hey, these things happen sometimes, people don&#8217;t look where they&#8217;re going and traveling on a longboard doesn&#8217;t make a lot of noise while still being quite fast for a sidewalk. Plus people don&#8217;t really expect to meet a guy traveling on a longboard when it&#8217;s below zero outside &#8230; I think.</p>
<p>Then at a stoplight I nearly tripped over another pedestrian. She was just sort of standing there and I wasn&#8217;t very efficient with my breaking and I think she got a bit spooked when I suddenly ran past her as I jumped off my longboard, narrowly avoiding killing her.</p>
<p>Got overtaken by a classmate on a bike and he offered to pull me to class to make the whole affair much quicker. I agreed &#8230; but it took me five tries to get a decent grip on his backpack.</p>
<p>In the process I nearly killed another pedestrian.</p>
<p>Actually, two pedestrians, they were suddenly in my way and I awkwardly jumped off the longboard so it sort off got between their legs and they&#8217;re quite lucky neither of them accidentally stepped on it because that would be a pretty nasty fall.</p>
<p>A hundred meters after this incident there was a car idly parked over the sidewalk &#8211; and when I say parked, I mean there was a guy chatting on the phone while lazily manuevering a big SUV into his garage thing.</p>
<div class="wp-caption alignleft" style="width: 310px"><a href="http://commons.wikipedia.org/wiki/File:Longboarding.jpg"><img class="zemanta-img-inserted zemanta-img-configured" title="English: Downhill longboarding example picture" src="http://swizec.com/blog/wp-content/uploads/2011/12/300px-Longboarding4.jpg" alt="English: Downhill longboarding example picture" width="300" height="185" /></a><p class="wp-caption-text">Image via Wikipedia</p></div>
<p>Had to jump off the longboard. Nearly killed another pedestrian who was just waiting there for the car to move.</p>
<p>Not ten minutes later we approached a stoplight with great speed and I couldn&#8217;t decide what to do. Should I jump off? But we&#8217;re going too fast for me to run. Should I just brake? But I&#8217;m not stable enough at this speed for driving with one foot &#8230; and if I just wait until I lose speed I&#8217;ll end up a hundred meters beyond the crossroads.</p>
<p>So I did the stupidest thing possible &#8211; kept hanging on to the backpack and trying to break like that. Ended up nearly taking the guy over his handlebars. Lost my footing on the longboard and before I knew it I was standing in the middle of a busy crossroads picking up the damn thing from the ground.</p>
<p>Luckily nobody ran me over.</p>
<p>Not sure how many pedestrians I nearly killed on my way home from class, but at one point I nearly smashed into the side of a car who didn&#8217;t see me crossing the road. Not even a hint of trying to stop, was just plain going and I had to jump off the longboard at the last minute with about a meter to spare.</p>
<p>Then I went to an event at the Cyberpipe, again with a longboard. At this point I seriously stopped counting the number of pedestrians magically winding up in my way and almost ending up killed. It&#8217;s all just a blur, indistinctive people always winding up riiiiiight where I want to go.</p>
<p>As if by magic!</p>
<p>An even more interesting thing happened on my way back home. I was passing a group of pedestrians and another group suddenly appeared out of nowhere so people took up almost the entire sidewalk. Somehow managed to swerve around everyone and just as I was about to propel myself forward I suddenly lost balance and try to catch my footing.</p>
<div class="wp-caption alignleft" style="width: 173px"><a href="http://www.flickr.com/photos/40230716@N03/5044996221"><img class="zemanta-img-inserted zemanta-img-configured " title="Longboarding" src="http://swizec.com/blog/wp-content/uploads/2011/12/5044996221_e7c0225126_m1.jpg" alt="Longboarding" width="163" height="240" /></a><p class="wp-caption-text">Longboarding</p></div>
<p>Sure enough, to catch my footing I stepped on the longboard and shot it from underneath me with great speed. Didn&#8217;t fall but did have to run after the damn thing. Just when I almost caught it, the longboard went off the sidewalk and into the street.</p>
<p>Ran after it, but there was a bus and &#8230; hey, it&#8217;s going to come out the other end right!? It did come out the other end, or rather somewhat to the side and juuuust as I was about to pick it up, it approached a car.</p>
<p>And the light turned green. The driver not noticing anything started off and drove right over the front-left side of my longboard, shooting it up into the air about a meter and right in my fucking leg.</p>
<p>The longboard then bounced off my bone and under the bus again narrowly missing being run over by a very huge tyre.</p>
<p>Not counting another guy who nearly ran me over because he didn&#8217;t see my crossing the street, the rest of the trip home was rather uneventful.</p>
<p>Should I be happy I&#8217;m alive?</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://www.coolhunting.com/design/erickson-longbo.php">Erickson Longboards</a> (coolhunting.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.thestar.com/news/article/1052107--army-of-skateboarders-takes-over-downtown-streets">Army of skateboarders takes over downtown streets</a> (thestar.com)</li>
<li class="zemanta-article-ul-li"><a href="http://coedmagazine.com/2011/12/10/chill-original-longboarding-country-roads-session-video/">Wake and Bake To This Chill Longboarding Sesh [VIDEO]</a> (coedmagazine.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=90c754a9-3b5e-49e1-9d1e-d0e48e96fcbb" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/mXubG2coynQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/today-i-nearly-died-four-times/swizec/3251/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/today-i-nearly-died-four-times/swizec/3251</feedburner:origLink></item>
		<item>
		<title>The problem with threads</title>
		<link>http://feedproxy.google.com/~r/AGeekWithAHat2/~3/-DDmyObuMBE/3230</link>
		<comments>http://swizec.com/blog/the-problem-with-threads/swizec/3230#comments</comments>
		<pubDate>Wed, 21 Dec 2011 18:05:21 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[Science Wednesday]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Lego]]></category>
		<category><![CDATA[MapReduce]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ptolemy Project]]></category>
		<category><![CDATA[Threads]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=3230</guid>
		<description><![CDATA[This morning there was a link going around listing the 15 papers you should read to understand node.js&#8217;s background. A large portion of the list is devoted to the comparison of thread- and event- based models of execution. Since I hear a lot about event loops being better than threads, I read The problem with [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignright" style="width: 250px"><a href="http://www.flickr.com/photos/45448242@N02/4800996644"><img class="zemanta-img-inserted zemanta-img-configured" title="Regular Expression NFA" src="http://swizec.com/blog/wp-content/uploads/2011/12/4800996644_c46de09b40_m1.jpg" alt="Regular Expression NFA" width="240" height="128" /></a><p class="wp-caption-text">Image by jl_2 via Flickr</p></div>
<p>This morning there was a link going around listing the <a href="https://plus.google.com/111191895515210271225/posts/HN2ZTbf7Cgg" target="_blank">15 papers you should read to understand node.js&#8217;s background</a>. A large portion of the list is devoted to the comparison of thread- and event- based models of execution. Since I hear a lot about event loops being better than threads, I read <em><a href="http://www.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-1.pdf" target="_blank">The problem with threads</a></em> written in 2006 by one Edward A. Lee, a professor at Berkeley.</p>
<blockquote><p>If the next generation of programmers makes more intensive use of <a class="zem_slink" title="Thread (computer science)" href="http://en.wikipedia.org/wiki/Thread_%28computer_science%29" rel="wikipedia">multithreading</a>, then the next generation of computers will become nearly unusable.</p></blockquote>
<p>And this bleak future is almost inevitable when you think about it. The rule of <a class="zem_slink" title="Moore's law" href="http://en.wikipedia.org/wiki/Moore%27s_law" rel="wikipedia">Moore&#8217;s law</a> has been changing from faster chips, to more and more cores. And yet the only software making good use of multiple cores are what Lee calls &#8220;<a class="zem_slink" title="Embarrassingly parallel" href="http://en.wikipedia.org/wiki/Embarrassingly_parallel" rel="wikipedia">embarrassingly parallel</a>&#8221; applications &#8211; those that simply split themselves into independent processes.</p>
<p>Problems with threads stem from sharing memory space. Without proper care this can lead to a situation where one thread changes a piece of data, while the other is reading it. Now you have two threads that both have a different understanding of what the value of a certain variable is.</p>
<p>While in theory solvable with semaphores, locks and so on, without very proper care this can then lead to deadlocks &#8211; more importantly, taking care of  interleaving threads is <em>very hard. </em>You are essentially facing a <a class="zem_slink" title="Nondeterministic finite-state machine" href="http://en.wikipedia.org/wiki/Nondeterministic_finite-state_machine" rel="wikipedia">nondeterministic machine</a> and trying to understand it through a poor abstraction that doesn&#8217;t  make use of your natural ability to deal with concurrency.</p>
<p>Lee also makes the case that this isn&#8217;t merely a problem of syntax or tools, but that threads are a fundamentally flawed model of computation. I won&#8217;t burden you with his whole proof/argumentation (page 3 to 5). The gist is that</p>
<blockquote><p>/../ given a sequental program and an initial state, you have a defined sequence of events. Any two programs can be compared &#8211; they are equivalent if they halt for the same initial states and the final state is the same. When threads are introduced these essential properties are lost /../ if two threads can provide the next action, we can no longer compare two programs, we might be able to compare all interleavings, but on a <a class="zem_slink" title="Thread (computer science)" href="http://en.wikipedia.org/wiki/Thread_%28computer_science%29" rel="wikipedia">multithreaded</a> envrionment even that is lost since we&#8217;d have to know about  all the other programs as well.</p></blockquote>
<p>Essentially the problem is this &#8211; the core abstraction of computation is a deterministic assembly of deterministic components, but threads are inherently nondeterministic. The car analogy Lee provides is trying to compose an <a class="zem_slink" title="Internal combustion engine" href="http://en.wikipedia.org/wiki/Internal_combustion_engine" rel="wikipedia">internal combustion engine</a> out of a pot of iron,  hydrocarbon and oxygen molecules randomly moving according to thermal forces.</p>
<p>This is so bad in practice even using very strict and rigid engineering principles, doesn&#8217;t help. In early 2000 Lee started the <a class="zem_slink" title="Ptolemy Project (computing)" href="http://ptolemy.eecs.berkeley.edu" rel="homepage">Ptolemy Project</a>, a project designing concurrent embedded systems. But this is also an experiment in battling threads with rigorous engineering discipline &#8211; they developed a code maturity rating system, design reviews, <a class="zem_slink" title="Code review" href="http://en.wikipedia.org/wiki/Code_review" rel="wikipedia">code reviews</a>, nightly builds, the works. Reviewers included concurrency experts and there are regression tests with 100% code coverage.</p>
<p>When the system started being used in 2000 no problems were observed until a deadlock on April 26th, 2004. Just the fact they know the exact date this happened tells a lot about how rigorously engineering principles are applied. Still, a very serious problem took <em>four years</em> to be discovered.</p>
<p>Many other approaches exist that try to combat this problem, but they either wallow in obscurity or aren&#8217;t very effective; perhaps the most effective is the use of higher-order principles like <a class="zem_slink" title="MapReduce" href="http://en.wikipedia.org/wiki/MapReduce" rel="wikipedia">MapReduce</a>, which aim to  break the problem into tiny fractions that can be computed separately and then combining the results.</p>
<p>An interesting solution Lee proposes is using the so-called Rendezvous pattern, which as far as I can tell is a generalization of MapReduce, with the use of a nondeterministic merge, so that each part of the program is executing deterministically and <a class="zem_slink" title="Nondeterministic algorithm" href="http://en.wikipedia.org/wiki/Nondeterministic_algorithm" rel="wikipedia">nondeterminism</a> is only used in a single spot on the network &#8211; where threads <em>actually</em> have to interact. Lee proposes using this with some sort of coordination language, so that programmers aren&#8217;t burdened with learning new ways of implementing their solutions (a historically <em>very</em> slow process), but can assemble different solutions almost like <a class="zem_slink" title="Lego" href="http://www.lego.com/" rel="homepage">Lego</a>&#8216;s.</p>
<p>Lee concludes that concurrency in software is difficult, but much of it is our own fault due to using poor abstractions. To deal with concurrency in a robust and predictable manner, we should stop using threads and focus on using nondeterminism only where it is warranted.</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://go.theregister.com/feed/www.theregister.co.uk/2011/11/03/peregrine_multithreading/">Better multithreading offered by Columbia U researchers</a> (go.theregister.com)</li>
<li class="zemanta-article-ul-li"><a href="http://powersthatbeat.wordpress.com/2011/11/12/major-breakthrough-improves-software-reliability-and-security-the-fu-foundation-school-of-engineering-applied-science-columbia-university/">Major Breakthrough Improves Software Reliability and Security | The Fu Foundation School of Engineering &amp; Applied Science &#8211; Columbia University</a> (powersthatbeat.wordpress.com)</li>
<li class="zemanta-article-ul-li"><a href="http://stackoverflow.com/questions/8458576/worker-threads-and-controller-thread-synchronization">Worker threads and a controller thread</a> (stackoverflow.com)</li>
<li class="zemanta-article-ul-li"><a href="http://stackoverflow.com/questions/8007465/what-does-really-happen-if-i-access-a-singleton-in-a-multithreaded-program">What does really happen if I access a singleton in a multithreaded Program</a> (stackoverflow.com)</li>
<li class="zemanta-article-ul-li"><a href="http://stackoverflow.com/questions/8363864/multithreading-performance">Multithreading performance</a> (stackoverflow.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.eurekalert.org/pub_releases/2011-11/cu-mbi110211.php">Major breakthrough improves software reliability and security</a> (eurekalert.org)</li>
<li class="zemanta-article-ul-li"><a href="http://stackoverflow.com/questions/4430388/access-violation-in-a-multithreaded-application-c">Access violation in a multithreaded application, C++</a> (stackoverflow.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=062c52b7-3f63-459d-bdc0-9e6a09bf5955" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/AGeekWithAHat2/~4/-DDmyObuMBE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/the-problem-with-threads/swizec/3230/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://swizec.com/blog/the-problem-with-threads/swizec/3230</feedburner:origLink></item>
	</channel>
</rss><!-- Served from: swizec.com @ 2012-02-03 12:35:27 by W3 Total Cache -->

