<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[defunct]]></title>
  <link href="http://www.less-broken.com/atom.xml" rel="self"/>
  <link href="http://www.less-broken.com/"/>
  <updated>2013-01-25T22:03:06-08:00</updated>
  <id>http://www.less-broken.com/</id>
  <author>
    <name><![CDATA[Siddharth Agarwal]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[New version of ntfsutils]]></title>
    <link href="http://www.less-broken.com/blog/2013/01/new-version-of-ntfsutils.html"/>
    <updated>2013-01-25T22:30:00-08:00</updated>
    <id>http://www.less-broken.com/blog/2013/01/new-version-of-ntfsutils</id>
    <content type="html"><![CDATA[<p>I&#8217;ve released a new version of the <a href="http://pypi.python.org/pypi/ntfsutils/">ntfsutils library</a> for Python.</p>

<p>The small spin-off project from some work I did at Mozilla became far more
popular than I expected, netting over 600 downloads last year. Pretty neat!</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Pymake has been enabled on Win32 Firefox builders]]></title>
    <link href="http://www.less-broken.com/blog/2012/09/pymake-on-builders.html"/>
    <updated>2012-09-01T07:30:00-07:00</updated>
    <id>http://www.less-broken.com/blog/2012/09/pymake-on-builders</id>
    <content type="html"><![CDATA[<p>[crossposting from mozilla.dev.platform; please continue the discussion there. <a href="https://groups.google.com/forum/?fromgroups=#!topic/mozilla.dev.platform/iupEOWZjHNc">Google Groups link</a>.]</p>

<p>As of yesterday, Pymake has been enabled on all Firefox Win32 builders. This includes mozilla-central, mozilla-inbound, try, and all project branches (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=787563">except elm</a>). Clobber build times (this includes Try builds!) should go down by 45 minutes to an hour, resulting in faster turnaround for developers and lower load on the infrastructure.</p>

<p>Pymake has now become the official way to build Firefox 18 and above on Windows. If you’re on Windows and you haven&#8217;t moved to Pymake yet, you should: <a href="https://developer.mozilla.org/en-US/docs/pymake">it&#8217;s really simple</a>. I recommend setting up an alias to the in-tree Pymake in your MSYS profile.</p>

<p>GNU Make will still work for now, but we won&#8217;t have tier 1 continuous integration for it (at least for Firefox — Thunderbird&#8217;s still on GNU Make, but I’m hoping to <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=786516">switch those builds to Pymake</a> soon). <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=787655">Win64 builds are also on GNU Make right now</a>, but those aren&#8217;t tier 1.</p>

<p>A few notes:</p>

<ul>
<li><p>If your project branch is seeing build failures on Windows:</p>

<ol>
<li>make sure you&#8217;re tracking an up-to-date mozilla-central: the last couple of fixes landed earlier this week and more fixes will be coming down the line</li>
<li>try setting a clobber for Win32 builds on your branch.</li>
<li>ask in #developers or #pymake &#8211; perhaps someone might be able to help you out</li>
<li>if all else fails, file a bug with releng similar to <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=787563">this one</a>.</li>
</ol>
</li>
<li><p>While try builds are much faster now, we also lose the ability to build Firefox 15-17 on them. <strike>I spent a bit of time investigating workarounds but didn&#8217;t get anywhere, unfortunately.</strike> <strong>Update 3/9:</strong> Simply add <a href="https://gist.github.com/3582912">this patch</a> to your queue before pushing to try.</p></li>
<li><p>This also means that you need to pushing an up-to-date mozilla-central to try, otherwise you <em>will</em> see failures on Windows.</p></li>
<li><p>One out of every 20 builds or so is failing with a strange error in dom/bindings/test &#8211; this seems to be corruption caused by a race condition that isn&#8217;t being properly handled somewhere but honestly shouldn&#8217;t be happening in the first place. If you see an error in dom/bindings similar to <a href="https://tbpl.mozilla.org/php/getParsedLog.php?id=14886515&amp;tree=Mozilla-Inbound&amp;full=1">the one in this log</a>, please retrigger that build. The error&#8217;s being tracked in <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=787658">this bug</a>.</p></li>
</ul>


<p>I&#8217;d like to say thanks to everyone who helped push it over the finish line: ted, khuey, coop, gps, glandium, catlee, bsmedberg, bhearsum, and anyone else if I missed them (sorry!).</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Civilising global state, take 2]]></title>
    <link href="http://www.less-broken.com/blog/2012/08/uncivilised-global-state.html"/>
    <updated>2012-08-04T13:30:00-07:00</updated>
    <id>http://www.less-broken.com/blog/2012/08/uncivilised-global-state</id>
    <content type="html"><![CDATA[<p>A few months ago, I wrote a post about <a href="http://www.less-broken.com/blog/2012/05/civilising-global-state.html">sane global state</a> via parameters.
Now Racket has parameters, but most other languages don&#8217;t. How important parameters are for a dynamic language
was driven home to me while working on getting the <a href="https://developer.mozilla.org/en-US/docs/pymake">Pymake</a>
build system working on our tinderboxes.</p>

<p>Pymake is a Python reimplementation of the venerable <a href="http://www.gnu.org/software/make/">GNU Make</a>, with two big advantages over it:</p>

<ol>
<li>Parallel GNU Make (at least the MSYS variant) is extremely buggy and prone to deadlocks on Windows, which means the only option is to run serially (<code>-j1</code>). Pymake doesn&#8217;t have any issues, so build times are much faster on machines with enough cores.</li>
<li>The Mozilla build system uses recursive Make. Each recursive call spawns another Make process, and <a href="http://stackoverflow.com/questions/47845/why-is-creating-a-new-process-more-expensive-on-windows-than-linux">process spawning is rather expensive on Windows</a>. Pymake performs all its recursion within the same process, which speeds build times on Windows even further.</li>
</ol>


<p>Pymake also provides a few bonus features, one of which is the ability to run
Python files &#8220;natively&#8221;, meaning within the same process. This helps speed up
builds even more by avoiding spawning extra Python processes. Of course, such
scripts have to be written with care to avoid trampling over Pymake itself.</p>

<p>One of the scripts for which this feature was enabled was <a href="https://mxr.mozilla.org/mozilla-central/source/config/pythonpath.py"><code>pythonpath.py</code></a>. By default, Python only loads modules from the current directory and its system directories. <code>pythonpath.py</code> lets us specify additional directories to load modules from. (Yes, <a href="http://www.virtualenv.org">virtualenv</a> is a much better solution, and we&#8217;re going to switch to it soon.)</p>

<p>To do its work <code>pythonpath.py</code> must modify important global variables like <code>sys.argc</code> and <code>sys.argv</code>. Since it doesn&#8217;t undo these modifications, it causes hard-to-debug problems down the line. To fix such issues, one would need to consider every eventuality: returns, exceptions, etc. Not only that, one might need to consider modifications by <em>others</em> as well.</p>

<p>As a result, we had to <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=780241">disable this feature</a> for it, slowing down builds by a bit.</p>

<p>If those variables were parameters, one could simply wrap the modifications up in a <code>parameterize</code> and expect things to Just Work. Since everyone would be doing the same thing, things continue to Just Work no matter what is run.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Build System on BugsAhoy]]></title>
    <link href="http://www.less-broken.com/blog/2012/06/build-system-on-bugsahoy.html"/>
    <updated>2012-06-30T11:25:00-07:00</updated>
    <id>http://www.less-broken.com/blog/2012/06/build-system-on-bugsahoy</id>
    <content type="html"><![CDATA[<p><a href="http://www.joshmatthews.net/">Josh Matthews</a>&#8217; amazing
<a href="http://www.joshmatthews.net/bugsahoy/">BugsAhoy</a> now has support for the
build system. All open bugs labelled <code>[good first bug]</code> and with a listed
mentor in the Core::Build Config and MailNews Core::Build Config components
are listed. If you&#8217;re interested in one of the bugs, post a comment there or
find us in <code>#pymake</code> on <code>irc.mozilla.org</code>.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Assuming makes an ass out of everyone, or how Ruby's build system sucks]]></title>
    <link href="http://www.less-broken.com/blog/2012/05/rubys-build-system-sucks.html"/>
    <updated>2012-05-15T05:30:00-07:00</updated>
    <id>http://www.less-broken.com/blog/2012/05/rubys-build-system-sucks</id>
    <content type="html"><![CDATA[<p>At Mozilla, our build system has a firm rule we only grudgingly violate:
<em>explicit is better than implicit</em>. What that means is that if we depend on a
library <code>foo</code> and we don&#8217;t find it on the machine we&#8217;re building on, we <em>fail</em>
instead of silently <em>assuming</em> the user doesn&#8217;t want to build in support for
<code>foo</code>. If the user really wants that, she would need to pass in a <code>--disable-foo</code>
configure flag saying so. This means we know exactly what we&#8217;re shipping
as binaries, and users know exactly what to expect.</p>

<p>Once you spend a lot of time working with Mozilla code, you sometimes forget
other projects don&#8217;t follow such obviously important rules. Case in point:
Ruby. A default Ubuntu install builds Ruby out of the box. Of course, when you
then try to do anything remotely useful:</p>

<pre><code>% gem install heroku
</code></pre>

<p>Ruby fails with a cryptic <code>no such file to load -- zlib (LoadError)</code>.</p>

<p>Turns out Ubuntu doesn&#8217;t come with the <code>zlibg1</code> dev library, which means the
Ruby build system <em>assumes</em> you don&#8217;t care about zlib support and happily builds
without it.</p>

<p>Great, so you installed the library and built Ruby again, and <code>gem</code> actually worked.
Now, you try to log in to Heroku:</p>

<pre><code>% heroku login
</code></pre>

<p>&#8230; and Ruby fails with yet another <code>no such file to load -- net/https</code> error.
At least the error message is slightly less cryptic this time, since it tells
you to <code>apt-get install libopenssl-ruby</code>. Which means you need to install the
library and rebuild Ruby a <em>third</em> time.</p>

<p>God knows how many more libraries the build system&#8217;s <em>assumed</em> I don&#8217;t care
about.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[no-www considered harmful]]></title>
    <link href="http://www.less-broken.com/blog/2012/05/no-www-considered-harmful.html"/>
    <updated>2012-05-08T07:38:00-07:00</updated>
    <id>http://www.less-broken.com/blog/2012/05/no-www-considered-harmful</id>
    <content type="html"><![CDATA[<p>I remember reading about the <a href="http://no-www.org/" rel="nofollow">no-www</a>
movement years ago. At that time it struck me as a cool thing to do, but I now know
that no-www is a really bad idea in general. That&#8217;s because the DNS system lets you
assign <a href="http://en.wikipedia.org/wiki/CNAME_record">CNAME records</a>
to subdomains, including the <code>www</code> subdomain, but only A or AAAA records to root domains.
In other words, you can say that <code>www.example.com</code> is the same as <code>test.example.org</code>, but you
can only say that <code>example.com</code> is the same as a particular IP address.</p>

<p>What&#8217;s the benefit of this? Well, if you use a CNAME you can let the owner of
<code>test.example.org</code> deal with anycast and routing issues, but if you use A
records you have to deal with them yourself. If you do decide to deal with
them yourself, you&#8217;ll be frustrated when your DNS updates take a while
to propagate.</p>

<p>More generally, CNAME is an example of the most powerful law of computer
science in action, and A isn&#8217;t.</p>

<blockquote><p>All problems in computer science can be solved by another level of indirection.
<cite>David Wheeler</cite></p></blockquote>

<p>See <a href="https://devcenter.heroku.com/articles/avoiding-naked-domains-dns-arecords#naked_domain__arecord_limitations">Heroku&#8217;s documentation</a>
on the matter.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Switching to Octopress]]></title>
    <link href="http://www.less-broken.com/blog/2012/05/switching-to-octopress.html"/>
    <updated>2012-05-07T07:35:00-07:00</updated>
    <id>http://www.less-broken.com/blog/2012/05/switching-to-octopress</id>
    <content type="html"><![CDATA[<p>I finally made the switch to <a href="http://octopress.org/">Octopress</a> today. I&#8217;ve
managed to migrate all my Blogger posts to it, and set up HTTP 301 redirects
so that people hitting my old posts and feeds aren&#8217;t lost.</p>

<p>I&#8217;m hosting my blog on <a href="http://www.heroku.com/">Heroku</a>, and the theme I&#8217;m
using is the default Octopress theme (which is actually really nice) with a
few tweaks. I&#8217;ve also played around with <a href="https://developer.mozilla.org/en/CSS/-moz-font-feature-settings">OpenType features</a>,
which only work in IE 10 on Windows 8, Firefox 15 and above on all platforms,
and Chrome 16 and above on Windows and Linux. (Firefox 14 and below do support
OpenType features, but with a different syntax I&#8217;m too lazy to support.)</p>

<h2>Web fonts and Windows</h2>

<p>Windows&#8217; <a href="https://en.wikipedia.org/wiki/ClearType#ClearType_in_GDI">GDI ClearType</a> has a
<em>really</em> bad time dealing with most web fonts, including the ones I&#8217;m using
for this site. <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd371554%28v=vs.85%29.aspx">DirectWrite</a>
does much better, but only works in IE 9 and above and in Firefox with
hardware acceleration. Thus I made the call to disable web fonts for body text
on Windows and use the similar-looking system font
<a href="https://en.wikipedia.org/wiki/Constantia_%28typeface%29">Constantia</a> instead.
I&#8217;ve left web fonts enabled for titles though.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Civilising global state]]></title>
    <link href="http://www.less-broken.com/blog/2012/05/civilising-global-state.html"/>
    <updated>2012-05-02T13:58:00-07:00</updated>
    <id>http://www.less-broken.com/blog/2012/05/civilising-global-state</id>
    <content type="html"><![CDATA[<div class='post'>
<div>
It seems to be universally agreed that global mutable state is considered harmful. It makes dependencies less clear, means that functions are harder to test, introduces races, has to be handled separately when exceptions occur, and so on.<br />
<br />
Yet anyone who has programmed for a while knows that there are always situations where global state is <i>useful</i> <i>and convenient</i>. Perhaps adding it to every single function call&#8217;s signature is a pain; perhaps you need to set up a callback and need some data there but can&#8217;t create a closure for it; perhaps you&#8217;d like to look up the stack for security reasons; perhaps you simply don&#8217;t want to refactor 90% of your code. (You might think you&#8217;re avoiding the pitfalls of global state by using singletons or static variables, but you&#8217;d be wrong.)<br />
<br />
Funnily enough, we&#8217;ve had a solution to these use cases since the dawn of programming languages: <a href="http://c2.com/cgi/wiki?DynamicScoping" target="_blank"><b>dynamic</b><b> </b><b>scope</b></a><b>. </b>Dynamically looking up the stack for variable bindings is thread-safe, exception-safe and remarkably less error-prone than global state. It has also quite rightfully been mostly abandoned in favour of <a href="http://c2.com/cgi/wiki?LexicalScoping" target="_blank">lexical scope</a>.<br />
<br />
But what if you could get all the great properties of dynamic scope with lexically scoped variables? That is what <a href="http://racket-lang.org/" target="_blank">Racket</a> achieves with <a href="http://docs.racket-lang.org/guide/parameterize.html" target="_blank"><i>parameters</i></a>. Racket parameters<br />
<ul>
<li>are explicitly declared as such, so you wouldn&#8217;t confuse them with regular variables</li>
<li>
hold their value within blocks where they&#8217;re defined, called <code>parameterize</code> blocks</li>
<li>can be nested safely and work as you would expect them to</li>
<li>importantly for a Scheme dialect, don&#8217;t interfere with tail call optimization</li>
<li>
are, by their very structure, thread-safe and exception-safe — it is always beautiful to see the semantics you want be a natural, obvious consequence of the syntax you&#8217;ve created</li>
</ul>
So the next time you&#8217;re tempted to use a global variable to solve a problem, don&#8217;t blame yourself; instead, blame the language you&#8217;re using for providing insufficient abstractions.</div></div>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Transferring apps and data from one Android device to another]]></title>
    <link href="http://www.less-broken.com/blog/2012/04/transferring-apps-and-data-from-one.html"/>
    <updated>2012-04-22T10:01:00-07:00</updated>
    <id>http://www.less-broken.com/blog/2012/04/transferring-apps-and-data-from-one</id>
    <content type="html"><![CDATA[<div class='post'>
My Nexus S&#8217;s screen has been having some issues with touch lately, so
 I&#8217;ve decided to send it in for repairs. I&#8217;ve really come to depend on a
 smartphone, though, so I went out and bought another Android phone to 
tide me over until my Nexus S is fixed: an <a href="http://www.htc.com/in/smartphones/htc-one-v/" target="_blank">HTC One V</a>.<br />
<br />
Now
 my phone had a lot of data, none of which I wanted to lose. Google&#8217;s 
cloud-based backup service unfortunately doesn&#8217;t do much in my experience, and the total 
amount of data I had (over 2.5 GB) was pretty large anyway, so I 
decided it&#8217;d be best to use my computer to do a full backup and restore.<br />
<br />
Full backups, restores and data transfers have <i>always</i> been a big issue with Android. Android 2.x requires you to root your phone and then use an application like <a href="https://play.google.com/store/apps/details?id=com.keramidas.TitaniumBackup&amp;hl=en" target="_blank">Titanium Backup</a>, which is honestly ridiculous. Android 4.0 is actually a lot better if you&#8217;re willing to use the command line a bit. <a href="https://developer.android.com/guide/developing/tools/adb.html" target="_blank">adb</a> for Android 4.0 has working &#8220;backup&#8221; and &#8220;restore&#8221; commands, no rooting required.<br />
<br />
<p>Here&#8217;s
 my setup: I wanted to transfer all my applications, settings and data 
from an encrypted Nexus S running Android 4.0 to an unencrypted HTC One 
V, also running Android 4.0. The instructions should work for any pair 
of Android 4.0 devices.</p>
<ol>
<li><p>I first made sure I had all the prerequisites. You essentially need most of an Android development environment on your computer.</p>
<ul>
<li>Download the latest version of the <a href="https://developer.android.com/sdk/index.html" target="_blank">Android SDK</a>
 for your platform, then run the SDK Manager and make sure you have the 
latest version of the Android SDK Tools and Android SDK Platform Tools.</li>
<li>If you&#8217;re on Windows, you&#8217;ll also need the <a href="https://developer.android.com/sdk/win-usb.html" target="_blank">ADB USB drivers</a> for both devices. The Nexus S drivers can be downloaded via the SDK Manager, while the HTC One V drivers are part of <a href="http://www.htc.com/in/help/htc-one-v/#download" target="_blank">HTC Sync</a>. (The HTC drivers are a pain to install: you need to <a href="http://community.spiceworks.com/how_to/show/1473" target="_blank">force-install</a> the &#8220;My HTC&#8221; drivers from <code>C:\Program Files (x86)\HTC\HTC Driver\Driver Files\Win7_x64</code>. Ridiculous.) For other OSes, see <a href="https://developer.android.com/guide/developing/device.html#setting-up" target="_blank">these instructions</a>.</li>
<li>If you&#8217;re on Windows, let the HTC Sync installer install the prerequisites (including drivers), but <b>do not</b> install HTC Sync itself. It comes with its own, older adb that interacts badly with the SDK&#8217;s adb.</li>
</ul></li>
<li><p>I connected the Nexus S to my computer and turned on USB debugging on the phone. Then, from the <code>platform-tools</code> directory inside the SDK folder, I issued the following command:</p>
<pre>adb backup -all -apk -noshared -nosystem -f nexus-s-backup.ab</pre>
<p>See <a href="http://forum.xda-developers.com/showthread.php?t=1420351">this guide</a> for a complete list of options for the <code>backup</code> command.</p></li>
<li><a href="http://2.bp.blogspot.com/-xBzjNmhpXmY/T5QxUjHV3dI/AAAAAAAAAE4/Mgt2D2A-wfo/s1600/Screenshot_2012-04-22-21-54-47.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="200" src="http://2.bp.blogspot.com/-xBzjNmhpXmY/T5QxUjHV3dI/AAAAAAAAAE4/Mgt2D2A-wfo/s200/Screenshot_2012-04-22-21-54-47.png" width="120" /></a>
  <p>On my Nexus S,&nbsp; a prompt (screenshot to the right) showed up asking me to enter my encryption password. I did so and moved ahead.</p></li>
<li><p>I now connected the HTC phone to my computer and turned on USB debugging. There&#8217;s one more thing I needed to do: in Settings -&gt; Developer Options, set the Desktop Backup Password to the encryption password from step 3.</p></li>
<li><p>I then issued this command from the <code>platform-tools</code> directory:</p>
<pre>adb restore nexus-s-backup.ab</pre>
<a href="http://2.bp.blogspot.com/-ui-sNZFpnT8/T5Q05vPaHEI/AAAAAAAAAFA/WaoqdV0xUqY/s1600/Screenshot_2012-04-22-22-07-06.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="200" src="http://2.bp.blogspot.com/-ui-sNZFpnT8/T5Q05vPaHEI/AAAAAAAAAFA/WaoqdV0xUqY/s200/Screenshot_2012-04-22-22-07-06.png" width="120" /></a>
<p>Another prompt (screenshot to the right) showed up asking me to type in my encryption password, even though this phone wasn&#8217;t actually encrypted. (Very confusing!). I found I had to type the encryption password from my Nexus S into <i>both</i> fields &#8211; this was the only way the restore worked.</p></li>
<li><p>I finally copied the SD card&#8217;s contents manually. That&#8217;s about it. Most apps were restored properly, and whichever apps I downloaded from the <strike>Android Market</strike> Google Play Store showed up as installed there. A few didn&#8217;t make the cut: most notably Google&#8217;s 2-step <a href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2&amp;hl=en" target="_blank">Authenticator</a>. I&#8217;m not sure why.</p></li>
</ol>
More complex than necessary, but I&#8217;m happy I didn&#8217;t have to redownload much and didn&#8217;t lose any settings or game progress. I hope for everyone&#8217;s sake that future versions of Android are better at it.</div>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[OS X mouse strangeness]]></title>
    <link href="http://www.less-broken.com/blog/2012/04/os-x-mouse-strangeness.html"/>
    <updated>2012-04-19T02:45:00-07:00</updated>
    <id>http://www.less-broken.com/blog/2012/04/os-x-mouse-strangeness</id>
    <content type="html"><![CDATA[<div class='post'>
So I decided to upgrade my Apple notebook&#8217;s OS X install to Lion earlier this week. Due to an unfortunate series of events, partly my fault, mostly Apple&#8217;s, my <a href="http://www.rodsbooks.com/gdisk/hybrid.html" target="_blank">MBR</a> was corrupted and my Windows install became unbootable. So I was stuck with OS X for a few days until I had the time to fix my Windows install.<br />
<br />
I&#8217;ve been running Windows and Linux with mouse acceleration turned off ever since I started using a <a href="http://www.coolermaster-usa.com/product.php?product_id=3021" target="_blank">high-precision mouse</a> (it&#8217;s ugly, but <i>really</i> precise and comfortable to use), and I&#8217;ve come to appreciate it a lot. OS X&#8217;s acceleration curve is very different from Windows, which is fine, but the real problem is that there&#8217;s no built-in way to turn it off. Luckily, there&#8217;s a <a href="http://itunes.apple.com/us/app/decelerate/id449448909" target="_blank">$0.99 app</a> on the Mac App Store which lets you disable acceleration. That, and bumping up the resolution of the mouse a notch, made things better.<br />
<br />
Things still felt strange, though, and once I fixed my Windows install and booted into it I realized why. <b>OS X has severe input lag with the mouse.</b> According to <a href="http://d43.me/blog/1205/the-cause-for-all-your-mac-os-x-mouse-annoyances/" target="_blank">this blog post</a>, the lag (which has been confirmed to exist by an Apple engineer) exists on all OS X installs, and on all mice and touchpads, and is 32 milliseconds. Now, 32 milliseconds might not sound like much, but I can easily tell the difference between 30 frames per second (33 ms/frame) and 60 FPS (17 ms/frame) while playing a game.<br />
<br />
Windows and Linux do not have this problem: the input lag is less than the screen&#8217;s refresh rate, so the pointer is locked on to the mouse. Both feel significantly more responsive as a result.<br />
<br />
If you&#8217;re using OS X now and are sensitive to such things, I suggest switching away until it&#8217;s fixed. You&#8217;ll be delighted you did.</div>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Offered without comment]]></title>
    <link href="http://www.less-broken.com/blog/2012/04/offered-without-comment.html"/>
    <updated>2012-04-07T07:22:00-07:00</updated>
    <id>http://www.less-broken.com/blog/2012/04/offered-without-comment</id>
    <content type="html"><![CDATA[<div class='post'>
&#8220;The bitterness, futility, and self-righteousness of most moral arguments can now be explicated. In a debate about abortion, politics, consensual incest, or what my friend did to your friend, both sides believe that their positions are based on reasoning about the facts and issues involved (the wag-the-dog illusion). Both sides present what they take to be excellent arguments in support of their positions. Both sides expect the other side to be responsive to such reasons (the wag-the-other-dog&#8217;s-tail illusion). When the other side fails to be affected by such good reasons, each side concludes that the other side must be closed minded or insincere. In this way the culture wars over issues such as homosexuality and abortion can generate morally motivated players on both sides who believe that their opponents are not morally motivated.&#8221;<br />
<br />
&#8211; Haidt,
  J. (2001). The emotional dog and its rational tail: A social
  intuitionist approach to moral judgment. <i>Psychological Review. 108</i>,
  814-834. <a href="http://www.nd.edu/%7Ewcarbona/Haidt%202001.pdf" target="_blank">Link</a> (PDF).</div>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[A pure Python library to access NTFS features]]></title>
    <link href="http://www.less-broken.com/blog/2012/04/pure-python-library-to-access-ntfs.html"/>
    <updated>2012-04-04T02:33:00-07:00</updated>
    <id>http://www.less-broken.com/blog/2012/04/pure-python-library-to-access-ntfs</id>
    <content type="html"><![CDATA[<div class='post'>
I&#8217;ve written a small Python library to access Microsoft NTFS <a href="https://en.wikipedia.org/wiki/Hard_link" target="_blank">hard links</a> and <a href="https://en.wikipedia.org/wiki/NTFS_junction_point" target="_blank">directory junctions</a>&nbsp; that&#8217;s<br />
<ul>
<li><strong>Pure Python:</strong> no C or pywin32</li>
<li><strong>Easy-to-use:</strong> the API follows Python&#8217;s own link APIs closely</li>
<li><strong>BSD licensed:</strong> thanks to the Mozilla Foundation.</li>
</ul>
You can <a href="https://github.com/sid0/ntfs" target="_blank">get it on GitHub</a>.<br />
<br />
<b>Update 20/4: </b>Thanks to <a href="https://github.com/lck" target="_blank">Roman Lacko</a> the package is now <a href="http://pypi.python.org/pypi/ntfsutils" target="_blank">on PyPI</a>. To install, run <code>pip install ntfsutils</code>.</div>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[If your build breaks with a PLY "invalid syntax" error on "dictionary"...]]></title>
    <link href="http://www.less-broken.com/blog/2012/03/if-your-build-breaks-with-ply-invalid.html"/>
    <updated>2012-03-13T23:38:00-07:00</updated>
    <id>http://www.less-broken.com/blog/2012/03/if-your-build-breaks-with-ply-invalid</id>
    <content type="html"><![CDATA[<div class='post'>
&#8230; make sure there aren&#8217;t files called xpidllex.py and xpidlyacc.py in $topsrcdir/xpcom/idl-parser.<br />
<br />
Removing them, and whatever .pyc files are in there, and then doing a clobber build should fix things up.</div>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Paper voting is broken]]></title>
    <link href="http://www.less-broken.com/blog/2012/03/paper-voting-is-broken.html"/>
    <updated>2012-03-10T15:49:00-08:00</updated>
    <id>http://www.less-broken.com/blog/2012/03/paper-voting-is-broken</id>
    <content type="html"><![CDATA[<div class='post'>
An interesting link popped up on Hacker News today: the <a href="http://www.wombat-voting.com/" target="_blank">Wombat voting system</a>. It&#8217;s part of a long line of electronic voting systems (including <a href="http://heliosvoting.org/" target="_blank">Helios</a>, created by <a href="http://ben.adida.net/" target="_blank">Ben Adida</a>, now at Mozilla) that aim to use cryptography to ensure the privacy and integrity of votes.<br />
<br />
Of course, Hacker News, being the contrarian, negative community that it is, immediately <a href="http://news.ycombinator.com/item?id=3687744" target="_blank">shot it down</a> by claiming that &#8221;<span class="comment"><span style="color: black;">we don&#8217;t need computers in voting&#8221;, that such systems attempt to &#8221;</span></span><span class="comment"><span style="color: black;">fix a problem which don&#8217;t exist&#8221;, </span></span><span class="comment"><span style="color: black;">and that such systems alienate &#8221;</span></span><span class="comment"><span style="color: black;">common people without IT education&#8221;.</span></span><br />
<br />
It&#8217;s sad to see people &#8211; on <i>Hacker News</i> of all places &#8211; being Luddites.<br />
<br />
Paper voting is fundamentally broken, and will continue to be as the world&#8217;s population increases. The reason&#8217;s simple: <b>it doesn&#8217;t scale</b>. The <a href="http://en.wikipedia.org/wiki/Indian_general_election,_2009" target="_blank">last Indian general election</a> had over 417 million people casting votes. <b>417 million.</b> Imagine the sheer amount of time and resources it would take to count 417 million votes, and the possibility of error that might happen with improperly marked ballots, etc.<br />
<br />
Fortunately, Indian elections haven&#8217;t had paper voting for a while. They&#8217;ve instead had <a href="http://en.wikipedia.org/wiki/Indian_voting_machines" target="_blank">standalone voting machines</a> that keep a tally of votes for each candidate and reveal them on counting day. However, the election commission of India expects citizens to trust these machines on their word, and it&#8217;s been shown that these machines are actually quite <a href="http://indiaevm.org/" target="_blank">vulnerable to fraud</a>.<br />
<br />
So, yes, the problem exists, and yes, we need computers to solve it. I&#8217;m glad to see brilliant minds hard at work on solutions. Democracy&#8217;s far too important to let voting systems not be <a href="http://en.wikipedia.org/wiki/End-to-end_auditable_voting_systems" target="_blank">end-to-end auditable</a> by anyone with the requisite knowledge.<br />
<br />
One last note: do people feel alienated when they check their email, type in their credit card number on a shopping site, or operate their bank accounts over the Internet without 
knowing all the mathematics and engineering making sure no one else is reading their data? The way crypto, and scientific knowledge in general, has always worked is that you either (a) have domain knowledge that lets you verify what is being said, or (b) trust others who do.</div>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Dissent]]></title>
    <link href="http://www.less-broken.com/blog/2012/03/dissent.html"/>
    <updated>2012-03-08T02:52:00-08:00</updated>
    <id>http://www.less-broken.com/blog/2012/03/dissent</id>
    <content type="html"><![CDATA[<div class='post'>
Over the last two days, I&#8217;ve read a number of blog posts I disagreed with. A couple of them allowed me to comment, so I did so.<br />
<br />
On one of them, my comments are still up.<br />
<br />
On the other, which adopted a roughly antipodal view, my comments were summarily deleted and I was told I was &#8220;derailing and silencing&#8221; the conversation by accusing the author of being &#8220;overemotional&#8221;, &#8220;oversensitive&#8221; and &#8220;taking things too personally&#8221;.<br />
<br />
Before today, if you&#8217;d asked me which post that would have happened with, I&#8217;d have picked the first without a second thought.<br />
<br />
Guess I have a lot to learn.</div>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Dr. Seuss and the halting problem]]></title>
    <link href="http://www.less-broken.com/blog/2012/02/dr-seuss-and-halting-problem.html"/>
    <updated>2012-02-01T04:26:00-08:00</updated>
    <id>http://www.less-broken.com/blog/2012/02/dr-seuss-and-halting-problem</id>
    <content type="html"><![CDATA[<div class='post'>
The <i>unsolvability of the halting problem</i> is a well-known fundamental result which says that it&#8217;s impossible to write an algorithm that determines if an arbitrary program halts given some input. It also implies a lot of other things &#8211; including, for example, that there&#8217;s no general way to determine whether a particular variable in a program has a particular value at a point, and famously, that <a href="http://www.scottaaronson.com/blog/?p=710" target="_blank">every consistent formal system powerful enough to do arithmetic in will have unprovable statements</a>.<br />
<br />
I&#8217;m not going to talk much about it, though &#8211; instead I&#8217;m going to direct you to this extraordinary proof, written in verse, in the style of Dr. Seuss. It&#8217;s called <a href="http://www.lel.ed.ac.uk/%7Egpullum/loopsnoop.html" target="_blank">Scooping the Loop Snooper</a>, and it was written by <a href="http://www.lel.ed.ac.uk/%7Egpullum/" target="_blank">Geoffrey K. Pullum</a>, who you might also know from posts at the <a href="http://languagelog.ldc.upenn.edu/nll/" target="_blank">Language Log</a>. Wow.</div>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Important upcoming change: starting Gecko 12, pre-Windows 7 SDKs will no longer be supported]]></title>
    <link href="http://www.less-broken.com/blog/2012/01/important-upcoming-change-starting.html"/>
    <updated>2012-01-26T09:57:00-08:00</updated>
    <id>http://www.less-broken.com/blog/2012/01/important-upcoming-change-starting</id>
    <content type="html"><![CDATA[<div class='post'>
<b>tl;dr:</b> if you&#8217;re on an outdated Windows build configuration, upgrade.<br />
<br />
I just checked in <a href="http://hg.mozilla.org/integration/mozilla-inbound/rev/3950aa85276d" target="_blank">a patch</a> to mozilla-inbound to drop support for SDKs prior to the Windows 7 SDK. Depending on when you last updated your build configuration, your Mozilla build might break.<br />
<br />
Everything&#8217;s documented on the <a href="https://developer.mozilla.org/En/Windows_SDK_versions" target="_blank">Windows SDK versions</a> page on MDN; here&#8217;s a quick summary of what you need to do:<br />
<ul>
<li><b>If you&#8217;re on Windows 2000:</b> Upgrade to Windows XP, Vista or 7.</li>
<li><b>If you&#8217;re on Windows XP SP1 or below: </b>Update to the newest service pack.</li>
<li><b>If you have an older SDK (Vista or 2003): </b>Install the Windows 7 SDK instead. You can either <a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;id=3138" target="_blank">download it separately</a> or use Visual C++ 10 Pro, which comes with it.</li>
<li><b>If you use Visual C++ 8 (2005) Express or Visual C++ 7.1 (VS2003)</b>: Upgrade to Visual C++ 10 (2010; recommended; pro or <a href="http://go.microsoft.com/?linkid=9709949" target="_blank">express</a>) or Visual C++ 9 with Service Pack 1 (2008; pro or <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=F3FBB04E-92C2-4701-B4BA-92E26E408569&amp;displaylang=en" target="_blank">express</a>).</li>
</ul></div>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[MSVC9+ opt builds currently broken due to a compiler bug]]></title>
    <link href="http://www.less-broken.com/blog/2012/01/msvc9-opt-builds-currently-broken-due.html"/>
    <updated>2012-01-25T03:36:00-08:00</updated>
    <id>http://www.less-broken.com/blog/2012/01/msvc9-opt-builds-currently-broken-due</id>
    <content type="html"><![CDATA[<div class='post'>
Optimized builds with Microsoft Visual Studio 2008 (VC9) and above are currently broken because of what we believe is a compiler bug. More information and workaround in <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=718541" target="_blank">bug 718541</a>.</div>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[C# 5.0 to have fresh bindings per iteration]]></title>
    <link href="http://www.less-broken.com/blog/2012/01/c-50-to-have-implicit-fresh-bindings.html"/>
    <updated>2012-01-18T02:08:00-08:00</updated>
    <id>http://www.less-broken.com/blog/2012/01/c-50-to-have-implicit-fresh-bindings</id>
    <content type="html"><![CDATA[<div class='post'>
<a href="http://stackoverflow.com/a/8899347" target="_blank">Straight from Eric Lippert</a>. Great news. Now if only ECMAScript Harmony included a fix for <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=449811" target="_blank">this bug</a>&#8230;</div>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[More experiences with an Apple notebook]]></title>
    <link href="http://www.less-broken.com/blog/2012/01/more-experiences-with-apple-notebook.html"/>
    <updated>2012-01-14T04:55:00-08:00</updated>
    <id>http://www.less-broken.com/blog/2012/01/more-experiences-with-apple-notebook</id>
    <content type="html"><![CDATA[<div class='post'>
<div>
It&#8217;s now been eight months since I got my first Apple notebook. A few months ago I wrote about <a href="http://monogatari.doukut.su/2011/07/my-experiences-with-apple-notebook.html" target="_blank">my initial opinion</a>, where I was pretty sure it would be my last Apple notebook too.<br />
<br />
Since then I&#8217;ve had the chance to use it in a variety of situations. Spoiler: none of what I&#8217;ve seen has improved my opinion of it one bit.<br />
<ol>
<li>The decision to make the outer body out of aluminium is literally shocking. If the notebook isn&#8217;t plugged in to a grounded socket (for instance, <b>if I&#8217;m using the plug that comes with the power brick BY DEFAULT</b>), I&#8217;m liable to get electric shocks if I touch the casing. I received a couple of shocks, a mild one and a jolting one, before I realized what was happening. Electrical common sense is that if the outer surface is electrically conducting, it MUST be grounded properly. Having an ungrounded plug by default, or even having one in the first place, is inexcusable. (<b>Update:</b> I&#8217;ve had several people complain to me about this, and one person also complain about his plastic macbook&#8217;s screws shocking him several times. I&#8217;m clearly not the only one with this issue.)</li>
<li>The Wi-Fi reception is the worst I&#8217;ve ever seen in a laptop, and only slightly better than the reception my Nexus S with its puny little antenna gets. Friends tell me it&#8217;s because the aluminium casing acts as a Faraday cage and attenuates the signal. The &#8220;unibody&#8221; marketing&#8217;s clearly far more important to Apple than shipping a working product. (<b>Update:</b> guess <a href="http://support.apple.com/kb/HT1365" target="_blank">who says</a> metal has a &#8220;very high&#8221; potential to interfere with wireless connections?)</li>
<li>The original power adapters were T-shaped. However, presumably because Apple didn&#8217;t like the look of and subsequently didn&#8217;t include the strain-relieving flexes found on all other cables, they were easily <a href="http://www.gadget.com/files/2011/11/magsafecharger.jpg" target="_blank">frayed</a>. To &#8220;fix&#8221; this, they started using <a href="http://upload.wikimedia.org/wikipedia/commons/thumb/b/bc/Right_Angle_Magsafe.jpg/250px-Right_Angle_Magsafe.jpg" target="_blank">L-shaped</a> adapters. Of course, what it now means is that depending on the way I insert it, either the power cord blocks the Ethernet port or it gets subjected to strain if I tilt the notebook back.</li>
<li>There&#8217;s no VGA, DVI or HDMI port, so I need to carry around a set of three dongles everywhere I go. There&#8217;s plenty of space on the left side, too, so that&#8217;s not an excuse.</li>
<li>The lack of working sleep is more annoying than I thought it would be. Amazingly, the EFI equivalent to the POST takes almost as long as Windows resuming from hibernation. A few people seem to be working on <a href="http://forums.macrumors.com/showthread.php?t=696523" target="_blank">getting Windows to boot via EFI</a>, and my hopes are mostly pinned on that.</li>
</ol>
My iPod nano media player, the only other Apple product I own, is actually well-designed (save for the fact that I need to keep the piece of crap called iTunes around on my computer, even though <a href="http://yuo.be/ipod.php" target="_blank">I don&#8217;t need to use it</a>.) This is not. This stinks of form-over-function failure.<br />
<br />
<b>Edit (25/1): </b>Two inline updates. </div></div>
]]></content>
  </entry>
  
</feed>
