Installing Django on Mountain Lion (+ MySQL and PIL)

UPDATE 1/14/13: A few small corrections. See Jonathan’s comment below if you’re having issues installing mysqldb

A few years ago, I posted instructions on installing Django on Snow Leopard. Since then, things happen gotten a lot easier. At that time, there was a weird shift going on with 64-bit computing that made it difficult to know what versions of various software to install. Well, it’s a few years past that, and package installers have become much easier to use as well. So, if you’re looking to do a fresh Django install on your computer, take a look:

1. Install MySQL

Download MySQL from http://dev.mysql.com/downloads/mysql/. Specifically, you want the “Mac OS X ver. 10.6 (x86, 64-bit), DMG Archive” version. Install mysql*.pkg as given. If you would like, you can also install the startup item (if you want MySQL to start automatically) and the preference pane so that MySQL can be started from System Preferences.

For some convenience, you can also add mysql to your path to invoke it in Terminal directly. To do this, open ~/.bash_profile with your favorite editor, and add

export PATH="/usr/local/mysql/bin:$PATH"

to it. You should also set your root password for MySQL using

/usr/local/mysql/bin/mysqladmin -u root password YOUR_PASSWORD

References:

2. Install libjpeg

Feel free to skip this if you don’t need the Python Imaging Library, but if you do, homebrew is the easiest way to get it and many other packages that you deserve as a UNIX user. Long ago, I used fink, and it was an awful experience. I hope they’ve improved it since, but homebrew was so painless.

ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
brew install libjpeg

References:

3. Install virtualenv (recommended)

I hadn’t used virtualenv before doing this setup, but it’s great. In short, it creates a virtual environment to setup python packages. Even though it’s easy to install packages otherwise, it does become a mess if different applications have different dependencies or if you need to swap python versions. This does away with all of that.

sudo easy_install virtualenv
sudo easy_install virtualenvwrapper

Then start from line 2 of https://gist.github.com/1852087 to get your virtualenv setup.

References

4. Install the python packages

If you didn’t install virtualenv, you’ll need to install pip (sudo easy_install pip) since pip otherwise is packaged with virtualenv. You will also need to sudo the next steps.

I recommend that you use a requirements file to setup your packages. It probably isn’t a big deal if you’re working on your own project, but it’s immensely handy as soon as someone else needs to setup the same environment as you. To do that, create a requirements.txt with contents similar to

django>=1.4
MySQL-python
pillow>=1.7.8
South>=0.7.6

pillow is optional depending on if you want PIL, and so is South. If you have your own favorite way of doing schema migrations, feel free to substitute. If not (or if you don’t know what South is for*), I recommend South. After you have that setup, just run

pip install -r /PATH/TO/requirements.txt
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib

I don’t exactly know what the circumstances are for requiring the second line, but I needed it, so I’m going to assume you will too.

References:

And that’s it! Now, you can fire off your Django project from within your virtual environment for local development. If you mine through some of the other links above, you will find a lot of other really good instructions for setting things up. Presumably, you can also google things as necessary.

Let me know in the comments if you run into any problems, if I missed anything, or if you have any proposed enhancements to this process. Also, let me know if I can do any other advocacy on the part of Django. I have had largely good experiences with it for building websites.

 

* one thing that Django doesn’t address well is database migrations. When you setup your models initially, Django will create db tables for the fields you specify. As fields change, however, Django doesn’t deal with changing the db tables. A tool like South will analyze your models and create migrations for you to run and modify the db schema

The Board Game Chooser: find a board game for any occasion with a few simple questions

My friends and I have been playing a lot of games together recently. It’s quite remarkable how much time one has when no longer in school, and given how much time we spend together, it always helps to find fun, accessible activities for us to do together. Enter board games.

It turns out there’s a huge world of board games. BoardGameGeek is a great database of the ones that exist, but with so many and a decent investment to get any of them,  it’s hard to know which one is right. Right now, most of them aren’t right since my housing is in transition right now, but if I wasn’t, it would be really handy to find a way to narrow down to my own preferences in games and the situations I would be playing it in. For that, I built the Board Game Chooser, a simple website that walks you through to a good fit.

All of the credit for the data goes to the Silver Oak Casino, who made a huge flowchart for picking a board game. My contribution here was just processing the data and putting it online for greater accessibility. I hope it’s helpful to you.

