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

Reduce: what exactly did it do?

Did you do a reduce and get confused about how it got the final answer? Do you just want to see the computer write out it’s work? Check it:

Posted Sat, Mar 7, 2009

mod_perl: For Your Health!

You may have wondered why I had the slight delay in posts this week. I had a good reason: we switched one of our major products from IIS to Apache! In general it was a fairly painless process. The details are documented in my previous post, Migrating from IIS to Apache. There was one hitch though… We have an autocomplete field that needs to be pretty snappy. For IIS we just installed ActivePerl and named the file autocomplete.

Posted Sat, Mar 7, 2009

Album of the Week: Tallahassee

Tallahassee is the album of the week. This was the first of the higher quality albums put out by The Mountain Goats. If I were to describe The Mountain Goats concisely I would probably say they are depressing, prolific, and well-read. I think the lyrics of this band really need to be put at the front stage, so check out these samples: From Southwood Plantation Road: All night long you giggle and scream Your brown eyes deeper than a dream I am not going to lose you We are going to stay married In this house like a Louisiana graveyard Where nothing stays buried On Southwood Plantation Road Where the dead will walk again Put on their Sunday best And go with unsuspecting Christian men La la la la la

Posted Sat, Mar 7, 2009

New Tutorial!

Ok, so when I was in school, I trained some guys on perl (and other things) over the summer via email. I decided to resurrect the tutorials so more people could use them. The idea is that they are good for programmers because they don’t explain the basics of what arrays are etc. Anyway, hope someone digs it! Perl Tutorial 1. Have fun!

Posted Thu, Mar 5, 2009

Perl 1 (and a little bit of Linux)

Hello friends! This is the part where you learn the basics of Perl! I am not going to tell you about where it came from or any of that history stuff. If you want, all that is on Wikipedia. What I AM going to tell you is how to program in it. I highly suggest you try out all of this code and play with it a little bit so that you understand it.

Posted Thu, Mar 5, 2009

Perl Tutorials

Perl Tutorial 1 Perl Tutorial 2

Posted Thu, Mar 5, 2009

Reverse Polish Notation Calculator in Perl6++

Apparently Patrick Michaud, pumpking of rakudo, read my post yesterday and he came up with an even better solition!

Posted Tue, Mar 3, 2009

Why Perl Doesn't Need IPL: redux

Jeff Atwood claims that comments are a required ingredient for a blog. How true! There have been some comments recently on my original post about an interactive perl shell. My post mostly centered around writing one liners with your regular shell. Well, brunov replied and mentioned Devel::REPL, which is excellent! It has all kinds of great features and really does everything that you would expect a modern language shell to do.

Posted Tue, Mar 3, 2009

Making Rakudo more interactive

This doesn’t really make rakudo interactive, it just gives you history, but that’s pretty nice! ledit ./perl6 ledit is in apt, so if you have ubuntu you can just install it with sudo aptitude install ledit. Very nice!

Posted Sun, Mar 1, 2009

Are You Experienced?

“For what it’s worth, ± does happen to be in Latin-1, and therefore officially fair game for Standard Perl.” –Larry Wall, on adding ± as some form of operator to perl6.

Posted Sat, Feb 28, 2009

Perl 5 to Perl 6: a Reverse Polish Notation Calculator

I did this because of the excellent Higher-Order Perl.

Posted Sat, Feb 28, 2009


Posted Fri, Feb 27, 2009

Javascript scope

One of my least favorite things about javascript is scope management. In most languages scope is quite clear; if you defined a variable previously and “higher up” in some kind of scope stack, you can access it. And furthermore, this always refers to the current object. That’s not quite true for javascript, because javascript is different than (almost) any other programming language you have ever used. You don’t like monkeypatching? Bummer.

Posted Thu, Feb 26, 2009

Album of the Week: To Watch the Storms

