Cookie Notice

As far as I know, and as far as I remember, nothing in this page does anything with Cookies.


Testing from the new phone

I have a new phone, a Samsung s30. It is a pretty thing but has a problem. Only AIM and Yahoo Messenger and I'm a Google Talk guy. Anyone know of a GTalk client for this phone?


Making Graphs with Perl and Chart::Clicker

The Graph

The Code

use 5.010 ;
use strict ;
use warnings ;
use Chart::Clicker;
use Chart::Clicker::Data::Series;
use Chart::Clicker::Data::DataSet;

my $pi = 3.14159265358979;

sub deg_to_rad { ($_[0]/180) * $pi }
sub rad_to_deg { ($_[0]/$pi) * 180 }

my @core = ( 0 .. 1_000 ) ;
my @sine ;
my @cosine ;
for my $a ( @core ) {
push @sine , sin(deg_to_rad($a)) ;
push @cosine , cos(deg_to_rad($a)) ;

my $cc = Chart::Clicker->new;
my $series1 = Chart::Clicker::Data::Series->new(
keys => \@core ,
values => \@sine
my $series2 = Chart::Clicker::Data::Series->new(
keys => \@core ,
values => \@cosine
my $dataset = Chart::Clicker::Data::DataSet->new(
series => [ $series1 , $series2 ],
$cc->add_to_datasets($dataset) ;
exit ;

There's lots of ways to do graphs. The way we do some graphs here is to do a system call to R. R is powerful, sure, but there's no good way to set up a batch of complex graphs in Perl and send them to R for graphing. There are ways, sure, but not good ways. So, I expect to do a lot more with Chart::Clicker in the future.


Letting It Go, or Why Ask Why?

I was at the library Saturday. While I sat in periodicals, reading Guitar World, there was a bit of a dust-up at the reference desk. I don't know what the person was asking about, but evidently it was, in his mind, easily-spelled, yet the librarian felt lead to ask.

This caused the guy to switch his interest. He wanted to know why she could not spell.

Now, if you were a librarian, there trying to help people, and people instead attack you, you would naturally be disinclined to be helpful. In this case, after several repeats of the phrase "This conversation is over", the head librarian was called over and the patron was escorted out the door.

There's a point here. Beyond the obvious "Don't Be An Obsessive-Compulsive Psycho." Clearly, that is important. The point I have is Why is Not Important. Of all the Ws, it is the least important in most parts of your life. Who: Someone, from a waitress to Mordoc, Preventer of Information Services. What: A good or service. Something they have and you want. When: If a deal is being made, urgency has been established. So, now, if not sooner. How: Sometimes this is crucial. As a parent, I know the results when "carefully, half that much, with both hands" is ignored. Someone has to sweep up the broken stuff. But Why? "Why can't you spell?" Is there a possible answer that will be satisfactory? "Ah, so that's why you can't spell! That explains it perfectly!"

I have found that it makes no sense to ask questions when I'm trying to get something done. Give orders? Make requests? Sure. But questions? I don't want to know the answers. I just want what I'm trying to get.


Windows Essentials?

OK, I munged it up. I couldn't create new accounts or add new MSI packages to the netbook. It had to go. It had to go. The problem I had was that my install media was on CDROM, but the netbook, being a netbook, has no optical drive from which to read a CDROM. But college campuses collect computer geeks and computer gear, so a quick Hey Rube got me a loaner USB optical drive. (What's crazy is that this drive is almost exactly the size of the netbook. I'll put up a picture tomorrow.)

So, I have the initial install. That was fast enough. There's the drivers to make the thing usable. I shoved a chunk of 'em onto my thumb drive, but I am sure I missed more than a few, including the work printer. After that, go to windowsupdate and get the thing up to the newest. And honestly, I'm still downloading and installing Service Pack 3 here. But that's just minimal function. We're not talking apps yet.

First place I went to was Ninite. There's an awful lot installers you can get at once. I picked up a bunch of browsers — I rock Firefox because Delicious has my bookmarks, but I have Chrome and Safari running, too — plus Hulu and VLC, Microsoft Security Essentials for virus protection and such, .Net and Dropbox and CCleaner and Notepad++ and PuTTY. Not a bad bunch of stuff, but not complete.

Dave Winer calls Dropbox the coolest software of the decade. I'm not quite there yet, but I'm close. It is pretty neat.

I live in a very networked world, and I have 15GB of SSD total on this thing, so I'd rather run Google Apps for what few Office Suite things I need and keep the space. I mean, if I'm somewhere not home and not work, it's very unlikely that I need an office suite. So, I went to get the Google Pack.

All things told, I probably shouldn't have put on Google Earth. Probably too big with little enough use. We'll see.

There's also a whole bunch of tweaks for XP that only come from the source. Power Toys. I first went for TweakUI, but the ClearType Tweaker and Alt-Tab replacement, are really near-essential add-ons. And Virtual Desktop Manager is SO nice.

But that doesn't get into the core issues. I have IE6. It is inexcuable to not have IE8. I need PowerShell. It isn't a Gnome terminal with a bash shell, but it's better than Command Prompt.

He's a few required SourceForge bits. Synergy allows you to share one keyboard and mouse across many computers, which is great when I'm at work. I can type on a netbook keyboard but I probably couldn't work on one, program on one. And there's XMing, an X server for Windows, which connects to the crucial PuTTY and allows you to have your big heavy windowing applications run on the big server and show up on the netbook as just the pictures.

One thing I'm pondering but not decided on is Growl for Windows. It's like my beloved notify-osd with a networking protocol bolted onto it, it seems.

Which leads me to these few questions: I need a Perl, but do I need Strawberry or Activestate? And is Notebook++ good enough for my programming on Windows needs, or should I get Komodo Edit? I've gone Komodo for 80% of my coding work.

And the big one. What did I forget? What Windows program have I omitted that's essential and just plain cool?


jBiff - Announcing New Mail via XMPP/Jabber

The Productivity People say turn off alerts for new mail, because it will suck your brain and suck your time. That's fine well and good. Except when you're coding and your boss shows up over your shoulder and says "Did you get my email?"

I hate having to respond "What email?" So, there's good reasons to have highly-specific alerts. And, to my knowledge, you can't really do that with Thunderbird and Epiphany. So, I began to wonder why I should even use those. Why not use Perl? It has Net::XMPP and more than one IMAP module.

So, I wrote jBiff. First there was biff, the command line tool. Then there was xbiff. Now, we have jBiff, telling your jabber client "You have mail."

I will put it on Github, soon after I figure out how.


# -imap -x -s foo -s bar -s blee

use Carp ;
use Data::Dumper ;
use Getopt::Long ;
use IO::Socket::SSL ;
use IO::Interactive qw{interactive} ;
use Mail::IMAPClient ;
use Modern::Perl ;
use Net::XMPP ;
use subs qw{ imap_part xmpp_part } ;

$Data::Dumper::Indent = 1 ;
my @sender ;
my $debug ;
my $xmpp_identity ;
my $imap_identity ;
GetOptions( 'sender=s' => \@sender,
'debug=i' => \$debug,
'xmpp=s' => \$xmpp_identity,
'imap=s' => \$imap_identity, ) or exit( 1 ) ;

exit if !defined $imap_identity ;
exit if !defined $xmpp_identity ;
exit if length $imap_identity < 1 ;
exit if length $xmpp_identity < 1 ;

imap_part @sender ;

# ====================================================================
# Pull credentials from a configuration file
# ====================================================================
sub get_credentials {
my ( $protocol, $identity ) = @_ ;
my %config_files ;
my %config_vals ;
my %config ;

$config_files{ imap } = '.imap_identities' ;
$config_files{ smtp } = '.smtp_identities' ;
$config_files{ xmpp } = '.xmpp_identities' ;

$config_vals{ imap } = [ qw{
key server port username password directory
} ] ;
$config_vals{ xmpp } = [ qw{
key host component sender password recipient resource
} ] ;
my $stat = ( stat "$ENV{HOME}/$config_files{$protocol}" )[ 2 ] ;
my $hex_stat = sprintf '%04o', $stat ;

if ( $hex_stat != 100600 ) {
say 'You should ensure that this file is not executable,' ;
say ' and not world or group-readable or -writable.' ;
exit ;

if ( -f "$ENV{HOME}/$config_files{$protocol}"
&& -r "$ENV{HOME}/$config_files{$protocol}" ) {
if ( open my $fh, '<', "$ENV{HOME}/$config_files{$protocol}" ) {
while ( <$fh> ) {
chomp $_ ;
$_ = ( split m{\#}mx, $_ )[ 0 ] ;
my @creds = split m{\s*,\s*}mx, $_ ;
next if scalar @creds < 6 ;
for my $i ( 1 .. $#creds ) {
my $key = $creds[ 0 ] ;
my $val = $creds[ $i ] ;
my $key2 = $config_vals{ $protocol }[ $i ] ;
$config{ $key }{ $key2 } = $val ;
close $fh ;
my $href = $config{ $identity } ;
return %$href ;
else {
say "No Configuration" ;
exit ;
exit ;

# --------------------------------------------------------------------

# ====================================================================
# connect to and search your mail server via IMAP
# ====================================================================
sub imap_part {
my @sender = @_ ;
my $sender = join '|', @sender ;
my %creds = get_credentials( 'imap', $imap_identity ) ;

my $socket = IO::Socket::SSL->new( PeerAddr => $creds{ server },
PeerPort => $creds{ port },
) or die "socket(): $@" ;

my $client = Mail::IMAPClient->new( Socket => $socket,
User => $creds{ username },
Password => $creds{ password },
) or die "new(): $@" ;

if ( $client->IsAuthenticated() ) {
$client->select( $creds{ directory } )
or die "Select '$creds{directory}' error: ",
$client->LastError, "\n" ;

for my $msg ( reverse $client->unseen ) {
my $from = $client->get_header( $msg, 'From' ) ;
my $to = $client->get_header( $msg, 'To' ) ;
my $subject = $client->subject( $msg )
or die "Could not subject $@\n" ;
if ( $from =~ m{$sender}i ) {
my $title = 'New mail from ' . $from ;
my $body = $subject ;
$body = join q{"}, '', $body, '' ;
xmpp_part "$title - $body" ;
$client->logout() ;
else {
say 'FAIL ' . $! ;

# --------------------------------------------------------------------

# ====================================================================
# send message via XMPP/Jabber
# ====================================================================
sub xmpp_part {
my $args = shift ;
my %creds = get_credentials( 'xmpp', $xmpp_identity ) ;

# connection
my $hostname = $creds{ host } ;
my $port = 5222 ;
my $componentname = $creds{ component } ;
my $connectiontype = 'tcpip' ;
my $tls = 1 ;

my $username = $creds{ sender } ;
my $password = $creds{ password } ;
my $resource = $creds{ resource } ;

my @field ;
push @field, $creds{ recipient } ;

my $Connection = new Net::XMPP::Client() ;

# Connect to
my $status = $Connection->Connect( hostname => $hostname,
port => $port,
componentname => $componentname,
connectiontype => $connectiontype,
tls => $tls ) ;
if ( !( defined( $status ) ) ) {
print "ERROR: XMPP connection failed.\n" ;
print " ($!)\n" ;
exit( 0 ) ;

# Change hostname
my $sid = $Connection->{ SESSION }->{ id } ;
$Connection->{ STREAM }->{ SIDS }->{ $sid }->{ hostname } = $componentname ;

# Authenticate
my @result = $Connection->AuthSend( username => $username,
password => $password,
resource => $resource ) ;

if ( $result[ 0 ] ne "ok" ) {
print "ERROR: Authorization failed: $result[0] - $result[1]\n" ;
exit( 0 ) ;

# Send messages
foreach ( @field ) {
$Connection->MessageSend( to => "$_\@$componentname",
resource => $resource,
subject => "Notification",
type => "chat",
body => $args ) ;

$Connection->Disconnect() ;

# --------------------------------------------------------------------


Pieces-Parts To Program, Toward A Better Programming Life.

Just to be clear: I do not have advanced digital cable. We get the basic analog cable that comes with our internet. We have asked to not get it, because we don't want to be surprised into having to pay for it. This means we don't have the TiVo-like interface to remember when the show we want.

What we do have is the TVGuide Channel. Which is the Michael Jackson and Ugly Betty channel, which sucks.

And, which never remembers the settings I want to have it set. It's a reasonable. But there's the big big big table of all that's on. I don't care about that. I have a much smaller list of shows I want to watch.

And want to watch is a key. We're not talking is fine to watch, which I can search for the best thing right now. I'm talking about the things I want to be sure for the whens of my favorite shows.

This is what I want, what I think I can do.
  • get_TV_data - an API to access what's on what channel
  • set_google_calendar_event - an API to create an event on a Google Calendar calendar. I want this anyway, and I'm pretty sure that it's on CPAN.
  • google_calendar_alert - When you set an event in Google Calendar, it will either pop up (useless if you're not in Google Calendar), send an email, or send an SMS, which is essentially an email. What I want is for it to talk to me via GoogleTalk, which is Jabber, or XMPP. I have the XMPP part, I more than have that, so it's just the reading of the calendars.

Everything on that is pie in the sky, but it should be doable.


Another Little Pessimizations

chromatic has a post on the Modern Perl site called Removing the Little Pessimizations where he mentions and expands on bit from Perl Hacks. He suggested adding this line to your .alias:
 alias realias='$EDITOR ~/.aliases; source ~/.aliases' 

I just came up with another one. This one should go into your crontab:
 0 * * * * /usr/bin/crontab -l > ~/.latest_crontab  

Every hour, on the hour, it copies your crontab into a local directory.

I just reinstalled Ubuntu, hoping that this fixed the problem that occurred after the Jackalope->Koala upgrade. It didn't, but I lost some stuff, including my crontab. I have a separate partition for /home, so I didn't lose everything in the reinstall, but crontabs are not stored in your local dir and thus are wiped.

And, thank you Damian Conway and chromatic for the realias thing!

That's It!

I have my notify-osd back!

I have a Radeon 7000 dual-head card, and evidently there's a known issue with the driver that comes with Ubuntu Koala. Saying Driver "vesa" like the thread said didn't work, but telling my X config to shut off hardware accelleration did.

Section "Device"
Identifier "Card0"
Driver "radeon"
VendorName "ATI Technologies Inc"
BoardName "Radeon RV100 QY [Radeon 7000/VE]"
BusID "PCI:1:0:0"
Option "NoAccel" "TRUE" # []

Will post a pic with all the goodness running later. Thanks, Shub-Internet!

Other Broken Things in Ubuntu Koala

This is Gnome System Monitor. In an ugly pink punk tartan.

Thing is, it's usable, except it's not. I mean, I can right-click and I get a drop-down in some other indecipherable pattern. I can double-click where the angry pink tartan should have a menu and have it roll up like any other window. I just can't see it!

Any thoughts as to how to fix this?


notify-osd is broken under Ubuntu Koala

At least for me. Because that image, which shows a pink punk tartan, should be telling me that it's 55° and sunny in my home town today. I wrote a script that gathered the weather, put on a nice icon and displayed it. And it worked under Jaunty. But when I upgraded to Karmic, no dice. And now, after I spent the morning reinstalling , still no dice.

Any thoughts? Any help?