propeller_beanie posts

Sometimes you just have to write a program.

20120316.friday   comments=2   propeller_beanie  

I’m a UNIX pipe enthusiast.

Well, that came out a little more bong-like than intended.

What I mean to say is that, when I have a computer problem to solve, I prefer to solve it using ready-made little programs that are then strung together to do the job. The metaphorical string is the UNIX pipe operator — the vertical bar thingy on your keyboard that looks like this: | — which simply takes the output of one program and makes it the input to the next.

It sounds simple. It is simple. And yet it can do astounding things. All without having to write a program, in the traditional sense.

The other day I strung together a doozy of a command necklace to download the web pages for a course at the College, strip out the navigation links, simplify the HTML code, and then package the whole megillah into a format that could be loaded into the College’s learning management system.

For a number of reasons, not the least of which my hubris, it didn’t really work all that well.

So, after the requisite fruitless twiddling-of-the-command-switches exercise, I threw out the idea and began writing it all out again as a program, written in Python this time around. I like Python.

There’s no life lesson in any of this, told by way of pipe analogies. No particular computer programming lesson either.

Sometimes you can take a big problem and break it into simple, easily digestible chunks, and solve it with off-the-shelf utilities. Sometimes you just have to write a program.

Reminders for setting up an alternate python-versioned Django site on a non-root URL under WSGI on Apache

20120103.tuesday   comments=2   propeller_beanie  

Lord help me, but that’s the title I’m going with. In case it’s not already obvious, you will not desire to read the following. Its existence is merely to document the tricky issues that some other sap (future-me, most likely) will encounter under a very precise set of circumstances, as enumerated in the title.

The first, and most frustipating, problem was getting mod_wsgi to use the proper Python libraries. Because I had to leave the stock Python 2.4 in place but needed 2.6 to run Django, it only dawned on me after many hours to re-configure and compile mod_wsgi with an explicit reference to the Python 2.6 version. Extra care is also needed to make sure that the other Python modules are built with the correct version and end up in the proper site-packages/ directory.

Don’t forget to point to the proper Python version in the manage.py file’s shebang.

The mod_wsgi documentation is a snap to read, but only once you understand it thoroughly. I eventually stumbled upon WSGIPythonPath (Edit: I meant the python-path argument to WSGIDaemonProcess, since WSGIPythonPath doesn’t work in daemon mode), which did make module inclusion so much more pleasant. The more you can do with Apache directives, the more simple becomes your .wsgi file. In the end, mine was just:

import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
os.environ['PYTHON_EGG_CACHE'] = '/tmp'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

Put the .wsgi file somewhere removed from your Django app directory. Somewhere that’s easily accessible to the httpd daemon, like DocumentRoot.

Running elsewhere than a web root is always dicey in Django. An extra complication is that WSGIScriptAlias gives you app it’s own root URL, but that nothing in Django knows this, so you have to adjust all links with a – preferably not hardcoded — root path that matches the WSGIScriptAlias’s setting. Same goes for STATIC_URL and ADMIN_MEDIA_PREFIX in settings.py, along with matching Apache Alias directives and Directory permissions.

Oh, and if you don’t include HTTP 404 and 500 error templates, Django won’t run in non-DEBUG mode. I kept seeing the error that it couldn’t load a 500 template and thinking that meant it was trying to show me an actual HTTP 500 error (of which I had seen plenty thus far) and couldn’t find the template to do so.

Finally, if you’re not running mod_wsgi in daemon mode, you’ll need to restart Apache after every source code change. I must’ve fixed the same problem five times in five different ways before I realized that all of my fixes had worked, but I was still viewing the old code running. Ay Caramba.

So that right there is how I spent about ten hours on New Year’s Day.

The Worst Icon

20110216.wednesday   comments=2   propeller_beanie  

You run into some bad icons in the computer business. Little guiding images that look like nothing, guide you nowhere, and delete all your files when you click them.

There are also many antiquated icons, but at least they once meant something.

While working on Carole’s Mac the other day, I came across this gem:

That icon is pretty much ubiquitous in the Mac world and, I think we can agree, seems to represent a circle-embossing application of some sort.