For a project that took only a few hours, I’m happy with how it works. All of the data is in JavaScript, so notice that once you load the first page, you never need to load another page again. Not only does this reduce the amount of traffic my server needs to deal with, it results in a much faster experience for you as well.

Given that the path does feel like a series of pages, however, I am also using browser history in HTML5 to simulate the same effect. If you’re in a modern browser, you’ll notice the URL change as you click through choices, and if you navigate directly to any of those pages, you’ll return to the same state. It even supports the browser “back” and “forward” buttons, which have become critical in surfing the web but can often be a web developer’s nightmare.

Anyways, enough about tech. If you’re still interested, you can see all of the code at https://github.com/StoicLoofah/boardgame-chooser. Otherwise, go ahead and try it out, and I hope you find something that interests you.

And as a last second pitch, if you do want to play a game, please consider going out to a local game store or bookstore instead of just buying it online. The game store I went to growing up was a great place, not only as a retail space for fun things but also as a community for people looking to play games of any sort. Internet retailers may be $10 less than MSRP, but they don’t have tables in the back to meet new people to play with.

About my next computer: insert words in mouth, commence chewing

Since I wrote about how I have been moving to a desktop setup, I have been telling everyone that my next computer would be a Mac Mini. The specs looked good, and it would force me to walk away from my computer instead of lugging my computer around with me. Despite being on the computer more than half the time, I pretend to appreciate reality as well and want to step away from computers as much as possible*.

As of Monday morning, however, I feel as though I can no longer do that. That morning, all of the engineers were following live blogs of the WWDC keynote as they announced the new hardware. We moved on as soon as they moved onto software updates, but we were anxious to hear all about the new hardware. Apple announced a new Macbook Pro, a hybrid between the beefiness of the old Macbook Pro and the slim shape and the Macbook Air. The specs are great for a laptop, the retina display is by all accounts amazing, and it is on its way towards manilla envelope size. I admittedly don’t follow non-Apple hardware much, but I haven’t seen anything with the industrial design of this computer, and the specs are almost a kicker.

The skinny kids who didn’t get picked to play on either team during recess, however, were the Apple desktops, including the Mini. A few months ago, I was certain that the specs on it would last me long enough, but there’s truly no comparison with what the new MBP has. The difference in the specs is significant enough to my gaming experience that I think I need to go back on my commitment and get a portable computer.

It ruins my attempt to prove I’m “better” than a computer, but it is clearly the right choice. Except for price, it has the Mini beat in every respect. Thinking back to when I first got my current MBP, it had the slickest case design and the best specs. And it lasted me 5 years. I would give the same opinion of the new MBP and would certainly hope that it would also last 5 years.

The price will be what it is, but the surprising criticism of the new MBP is that is, in some sense, too well engineered. Kyle Wiens, co-founder of the popular ifixit.com that shows you how to do repairs on your own hardware, describes it as the “least repairable laptop” in this opinion on Wired. Read for yourself for some contrarianism against the hype, but his main point is that Apple sacrificed repairability and upgradeability in literally gluing together the most compact internals ever, and by buying it, we’re supporting a future of light, thin computers with planned obsolescence as the battery slowly drains itself. If you don’t like that, the older MBP design is the way to go.

Most of the comments seem to dismiss this opinion, but I have taken it surprisingly seriously over the past few hours. On the one hand, I haven’t upgraded my MBP. If it were truly modular, I would have, but the graphics card alone is too specialized for me to want to swap parts. And of course, the new MBP is very thin and light. On the other hand, my hacker instincts tell me that I want the flexibility, and it actually has been useful. The battery in my model happened to be defective, and it was a simple exchange at the Genius Bar to get it fixed. And earlier this year when I thought my computer was dying, it was pretty easy to open it up and clean out the fan. Most of the wins of the new design don’t benefit my outlook, either. I have since purchased a 23″ external display that makes the retina display unimportant, and I think my desk can withstand the difference of a pound as my computer hopefully spends most of its time immobile.

At the moment, though, I’m having a hard time resisting the specs of the new MBP. The older design is cheaper, but it might need a few additions to bring it on par with the new specs. As Julie helpfully pointed out as she just saw me on the Apple Store, “[I] don’t need to decide by the end of the blog post.” And in truth, I actually really enjoy thinking about what hardware to buy. After waiting months for the newest revisions, I’m still uncertain.

At this rate, I might as well just savor the prospect of a new computer as long as possible and wait for a new Mac Mini.

*At some point recently, I sarcastically said something like, “Well, the physical world is just a substrate for the virtual world we actually live in.” That might be the scariest, most honest thing I have ever said.

