Saturday, November 14, 2009

Fixing broken sound in flash plugin in Slackware 13.0

I upgraded my laptop to Slackware 13.0. In general, hardware support has improved. All hardware was detected automatically by HAL and UDEV. That includes formerly problematic Synaptic touchpad, both monitors attached via DVI and VGA, and Logitech Quickcam. I only needed minor adjustments to get dual screen out of the mirroring mode.

One of the minor problems was that flash plugin in Mozilla wouldn't play sound. That was despite that my username being a member of the group "audio". It turned out that if you had more than one sound device, Flash would only output sound to the first configured device (alsa card #0). When I booted the laptop with webcam attached through USB, the snd-usb-audio module loaded before snd-hda-intel, resulting in the first configured audio device (webcam) not supporting any audio output.

The workaround would be to always boot with the webcam unplugged. However, a better solution is to hint the device loading system (udev) that the built-in intel sound device needs to be loaded first. Google found me a solution in a Slackware forum at Add a file in /etc/modprobe.d containing the following instruction: "options snd slots=snd-hda-intel,snd-usb-audio". You can check the mapping of sound card slots to modules using "cat /proc/asound/modules"

References: Slackware, Where Alsa looks for default sound card, Synaptics Touchpad with HAL, Dual-screen with xrandr.

Thursday, November 12, 2009

Command line email with attachments

This is a perl script which can be used as a replacement for "mail" program, but supporting email attachments.

#!/usr/bin/perl -w

#****h* common/send_files
# send_files - sends an email with multiple file attachments
# Uses sendmail to send an email with attachments. Takes message text
# from the standard input.
# --from - From email address
# --to - To email address
# --subject - Email subject
# --file - Attach a file (use multiple times to attach multiple files)
# All the unprocessed options are treated as files to be attached
# echo "Look here" | send_files --from --to \
# --subject "Files" --file /tmp/1.txt --file /tmp/2.txt
# echo "Specify files last" | send_files --from --to \
# --subject "Files" --file /tmp/*.txt
# $Header:,v 1.6 2008/04/08 20:53:13 nsushkin Exp $
use MIME::Lite;
use MIME::Types;
use Getopt::Long;

my ($opt_from, $opt_to, $opt_subject) = ("", "", "");
my @files = ();
my $VERSION = sprintf("%d.%03d", q$Revision: 1.6 $ =~ /(\d+)\.(\d+)/);

GetOptions("from=s" => \$opt_from,
"to=s" => \$opt_to,
"subject=s" => \$opt_subject,
"file=s" => \@files);

push @files, @ARGV;
$oldC = $/;
binmode STDIN; undef $/;
$/ = $oldC;

$msg = MIME::Lite->new(
From => $opt_from,
To => $opt_to,
Subject => $opt_subject,
Type => 'TEXT',
Data => $message

'X-Mailer' => " $VERSION"

for $file (@files)
die "Not readable $file: $!" unless -r $file;
chomp (my $mimeTypeS=`file -bi "$file"`);
my MIME::Type $mimeType = MIME::Types->new->type($mimeTypeS);
chomp (my $fileName=`basename "$file"`);

Type => $mimeTypeS,
Path => $file,
Filename => $fileName,
Encoding => ($mimeType->mediaType eq 'text' ? 'quoted-printable' : 'base64')


Tuesday, March 17, 2009

set role plustrace

Just spent an hour trying to configure autotrace in Oracle It turns out that in addition to granting plustrace role to a user and creating a PLAN table, you also need to enable the plustrace role in the user's session using "SET ROLE PLUSTRACE;"

Read comments at the bottom of Tom Kyte's autotrace topic.

Friday, February 27, 2009

What will save the Earth and Wall Street?

A couple of recent articles in Wired and O'Reilly claim that technology for transparency, specifically XBRL (Extensible Business Reporting Language), is going to be crucial in saving the climate and also Wall Street. Go learn XBRL now!

In The Wired article, Daniel Roth suggests that XBRL

"...should become the lingua franca of every investment bank, hedge fund, pension fund, insurance company, and endowment fund. ... It is impossible to track any one loan in a CDO [collateralized debt obligation]; when it is combined and divided with other loans, it loses its independent identity... But if those mortgages and loans carried XBRL tags, and everybody who touched them along the way was required to use those tags as well, anyone would have been able to track their circuitous route through the financial industry and judge each CDO based on its actual content."
Chicago Climate Exchange (CCX) is a market for trading offsets of carbon and other climate related emissions, implementing the "trade" component of a "cap and trade" climate control scheme. As far as I understand, currently, CCX takes semi-manual submissions of trades via its website. However, it turns out XBRL can be used to automate carbon credit accounting and trading.

Kurt Cagle writes
"...think of each participant [of smart power grid] as a node in a network. At any given point, the state of that node - how much energy they have available for transmission at that point in time, how much energy they currently need to fulfill demands upon them - can be represented as an XBRL accounting document."
For more information, read the following recent articles

Monday, February 9, 2009

Volkerding praises KDE4 again

Recently on Slackware ChangeLog, Volkerding wrote:

Tue Jan 27 14:33:35 CST 2009
KDE 4.2.0 is released -- congratulations to the KDE development team for such
an amazing job on this beautiful and highly user-friendly desktop environment!
Thanks also to Eric Hameleers, who did a ton of work getting KDE 4.2.0 ready
for Slackware. Once again (for now), these packages are compatible with
Slackware 12.2. Enjoy! :-)
Hopefully Slackware 13 will integrate KDE4 and I will be able to enjoy the new features and eye candy.

Friday, January 23, 2009

Alan Kay on modern programming languages

Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves.
Read the rest in A Conversation with Alan Kay