But we’d be wrong. It’s a hard drive. A necessary piece of hardware to be sure, but not one that nine out of ten people have ever laid eyes upon. Mac owners are contractually forbidden, under pain of the installation of a second mouse button, from opening their sleek designer cases to even peek at such a thing. It’s like using an image of a carburettor, speaking of antiquated things, to identify the ignition switch in your car.

So what does it do? Oh, that’s the icon you click to look at your files or find applications. What happens when you drag it to the Trash Bin? I’m too terrified to try, but I have visions of the drive shooting out of the case with shards of plastic and aluminum spraying into my eyes.

It’s not often I can say this, but Microsoft wins this user interface battle. The Start button makes a heckuva lot more sense than a diagram of a computer’s innards.

iTouch Dressed for Danger in an OtterBox

20110108.saturday   comments=nil   propeller_beanie  

Known for our butterfingers, Carole and I both ordered OtterBox protective cases for our mobile gewgaws. Hers was the lighter Commuter model for her HTC Android phone which even works with the swing-out keyboard, but I got the indestructo Defender case for my iTouch.

iTouch self portrait. Background courtesy of the Home Hardware lumber desk. Splayed-finger hand modelling by Dave.

It’s made of two snap-on hard plastic shells (one with a built-in screen protector) and a grippy rubber sleeve that stretches over the whole thing, without blocking any of the important orifices (including the Apple logo on the back).

The case actually makes it much easier to grasp the thing, because the iTouch is actually a little too thin, if you ask me. Beefing it up with the OtterBox gives it a much better “heft.”

I haven’t tested its durability yet, and hope never to, but it seems solid. I recommend it highly, and, even though the company is in the States, they managed to deliver all the way up here in only a couple of days for ten bucks.

It’s like living inside a technical support certification exam.

20101227.monday   comments=1   propeller_beanie  

Everything in life can be explained with three circles. Except bicycles.

As I tweeted on a frosty Christmas afternoon, Santa tucked an iPod Touch into my stocking. I had explained earlier to Carole — Santa’s agent — that I “needed” one for a) a mobile app project that I start in the new year, b) translation for our upcoming Korea & Japan trip, and c) because it’s totally cool and doesn’t require a soul-crushing contract with Bell Immobility.

So now, what with Carole buying a reconditioned MacBook Pro from her school, our house literally hums with operating systems:

  • iOS,
  • Mac OS X,
  • Android,
  • virtualized Windows XP/Vista/7,
  • two flavours of Ubuntu Linux, and
  • whatever it is that’s running the kettle.

All we need now is a Blackberry and the thing that Palm is grasping as an emergency flotation device and the circle will be complete. Heaven help us when it comes time to upgrade.

Go ahead, Yukon Energy/Electrical, make my day.

20100902.thursday   comments=nil   propeller_beanie  

I dare you. In fact, on the advice of my legal counsel, I double dare you. Just try to kill my laptop with a power spike:

For portability, the 25-pound uninterruptible power supply may be fitted with an attractive carrying handle.

(It’s actually thought to be a bad idea to daisy-chain surge protectors. That didn’t stop me from once attempting to build a perpetual electrical generation machine by plugging together two uninterruptible power supplies in a loop. Genius!)

Clock radios: we can finally do better

20100619.saturday   comments=nil   propeller_beanie  

A couple of years ago, I complained at length about the state of the art in alarm clock radios. Doing so doesn’t seem to have spurred anyone to invent a better one, but it recently occurred to me that, instead of conceiving a new device from the ground up, one could simply invoke last year’s omnipresent tagline — “there’s an app for that!” — and be done with it.

Apple doesn’t seem to allow you to search the App Store without owning one of their precious whatnots (Google’s Android isn’t any better), but I eventually discovered a site that unveils the complete list of iPhone and iPad apps. Sadly, the clock-related apps that I found strive merely to replicate the form and function of yesteryear’s nightstand specials. Let’s review the shortcomings of those models:

  1. miserable timekeeping accuracy,
  2. terrible radio reception and sound quality,
  3. infarction-inducing buzzers,
  4. tedious and minuscule controls,
  5. fixed nine-minute snooze intervals,
  6. displays that render 0, 6, 8, and 9 almost identically, and
  7. poor or non-existent blackout protection.