My Google+ Hangout Success Story

This past weekend, 3 friends and I met up to play Dungeons & Dragons in the early morning, mid-afternoon, and late night, in California, Washington, the UK, and Korea. Simultaneously. And we could all see each other and share notes and drawings with each other. Technology just works when we can easily do things we haven’t been able to in years, like meeting up with friends from junior high.

Since we were split across 3 time zones exactly 8 hours apart, one of us is working at literally every hour of the weekdays, with some spill onto the weekends. It took us maybe 4 weeks to schedule our first session, but it was well worth it to get a chance to catch up under the premise of playing Dungeons & Dragons, a game that I will try to sell you on in the next 2 paragraphs.

Dungeons & Dragons (or D&D) is improvisation with a few dice rolls as a final arbiter for how things go. The players take the role of adventurers in a fantasy world of swords and magic controlled by the Dungeon Master (or DM). Unlike most tabletop and video games that have rules to dictate what you do, D&D lets you dictate your actions and makes the DM determine how those flesh out in the game. Want to stiff-arm retreating goblin instead of just swinging your sword? Or do you have a 5 minute argument to give the innkeeper about why his fedex quest was a waste of time? Just about anything goes.

Despite its nerdy association, D&D is very social: in this last session, we extensively discussed a battle plan that was obviously (and hilariously) flawed as soon as we began fighting, I described how my character was pretending to play dead to get a jump on a hobgoblin (which also didn’t work when I failed to roll well enough to bluff the enemy), and we interrogated a rescued hobbit about his plans. Like any good game should, it encourages interaction between players.

Being able communicate in speech and gestures, share documents with character details, and draw out various rooms is critical for D&D, and in truth, nothing beats sitting around a kitchen table. Even so, a Google+ Hangout was about as close as you can get without being physically present. Group video chat let us all look at each while talking and brought back the surprisingly important gesturing to conversation. While waiting for our last player, we watched a YouTube video together of the promise of custom games in StarCraft 2. The chat window let our DM copy-and-paste in written descriptions of the scenario, as well as being used as a log of in-game events. We shared Google Docs describing our various abilities (and also used an online character sheet I wrote to keep track of our stats. Check out my character!). The sketchpad took the place of the game board as we drew a grid and placed ourselves on various parts. And we even had a few laughs over the mustache and hat effects.

I have admittedly been somewhat fearful about Google’s integration of everything into their platform. With my email alone, they basically control me, but when they know what information I’m looking for (search history), where I’m going (google maps), what I’m working on (google docs), and more, I’m concerned about how much they know about me. At the moment, I’m not even using Google Chrome (which I admit is all-around the best browser) as my primary browser because I’m scared of the vertical integration of products in addition to the horizontal integration they already have.

But integration isn’t entirely to be feared. Google+ Hangouts are awesome because Google glued a lot of good features together in a single product. We spent surprisingly little time fighting with technology to make things work, and our game just went smoother as we discovered more features to use. At this point, this post likely sounds like an advertisement, but I’m just really excited about how well it work, so let me round out this post.

I’m very cynical about a lot of technology. Despite how “social” we’re being pitched that technology like facebook or mobile phones are, I think that these communities built on a virtual substrate are making us more disconnected than ever. I’ve been taught about the importance of physical embodiment in the world, and I worry tremendously that we’re replacing meaningful interactions with impersonal bursts, 140 characters at a time.

But this time, technology worked. When my friends and I are spread across 3 continents, it is impossible for us to get together for a quick check-in, much less playing a game. With this, however, we were instantly back to joking around and sharing the latest news with each other. I’m still anxious for the opportunity for us to all be in the same room again, but until then, I’m glad we have another way of hanging out  like we were.

Introducing chronoline.js, a JavaScript library for timelines

Sadly, a lot of my work at Zanbato is behind closed doors, but recently, I have been working on a widget that is definitely not proprietary and is available for all of you to use, extend, or even just look at: chronoline.js.

chronoline.js is a library for making a chronology timeline out of events on a horizontal timescale. From a list of dates and events, it can generate a graphical representation of schedules, historical events, deadlines, and more.

This is just the short pitch, but hop on over to http://stoicloofah.github.com/chronoline.js/ where you can see a few examples. They don’t quite demonstrate what I think is quite a bit of built-in flexibility, but definitely let me know what you think!

Purchasing the Right Mouse

