2010-12-26

Creating Panoramas with Hugin

Like it? This is what the cliffs and the ocean look like at Black's Beach, California. Christmas Eve 2010. See that steep canyon gouged into the cliff face? That's how I got to the beach, on a trail some call the Goat Trail.

I stood at the bottom of this thing and took a picture of where I had come down. Then I took a picture of La Jolla to the South. Then one of the nudie beach to the North. Then one of the waves and the low sun. Then I decided I was just going to cover the whole world around me, and figure out a way to stitch the pictures together.

Back home, I remembered I had used this took, Hugin, to create panoramic images a while back. It was a pain: you had to couple up the images and click on a series of points that matched up. Image 1, image 2, click, click, click, click, click... Then Hugin would figure out just exactly how badly you had screwed up your picture by tilting, turning, panning, etc. and would create a panorama. It took about four hours of tedious work.

I wasn't looking forward to that, so I looked on my computer (apt-cache search panorama) for alternatives. I downloaded all of them. There was a GIMP plugin called pandora that didn't seem to be doing much, but it complained initially about not having an application from hugin installed (I just had to restart GIMP to make it work). There was an "easy to use" application called fotoxx that seemed more primitive than easy to use. There was a CLI app called enblend. Other stuff seemed to be mostly supporting software.

I wept, I gnashed my teeth, and I started Hugin. Lo and behold! It started with a tabbed interface and (miracles!) a WIZARD!!! It promised it would ask you what it wanted, and started by asking about the pictures you wanted to use as a base. Then it started working, actually giving me feedback so that I didn't have to wonder whether it had died on me. Then it came out with a crude map of the panorama. Perfect! It had figured it all out on its own!

Next came a series of optimization steps, and that's where Hugin need to be a little more proactive. For instance, it won't tell you that it will adjust exposure, so you worry how weird things will look like with this particular section overexposed. It also shows you how it tilted and modified the original image to make it fit into the panorama - a real miracle.

Once I figured out the optimization step (about ten minutes), I saved the project for later re-use and exported the image. That was fun!

I should mention at this point that Hugin sensibly leaves parts of the image out that aren't included in the image components. That means that a section at the top and the bottom were missing and needed to be filled out. To get that done, I used the outstandingly marvelous "Smart Remove Selection" plugin for the GIMP.

Use OpenOffice.org to Create an Image Gallery

I went on this hike on Christmas Eve - a steep trail down a ravine, with the most unusual people and the most unusual features. At the end, a gorgeous beach with surfers and pretty ladies with parasols waiting for them. Huge mansions staring down from lofty cliffs, and an amazing sunset that colored the cliffs a golden hue of honey.

I looked at the pictures, and they were pretty. Unfortunately, due to the unusual nature of the features and the number of different things you were looking at, it wasn't quite clear how (or even if) they belonged together, and what the story behind them was. The pictures needed an explanation. A story had to be told.

I did what I do these days when I record a hike: I posted the pictures on Facebook. Add the pictures, add captions, and wait for comments. That sure works, in a crude way. More generally, though, this approach has several issues:
  • In Facebook, the caption is an afterthought. You read it only if you don't know what the picture is about, or if you happen to stumble upon it
  • Facebook has no way to annotate an image. You cannot highlight portions, add notes, or expand parts for better viewing. You have to edit the image outside Facebook and upload it with annotations
  • Facebook doesn't provide a way to visualize a story as a video, with slide auto-transition
I realized that what I wanted was a video. Something like the DVD authoring software that takes an image folder and makes it into a DVD. You put it into the DVD player and you get a slide show.

Wait! I said the words! Slide show! My gallery was a dreaded Powerpoint™ presentation!!!

Now, every geek hates Powerpoint presentations. That's because we have sat through one too many of them. The one that usually ends it for us is the one where the marketing drone discovered transitions and animations, and now we have to sit through an hour of flashing text and banners that swirl through the air into place. Meanwhile, we are thinking about this bug that needs to be fixed and about the pickup basketball game we are missing.

But slide shows are perfect for the purpose I had in mind. Put a bunch of pictures together, add the text that explains them, and use the presentation software's awesome annotation powers to enhance the image. Stay away from gimmicks as much as possible and you got yourself a video.

I looked at different solutions online, and none of them satisfied me. The problem with cloud software is that every change is painful, as it needs to wait for round trip times. You post a minuscule change, it takes a couple of seconds, then you get a chance to see the results. Will this color show on the image? Is the annotation the right size?

Downloadable software works, but on Linux the quality is so-so. I tried a bunch of different gallery applications, but none of them did what I wanted. Then I caved in and used OpenOffice Impress, the group's Powerpoint replacement. Impress is amazing in functionality, by the way, and my reluctance comes from the fact it gets really slow when editing large presentations.

When I started creating my gallery, I realized there were really only three types of slides I wanted:
  • Accessory slides - text only, like the title page and the thank you page at the end
  • Vertical layouts for pictures shot in portrait mode
  • Horizontal layouts, for landscape
If I had shot videos, there would have been two pages for those, but the layout would have presumably been the same as with the pictures, only with video objects.

I created the title page, then started with a vertical image. I laid it out in the nice presentation layout: title, image on the left, text box on the right. Seemed reasonable enough. Since the next page was the same format, I just copied the one I had, replaced image and text, and got going.

Things got a little tough with landscape images, since they don't leave a lot of room for text. I ended up placing them in the top left corner, with text floating around them. That turns out to be a problem, since Impress (and I recall Powerpoint) don't float text around images like desktop publishing programs do.

That all went well, though. I had the three slide types, and whenever I added a new picture, I just selected the appropriate slide type, pasted it at the end, replaced the image and the text, and on to the next one.

Now, I told you Impress can be a hog. So after about five slides, the image selection dialog would take 20 seconds to load. Paging through it would take another 10 seconds per page. With over 100 images, that seemed completely impossible to deal with. Fortunately, if you shut down and restarted Impress, things were quicker until you added another five pages.