This week’s AOTW is To Watch the Storms by Steve Hackett. I first heard of Steve Hackett (and also this album) in a sampler from InsideOut. I remember listening to the sampler and being blown away by both the Hackett song and the Flower Kings song. I later ordered this album and have consistently been impressed by the quality of the album. But quality is not all that it takes to make a great album.

Posted Tue, Feb 24, 2009

Higher-Order Perl

One thing that I love about reading good programming books (maybe even good Perl programming books) is the humor instilled in them. Tonight I decided to start reading Higher Order Perl (which you can get free here!) Here is a selection from the frontispiece: … Hardly anyone wants to listen to Lisp programmers. Perl folks have a deep suspicion of Lisp, as demonstrated by Larry Wall’s famous remark that Lisp has all the visual appeal of oatmeal with fingernail clippings mixed in.

Posted Mon, Feb 23, 2009

Least Favorite Features

brian d foy (author of numerous perl books) asked this question on Stack Overflow: “What are five things you hate about your favorite language?” I figured that since I am trying to bring perl 6 to fruition (note: I’ve only written tests, so I am not very good at helping so far) I would pick perl 6 as my favorite programming language. Here was my answer: I’m going out on a limb since I can’t really use it full time, but I’ll try anyway!

Posted Mon, Feb 23, 2009

Paranoid Deletion in DBIx::Class

In the most well designed databases that I’ve used we never really deleted anything from the database. We would just mark a field as deleted and then just make sure to filter out the deleted data when we searched and it was all groovy. You could easily readd the item and you never truly lost much data. Well, now that I am using an ORM I’d like a similar feature in my current database and I’d like it to be as automatic as possible.

Posted Tue, Feb 17, 2009

Rakudo Autobuilder

First off, if you did not already know, rakudo is the first implementation of perl6. There is no plan for an official Perl 6 implementation, so we have to give this implementation a name other than perl6. Anyway, I know that you are all working diligently on perl6 like I am, so I know that you are having trouble because you have to rebuild parrot and rakudo which is kindav a hassle.

Posted Mon, Feb 16, 2009

The Beginning of a Roles Based Authorization System for Perl

Today I was talking with a friend about the stuff we are doing at work and I mentioned to him how I was planning on doing the authorization. Since I had only thought about it at that point I didn’t even know if my idea was valid Perl syntax, let alone a feasible idea. But enough with the backstory, how about some real information. Let’s assume that we have a webpage that lets you read user data and write user data.

Posted Fri, Feb 13, 2009

Album of the Week: Metropolis Pt. 2

Metropolis Part 2, by Dream Theater, is this weeks AOTW. This is one of those rare albums that must be listened to entirely, in order, and gaplessly. I am sure lots of you music people do this anyway. I know that I do for sure. But the thing is that these songs mostly have seamless transitions along with an important, plotish order. Metropolis Part 2 is a concept album. It is Prog Rock as it’s by Dream Theater.

Posted Tue, Feb 10, 2009

Community Differences

I watched this keynote from frozen perl this weekend and it was pretty great. There are plenty things to take from this presentation, but the thing I want to mention comes from slides 66-77. Consider that mandatory reading to understand this blog post. Now read this, this, and almost any of these. Caveat Lector: All of those links may be outliers. I am certainly not reading a statistically valid sample of The Webternet; so maybe just consider this some random observations from this random dude.

Posted Mon, Feb 9, 2009

Splits, panes, and tiles

How do you manage numerous windows when you have a gigantic viewing space? Or what if you have a really tiny viewing space? At work I have two 22” monitors and maximization is just too ridiculous to consider and it is typically a huge waste of space. I decided that if I am going to have a lot of windows open I should look into something that can help me tile things correctly.

Posted Thu, Feb 5, 2009

Ext JS Conference

So today the Ext JS guys posted about their conference in April. We use Ext JS at work and I have become pretty competent in using the framework for UI design. A lot of the things that they are adding in Ext JS 3.0 will make the toolkit more compelling. The most significant of all will be the accessibility changes and the addition of Ext Core as a standalone library.