Low motivation to do schoolwork and being caught up in work caused me to spend an hour and a half of researching about computer mice this evening*. The result is a feeling of satisfaction, decent knowledge of mice, and 3 notifications on slickdeals for mice that I will instantly buy.

Like most things I do, I simmered on the idea of buying a mouse for a few weeks as I found more and more reasons to do something about it. My current mouse is a Logitech MX700, an apparently decade-old piece of hardware that I’ve used for just over half that time. I got it as a peripheral to a computer I was supposed to fix up and reallocate, and it was a great change. Previously, I had used a cheap, dependable Microsoft optical mouse without any particular concern about how it felt. This mouse, however, felt much better: it was larger to fit my hand better, it had a thumb indentation for better grip, it was much heavier, and overall, it was just much more comfortable to use. I’m using it for this post right now, and it still feels good.

But I also use a Logitech Performance Mouse MX at the office, and it’s also awesome. Found in a random pile of peripherals, its shape has the same indentation and feel that I like about this mouse, but it’s better in other ways, too. I thought I liked the heft of my MX700, but it turns out that the much lighter Performance Mouse also works: the size was more important. According to Razer, I’m a palm grip guy, and I like tall mice that fit into my palm. And while I have to charge my mouse every few days, I used the Performance Mouse on low battery for 6 months. And it also doesn’t have a huge dock/receiver, like my MX700. So given how many hours a day I use my mouse, it’s time to upgrade.

It’s honestly been awhile since I’ve needed to do serious shopping research. I’ve been contemplating my next computer setup, but since I’m a Mac user, there are actually very few choices, and the deciding factors are larger usage questions. In looking at mice, there are tons of small questions: optical or laser? Wired or wireless? How many DPI? What about the shape? Ultimately, most of these choices aren’t going to matter too much to me, and as overwhelming as it seemed, I think I’ve figured it out in about an hour.

My primary concern is to get a comfortable mouse. First, it should be a full-sized (not a mobile/compact) mouse. Second, it should be shaped for my hand, which would include a mouse indentation. Finally, it shouldn’t be light, as I have developed a preference for slightly heavier mice. Oddly, I discovered that this meant that I need to look at gaming mice. Nowadays, the best computer peripherals are gaming devices, and although I certainly do get my game on, I primarily want a good mouse for daily use. I’m already an emacs user who will develop carpal tunnel from how I need to use the keyboard anyways, so I might as well be as comfortable as possible with my mouse. So, all the details about DPI and extra random buttons weren’t particularly important.

Research went relatively quickly. I had previously accumulated a few links from random browsing, so I put all of those into a spreadsheet. In total, I had 11 mice with some basic spec and price points. From there, I used Google product search to find reviews for each and sorted them according to my preferences given all details. This narrowed me down to a list of 3 mice that seemed roughly equivalent and worth buying: the Logitech G400, the Razer DeathAdder, and the Logitech G500. All of them appear to have roughly the shape I want, aren’t too expensive when on-sale ($30 or $40), and are well-reviewed. At that point, I googled direct comparisons between them, which yielded a ton of forum threads on exactly this choice. As I figured, the preferences there were a wash as various people spoke up for personal preferences and mentioned their own particular malfunctions with each device.

I think this is where I call it a draw and let price and chance decide for me. I have deal notifications on slickdeals setup for each mouse, and when a good deal comes up on any of them, I’ll be upgrading. Sadly, I saw the G500 come and go less than a week ago while I was still deliberating whether to researching buying a nice mouse or not.

Anyways, that’s about it. This post ended up being a lot drier than I was shooting for, but that’s okay. I have 2 takeaways from the experience, which you might consider as well.  First, a lot of shopping research is really easy nowadays. The number of choices and unimportance of most of them can be overwhelming, but a combination of a well-deliberated system and a ton of opinions from others got me through the process in almost no time.

Second, it’s worth thinking about computer and desk peripherals if you spend as much time at a computer as I do. At the beginning of college, my desk was my Macbook Pro 15-inch screen, its built-in keyboard, and my MX700. Now, I’m on a 23-inch LCD screen and an external keyboard, looking to buy a new mouse, and more comfortable than I’ve ever been before. So if you haven’t thought about your mouse much until reading this post, I recommend it. Even if it makes you feel like a tool or a nerd, I recommend looking at the Razer Gaming Mouse Advisor, which can help you think through what you should look for in a mouse.

