EEL 4834: Programming for Engineers

Welcome to the fifth installment of Academic School Years, featuring me, Professor Boykin. In this exciting episode, I’ll be teaching EEL 4834, Programming for Engineers. The 4834 course web page is on my wiki.

As the above XKCD comic depicts, Python is more fun than perhaps any programming language has any right to be. Nevertheless, we will not question that fact, but accept it, and master the wonderful language.

Channels of Communication

If one considers the channels of communication available to humans today one might make the following list:

  1. face-to-face
  2. videoconferencing
  3. real-time voice
  4. voicemail
  5. Instant message/chat
  6. text message
  7. email
  8. postal mail

The above list is ordered from most to least “occupying”. Efficiency suggests that we should use the least occupying method that will do the job. Doing the job usually consists of meeting two goals: deadlines and interactivity. In the above list, the first five channels are synchronous (both parties communicate at the same time) and the last three are asynchronous (one sends a message, later the other party receives it).

The asynchronous channels generally have a problem of reliability; it can be hard to tell if a message was lost or just ignored. Indeed, with spam being an ever growing problem, email has become less and less reliable as messages are sometimes mistaken for spam and never read by their intended recipients.

My guideline for picking a mode of communication is to start at the bottom of the above list and keep going up until you hit the one that can do the job. Postal mail would probably only be used for packages or messages where the physicality of receiving something would be meaningful.

There has been some coverage in the news of the claim that email is for old people. I think part of the issue is that older people (or rather people in the work force as opposed to students) are generally dealing with a larger volume of messages which would not be workable over IM. The people you need to communicate with are not always available to communicate with you at that time, in such cases asynchronous communication (like email works best).

Update 12/4/2007: I found this post on communications channels by Tim Bray. He extends and quantifies some of the issues above.

Once a year

Lots of things happen once a year on various dates in September. I’m one to reminisce so it’s a good month for me. I get a string of dates this time every year: 9/9: Mother’s birthday and friend’s anniversary, 9/10: Brother’s birthday, 9/11, 9/12: friend’s birthday.

There are lots of such dates this month: 6, 9, 10, 11, 12, 17, 26, 28, 30. They include births, anniversaries, and tragedies.

To those celebrating a birthday, I hope it is a warm and glowing one. To those celebrating an anniversary, may the reminder of this day strengthen your love. As for tragedy, let’s remember we’re built for the climb, and our defeats give meaning to our triumphs.

EEL4834 Lecture Online

The lecture I recorded on Friday to be shown today (while I am away at an NSF workshop), is now online.

You can watch it here.

Update 9/12/2007: If the quality of the above is not crappy enough for you, I made an mp4 version which you can put on your ipod. I recommend following the slides with the pdf version posted to the forums. Also, the real time use of the python interpreter is very hard to follow in the video (due to the low resolution), that’s why it pays to come to class.

Back in Gainesville.

I’m back in Gainesville. Let me say, the security at Ben Gurion is tight. They totally turned me upside down for about an hour, LITERALLY. They emptied everything from my all my bags, x-rayed every device I had separately, wiped the little bomb-detection swab over every square inch of all my luggage, inside and out. It was totally insane.

I noticed something interesting; all the people doing the screening were attractive young women. Maybe it’s a coincidence (but there were five of them), but I wonder if there is some psychological aspect that would address. Perhaps people are more comfortable with women going through their bags, perhaps people are more compliant, who knows. Finally, after all of this, they did escort me through the metal detectors so I wouldn’t have to wait in line. That was nice of them. Of course, by that time, we were old friends. We were having discussions on the universities of Israel, history of Israel, the new terminal, what discounts they got when flying, how often they find embarrassing things in the bags (every single day, usually more than once), etc…

After twenty four hours of travel I arrived just in time to teach my two hour class today. And still, I had nothing but unbridled enthusiasm for our young minds of tomorrow. That’s the kind of dedication and commitment to excellence for which I am known (in addition to my staggering humility).

