CPAN Mashup?

One of the common issues I hear about CPAN is that it’s so sprawling that people do not know which modules to use and which not to use. Hopefully part of that issue will be solved by the Enlightened Perl Core, but that will only go so far. Recently there were a couple posts regarding this issue. (Note: They are in reference to a post I made and they are from the same guy.

Posted Tue, Jun 9, 2009

Vim Feature of the Day: gv

Have you ever highlighted something in vim, yanked it, and then realized you wanted to yank it to a different buffer, often + or *? Well, try the command gv. It will highlight whatever you had previously selected. I probably use it at least once a day. Enjoy! (The following includes affiliate links.) If you’d like to learn more, I can recommend two excellent books. I first learned how to use vi from Learning the vi and Vim Editors.

Posted Mon, Jun 8, 2009


I just completed World of Goo(or buy direct, here). Very fun game! I like video games, but I tend to not play them very much because I do all kinds of other things (lots of programming if you can’t tell :-) ) but recently I’ve found that they help me clear my mind when I am trying to figure stuff out. Like, I’ll be coding and I will usually get stuck on a design issue.

Posted Sat, Jun 6, 2009

Future Post: Compare and Contrast CGIApp and Catalyst

So I’d like to do a post on CGIApp and Catalyst. People on IRC keep telling me that using CGIApp is wrong (mostly because they’ve never used it) and that I should switch to Catalyst. Catalyst may be great, but I haven’t seen any solid posts about how Catalyst is great. So help me out. Ignoring the fact that Catalyst is what everyone uses (so there are lots of plugins for it) what makes it so good?

Posted Fri, Jun 5, 2009

Windows Agony: Con

At $work I manage the subversion repositories for all of the software that we develop. It’s certainly not something that I’m great at, but I’ve used it longer than most so I am the most qualified to deal with it. Furthermore, at work we use this tool (Freescale?) which, when it creates a project, creates a Boot directory and a Con directory. Ok, so I had helped our head honcho EE create a repository to store his project data and versions.

Posted Wed, Jun 3, 2009

Web Comic Downloaders

Since the beginning of my serious webcomic journey with xkcd, I think that was four years ago, I’ve been writing little scripts to help me get started. The first type of script is to grab integer-based, monotonically increasing files. Very easy. Done in Ruby. #!/usr/bin/ruby -w Fromat = "" 1.upto(986) do |i| `wget #{sprintf(Fromat, i)}` sleep 1 end The next harder are the ones that are based on the date of publication.

Posted Tue, Jun 2, 2009

Script to Rename MP3's

I recently got a new car stereo due to the other one being stolen. I am almost entirely happy with the model that I ended up purchasing, but one thing that it does, which is really obnoxious, is that it doesn’t sort the files correctly unless the track number is early on in the file name. Even if all tracks are “FooBarBaz 01 - name.mp3” it seems to ignore the number unless it’s the very beginning of the file name.

Posted Sun, May 31, 2009


