Shallow Thoughts : : Jun

Akkana's Musings on Open Source Computing and Technology, Science, and Nature.

Sun, 22 Jun 2008

Custom ringtones on a Motorola phone, from Linux

I decided to stick a tentative toe into the current millennium and get myself a cellphone.

I sense your shock and amazement -- from people who know me, that I would do such a thing, and from everybody else at the concept that there's anybody in 2008 who didn't already have one.

I really don't think cellphones are evil, honest! (Except in the hands of someone driving a car -- wouldja please just put the phone down and pay attention to the friggin' road?) The truth is that I just don't much like talking on the phone, and generally manage fine with email. The land-line phone works fine for the scant time I spend on the phone, and I have to have the land line anyway (as part of the DSL package) so why pay another monthly bill for a second phone?

Prepaid plans looked like just the ticket, and that's what I got. With a cute little Motorola V195s. New toy! Rock! It can take custom MP3 ringtones and Java games ... but of course I don't want theirs, I want to make my own. So I wanted to talk to the phone from Linux.

The charger plug was a familiar shape -- looked a lot like a standard mini USB connector. Could the hardware be that easy? Sure enough, it's a standard mini USB. Kudos to Motorola for making that so easy! Now what about software?

My initial web searches led me down a false trail paved with programs like wammu and gnokii. I learned that I needed to enable ACM in my kernel (that's the modem protocol most cellphones use over USB), so as long as I was building a new kernel anyway, I grabbed the latest tarball from kernel.org (2.6.25.7). With that done, I was able to talk to the phone with gnokii, but the heavily Nokia-oriented program didn't show me much that looked useful.

Moto4lin is the answer

I set the project aside for a while. But half a week later while looking for something else, I stumbled across moto4lin, which turned out to be exactly what I needed. I had to run as root, or else when I try to connect, it prints on stderr:

sendControl Error:[error sending control message: Operation not permitted]
) but I'm sure that can be solved somehow.