Update: they did not literally turn me upside down. They searched me for literally one hour. Thanks to Arijit Ganguly for pointing out this humorously imprecise language.

Greetings from the Holy Land

When I flew into Ben Gurion Airport[wikipedia entry] to go to the Safed Workshop on Cooling and Thermodynamics of Quantum Systems, I spent the first night in Jerusalem. I had a chance to see a bit (by running 12.5 miles in the morning) and then I did some walking around in the Old City, which apparently has been going strong since the 11th century BC.

Here’s me in the market:

Me in the Old City in Jerusalem


Some random people:


Random humans in the old city of Jerusalem

The market was really interesting. They sold everything there: meat, clothes, electronics, spices, toys, pets, and everything in tiny little shops. The streets (which really aren’t streets, they are more like corridors) are PACKED with people, many tourists, but many really appeared to be living their daily life.

The downside as a runner is that both Jerusalem and Safed are very hilly cities. I’m just sure I’m going to injure myself here, but so far so good. I’ve been meaning to do more hill-work, so maybe it’s a good thing.

Out of the country

I’ll be attending the Safed Workshop on Cooling and Thermodynamics of Quantum Systems starting on August 26th. I’ll be staying on a few days to collaborate with my colleague Tal Mor.

I should be in touch with email, and to a limited degree cell phone, while I’m gone.

I’ll be returning to the US on the morning of September 6th, which is easy to remember (9/6), and also the reversal of by birthday (6/9).

Syllabus for 4834

I have just posted the syllabus for EEL4834. If you’re interested in this course, please take a look.

The EEL 4834 course website is on my wiki.

Congratulations Dr. Ungsik Kim

On Saturday, I had the pleasure of escorting Dr. Ungsik Kim at his graduation ceremony. Ungsik is my first student to graduate with a Ph.D. He was originally a student of Jianbo Gao and Jianbo certainly deserves much of the credit for guiding Ungsik’s research.

Ungsik will likely be taking a job in his native South Korea now that he has completed his Ph.D.

Ungsik, it was my pleasure to work with you, and I know everyone here at the University of Florida wishes you great success in your future.

Certainty

In mathematics and to a large degree in computer programming, one strives for absolute certainty. Unfortunately for those that spend a lot of their professional life in such realms, such certainty it almost never achieved elsewhere in life.

At this point, it’s time for the obligatory reference to quantum mechanics and the uncertainty principle. I guess I need to remember my physics more than my mathematics: the more precision I have about one thing, the less I may have about another*

*This is only true for certain so-called complimentary variables, unfortunately, it would seem real life is full of them.

Update 9/12/2007: Another author argues that programming can ruin your life.

3 miles (4.83 km) in 18:09 (6:03/mile)

I ran in the 29th Annual Melon Run on Independence Day. I came in 3rd in the 30-34 age group and won a seedless watermelon.

I had the goal of being sub 6 min/mile in this race, but unfortunately I didn’t quite make it. I actually had a second more ambitious goal of 5:50/mile, but clearly I was pretty far from that yesterday.

My first mile was on track at 5:33. By the second mile, I was a few seconds behind where I wanted to be, and I guess I lost even more ground in the third mile. I think I need to be more aware of the time during my next race. I really only checked the time about three times during the race. Also, I need to set my GPS watch to show my overall pace. The instantaneous pace is very noisy and tends to greatly underestimate my speed, which is very demoralizing.

At the end of the race, I somehow thought I had made my goal. I guess my brain was really not working properly. It was a few minutes before I realized I had not.

So, it’s back to training. Next time I’ll break then 6 minute/mile pace.

Save Internet Radio

Today is the Day of Silence for Internet radio. Please take a moment to call your congressional representatives about the Internet radio issue. The problem, if you aren’t aware, is that on July 15, 2007, unless new law is passed, Internet radio stations will have to pay very large fees (terrestrial (AM/FM) radio doesn’t have to pay any, and satellite radio has to pay 7.5 % of revenue). This is clearly unfair. There is a bill being proposed to bring the royalties in line with satellite radio (S1353 in the Senate and HR 2060 in the House).