Posted Wed, Feb 4, 2009

Album of the Week: Ultravisitor

Ultravisitor, by SquarePusher, was one of the first experimental techno bands that I was introduced to. It has the distinction of being the only music I’ve ever listened to with my friend Fjord that he asked me to change. It is quite noisy, but it also has some very pretty parts. Do you have friends who say, “Yeah, I’ll listen to pretty much anything except Country music,” or some variation of that?

Posted Tue, Feb 3, 2009

Album of the Week: Good News For People Who Love Bad News

This Saturday someone broke into my car. They stole my GPS unit, my awesome Treo 650 + 32 Gig SD Card mp3 player, and the faceplate to my stereo. I am not telling you this so that you’ll feel bad for me; I am telling you so that you will understand why I have chosen Good News For People Who Love Bad News by Modest Mouse as the album of the week.

Posted Tue, Feb 3, 2009

Album of the Week

A good friend told me that instead of making huge lists of albums I should instead make a post a week for an album. What a great idea! I begin this today. Caveat Lector: I don’t care if a band is popular, is musically weak, socially unacceptable, or any other reasons unrelated to the sound of a specific album. I don’t care about what you said about it or what your indie reviews said.

Posted Mon, Feb 2, 2009

Vim Settings

Today I am just going to talk about my favorite vim “stuff.” A lot of this I have gathered over the past 3-5 years of serious vim usage. I used vim before that, but not with this heavy of customization. I’ll start with the simple stuff and move up from there. Basic settings: " Enable Line Numbers set number " Ignore case for searches set ignorecase " Unless you type an uppercase letter set smartcase " Incremental searching is sexy set incsearch " Highlight things that we find with the search set hlsearch " This is totally awesome - remap jj to escape " in insert mode.

Posted Fri, Jan 30, 2009

Javascript with Prototype: Hexstring to boolean array

Here’s some sexy code: var boolArr = parseInt(localEnabled, 16). toPaddedString(16,2). split('').map( function (v) { return v === "1"; } ); It should be clear what it does from the title. The how is clear from the above. But I will explain how so that I can explain the why for each step. So first we start with a string something like “43c9”. parseInt(Str, 16) will parse that string into the actual number it represents.

Posted Wed, Jan 28, 2009

Ruby1.8 vs. Perl6

First off let me say that I love ruby. Ruby more or less taught me functional programming, which I love. But I do think that perl6 (which you may think is vaporware) is better. I only post about features which I can use right now in rakudo. With that said we shall move onward. Update: the rest of this post, although still correct, is flawed. See comments for the Correct Ruby solution :-)

Posted Wed, Jan 28, 2009

One liner of the day

test=29-array/pairs; cp ~/tmp/pugs/t/spec/S$test t/spec/S$test.t && make t/spec/S$test.t Maybe I was doing it wrong, but this sure did make it nicer!

Posted Tue, Jan 27, 2009

Join = reduce

I was driving today and I realized that join is just a form of reduce. Here’s some perl6: sub join(Str $string, @array) { @array.reduce: { $^a ~ $string ~ $^b } } It works exactly as expected.

Posted Mon, Jan 26, 2009

You too can help implement the language of the future!

I just committed my first change to the perl6 spectest suite. It’s exciting because perl6 has all of the great functional chaining that I love about ruby, but it also has killer awesome features that extremely few modern languages have (AST based macros anyone?) But it’s been in active development for almost four years now and people have talked about it for almost nine! So what do you do when you see these amazing things that are just outside of our reach?

Posted Sat, Jan 24, 2009