Or if you can wait, there will be a Logitech MX700 coming onto the market as soon as one of my deal alerts fires. It’s in fine condition, will come with rechargeable batteries, and may be more comfortable than any mouse you’ve ever used before. There might even be a blog-reader’s discount.

* not actually written this evening. I backlog and space out my blog posts nowadays. As of this evening, I have already bought the G400. Anyone want a MX700?

How to Be a Secure Computer User (Within the Bounds of Convenience)

It’s an old paradox to wonder why there are any doctors that smoke. It’s somewhat hypocritical, but mostly just confusing that the people who know the most about the effects of smoking should partake in it as well. I would like to say that I know better, but until a few days ago, I didn’t. Until then, my passwords for computer accounts and online services were all stored in plain text in a GMail draft. Were you to know that you could find it there, it would be very easy to steal all of them.

Using computers securely is a big battle for experts and users, and the best practices really depend from person to person. Every person needs to decide what their tradeoff between security and convenience is. On the completely secure side, one can remember long, random, unique strings of characters for every account. This, however, is extremely inconvenient to remember. On the completely convenient side, one can use “password” for every password. This, however, is extremely easy for hackers to break. Everyone’s practices lies somewhere in-between, using known methods and a little bit of personal construction.

That personal construction, however, is where we really get ourselves into trouble. Security is very hard, and most methods of compromising aren’t good. For example, I know that I should have long, unique, hard-to-guess passwords for everything. Because I couldn’t remember that, I decided it would be okay to record them in an easily accessible place for me. Unfortunately, that happened to be a really awful practice.

Most people aren’t security experts and don’t know the best way to use computers securely. Given that, I think that a lot of bad practices can be rooted out with a quick 2 question quiz:

  1. If a hacker knew where you store your passwords, could they guess your passwords easily?
  2. If a hacker knew a subset (none, one, a few) of your passwords, could they guess any of your other passwords easily?

The first question mostly deals with people securing their passwords by obscurity. This is mostly how my old system worked, and it’s a bad idea. The United States National Institute of Standards and Technology (NIST) thinks it’s a bad idea. It’s unlikely that you’ll come up with a method on your own that no one else has thought of, and if you’re borrowing someone else’s system, you’re already screwed. And even if you hide things, they can be found easily.

The second question deals with bad security design. In a world where you create passwords for many different services, some of which are well-built and some of which aren’t, it’s not hard to imagine that one of your passwords might be leaked to a hacker. That itself is somewhat unavoidable. If knowing that password, however, allows them to determine the rest of your passwords (either as a straight copy or by design), you’re in trouble.

Let me walk through a few common methods I’ve heard from friends recently (and a few trivial examples) and point out the possible problems with each of them:

  1. Use “password” for all passwords. This password is very common and not hard to guess. By question 2, a hacker could guess your password knowing a subset of size 0 of all of your passwords. This is an awful idea, as you can imagine.
  2. Use a small set (maybe 3) of passwords for everything. This is also a problem for question 2. If a hacker gets 1 of your passwords, they can now guess 1/3 of your accounts fairly easily.
  3. Store passwords in a (unencrypted) document on your computer. Even if you name it something other than “passwords.txt”, it’s not hard for a hacker who gets read access to your computer to find the file and copy it. At that point, this method fails on question 1.
  4. Start with a base password and modify it slightly for each service. For example, Google might be “abc123GoogleRocks” and Facebook might be “abc123FacebookSucks”. This ensures that each password is unique and somewhat long. Unfortunately, this is still a problem for question 2 because other passwords are deducible from a single password. In the example above, even though “Rocks” and “Sucks” are different suffixes that you can remember, it’s still a systematic method that doesn’t ultimately leave that many possibilities.

As you might have guessed, some of the above are better than others, but assuming you’re okay with the level of security each will give you, they’re all fine if they work for you. You should just be aware of the risks associated with it.

Given all this talk, I need to support my claims, so my new method is using a password manager (specifically, 1Password). Essentially, I have a single master password for an encrypted database that stores all of my other passwords. With that, I only need to type in my master password, copy the specific account password into the box (or use the auto-fill feature), then lock my manager again. Like other methods that aren’t memorized, random, long, unique strings, it’s not perfectly secure, but it’s good.

It isn’t susceptible to the flaw of question 1. Because the database is encrypted (using tested methods), it is presumed to be secure*, so even though I have announced that I’m using 1Password and the file is not hidden on my computer, a hacker shouldn’t be able to get my passwords without knowing my master password. Question 2 is a problem: if a hacker knows my master password, my world is open to them. Otherwise, my passwords can be arbitrarily complex.