See SaveNetRadio.org for more information.

Using Gmail

I’ve written about my mail usage before [1, 2]. Recently, I’ve experimented with Gmail. I’ve had my reservations about using web mail in the past, but it does have several positive features.

Gmail’s labels are superior to any filing system I’ve seen. Traditionally, information on computers was organized in a tree. The idea of labels or tags is to organize information as a bipartite graph, with the labels being one set and the objects being labeled the other. This allows you to attach multiple labels to a single email. Since you can search for messages with a given label (in Gmail use “label:example” to search for messages labeled with “example”), it is easy to find messages tagged with a set of labels. This makes finding well tagged email very easy. Search in gmail is good, but using my previous setup I also had excellent search via the Mairix email search and indexing tool. Gmail does make it trivial to use multiple computers to access my mail, something I had set up previously, but my setup had a lot of moving parts and required some effort when going to a new machine for the first time.

As for Gmail’s downsides, several important ones come to mind:

  • requirement to edit my mail in a form textbox rather than a real text editor
  • inability to access gmail offline
  • requirement to trust gmail with my most important data, and the inability to automatically forward outgoing email to another address (for backup)
  • requirement to use the mouse for many operations

It turns out, all of the above can be addressed with Firefox add-ons.

Since editting big emails in a text box is no fun, I installed It’s all text to allow me to use vim (or really gvim) to edit my mails. Using vim’s autocmd feature I set up some specific gmail options:

augroup gmail
"Remove all gmail commands
au!
autocmd BufReadPost mail.google*.txt :syn on
autocmd BufReadPost mail.google*.txt :set syn=mail
autocmd BufReadPost mail.google*.txt :set tw=78
autocmd BufReadPost mail.google*.txt :set spelllang=en
autocmd BufReadPost mail.google*.txt :set spell
autocmd BufReadPost mail.google*.txt :set spellfile="$HOME/.vim/spell/en.latin
1.spl"
augroup END

I’m not a vim expert, so the above can probably be made more elegant. So, text editor problem solved.

