Wednesday, 9 November 2011
Google AI Challenge—Week 2:
I think my ants are losing faith in me, as I haven’t uploaded a new version of my AI to the official server for a couple days now. New things are still in the pipeline, but I’ve lost my last 3 matches (though my opponents were ranked higher than me and probably deserve it too).
IU now has more than 5 people with active submissions, but the upcoming CS Club Hackathon will change that! I’m excited to co-organize the hackathon, which will consist of an all-day coding party dedicated to writing an ants AI. Dustin and I, as organizers, will be running matches and generally running things, and since we already have entries in the competition, we’ll be helping other aspiring antlords to get their own AI up and running.
Thanks to the school, we should have a competition server up and running soon, as opposed to running an unofficial TCP server. Prizes will also be offered to our hackathon winners, so I hope to see some creative strategies. I expect that there will be somebody wanting to use Haskell or JavaScript, but we’ll see how far they get.
Of course, I’ve been thinking about people’s choices of languages in the competition. The top-ranking bots are mostly “industry” languages like C++, Java, and Python, but there are a couple bots written in Go, OCaml, and Pascal up there. There’s definitely a trade-off between compiled languages like C and C++ and higher-level languages like Java and Python. In this competition, time is becoming a sticking point on many bots—you simply can’t run A* on as many ants in Java as you can in C. On the other hand, the time I’ve spent debugging memory errors could have probably been spent on improving my AI strategies.
Language designers are working to pull together this gap between productivity and speed: Google’s Go combines garbage collection and better concurrency models with the spirit of C, and Rust is another interesting but young language out of Mozilla. In the meantime, Java bot writers in the competition are just making do with timers to keep track of when to stop their calculations.
Posted in Programming | No Comments »
Wednesday, 12 October 2011
Walking back from Falafels today with CS majors, we somehow began discussing strange sorting algorithms.
A good sort to know (not really) is bead sort. Imagine you have a bunch of beads on rods, like an abacus, and cross-wise they represent numbers. If you simply tilt the whole thing over, then gravity will let them all fall and they’ll sort themselves. For example, we have the numbers 3, 2, 4, and 2 read horizontally. When they fall, we get 2, 2, 3, 4. Easy!

Another sort, “random sort,” “shuffle sort,” or the more common name “bogosort” was suggested as a good example of an O(?) algorithm. But, as people have pointed out, if the quantum many-worlds theory holds, then you could sort in O(n) time: Use true quantum randomness to randomize the list and if the list is not sorted, then destroy the universe. The only universe that remains will have a sorted list.
Finally, Graham showed me the wonders of sleep sort. I’ll just leave the bash source code here:
[bash]
seq="1 9 2 3 5 6 4 7"
for i in $seq; do
(sleep $i;echo $i)&false;
done
[/bash]
Posted in Programming | 1 Comment »
Tuesday, 11 October 2011
Git-dude is a cool little thing. Given a directory of git repos, it continually fetches updates and displays a popup if you get any new commits. When I first saw it on Google Plus, somebody inexplicably commented, “This is a neat thing and I dont [sic] think there is a mercurial equivalent.”