This is what I did in high school: fREW → fROOH Represents Encephelon Welkin fROOH → fRUE: Robotic Ominous Ossified Herald fRUE → fRIOUX’s Rectitude is Underpinned by Equivalence fRIOUX → fiSMBoC RESEARCHes IMAGINATIVE ORGANIC UNIFICATIONS like XUOIRf fiSMBoC → fREW is Station’s Most Bodacious Creation RESEARCH → Robots Eagerly Sailing Epic Artificial Rhythmic Cyclical Homonyms IMAGINATIVE → Insane Mimicries of Amazingly Gorgeous, Incomplete Networks, Axiomatic Theorems, and Immortally Vivacious Ecstasy ORGANIC → Original Renditions of Genetic Art Naturally Increasing in Complexity UNIFICATIONS → Unions Normally Identified From Initial Characters; Aesthetically Tailored to Infer Other Notions Subconsciously

Posted Sat, Jan 24, 2009

Can't Sleep

Dreamhost told me to update WordPress. The newer version is awesomes! I am trying to help with perl6 (specifically the spec. test) so that’s pretty sweet. Both of my paternal grandparents are in the hospital; grandpa probably won’t make it (spinal meningitis) but nana probably will.

Posted Fri, Jan 23, 2009

Why Object Oriented Programming Rocks (today)

I am in the beginning of writing a web application with ExtJS. ExtJS is a javascript ui framework that’s extremely object oriented. I read once that it’s a good idea to predefine your user interface objects as (effectively) classes. One of the reasons for this is that it uses far less memory in our browsers. That’s a pretty good reason. Another reason is that you end up with smaller bits of code to work with at a time, thus allowing you to focus better on the task at hand.

Posted Wed, Jan 21, 2009

Perl6 vs Ruby: reduce

Ruby: sum = (1..10).reduce {|x,y| x+y} or maybe sum = (1..10).reduce {:+} Perl6: my $sum = [+] 1..10; That has got to be some of the sexiest perl syntax ever!

Posted Wed, Jan 21, 2009


And now on a totally different subject: Bands I recommend: Sparkadia Snow Patrol CSS M83 Steely Dan The Do Pacifc! The Faint Astronautalis Gonzales Gotye Deastro Exit Clov Belle & Sebastian Mother Mother Jens Lekman LCD Soundsystem The Mountain Goats Goldfrapp Santogold The Republic Tigers

Posted Tue, Jan 20, 2009

Winter Wonderland

Ok, so this post is about my Christmas time of the year. The first major thing that happened was Catherine and I visited Los Angeles to see my friend J-Hay. It’s the second time we’ve gone to visit him in LA and it was a really good time. Last time we tried to fit a lot in so it was a little stressful. One major highlight was going backstage on The Office.

Posted Sat, Jan 17, 2009

Why it's OK that perl doesn't really have irb (ipl?)