That was tedious. Oddly, though, paging through the slides was fast, as was adding annotations and editing text. So if I had a script or wizard that generated the slides for me, that would have been marvelous.

I went online and checked how you create wizards for Impress. After all, what I wanted was not much different from a mail merge: get a data source (here, images) and plug it into an output format (here, slides). Not an ounce of information.

Fortunately, I remembered that OpenOffice standardized on XML as persistence format. I looked at the saved file and realized it was a PKZIP archive. That was to be expected, since PKZIP is the default persistence format for Java archives (JAR files).

I unzipped the archive and quickly discerned the various components. Kudos to the OO.o developers for creating a very sensible layout. I looked at the file content.xml, which had the slides in it (as a quick grep with the text on one of the slides revealed). Unlike some XML formats that are binary CDATA stuck into an XML wrapper, this one was very much in the spirit of eXtensible Markup - you could easily see how it worked.

So I wrote a little script that takes a template file and a set of images, and creates page after page of content. Then it saves the presentation, and you get to load it and modify it. Adding annotations, removing images where you don't like them, and finally saving the whole thing again. Then you can take the presentation and show it on its own, or share it using the Impress exporters. There is one for Flash, one for PDF, and one for HTML slideshows - amazing stuff!

The Live CD Web Server Project (Ongoing Series - Part I)

Imagine burning a CD with your latest and greatest in web sites, putting it into the computer's CD drive, turning on, and magically you have your web server running? No installation, no configuration, no login - no viruses, no persistent hacking, no version conflicts?

The idea came to me when running a large computer cluster in a three-tier application. The front end web servers were always the worst problem: they handled all the load, they handled the majority of attacks, they were the entry point for vulnerabilities and denial-of-service abuses.

I had tons of problems to deal with, so I never got to realize this idea: take the software we run on the web servers, make it into a CD, tear out the hard drive from the servers, and make the whole thing run from read-only drives. Stuff it and forget it.

I recently started thinking about the project again. I wanted to take an old machine I had sitting at home and train it as a minimal web server. It had to run LAMP and Joomla, but not allow persistent updates to the database. The project I thought of sounded like a perfect match, so I started looking into the available distributions.

Turns out nobody seems to have started a project in this direction, despite repeated calls for it. There are tons of Linux distributions on Live CD, but they are all fixed. The idea is that someone puts content together and the CD is to showcase the creator's efforts.

2010-10-20

Creating an Encrypted Subversion Repository on Linux

Why?

I have my source code on a server in the cloud. That makes perfect sense - I want to have my code accessible from everywhere, even if the only person accessing the repository is my own self. Access is secured using SSH with PKI - only whoever has the private key can access the system, no passwords allowed.

While I feel pretty secure about access, it bugs me that the source code is not encrypted at rest. Whoever gains access to a copy of the repository (for instance, from a backup) has the code in cleartext. That's absolutely not good. On the other hand, setting up an encrypted repository is too much of a hassle, and I couldn't find anything online about how to do it.

One rainy day (yes, we have those in Southern California, and we look at them like people in Hawaii look at snow) I decided I had enough of it. I wasn't going to take it anymore. I had to do it.

What Not?

When setting up my encrypted repository, I wanted to avoid the most common mistake: a repository that can be accessed from the machine itself. You see, the problem with most encryption software for drives is that it stores the key with the hardware. If you do it that way, the encryption is pretty pointless.

You could set up encryption so that only people with login access to the machine (who also know the password) can decrypt the repository. This approach works well for encrypted home directories, but in my source code access there is no password.

So, whatever I did, I needed to pass the credentials (or the path to them) with the request itself. The request would provide location and password, and that would be sufficient to unlock the encrypted file.

How?

My ideal scenario was simple: a Truecrypt repository on the server with SVN (Subversion) access. I base the whole description on this combination, and the peculiarities of both come into play at several times.

I chose Truecrypt over, say, CryptFS because the repository is a single file. It is completely opaque to the intruder, and I can even set it up so that it's not clear the file mentioned is a Truecrypt repository. (For instance, I could call it "STARWARS.AVI" and make people think it's a bootleg copy of a movie.) With most crypto filesystems, encryption is per file, which means the file name and the existence of single files (and directories is visible).

I chose Subversion over, say, git because... well, because my repo is already in Subversion, and because SVN has this neat remote "protocol," which consists of creating a remote, secure connection to the server and executing the commands locally, without a special network protocol involved.

Tricks

The first part is very, very simple: after installing truecrypt and subversion (as well as ssh, which you should already have) you need to create a Truecrypt container. Choose a file container and give it a Linux (ext3) filesystem, and make it big enough to fit the largest size your repository will ever grow to.