Given that Git and Mercurial are isometric for most intents and purposes, this baffled me. Clearly, this could not be some special Git-exclusive functionality. I dug into the git-dude source code and found out it was little more than a single bash script that pipes some git commands through sed and awk.
A few minutes later, I made hg-dude, which offers similar functionality for Mercurial. There’s a couple things that aren’t supported. Git-dude offered special notifications for tags and branches, and I didn’t translate them to Mercurial because the concepts, even though they have similar names, don’t quite match up. Regardless, it is still as useful as git-dude for commit notifications, which I expect is the primary usage.
Some may notice the irony of hosting a Mercurial tool on Github, but that was the easiest way to preserve its history from its git-dude days. Bitbucket fans can check out hg-dude’s Bitbucket repo.
Get hg-dude at Github or Bitbucket.
Posted in Internets, Programming | No Comments »
Sunday, 9 October 2011
Let’s say you have some private-key (symmetric-key) encryption scheme. It takes a key and a message, and outputs a ciphertext. Nobody without the key can decrypt the message using the decrypter. Is that secure? Not if it’s deterministic.
(more…)
Posted in Math, Security | No Comments »
Thursday, 6 October 2011
It’s hard to put Steve Jobs into words, but I will forever remember him as a leader who didn’t let critics stop him from accomplishing so many things. We as a society tend to complain about Apple products being overhyped and to mock Apple’s “magical” and “revolutionary” labels, but the critics are uncomfortable because there’s truth under that glossy marketing.
Simply compare tablets before and after iPad, smartphones before and after iPhone, mp3 players before and after iPod, and even personal operating systems before and after OS X. Apple has been constantly setting the goalposts of the technology industry year after year, leaving its competitors struggling to keep up, and they have been and still are profiting enormously.
In the capitalist ideals of our society, isn’t that commendable? Millions of people were willing to pay the sometimes-high price for Apple products not because Steve Jobs really had a reality distortion field or that they were actually just gullible. Fool me once, shame on you, fool me twice, there’s something in the water? Millions of people returned to Apple time after time because Apple had a responsibility and consistently fulfilled it: make products that are ground-breaking yet polished in a way that leaves one wondering how life existed before.
Apple wasn’t interested in esoteric technologies to publish in research journals. When they found something good, they did what seemingly nobody else could: bring it to everybody. It was the ultimate intersection of technology and people. And Steve’s legacy isn’t limited to Apple: NeXT brought revolutionary computing ideals to fruition and without Steve, Pixar would have never went on to produce films like Toy Story and Finding Nemo.
Some companies settle into complacency and some pioneers settle into a dull CEO life. Bill Gates, Marc Andreesen, Larry Ellison… they are still around and active, but when was the last time they stunned us with innovation? Nobody else has come close to Steve Jobs in transforming technology over and over. Steve Jobs saved the best for last, and because we knew he would have continued wowing us year after year, it’s a shame that his time has come. Rest in peace.
Posted in Uncategorized | No Comments »
Sunday, 25 September 2011

In my defense, I was trying to give an exact number.
Posted in Math | No Comments »
Wednesday, 21 September 2011
Here are the iOS keycodes for the keyDown and keyPress events in JavaScript as generated by an iPad running iOS 4.3.3:
(more…)
Posted in Hardware, Internets, Programming | 5 Comments »
Wednesday, 14 September 2011
“To perform the requested action, connection information is required.”
My earlier post on WordPress with NearlyFreeSpeech.net was too hastily written. There are more issues than WP not wanting to use the direct upgrader, and editing WordPress code is not the right way to solve it either.
Problem 1: WordPress doesn’t want to use the direct upgrader. You can force it to use the direct upgrader by adding define('FS_METHOD', 'direct');
to /wp-config.php
.
Problem 2: WordPress may not have write access to certain directories. The wp-content directory, for example, would need to be chgrp to web and chmod to 775 in order for WordPress to update the things within. Of course, there is the option of just doing that on all of your WordPress files.
Problem 3: WordPress will create files that you cannot edit. Files created by PHP will be owned by user ‘web’ and the permissions will be 644. That means you (“me”) cannot edit these files over SSH since you are not the owner. You can’t even delete, chown, or chmod the files. You’ll either have to get PHP to delete them or ask NFSN support to chown them for you. A workaround is to umask(002);
to your wp-config.php, which makes files created by PHP group-writable. They will still be owned by web by default, but at least you can do something about it.
Problem 4: The default temp directory may not be accessible by PHP. NFSN’s FAQ for installing WordPress has instructions about this and a variant is given here. First, make a directory called ‘tmp’ in your WordPress root and give PHP permissions to write to it (chgrp to web and chmod to 775). Then, add define('WP_TEMP_DIR', dirname(__FILE__).'/tmp');
to your wp-config.php file.
Posted in Internets, Linux, Programming | 4 Comments »
Tuesday, 13 September 2011
We’ve all known that Apple iDevices are superior to their competitors, but until now, we haven’t looked into a critical factor—their ability to save your life.
To compile the following charts, a Google search was conducted for “X saved my life” where X is a value from the left side of the chart. The number of results are reported by Google was then recorded as the data point.
“_____ saved my life”

(more…)
Posted in Hardware | No Comments »
Sunday, 11 September 2011
If your cellphone didn’t come preconfigured for T-Mobile (e.g. iPhone), you may need these APN settings to access the Internet:
APN: internet2.voicestream.com
Leave the username and password blank.
Posted in Internets | No Comments »