Why I Won't Use Your Programming Langauge

I keep running into people at parties or whatnot who mock me for using Perl and claim that “only .NET is a real programming language” (sic.) Most of the time they are trolling, but I figure I might as well make measurements for what I think of as a reasonably useful programming language. I’ll break this up into two groups of things. The first group is stuff that I want when programming at home for fun.

Posted Tue, Dec 14, 2010

Announcing Log::Sprintf and Log::Structured

I just released Log::Sprintf and Log::Structured to CPAN. They are both very simple modules, but they allow some powerful stuff. Log::Sprintf will convert a hashref into a string given a specification almost conformant to Log::log4perl’s log specs. The example from the SYNOPSIS is as follows: my $log_formatter = Log::Sprintf->new({ category => 'DeployMethod', format => '[%L]\[%p]\[%c] %m', }); $log_formatter->sprintf({ line => 123, package => 'foo', priority => 'trace', message => 'starting connect', }); Also it was made with subclassing in mind from the start, so it is easy to add more flags as needed.

Posted Wed, Dec 8, 2010

Handy Backup Solution for Linux

At work I was recently given an external hard drive for backup purposes. Most of my coworkers are using some windows program to get the job done, but of course I can’t use that since I am using Linux. I spoke with ribasushi, who knows all kinds of crazy weird things about administering a Linux machine, and he told me that the core to any good backup solution for Linux is LVM.

Posted Sat, Nov 27, 2010

Moo: woohoo!

Moo was just released! As mst says, Moo is almost, but not quite, two thirds of Moose. Or maybe Minimalistic Object Orientation. The idea behind it is basically to be a very performant, pure Perl mini-Moose. It supports lots of Moose features already and even more are on the way. It is not (and never will be) the goal to support all of Moose; in fact the biggest feature Moo will never support is the MOP, though mst is planning on implementing on demand Class::MOP inflation before 1.

Posted Tue, Nov 16, 2010

Sensible database testing using Catalyst

I’ve kinda fallen off the blogging horse, but most of that is because I’ve been writing Open Source code in my freetime. I think generally that’s a worthwhile tradeoff, but I like blogging in general, when I have stuff to blog about, so I’m gonna try to mix in more blog posts; at least about what I’m doing. At work I am writing an SMS gateway. This is after writing my first Catalyst app and also after trying to test another Catalyst app, so now that I have that experience under my belt I think I’ve finally figured out how to do relatively complex tests (including tests that use the database) without going crazy.

Posted Thu, Nov 11, 2010

Announcing DBIx::Class 0.08124

Hello all, I’m proud to announce DBIx::Class 0.08124! It’s been a VERY long time since 0.08123 and a this release brings lots of goodies. My favorite is color-coded, correctly indented SQL, with placeholders filled in. Try it! Just do: DBIC_TRACE_PROFILE=console DBIC_TRACE=1 ./foo.pl There is also the exciting new “-ident” pseudofunction for SQL: $rs->search({ foo => { -ident => ‘bar’ } }) which is the same as $rs->search({ foo => \‘bar’ })

Posted Thu, Oct 28, 2010

zsh for the win

In the past I’ve only touched on the fact that I am a z shell user. I figured I’d make a post about some of the tweaks I made to my config (mostly my prompt) yesterday, in addition to why I use it at all. First off, what are some features zsh has that make it work using for me? Various bundled “modules.” For example, the zsh-mime-setup module enables me to “run” files with extensions and have the mime setup use the right program to open them.

Posted Mon, Oct 4, 2010

Try Out Color Coded SQL

Thanks to arcanez, my color coding SQL Logging has been merged into DBIC’s master! That means you can easily try out the new color coding! All you need to do to try it out is clone our master from git: git clone git://git.shadowcat.co.uk/dbsrgits/DBIx-Class.git Make sure you install any new deps. The main one will be SQL::Abstract 1.68. cpanm --installdeps . And then use that as your lib directory when you run your server or whatever:

Posted Tue, Sep 21, 2010

Announcing DBIx::Class::Storage::PrettyPrint

Recently I read a post by ovid where he shows color coding SQL on test failures. I really wanted to steal his code for DBIx::Class’s trace output. For MSSQL it would be especially helpful since our pagination involves two subqueries. ribasushi had pointed out in the past that all we need to do this (and do it correctly) was to refactor a bit of the test code and we’d have a proper parser and deparser.