To create the container, simply type in truecrypt -t -c on the server. That will start the interactive dialog that will create the encrypted file. Give it any name (I assume here you called it STARWARS.AVI) and location (doesn't really matter). The defaults are fine for everything, you'll provide file name, file size, and none for the file system. When it comes to the password, choose something really really good.

[Note: volume creation on the client has the advantage of being able to use the graphical interface, which helps a ton.]

Since we didn't select a filesystem, we have to create one. To do that, we need to learn a little about truecrypt internals - but we'll use it in a moment for the actual subversion trick, so it's not too bad. Here goes: truecrypt creates a series of "devices" that the system uses to talk (indirectly) to the encryption core. That's done because truecrypt lives entirely in user space, and hence encryption is not available on a kernel level.

The devices are called mappers and reside in /dev/mapper/truecrypt*. To Linux, the devices behave like regular block devices (read, like a hard drive). One you have a map done, you can do anything with it that you would normally do with a drive, including formatting.

To map, you invoke truecrypt with the container name and the no filesystem option:

truecrypt --text --password= STARWARS.AVI --filesystem=none --keyfiles= --protect-hidden=no

(Long options this time to save the pain of explaining.)

Now you should have a mapper mounted - if you type mount, you should see one line that starts with truecrypt. Remember the number after aux_mnt (typically 1 on your first try).

Now we create the filesystem:

mkfs.ext3 /dev/mapper/truecrypt1

(You may have to be root to do that - in which case add "sudo" at the beginning of the line.)

AutoFS

The "evil" trick that we are going to use next is a dynamic filesystem mounted automatically. AutoFS is a package that allows you to declare that certain directories on your system are special and access to them requires special handling. For instance, I use autoFS to connect to my SSH servers. The directory /ssh on this machine is configured to open an sshfs connection to whichever server I name. So, if I write:

ls /ssh/secure.gawd.at

I get the listing of the home directory on the server secure.gawd.at. (The server doesn't exist, but that's beyond the point.)

In this case, we will use what is called an executable map: autoFS invokes a script that you name, and will take the results as the configuration options it needs to mount the filesystem. In our case, the script will first open the truecrypt container and then move on to passing the options for the underlying filesystem to autoFS.

Once more: ls /svn/magic-name - autoFS - mapper script - truecrypt mapper - mount options - mount

I wrote the script in Tcl, which is still my favorite shell to use. It requires nothing but Tcl and Tcllib, both package available in pretty much all Linux distributions (although the Debian people, noted bigots, require you to specify a version number). You can download it here.

Copy the script into the /etc directory. If you didn't already, install autofs on your machine. Now edit the /etc/auto.master file and add a line for this new file. Let's call it auto.enc and link it to the /svn directory.

A little magic setup: you have to create the directory (sudo mkdir /svn); then you have to make the map executable (sudo chmod+x /etc/auto.enc); finally, restart autoFS so that it looks at your map.

Now we have to choose the container and map. To make my life easier, I chose to use a .d directory in /etc. If you create a directory /etc/auto.enc.d with (sudo mkdir /etc/auto.enc.d), then all the links inside it will be considered maps. The name of the link is the name of the map, and the location it points to is the file container.

If you want to use the container /enc/data/STARWARS.AVI under the symbolic name repo, then you would do this:

ln -s /enc/data/STARWARS.AVI /etc/auto.enc.d/repo

Grand Finale: Credentials

Now the big question: how does the mapper find the password? That was the big question at the beginning. The way I solved it was to add the password to the name of the directory. Crazy guy!

If you followed the instructions above, then whenever you access /svn/anything, the map is consulted. The map script looks at the data passed in and looks for an "@" sign, which is considered the separator between map and password. So, if you wanted to access the repository repo with the password "secure," you would type in

ls /svn/repo@secure

The script would mount the mapper and tell autoFS to mount the directory as an ext3 file system.

But, but, but!!! You are passing the credentials in cleartext! That's bound to be terribly bad!!!

Well, yes and no. The transmission between server and client is SSH, so nobody can see the password in the clear. On the server, the password is in the clear, but it is not logged anywhere (unless you tell SVN to log everything). On the other hand, someone that happens to be on the server when a request comes in is also able to look at the encrypted data, since it is mounted for that period of time. So if an attacker looks at the password, the attacker might as well look at the files that are protected.

Epilogue

Let's just assume you got everything working - you should now be able to create a repository:

svnadmin create svn+ssh://svn/repo@secure

Now you should notice that the file STARWARS.AVI has been modified. If you mount it using truecrypt, you will see a series of files in there - files that SVN will continue using from now on whenever you access the encrypted repository. Hooray!

Notes and Addenda

1. I set the expiration timeout for the directories low, but not incredibly low - at ten seconds. You do that by specifying the "timeout" parameter in the auto.master file. That way, I can do an svn update; svn commit cycle without requiring a second mount. You can play with the parameters yourself.

2. The encryption scheme could be improved easily by using keyfiles instead of passwords. To do so, you would place a keyfile on a remote location (a web server, maybe) and require the script to get that resource, decrypt it using the password provided, and then use that as the keyfile. The advantage is that you require three pieces of information: the truecrypt container, the encrypted keyfile, and the password to the keyfile, to do your bidding.

3. Disclaimer: this setup works for me, but that's because I munged around for dozens of hours until I figured out all the options and configuration items necessary. If it doesn't work for you, don't sue me. If it works, but it stops working after a while and your brilliant source code is lost forever, don't sue me. Proceed with caution, always make backups, and never rely on the advice of strangers. Mahalo.

2010-09-25

The YouTube Conspiracy in Abby/CClive

There is a command line utility available on all Ubuntu derivatives called cclive. If you install it (sudo apt-get install cclive), you can give it a YouTube URL and it will download the video on it. I love using it for backup purposes - I upload a video from the camera, perform all my changes on YouTube, and then cclive the outcome for posterity. Just in case YouTube "forgets" about my latest cam ride.

There is also a GUI for cclive, called Abby. Abby is more than just a frontend for cclive, though, it also helps with pages that have multiple videos on them - playlists or RSS feeds. Abby is hosted on googlecode and written in QT/C++.

I started surfing, so I decided to scour YouTube for surf instruction videos. There is a set of 12 introductory videos by two Australian pros on there, so I decided to download them to take them to the beach. My N900 gladly displays YouTube videos on its gorgeous screen. Unfortunately, though, the T-Mobile coverage is fairly bad, so a downloaded video was the only real option.

BPM Detection in Linux

Doing a lot of cardio workouts, it is really good to have music that beats to your rhythm. The pulsating sound gives you energy and pace, both excellent ways to make a good workout, great, and to make time pass faster. When I get new music on my player (a Sansa Clip+ - the almost perfect player for a Sporty Spice) life is good. An hour of running is gone before I even know it, and when I look at the calorie count, I feel like Michael Phelps freshly crowned with Olympic gold.

At first I would stumble across music that matched the pace. I do lots of different kinds of workouts, so certain songs would work with different segments. I have a running pace, a hiking pace, a mountain climbing pace, a cycling pace, a weight lifting pace, a spinning pace, etc. I would get used to certain songs in certain parts, but that would get old, fast.

Then I got used to counting beats. I would look at the big clock in the gym and count beats for 15 seconds. That would give me a general idea of what I could use a song for. My favorite spinning song, for instance, was "Hazel Eyes," so anything that had the same beat count would be a good replacement.

Then I started getting bored with this random approach and realized I had a library of hundreds of CDs ripped onto my computers. I just had to detect the beat automatically and I would be able to simply do a lookup search for a specific BPM count and get all possible results.

2010-09-24

The Rise and Fall of Internet Browsers

It amazes me how, since the very inception, Internet Browsers have been subject to periodic meteoric rise and subsequent fall. They do so a lot more than other pieces of software, like operating systems or word processors. It seems people are much more willing to throw out their browsers than virtually any other kind of software.

It all started with the venerable grandfather of them all, Mozilla Navigator. Marc Andreesen, the ur-type of the "smart kid with an idea brighter than even he thinks it is who goes on to think he's the smartest person on the planet because he's been lucky with his idea", and his team created the software and threw it out. Instant success, huge company, enormous IPO. But a piece of software that was horrible, and got more and more horrible as time wore on.

Mozilla was mired in the conflict of the dot-com days: how do you monetize a piece of software without charging the user? It would take almost ten years for Google to show us, but back in the day, it meant shareware. Mozilla was selling servers, and the browser was a loss-leader. It got all the attention that a loss-leader gets - it got more and more bloated, supporting more and more reasons for people to upgrade their servers (and not buy them from anyone else), but in the process it got slower and slower.

Finally, in one of his last acts of Imperial Fiat, Bill Gates decreed that the Internet was not a fad and that Microsoft needed to get in on the action. A few years later and a ton of lawsuits after, Mozilla was dead (or bought by AOL, which is pretty much the same thing) and Internet Explorer the only dominant figure in the landscape.

Then IE started showing problems. Not bloat and slowness, although those became more apparent. No, it was security that became the big issue. IE's security model was cooperative and not designed for the abusive exploits of Internet Mafia conglomerates. As a result, surfing certain types of "shady" sites would invariably land your machine into zombie territory, or at least get you a virus infection or two.

When the Mozilla Foundation announced it was looking at a new, brand new browser named Firebird, even the most hopeful were not easily convinced. Navigator was a monster, written by people that needed to get things done, no matter how unmanageable the result, and Firebird would have to be a rewrite from scratch to compete.

But it did. Renamed Firefox (sadly), it began a march of conquest that landed it to top spot in the browser stats. Nowadays, almost half of all Internet users choose Firefox, while IE has only a little more than a third of the market.

Firefox was helped by a series of advantages: it was much faster than IE; it was factors more secure than IE; it had an extensive extension system with loads of useful things - useful for users, which IE had traditionally ignored in favor of usefulness for companies. Only lately has Firefox started to show weakness, and from the most unlikely of sources.

I invested much time in my Firefox setup. I have the extensions I want, synchronized across my two dozen machines (don't ask) using a sync extension. I have Firefox customizations for nearly everything, and I write my own Greasemonkey scripts. Yet, I started using Google's Chrome browser (Chromium on this laptop). Why? Because Chromium uses "one process per tab".

How does it matter? Why is it so important to me that each tab have its own process? The answer is Flash. You see, Flash is a giant memory leak. Whenever I land on a page that has Flash on it, memory gets allocated (by the Flash plugin) and never released. After a few hours of heavy browsing, my browser slows down to a crawl. Another few hours, and it's completely unusable. After a day, I have to restart it, and the process of freeing up memory may take upwards of 10 minutes.

Flash on Linux, of course, is an afterthought. The way Adobe treats its Linux users, though, shows all the weaknesses of the technology in a merciless way. First, there is the closed nature of Flash: Linux users cannot suggest modifications or fix bugs, as they do with other software, because the plugin is closed.

Then, there is the "one-size-fits-all" approach of the plugin. I find Flash used for controls on web pages (especially ones that require notifications), for e-cards, especially of the inspirational or funny kind, and for online videos. Those three use cases are totally different, and using the same software for each of them is only in the interest of the maker of the software, Adobe, not in the interest of the user.

So. for now I am forced to leave Firefox for no reason of its own and adopt a different (and very capable) browser simply because I can't get Flash to work on FF.

2010-09-14

Solar-friendly Gadgets

Living in San Diego, you spend a lot of time at the beach. There, it's a tragedy to have no outlets to recharge things, while you have a lot of sun available. Ideally, you would use a solar charger to recharge all your devices while they are being used.

There are lots of chargers on the market. Solio makes very popular ones, but they are by far not the only vendor. Basically, all of them in one way or the other allow you to connect a variety of devices to a solar panel that outputs the correct power (voltage).

When buying a charger, you should look mainly for one thing: that the output is USB. Dedicated plugs are nice, but ultimately you'll end up connecting most devices via USB, so something that requires an adapter to get to USB requires you to carry something extra (Solio, for instance, mysteriously has output that looks like USB, but isn't. You need an adapter to translate to USB, which is really stupid. I assume it's done to have something else to make you lose and buy.

The devices, though, are a little more challenging, since there is more than one thing you have to look at.

2010-08-22

A Tale of Broken Packages

Now, you are probably going to think this is about mishaps with a shipping company. Boohoo! My UPS package arrived damaged... Sad Face... None of that: UPS is reliable as ever, as are the other shipping companies (FedEx, DHL, USPS, what have you). No, the packages I am talking about are Linux/Ubuntu packages.

One of the major advantages of using a distro like Ubuntu is that someone else figures out what works with what and makes packages available for you to download and install semi-automatically. It's really easy and a lot more fun than the super-crappy way you install software on Windows. Instead of downloading an installer that tells you to shut down all applications before starting and then goes through a hundred screens of questions that you really don't care about (Where do you want the software installed? Do you want the software to report usage statistics?), in Ubuntu you just say, "I want Amarok," and there it is.

Sure, the whole system could use improvements. For instance, it would be more than just nice to add user ratings to the packages, so that you can see which one of the zillion alternatives is rated best. Also, it would be nice to know the size of the download before you get started. Finally, it would be great if there was a meta-server that lists major available repositories, and you'd just check the box next to the ones you'd like.

What I am going to be complaining about here, though, is more basic. I expect the download of a piece of software to give me a package that (a) doesn't break my system, (b) doesn't cause security problems, and (c) does something useful. While (a) and (b) have not been violated yet, I just got a package that clearly violates (c) big time.

2010-07-16

Rethinking Traditions

A confession: I don't like signing emails. I find it stupid. You know the message is from me, after all your email client tells you that before you open it. What's the point of salutation and signing? What does, Sincerely, Cinserely tell you that you didn't already know?

Turns out there was a good reason for the signing. That's from the days of snail mail and before there was such a thing as a typewriter: the presence of a signature was the only certain way to know who wrote you a letter. I remember the days when you'd get one, and you'd turn it over to read who sent it. If I had known I would feel old just for admitting I had ever read a hand-written letter, I would have believed everything science fiction told me.

But now I write emails, and I got used to doing a lot of things that you couldn't really do with paper. For instance, I reply inline - breaking up long messages and replying to a question right beneath it. Or I make creative use of the Subject: header. Of BCC: myself to have a record of sending the message.

More often than not, I won't sign an email. It's not that I forget, and it's not that I am too lazy. It's that I find that a truly pointless activity. I will typically close my message with a friendly greeting to the family or coworkers, or a wish for something fun, but rarely sign. It's a tradition we keep on, just because we don't think about it.

2010-07-14

Is USB the New Outlet?

I just got a refurbished Garmin Edge 705 (review to follow) along with a bunch of craptastic free sample gadget from China. The thing they had in common? Instead of having dedicated chargers, they all came with an AC/DC converter to USB.

It used to be that you were flooded with dozens of different chargers. After a while, you'd forget which charger belonged to which gadget and you had to label them. Every time you'd move, then, you'd have this monstrous mess of chargers that you couldn't get rid of, because you had long forgotten what gadgets they belonged to.

There were craptastic adaptable chargers with dip switches for current and voltage and different tips. You constantly risked destroying your gadget by choosing the wrong voltage, so they were really just an item of last resort. It was a nightmare.

2010-07-09

YHIHF: Do Internet Shopping Companies Ship by Access?

It's been a few months now that I noticed something odd going on. Whenever I buy something on certain online shopping sites, nothing happens for a while. Then, when I log on to check what's happening with my order, mysteriously it ships on the same day.

It all started with this deal site. I ordered a refurbished computer, and while the site stated they were shipping within two days, after four I had no email confirmation, no tracking number, nothing. When I went to the site, it said it was undergoing construction, and that sent me into Scam Prevention Mode. I sent them an email demanding an update and alerted my credit card company.

Next morning, UPS faithfully delivered my computer. Overnight shipping. At that point, I thought they had just somehow messed up and wanted to make up for it.

Then I started noticing it with other sites. At first, it was an argument with a big online vendor: I checked their Super-Saver Shipping box for my new Acer laptop, and they sat on the order for a week. When I told them their policy was that free shipping allows them to perform a slow shipping, not a slow fulfillment process, they gave me drone talk for a while, but then made it happen. (Coincidentally, the laptop ended up arriving the day before I unexpectedly had to fly to Germany for a funeral.)

2010-07-03

Comparing eBook Readers

The local Best Buy has a display with different eBook readers, so I got a chance to hold them all in hand and compare them. Nice way to entice customers, by the way!

Price wars are all the rage right now. The new Nook reader came out, and the price dropped to $149 (no 3G). Amazon followed suit and dropped the price of the Kindle to $189 (with 3G, compared with $199 for the nook 3G). Sony interestingly still sells ebook readers, and those were on display, too.

Admittedly, considering that the device is not the major buying factor for either Barnes & Noble or Amazon, the price of the device is still way too high. At the very least, the companies should offer discounts for buyers of the respective devices to cover their cost, since you are buying something that ties you to a particular vendor (still).

Of the devices on display, the Nook clearly had the upper hand. The Sony readers were quite nice, but the decision to put the touchscreen on top of the e-ink dims the latter considerably, giving the whole reading area a washed out, grey-ish look. The price is right, though, and Sony e-readers are not affected by the usual Sony price inflation.

2010-06-25

MeeGo to Become Default OS for Nokia Smartphones?

To my complete surprise, I found an article on Slashdot this morning, in which Reuters was quoted as saying that Nokia is going to ditch Symbian on the N series of phones. Instead of the trusted in-house OS, Nokia is moving their flagship product to MeeGo.

For those of you who don't know, MeeGo is the merger or Nokia's very on Maemo project and Intel's Moblin. All three projects have the same aim: to provide a full Linux distribution for mobile devices. Nokia's main aim is the smartphone market, while Intel started out thinking about MIDs and netbooks.

The move on Nokia's part is quite unexpected, since they just recently reiterated that Symbian would always be at the core of their smartphone offering. Symbian is great, don't get me wrong, but I wouldn't want to develop for it. It's getting old in the tooth and requires a lot of work to get used to.

Now, what does that mean in the mobile landscape? Why would Nokia move in this direction? What does that all mean in context?

2010-06-24

Kindle and Calibre

I've been using Calibre on and off to get content to my Kindle, and I have to admit the software is gaining a lot in functionality as it matures. The version label (currently 0.6.42) doesn't do functionality, stability, and ease of use justice at all, and I highly recommend it to anyone with a Kindle, regardless of use.

What do I do with it? I mainly add all those files I couldn't otherwise read on Kindle. Calibre allows me to easily do the following:
  • Display web pages
  • Get RSS feeds
  • Convert text-based PDF files
  • Show ePub files
  • Access Project Gutenberg ebooks
The flow I have to follow for each task is slightly different, but all in all they are fairly easy to get used to and in some cases downright simple.

To get a web page onto your Kindle, for instance, you just save the page as HTML and convert it by simply adding it as a new ebook to Calibre. You automatically get the best feature of Calibre: once you tell it what the target device is (Kindle, in this case), it will automatically convert to a format (.mobi) that works on that device, and it will format the ebook for he device properties.

RSS feeds are solved differently (and justly so) in that they are scheduled in a separate module. You can add your own RSS feeds, and there are some pre-defined ones. The adding process is not as straightforward as it could be, mostly because RSS feeds are so different - some come with full articles, others with a brief preview, others still with just a link. Once you choose the feeds your are interested in, you decide how often you want them updated, and Calibre will download, convert, and push as often as you'd like.

For PDF and ePub files, the process is the same as for web pages. The main difference here is that some PDF and ePub files are protected. Calibre doesn't know how to deal with that (which is quite to be expected). Otherwise, it does a pretty good job, handling only headers and footers poorly.

Gutenberg is finally smarting up to Kindle and is starting to publish some of its ebooks in .mobi format. That means you can download them straight to your computer and either add them using Calibre of simply adding them to your Kindle documents folder. Really dead simple.

I would be perfectly happy with Calibre if it added just two features:
  1. Sharing of "recipes." Things like RSS feeds and header/footer detection need advanced settings that are recipes of some form (XPath for header/footer, for instance). It makes very little sense to write a recipe if you are the only one that uses it, and there is no easy way to share them. I know it's a pain to set up a repository for automatic sharing, but it would make like so much easier. The current recipe for PDF header/footer, for instance, detects the headers and footers that web browsers put on printed pages. Admittedly a good default - but what am I going to do with the PDF of a book, with the standard chapter heading and page number as h/f?
  2. Direct download of URLs. It annoys me that I have to download a file from the web - be it HTML or .mobi - to add it to my list of books. I guess direct integration with ebook providers (for free or for pay) would be really welcome, as would an option to add a book from URL.
I'll keep you posted. You should certainly try out the program, though, if you like your Kindle for more than reading Amazon offerings.

2010-06-18

Quick Greasemonkey Script for Kelley Blue Book

One of the most frustrating user interfaces on the planet is that of Kelley Blue Book. It just seems to be designed around the idea of making you click as many times as possible to get to the information you need, instead of around the notion of quick access. Is that because KBB wants to maximize ad impressions?

Well, it really doesn't matter. There is only a certain amount of clicks I will endure until I start typing URLs manually into a browser, and KBB got me there. In frustration.

How does the navigation work? Well, it's essentially tree navigation. You choose first whether you want trade-in or retail values. Then you select the model year, then the manufacturer, and finally the model (and later on, options). That's great if you want to look up the values for a particular car, as for instance if you intend to sell yours.

Now, imagine you are looking to buy a particular type of car - say an AWD sedan. You settled on either an Audi A4 or A6, or a Subaru (any of many models). Your budget is constrained (yeah, well) but you are less interested in the car's age. I would think that's the more "normal" case.

So, now you are armed with a list of cars (from Craigslist, cars.com, etc.) and you need to look up their value. Say you found two Forresters, one from 2004, one from 2005. You found an A4 from 2008 and an A6 from 2003. You got an Outback from 2001. They are all nominally in your price range.

So, off you go to KBB. Logically, you'd want to focus on the two manufacturers or six models you are considering, but in KBB, you have to first hand in the year. After you chose the year, you can drill down to the car you are considering. When you are looking up the next Forrester, no help: you have to go all the way to the top (the year) and drill down.

Of course, if you look at the URL, you notice that it specifies year, then manufacturer, then model. If you just change the year in the URL, then you find what you want. Huh? You don't have to go all the way to the top?

Now, why are they navigating this way? It makes no sense from a user's perspective: when I say I want to look up the value of a 2006 Subaru Outback, the next logical thing to look up is a 2005 Subaru Outback, not a 2006 Lamborghini Countach. But the deal is that the navigation is organized around availability: the year constrains the possible manufacturers (not much), and then the models available.

That means that the programmer found out that each model is available only in certain years, and hence built the navigation around that fact.

The rest of the world thinks that's stupid.

Hence, the need for a very simple Greasemonkey script that adds the missing navigation. You get to the page you requested (e.g. for the 2006 Subaru Outback) , and links to the year, manufacturer, and model (and trim, where available) are augmented by drop down boxes that allow you to choose alternatives. You can click on the year drop down and select a different year for the model listed. Or you could click on the model and see an alternative - all other things equal.

Let me know if you are interested in the script. It's not packaged for public consumption, yet, but if you want it, you can gave it!

2010-06-11

Compact Flash - Long Obsolete?

A few years back, I thought I'd revive my days of taking pictures and bought myself a digital SLR. Back then, they were not all the rage, mostly because they were so incredibly expensive and the pictures they shot were not much better than the point-and-shooters'. Seriously, if it hadn't been that I was already used to SLRs and that I knew how powerful the lenses are, I would have done without.

I bought a Canon EOS Digital Rebel XT. I am not going to bore you with the specs, since every camera you get for free with a two-pack of ink cartridges is better these days, but it shot passable pictures (not particularly good ones, though) and I thought getting the tele lens out for the AIDS ride might be a good idea. You know, shoot the incoming finishers when they are not two inches away, that kind of thing.

Well, turns out the camera had a stinky 2G card. Back in the day, I am sure, it cost a fortune. I may have chosen it because it was the best bargain, but I could have probably bought two ink cartridges for the price of that one... (Sorry if you didn't follow the sarcasm.) I thought, well, you can get 8G cards for $20, I'll just head out to my fave store, The Shack (or whatever they call themselves today), and get myself a Terabyte of them.

I got there and looked at "options." There was one card available, a 4G card for $30. It seemed like a seriously bad deal. I actually half-way thought CF cards had gone out of style and that a SD to CF adapter might be the way to go. They didn't have any of that.

Instead, I decided to go to my least fave store, Best Buy. They opened a new store just across the street, and between the Shack a few blocks East and this new Best Buy, I am not sure how long that little store will survive. In any case, I get into the BB and manage to dodge the first wave of drones that come to "help" me (i.e. upsell me to whatever they need to throw out today).

When I stupidly think that the memory cards are going to be with the portable hard drives, a drone attacks. He's actually kinda nice and not as salesly as I am used to from the store on Harrison in San Francisco. He doesn't know of CF cards, though, hasn't seen them. He is certain, though, they don't carry an adapter. He runs back to the computer and just in time for me to ponder whether I should leave, he comes back with news: they are in store. The cards, not the adapter.

We walk to the other wall of the digital camera section and see the CF cards. There are four types: outrageously expensive 4GB, outrageously expensive 8GB, and outrageously expensive 16GB. I mean, the prices were laughable - the 16GB ran over $250! For that price, I can easily buy a 2TB portable drive!

Of course, they were supposed to be ultra-fast. But my camera is ultra-slow, so it doesn't really matter. I ended up picking the 4GB model, praying that everything will work out fine. Then I walked to the digital SLR section and looked. All of them switched to SD now.

How quickly whole standards obsolete!

2010-06-08

My Ideal Phone

I am OK with my N900, but not really happy. The software is still buggy, the thing is too heavy, and the slider keyboard is useless. I do like certain things about it, tough, and that got me thinking: what would a perfect phone look like?

Form Factor

I find that the bigger the screen, the more I like a phone. Actually, it's mostly the resolution that I like - I couldn't live with the crappy resolution of the 3G iPhone, and the resolution of current Android devices (and of the N900) is OK. Even better, though, would be a phone with a screen that folds in the middle. A little like the current crop of eReaders, only that those tend to have two different screens (one eInk, the other LCD-type). You either flip the phone open (screens protected inside) or the screens are on the outside (one turned off until you flip the phone flat). That way you get twice the screen real estate at half the carrying size. Gotta love that!

Battery Life

Clearly the worst gripe about smart phones is their outlandishly crappy battery life. The N900 fits with most and doesn't quite manage a full work day without recharge, but that's absolutely unacceptable on a device you use for mobile communication. Clearly, we need phones that can last a full 24 hours at average use, which includes constant texting and at least two hours talk time.

Or....

At the very least we need an easier way to charge our phones. I am not talking wireless charging, necessarily, but at the very very least an end to the endless number of plugs and cables. Stop the madness, standardize on one single power input, and make it possible for us to have power outlets into which you can directly plug a phone.

Software

The current crop of phone operating systems isn't quite there, yet. The problems vary, but it's mostly a combination of three factors:
  1. the OS vendors tries a lock-in strategy
  2. the relationship between phone and desktop OS is not clearly outlined
  3. the limitations of the tool chains make it hard to develop
iPhone suffers from all three. Windows Mobile is too much desktop, not enough phone. Android chose to go the Java route, which is good for portability but bad for developers, who have to buy into the paradigm.

The N900, on the other hand, would have the winning combination. You can simply take software written for the desktop and recompile it for the phone - make your changes to the user interface, and you are done. That gives you enormous leverage: you can write the backend code once and you know it will work (as is the case with the standard DB format on it, SQLite), you can reuse text mode utilities if you just recompile them, you can stick with whatever expertise you have already.

The problem with the N900 is one of implementation. It's the winning idea, but it isn't well done. For instance, it's a serious bitch to get the development environment going - you have to wade through a ton of web pages that are partially outdated, and even the virtual image offered is not kept current. Things that should be easy (e.g., getting a current re-build of a text mode app for Maemo) are hard. Why not have a current list of Linux source packages in Debian and build them on Maemo by default?

I think Maemo has the same problem that KDE ran into as of lately: great idea, but not enough people working on it, and those that are are too ambitious about their own agenda.

Connectivity

People of the world, unite! Demand that your smart phone be what you expect it to be: your computer when you don't want to carry a computer. How come so few smart phones have USB hosts? I want to be able to plug a printer, a scanner, a card reader into my phone. I want to be able to attach my phone to a TV via HDMI. I want my phone to have a standard interface for extensions, so that I can easily plug in a GPS module, or a better camera, or a credit card scanner, or a heart rate monitor.

Manufacturers are making a huge mistake by ignoring connectivity options. Of course, I understand where that comes from: any new connector means thousands of support calls, every open connectivity channel means compatibility issues left and right. Whoever starts the movement is going to have to deal with a host of issues.

But you know what: it's absolutely worth it. Remember when USB came out? It just didn't work. You needed drivers for everything, half the USB devices had drivers so poorly written, they'd crash your computer, and their were mutually incompatible half the time. It was a nightmare But now, is there anything easier than USB plug & play?

That's probably the reason the first connectivity option I mentioned is USB. Just add USB host, and we'll figure out a way to get modules for our phone that can connect, and software that will work with it.

End App-centricity

One of my worst gripes about the N900 is that the software isn't standardized. There are some apps that use Berkeley DB, most others use SQLite, and a third set uses incompatible formats. Some things are done well - for instance, the Conversations widget handles both SMS and IM, and the Phone widget does both Skype and GSM well. But there is no overriding architecture for that.

The idea should be that all data are stored in a central repository, and the apps should have access to it. Apps shouldn't even be allowed to store anything in a format that is not the central repository's, especially if it is user-dependent and fast-changing (like messages of any kind).

Examples? The email app stinks big time. That's mostly because it has no unified inbox, so that every GMail account I have requires a bunch of clicks to get to. It also does late binding, which means it will tell you there is a new message, but when you want to see it, you have to first load the current server view. Most importantly, though, you cannot combine things that have the same frequency as email, like RSS feeds, into your email view.

The idea is the life stream - a single point of entry that combines all the data you want into a single view. There you can filter the types as you wish (if you wish). Things are arranged chronologically and updated automatically. They scroll on their own. There are sources of data. There is a view. You can interact with the data the way you see fit.

But don't force me to switch apps just because I want to see more data. Even in a phone that does multitasking well, it's a pain.

2010-06-07

MMS on Nokia N900/T-Mobile

OK, this is the latest on N900 and T-Mobile MMS. It works, but you have to figure out a few things. To save you the time and aggravation, here is my recipe:
  1. Download and install (via Application Manager) fMMS.
  2. In fMMS, go to Settings -> Internet Connection Settings
  3. Get the current settings from this page (they worked for me)
  4. You are ready to go
The settings (in the format used by fMMS), in case you can't reach the page or whatever, are summarized below:
  • Access point name: wap.voicestream.com
  • MMSC: http://mms.msg.eng.t-mobile.com/mms/wapenc
  • User name: 
  • Password:
  • HTTP proxy: 216.155.165.50
User name and password are blank. Let me know if it doesn't work for you!

[Oh, and by the way - the settings will work only if you are on the T-Mobile Internet connection. WiFi won't work.]

2010-06-03

Mashups, Lady GaGa, and the Rebirth of Pop

A slightly unusual post today. I'll talk for a change about music, even if with a firm rooting in technology.

As someone who lived through the 80s, I can say that whatever you may think of politics, economics, fashion, or architecture, you'll have to admit that music in that decade was exciting. Sure, the 60s had the Beatles, the Rolling Stones, etc. - but the 80s had by far the best pop music. In addition, they started an explosion of musical movements and genres (rap, punk, hip hop, etc.) that came to fruition (and popularity) a lot later.

There were, as of my reckoning, two main reasons for this explosion. For one, the CD came on the market and with it a completely new ball game for music distribution. CDs were incredibly cheap to mass-produce, incredibly accurate in their rendition, and the players were obviously equivalent. Everybody could listen to high quality music from a cheap player, and CDs could be sold at extremely low cost.

The other reason is the advent of PC technology. Married with the MIDI interface for musical instruments, it put music in everyone's reach. A two man band could perform the same music that until then required a whole band, and professional recording was increasingly affordable. The democratization in music had begun, and the fruits were clearly visible.

The 90s brought a double shock. For one, there was enormous consolidation in the music industry, with smaller labels being gobbled up by larger ones, and these in turn by even larger ones. The end result was a choking off of the creativity and inventiveness of small labels in favor of big names. Even those big names, though, were choked off, as the story of Prince shows quite clearly.

The second component, in a wonderful symmetry to the perfect duo of the 80s, was technological. In the 90s, technology to copy CDs became more and more widely available, and the long decline in sales of music began.

The new Millennium brought an intensification of the trend. For one, there was the Internet: the perfect medium for the transmission of digital files. Napster started something that became clearly unstoppable, while the music labels continued their consolidation and rejection of a search for quality over the predictable.

You see, music has had a trend to simplification. Pop music in particular had started a long progression towards less and less content in music. You had an idea - a new melody, beat, or harmony - and you'd extend it for four minutes. That would be fine and in the trend of he time - the mixing shops would take your song and extend it from four to eight or even twelve minutes.

Going dancing soon became an exercise in boredom, at least as far as the music was concerned. You'd listen to something that would go on forever, pulsating its way into your brain until you zoned out. Music became the background, not the reason for dancing any more.

In doing so, music bucked a trend towards increasing complexity and information density that the Internet has brought on. Consider the new trend in editing: take a scene with low information content (such as a person moving on a straight trajectory) and increase the speed in editing, acting as if the viewer had used the fast forward button. That's the trend: make information more compact, give me a constant stream of information, don't bore me. We have become very efficient information processors, and the Internet has become the main source for our constant desire for information - and fuels increased ability to process information.

Music couldn't skip the trend forever. The information density in music had to increase again, making music richer than it was any time in the past. We wouldn't accept a musical idea spread over four minutes for long, things had to change.

The first ones to do something about it were DJs. They took matters in their own hand and decided to do something innovative: combine different songs into one. For it to work, the songs had to have similar beats and compatible chord progressions - and lo and behold, the lack of imagination in music made that all possible!

It so came to pass that mashups became all the rage. You can hear all sorts of mashups, for instance by typing "mashup" in the YouTube search bar. Some are combinations of current pop chart songs, some combine those with rock and roll classics. An astonishing amount of them mixes Eurhythmics' Sweet Dreams (are Made of This) with whatever flavor of the day is available.

A second degree of mashup is the multi-mash. DJ Earworm is an outstanding example of this kind of work - since 2007 he has produced a mashup of the top 25 most popular songs of the year (amongst other work). These mashups are staggering in quality and complexity and succeed in creating a new genre in music, one where other people's songs are the instruments used to create a new song. (Oddly, that's basically the idea that Edgar Varese had 50 years ago. His music, though, sounds really alien and frightening.)

Enters Lady GaGa. Those who know here point to her whole persona as the reason for her success: the outfits, the political opinions, the collaboration with other artists. That's all very true, but without innovative music, Lady GaGa would not succeed.

Listening to her most popular songs, one notices that they are more complex than typical pop songs. Instead of the simple aba or ababa structure, in which chorus and narrative alternate, her songs have three, four, five key musical concepts that are followed around and alternated. Bad Romance, the crazed sinfonietta whose video became the most watched in YouTube history, is particularly rich with unrelated themes. Lady GaGa is also perfectly able to have those themes play with each other, adding a mashup element to the dramatic complexity of her music.

You may like the Lady or not, but you'll find out that soon everybody is going to write songs like hers - or even more complex. And we can get back to the musical explosion of the 80s.