Monthly Archives: December 2013

Teachers make up 15% of Coursera users

Coursera Poll question
According to this Coursera poll question, approximately 15% of its users are teachers and about 9% teach at the college/university level.

I enroll in MOOCs primarily to see what the state of the art is and to pick up ideas I can use in my own teaching. We teachers borrow from each other all the time. Chances are I found that assignment you did was found in another textbook, at a conference, or on some other teacher’s website.

Linux on JavaScript: new horizons in interactive content

busybox in browser

Linux-in-Javascript emulators are very interesting to me. These are stripped-down Linux systems (usually running busybox) running atop a virtual CPU whose emulation engine is written in JavaScript.

It started with the groundbreaking JavaScript PC Emulator by Fabrice Bellard in 2011. His project emulates a 486 processor. Follow that link to see Linux boot right in your browser. It even comes with gcc to compile programs! The first time you boot up it’s pretty slow, but caching by your browser will result in better performance on subsequent boots.

Check out busybox’s own version of Bellard’s emulator with a fully tricked-out busybox executable.

Today I discovered the JOR1K Emulator which uses the OpenRISC 1000 emulator and includes network and graphics frame buffer support. All things considered, it’s very fast, even on an iPhone. Be sure to run the demo.

These emulators would be a great way to introduce novice students to the command line without needing to set up an account on a real Linux system in advance. They could be embedded directly into educational content–picture an online textbook where the student could try commands in the safety of an emulator. With a suitable suspend/resume feature, we could forego the whole “boot” process entirely and simply jump into a working shell.

As I bring more of my classroom content online (the “flipped classroom” model), it has to be more than just “read this chapter” or “watch these videos.” Interactive content is the way to keep students motivated and engaged. Projects like these really get me thinking about the possibilities.

WASD is the new HJKL

wasd_vs_arrows

I was showing some students the vi editor recently. One can, of course, use the arrow keys to move around the screen, but HJKL can be used without moving the hands from the home row. (For those who are unfamiliar with vi, H will move left, J down, K up, and L right.)H J K L keys on a keyboard

They commented that HJKL seemed like a strange choice. Why not the more intuitive WASD?

I’m not a gamer. WASD isn’t in my muscle memory. The adoption of WASD as movement keys is a much, much more recent development than vi. Once you see the ADM-3A terminal it was created on, it’s easy to understand why HJKL was used. Nevertheless, an era before first-person shooters was clearly the Dark Ages of computing.

bigpicture

The next time you’re using an application or a website that uses keyboard shortcuts, such as Boston Globe’s The Big Picture or Trello, take at look at what the navigation keys are. If they are H, J, K, and L, you can bet it was developed by an old-fogey vi user like me.

Are physical machines still the better choice?

Dell Optiplex 755This post is a bit of a ramble. My apologies in advance. Just looking for advice, I guess.

If I’m going to dive head-first into producing videos for my upcoming online Introduction to SQL course, plus supplementary “flip-classroom” videos for other courses, I need some horsepower. For screen recording and video editing, I’ve purchased an i7 iMac with Fusion drive and 8GB of RAM. That should be arriving next week and will replace the Mac mini I’ve been using the past year.

For a database, I’ll use the same PostgreSQL backend software that I use for my on-ground class. But since the videos will be publicly accessible on YouTube, I don’t want to use the same server machine. That is, I don’t want the public to see exactly what my students will see, since doing so may pose a bit of a security risk. Consequently, I’ll run the database on a separate machine.

A few options are available:

I have a small Dell Optiplex 620 “Slim Form Factor” machine sitting in a closet. It’s the machine that ran the database for my previous videos already on YouTube. It’s perfectly adequate for basic stuff and it has an Nvidia GT 610 in it for simple CUDA programming, but I’m afraid that if I start working with larger datasets, it may start to creak. The temptation to upgrade to something snappier is looming large.

I could throw together an Intel i3 machine out of parts for about $400. As a plus, I can toss into it a Nvidia GTX 680 I happen to have lying around for bigger CUDA projects.

I could purchase a used, but more current, Optiplex 755 or 780 from Craigslist for about $180, but I wouldn’t be able to put anything larger than the GT 610 into it. Still, it would run the database with ease. I like small machines that I can tuck into an out-of-the-way place.

I suppose I could run the Ubuntu server inside a VirtualBox on the soon-to-be-unused Mac mini. It would be difficult to run the machine headless, though.

