Saturday, July 12, 2008

My close call with greatness

I was thiiiiiis close to greatness last night. The workshop had ended and a bunch of us were getting ready to go to Chinatown to get dinner. Goeff Knauth (instructor at Lycoming College in PA and one of the attendees) asks, "shall I call Richard Stallman and invite him to dinner?"

Can someone really turn down an invitation like that?

A phone call was made; message left; and shortly returned. Richard would love to join us, but is currently in France and can't make it in time.

Bummer. But how cool would that have been?

Sunday, June 15, 2008

I'm a stickler for quality. And a cheapskate at heart. Conflict arises, especially when I'm getting into a new hobby or activity.

A couple of cases in point:

About a year ago I wanted to buy one of these new digital oscilloscopes. They have LCD displays, can capture signals, and do real-time analyses on the inputs. Neat stuff, and much better than their analog predecessors.

Like most things, they come in a variety of price points. The cheaper units has B&W LCD displays and narrower bandwidth. Being my first digital o-scope, I bought a used one off eBay for about $200. After playing with it for a few hours, I wanted more. More bandwidth, faster display, color.

My next purchase was a new, Chinese-made color LCD unit for about $1,000. It had great reviews online and, indeed, it's a nice unit. But although it had a huge memory for capturing digital signals, the display was kind of "noisy" and it didn't quite have the bandwidth I lusted after.

Finally, I purchased the unit I should have bought in the first place: a Tektronix TS3012 color LCD digital storage oscilloscope for about $1,200. It's fast, built like a tank, and still supported by Tektronix even though it's used (another eBay purchase).

In other words, I spent on my dream 'scope the same amount of money I spent on the first two 'scopes that are now sitting on a shelf. I spent double, needlessly.

Another case in point: as a teacher, I'm getting more into online instruction. And I might dabble in podcasting. So I bought the typical starter kit:

Basic condenser microphone (Audio-Technica 2020), $100.
Basic mixer (Behringer 802), $60.
iMic USB interface, $50.

But I quickly ran into limitations. Being a condenser mic, the AT2020 picked up way too much room noise for my taste. So I upgraded to the Electro-Voice ND767A super-cardioid dynamic, $130.

The wimpy Behringer mixer was quickly replaced with a Yamaha MW10C, $200.

Boy, that Heil PR-20 microphone sure is looking nice. Heil, known among podcasters for its PR-40 studio microphone, makes great microphones right here in the USA. Well, better order one of those. ($150)

Then I start really getting into different ways that might students might be "calling" into class: either through CCCConfer or through Skype. I need a way to cross-mix the two inputs. And I'd love to have Firewire so I can send all the audio inputs to the computer separately, rather than mixing them down to a single stereo track. That Yamaha mixer just isn't going to cut it.

So, off to eBay to get a Mackie Onyx 1220 Firewire mixer, $800.

After using it for a few hours, I still can't quite get the inputs to mix correctly. Next purchase, Behringer UB1622FX mixer along with a Behringer UCA202 USB interface (to be used in conjunction with the iMic). Total for this purchase: $170.

But wait! I think I might be able to get the Mackie to do what I want! Too late, the Behringer is on its way.

Finally, here we are on Sunday evening. I'm lusting after that Heil PR-40 again -- the microphone I should have bought in the first place.

Sigh.

Wednesday, March 12, 2008

Finding the median value in SQL

Most SQL dialects don't come with a median function. But one can be cobbled together using the procedural programming language that accompanies most databases.

They work like this:
1. Sort the list of values.
2. Count the number of items in the list.
3. Select the element at position n/2.

A function like this can't be expressed purely in SQL because SQL is not procedural.

I've come up with a median function that uses pure SQL:

select age
from person
where (select count(age) from person p1 where p1.age >= person.age) -
(select count(age) from person p2 where p2.age <= person.age) between 0 and 1;