The caveat to all this is that I trust that the creators of the password manager are honest people using secure methods of security. If they’re sending all of my passwords out to their secret server, of if they screwed up the implementation of some security protocol, I’m in trouble. But that’s the line I draw for myself between convenience and security: I believe that my master password cannot be guessed and that 1Password is honest and secure, and this is the furthest I’m willing to go to be secure.

So maybe a password manager is a solution for you, or maybe it isn’t. I just wanted to write about it since I had thought about it so much recently and think it’s worth it for everyone to evaluate the ways that they are being secure. Again, it’s a tradeoff between convenience and security. Just be aware and comfortable with the consequences of your method, keeping in mind these 2 questions:

  1. If a hacker knew where you store your passwords, could they guess your passwords easily?
  2. If a hacker knew a subset (none, one, a few) of your passwords, could they guess any of your other passwords easily?

* I say presumed because even security experts don’t know if any construction is completely secure, but it’s the best that anyone knows. The limit of that is whether P=NP, for the CS literate among you, so it’s pretty certain.

If We’re Moving Classes Online, Where Are They Leaving From?

There’s been a recent trend of moving opening up coursework to the world on the internet. The first steps towards this happened a few years ago with resources such as iTunes U and OCW, where recorded lectures and notes were made available online. This trend, however, has taken the next step as university courses in their entirety are being offered online, with graded homework and a certificate to boot. I’m mos  t familiar with offerings from Stanford, but I think others are jumping on the bandwagon, too.

The reasoning behind it is sound. A lot of coursework is moving online anyways as convenience for students, and it seems like the right thing to do. I’m fortunate enough to be a student at a well-funded private university, but that luxury isn’t available to most people. With the popularity of this model from sites such as Khan Academy and the pipeline to do it, it seems almost unfair to restrict the content to the few who can afford it.

It’s not perfect. For many classes, there’s no replacement for the ability to work hands-on and in-person for a class. You lose the physical environment of a college campus and the ability to collaborate with instructors and other students directly. Some argue that the most valuable part of college is not the class but the people you meet. If you can’t have that, though, this is pretty close. The traditional teaching model with hour-long lecture and problem sets don’t really involve interaction to a large degree.

At the risk of sounding privileged and snooty, however, I’m a little disappointed by how this change is being embraced in class design for in-person students. Since this was an initiative in the Stanford Computer Science department, I’ve taken several classes (and am currently taking a class) that are now in the online format. To accommodate the students, they’ve made some changes to how the class is taught, both for online and in-person students. And I think they’re a little worse for it.

Most professors really do just lecture, and a recording is no different. I actually depend heavily nowadays on watching lecture online to work with my schedule. But some professors are really good in class, and it’s a shame to lose that. For example, Dan Jurafsky is teaching an online class on Natural Language Processing. I took the class from him junior year, and the lectures were great. He actively pushed students to think in-class, ask and answer questions, and just made it a really fun environment, even though he did teach by lecturing from slides. Even though the class was early in the morning, everyone was awake and could really be a part of things.

That class, however, might be an exception. The other substantial change that I’ve noticed is a change in the workload for students. In order to make classes available to possibly thousands of students, grading must be automated: it isn’t practical have TAs go through all the assignments by hand. This model isn’t really scalable for, say, English classes, where most of the work is discussion and essays. But for many technical fields, where work boils down to getting the right number at the end of a derivation or writing a program that computes the correct output for some specification, it might work.

Having gone through these classes, however, I think that might be cutting students short to some degree. Let’s take Computer Science as an example. Past the 3 course introduction to programming series, most of my work has been tailored towards proofs and conceptual understanding. Once you has a sense for how to program, actually programming in classes becomes much less relevant: if you need to implement a program, you take a few days and learn the specifics of the language. The real trickiness comes in understanding how to build systems, which requires conceptual understanding to compose and extend systems.

Take, for example, Probabilistic Graphical Models. Roughly, this class on artificial intelligence is about modeling phenomenon using probability. This class is historically known to destroy students. In the past, there were biweekly problem sets involving derivations and proofs for 5-ish problems, often the results of research papers in the field. TAs were responsible for grading these lengthy, often page-long proofs involving a mix of mathematical derivations, cleverness, and intuitive explanation. This syllabus, however, needed to be switched up, so it’s now weekly programming application projects.