But then I think: for $400, I could rent a Linode virtual machine for almost two years! And for the few times I need more oomph, I can temporarily fire up a more capable one for just a few dollars. When I want to do CUDA, just rent an Amazon EC2 GPU machine at 35 cents/hour.

A few years ago I promised myself I’d stop running server hardware and just go virtual. Why am I still thinking about buying new stuff? What is it about spending a few hundred dollars up front that seems better than paying a dozen dollars every month?

Having a local machine means zero latency and no setup necessary when I just want to record a video or two; I can shut it down when I’m done. A virtual machine means setting it up from scratch every time I need to start it up. (Some StackScripts could help with that.) A low-end local machine would satisfy 95% of my needs. A more capable machine would satisfy 100%, but at 2x the expense.

What would you do?

Where is the MOOC train headed? No one knows.

Keith Devlin, a MOOC veteran who has run his Mathematical Thinking course three times, recently attended a conference on MOOC education and research. Kudos for recognizing that online education hasn’t been the domain of tier-one universities.

If you want to see the future of MOOCs, you need to hang around with the instructors in the lesser known, small universities and community colleges who, for many years, have been experimenting with online learning. Most of the leaders of that loosely knit band could be found in a large, cavernous room in Arlington for two days last week – along with key figures from such new-MOOC, Ivy League players as Stanford, MIT, and Georgia Tech.

From The MOOC Express – Less Hype, More Hope.

Sometimes it’s the simplest assignments

It’s the week before finals and I asked my C Programming class for feedback about the semester. We had productive, hour-long discussion in which everyone participated. Among the questions I asked was: which assignment did you like the most?

The answer astonished me: They had to modify a simply program we had written during lecture and add a few features to it, each time committing the changes to a Mercurial repository. When they were done, they were to push the repository to BitBucket where I would inspect the program and give them credit. Easy-peasy.

I invented that assignment at the last moment, just before lab time about two weeks ago, to fill up an hour that would have otherwise gone unused. What I figured it would have taken them about 45 minutes to do in reality took about 90 minutes. They found the assignment more challenging for a variety of reasons:

  • Many of them had used Mercurial or set up a BitBucket repository despite being shown it and given instructions to do so some two weeks prior.
  • They had never modified someone else’s program to add features.
  • They had never thought about coding in an iterative, cyclic fashion: add feature, test it, commit, repeat.

What I thought would be a trivial, almost throwaway assignment turned out for many of them to be the most practical, instructive one of the entire semester. It was not so much about using some particular C language feature that we had just learned; instead it was about the process of programming–using the tools, putting iterative development into practice, and reading third-party code.

I pointed out that in industry, this would likely be what most of their programming would be like: using a VCS and modifying an existing codebase.

It was suggested that I ought to give more assignments like this one. Add features to an existing program. Fix programs with bugs in them. Glue together parts of an incomplete program. They gave me some great ideas for collaborative projects, too.

I always figured that writing programs from scratch were the most instructive. Certainly, they said, there’s a place for that. But it’s a nice break once in awhile to puzzle over someone else’s code.

A preview of my winter break

Although I’m on the Distance Learning committee at my institution, I’m one of only a few faculty on the committee that doesn’t teach an online course. I joined the committee because I have an interest in a) making high-quality online courses available and b) making sure the learning management system (LMS) that we use is suitable for both online and on-ground courses. Myself, I love and crave the classroom experience, but I’m increasingly intrigued by the idea of offering an online course.

The opportunity has come up to take my Introduction to SQL course online. I’ve been hesitant to do so for one primary reason: it’s a lot of work. I would be embarrassed to put up a bunch of links to readings, assignments, tests, and call it good. That is, frankly, a waste of students’ time and money. Unfortunately, it’s what qualifies as an “online course” at many institutions–even my own. If I’m going to make an online class, I’m going to do it right, by golly. That means lots of instructional videos, Socratic-style quizzing, and peer reviewing (when appropriate).

Luckily, there are lots of role models for best practices. I sign up for  Coursera and Udacity courses simply to take a look at how the content is presented. My current favorite course is Programming Languages from Coursera, taught by Dr. Dan Grossman of the University of Washington. I can’t link to an actual video, but here is a screenshot.

Screenshot of Coursera Lecture