This technique uses two correlated subqueries. The outer query works through the list of values (in this case, age). As it considers each age in turn, it counts the number of ages that are greater than the target age and the number of ages that are less. The difference between the two should be 0 or 1 (depending on whether there are an odd or even number of ages to consider).

When the difference is 0 or 1, you've found the median value.

This solution is O(n2). Expect it to take a long time on large data sets.

Sunday, March 9, 2008

I'm so excited, and I just can't hide it!

As you know from one of my previous posts, I have a list of things I'd like to do during my lifetime. My upcoming sabbatical is going to give me some elbow room to get a few of the items checked off!

During my spring break, I'm going to make a hologram. I've already got all the raw materials: laser, holographic plates, chemicals. After a quick trip to Home Depot, I'll have the pieces needed to build the table on which holograms are made.

Right after school lets out, in May, I'm heading to Florida to watch the next Space Shuttle liftoff. I've built into my schedule a few extra days in case it doesn't blast off on time. As long as liftoff is within three days of the scheduled date, I'll be OK.

2008 is going to be a great year!

Monday, October 22, 2007

Time Machine: not just for backups

Time Machine occupies just a few bullet points in Apple's list of 300+ new features in Leopard. But it has the ability to fundamentally change the way you and I use our computers.

Disclaimer: I have not actually used Time Machine. My only knowledge of it comes from the public videos and demos and from reading the Mac sites like MacInTouch and The Unofficial Apple Weblog.



From the Apple literature, Time Machine is an easy way to retrieve your lost files. It's being introduced it like that because it's simple to understand. If you've accidentally (or purposefully) deleted a file, you can simply use Time Machine to find it and bring it back. For this use, it's not much different from any other backup software. But the similarity ends there. This is not SuperDuper.

Time Machine maintains a complete history (at hourly intervals) of every file on your computer. To put it a different way, every hour it takes a "snapshot" of your computer and stores the way it looked at that moment. These snapshots comprise a set of "versions" of your files. Time Machine gives you a way to retrieve those versions.

Time Machine is not simply a backup of the way your computer's files currently look. The term "backup" implies a second copy of your current files. Stop thinking about backups. Start thinking about versions. Think about three, four, ten, hundreds of copies of your files, each representing the way it looked at a particular point in time.

Here are a few scenarios that use versions--rather than backups of lost files--as their centerpieces.

Have you ever worked on a long-term project? One that spanned more than a few hours? It could be a project for work. Or it could be that Great American Novel you've been writing. Or an iMovie project of your last vacation. You haven't deleted it; you've simply been changing it. Have you ever messed it up so badly (and saved your mess) that you wished you could go back to the way it was earlier in the day? With Time Machine you can. Just roll back through time to find the last good version of your project. You can use Quick Look to glance at the document to verify it's the one you want. When you find it, restore it.

Some documents are ever-evolving. For example, a real estate office may have a letter they mail out to new clients periodically. When they want to send out a letter, they just change the address and a few words here and there to customize it. Because the document evolves, today's version bears little resemblance to the one they sent out six months ago. What if they wanted to see what the letter looked liked back then and compare it to today's? They can with Time Machine. They don't even have to restore it; just use Quick Look to peek at it.

I'll leave you with this one final revolutionary usage of Time Machine. Most of us have an ever-increasing number of files on our computer. Organizing it all is becoming a chore. We download new files or create them constantly. They clutter up our folders and Desktop. It's maddening. And we should be backing it all up. Of course, you know that Time Machine will help you do the backups.

But think about this: Download or create a new file. Use it for its intended purpose now. Keep it around for an hour or two. Then throw it in the Trash. That's right: don't think about how you might want to use the file later. Never mind that your co-worker will be needing it next week. Or that you might want to refer to it next month. Throw it away now. De-clutter your life. Or at least your Mac.

Ah, don't worry. Time Machine has it. You can always get it back later. Spotlight can help you find it.