As for offline gmail, that has not been solved. Firefox 3 will support offline web apps. In the mean time, Google has released a free software library called Google Gears to enable offline support in web apps (it is already supported in Google Reader. So, offline gmail seems to be likely in the near future. Some have argued, there is really only one use-case of offline gmail, and it’s really not that important. Though, not offline, gmail does have a very full featured java applet for your phone that can access your mail (visit http://gmail.com/app on your phone to install it). This is incredibly convienient. It means you can read mail, send quick replies and search your mail all from a java compatible phone. This is extremely useful, and probably the killer app for my conversion to gmail.

As for the concern of trusting gmail with my important email data. I just learned to stop worrying. I keep a backup copy of all my mail on my personal server (all mail sent to me has a copy sent to my server). Also, I found a Greasemonkey script to automatically bcc in Gmail. I use this to make sure all my sent mail is also copied to my personal server. Since I already sent a copy of mail to gmail even when I wasn’t using gmail full time (using gmail as a backup email system), they already had my mail, so, what’s the big deal?

Using the mouse to navigate my email slows me down. If you don’t get 100 messages a day (or more), maybe you don’t really care, but being as efficient as possible with email saves me a lot of time during my day. Gmail has some keyboard shortcuts, but they don’t support labeling or several other operations. Fortunately, as part of the Better Gmail Firefox add-on, there is an extended suite of keyboard shortcuts. One must specifically enable the extended keyboard shortcuts (Tools :: Add-ons :: Better Gmail Preferences :: Macros), but I highly recommend it. The ability to create new labels and add labels to messages without touching the mouse is a great feature.

There is one last thing I want to mention, and that is speed. Javascript applications in the browser are slow. It’s not a total disaster, but it does feel a bit like 1995. There is hope on the horizon. Adobe donated a virtual machine for Javascript to Mozilla called Tamarin. Tamarin is slated to appear in Firefox 4 and should make javascript much faster on Firefox. Since some of Firefox is coded in Javascript (from what I understand) it may also make Firefox faster in general. I’ll be looking forward to it.

Lastly, there is one downside to using Gmail: everyone knows how to use it and attackers can focus on a big target. Since my previous mail setup was esoteric (most Windows users would be completely lost trying to eavesdrop on me due to their inability to use mutt or mairix), there might have been a certain level of security through obscurity. It wouldn’t keep out a determined attacker, but casual eavesdroppers would have a very hard time. Since so many people use Gmail, clearly attackers are always looking for ways to get in. Once in, the attacker could find passwords, credit card numbers and social security numbers with a few well crafted search queries executed over a large number of Gmail users, potentially including myself. However, as I mentioned before, I was already accepting this risk by using Gmail as a backup solution, so the marginal increase in risk is nil.

15,000 miles on 329 gallons (or one year with a Prius)

A little over a year ago I bought a Toyota Prius. I’ve been tracking my gas usage for a year and recently I paid more then $3/gallon for the first time, so I thought it was time to report on the Prius.

There were two reasons I bought a Prius. First, it’s a fun car. It really feels like the future, and I love it. The dashboard is beautiful, the backup camera is fun, my in-dash MP3 cd changer is great, the smart key (I don’t need to remove it from my pocket to enter the car, lock the door or start the car) is great, I use the bluetooth speakerphone a lot, and it has plenty of room. It’s a great car. I really love it. Secondly, it gets much better gas mileage than most cars, so I potentially save money (I’ll discuss that more in a bit) and I reduce pollution due to me burning less gasoline. On the first point you will either agree with me or not, but on the second issue we can be a little more data oriented.

First, let’s take a look at gas prices in the US. I downloaded this retail gasoline data from the DOE.
plot of gas price data
The x-axis is weeks since August 20, 1990. For most of the 90s, gas prices were stable. Since then, they’ve been growing. From the data we can clearly see that something has changed in the past 2-3 years as the fluctuation in prices have grown dramatically. I did two fits to this data to predict prices over the next five years. Both are exponential fits, one looks at all the data since 1990, the other only the past 5 years. From this we might expect gas prices to be between 3-6 dollars in 5 years. Since gas prices are over 3 dollars today, I guess 3 dollars 5 years from now is going to be an underestimate.

Coming to the Prius, how has my personal gas mileage been? Here’s a summary:

Total Miles 14999.0
Total Gallons 329.065
Total Cost 823.21
Ave. MPG 45.58
Std. Dev. MPG 3.346
Max MPG 52.58
Min MPG 39.58

I met the guy who runs FLHybrid, and he uses various tricks (keeps his tires inflated to a higher pressure, drives more carefully, etc.) to achieve over 50 MPG regularly.

So, I spent $823 to drive 15K miles in a year, and I got 46 MPG. If I bought a car that got 23 MPG, I would have paid $1646 to drive the same distance. Naively, if we extrapolate for 5 more years with constant gas prices, I’ll save $4938. In addition to these ongoing cost savings, I got a $3100 tax credit this year on my income taxes. So, adding that in, that’s $8038 saved by buying the Prius over 6 years. It is true that the sticker price of the Prius is higher (say 22-25K) than a Civic (say 15-17K), but when you add in the $8000 saved, it may well be worth it. Indeed, even ignoring the tax credit, Intellichoice says you have a lower total cost of ownership with the 2006 Prius ($19,897 over 5 years excluding tax credit) than the 2006 Civic 4 Door ($22,543 over 5 years) (ownership costs include expected maintenance, fuel costs, and depreciation amongst other things). In fact, the Prius is the cheapest car to own according to Intellichoice.

Of course, fuel costs are very difficult to predict. If we average 50% higher fuel costs over the next 5 years than we did over the last year I will save $6,100 over the next 5 years (more than one 1K more than I estimated above). Clearly there is risk involved in such predictions. One thing that is easy to predict is how many gallons of gas I’ll use over 6 years since mileage driven is not so variable. I can expect to use 1,974 gallons over 6 years of car ownership. Compared to a car that only gets 23 MPG (half what I get), I am saving almost 2000 gallons of gas from being burned. Burning a gallon of gas releases 6 lbs. of carbon into the atmosphere, so over 6 years I’ll release 12,000 lbs. (6 tons!) less carbon. I don’t know what you’re willing to pay to prevent 6 tons of carbon from going into the air, but I’m willing to pay more then zero (apparently, a carbon offset for 12,000 lbs would cost about 30 bucks). Since, I figure I’m already saving money by buying a Prius, this is gravy (and you and your progeny get the benefit too)! It’s a shame the hybrid comes with the extra up-front costs, because most people will opt for lower up-front costs even if it costs them more in the long run. Hopefully as gas gets more and more expensive, the difference will be too great to ignore.

So there you go. I’m a happy Prius owner, I did it because I loved the car, and I’d save money and pollute less. One year into it, I feel great. I still love the car.

Bookmarks on multiple computers

I make frequent use of two computers: my laptop and my home desktop. In order to keep things sane, I keep my home directory organized on both and I use rsync to keep them synchronized. I use Firefox for web browsing. Firefox makes it very easy to install addons to add features to your web browser.

Until last night, I relied on Google Browser Sync to keep my bookmarks synchronized. This is nice, however, I need to have it installed on each computer I use to get the benefit. If, for instance, I use a friend’s computer, I can’t see my bookmarks without installing Google Browser Sync and entering my password. Last night, I discovered Del.icio.us Bookmarks. This allows you to use Del.icio.us as your bookmarks inside Firefox.

This is really useful, because if I use a computer without Del.icio.us Bookmarks installed, I can still visit my Del.icio.us page and find my bookmarks. Also, it means that I’m more actively using del.icio.us which helps my friends see what I’m interested in (and I also use it to see what my friends are interested in).

I want to highly recommend this tool to everyone.

Finally, I want to end with the following comment. Not everyone wants to produce content (be it science, music, movies, sculpture, etc…), but many more are willing to produce meta-content, or content about content. By using tools like del.icio.us, people can contribute to the value of the web by identifying interesting URLs and by labeling them. Related to this are systems like Google Reader with its shared items or Yahoo Pipes. Such tools allow you to be a sort of commentator or reviewer. Isn’t that so much more interesting than one-way media like television and radio? With these kinds of systems you can get in on the fun, showing the world what you find interesting. I recommend this to everyone.

If you make a del.icio.us page, or have any RSS feeds, please let me know. I like to see what my friends and colleagues are interested in. My del.icio.us feed is here and my Google Shared items feed is here (you can also browse my shared items). If you really want to get obsessive, you can watch which songs I’m listening to with my Last.fm RSS feed.

So long Suma!

Our dear Suma Adabala is leaving the ACIS lab for Microsoft. She’ll be working on Windows Live and we all wish her the best.

Last night she had us over to her apartment (and even invited our dogs). At the party, I played Suma a song I wrote for her. It is intended to be a bit humorous:

Hope you’re better off
at Microsoft
At least your paycheck
will be getting bigger

I don’t use
Windows Live
That’s okay
I’ll still miss you anyway

I’ll always speak about you fondly
(even though you now work for the devil)
I’ll always think about the good times

Like the time you gave me
a ride to the party
or debating causes
of the great depression

Or stories of you
working on a horse farm
and fearless dogs
racing with the horses

When we get sad we’ll read your source code
(from Invigo middleware)
We’ll think of you when we see Blue Screens

And when you think
of north central florida
We hope that you’ll
. . .

Think of ACIS
Think of ACIS
Think of ACIS
Think of ACIS

Update:
Vineet took some pictures from the party. Here is me performing the above song:
POB playing guitar

Discretization of Friendship

I don’t use many social networking websites. I used to have an account with Orkut (since I, like many geeks, have a pathological Google fetish), and I have played around with LinkedIn. I don’t use any of the “popular” ones (are MySpace and FaceBook popular?). I do like using Last.fm, which allows me to see what music my friends are listening to.

With all of these systems, you can make links to friends. There is a boolean value between every pair of users, are we friends: True or False. What an idea, your relationships reduced to their most significant bits. This also comes up in instant messaging systems. Each is either on your list or not.

Friendships are dynamic. Interesting things happen at both transitions 0 -> 1 and 1 -> 0. Generally the 0 -> 1 transition is happy, fun, exciting, etc. The 1 -> 0 one is not quite as much fun (depending on your idea of fun).

The state changes have their own anxieties. 0 -> 1 is an opportunity for embarrassment or disappointment. What if the other person thinks you are a 0, but you really want to be a 1. What if someone wants to be a 1 to you, but you’re really more comfortable with them as a 0. On the other hand, the 1 -> 0 transition is clearly a sad one. When is the right time to make the change? Was there some big fight? Did things just taper off? How long should a pair go without talking to become a 0?

I’ve been through a lot more 0 -> 1 changes than 1 -> 0 changes (I guess everyone has). I still remember my first 1 -> 0. At first, I thought there was sometime wrong with the system (hey, we’re friends… aren’t we?… ohhhh). I imagine humans who grow up with such systems might find them natural (perhaps even comforting), but as someone who grew up with friendship states being very subtle variables, seeing them represented as single bits can be strange.

Finding Probability of a Lost Package

It occurred to me today that by looking at the cost of insurance for various shippers, you can bound the probability of package loss. If C is the cost of the insurance, and I is the insured amount, and we assume that the shipper at least breaks even by selling insurance we have:

C - p I > 0

Which means that C/I > p. I looked this information up for UPS, USPS, and Fedex at the values of 100, 500, 1000 US dollars. For UPS and Fedex, I couldn’t find the cost of insurance, but could estimate it from increasing the value of the item (it seems both offer a certain amount of insurance for free, which appears to be 100 dollars). USPS publishes their insurance costs. Looking only at the 500 and 1000 dollar amounts I have:

USPS: p < 1.2 % (2.3% for lower amounts, and tending to 1.05% in the limit of the most insurance)
UPS: p < 4/500 = 0.8 %
Fedex: p < 2.75/500 = 0.55%

It’s interesting to note that these are upper bounds assuming all insurance is profitable. If some cases are not profitable the bound may be violated. If the insurance is overpriced, the bound may be very weak, but from this is seems that packages are probably lost with probability on the order of 1% (with Fedex loosing 1/2 the packages of USPS and about 2/3 of UPS).

It would be interesting to compare this to experiences of large scale ebay sellers (or other online retailers). I can’t seem to find a link where any of the above shippers publish statistics on this.

Talk for HKN

I gave a talk for the UF chapter of Eta Kappa Nu yesterday. My slides in PDF format are online.

I used the Beamer package for LaTeX to produce this talk. For some reason, Acrobat has problems with one of the images included, but my Free PDF reader (Evince) can show it just fine. More evidence of the superiority of Free Software.

Update:
Brian Sapp (President Epsilon Sigma Chapter Eta Kappa Nu) forwarded a link to the RSA Secret-Key Challenge. 64-bit RC5 keys have been brute forced (they try all possible keys until they decrypt the message). The Factoring Challenge is also interesting. Recently, a 640 bit number was factored to win 20,000 dollars! If you have a (sufficiently large and accurate) quantum computer, it looks like you can get 605,000 dollars from RSA by factoring all the numbers on this page.

Planet ACIS

I have installed the RSS aggregator Planet to produce Planet ACIS. This is an aggregation of blogs from members of the ACIS Lab.

So far, there are only a few (semi-)active bloggers. Hopefully this will encourage more ACIS people to blog.