Highlights of his presentations:

  • In addition to Powerpoint presentations with a few key points he does lots of live coding on screen. The main window you see there is him typing in programs and running them during the lecture.
  • His face appears in the video. You can see him talking the entire time. This is huge. It’s like he’s talking to me. When there’s nothing else going on in the terminal window or on the slides, I can watch him. When students can see or hear the instructor, they are more engaged successful. I’m not camera shy.
  • The videos are relatively short (5-15 minutes each) with small quizzes scattered throughout. (Udacity rules the roost when it comes to Socratic quizzing, though.) Each week there are about 1.5 hours of videos to watch.
  • Production value is pretty low, to be honest. It’s just a screen, a talking head, and a low-quality microphone. But that’s the state of the art in online education in 2013.

Here’s one of my videos in an attempt to emulate what Grossman does. I think it came out pretty well.

I have also done some videos in the Khan Academy style: disembodied voice with a pen tablet.

My work is cut out for me this winter break. To qualify to teach the course online in the fall, I need to have 25% of the content prepared by March. (We are one of the only institutions that peer-reviews course content before it goes live. The ACCJC accrediting institutions gave us high marks for that.)

I have “new computer” lust. I’ll need a new machine to handle all this video editing, right? Right?

Buying Arduino supplies online

Arduino UNOI use the Arduino Uno in my System Programming in C course. While most of the programming projects are done on a Linux system, using the Arduinos for a couple weeks mid-semester is a nice break from text-based C. Some students are inspired to buy their own boards and want to know where to buy parts such as switches, resistors, motors, and so forth.

First and foremost, Arduino is a real organization based in Italy. They design and manufacture their own boards. It costs real money and effort to create new products. Support them whenever possible, because what they’ve done to inspire makers around the world has been phenomenal.

Local Retailers

Radio Shack sells real Arduino boards and starter kits. You’ll pay full retail price, but if you want the genuine articles and need them now, this is the place to go.

Fry’s also sells Arduino-compatible boards and kits, such as the OSEPP Uno R3+. The prices aren’t any better than Radio Shack’s, though, so my own personal preference would be to get the real thing and support Arduino.

Online US Distributors

Jameco is a great online US store. They cater to electronics hobbyists by allowing you to purchase in small quantities. Some sample products are:

Maker Shed is a mecca for anyone interested in tinkering around with robotics, wearable art, 3D printing, and drones. They are affiliated with the fabulous Make Magazine and the annual Maker Faire in the Bay Area. Look here for Arduino boards as well as good starter kits that includes a project book and all the parts necessary to build them.

SparkFun Electronics sells a plethora of development boards, including ARM, Raspberry Pi, Beagle, AVR, mbed, and of course Arduino. (SparkFun is where I bought the first set of Arduino Unos that you used in this class.) They also design and sell their own line of sensors and I/O devices, conveniently mounted on boards for easy connection.

Many Arduino kits don’t include a USB cable. Monoprice is the place to get all your cables such as HDMI, Cat5e/Cat6, USB, DisplayPort, optical, and home theater wire, as well as very inexpensive networking gear (switches, patch panels, etc.), IPS monitors, speakers, and much more. Overnight shipping is shockingly cheap. Don’t pay more than a few dollars for any cable, ever again.

Overseas Distributors

If you don’t mind waiting a week or more for your order to arrive, you can’t beat the prices of Asian distributors. They often offer free shipping and quantity discounts.

Deal Extreme sells thousands of gizmos, some of them downright weird. But buried in their vast catalog is a section titled Arduino & SCM Supplies. This is where I purchased mini breadboards and micro servo motors. Other goodies include bundles of pre-cut hookup wires, 16×2 LCD display with keypad, and power supply for breadboards.

Sain Smart sells a limited selection of Arduino-compatible boards and related accessories such as motors and sensors, as well as respectable Chinese test equipment like oscilloscopes and logic probes. This is where I bought “High Quality” Arduino Uno R3-compatible boards for $10 each. Check out the rest of their Arduino-compatible lineup, all for 50-65% less than the real Arduinos. Lots of hobbyists think these are the best clones for the price.

AliExpress is a bazaar of thousands of independent sellers under a common roof. Personally, I get choice paralysis when I browse around AliExpress — there are just too many choices, all of questionable quality and service. I have never ordered from them, but some people say this is the place to get the best deals if you can stomach it.

eBay

Many of the discrete components you used in this class I got from individual sellers on eBay. Overall, I’ve had good experiences with them, but some people have philosophical objects to using PayPal to transfer money. Your mileage may vary, as they say.

