After much head-wall-banging, I got a Wiimote to pair successfully with my computer and work as a controller in Mupen64plus! There was a lot of trial and error, so I've created a guide to getting a working setup so future generations don't have to go through what I did. The details are in this git repo, which includes detailed instructions and config files.
Monday, December 17, 2012
Wednesday, December 12, 2012
Against my better judgment, I am going to take another shot at installing a ROM on my phone. The battery life could use some improvement, and people have claimed that some of the 3rd-party ROMs can help with that. I know I have promised myself not to play with ROMs on my phone again, since the result is usually a big waste of time with nothing to show for it, but this time is different.
Brace yourselves for a follow-up in which I immediately regret this decision.
Tuesday, December 11, 2012
I updated to 12.10, and Alt+middle-click to resize windows was broken. After about an hour of circular Googling, I found the correct incantation to sprinkle. For some strange reason, the setting
org.gnome.desktop.wm.preferences.resize-with-right-button was set to
true. Set it back to
false and the system returns to its former functioning state.
Sunday, November 18, 2012
In addition to equality matches, it can match using regexps and arbitrary functions. Let's see Java do that in 20 SLOC.
Saturday, September 29, 2012
This is copy of an email I sent to my dad just now.
My concern about the libertarian candidate, besides the fact that he cannot win,
That's no reason not to vote for him. A well-functioning democracy requires a choice of more than the people who are "obviously" going to win. Otherwise, it isn't democracy so much as a decree by the political parties who will be the next president.
My is that his economic plans are hopelessly naive. He pretends that, given Congressional cooperation, one could dramatically cut spending in 2013.
Again, for democracy to work, you need people who are going to do more than what will easily pass.
My The prospect of a much smaller cut is labeled the fiscal cliff and would send us into recession.
I'm not so sure it would be quite that bad. It strains credulity for a trillion-dollar increase in federal spending to be little more than an academic nuisance, but a symmetric decrease to bring about the apocalypse.
I might love to see federal spending go down to 15% of GDP, but if that happened in one day we would have a depression that would make the 1930's look like the good old days.
It just seems weird that spending can shoot up by an enormous margin in one year, but for it to drop by the exact same amount would throw the country into ruin. As a counter-example, I would point to the demobilization following WWII. Government spending fell through the floor, yet the economy boomed, even as it had to absorb the mass of people coming home from the war.
Since Obama will carry MA by a landslide, I want the message of my protest vote to be unambiguous. Voting for Romney says my concern is economic. Voting for a fringe candidate could mean anything.
Well, the fringe candidate has a much clearer message: that neither of the two parties offer particularly attractive directions for the country and that both parties are to blame for the mess we're in.
Besides, whether you vote Democrat, Republican, Libertarian, Green, Wizard, or not at all doesn't make a measurable difference in the outcome of the election, so you might as well vote for your highest preference. See the paradox of voting.
Since you personally are never going to be the tiebreaker, vote for the person who most closely matches your preferences. But what if everyone thought that way? They don't. You are not a collective. And your choice of candidate does not effect a change in other people's voting behavior.
As long as the Republicans hold the House we may stave of the Spanish food riots here. I have great sympathy for them, but they are still thinking there is the alternative of just spending more of that free money.
Incidentally, this is one of the reasons I am in favor of a smaller role for government: there's no one to whom to complain when things don't go your way. People riot against the government in the hopes that the bureaucrats will deign to bestow to each according to his need. Against whom do I riot if the ending of Mass Effect 3 is a major letdown? I can raise money for charity in protest of the botched opportunity, or send ending-related colored cupcakes to the developer's offices (both of which people did), but that's about it. The most impactful thing I can do is refuse to buy their products in the future, since I possess all of the power in that relationship. I bear the burdens and benefits of my actions.
When the target of protest is the government, on the other hand, I can lobby or attempt to vote myself a job and cash. Politicians can try to sell me a free lunch, and since my vote is infinitesimal, which way I vote doesn't have any personal ramifications. It is quite understandable that the Spanish and Greeks want jobs, but when the government is seen to be the solution to unemployment, the focus changes from job creation to job bestowment.
Thursday, September 20, 2012
Like any virtuous person, I use Emacs for everything, and so tried out using
Emacs key bindings for all GTK applications generally. After a year or so of
working like this, I have decided to go back. The main problem is that other
applications can't handle the awesome power of Emacs. Firefox, for example, uses
C-k to jump to the search box, but if you are in the location bar,
C-k will run the equivalent of
kill-line which means
that in order to get to the search bar, you have to remove focus from the
location bar. Not convenient.
Since I do all serious typing within Emacs anyway (using the It's All
Text! addon to edit
textareas in Emacs), I figured I might as
well take full advantage of the standard key bindings of the lesser
A lot of the guides online talk about editing
/desktop/gnome/interface/gtk_key_theme through Gconf, but
this has ceased to work under Gnome/GTK 3. To fix it, you need to set the value
gsettings (which uses
dconf>) rather than
$ gsettings reset org.gnome.desktop.interface gtk-key-theme
Why would they break backwards compatibility? Who knows. Also, due to the
brilliance of the Gnome 3 developers, the data for
dconf is stored
in some opaque binary blob, rather than the straightforward XML files used by
gconf. This is a huge step backwards from the Unix
philosophy for what appears to be no change in functionality.
It's things like this, along with brain-dead vomit that is Gnome Shell (or Unity), that have convinced me that all of the Linux desktop developers have simultaneously taken crazy pills and have gone insane. Why else break perfectly good code and interfaces in favor of less functional and less useful crap?
Thursday, September 6, 2012
This is an older idea which had been floating around in my head, half-finished for a few years.
I was inspired by this Ars Technica article to think about the relationship between network operators — both cellular and landline — and consumers. The key quote from the article is by "one mobile operator" and is:
Some people like 3 may be in a position where it could make sense to accept that. But if you spend upwards of £40m per year building your brand, you don't want to be just a dumb pipe do you?
This is the fundamental tension between consumers and network operators: one wants internet access to be a commodity, the other doesn't. Why should I care about their brand? Electricity or water utilities don't have a brand. In most (all?) cases, they are government-granted monopolies, so there isn't any choice, but still, the only time I think about a water or electric company is once a month when the bill comes due. The only thing in the world I want from those companies is that when I plug in a lamp or turn the faucet, electricity or water comes out, (hopefully!) respectively. I want the same to be true of ISPs. It annoys me that the word "Verizon" is printed on back of my phone; we would think it bizarre if refrigerators had "National Grid" printed on the doors.
Luckily, we have been moving in this direction since the article was written. The incredible explosion of smartphones has put huge competitive pressure on text messaging, to the point where basically all plans have unlimited voice time and text messages, removing that significant avenue of differentiation. There's less and less room for the networks to do much of anything aside from providing a pipe to the public internet. Despite the fears of Network Neutrality advocates (of which I was formerly one) and a lack of legislative action, no traffic discrimination has taken place. Gradually, the carriers are being ground down into commodities, forced to compete only on quality, coverage, and price, and having their profit margins squeezed ever tighter.
We live in glorious times.
Thursday, August 2, 2012
language. I just ran into a situation in which I needed to apply an S3 generic
function to a list (actually, a row-wise iterator on a
and hit an annoying rough patch
For those not as well-versed in R (I've been learning it for about two weeks at
this point), "method dispatch" is done in a quirky yet effective way. You define
a generic function, say
Which means "when
foo()is called, dispatch to the function
matching the class of
bar". Setting the class and calling the
generic method is simply:
foo(bar)causes R to look for a function named
foo.myClassand calls that. If
defined, it will try to call
foo.defaultand if none of those functions exist, it will throw an
You might have noticed that
UseMethod("foo")doesn't pass along the
foo. R passes the arguments along automagically.
If you want to apply a function to each element to a list, R makes it easy:
identical()do what you would expect.
There are a bunch of variants of
apply; RTFM for the details.
Now let's say we want to call
identity. There are some complications:
This throws an error because
UseMethod()tries to dispatch on the
class of its first argument, which is a string
"character", in R parlance). One way to make this work is to
reverse the order of the arguments so the iteration variable comes first and
UseMethod()to dispatch on a different argument:
Yuck! Wouldn't it be great if there was an easier way? Preferably one which
doesn't involve hacking R's method dispatch system? Well luckily, there is. We
take advantage of the fact that R can use named arguments:
It's a bit wonky when coming from normal languages, which wouldn't appreciate a
named argument being assigned to a variable earlier in its argument
list. Again, R is amazingly bizarre and bizarrely amazing. The explicit naming
quuxcauses it to be "used up" from the argument list, so that
any remaining arguments are assigned to the "unclaimed" variables. Taking
advantage of this feature of R lets you apply a generic function to a list (or
other iterable R objects) without having to mess around with its
Hopefully this spares a fellow hacker the pain of digging through R's
documentation on method dispatch.
Thursday, July 5, 2012
Monospacefont doesn't support italics, I set about trying to find a suitable replacement. This EmacsWiki page lists a way to print some example text in all of the fonts on the system, which is very helpful for comparing what's available. The problem with it is that it displays all fonts, not just the monospace fonts, which isn't useful. (For those of you not in the know, all programming is done with monospace or uniform-width fonts, meaning that
mare the same size).
I modified the code so that it displays only monospace fonts. There's probably a property on the font family which one could check, but I used a much more primitive method: measure the pixel width of 5 consecutive lowercase
Lcharacters and 5 lowercase
Mcharacters. If they are the same, then the font is monospaced.
It isn't perfect (it has a couple of false positives, such as
courier 10 pitch), but it's close enough to be a big improvement.
Tuesday, June 19, 2012
Monday, June 18, 2012
Short version: there's been minimal to negative austerity since pre-meltdown 2008.
Friday, June 8, 2012
sudo aptitude install libapache2-svnunder Ubuntu turned into hours of staring at
Syntax error on line 270 of C:/Program Files (x86)/Apache Software Foundation/Apache2.2/conf/httpd.conf: Cannot load C:/Program Files (x86)/Apache Software Foundation/Apache2.2/modules/mod_dav_svn.so into server: The specified procedure could not be found.
I tried copying all of the SVN libraries into
binwithin the server root, downloading different versions from the web, and "unblocking" the libraries (Windows blocks code downloaded from the internet. Nice idea; I only wish it would tell you about it). Finally, after hours of Googling, I found some post on some forum somewhere that mentioned using the
libapr-1.dllfrom the Subversion distribution rather than Apache's would help. It did.
This would seem to undermine somewhat the idea of the "Apache Portable Runtime". But whatever; I have a working system. Now onto trying to get LDAP set up for SVN and Ubuntu. Wish me luck!
TL;DR: If Apache in Windows fails to start with
mod_dav_svn.soloaded in your
conf/httpd.confand you get this error in your Event Viewer:
Syntax error on line 270 of C:/Program Files (x86)/Apache Software Foundation/Apache2.2/conf/httpd.conf: Cannot load C:/Program Files (x86)/Apache Software Foundation/Apache2.2/modules/mod_dav_svn.so into server: The specified procedure could not be found., you can solve it by copying
Apache2.2/bin, replacing the version which ships with Apache.
Tuesday, June 5, 2012
Based on my decades of experience in the sovereign debt markets, I have come up with a perfect metaphor for what is going on in the Eurozone. It is as if the Grace government promised 200,000 people one boat each, but now that the boats are due, it turns out that she doesn't have 200,000 boats anywhere, there are only 100,000. Grace tries telling half of the people not to try to use their boat; to pretend that it is sitting in a port somewhere, waiting for them. If some people use their boat half of the week, other people can use it for the other half of the week, so it is "like" having 200,000 boats. Uncle Jeremy has 1.5 million boats, but he isn't so thrilled about just handing over a bunch of his boats to Grace, who knew she promised more than she had. Jeremy says "I'll give you 50,000 of my boats, but only if you tell 50,000 people that they aren't getting a boat at all." Grace is furious, shouting "you're forcing boat austerity on me! I need to implement boat-growth policies!" Of course, "boat-growth policies" is a euphemism for "Jeremy gives me more boats."
Grace then proposes a consolidated "Euroboat" concept, in which all of Grace's, Jeremy's, Ira's, Talia's, and Pete's boats are lumped together and then given out to each of their citizens, regardless of how many boats each person (government) has. It just so happens that Jeremy has 1.5 million boats and has promised 750k of his citizens one boat each, but all of the other governments have promised more boats than they have, and have even promised more than the 750k spare boats that Jeremy has. Jeremy, understandably, doesn't want to give out all of the spare boats he has to people who promised more than they had, but when he tells the other people this, they get angry and call him mean names. Jeremy tries to explain that even if he was to give out all of the extra boats he has, and cut back on a bunch of the boats he already promised to his citizens, there would still not be enough boats for all the people who promised more boats than they knew they had.
Some people want their acquaintance Mario to print them a bunch of boats.
Friday, June 1, 2012
Sunday, April 22, 2012
Really quick: I wrote a simple bit of elisp to
eval a body over
each of the files in a directory, recursively. Looking around for a little
bit, I found a couple of options, including Findr, which has its
own queue implementation (pretty short), and whose main function is a whopping
find) and was simple. I ended up with this little guy:
11 lines for the main function,
recursive-files itself, and
another 3 (including docstring) for simplifying macro. It's main weakness at
this point is that it incorrectly ignores any files with leading dots. So not
only does it (wisely) avoid
.., it rather
.foo as well. I couldn't easily figure out how
.. in a single regex easily without
also excluding leading-dot files. For what I'm doing, it's not important.
Also, note that this barfs on symlinks. It thinks they're directories and
tries to call
directory-files-and-attributes on them. Again, a
more careful implementation would deal with this.
I was surprised that Emacs didn't have a "recursively visit files" function or macro built in, but this gets me close enough. Enjoy!
Monday, February 27, 2012
And set your login session to "Gnome fallback". This gives you a passable facsimile of Gnome 2 (aka "worked and was not useless" edition). I am a little... offended is to strong, but miffed that "fallback" means "what to use if you want to get work done and are not, in fact, a hipster," but whatever.
Wednesday, February 15, 2012
In yesterday's class of the Python-infused Linear Algebra course I'm taking, a fellow student noted the strange ordering of items in a
set when printed. It seemed that the printed order of the set items always swapped the first two items, but left the rest unchanged. I don't know what sets he tried, but I was interested in the general behavior, and so began my quest through the Python source code...