I’m loving Dial2Do

A Tech article with View Comments posted 15 July 2009.
Tags: , , ,

So with my newly acquired cell phone, I’m finding that there are all sorts of interesting applications that I wouldn’t have been interested in before, but am now. I had heard of Jott, a service which transcribes spoken words into text and shuttles it off to different services, but apparently they went for-pay in February. So I found a free alternative: Dial2Do.

I am using Dial2Do for reminders (which are automatically emailed to me for later action) and for help managing my calendar. I have set up Google Calendar to send SMS messages when I have an appointment on my calendar, and with Dial2Do, I can call in to listen to my daily calendar or add new items. So far, the recognition accuracy has been pretty good. What’s really interesting, though, as a web developer is Dial2Do’s ability to set up new connections to web services. With the appropriate home automation gear at home, I could call Dial2Do, tell it to turn the lights on in ten minutes, and Dial2Do would HTTP POST that as text to a web server, which could schedule/execute the command to turn on the lights. It has really fired up my imagination.

So if you use online calendaring but don’t have a smartphone or the money for a fancy data plan, you should try Dial2Do.

MusicBrainz on my brain

A Tech article with View Comments posted 6 October 2008.
Tags: , ,

I have discovered a lovely service, MusicBrainz, which will sort through my rather poorly categorized collection of music and tag it with the proper artist, title, album, genre, etc. It does this by “listening” to the song, generating a fingerprint, and then looking that fingerprint up on a website which seemingly aims to be the Wikipedia of Music.

MusicBrainz’ tagging tool is called Picard, and it is available for Linux, Mac, and Windows. I got my copy from my friendly neighborhood Ubuntu repository. If you register on the MusicBrainz site, the tags you edit and save for your music will be uploaded and shared with other MusicBrainz users. Enjoy!

Tediousness vs. Interest

A Tech article with View Comments posted 14 June 2007.
Tags: , ,

Just got done reading this post by a respected high-energy physicist at Fermilab. I find that the same behaviour applies in a lot of other endeavors in life. Some people on mailing lists I have frequented call this “bikeshedding.” Typically software developers tend to spend too much time getting the little things perfect, the average stuff goes unreviewed, difficult things get more attention, but truly urgent stuff (like critical bugfixes) go into production almost completely unreviewed.

This is less a commentary on particle physicists or software developers and much more a commentary on humanity.

Do the simplest thing that could possibly work

A Tech article with View Comments posted 19 April 2007.
Tags: ,

Nate and I dreamed up this list this morning:

Different programming languages’ approaches to “Do the simplest thing that could possibly work.

perl: Do the simplest thing that no one can read.

C: Do the simplest thing that could possibly compile.

java: Just extend SimpleNamingSchemeWithAllNounsNameContainer.

C#: Do it in Java, only don’t suck as badly doing it.

python: Do it the only way that you can possibly write it.

COBOL: Do the simplest thing that no one alive today can maintain.

lua: Let’s take our application and embed Lua in it, then write an interpreter for a new domain-specific language in Lua and write our new feature in *that* language. Simple!

Got any others? Feel free to add them here!

Heard in the office today

A Tech article with View Comments posted 12 March 2007.
Tags: , ,

“I have a comment. In my code. That says ‘Uh oh.’ And I don’t know why.”

Debugging long-running perl programs in Debian

A Tech article with View Comments posted 15 December 2006.
Tags: , , ,

One of the slicker ways I’ve seen of trying to figure out what Perl is doing in a long-running process is defining a signal handler, like so:

use Carp ();
$SIG{‘USR2′} = sub {
Carp::confess(“Caught SIGUSR2: Dumping stacktrace and dieing:”);
};

It works great, dumping the current stacktrace to STDERR. But if you’re stuck in a loop inside the perl interpreter, that user-level signal is never handled, and you don’t get anything. Foiled again! You’re going to have to use (gasp!) the GNU debugger (gdb).

While the advice offered in Debugging mod_perl and Debugging mod_perl C internals is useful, most of the magic with gdb doesn’t work unless you are running a perl with debugging symbols on. How do you get that in Debian-based distributions?

sudo aptitude install perl-debug

Then run the process:

/usr/bin/debugperl path/to/program.pl

Attach gdb:

gdb

attach Process ID

Define the curinfo gdb macro. (see Analyzing the Core File.) If you see “my_perl” in a gdb backtrace, you’re running threaded perl, otherwise use the unthreaded version of curinfo.

(gdb) bt
#0 0xffffe410 in __kernel_vsyscall ()
#1 0xb7f78751 in accept () from /lib/tls/i686/cmov/libpthread.so.0
#2 0x081502de in Perl_pp_accept (my_perl=0x81c1008) at pp_sys.c:2565
#3 0x080d10b3 in Perl_runops_debug (my_perl=0x81c1008) at dump.c:1452
#4 0x08065c9b in S_run_body (my_perl=0x81c1008, oldscope=1) at perl.c:1995
#5 0×08065703 in perl_run (my_perl=0x81c1008) at perl.c:1919
#6 0x0805febd in main (argc=3, argv=0xbfccac44, env=0xbfccac54)
at perlmain.c:98

Looks like we’re running threaded perl, so define curinfo:

(gdb) define curinfo
Type commands for definition of “curinfo”.
End with a line saying just “end”.
> printf “%d:%s\n”, my_perl->Tcurcop->cop_line, \
my_perl->Tcurcop->cop_file
> end

Then use it:

(gdb) curinfo
196:/usr/local/share/perl/5.8.7/Catalyst/Engine/HTTP.pm
(gdb)

That’s what line was executing and what file you were in. It’s worth mentioning that this was not a buggy application, just an ordinary Catalyst application waiting for a connection. Not too exciting for ordinary perl debugging (much easier to run the process as perl -d), but when you’ve got an infinite loop in the perl interpreter (for example, an infinite loop in a regex), this can help point you in the right direction.

My first CPAN acknowledgement

A Tech article with View Comments posted 2 October 2006.
Tags: , ,

It’s a small thing, but I’m listed in the acknowledgements for Test::Class, an excellent little xUnit-with-a-decisively-perl-twist module that we use at work. A star is born?