This may change the way we build computers. No longer will you need a gigantic primary hard drive that holds all your files, plus an equally monstrous hard drive to back up it all. Instead, your computer has a lean, fast primary storage device big enough to hold the files you're using right now. A few GBs of flash memory will do for most people. The rest--a complete history of every file you've ever worked on--is stored on a large-capacity Time Machine device.

That's the future of computing. Look out, because in a near-future release of OS X, I predict that Time Machine will be the filesystem. There will be no distinction between your "current files" and your "backup files." All your files, current or not, will simply be versions stored in a searchable database. Solaris' ZFS technology will help make that happen.

Saturday, October 6, 2007

Lifetime To-Do List

Doesn't everyone have a list of things they'd like to accomplish/do/see before they die? Here's mine, in no particular order.

See a space shuttle launch.

Experience weightlessness.

Visit Antarctica.

Visit Alaska.

Visit China.

Write an application that gets used by more than 100 people.

Make a hologram.

Make a daguerreotype.

What's yours?

Tuesday, August 21, 2007

iPhone features I'd like to see

OK, I'm thiiiis close to getting an Apple iPhone. I'd have to break my contract with Verizon. But there have been so many times that I've been out and about and wanted to quickly look up something on the web. Or check my email to see if I've been outbid in the last 10 seconds on a digital oscilloscope auction, again.

I've used my friends' iPhones and played with them in the store. As a result, I'm tempted to wait until software updates or a new iPhone model comes out. There are some nifty features missing on the current version that it desperately needs to be really, really usable.

GPS

Think about it: how many times have you been in an unfamiliar town (or even a familiar one) and wanted to know something like "where are the Italian restaurants nearest to me right now?" or "where's the nearest Post Office?" With the current iPhone, you can bring up Google Maps, which is great, but you still need to know what city or ZIP code you are in. What if you don't know your exact current location? You're screwed, because either you can't search at all or you get way too many results.

What I'd like to see is a way for the iPhone to know its current location. GPS would be great, as it would give your location to within 10 feet or so, but for Google maps an exact location isn't necessary. Even knowing your approximate current location would be good enough. I don't know much about cell technology, but I imagine that each cell tower knows its own location. The iPhone could do some triangulation to figure out where it is in relation to the towers, at least well enough to make Google maps searching incredibly useful.

Voice Dialing, Done Right
I use voice dialing when I'm driving. With my headset on, I just touch a button on the phone and ask it to dial one of the people in my contact list. Here's how the conversation with my phone usually goes:

Me: Call Brenda
Phone: Did you say, "Call Brenda?"
Me: Yes
Phone: Which number?
Me: Mobile
Phone: Calling...

My phone has a voice-recoginition system that doesn't need training ("voice-independent recognition"). That is, out of the box, it's able to listen to the user's voice and match it with a name in the contact list. But because the voice recognition isn't tuned to a specific voice (mine), it needs to double-check the match. Hence, the question "Did you say...." What gets me is that it is always correct!

Phone manufacturers, unfortunately, have decided that implementing voice-independent recognition is inherently a binay decision (either it's used for all contacts, or it is not used at all) and, if voice-independent recognition is not used, training it is inherently modal. That is, in order to train the phone to recognize names, the user must go into a special "training" mode.

What I want is a phone that learns.

When I answer "yes" to the query "did you say...", the phone should immediately remember what I just said. The next time I ask to call that name, the training will have already been done. That should be the extent of training the recognition system -- totally transparent to the user.

Games
I need my Tetris and Bejeweled!

VOIP
That's Voice Over IP or, in layman's terms, Skype. Not going to happen, though. The purpose of a mobile phone is to make the carrier rich by charging for minutes of airtime.

On the other hand, T-Mobile is rolling out a new service called T-Mobile Hotspot @ Home in which a WiFi-enabled mobile phone can make free call when in the presence of a WiFi hotspot.

So who knows, maybe we'll see Skype on the iPhone yet.