By itself, the smartphone platform is able to address complaints #1 and #7 with network time protocols and onboard batteries. The apps can in turn handle numbers #2 and #3 through audio files or radio streaming easily enough, and some feature ingenious solutions for #4: swiping and shaking motions for scheduling and extinguishing alarms. All of the apps are intent on reproducing problems #5 and #6 though. The upshot is that the current stable of clock apps are, at best, marginally superior to the Groundhog Day flippers.

What I’m looking for is something way beyond that. Here’s a not-an-artist’s rendition of my dream (pun!) alarm clock:

You too can enjoy the ultimate alarm clock experience for the low, low introductory price of just $749, plus shipping and fondling.

Ain’t she a peach? I’m sure an interface wiz could do much better, but at a minimum, here’s what I’d expect from such a wondrous creation:

  • analog and digital time representations, easily read from a metre’s distance (more, if using an iPad);
  • the date;
  • automatic time zone adjustment;
  • the current weather and temperature;
  • the time of the next alarm;
  • an adjustable snooze duration;
  • impending appointments from my calendar;
  • indication of any missed calls or messages while I was asleep;
  • multiple separate alarms for one person, or for many;
  • a charging cradle that will display the clock in my preferred orientation;
  • automatic screen brightness adjustment using the phone’s camera to detect ambient light levels;
  • choice of radio or television streams as the alarm, or stored audio files;
  • alarm sound levels that increase gradually, along with the screen brightness;
  • motion, swipe, or shake detection to turn off a ringing alarm;
  • voice recognition for common settings (e.g., alarm time, snooze duration, phone do-not-disturb);
  • white noise or soothing sound generation with configurable sleep timer setting; and
  • other brilliant ideas that I can’t think of right this minute.

From what I understand, virtually all of that can be accomplished with today’s technology. Packing in too many features is a problem in itself, but given the cost of these smartphones, why not exploit them as as much as possible for the third of your life that you’re unconscious?

Putting all of that together is something I could do, but someone else could do it better. If you can pull it off, I’ll even promise to buy my first smartphone just to run your app.

I want you to invent the following…

20100611.friday   comments=4   propeller_beanie  

I have a problem in need of a solution. I think I can best describe my problem through interpretive dance by showing you this photograph:

Power bar spaghetti.

It's not so much the idea that boggles, it's that someone actually thought this scene worthy of a photograph.

In this age of mobile, rechargeable devices, the travesty illustrated above is not uncommon. There are actually two problems with this power strip arrangement:

  1. there is not enough space between the outlets to directly plug-in the transformer blocks; and
  2. either all of the transformers are receiving power or none are, and if all of them are, they’re drawing current even when not used and heating up as a result.

Problem #1 has already been solved in various and ingenious ways.

Problem #2 is what concerns me. I would prefer to turn on the sockets individually, so that only the transformers in use would draw electricity. I also don’t want to spend the day plugging and unplugging like a one-ringy-dingy Ernestine.

Since I’ve been unable to find such a device anywhere, I’ve put together this mock-up to entice prospective inventors. Behold, the SwitchPlex™:

The SwitchPlex

Okay, I also have a problem with photo-editing software.

My SwitchPlex™ mockup does have a few shortcomings. For one, the outlets should be facing sideways. For another, it needs more outlets. Looking more closely, the switches should read On/Off not Reset/Off, but what can you do?

Noble inventor, your task is set before you. In exchange for your work, I hereby surrender all intellectual property rights to the SwitchPlex™. I’ll expect to see it in finer stores everywhere by Christmas.

Readability is the Japanese tea garden of the web.

20100607.monday   comments=nil   propeller_beanie  

There is a school of web design, beloved by news organizations, that lives by the motto “that space can be filled.” To these folks, white pixels are a lost opportunity cost.

Every so often, I come across browser plug-ins that promise to cleanse these sardined pages, but each one has some unpardonable fault: missing text, choppy layout, inconsistent font size, or — Heavens to Betsy! — advertisements.

