2009-09-06

More LaTeX document classes: resume and cover-letter

I was making a resume and cover letter to apply to some internships recently, and I was trying to use res.cls and letter.cls to make them. But whenever I wanted to tweak something, the complexity and TeX-ness (as opposed to LaTeX-ness) of these standard document classes made things more difficult than I liked.

So, since what I wanted was fairly simple, I decided to reinvent the wheel with the resume and cover-letter classes. Here's the source, screenshot and usage for each.

resume.cls

Usage:
\documentclass{resume}

\name{Ankur Dave}
\addressone{1234 Abc Road}
\addresstwo{San Jose, CA 95101}
\phonemobile{555-555-1212}
\phonehome{123-456-7890}
\email{ankurdave@gmail.com}
\website{http://ankurdave.com}

\begin{document}

\maketitle
\thispagestyle{empty}

\section{Experience}

\employer{Berkman Center for Internet and Society at Harvard University}
\location{Cambridge, MA}
\jobtitle{Summer Intern}
\dates{July---August 2009}
\begin{position}
Position description.
\end{position}

\section{Education}

\schoolname{Interlake High School}
\dates{September 2006---June 2010}
\begin{school}
Description.
\end{school}

\end{document}


cover-letter.cls

Usage:
\documentclass[12pt]{cover-letter}

\address{
Your address and contact info
}

\recipientaddress{
Recipient's address
}

\date{\today}

\begin{document}

\maketitle
\thispagestyle{empty}

Cover letter body

\end{document}

2009-07-15

Getting started at the Berkman Center

It's been a week since I arrived in Cambridge for my internship with Harvard's Berkman Center for Internet and Society. It's been fun and interesting living on my own and working at the Berkman Center.

I'm working in the HerdictWeb team, which runs the Herdict web site. HerdictWeb's goal is to detect Internet censorship around the world through large volumes of reports by a community of volunteers in different countries. It's an effort to use the power of the crowd (also known as "crowdsourcing") to create transparency in governments around the world. The Herdict project is run by Prof. Jonathan Zittrain.

My first task in HerdictWeb is to create an alert system similar to Google Alerts that allows users to sign up for email alerts based on changes in Herdict censorship report data. The alerts would have three parameters:
  • Content (a country or a site) -- a reporter might want updates on reports in Iran, and a site owner might want updates on reports regarding their site.
  • Threshold (a number of reports or a percentage change) -- the level of the reports before the alert is triggered. For example, an alert should only happen when 20 reports in Iran happen in a day, or when the number of reports in any country increases by 20% over the previous day.
  • Frequency (a time period) -- a cap that prevents alerts from being sent more frequently than specified. For example, an alert may be triggered at maximum once per day.


Normally, the alert project is at most a week-long project, but it's complicated by the fact that I'm not yet entirely familiar with the HerdictWeb codebase, and in fact neither is anyone else on the team (two others) -- they're new to the project as well. In addition, the previous developers of the project seem not to have checked in a full build configuration to revision control, so even after I was able to get the project to build, a lot of the output was missing. As a result, I've spent the past week setting up the build environment and reading different parts of the project's code.


More generally, life so far in Cambridge has been pleasant. I'm living in an apartment that I'm renting from my cousin, and my two roommates are nice (if a little messy). I've been cooking my own meals based on instructions my mom wrote for me, which has turned out to be surprisingly easy and tasty. There's a Whole Foods two blocks away and a Trader Joe's not much further, so buying groceries is very easy.

My uncle, who lives in Syracuse, NY, lent me his bike while I'm here, and that's been really helpful. Even though everything I need to do day-to-day is within a two-mile radius of my apartment, having a bike makes it possible to go back and forth between the Berkman Center's two offices without thinking twice. There are plenty of bike lanes around Cambridge, but most streets are one-way, complicating my routes a little.

So overall, Cambridge is better than I expected, and independence is a nice feeling!

2009-04-06

Creating your own LaTeX document class

I've been using LaTeX for a few years, and every time I make a new document, I always start by copying a similar document I've made in the past. So over time, the preamble to each document—the header, where formatting and package includes go—has kept getting bigger. And since I frequently create new commands to simplify things while I'm writing a document, those document-specific commands end up in unrelated documents.

For example, I wrote my IB Extended Essay last year, and the formatting I used (1-inch margins, ruled headers and footers with my IB candidate number, 3-point paragraph skips, etc.) became my standard formatting for all IB documents. So whenever I was starting a new IB assignment, I copied my Extended Essay, often neglecting to delete the unnecessary document-specific commands like the following:
\newcommand{\class}[1]{\texttt{#1}}
\newcommand{\method}[2]{\texttt{#1.#2}}
\newcommand{\note}[1]{\textit{#1}}
\newcommand{\coderef}[2]{\ref{#1}, page \pageref{#1:#2}, line \ref{#1:#2}}
So I finally decided to package the common document types I use into custom LaTeX classes, just like the built-in article.cls class. So far, I have two classes, interlake-assignment.cls and ib-assignment.cls. Both of those let you define several fields like candidatenum and wordcount that then get printed out into an appropriately formatted title section.

That makes it possible for me to start a fully-formatted new assignment with just a few lines:
\documentclass{ib-assignment}
\title{Modeling the Course of a Viral Illness and Its Treatment}
\subtitle{IB Math HL Type II Portfolio}
\author{Ankur Dave}
\candidatenum{0844-028}
\updateheaders % a bit of a kludge to get the title working properly

... % document-specific packages and macros

\begin{document}
\maketitle

... % document body

\end{document}
Here's the source for the two classes, as well as a screenshot of each one being used:
ib-assignment.cls
interlake-assignment.cls
(Update 2009-04-20: I fixed the links; thanks to Lincoln Berkley from New Zealand for pointing out that they were broken.)

2008-03-22

Microsoft Seattle regional FIRST robotics competition

I just got back from the competition. Our team, Saints Robotics, didn't do so well, mainly because various components of our robot failed throughout the competition. We ended up seeding in 30th place out of 31 teams, and though the top alliance in the finals chose us to be part of their alliance (probably out of pity or impulse), our robot failed again during one of the quarter-final rounds, so we were out of the finals.

So we messed up in this year's competition. It's not that big of a deal, but what can we do next year to avoid it happening again? First let's see what went wrong.

The most important contributing factor to our failure was that we introduced unnecessary complexity. Our drivetrain, rather than using the known-good tank drive system (each side of wheels runs together) we tried to build a car-like drive system (rear wheels are powered, front wheels turn). We chose this much more complicated system in the hopes of getting more maneuverability. As far as I know we didn't have any hard evidence to back up the claim that the maneuverability justified the extra complexity. So next year we should either just use tank drive, or prototype a different system well in advance so we can really understand whether the new system is worth it.

Another problem was robustness. During most of the competition rounds, when our robot was jarred a little too hard, something would go wrong. The problems included a short in the electronics, the battery coming loose, and something bad, the details of which I never figured out, happening to the wheels. This is a hard problem to avoid, but an important countermeasure we can take is stress testing. We need to stop being so protective of the robot, getting scared if it so much as runs into a wall, and instead kick it around a bit. Run it into bricks, kick it, drop stuff on it, and so on. Also, we need to design it to be robust. The main thing we can do to that end is make sure everything is organized and planned out. One important example is the wiring. We should have a map of the electronics layout done ahead of time, with places for wires, so nothing comes loose.

Similar to the problem of too much hardware complexity, our software was too complex in similar ways. Because we had so many sensors, most of which weren't worth the complexity they introduced, we had to add lots of sensor code all over the place. Our code wasn't version controlled. This was a major problem that arose mainly because the mentor who knew how to program the sensors didn't want to use version control, instead littering the code with #ifdef's (for building for FRC or Vex) and #if 0's (for disabling code). He also didn't communicate well about what changes he was making to the code, so we were constantly confused about whether problems were caused by the software or the hardware. Next year, we will start from scratch, and I will make sure everyone on the development team understands what every part of the code does so that anyone can fix problems and no one treats the code like a magical black box. We will also only attach sensors if we are certain that their benefits will outweigh their complexity and added risk of failure. We'll keep the code under version control, and make sure to have different branches that each work around a missing sensor so we're always prepared for failures.

So we did pretty badly this year. But I'm still glad that next year at least we'll have a big list of things not to do :)

Update 2008-03-22 20:23: Well let me correct myself—we weren't second to last but rather second because the alliance that chose us finished second. Of course, we only got second because our robot died and got swapped out with a more useful one. Still, it's certainly a good feeling to be second :D

2008-03-09

Upgrading TiVo's hard drive the second time

We've had a TiVo for three or four years. It started out as an 80-hour Series 2 model, but two years ago I replaced its 80GB hard drive with a 300GB one using the Hinsdale guide. That was plenty of space until a few months ago, when we ran into the space limit again.

So we bought a 750GB drive. I tried using the same guide to upgrade the 350GB drive to the 750GB one, but the MFS Tools CD wouldn't even boot this time. I found a newer version, MFS Live, and that at least booted. But when trying to run the command to copy the contents of the old drive onto the new one, it gave the error "Backup target not large enough." I decided just to use Linux's dd (disk dump) command to do a bit-by-bit copy of the old drive onto the new one, and from there I planned to expand the copied image using the mfsadd tool provided.

I left the disk copy running overnight, and the next morning I tried to expand the image. When that didn't work (the command said the image was already expanded), I looked around and found out that you can't expand an already-expanded image. Finally, though, I found a tool that advertises that it can: WinMFS. Unfortunately, this requires Windows, but luckily I had an install of Vista lying around on my computer. So I used the MFSSuperSize and MFSadd tools on WinMFS, and that worked, resizing the image to the full 750GB.

So now we have a TiVo with around 1000 hours of recording space. That should last a few more years :)

2008-02-27

Firefox 3

I'm trying out Firefox 3 on my laptop running Ubuntu 7.10. It's a huge improvement over Firefox 2 because of three things: it's very fast, it integrates much better with the rest of the desktop in terms of UI, and it has full-page zoom.

The speed improvement is really noticeable. Opening a new tab is absolutely instant. Javascript benchmarks show it to be 10 times faster than Internet Explorer 7 (this particular benchmark was featured on Slashdot).

Firefox 3 uses Cairo/GTK2 for rendering all its page elements on Linux. (On Windows and Mac it uses the appropriate toolkits as well.) This means that it looks like any other Gnome application on my computer, and though that may seem like a small thing, it actually benefits the experience tremendously.

Full-page zoom, a feature I've always wanted in Firefox, is finally implemented in the browser. (It was implemented in various extensions for Firefox 2 but they did a pretty bad job.) Full-page zoom is where instead of the just the text size increasing, the images and the layout scale as well. It's worth noting that IE7 and Opera already have this feature.

To install it on Ubuntu Gutsy, I installed the package firefox-3.0. Unfortunately, there is one important flaw in how the Ubuntu people built the Firefox 3 package: it's not built against a version of Cairo that supports detection of the system subpixel font rendering settings. This means that the fonts have ugly color bands around their edges. In theory I could build my own copy of Firefox 3 from source with the --with-system-cairo flag, which would fix the problem, but after a few hours of reading bug reports and forums I found out that Firefox 3 requires at least libcairo version 1.5.2. The Ubuntu Gutsy repositories only include version before that. Turns out the only repository that has the correct version of Cairo is the Ubuntu Hardy repository, which means that I have to upgrade to Hardy, which is still in development, to get the correct Cairo library to be able to build Firefox 3.

I briefly considered upgrading to Hardy but decided it wasn't worth it. But Firefox 3 is good enough that I'm not giving it up just because of that font rendering problem. I'll survive with the poor rendering until Hardy officially comes out in April.

Update 1 minute after I finished writing this: Screw caution. I'm upgrading now.

Update 2008-02-28: The upgrade failed because of package dependencies (something to do with update-manager-core) and I tried to roll back but that messed up a lot of the install. So I'll just make a new partition and install Hardy directly. It's only at alpha 5, but I can manage a little instability. Also, I'm going to use the 64-bit version, so for the first time I'll get to use a 64-bit OS on my computer. Interesting how what started as an innocent attempt to try a new browser ended up in me upgrading my OS entirely... :)

2008-02-03

Virtualizing Windows XP with QEMU and KVM

For Robotics, to program the robot, we use Microchip's MPLAB IDE with the MPLAB C18 compiler. Unfortunately, those two only run on Windows. So to use them if your primary OS is Linux, there are three choices: boot to Windows, use the WINE compatibility layer, or virtualize a full Windows installation from within Linux.

My first choice was to use WINE. Unfortunately, WINE is pretty slow, annoying to use, and unreliable (the MPLAB IDE install failed for me). So I booted to Windows Vista and installed the tools there. They installed after a little fiddling with compatibility options, but booting to Vista every time I want to make a change is a pain, especially considering how slow Vista is to boot.

So my last option was to virtualize Windows (here's a tutorial if you're interested). Luckily, my laptop's CPU supports hardware virtualization extensions (it's an Intel Core 2 Duo T7200) so full virtualization should be pretty fast—around 80% of native performance. I installed the Ubuntu qemu and kvm packages. Qemu is a basic open-source emulator that can run any x86 OS. It usually runs pretty slowly, at around 10% of native. KVM is the Linux kernel module that takes advantage of the CPU's virtualization extensions to speed things up significantly.

Once those two packages were installed, I modprobe'd the kvm and kvm_intel modules and created a 3-gigabyte disk image. I installed Windows XP onto it (we have 3 or 4 copies of XP lying around, and since we either replaced those installations with Ubuntu or Vista, the copies are available for me to use). I backed up the fresh image onto an external drive and installed Office XP (same thing as above, we have a few licenses) and the MPLAB tools onto the image.

So now I have a nice virtualized session of Windows XP up that boots in around 15 seconds and is almost as fast as the real thing. Here's a screenshot of the robot code building (successfully!) under the virtual machine:

2008-01-09

Open Source as an IB Extended Essay topic

I just came back home from the IB Extended Essay presentation, and the one thing that struck me was how many people presented on the history of their country of origin. I'd estimate that three-fourths of the candidates wrote their EE on history and one-fourth on a literary topic. Probably several discussed an art-related topic, only one person (as far as I know) wrote the EE on technology (ITGS), and nobody did anything on physics or math.

Do English and history really interest so many people, or did they choose it mainly for safety in numbers? (Or because O'Byrne discouraged people from doing anything but those subjects?) I searched online for people who had chosen the sciences: math, physics or ITGS (which, since the course focuses on society so much, doesn't seem like a science at first, but at least it's grounded in computer science).

Searching with Google for "ib extended essay math" returns two promising results. The first is an IB EE topic discussion thread. Posts 43 and 44 (search the page for "#43") discuss math as an EE topic. One of the students was going to use game theory as a topic but "my supervisor told me that i couldnt expect the examiner to know anything at all about game theory." So clearly we're very limited by the readers' knowledge—game theory is not an obscure branch of mathematics by any means, so if we do math we'll probably have to either stick to the basics or explain all the more advanced concepts in painstaking detail.

The second good result was someone who had published their math/physics paper on juggling online. The paper seems pretty interesting (I only skimmed it) and the author makes moderate use of equations around the end of the paper, contrary to my expectation that the paper would be almost completely prose. Of course, the paper didn't necessarily get a good score, but at least something like this has been done and the evidence is there for us to see.

Finally, I searched around for a topic more in my area of computer science. During the presentations, I was thinking about some topics I could use in the technology area. For example, I liked the idea of doing something about how the open-source development model has influenced corporate software development, or the growing role of open-source software in society (yes, that's vague, but these are only ideas from off the top of my head). So I searched for "ib extended essay itgs open source" and I got only one relevant result: a (seemingly) official IB ITGS document that, on page 113, gave a sample prompt ("intended for guidance only"): "How Open Source software has led to improved corporate networking." To clarify, corporate networking is intended in the sense of "LinkedIn," and not in the sense of "enterprise networking with Cisco."

So I rephrased the query to "ib extended essay itgs +linux," for which I got a great result: a paper about Free-Libre Open Source Software and its future in K-12 education. This paper is really in-depth and well-researched; it even includes surveys of school sysadmins from around the world.

Anyway, I wanted to be sure that not doing an English or history paper for the IB Extended Essay was viable and proven, and it seems like it's does have some precedent. Although even if there was no precedent, I would probably still do something on ITGS, since I just can't bring myself to be passionate about history, and at best I can only be somewhat enthusiastic about English.

2007-12-27

Amarok and last.fm

I recently started using last.fm, which if you didn't know is a service that records the songs you listen to, provides statistics and recommendations, finds others with the same music taste, and allows you to sample music and music videos from related artists. I also just switched to Amarok from Rhythmbox because it seemed much more featureful.

Amarok is a great piece of software, although it takes a little getting used to. Here's a screenshot:



Last.fm is quite nice as well. Here's my music profile, which shows tracks I've recently listened to, as well as top artists and that sort of thing.

How the two integrate is pretty neat. When you play a song in Amarok, it gets "scrobbled" (to use last.fm terminology)—that is, sent to last.fm and added to your music profile. Here's how Amarok lets you reap the benefit of sending last.fm your data: Amarok has "dynamic playlists" that provide an automatic playlist of songs based on some criteron, like random selection or most-played tracks. But one setting allows you to put a few songs on your playlist and then enable the "Suggested Songs" dynamic playlist (it's enabled in the screenshot above). This allows Amarok to ask last.fm for suggested songs based on the current playlist and your account information. So you can leave it running and not have to keep refilling the queue with manually selected songs.

For more thorough documentation of Amarok, see the Amarok Handbook at docs.kde.org.

Note that Amarok is not associated with last.fm in any way except that it provides an open-source implementation of its client. It is the default player included with KDE.

2007-12-18

Shure E2c earphones

I got the Shure E2c sound-isolating earphones yesterday from Amazon for about $60. Almost all of the major reviews I could find described them as excellent earphones for both their sound-isolating properties and their audio quality. I've only used them for about a day so far, but here's a sort of review of how well they live up to the high standards I started out with.

Standard earbuds are disk-like speakers that sit on the outside of your ear, not extending into the ear canal at all. Some earbuds have a little protrusion that goes a little bit into the ear canal, but only a few millimeters. In contrast, sound-isolating earphones go pretty deep into the ear canal, up to about a centimeter. They block background noise passively, like earplugs do: by having a rubber or foam plug that stays in the ear canal. The advantages of this are that they block sound very effectively without requiring batteries like noise-cancelling headphones do, and that they won't come out when you run because they're deep in your ear. The disadvantages are that it can be hard or painful to put them in if you don't know how to do it, they collect earwax pretty easily, and (this is also an advantage) they block outside sound very effectively, so you can hardly hear someone who's standing next to you, even if you're not actively playing music.

The Shures are excellent at sound isolation. In a loud room like the school cafeteria,
the roar is literally quieter than a whisper with the earphones on. This lets you play music at low volumes and preserve your hearing, since you don't have to drown out any sound.

In terms of sound quality, the treble is amazingly crisp, and that really adds to the enjoyment of the music. The bass is very accurate (not artificially high, nor too low) when you're using a decent sound source like a computer or a good MP3 player, but with my poor-quality player, there's very little bass, so that detracts from the experience a little.

Finally, comfort. At first, it's very painful to put these earphones in. You try to push but they just don't budge, and when I say it's painful, I really mean it. But what really helps is to wet the tips a little, which makes them go in easily and painlessly as well as making a better sound-isolating seal.

So overall, I'd say these earphones are quite good—of course they're a huge step up from standard iPod/Creative earbuds, but their sound quality is actually better than even a pair of $100 non-sound-isolating Bose earphones we have. And their sound isolation just makes it even better.

Update 2007-12-20 2:20am: Shure provides three kinds of tips for the earphones: clear hard-ish PVC ones, black soft rubber ones, and orange foam ones. I had been using the black rubber ones and I always had to push them uncomfortably deep into my ears to get good isolation and sound quality, but I just tried the orange foam ones, and they're much better. They're very comfortable, I don't have to put them into my ears very far at all, and they provide even better sound isolation. The only problem is that they're not as durable as the others since they're foam, so I'll have to replace them in a few months. Also, they take longer to remove. Overall though, they make the earphones nearly perfect.

2007-12-02

Backing up Gmail

My Gmail account is pretty important to me—I've been using it since 2004 and it currently holds around 4000 emails (grouped into about 2500 threads, taking up 425 MB). I've been thinking about backing it up for a while, but I finally got around to it and succeeded after only a little frustration.

The first thing I did was configure Gmail to accept POP3 connections. I went into the Gmail settings page and, in the "Forwarding and POP/IMAP" tab, chose "Enable POP for all mail."

At first I tried fetchmail to get the emails over POP3 from Gmail. I had it all set up and everything until I discovered that it depends on a mailserver running on the local machine so it can get the messages from Gmail and send them to the local mailserver. I didn't want to go through the hassle of installing and securing sendmail or postfix, so I went looking for alternatives that would just dump the mails to a file or directory.

I found getmail (available through the getmail4 package on Ubuntu) and installed it. Here's how I configured it:

First, I set up the getmail configuration directory and the Maildir structure where the mails would go:
cd ~
mkdir .getmail/
mkdir gmail-inbox/
mkdir gmail-inbox/cur/
mkdir gmail-inbox/new/
mkdir gmail-inbox/tmp/


Then I created the file ~/.getmail/.getmailrc-gmail with the following contents:
[retriever]
type = SimplePOP3SSLRetriever
server = pop.gmail.com
port = 995
username = ankurdave@gmail.com
password = my password

[destination]
type = Maildir
path = /home/ankur/gmail-inbox/

[options]
delete = false


Finally, I launched getmail to fetch the emails:
getmail --rcfile='.getmailrc-gmail'


I had to run this command several times because Gmail serves up the emails in chunks of 400–600 mails at a time instead of giving all 4000 emails in one go. (This took a while to figure out.)

Since getmail uses the Maildir format to store its emails, I could read the emails as they were being downloaded. I ran mutt with mutt -f ~/gmail-inbox/ to point it to the mail directory.

Finally, if you have to start downloading over again for some reason, you have to tell Gmail you're starting over. In its web interface, it shows that you have downloaded up to a certain point in your inbox with the following line (available in Settings->Forwarding and POP/IMAP): "Status: POP is enabled for all mail that has arrived since 12/10/06" where the date is the date of the last message retrieved through POP. The next time you download emails over POP, Gmail only delivers mails after that date to avoid duplicates. You can reset the date by choosing "Enable POP for all mail (even mail that's already been downloaded)."

So overall, backing up my Gmail account was fairly easy and clean, and now I can be sure that all that information isn't at the mercy of Google.

Update 2007-12-02 11:04:55 PM: I just finished downloading all the email. There are 4235 messages, taking up 434 MB of space. When compressed with zip, they take up 282 MB—still pretty big, but a little more manageable.

2007-11-21

Shared hosting with GoDaddy is annoying

We bought hosting for Saints Robotics with GoDaddy (it's a "Linux Deluxe" plan). I'm trying to set up a MySQL database for MediaWiki. Our site is hosted on a shared server with lots of other users. All these users share the same Apache, the same MySQL, etc. So when I'm trying to created a new database, I can't name it anything I want—instead, I have to try to find a unique name, since someone else has taken the database name I wanted already. Also, they don't give SSH access because the server is shared. Why don't they just use virtualization? Not having shell access to my server is very annoying. (Although I could just install a PHP terminal...but SSH is so much nicer.)

Also, whenever I make a change to the server configuration, for example adding an FTP user, a MySQL database, or changing the PHP version settings, it can take up to 24 hours to apply! That's ridiculous! I can't wait a day each time I make a change!

2007-11-04

Daylight saving time...

I looked at the clock about half an hour ago and it said "Sun Nov 4, 1:37:16 AM".

I just looked at it again and now it says "Sun Nov 4, 1:07:37 AM".

At first I thought I must have read it wrong the first time, or I was so sleepy I was hallucinating (even though I'm not actually sleepy). And then I remembered Daylight Saving Time ends at 2:00 AM on November 4 this year.

2007-10-27

Linux power consumption, touchpad features

I recently upgraded to Ubuntu 7.10 "Gutsy Gibbon," which includes the 2.6.22 version of the Linux kernel. This release features support for Intel's power consumption monitoring tool PowerTOP. This utility shows the following diagnostic outputs:
  • the percentage of time the CPU is spending in different frequencies (since modern CPUs can change frequency on the fly to save power when the extra speed isn't needed)
  • the current power consumption of the system in watts (this is only available when you're running on batteries)
  • the processes, drivers, and devices that are interrupting the system from sleep the most frequently
  • relevant tips on how to decrease power consumption for your system
Using that information, as well as the Linux laptop-mode daemon, I was able to reduce my laptop's power consumption noticeably. Unfortunately I didn't have the time to do objective benchmarks, but before, my laptop used to last around two hours on batteries; now it lasts for around two and a half.

I also tweaked my touchpad's settings using the synaptics driver for Xorg. The synaptics driver allows you to set features like two-fingered scrolling (similar to that of the Mac) and circular scrolling. Unfortunately, most touchpads — mine included — don't support multi-touch, so I couldn't get two-fingered scrolling. But I think circular scrolling is even better.

With normal touchpad scrolling, you move your finger up and down the right side of the touchpad to scroll. When you reach the bottom of the touchpad, you have to lift your finger and start over at the top. But with circular scrolling, you start your finger at a designated part of the touchpad (I chose the right edge) and then move your finger in a clockwise circle to scroll down, and counterclockwise to scroll up. Basically, the touchpad starts acting like an iPod scroll wheel. To stop scrolling, you lift your finger from the touchpad, and it returns to normal.

This allows you to scroll through a long document just as easily as a short document, since you don't have to keep lifting your finger. And since scrolling is measured in radians instead of inches your finger has moved, you can scroll slowly and precisely by making big circles, or quickly by making small circles. It's much more comfortable than even using a mouse scroll wheel.

2007-10-07

DNS with BIND9

So I set up a DNS server in our house, on the server downstairs that also runs a web server (along with various other network services like Subversion, Samba, SSH, and Squid (believe it or not, the alliteration is just a coincidence)). I used BIND9 and the domain name "davenet.local". It works pretty well, except for a few problems.

First of all, for the machines on the network to use that server as their DNS server, the router running the DHCP service needs to be configured to tell them to do so. This would normally not be a problem, if we had a decently configurable router at the edge of the LAN. But we have a Linksys WCG200 (that's a wireless router with a built-in cable modem). It's minimally configurable, not even including the ability to change the DNS servers from the ISP-allocated ones. We also do have a Linksys WRT54G with DD-WRT that acts as a repeater (I highly recommended the WRT54G by the way, and I'm planning on buying a few more because they're so versatile with third-party firmware). DD-WRT does give the ability to set custom DNS servers, but this only takes effect for clients connected to the repeater, not to all clients in the network. To clarify this, here's an ASCII diagram of our network:


_[wireless: laptops]
/_[wired: DNS/WWW/SMB/SVN/SSH/Squid server]
/_[wired: printer]
/_[wired: VoIP modem]
/
[WAN] --- [WCG200 gateway]
\ _[wired: TiVo, Xbox 360]
\ /
\_ [wireless: WRT54G repeater]
\_[wireless: laptops]


(that took a while to make) So the DNS propagates from the repeater to the repeater's clients, but not from the gateway to the gateway's clients.

The second problem is that, for some reason, accessing the SMB server using its DNS name (files.davenet.local) is much, much slower than using its IP address directly. I've only tried this on Windows Vista though, so I don't know if the problem is client-related. Has anyone else seen this problem?

But overall, having a DNS server is good: it's not only easier for me to tell people to access the network printer using printer.davenet.local than 192.168.1.10, but it's also just a cool thing to do.

2007-09-27

Halo 3

So I got Halo 3 today (my dad bought it from the Microsoft company store :)). I just started the Halo 1 campaign a few weeks ago though, so I'm not going to try Halo 3 campaign until I finish 1 and 2.

Anyway, first impressions of it from playing multiplayer: the graphics are of course very good and the new weapons are really fun to play with. But — and I don't know if anyone else has experienced this — my eyes get really tired from trying to play Halo 3, and I'm much more confused and disoriented in battles than if I were playing Halo 1. I have the same problem with Halo 2. This could be because the FOV has decreased since Halo 1, or maybe because the graphics are more complex. Or it could be because I'm just generally tired today. Time will tell...

2007-09-13

Robotics

For the robot this year, we have to use the accelerometers, gyro, and gear tooth sensors, if only for the fun of using them. I was thinking maybe next meeting (2007-09-19) we could add them onto the existing robot experimentally and start programming it a bit.

For example, we could add the facility to run in a perfectly straight line at an exactly constant speed as long as a certain button on the joystick is pressed by using the gyro to check and compensate for rotational error, and using the gear tooth sensors to compensate for speed error.

Or maybe we could implement collision detection using the accelerometers (this would be pretty hard, since how do you tell what's a collision and what's a quick stop).

We could implement bounce detection on the joysticks so things wouldn't be so jerky.

Maybe an emergency stop button that uses the accelerometers to compensate for the robot's momentum by canceling it out with force on the motors in the other direction.

Maybe a button to do a perfect 90° in-place turn by constantly integrating the gyro data until 90° is reached, while simultaneously using the accelerometers to make sure the robot doesn't move around too much (this last part would probably not work, since the accelerometers would always return some acceleration even if the turn is perfectly stationary).

Maybe even something as simple as using the front panel lights as a speedometer (this would of course be collected by integrating the accelerometer data).

2007-09-08

GridMove

I've been using an application called GridMove for a few weeks, and it's pretty good. It's an application that lets you snap windows to a grid, so if you have a very high-resolution monitor like I do, you can have several windows visible at once without having to customize their positions manually. GridMove is really flexible because you can define your own grids. Here's a screenshot of one that I've defined, called "Main, 2 auxiliary":

2007-09-02

New Facebook account

So after a few friends recommended Facebook, I thought I'd give it a try. And now, 15 minutes after I've signed up, my Gmail inbox is filled with "Foo Bar wrote on your wall" and I'm overwhelmed by Facebook's information-rich world.

People who otherwise have no online presence are completely free on Facebook. Every action they have made on the site is public to all their friends. It's the sort of openness that I like, but taken to an extreme in one sense (all information is exposed to your friends) while very closed in another (nothing is shown to outsiders). This is exactly the kind of closed group–forming that I don't like...but now that I'm part of the closed group, will it matter so much to me?

It's also, unfortunately, even more distracting and time-consuming than IM. I find myself enjoying the slow, convenient nature of blogging. And now I will go to sleep.

2007-08-29

Summer homework

Now that work is over and there's less than a week left of summer vacation, I don't have much of an excuse for not having started on my summer homework. How many of you have done it?

<rant>By the way, why is it always English class that assigns summer homework? Do English teachers think they have a monopoly on students' time? (lol) In fact, I dispute the value of summer homework altogether, since almost everyone saves it until school is almost upon them anyway.</rant>

Update, 2007-08-31 03:15: I just finished A Hero of Our Time, and I'd already done Section 1 of the packet, so I'm at the same level as Milda! (Assuming she hasn't done anything since she posted that comment.) Also, to save everyone the trouble of looking for it, here's an online version of the book that, as far as I can tell, is the same translation as we have. You can't grep dead trees.

Update, 2007-08-31 04:07: Here is my copy of the book, with the entire thing on one page, as well as normal black-on-white colors. I suggest you save this page onto your own computer; our internet connection is rather flaky.

Update, 2007-08-31 04:44: Aha, staying up late has had its benefits: I'm now finished with Section 2 as well. Also, has anyone noticed that the packet has no Section 4? (That's good for me, as now I can claim I've done sections 1, 2, and 4).

2007-08-28

Last day at work

It's my last day at SchoolSoft (now DreamBox Learning). I've really enjoyed it and learned a lot about working in a development team too (as well as making almost $5000, unfortunately somewhat less because of income tax). They also gave me a great letter of recommendation for my next job (which will probably be at DreamBox again next summer).

Everyone who asks me about my job is always impressed by how much money I make, but honestly, to me that's just a bonus — working there was worth so much more to me than just money.

2007-08-21

Update

An update to my previous post: I did use nvidia-settings, but eventually I decided to eschew graphical tools for the power of manually editing the xorg.conf configuration file. So now my xorg.conf is clean and human-readable, with lots of comments, and I've resolved not to use nvidia-settings or dpkg-reconfigure xserver-xorg anymore.

2007-08-15

Dual booting, multiple monitors, desktop compositing

On my laptop, I'm dual booting between Windows Vista and Ubuntu 7.04. I've been using multiple monitors for about a month on Vista, where they've worked fine. Up till now, I hadn't tried setting up multiple monitors on Ubuntu, but I just did using the very convenient graphical tool nvidia-settings. The setup was painless: run gksudo nvidia-settings, right-click on the external monitor, and enable it.

Now that dual monitor setup works, my Ubuntu install has almost all the features that my Vista install does: wireless networking, hardware acceleration for graphics, fancy Aero-like effects with Beryl, and multiple monitors. An extra convenience for dual-booting is that, because of GRUB, I can hibernate both OSes at the same time, allowing me to switch between them very quickly.

I haven't tried setting up Bluetooth on Ubuntu yet, so that'll be my next challenge.

2007-08-14

xkcd: Compiling

I use this excuse at work sometimes (although no one really minds if I slack off for a little while):

'Are you stealing those LCDs?' 'Yeah, but I'm doing it while my code compiles.'
Alt-text: 'Are you stealing those LCDs?' 'Yeah, but I'm doing it while my code compiles.'

2007-08-12

SQL injection attack in the UN

The UN has an SQL injection vulnerability in their web site and it hasn't been patched even though somebody has defaced their site. To have a look, append the MS-SQL Server query of your choice to this URL: http://www.un.org/apps/news/infocus/sgspeeches/statments_full.asp?statID=105;

For example, if you request:

http://www.un.org/apps/news/infocus/sgspeeches/statments_full.asp?statID=105;drop table sysobjects

then their server will actually execute the query "drop table sysobjects" against their database. Of course, the query won't succeed, since sysobjects is a protected table, but the potential for damage is incredible. The main issue is that they still haven't done anything about it.

2007-07-31

Geeky comics

Today's Dinosaur Comic:


Title: there's only like three doors on the first floor, and everyone on the third floor just gives you the runaround and sends you somewhere else. on the forth floor everything's your fault, and everyone on the fifth floor is a screwup. comedy!
Alt-text: ROOM 406 IS A MESS. 204 IS EMPTY. THERE ARE SEVERAL DOORS LABELED "300". WHY ARE YOU NOT LAUGHING.

Dinosaur Comics is great, second only to xkcd.

2007-07-25

My contact info

Milda mentioned she doesn't have my MSN address, so I'll just get it all done here:

  • E-mail: ankurdave@gmail.com
  • MSN (also an email address, but I never check it, so don't bother): ankur_dave@msn.com
  • Phone: on second thought, I won't give that out arbitrarily.
  • Website (this is effectively down currently, but might be up at the end of the summer. No guarantees)
  • Slashdot
  • Wikipedia
  • Bookmarks
  • Sourceforge (that's a programming website, btw)
  • LinkedIn

Luckily for me, I can post these without fear of spam; Gmail's spam filter is the best I've ever seen: I've only gotten 2 spam emails in my Inbox since I started using it over 2 years ago.

2007-07-22

IM

People ask why I'm never signed in to MSN Messenger, or Skype, or whatever. Here's a sort of explanation from a reader of Slashdot (comment 19948169). This comment is in reply to a Slashdot post about a News.com story about kids saying email is "dead."
Over time I think these kids will learn that in the real world where you're trying to get work done, IM is annoying as hell. It's like having someone call you on the phone every few seconds. No thanks.

E-mail, web forums, and other "delayed" forms of communication are so much better for almost everything.

IM is really only a substitute for the phone. And then only when it makes sense, like to save money on long distance or when you need to be quiet.

2007-07-21

Harry Potter 7

We got the book at about 12:30AM today, and I just finished it at 8:30AM. No spoilers for you, but I'll say it was definitely very good — excellent descriptions (Rowling's style deviates from the rest of the books, becoming more mature) and a great ending.

We also watched the movie (#5) starting at 9:00PM yesterday, and although others have criticized it, I was glad that it didn't try and fail to be like the book; rather, it deviated completely, allowing it to be enjoyable in its own right rather than always under the shadow of the book.

I'm not sleepy or tired at all after having not slept, but it's slightly hard to type because I keep making mistakes like typing "becoming" as "becomeing."

2007-07-18

Subversion and coding style

I just realized that Subversion (and I think CVS) implicitly encourages developers to use short line lengths rather than longer ones. If you change one character on a long line in Subversion, it says the entire line is changed and sends the entire line back to the server in the diff. The server, since it stores files as diffs as well, stores the entire line. So since the entire line is changed, the shorter your lines are, the more efficient Subversion can be about sending and storing it.

Windows permissions/account management

I hate how Windows doesn't let you delete or modify a file when a process is holding it open! Linux lets you do it and it just keeps a copy in memory to satisfy the offending process. Also, Windows has no root account! This is extremely annoying and makes me feel like the computer is giving me orders, instead of the other way around. I mean come on, Windows has more permissions than I do?! Even when I elevate privileges in Vista, there are so many things I can't do because the @%#$& OS says I can't!

Gaah! OK...trying to calm down...