So run as root, click Connect, click File Manager if you're not already in that mode, then click Update List and it reads the files. Once they're there, you can click around in the folder list on the left looking for the audio files (on my phone, they're in a directory called audio somewhere under C, not A). Excellent!

Creating a ringtone leads to a kernel debugging digression

Okay, now I needed a ringtone. I wanted to use a bit of birdsong, so I loaded one of the tracks I use for tweet into Audacity and fiddled semi-randomly until I figured out how to cut and save a short clip. It would only save as WAV, but lame clip.wav clip.mp3 solved that just fine.

(Update: the easiest way is to select the clip you want, then do File->Export Selection...)

Except ... somewhere along the way, the clips stopped playing. I couldn't even play the original ogg track from tweet. It *looked* like it was playing ... it found the track, printed information about it, showed a running time-counter for the appropriate amount of time ... but made no sound.

It eventually turned out that the problem was that shiny new 2.6.25.7 kernel I'd downloaded. A bug introduced in 2.6.24 to the ymfpci sound card driver makes Yamaha sound cards unable to play anything with a bitrate of 44100 (which happens to be the typical CD bitrate). After a lot of debugging I eventually filed bug 10963 with a patch that reverts the old, working code from 2.6.23.17.

Ringtone success

Okay, a typical open source digression. But while I was still trying to track down the kernel bug, I meanwhile found this Razr page that tipped me off that I might need a different bitrate for ringtones anyway. So I converted it with:

lame -b 40 mock.wav mock.mp3
(which also made it playable on the new kernel.) I also found some useful information in the lengthy Ubuntu forums discussion of moto4lin.

In the end, I was able to transfer the file easily to the motorola phone, and to use it as my nifty new ringtone. Success! Too bad nobody ever calls me and this phone is mostly for outgoing calls ...

Now to look for some fun Java apps.

Tags: , ,
[ 20:27 Jun 22, 2008    More linux | permalink to this entry | ]

Thu, 12 Jun 2008

Making Firefox default to Portrait printing

I discovered a handy tip for Linux Firefox' printing Page Setup today.

Normal web page printing uses "Portrait" mode: you read the page with the paper oriented so that it's taller than it is wide.

Once a week, I need to print a form from a club web site to bring to the meetings. It's a table that's much wider than it is tall, so I want to print it that way: in "Landscape" mode.

In Firefox 2 (at least on Linux), you can't do that from the Print dialog -- there's no Portrait/Landscape option. So you have to use a separate dialog, Page Setup, following these steps:

  1. Run Page Setup
  2. Change Portrait to Landscape
  3. Click OK
  4. Print (bring up the Print dialog and click OK)
  5. Run Page Setup
  6. Change Landscape to Portrait
  7. Click OK
Kind of a lot of steps just to print one landscape page! But if you forget, the next page you print from Firefox will be printed in Landscape mode and will take twice as many pages as it should (if you don't notice what's happening and dive for the printer's OFF switch in time, that being the only way to cancel a printing job once it hits the printer).

This morning, it finally occurred to me that Firefox was storing this setting somehow, most likely in prefs.js. If I could find the setting and force it in user.js (which takes precedence over prefs.js and is not updated by Firefox), I could make Firefox set itself back to Portrait every time it starts up. (prefs.js and user.js are both generally found in $HOME/.mozilla/firefox/).

Some greppery-pokery revealed the solution. I needed only to add a line in user.js that looks like this:

user_pref("print.printer_CUPS/Epson.print_orientation", 0);
and presto! my problem was solved.

Oddly, it's set separately for every printer you have defined, even though there's no way to set one printer to Landscape while another one is still on Portrait (the Page Setup dialog is global, and applies to every printer Firefox knows about). "Epson" is the CUPS name of my primary printer; replace that with your printer's name (as set in CUPS), and add a similar line for each printer you have. For the printers I've used, 0 is Portrait and 1 is Landscape, but you can verify that by typing:

grep orientation prefs.js | grep name

That command will also help you if you're not sure what printers you have defined, or you don't use CUPS but want to try this under a different print spooler. (Don't be misled by all the orientation prefs with "tmp" in the name.)

As a minor digression, there's actually a secret pref that's supposed to give another way around the problem:

user_pref("print.whileInPrintPreview", true);
This lets you do all your printing from the Print Preview window, which offers its own Portrait and Landscape buttons. That would be a nice solution. Alas, the Portrait and Landscape buttons in that dialog currently don't work, and since this preference is undocumented and unmaintained, filing more bugs isn't likely to help.

(I should mention that this all pertains to Firefox 2. I haven't switched to Firefox 3 yet, so I don't know the state of its printing UI, or whether this preference is either helpful or effective there.)

Tags: , , ,
[ 21:07 Jun 12, 2008    More tech/web | permalink to this entry | ]

Tue, 10 Jun 2008

Is ODF a standard, or not?

I'm confused about ODF. Remember a few years back when we kept reading about how governments and schools and everybody else should switch away from proprietary formats, and therefore they should use software that supported the open international standard of ODF (Open Document Format)? Never mind that at the time, there was only one program in existence that could read ODF (the then brand new Open Office 2, usually present only on new installs of cutting-edge Linux distros). Honest, we were told, lots of other open source word processors (meaning basically Abiword and Kword -- are there others?) would soon add ODF support in their upcoming releases -- so everybody should stop using .doc now and switch to Open Office 2.0.

Fast forward a few years. Now all the open source word processors support ODF, no problem, and there's even a plug-in available for MS Word even though MS is fighting with their usual underhanded tactics to get their latest Word format (OOXML) blessed as a standard too.

Meanwhile, Open Office 3.0 is in beta ... and since it actually has comment support that's usable (you can write new comments and read existing ones, and even see where they were in the document), I downloaded a copy and have been using it.

OOo 3.0 beta has a lot of problems reading and writing to .doc format, as it turns out. If I save something in any of the (three?) available .doc formats, then read it back in, lots of the formatting will have disappeared or changed. And about half the time, .doc files that I write will crash Dave's copy of Word 2003 if he tries to read them (yes, crashing says more about the quality of Word 2003 than about the quality of OOo 3 ... until you try to explain to your editor why your documents cause Word to crash.)

Anyway, I decided that the way to go was to save my intermediates as ODF until they're ready to submit, at which point I'll export a copy to Word 2000 format. Sounds straightforward, right?

So today, I was on the laptop (which doesn't have OOo 3 beta) and I used Ubuntu's existing OOo 2.4.0 to read in one of those .odt files I'd been saving.

And I got this warning:

[ screenshot of OOo3 format warning ]

This document was created by a newer version of OpenOffice.org. It may contain features not supported by your current version.

Click 'Update Now...' to run online update and get the latest version of OpenOffice.org.

I'm a little confused now. Wasn't ODF (.odt) was the format we were all supposed to use because it was an international standard, and therefore documents written by any program could be read by any other ODF-supporting program? And no one would be tied to any particular program or version?

I double-checked OOo 3's "Save as" file type menu, and the format I was using was:

ODF Text Document (.odt)
I don't see anything there about "OpenOffice 3.0 format (may not be readable by earlier versions or by other programs)." I just see the exact same string OOo 2.4.0 gives me for ODT -- for a format that apparently is not the same. Even Microsoft at least gives the option in Word of saving in formats that older Word versions used. It looks to me like ODF in OOo3 is a step backward, not a step forward. (In fact, it looks like OOo2 is reading the document just fine ... but I can't be sure after seeing that warning, and will have to check it very carefully before I send it anywhere.)

Can one of you ODF-enthusiasts please explain where I'm going wrong here, and why it makes sense to define an international standard format that's nevertheless different depending on what software wrote it? (I know this blog doesn't have comments, but I promise to publish here any comments I get if you say you want them published (and only then ... private comments are okay too). Here's my contact page.

Update, Jun 11 2008: Two helpful replies this morning.

Markku Korkeala tells me that the ODF standard has more than one version. OpenOffice 2.x writes ODF 1.1, while OO 3 writes 1.2. He also points me to Rob Weir's ODF Validation for Dummies, which includes a long discussion on XML validation methods (specifically, validation of ODF vs. Microsoft's OOXML).

Harm Hilvers writes a longer reply with some more useful information, which I'll include here:

ODF is a standard, but it's a constantly developing one. This should not be a problem, since as we all know the first ISO ODF was already quite comprehensive and complete. Newer versions are making ODF even more complete. This should not mean that ODF should be versioned in the Save As dialogue (although there might be differences in the ODF version's features) if OOo gives a list of the things that don't work in the older OOo if a newer ODF document is opened.

Personally I don't use Linux, but Mac OS X, and I use both OOo 3 and Pages (from the iWork office suite). Every time I open a Word document in Pages, it gives me a list of things that weren't imported properly because certain features are missing. OOo should do the same I guess: if a newer ODF document is opened in OOo 2 and one of the newer features is used, it should tell the user exactly that. That's a lot better than just telling the user that something might be wrong (or not).

(Akkana here:) What an excellent solution! I agree with Harm: if OOo had either mentioned ODF version numbers, or said something like "This document may use the 'foo' feature, which is not implemented in this version of Open Office", it would have gone a long way toward making me feel better about using ODF.

I still consider it a problem, though, that OpenOffice doesn't give you any option to save in a more backwards compatible format, nor does either version of OOo give you any hints about what might be incompatible. If you're using OOo 3 and you have to send a document to someone using software that can only read ODF 1.1 or 1.0, there's no way of knowing how much of your document they'll be able to read.

Thanks, both Markku and Harm, for the information.

Update, November 2008: Tom Wright wrote to let me know that the OpenOffice 3.0 final release does allow choosing between ODF 1.1 or 1.2. Excellent news! That'll make it a lot easier to work with older versions. Thanks to Tom for letting me know.

Tags: , , ,
[ 22:49 Jun 10, 2008    More tech | permalink to this entry | ]

Sat, 07 Jun 2008

Ladybugs and Bees

At Wunderlich today, while hiking up the Alambique trail a bit above the function with Meadow, we heard the bzzzzzzz of a swarm up ahead.

A beehive? No ... ladybugs! Hundreds of 'em, flying at trail level and just above it. When we stopped to watch, we had ladybugs landing on our legs and arms and shirts. We passed through the swarm, then just a few hundred feet up the trail there was another one just as big.

And then another few hundred feet and yet another buzzing ... this one seeming to go much higher than the other two, way up in the treetops. Sure enough, this time it was bees, from a hive in a tree just to the right of the trail. We hurried on by.

But I must have acquired some sort of karmic load there, because as we returned on the Meadow trail, a bee took exception to the top of my head, buzzing me persistently and eventually diving into my hair and stinging me before I could dislodge it. I have no idea why it was so upset -- this was one of the few places during today's hike when there wasn't any visible or audible insect swarm nearby. Must've used the wrong shampoo this morning.

In these days of Colony Collapse Disorder and since I don't own a decent insect field guide, in the interest of science I'll report that the bee was a bit smaller than a typical honeybee (maybe 3/4 the size) and quite a bit thinner, but with similar color and stripes (perhaps a tad less contrasty).

Tags: , ,
[ 22:43 Jun 07, 2008    More nature | permalink to this entry | ]

Thu, 05 Jun 2008

Quote of the Week

From a BBC story on the wife of France's president:
She said her husband was so bright he appeared to have "five or even six brains".

Raises all kinds of intriguing followup questions, doesn't it?

Tags: , ,
[ 21:46 Jun 05, 2008    More headlines | permalink to this entry | ]