# Technical Interview Workshop

In November 2012, I gave a seminar about technical interviews for students in CS50. I didn’t realize that the video was on youtube until today, and it has almost 5000 views! I’m glad I can keep a memento of me teaching!

A note about the video: I usually use the whiteboard when teaching and I write much neater than I do in the video. However, I had to use a tablet for video recording purposes, and it’s really hard to write on a touch screen!

# 197,717 Lines of Code Later…

After taking 18 computer science classes at Harvard (17 in CS, 1 in EE), I was curious to see exactly how many lines of code I have written for assignments these past four years. I was also curious what the breakdown would be for the different programming languages I’ve learned over the years.

After looking through the archives of my computer, I calculated that I wrote 197,717 lines of code (141,008 insertions, 56,709 deletions) for my classes in the past four years! In fact, I believe this is actually an underestimate. In this post, I’ll talk about how I calculated this number, and assumptions I made when calculating this number.

# tiniBot: A Voice-Activated Drink Mixer

This past semester, I took ES50, Harvard’s introductory course in electrical engineering. For our final project, my group decided to make a voice-activated drink mixer! I was in charge of the coding component of the project.

The code is available on github. To do the speech recognition, I used the Chrome Speech API. Once I have the transcribed text, I send the text to a local server, which figures out the drink that was ordered, and then sends the appropriate times to open each of the bottles. The server sends these times to the attached Arduino, which then sends current to the appropriate solenoid valves for the designated times. When activated, the solenoid valves allow liquid to flow through.

# Reflecting on 3 Years of Teaching

I taught my last section as an undergraduate today. I’ve been a teaching fellow for a computer science class every semester for the past three years, teaching:

• CS50 (Intro to Computer Science), Fall 2011
• CS51 (Abstraction and Design), Spring 2012 and Spring 2013
• CS61 (Systems Programming and Machine Organization), Fall 2012 and Fall 2013
• CS161 (Operating Systems), Spring 2014

At Harvard, a “Teaching Fellow” is the equivalent of teaching assistants at most other universities. Technically, I’m a “Course Assistant” as the title “Teaching Fellow” is reserved for graduate students, but in many of the classes that I’ve taught, the undergraduates have the same (if not more) responsibilities than the graduate students. These typically include teaching section, holding office hours, and grading.

Over the past three years, I’ve attempted to have an impact in all of the classes I’ve taught, and hopefully that impact will last after I graduate. Also, I’ve learned several lessons about teaching computer science classes, and I have advice for current or future undergraduates considering teaching.

# Writing Synchronization Problems for OS161

This semester, I have the privilege of being a teaching fellow for Harvard’s legendary operating systems class, and I was tasked with writing the synchronization problems for this year’s synchprobs assignment! The goal of these problems is to get students to think carefully about the synchronization primitives and data structures needed to solve highly concurrent problems, avoiding the usual problems that come with concurrency: race conditions, deadlock, starvation, etc.

I remember how fun these problems were last year (forming little fellowships of the ring and piazza posts, meant to mimic creating barriers and reader-writer locks), and I wanted to make sure the problems were just as fun this year. I was tasked specifically to write problems to mimic the synchronization one would use to implement waitpid()/exit() (how would you do it?) and the synchronization needed between address spaces and the coremap when implementing a virtual memory system in the third assignment. Given these specifications, I came up with Singing Cows and Hunger Deletion Games synchprobs!

# C Error Handling

After taking an operating systems class last year and taking a data systems class this semester, I’ve picked up a few patterns to make it easier to handle error conditions in C.

Consider the following example from my data systems class, where I initialize a directory to act as persistent storage for my database.

# Learning Through Bootcamps

This semester, I’ve been writing and leading bootcamps as the Harvard Computer Society Bootcamp Manager. In the past, HCS has had bootcamps on various topics including python, javascript, and git. Bootcamps are typically targetted for students just starting computer science (fresh{wo}men, sophomores).

My goal this smester was to restart the bootcamps and to revamp the curriculum. In this post, I’ll talk about:

1. The bootcamp curriculum I designed
2. The typical workflow for a bootcamp
3. The design decisions that went into writing these bootcamps
4. Some high level results (pull request numbers and summary of testimonials)
5. Unedited testimonials from students in the bootcamps

# Omnibox GDrive Search

I published my first Chrome Extension: Omnibox GDrive Search! The extension allows you to search your google drive for documents and then jump directly to them from the omnibox! See the code on github.

In the omnibox, type gd and press TAB. Now you can enter your queries and jump directly to the file from the omnibox suggestions!

To use it, you must first authorize Google Drive metadata read-only access to the extension by following these instructions (see screenshots in extension link):

1. Go to chrome://extensions
2. Find this extension, and click “Options”
3. Click “Authorize”, and then click “Accept” to grant the extension access. This will redirect to a blank page. Close it, and refresh the options page.
4. If you see “You have already authorized this extension!”, then you can now search!

By far, the most difficult part of the extension was understanding authorization with Google Drive. The extension is a bit buggy and lags a little because the extension must renew the authorization with Google Drive every 15 minutes or so. To get around this, the extension only requests authorization on the first use after the expiration and will redirect the user to the options page. Thus, if you’re using the extension for the first time in a while, it may take ~3 seconds before search results come back.

# Pipeline for Improving Hand Tracking Accuracy

For my CS283: Computer Vision Final Project, I created an application to control Google Maps using your hand and a webcam.

It uses the Chrome API to access the webcam, and frames are sent to a Tornado server that runs the hand tracking pipeline, annotates the frame, and sends back the displacement vector to update the view of the map. I am using OpenCV for it’s Haar Cascade libraries.

You can view the code on github and setup an instance of the server locally!

You can also view the paper I wrote to describe the process I used in the pipeline. Below is a summary of the problem statement and the stages in the pipeline.

# Problem Statement

Given a poorly trained Haar Cascade Classifier (250 positive samples and 100 negative samples) to recognize hands, this project assembles a pipeline to improve the quality of the tracking. These steps include:

1. Face detection and removal of faces.
2. Background subtraction.
3. Use a simplified Kalman-Filter-esque technique to estimate the bounding box of the hand. This assumes that a hand moves in a smooth manner.
4. Use our hand classifier to detect the largest hand within the bounding box.
5. Compute the optical flow of points within the bounding box using Lucas-Kanade.
6. Use the optical flow and the measured position of the hand to correct our Kalman-Filter estimate.

# Java Flag Command Line Library

Inspired by other commmand line libraries, I decided to make my own Java flag command line library here. It makes use of Java’s Reflection capabilities to fill in the values of flags at runtime. The library is fairly simple to use–it requires only declaring a static field, and one invocation to Flags.parse in the main method of the application. The library offers support for various wrapper types as well as collection types.
As an example of using the library, you declare a flag using the annotation @FlagInfo with the desired flag names and values.
See the README.md in the github directory for more information on how to use it and install the library.