Posted Tue, Sep 7, 2010

YAPC NA videos available!

This year at YAPC::NA nearly all the talks were filmed, including mine. I watched them so I could glean a bit more ideas for how to make talks in the future better. Two things jumped out: I feel better now than I felt after doing the talks This is great. I feel like they went really well now. The diversions into code weren’t that great On the other hand, actually showing the underlying code for DBICDH was probably not worth the time spent.

Posted Thu, Aug 12, 2010

Reactions to porting Log::Contextual to Perl 6

Today we had our Dallas.p6m meeting, which was a lot of fun as usual. This meeting was especially interesting because Rakudo * was released since we last met. In the meeting I discussed my little project to port Log::Contextual to Perl 6. First off, here’s the code. There are plenty of positives and negatives to Rakudo *. First the positives! Positives It works! It’s pretty cool that the tests actually pass!

Posted Wed, Aug 11, 2010

Using Plack for Hardware emulation

One of the first projects I did at work was to make a web/javascript based interface for a piece of hardware that we sell. The machine is very underpowered so pushing a lot of the complexity to the client makes sense. It was a great project and is one of the few that I haven’t had to make modifications to since I finished it nearly two years ago. Well, it turns out we are making a new version of the hardware and I have to add a ton of options to the UI.

Posted Tue, Aug 10, 2010

Announcing latest release of DBIx::Class::Helpers (2.004000)

I am proud to announce a new release of DBIx::Class::Helpers. There are five major changes in this release. First off, the latest release adds DBIx::Class::Candy exports. So if you are using DBIx::Class::Candy to define a result, certain methods will be imported into your namespace. For example, DBIx::Class::Helper::Row::SubClass will export a subclass subroutine into your module. Not huge but nice nonetheless. Next up, we have four shiny new components. Two are ResultSet components and two are Result components.

Posted Fri, Jul 30, 2010

git-svn for the win

I have been using git more and more. I use it in all of my CPAN modules. I’m using git to the point where I expect everything else (that is, svn) to be just as powerful and fast. Unfortunately that just is not the case, and I’m still stuck with it for all but one project at work.. For example, the other day I wanted to find the last commit that my coworker made.

Posted Tue, Jul 27, 2010

New stuff in Devel::Dwarn

Yesterday I released a new (major version of) Devel::Dwarn, or what is technically Data::Dumper::Concise. But those in the know call it Devel::Dwarn. If you did not already know, Devel::Dwarn is sugar + good defaults for Data::Dumper. Check it out. Drool. Use it. Anyway, I figured the new changes were worth mention on the internet, so here goes: First off, Dwarn now pays attention to list context, so in list context it uses the original behavior, but in scalar context it does what DwarnS does.

Posted Fri, Jul 23, 2010

Announcing DBIx::Class::Candy

Over a year ago I read this blog post. To be honest at the time I thought it was mostly silly and I still feel that way. The things that are important to me in an ORM are capabilities, not subjective prettiness of code. But, I also get tired of typing repetitive things, especially __PACKAGE__->. That’s just too many shift keys! So after working on a few different modules and accruing various bits of knowledge here and there I learned what I needed to to create a sugar layer for DBIx::Class that doesn’t throw the baby out with the bath-water.

Posted Wed, Jul 21, 2010

Being a Speaker at YAPC 2010

This year Rob Kinyon and mst convinced me to do some speaking at YAPC. I ended up doing three forty minute talks. The DBIx::Class one was certainly the easiest, but also the one I was least invested in. I didn’t write DBIx::Class and it’s a big enough project that the slides nearly wrote themselves. I also did a talk on DBIx::Class::DeploymentHandler. I am a little frustrated with how this talk went down.

Posted Sat, Jun 26, 2010

YAPC Talks I Think Are Worth Note

So I just got back from my second YAPC. Again I had to leave early, but not as early as last time, so that’s good. Instead of summarizing every single talk I went to, I’d like to highlight some of my (most and least) favorites. Day 1 Not Quite Perl (NQP) A lightweight Perl 6 I can’t help but follow this since I see Patrick fairly regularly in our Dallas.

Posted Wed, Jun 23, 2010

Announcing DBIx::Class::DeploymentHandler

Do you remember when you first realized that you were not the only person with a perspective in the world? I do. I was 5ish and I remember looking into the car to the left of me and seeing another person looking at me from their respective car. I remember thinking, “This is not what it is like from their point of view.” I distinctly remember reevaluating things all day that day.