So admittedly most of my response to that is bitterness at having been brutalized by the problem sets for this class while current students can just write a little bit of code. But it seems to me that students now aren’t getting the same depth that they would have thinking through problems. For many advanced algorithms, the actual implementation is relatively easy when it’s already outlined: it’s basically just translating a description into code, which often doesn’t require much insight into the algorithm itself. Trying to re-derive the same result or prove a similar concept, however, is much more difficult and requires understanding of how things work. I don’t need a class to teach me whether I did something right: I need a class to teach me whether I understand.

We’ll see how this shift goes moving forward. I’m all for providing content online as long as it doesn’t displace valuable aspects of current teaching methods. By focusing on the most tangible products of coursework, such as lecture content and quizzes, we might lose out on more subtle parts of an embodied, learning experience. Let’s democratize education as best we can, but don’t sacrifice the vitality of colleges while we’re at it.

Using the Web to Make Academic Work Useful

For several stretches of several academic school years, I have allowed my class-related work to become my blog content. Sometimes it’s more natural, such as the final essay for Creative Nonfiction, and sometimes it’s less natural, such as short critiques for Moral Philosophy. Most of my motivation for posting this work is pure laziness: it’s really hard to will myself to write a blog post after having worked through an essay. A smaller point, which is the crux of this post, is that it seems a shame that I should spend so much time on classwork that will ultimately be seen by only one grader.

Not all classwork is valuable beyond its own context. Mechanical math problems and proofs of known results are obvious examples of classwork for its own sake, so I hope you won’t be offended if I avoid posting addition and multiplication worksheets. A lot of other classwork, however, emphasizes critical thinking, synthesis, and creativity in research and projects.

I’ve tried to make most of my original and less embarrassing writing available on this site, either in blog posts or on my Writing page. Despite its pedagogical purpose, classwork can still be original and contribute to knowledge as a whole, especially given how sparse some of the content may be. For example, Google Analytics tells me that my essays and responses for Moral Philosophy are some of the most popular content from google searches on specific philosophers and philosophies. Posting this content is cheap and easy for me, and it may be extremely valuable to anyone else who ends up researching similar topics to those papers.

Even so, most of my work has been relatively simple, and I have often been frustrated by how difficult it can be to find similar resources for some actual published papers. Many researchers have released open frameworks for their work, but more often than not, the details aren’t available. Datasets, stimuli, program code, and all sorts of other work are poured over by researchers for months and sometimes years, yet are basically forgotten after being summarized and presented in a paper. I’m not a full-fledged researcher and don’t understand most of the logistics, red tape, and politics that probably drive most of the reasoning behind the process, but in the pursuit of knowledge, it only seems right to make as much known as possible.

Along those lines, I’ve taken that first step and released several of my projects on GitHub, where you can view much of the code for research I’ve done, along with some results and write-ups. As you might expect, the code is something of a mess, though should anyone want to use or understand it, I would be happy to clean it up. In all likelihood, the repositories will likely sit on the web, unseen and unimportant, but for how much I complain about not being able to find things, I can at least say that, “I tried.”

For many of my peers who have also worked on various projects, I recommend that you do the same. I’ve seen some really impressive work come out of class projects, and it would be a shame for that to be the end of it. And use it for current projects as well. Should you be doing any coding or research, you should be using a version control system anyways, so you might as well make it publicly available as well. In academia, we’re always all collaborating with everyone.

Why We Don’t Need to Worry About Robots’ Rights

Last Thursday, I went to a panel discussion being held at the Stanford Law School by The Center for Internet and Society on “Legal Perspectives in Artificial Intelligence.” My mind is mostly buried in the AI, but since I have recently become more interested in policy in general and the social impact of technology, I thought it could be interesting to see where the crossover is.

There were a lot of possible intersections, such as the use of AI in assisting lawyers put together cases or IP rights to AI code and programs. The topic they mostly discussed, however, was the possibility of AI being considered a legal person and what the implication of that was. It was an unfortunate angle to take because AI equal to a human doesn’t exist, so it was mostly non-answers, roughly of the form, “Interesting; we’ll see what happens.” They also chose not to jump into the philosophical aspects too much, with only minor discussion of philosophical zombies (a being that behaves exactly like a human but has no consciousness), and instead left those as largely open questions as well.