Last week I found Readability, a clever snippet of JavaScript that can be used from any browser as a bookmarklet. Someone has also written convenient Readability add-ons for Chrome and Firefox.

In short, Readability takes pretty much any complex web page, extracts the main story text, and presents it in a simple format of your choosing. This announcement explains the concept and demonstrates it in action with a video.

For example, consider the following eye-gouging article presentation. We know there must be a story in there somewhere. On the left side, maybe?

You know what would really spruce up this page? Dancing leprechauns, for starters.

With a quick click of the Readability button, the article is transformed:

Martha, I do believe I'll take my piña colada on the south terrace.

An article that you can actually read. On the internet, no less. I thought I’d never see the day.

I have predicted the future of Social Networking.

20100519.wednesday   comments=4   propeller_beanie  

While true, there are at least two caveats that must be observed of my bold statement:

Whoops! Looks like the spotting scope is mounted crooked again.

To my way of thinking, there are two things wrong with social networking as it exists today:

  1. The control over my privacy is delegated to multiple third parties, all of which financially benefit from the elimination of my privacy.
  2. My contributions to the multiple social services are scattered, and can’t be reconstituted into a single stream of expression.

Facebook is the exemplar of the first point. Much has been made of Facebook’s recent changes to their privacy policy, as well as the — seemingly intentional — complexity of the site’s privacy settings. The more personal information that Facebook can expose, the more it can be exploited for advertising profit. To counter this exploitation, tools to monitor and restrict Facebook’s myriad settings have appeared, and Quit Facebook Day has been organized for the 31st of the month.

I haven’t seen my second point discussed, but it goes something like this: if I tweet a couple of somethings, write something on a friend’s wall, discuss something in a blog comment, post a picture of me doing something, or send an e-mail with something in the subject line, there’s no way to tie all of those together, even if they all share the same something. Instead of forming my complete opinion on the topic of this something, the fragmented ideas are segregated: into Twitter, Facebook, WordPress, Flickr, and Google Mail, respectively.

A diagram of the current state of the social network, like the following, would look much, much better if designed by professionals.

Marilyn and Elvis popped pills, and Sherlock shot up regularly, so what was Harry's vice? Bertie Bott's peyote-flavour beans?

For something called a social network, the people don’t actually socialize directly with each other, and the intermediaries have far too much control over the method and content of the social interactions.

As a solution to the problem, I predict the following:

The future social network is one in which everyone hosts all of their own information themselves, uses external services merely as aggregating proxies, and is bound together by an open networking protocol, in the spirit of HTTP.

Try as I might, I couldn’t seem to make that any simpler. So here it is again:

  1. All of the information that you previously shared as tweets, comments, discussions, blog posts, e-mails, chats, and so on, is now stored in a single location of your choosing, and under your control.
  2. Services like Facebook and Twitter still exist and allow you to connect with others and share your information, but only by using transient references to the information that you host.
  3. A networking protocol, specifically designed for sharing social information, binds everything together.

So the — unprofessionally executed — diagram of the future state of the social network now appears thus:

Just imagine that ring of retweets.

The people are all directly connected, but the familiar and easy-to-use (‽) services still play a role in making and maintaining the social interactions. In the example above, Elvis is writing on Harry’s wall. Facebook makes the connection and provides the interface for typing on someone’s wall, but the content of Elvis’s posting is hosted by Elvis, and completely under his control. If the message is sensitive, and intended only for Harry, Elvis can forbid access to it from anyone else. Because Facebook does not store the posting, Elvis may also revoke it at any time. Because Elvis stores all of his own content, he may also combine it together in any way that he sees fit.

Ta da!

I have blithely skated past many implementation details, but there are nevertheless at least two projects underway to implement my (ahem) prediction: Diaspora and OneSocialWeb. The former collected a barrowful of cash donations following Facebook’s latest privacy indiscretion, but the latter is further along in development and employs just the sort of open social protocol I had hoped for: XMPP.

Facebook and the others won’t willingly surrender their control, but the short history of the web already tells many stories of users hopscotching past intransigent services and companies. I predict the same in this instance.

(Diagram icons courtesy of Iconka and jwloh.)