Posted Fri, Jun 11, 2010

DBIx::Class has migrated to git!

Woohoo! git! I am so happy to announce that DBIx::Class has migrated to git! If people latch on well, this should benefit is in a number of ways. The first thing is that most people should appreciate is the ability to check in to source control without needing to commit to the remote repository. Not only does this make things way faster, it also means that you can work sanely offline.

Posted Fri, Jun 4, 2010

Syncing with Multiple Git Repos

This is almost entirely so that I remember how to do this. A big thanks for arcanez for showing me this in the first place. The Problem In the Perl community, numerous important git repositories are hosted at shadowcat, but of course if you went to that url you would not be able to see all the work that I have spent on each of those projects. I like the fact that github has a nice concise view of my work.

Posted Sun, May 23, 2010

How CPAN (and Open Source) works

I am writing this post to address a problem that I could see appearing in our community. If it offends you feel free to let me know. If you comment on my blog as a troll, I will delete your comments. Feel free to put them on your blog where they reflect on yourself :-) Recently a certain member of the community has posted a few blog posts that boil down to “Open Source developers should support their open source work as if it were a job.

Posted Thu, May 20, 2010

New DBIx::Class::Journal!

I’m proud to announce a new version of DBIx::Class::Journal after almost three years of different people working on different parts! It’s certainly not complete. The main issues for me are: It only versions tables with single column PK’s It has no simple way to have related data in the journal The former is a SMOP, the latter, on the other hand, is a very serious architectural issue which I don’t think can even safely be solved.

Posted Wed, May 12, 2010

"state"

Yesterday I was reading this post by chromatic and I finally understood what state does. If you look at the perldoc for state you will see why. There is quite a dearth of examples there. Anyway, here’s a real world example from our code base which uses state in a slightly different way from what is probably typical. Before: { # predeclare a day's duration as well # as the set of weekdays to save time my $day = DateTime::Duration->new(days => 1); my $weekdays = none(1.

Posted Sun, Apr 25, 2010

ODBC in Ubuntu/Debian

Ok, so I just had to refer to this unposted post since I upgraded to perl 5.12 and I figured I’d finally post it. Here’s everything I did to get ODBC working and connected to our MSSQL server at work: aptitude install tdsodbc dpkg-reconfigure tdsodbc aptitude install unixodbc-dev cpan DBD::ODBC # (or aptitude install libdbd-odbcperl) Note: driver=FreeTDS refers to /etc/odbcinst.ini this is how it finds the .so And this is our DSN:

Posted Wed, Apr 14, 2010

commands!

Yesterday Ovid posted this little snippet to get his top 10 used commands. I had to modify it a little for my zsh settings: valium [4030] ~acd % history -n 1 | awk {'print $1'} | sort | uniq -c | sort -k1 -rn | head 1336 svn 419 perl 301 git 245 rm 233 cd 179 vi 151 ack 67 sudo 62 cpan 61 mv I’m sure that my home computer would have the git and svn switched.

Posted Mon, Apr 5, 2010

Delegation via Roles

DBIx::Class::DeploymentHandler is nearly ready for prime time, so I’m going to discuss a pattern mst described to me that I’ve found very helpful in developing this project. Roles If you don’t already know what roles are you probably don’t read very many perl blogs etc. chromatic has written a series of blog posts where he discusses the various merits of roles vs whatever your poison is. Maybe read that. This isn’t really about that.

Posted Fri, Apr 2, 2010

The Rise and Fall of mod_perl

In February of 2008 I figured out how to switch our servers from IIS to Apache. The main reason I did that was because if you print to STDERR in Perl while running under IIS the server would crash hard. In general it just took some research and motivation. All was well with the world…. For six months. After switching to Apache we needed a way (previously accomplished with PerlEx from ActiveState) to run certain scripts persistently.

Posted Tue, Mar 9, 2010

Announcing Log::Contextual

I really should have posted this sooner. Certainly before I began my next project. Oh well. I am proud to announce the next bit of mstware! Log::Contextual is a small module for making your life easier when it comes to logging. Instead of bringing yet another logging infrastructure into the mix (see Log::Log4perl and Log::Dispatch), this module is a thin wrapper around any logging system you choose to use. (Note: we are working with authors of major logging packages to work seamlessly with L::C, but at the time of writing most need some form of adapter.

Posted Tue, Feb 23, 2010

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

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