Disregarding how unsatisfying those answers were, I was also disappointed by the conversation as a whole because I found their conception of AI somewhat narrow, and that limited the topics they could consider. Instead of considering the state of technology as it is today and the issues surrounding that, they mostly clung to the more fantastic view of AI. This view, perpetuated largely by popular media, is best represented by robots like C-3PO that are human in all except form. More generally, this view treats AI as a system with intentions, self-motivation, and more psychological properties similar to humans. And that AI doesn’t exist.

Stepping back from that, however, and we already have some forms of AI, and I will make the stronger claim that what we have now will be the form of AI for the foreseeable future (with respect to legal rights; of course we’re making great progress in the nitty-gritty). So, I think that this panel was appropriate for us now, but for different reasons than what the organizers likely considered. AI is here now and it has plenty of problems surrounding it. For better or worse, though, I think it’s largely invisible in our lives. Let me give a few examples of AI in our lives, what its role is, why I don’t see it changing into HAL, and what the legal implications of it are.

First, AI in the market. The panelists discussed the legal status of AI as a trustee, an advisor to a trustee, or as a business operator. I don’t see this coming soon because AI don’t have their own desires, so it doesn’t make sense for them to be in charge. AI can be a tool to make recommendations and crunch the numbers, but the last mile will be all blood and guts. And this form of AI already exists. Take algorithmic trading: a computer is executing trades for a fund or some other trader based only on the numbers and often faster than humans are capable of. On the whole, it’s a black box. Very smart physicists and computer scientists can build models to make it run, but once it’s going, it’s past our ability to actively monitor it. Just last year, the Dow Jones crashed, which was largely blamed on algorithmic trading. The SEC ended up changing some rules based on this, so this is a problem being dealt with right now. I haven’t followed the situation, but I imagine that there are questions about liability when AI runs havoc on the market.

Second, health care. This came up in the discussion of Watson, the Jeopardy playing AI that IBM claims it wants to retool for health care. They were concerned about the possible issues here, as health as least as touchy of a topic as the market. I’m not scared about it, though, because we still have doctors. Doctors may receive advice from computers, but the final decision is going to be in the hands of a human. We don’t send our brightest to school for a decade just to let them defer judgement: they’ll still sit between a patient and AI. Even so, this is again already happening today. In fact, we apparently even have a journal dedicated to this topic. As it is, we can use probabilistic models to diagnose various illnesses by telling a computer what the various symptoms are, and it’ll spit back the likelihood of various possibilities. AI researchers will tell you that they’re actually better than doctors since they have the accumulated knowledge of many more cases than any 1 doctor could ever know. Importantly, AI here is just a tool, not a legal person. We do have questions today, such as patient privacy when the data are being aggregated into a single machine, and these will be the questions moving forward.

To wrap this up, let’s bring this around to an example of AI that you must be familiar with to be reading this: web search. On the surface, it seems like this is a task that humans are performing, any non-trivial search engine you’ll encounter has all sorts of interesting AI in it, such as trying to figure out if you meant the scooters, the mice, the hygiene product, or the phone when you type in, “Why isn’t my razor working?” The net result is that people usually click on the first link, which means that we’ve already deferred a lot of our choices to AI in picking the “best match” to our search terms. But that’s a far cry from R2D2, and hopefully, no one will ever sue a search engine for giving them bad results.

And it’s everywhere else, too. Google translate, autonomous cars, Bing flight search, Amazon search recommendations, and Siri are all examples of what AI really looks like today, and frankly,  it’s not that scary. None of it may sound that impressive or very AI-like, but that tends to be a funny problem with AI as a field of research: once we figure out how to do it, it’s not AI anymore.

I think it’s important that all of those things I just rattled off are tools, not independent agents. We build things that we want, and for the most part, we want things done for us while leaving us in control. This means that we build wonderful systems that use AI to make our lives easier, but that last mile is still human.

Given that this is what AI is and what it will be (so I claim), then the issues are already in front of us now. And if they don’t seem like issues, it’s because they aren’t. Do we worry about incorrect diagnoses from AI? A doctor may blame a computer, but it’s still the doctor’s call. What about an autonomous car getting into an accident? Assuming it’s entirely autonomous, it’s no different than trams that have a preset schedule. Cars aren’t going to have their own desires (such as to tailgate the jerk who cut them off), and since we’ll understand how they work, the mystery is gone.

So in summary, AI is here now, and it’s as it will be. There are legal issues to consider with respect to AI, but we shouldn’t be worrying about AI as a legal person. And appreciate and understand how important AI already is in your lives. As tools.