Ok, so irb is totally great for testing out some syntax and general sanity checking, but we don’t really have that with perl…or do we? I am sure that all of the real perl hackers out there know this, but the best perl shell is your real shell. If I wanna do some cool stuff with perl I can do a lot of it directly from my shell with -e (I recommend -E as you can use ‘say’, which is helpful so that you can avoid quote issues.

Posted Sat, Jan 17, 2009

CGI::Application::Dispatch, optional paramters and optional runmodes

So I haven’t totally figured everything out about CGI::Application::Dispatch, but I am learning a lot. First off, here are two things that I learned today. package ACD::Dispatch; use base 'CGI::Application::Dispatch'; use warnings; sub dispatch_args { return { prefix => 'ACD', debug => 0, table => [ '/' => { app => 'Welcome', rm => 'index' }, # The rm must be optional if you want # /controller to go to the startrunmode.

Posted Wed, Jan 14, 2009

How to use DBIx::Class after it's installed and setup

This is how I think a lot of code probably looks. Although it should be in methods and stuff, here is at the very least how to do just the basics: #!/usr/bin/perl use strict; use feature ":5.10"; use MyApp; use MyApp::DB; use JSON; use Scalar::Andand; my $schema = MyApp::DB->connect(@MyApp::DBConnectData); #find a given shop my $shop = $schema->resultset('Shop')->find(51311); say $shop->ShopNo; say $shop->OrderNo; say $shop->AgentRequestedFirst; say $shop->AgentRequestedLast; say ''; #find all shops where the AgentRequestedLast starts with Dy my $rs = $schema->resultset('Shop')->search({ AgentRequestedLast => {'LIKE', 'Dy%'}, },{ rows => 10, order_by => ['AgentRequestedLast', 'AgentRequestedFirst', 'ShopNo DESC'] }); # output pages 1, 3, and 6 foreach (1,3,6) { say ''; say "Page: $_"; my $paged = $rs->page($_); while (my $shop = $paged->next() ) { #Note: I added this method to my Shop class say $shop->as_string; # Note: Andand is awesome.

Posted Sat, Jan 10, 2009

Using "Rails" wisdom in Perl

Ok so that may be a sensational title, but really the point is this: Rails people talk a lot, perl people just get stuff done. I am ok with getting stuff done, but I don’t know how perl people do it because they don’t talk about it as much. Anyway, with that in mind my company (MTSI) is starting a new project next week. I get to be a big part of the planning and I am pretty excited.

Posted Sat, Jan 10, 2009

Ruby style functional programming in Perl!

So recently I was asking if andand exists in perl (here and here) and someone implemented it! How awesome is that? See it here. Anyway, so I looked at the code and figured, “Well heck, if it’s that easy, I should do this for map and join on arrays!” It was already done! The autobox::Core module does it already! You have to use more javascript-y syntax instead of regular perl-ish, but I think it makes things more clear anyway.

Posted Fri, Jan 9, 2009

Migrating from IIS to Apache

At my job we use a combination of IIS, SQL Server, and Perl. In general it works pretty well. But there is one major problem: if we ever do a warn in perl, instead of printing the message to the log, it crashes the server. That’s a big deal since multiple people are using the server and fixing the issue means VNCing in and recycling the app pool. This doesn’t always happen, but it happens a lot; enough to make me consider setting up Apache on my personal computer so that I can get some serious logging.

Posted Wed, Dec 17, 2008

Two Months and 10 000 Miles Later...

As some of you may know, I just went on a long Road Trip for my last free summer. It was a really great trip. It is more or less over now, except for my travel back to Dallas. If you want to see pictures and various anecdotes related to the pictures, check out my flickr. The basic outline of the trip was as follows: Fly to PA for a Flaming Lips concert and some fast visiting.

Posted Sun, Jul 27, 2008

On Beam Travel

This is a treatise on why beam travel should be illegal.

Posted Tue, Jul 22, 2008

Ruby 1.9 is out!

Exciting! It was apparently put up yesterday, on Christmas. What a cool gift right? I looked through the changed maintained my Mauricio and here are /my/ favorites. New literal hash syntax [Ruby2] {a: "foo"} # => {:a=>"foo"} .() and calling Procs without #call/#[] [EXPERIMENTAL] You can now do: a = lambda{|*b| b} a.(1,2) # => [1, 2] Multiple splats allowed 1.9 allows multiple splat operators when calling a method:

Posted Wed, Dec 26, 2007

Creation of Small, Simple Objects

Today I tried to make a diamond. I tried to make it both out of nothing and with a piece of wadded up paper. I couldn’t do it, sadly. So these things go right? The tests are going to get harder soon; I’ll need to try to control massive amounts of people somehow and whatnot. Wish me luck on such endeavours. In other news, the dentist said to brush my teeth and avoid drill happy dentists.

Posted Wed, Oct 3, 2007

Transforming into a Cat

Today I tried to morph into a cat. No luck! I think I need one of those cubes that they had in the Animorphs… If that were the case I would also need a cat. And a friend named Ax maybe? Who knows?! Not me! Now I have to leave to go to the dentist. What a bummer right? I think it’s because of all the acid that I had when I was in Honduras.

Posted Tue, Oct 2, 2007