Shallow Thoughts
Akkana's Musings on Open Source, Science, and Nature.
Tue, 09 Mar 2010
A friend was trying to get some of her laptop's function keys working
under Ubuntu, and that reminded me that I'd been meaning to do the
same on my Vaio TX 650P.
My brightness keys worked automagically -- I suspected via the scripts
in /etc/acpi -- and that was helpful in tracking down the rest of the
information I needed. But it still took a bit of fiddling since
(surprise!) how this stuff works isn't documented.
Here's the procedure I found.
First, use acpi_listen to find out what events are generated
by the key you care about. Not all keys generate ACPI events.
I haven't get figured out what controls this -- possibly the kernel.
When you type the key, you're looking for something like this:
sony/hotkey SPIC 00000001 00000012
You may get separate events for key down and key up. It's your choice
as to which one matters.
Once you know the code for your key, it's time to make it do something.
Create a new file in /etc/acpi/events -- I called mine sony-lcd-btn.
It doesn't matter what you call it -- acpid will read all of them.
(Yes, that means every time you start up it's reading all those
toshiba and asus files even if you have a Lenovo or Sony.
Looks like a nice place to shave off a little boot time.)
The file is very simple and should look something like this:
# /etc/acpi/events/sony-lcd-btn
event=sony/hotkey SPIC 00000001 00000012
action=/etc/acpi/sonylcd.sh
Now create a script for the action you specified in the event file.
I created a script /etc/acpi/sonylcd.sh that looks like this:
#! /bin/bash
# temporary, for testing:
echo "LCD button!" >/dev/console
Now restart acpid: service acpid restart if you're
on karmic, or /etc/init.d/acpid restart on earlier releases.
Press the button. If you're running from the console (or using a
tool like xconsole), and you got all
the codes right, you should be able to see the echo from your script.
Now you can do anything you want. For instance, when I press the LCD
button I generally want to run this:
xrandr --output VGA --mode 1024x768
Or to make it toggle, I could write a slightly smarter script using
xrandr --query to find out the current mode and behave accordingly.
I'll probably do that at some point when I have a projector handy.
Tags: linux, acpi,
[
16:15 Mar 09, 2010
More linux/kernel |
permalink to this entry
]
Sun, 07 Mar 2010
I never blog recipes. But while I was making rouladen today, I
remembered when I first tried to make it, and discovered that the
recipes on the web were all for something entirely different than
the delicious rouladen my mom used to make. Mom got the recipe from a
German babysitter named Betty who used to take care of me when I was little.
It was fantastic and I haven't had anything else like it anywhere,
so I asked Mom for the recipe, adapted it a little for my crockpot,
and have been enjoying it ever since.
Apologies for the lack of precise quantities. This is how we do recipes
in my family, and I'm not great at following precise instructions
anyway, and in any case, the recipe originally came from Mom watching
Betty make it once.
Crockpot Rouladen
Flank steak - lay it out flat.
Mustard - whatever kind you have lying around.
Paint a thin layer onto steak. I personally hate mustard, but
it doesn't taste like mustard in the final dish so it's okay.
Bacon - maybe 5 pieces. Cook to not-quite-crisp, to get rid of some
of the fat. I cut off some of the fat too, but I'm weird that way.
Lay strips on top of mustard.
Bread crumbs - Sprinkle on top of bacon. A little or a lot, as you wish.
Enough to leak out when it's rolled, as it thickens the sauce nicely.
Roll steak up and secure with skewers or string. Watch the grain and
roll it so that when you slice it, you'll be slicing across the grain.
This will seem weird and wrong and you'll want to roll it up the other
way because this way you'll end up with a long skinny thing that doesn't
fit in the pot. It'll taste just as good either way, but it'll be a lot
easier to eat if you roll it up the right way.
Brown steak a bit in small amount of oil, any kind ... maybe use
a little of the bacon grease.
Onions, sliced - I don't like onions, so I leave them out.
Tomato sauce - one regular-sized can. Pour over steak.
Add a little water too, up to about 1/3 can, if you want more sauce.
Salt, pepper, spices as desired. I add a little cinnamon, to make it
taste more like Grecian Chicken (another tomato-sauce recipe where
googling gets entirely the wrong result, and if I ever find it I'll
be sure to blog it) or like the chicken tikka masala at Bollywood Cafe
(which has no resemblance to tikka masala anywhere else, but is wonderful).
I usually toss in a couple of bay leaves too, and whatever else I
feel like adding that day.
Cook in the crockpot maybe 6.5 hours on high, longer on low.
Also works fine simmering in a pan on the stove -- check it about 2.5
hours but expect it to take 3 or so.
It doesn't hurt to baste occasionally, or add water if it starts to look dry
(in the crockpot that usually isn't needed).
In the last hour or two, toss in:
Raisins - maybe a double handful (a couple small boxes).
When it's done, it should be falling-apart tender.
Serving:
Cut small rounds, ladle sauce over them, and serve with noodles or bread.
Enjoy!
Tags: recipe
[
10:56 Mar 07, 2010
More recipes |
permalink to this entry
]
Fri, 05 Mar 2010
(and how to convert MPEG video to animated GIF)
I gave an
Ignite talk
this week at
Ignite Silicon Valley.
It was a great event! Lots of entertaining talks about all sorts of topics.
I'd always wanted to do an Ignite speech.
I always suspected the kicker would be format:
O'Reilly's guidelines specified PowerPoint format.
Of course, as a Linux user, my only option for creating PowerPoint
slides is OpenOffice. Historically, OpenOffice and I haven't gotten
along very well, and this slide show was no exception. Happily,
Ignite needs only 20 slides ... how hard can that be, right?
Most of my slides were very simple (a few words, or one picture),
with one exception: I had one simulation I wanted to show as a
video. (When I give this presentation on my own machine, I run
the simulation live, but that's not an option on someone else's machine.
Impress woes
First I wrestled with Open Office to create the non-animated slides.
It was harder than I'd expected.
I just loved having to go back and un-capitalize words that
OO kept helpfully re-capitalizing for me.
And the way it wouldn't let me change text format on any word that
triggered the spellchecker, because it needed to show me the spellcheck
context menu instead. And the guessing game clicking around trying to
find a place where OO would let me drag to move the text to somewhere
where it was approximately centered.
And when I finally thought I had everything, I saved as .ppt, re-loaded
and discovered that it had lost all my formatting, so instead of yellow
96 point centered text I had white 14-point left-aligned, and I had to
go in and select the text on each slide and change three or
four properties on each one.
And I couldn't use it for an actual presentation.
In slideshow mode, it only showed the first slide about one time out
of six. The other times, it showed a blank slide for the first 15
seconds before auto-advancing to the second one.
The auto-advance timing was off anyway (see below).
Fortunately, I didn't need use OpenOffice for this presentation;
I only needed it to create the PPT file.
I ended up making a separate version of the slides in HTML to practice with.
Inserting a movie
But I did eventually have all my static slides ready.
It was time to insert my movie, which I had converted to MPEG1
on the theory that it works everywhere. With the mpeg added,
I saved one copy to OpenOffice's native format of .odp,
plus the .ppt copy I would need for the actual presentation.
Then I quit and opened the .ppt -- and the video slide was blank.
A bit of searching revealed that this was a long-known issue,
bug 90272,
but there seems to be no interest in fixing it.
So I was out of luck if I wanted to attach an MPEG,
unless I could find someone with a real copy of PowerPoint.
Plan B: Animated GIF
Next idea: convert my 15-second video to an animated GIF.
But how to do that? Google found me quite a few web pages that claimed
to give the recipe, but they all led to the same error message:
ERROR: gif only handles the rgb24 pixel format. Use -pix_fmt rgb24.
So what? Just add -pix_fmt rgb24 to the commandline,
right? But the trick turns out to be where to add it, since
ffmpeg turns out to be highly picky about its argument order.
Here's the working formula to convert a movie to animated GIF:
$ ffmpeg -i foo.mpeg -pix_fmt rgb24 foo.gif
This produced a huge file, though, and it didn't really need to be
1024x768, so I scaled it down with ImageMagick:
convert -depth 8 -scale 800x600 flock-mpeg.gif flock-mpeg-800.gif
which brought the file size from 278M down to a much more reasonable
1.9M.
Happily, OpenOffice does seem to be able to import and save animated
GIFs, even to .ppt format. It has trouble displaying them -- that's
bug 90272
-- so you wouldn't want to use this format for a presentation you were
actually going to give in OpenOffice. But as I mentioned, OpenOffice
was already out for that.
If you do this, make sure all your static slides are finished first.
Once I loaded the animated GIF,
OpenOffice slowed to a crawl and it was hard to do anything at all.
Moving text on a slide turned into an ordeal of "hover the mouse where
you think a move cursor might show up, and wait 45 seconds ... cursor
change? No? Okay, move a few pixels and wait again." Nothing happened
in real time. A single mouse click wouldn't register for 30 seconds or
more. And this was on my fast dual-core desktop with 4G RAM;
I don't even want to think what it would be like on my laptop.
I don't know if OOo is running the animations continuously, or what --
but be sure you have everything else finished before you load any animations.
The moment of truth
I never found out whether my presentation worked in real Microsoft Powerpoint.
As it turned out, at the real event, the display machine was a Mac
running Keynote. Keynote was able to import the .ppt from OpenOffice,
and to display the animation. Whew!
One curiosity about the display: the 15 seconds per slide auto-advance
failed on the animated slide. The slide showed for 30 seconds rather
than 15. I had written this off as another OpenOffice bug, so I wasn't
prepared when Keynote did the same thing in the live presentation,
and I had to extemporize for 15 seconds.
My theory, thinking about it afterward, is that the presentation
programs don't start the counter until the animation has finished
playing. So for an Ignite presentation, you might need to set the
animation to play for exactly 15 seconds, then set that slide to
advance after 0 seconds. If that's even possible.
Or just use HTML. The great irony of this whole story is that some of
the other presenters used their own laptops, so I probably could have
used my HTML version (which had none of these problems) had I asked.
I will definitely remember that for the next Ignite!
Meanwhile, I suppose it's good for me to try OO Impress every few
years and remind myself why I avoid it the rest of the time.
Tags: speaking, open office, video, rant, flame
[
15:36 Mar 05, 2010
More speaking |
permalink to this entry
]
Thu, 25 Feb 2010
Part 2 of my 3-parter on configuring Ubuntu's new grub2 boot menu
covers cleaning up all the bogus menu entries (if you have a
multiple-boot system) and some tricks on setting color and image
backgrounds:
Cleaning
up your boot menu (Grub2 part 2).
Tags: writing, linux, grub, ubuntu
[
21:49 Feb 25, 2010
More writing |
permalink to this entry
]
Wed, 24 Feb 2010
I'm finally getting caught up after
SCALE 8x,
this year's Southern CA Linux Expo.
A few highlights (not even close to a comprehensive list):
Friday:
The UbuCon and Women in Open Source (WIOS) were both great successes,
with a great speaker list and good attendance. It was hard to choose
between them.
Malakai Wade, Mirano Cafiero, and Saskia Wade, two 12-year-olds and an
8-year-old, presenting on "Ultimate Randomness - Girl voices in open source".
Great stuff! They sang, they discussed their favorite apps, they
showed an animated video made with open source tools of dolls
in a dollhouse. Lots of energy, confidence and fun. Loved it!
I hope to see more of these girls.
I liked Nathan Haines demo of "Quickly", an app for rapid development
of python-gtk apps. It looks like a great app, especially for
beginning programmers, though his demo did also illustrate the
problems with complex UIs filled with a zillion similar toolbuttons.
(I'm not criticising Nathan; I find UIs like that very difficult to use,
especially under pressure like a live demo in front of an audience.)
Happily, the UbuCon and WIOS scheduled their lightning talks at
different times (though UbuCon's conflicted with WIOS's "How to give
a Lightning Talk" session). So lightning talk junkies enjoyed two
hours of talks back to back, plus the chance to give two different
talks to different audiences. Hectic but a lot of fun.
Saturday
I was a little disappointed with the Git Tips & Tricks panel; I wanted
more git tips and less discussion of projects that happen to use Git.
I liked Don Marti's section on IkiWiki;
it looks like a great tool and I wish Don had had more time to present.
I liked Emma Jane Hogbin's useful and interesting talk on "Looking
Beautiful in Print", full of practical tips for how to design good
flyers and brochures using tools like OpenOffice.
Diana Chen, who got introduced to open source only a year ago at SCALE
7x, gets the award for courage: she gave a talk on "Learning python
for non-programmers" using a borrowed laptop that I'm not sure she'd
even seen before the presentation. Unfortunately, the
laptop turned out to be poorly suited to the task (no Python installed?
Dvorak keymap?) so Diana struggled to show what she'd planned, but
she came through and her demos eventually worked great.
I hope she wasn't too discouraged by the difficulties, and keeps
presenting -- preferably with more time to practice ahead of time.
The room was absolutely packed --
they had to bring in lots more chairs and there were still a lot of
people standing. There's obviously a huge amount of interest in
beginner programming talks at this conference!
Shawn Powers' talk, "Linux is for Smart People, and You're Not as Dumb
as You Think", was as entertaining as the title suggested --
an excellent beginner-track talk that I think everyone enjoyed.
Sunday
I'm not going to review Sunday's program, because I was busy
obsessing over my own "Featherweight Linux" talk. I'll just say that
SCALE is a great place to give a talk -- the audience was great, with
excellent questions and no heckling and, most important, they laughed
when I hoped they would. :-)
Exhibitors
I didn't get to spend much time on the show floor, but it looked
active and fun.
The Linux Astronomy folks
had a fantastic display, with a big table with a simulated Martian landscape
and a couple of robotic rovers exploring it and a robotic telescope
driven by a milling machine program, as well as computers exhibiting a
selection of Linux astronomy, science and math-teaching software.
ZaReason had a booth, and my mom was able to get info on how to get
a spare battery for her laptop. (Can I take a moment to say how cool
it is to be wandering around a Linux conference with my mom, who's
carrying her own Linux netbook?)
An Ubuntu/Canonical table was testing people's laptops for
compatibility with the next Ubuntu release. (There may have been
other distros tested as well; I wasn't clear on that.)
Engineers
Without Borders, Orange County looked really interesting and
assured me that not all of them were in Orange County, and there's
activity up here in the Bay Area as well. Definitely on my list
to learn more.
Linux Pro magazine was giving out copies of Linux Pro and Ubuntu User,
both fantastic magazines packed with good articles.
Beginners and Hobbyists
One notable feature of SCALE is the low price. This conference is very
affordable, which means there are a lot of hobbyists, beginners and
even people just considering trying Linux. They've offered a "Beginner
track" for several years, though not all the talks in that track are
really accessible to beginners (speakers: here's your chance to propose
that great beginner talk the other conferences aren't interested in!
Help some new folks!)
There's a lot of energy and diversity and a wide range of interests
and knowledge -- yet there's still plenty of depth for hardcore
Linux geeks.
Overall, a fantastic conference. The SCALE organizers do a great job
of organizing everything, and if there were any glitches they weren't
evident from the outside.
Tags: conferences, linux
[
14:34 Feb 24, 2010
More conferences |
permalink to this entry
]
Sat, 20 Feb 2010
I gave a lightning talk at the Ubucon -- the Ubuntu miniconf -- at the
SCALE 8x, Southern
California Linux Expo yesterday. I've been writing about grub2
for Linux Planet but it left
me with some, well, opinions that I wanted to share.
A lightning talk
is an informal very short talk, anywhere from 2 to 5 minutes.
Typically a conference will have a session of lightning talks,
where anyone can get up to plug a project, tell a story or flame about
an annoyance. Anything goes.
I'm a lightning talk junkie -- I love giving them, and I
love hearing what everyone else has to say.
I had some simple slides for this particular talk. Generally I've
used bold or other set-offs to indicate terms I showed on a slide.
SCALE 8x, by
the way, is awesome so far, and I'm looking forward to the next two days.
Grub2 3-minute lightning talk
What's a grub? A soft wriggly worm.
But it's also the Ubuntu Bootloader.
And in Karmic, we have a brand new grub: grub2!
Well, sort of. Karmic uses Grub 2 version 1.97 beta4.
Aside from the fact that it's a beta -- nuff said about that --
what's this business of grub TWO being version ONE point something?
Are you hearing alarm bells go off yet?
But it must be better, right?
Like, they say it cleans up partition numbering.
Yay! So that confusing syntax in grub1, where you have to say [SLIDE]
(hd0,0) that doesn't look like anything else on Linux,
and you're always wanting to put the parenthesis in the wrong place
-- they finally fixed that?
Well, no. Now it looks like this: (hd0,1)
THEY KEPT THE CONFUSING SYNTAX BUT CHANGED THE NUMBER!
Gee, guys, thanks for making things simpler!
But at least grub2 is better at graphics, right? Like what if
you want to add a background image under that boring boot screen?
A dark image, because the text is white.
Except now Ubuntu changes the text color to black.
So you look in the config file to find out why ...
if background_image `make_system_path_relative...
set color_normal=black/black
... there it is! But why are there two blacks?
Of course, there's no documentation. They can't be fg/bg --
black on black wouldn't make any sense, right?
Well, it turns out it DOES mean foreground and background -- but the second
"black" doesn't mean black. It's a special grub2 code for "transparent".
That's right, they wrote this brand new program from scratch, but they
couldn't make a parser that understands "none" or "transparent".
What if you actually want text with a black background? I have
no idea. I guess you're out of luck.
Okay, what about dual booting? grub's great at that, right?
I have three distros installed on this laptop. There's a shared /boot
partition. When I change something, all I have to do is edit a file
in /boot/grub. It's great -- so much better than lilo! Anybody remember
what a pain lilo was?
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
Oops, wait -- not with grub2. Now I'm not supposed to edit
that file. Instead, I edit files in TWO places,
/etc/grub.d and /etc/default/grub.conf, and then
run a program in a third place, /usr/bin/update-grub.
All this has to be done from the same machine where you installed
grub2 -- if you're booted into one of your other distros, you're out
of luck.
grub2 takes us back to the bad old days of lilo. FAIL
Grub2 really is a soft slimy worm after all.
But I have some ideas for workarounds. If you care, watch my next
few articles on LinuxPlanet.com.
Tags: grub, ubuntu, linux, speaking, conferences
[
10:29 Feb 20, 2010
More linux |
permalink to this entry
]
Fri, 12 Feb 2010
Okay, I know Dave and I are probably the last two people on the face
of the earth who use PalmOS. But we still do, to read news and
ebooks prepared with
Plucker, only
there was one big frustration: none of our Plucker files were
beamable. So if I downloaded a really interesting article and wanted
to share it with Dave, I couldn't (unless we went back to our
desktop machines and transferred it that way.)
The Palm just said
Unhandled exception, error code = 5395.
I tried all sorts of things in the
feedme code that
calls Plucker -- adding --beamable, moving it earlier or later in
the argument list, trying other arguments. --beamable is supposed to
affect the "copy protect bit", but checking on the Palm devices
confirmed the copy protect bit wasn't set, and still beaming didn't work.
And I just stumbled on the answer tonight, and since it's not
documented anywhere, I must document it in case somewhere, there's
someone else who still uses PalmOS and Plucker struggling with this
problem.
It turns out that a document with a colon in the name can't be beamed.
On any PalmOS device we've tried, regardless of generation or
manufacturer. This of course isn't documented anywhere I can find.
So Fri: BBC World News isn't beamable. But simply give it a
colonoscopy -- rename it to Fri BBC World News --
and beaming works great.
Sheesh! Ain't debugging grand?
Tags: palm, plucker
[
19:43 Feb 12, 2010
More tech |
permalink to this entry
]
Thu, 11 Feb 2010
Upgraded to Ubuntu 9.10 Karmic and wondering how to configure your
boot menu or set it up for multiple boots?
Grub2 Worms Into Ubuntu (part 1)
is an introductory tutorial -- just enough to get you started.
More details will follow in parts 2 and 3.
Tags: writing, linux, grub, ubuntu
[
16:40 Feb 11, 2010
More writing |
permalink to this entry
]