LEDs

Who doesn’t like LEDs?

All the LEDs you used are 5mm diffused round. You can get them in smaller and larger sizes, rectangular or round, diffused or concentrated.

My favorite seller is sweetflower8588. Look in the left sidebar to select the size and shape of the LEDs you want. Free shipping and it comes in about a week.

The common-cathode RGB LEDs I bought from bestshop2008hk.

Resistors

I found two distributors of resistors on eBay that I like. Both are based in the US.

The first is E-Project Electronics. They mostly sell resistors, but also a few other discrete components.

The other is FoxyTronics. Their selection of resistors is quite limited, but wow they are cheap and the free shipping is fast.

Switches

I don’t know how long this seller will be around, but here are micro push-button switches that are great for breadboards. They sell a lot of other components, but I have no other experience with them.

Servos

Deal Extreme sells a huge selection of servos.

For high-quality mid-sized servos, such as the continuous rotation servos, look no further than Parallax, just west of us in Rocklin. They don’t have a storefront, but you can go to their offices and buy parts directly from them.

HobbyKing also sells an enormous selection of servos. But shipping takes nearly forever.

Since servos are used in radio-controlled hobbies, you can also get them from nearly any hobby store that sells RC planes, boats, etc. Sometimes their prices beat the online distributors. Shop around.

Check on eBay, too.

Things that bug me about Python

Python, love it or hate it, is a bizarre mix of procedural, functional, and object-oriented syntax. There are lots of things to like about it, but also lots of things to dislike. Here are some of my peeves. I’m sure I’m not the only one.

Versions

What do Windows and Python have in common? Everyone uses the prior, obsolete version and whines about the new version. Python 3 has been out for what, five years now, and people still prefer Python 2.x for everything?

Is version 3.x the Vista of Python?

Sets

This is a set of three numbers: {1, 2, 3}
This is a set of three strings: {‘pizza’, ‘hot dog’, ‘soda’}
This is not the empty set: {}. No, that’s a dictionary. What you meant to write was set(), of course.

Speaking of dictionaries…
Use braces to define an empty dictionary:
>>> D = {}
Use square brackets to access it.
>>> D[‘foo’] = ‘bar’
>>> D[‘foo’]
‘bar’
But get the contents of the dictionary and see it using braces:
>>> D
{‘foo’: ‘bar’}
Sometimes you have to use a method with dictionaries:
>>> D.keys()
dict_keys([‘foo’])
And other times you must use a function:
>>> len(D)
1

The Perl monger in me dies a little bit when I see that.

Strings

Want to convert a string into a list of characters? Use the list function, which I guess is OK:
>>> list(‘hello’)
[‘h’, ‘e’, ‘l’, ‘l’, ‘o’]

Want to convert that list back into a string? Use the join method of a string object:
>>> ”.join([‘h’, ‘e’, ‘l’, ‘l’, ‘o’])
‘hello’

IDLE

Want to give your language the impression that it’s slow: make the primary user interface as glacial as possible. Why is IDLE scrolling sooooo slow?

How about porting a native GUI toolkit to Python so it doesn’t have to rely on Tck/Tk? I can’t tell you how much frustration me and my students have had because the Tk implementation was borked, or there was some weird interaction between Python and Tk. At least Python 3.3.3 for the Mac comes with Tk built in now, but it has bloated the download size tremendously.

But then again…

I’ve still chosen to use Python 3 in my discrete structures course. It has a rich set of datatypes (lists, sets, tuples), comprehensions, a REPL, is cross-platform, is a “cool” and “hip” language, and amazes Java programmers with its handling of large integers.

I just try not to show my students the dark underbelly parts of Python that drives me crazy.

Cheating, round 1

cheating

The assignment was to write a C function that trims the newline character off a string, if it is present. The function takes a string as an argument, trims it in place, and returns nothing.

Here’s what one student turned in:

void trim(char *s)
char *tr ( char *s )
{
  int i = 0;
  int j = strlen ( s ) - 1;
  int k = 0;

  while ( isspace ( s[i] ) && s[i] != '' )
    i++;

  while ( isspace ( s[j] ) && j >= 0 )
    j--;

  while ( i <= j )
    s[k++] = s[i++];

  s[k] = '';

  return s;
}

Announcement to all students: we teachers can use Google, too.