This is a blogish version of a message I posted to the DBIC Mailing list recently. First off, this is my table structure: User has many Roles (Role belongs to User) Role has many Permissions (Permission belongs to Role) Permissions has many Screens (Screens has many Permissions) Screens belongs to Section (Section has many Screens) So I thought I could do this: my @sections = $user->roles ->related_resultset('permissions') ->related_resultset('screens') ->related_resultset('section') ->all; But related_resultset doesn’t work with many_to_many because it’s not a “real” relation (I’d like to hear about why that is at some point.

Posted Fri, May 22, 2009

Don't Repeat Yourself: JSON

With DBIx::Class we typically have a TO_JSON method which returns a hashref of the data you want in your json. Here’s an example: sub TO_JSON { my $self = shift; return { id => $self->id, name => $self->name, comments => $self->comments, email => $self->email, job => $self->job, ok => $self->ok, i_cant => $self->i_cant, think_of => $self->think_ok, anymore => $self->anymore, }; } Here’s the shorter version mst inspired me to write:

Posted Tue, May 19, 2009

Perl 5 to Perl 6 Rewrite

My coworker Wes asked me if there could be a nice refactor for the following function which checks CAS Numbers to ensure their validity. After struggling for 30 minutes I gave up trying to make it a little bit nicer with reduce. sub cas_old { my $cas = shift; if ($cas =~ /\d{1,8}-\d\d-\d/) { my @ary = grep { $_ ne '-' } split(//, $cas); my $check = pop @ary; my $count = @ary; my $sum; for (@ary){ $sum += $_ * $count--; } return $sum % 10 == $check; } return; } Let’s take a look at this and figure it out.

Posted Fri, May 15, 2009

Dallas.p6m: May 2009

We had the second Dallas.p6m on May 12, 2009. Along with me there were two of my coworkers, s1n, Graham Barr, and Patrick Michaud. We discussed a lot of things. One of which was the difference between subs and methods in Perl6. And the fact that you can’t imply self. This should explain it: class A { sub foo { say 'foo'; } method bar($o:) { # much to s1n's chagrin, you can't # have baz() imply self.

Posted Fri, May 15, 2009

What I want from the Perl 5 support policy

This is in response to chromatic’s post Writing Perl 5’s Support Policy I want to be able to use the support policy as a reason to convince customers with lots of Perl installs that they need to update. A big part of this means an easy upgrade. Probably most of the people using Perl 5 are in Unix. That makes it easier for you folks. On Windows installing Perl is no simple task, either ActivePerl or Strawberry Perl.

Posted Thu, May 14, 2009

Profilers or more specifically NYTProf

At work one of our customers is having us revamp one of the major sections of the site. We are moving in the “Web Application” direction; that is, very little HTML, and almost all Javascript. The section of the site that my coworker was working on recently does a lot of calculation. On the old HTML page a customer would log in, ask for a certain report, and I guess go get a cup of coffee.

Posted Tue, May 12, 2009

Concert of the Month: Astronautalis

Saturday night my roommate and another friend went to see Astronautalis. He was actually sandwiched between Valina and The Paper Chase. Valina was a generic rock band that I can’t imagine ever going to see just for them. They just didn’t seem to bring anything special to the table. The Paper Chase were Dissonant Rock and most of their songs sounded the same. We left after their fourth song I think.

Posted Tue, May 12, 2009

Friday Refactor

It’s Friday, so a long post is not in order. With that in mind, a simple refactor for your pattern matching skulls and skills:

Posted Sat, May 9, 2009

Album of the Week: Space Revolver

(The following includes affiliate links.) I have had quite the love affair with prog-rock. One of the bands that led to this affair was The Flower Kings. I think the third album of theirs that I got was Space Revolver. Space Revolver is very much prog and very much Flower Kings. For instance, the first song, I Am The Sun (part one) has lots of noise and even a weird (but awesome) sub-song that most bands certainly wouldn’t do.

Posted Fri, May 8, 2009

Making MSDOS a little bit nicer

I work at a Microsoft Company more or less. We use SQL Server, IIS (moving to Apache…), and various flavors of Windows for all of our machines. I haven’t had the cojones to install Ubunutu on my desktop yet, so I am stuck with cygwin and friends. But the perl that runs my server is not in cygwin. That means that if I want to do valid testing I have to do it with the regular perl.

Posted Fri, May 8, 2009

Perl6 Excitement

“I estimate that Rakudo starts up nearly 40% faster now than it did when I started on Sunday night. We can get it faster yet.” –chromatic

Posted Fri, May 8, 2009

Testing with Perl: awesome

Sometimes when I get close to the end of the day and it isn’t feasible for me to start on something new I expand on my current project’s test suite. Recently I worked on one of the (seemingly) more complex ones. Basically it tests one of our autocompleters to ensure that it will search for the name and also the public facing id of a certain field. The id part was easy.

Posted Thu, May 7, 2009

Future Perl

This is mostly stuff I’ve gathered from this talk and updated slightly.

Posted Thu, May 7, 2009

Flight of the Conchords live

I’ve decided that seeing a concert warrants a blog post, and that a concert blog post can fill in for an Album of the Week post. If I pay the money to see a concert (typically more than the cost of a CD) I probably like the band that much :-) With that in mind I present to you my most recent concert: The Flight of the Conchords. You’ve probably already heard of Flight of the Conchords.

Posted Thu, May 7, 2009

Glad to be part of the Perl Community

I’ve mentioned this in at least one previous post before, but it bears repeating. First off, here’s some context for the varied information I am about to throw out at you, dear reader. I keep in touch with both the Ruby and Rails worlds because I think they have some really good ideas. Recently there was a conference session about CouchDB. I read the slides and I was impressed. CouchDB is cool stuff!

Posted Wed, May 6, 2009

WebCritic: standalone version

Ok, you guys asked for it. I have updated WebCritic to be a lot leaner and meaner. Get the new version at the same great place. It now runs entirely in it’s own lightweight server. No apache or mod_perl needed. It now uses CGI::Application::Server. It no longer uses CGI::Application::Dispatch, as my end goal no longer requires it. CAS fills the gap that CAD did for me. I also removed all of the lines that needed perl 5.

Posted Tue, May 5, 2009

Moose makes Perl OO Sexy!

We should have all heard of Moose by now as a great way to do OO with Perl. While I was working on WebCritic I decided that it would be a good idea to hook my OO stuff up Moose style. I figure that even if I were to just write code and then disappear I might as well write 2009 code instead of 1999 code so that if it ever gets copied it will bless the copier instead of curse them.

Posted Fri, May 1, 2009

Testing: Way Cool!

When I was writing WebCritic I decided that the code was small and simple enough that it would be a great candidate for me to figure out how to set up automated testing for the whole stack (except for the javascript.) This is something that I’ve wanted to do at work for a long time but I feel bad spending time figuring out stuff like this on the customer’s dollar. I already had Perl Testing: A Developer’s Notebookand I figured I’d use it to get a start.

Posted Thu, Apr 30, 2009

PerlCritic for Web Developers

I like to continually move towards perfection in my code. perlcritic is a tool based on the book Perl Best Practicesby Damian Conway. It’s basically lint for perl. perlcritic is fine as it is if you spend all day on the console, but I usually spend my whole day in Firefox and vim. The only use for my console is checking in source and using irssi. There are a few other things I use the console for, but the point remains, I spend more time in Firefox than I do in the shell.

Posted Wed, Apr 29, 2009

Hey guys! You should blog too!

Check it! Ok that article is really long. Here’s the breakdown. Basically Matthew S Trout, the main guy who makes DBIx::Class, made a similar observation as other people. More specifically, Perl people don’t blog enough. With that in mind Mr. Trout gives some compelling reasons to start! So read the article. Also: lots of things are coming out lately! Ubuntu 9.04 just got pushed to my laptop, and my phone is gonna get updated from 1.

Posted Fri, Apr 24, 2009

Perl::Tidy: annoying facts

So I was trying to use perltidy programmatically, that means using Perl::Tidy.

Posted Fri, Apr 24, 2009

Vim Tip of the Day

Every now and then I want to run a given vim command on a bunch of lines. In the past I would have either executed the command and then pressed j. (Hi J-Dot!) to go down and repeat the command. Or if the command were more complex I would have used a macro and done it over and over with @@. Well, for simple stuff on a range there is an easier way!

Posted Thu, Apr 23, 2009

Why CPAN is Awesome

Have you ever written a server? It’s kinda fun!

Posted Thu, Apr 23, 2009

Album of the Week: Anywhere I Lay My Head

(The following includes affiliate links.) This week’s Album of the Week is Anywhere I Lay My Headby Scarlett Johansson. The album is comprised of Tom Waits covers done by Johansson. According to my friend Neil and also Internet, Dave Sitek, also made quite the impression on the album as a whole. The main impression one gets from the album is it’s muddled sound. It’s as if Johansson is singing from the bottom of a lake or something.

Posted Wed, Apr 22, 2009

More Tools Monday

So I am working on a new way to use perlcritic, and one of the things I’d like perlcritic to check for is a correctly formatted file. Unfortunately the integration between perlcritic and perltidy goes something like this: Tidy the file with perltidy Give vague error if tidy file != original file That’s fine until you discover that = signs get aligned and apparently you cannot turn that feature off.

Posted Tue, Apr 21, 2009

Post Conference Friday Toolchain

Today at work I put to use a lot of the stuff that I learned at the conference this week. The first thing I did was install JSLint Multi. I already use Yahoo! Widgets for the weather and an analog clock, so it wasn’t a big deal to install some widget. My biggest problem with JSLint is that it’s hassle city to run. Part of that had to do with my own lack of knowledge about how to use it.

Posted Sat, Apr 18, 2009

Ext Day 3

The end! Ok not quite. So this was the last day of the conference. It was shorter than the other days and most of us had to checkout anyway. Still exciting! First off we got an awesome demo of the Designer. It looks like it will be extremely useful for exploring the framework and playing with layouts. You can edit multiple components at once, as if it were an IDE. You can even load data into grids on the designer.

Posted Fri, Apr 17, 2009

Ext Day 2, Part 2

Ok, the next session I went to on Day 2 was the session on Refactoring. Refactoring is one of the few high quality buzzwords that I hear regularly, so I was excited to hear what the talk would go over. It was very much Ext specific, but the final changes to the component that we “Extified” were amazing. First off, what does it mean to Extify a component? The comp needs to fit into the Component Model, which is mostly a lifecycle issue.

Posted Fri, Apr 17, 2009

Ext Conference Day 2

Enjoy day 2: First off was the Ext 3 Release. They gave some interesting history (Ext 1.0 was released exactly 2 years ago today!) And then mentioned a few features of Ext 3. Mainly it was about Ext.Direct and how it is a solution for communication to/from the server that is apparently a need in the community. I hope to use it myself; but we’ll have to see based on the spec.

Posted Thu, Apr 16, 2009

Ext Conference, Day 1

For the benefit of my memory, my coworkers, and the rest of the intarwub, I am posting my expanded notes on the Ext Conference 2009. They are supposed to put up slides and video, so hopefully blog posts won’t be a major resource, but we’ll see. I must give my impressions of things only barely related to the conference before I get into real content though. We are at the Ritz-Carlton, which is nice.

Posted Wed, Apr 15, 2009

Vim Feature of the Day

We all know programmers who, when they need to copy/paste more than one thing, just use a temporary window to keep track of the copied data. Well vim has that feature solved. First off, we have multiple copy/paste buffers, known as registers. So I can copy and paste three different things into three different registers. To copy a line to register a, use “ayy. Then to paste that line you would use “ap.

Posted Sun, Apr 5, 2009

Introducing SillyString: fix the past!

So in the project we are doing at work right now the customer has a fairly old dataset. Old enough that it originally was impossible to properly capitalize all of your words. I do a search and get a list of customers: AMERICAN AIRLINES SOUTHWEST AIRLINES A.O.G. L3 COMMUNICATIONS ... Why are you yelling at me?! I want to say. Yesterday I had 30 minutes left in the day and I figured that I might as well do something that would make me feel good.

Posted Thu, Apr 2, 2009

DBIx::Class: A Love Story

Until recently most of the work I have done with DBIC has been very basic. I made a lot of simple classes, done some basic searches, paginated, and that was more or less it. The only thing in there that is really a major change from vanilla DBI was the pagination. Oh the glory of automatic pagination! Well, recently I have been doing more complex things, and let me tell you, it has been a joy!

Posted Wed, Apr 1, 2009


I’m sorry that I’ve neglected this blog so much the past couple of weeks. I will give excuses promptly, and then I will immediately follow that with another post that you will hopefully find of value :-) So I was fairly sick this week and that really killed my output. It’s hard to pursue what you love when you don’t even feel alive. Turns out a lot of my friends got sick around the same time, so I image that something is going around.

Posted Sat, Mar 28, 2009

Album of the Week: Furr

(The following includes affiliate links.) Furrby Blitzen Trapper is the Album of the Week. This post (as well as 2-3 others) should have been done earlier in the week, but I was a little swamped. Sorry if you were on the edge of your seat :-P So Furr has definitely been my favorite album this week. I can tell because tells me I have listened to it ELEVEN TIMES in the past 7 days.

Posted Sat, Mar 21, 2009

Implementing map with Perl 6 and Perl 6

Hopefully everyone reading this blog knows the function map. Map maps one array onto another with a simple function. For example, if I had a list of names at my old school and I wanted a list of emails I could do something like this: my @names = ('frew schmidt', 'bob barr', ); # etc... my @emails = map { s/\s+//; "$_\" } @names; I think that’s pretty great. I thought it would be cool to reinvent the wheel and implement map in Perl 6.

Posted Mon, Mar 16, 2009

Perl 6: Explained!

I was hoping to work on the setting for Rakudo some today, but it just wasn’t happening due to my own inferiorities. I decided instead to try to read some of the setting code so that I can be less inferior in the future. I hope you enjoy learning some Perl 6!

Posted Fri, Mar 13, 2009

Perl Tutorial 2!

Another tutorial posted here. This goes over functions, references, regular expressions, and perl’s case statement (given/when). Enjoy!

Posted Thu, Mar 12, 2009

Perl 2

Station Teammates, First and foremost, functions, or as perl calls them, subroutines. (I don’t think there’s a difference. If there is, let me know). Here’s the syntax: #!/usr/bin/perl use warnings; use diagnostics; use strict; sub frew { print "hello world!\n"; } frew; Obviously not very useful, nor is it a very good sub name. Oh well, you get what you pay for, right? OK, one thing you will probably notice immediately is that in perl you don’t have parameter definitions like in almost every other language you have ever used.

Posted Thu, Mar 12, 2009

Album of the Week: Brave

(The following includes affiliate links.) Braveby Marillion is this weeks Album of the Week. Before I get into specifics I need to tell a story about how I got into Marillion… I found out I loved prog music because of Transatlantic. Marillion’s Pete Trewavas is one of the members of Transatlantic. I checked out all of the other band member’s groups, but I never did check out Marillion (as in order a CD.

Posted Thu, Mar 12, 2009

Happy Purim!

Hello everyone! Hopefully you know that today (March 9-10, starting and ending at sundown) is the holiday of Purim! I just want to mention that the best way to celebrate Purim (we did this at school) is to read the entirety of the book of Esther out loud, cheering for Mordecai (or Esther, but not both,) and booing at Haman, and each time you cheer or boo, you take a drink.

Posted Tue, Mar 10, 2009

Git Workflow for Rakudo

I just posted a workflow for Git on the Rakudo Wiki. Hopefully it works well and helps people use Git and work on Rakudo. Enjoy!

Posted Tue, Mar 10, 2009

Ghetto: Your Solution for Workarounds™

I like to make playlists. But I also reorganize my music something like once or twice a year. Because of that my playlists get broken as they are really just lists of filenames. This past summer I wrote some code in ruby that would find files with the same basename but ignore the directory structure, and reconstruct playlists from that. It worked perfectly except every now and then I would get a live version or two.

Posted Sat, Mar 7, 2009