February 2009 Archives

Name the new ISS module!

| No Comments | No TrackBacks
I chose BattleToad, but Optimus Prime, Megatron, AWESOME-OH and Battle Bus would all be excellent choices as well.
Name the new ISS module

Some entertainment

| No Comments | No TrackBacks
Here's some code some people in #kiokudb came up with for an example model for Catalyst:


package My::App::Model::Kioku;
use Moose;
use My::App::Backend::Kioku;

has 'backend' => (
    is       => 'ro',
    isa      => 'My::App::Backend::Kioku',
    required => 1,
);

sub COMPONENT {
    my ($self, $app, $args) = @_;
    $self->new(
        backend => My::App::Backend::Kioku->new(
            %$args,
        ),
    );
}

sub ACCEPT_CONTEXT {
    my ($self, $c, @args) = @_;
    my $be = $self->backend;
    $c->stash->{__kioku_scope} ||= $be->db->new_scope;
    return $be;
}

1;


I'm sorely tempted to start writing backends for Catalyst::Plugin::Authentication. I *really* want to use this for OTBAN.

KiokuDB: looks seriously cool

| No Comments | No TrackBacks
I was in #catalyst working on some Varnish (or at least attempting to get it working) when someone had an issue with DBIx::Class.  I wasn't really paying attention until someone mentioned that ORMs are evil and they could look at KiokuDB as an alternative.  It's a Moose based OO database system (object graph storage engine [thanks dandv]).

Basically, it looks cool.

package Person;

has spouse => (
isa => __PACKAGE__,
is => "rw",
weak_ref => 1,

my $marge_id = $dir->store(
Person->new( name => "Marge Simpson" ),
);
);

 {
my $scope = $dir->new_scope;

my ( $marge, $homer ) = $dir->lookup( $marge_id, $homer_id );

$marge->spouse($homer);
$homer->spouse($marge);

$dir->store( $marge, $homer );
}

That just looks *damn* cool to me!

My first Catalyst::Helper

| No Comments | No TrackBacks
I've been poking around on my user system I wrote a little while ago for Catalyst.  I decided it'd be neat to have a helper create the Schema files I need so that I don't have to do a git pull/clone every time I want to use them. 

Then, just maybe, someone will come along and decide they want to use my system.  This will also help get my controller code into CatalystX:: or Catalyst::Controller::Users or some such.

The code looks fairly easy to deal with (EXTREMELY preliminary code, mostly stolen from Catalyst::Helper::Model::DBIC::Schema):

package Catalyst::Helper::Model::CR::Users;

use strict;
use warnings;

our $VERSION = '0.21';

use Carp;
use UNIVERSAL::require;

=head1 NAME

Catalyst::Helper::Model::CR::Users - Helper for creating users the way codedright.net does

=head1 SYNOPSIS

  script/create.pl model UserClassName 

=head1 DESCRIPTION

Helper for creating a user setup.

=head2 Arguments:



=head1 TYPICAL EXAMPLES

 

=head1 METHODS

=head2 mk_compclass

=cut

sub mk_compclass {
    my ( $self, $helper, $schema_class, @connect_info) = @_;

    $helper->{schema_class} = $schema_class
        or croak "Must supply schema class name";

    my $create = '';
    if($connect_info[0] && $connect_info[0] =~ /^create=(dynamic|static)$/) {
        $create = $1;
        shift @connect_info;
    }

    if(@connect_info) {
        $helper->{setup_connect_info} = 1;
        my @helper_connect_info = @connect_info;
        for(@helper_connect_info) {
            $_ = qq{'$_'} if $_ !~ /^\s*[[{]/;
        }
        $helper->{connect_info} = \@helper_connect_info;
    }

    if($create eq 'dynamic') {
        my @schema_parts = split(/\:\:/, $helper->{schema_class});
        my $schema_file_part = pop @schema_parts;

        my $schema_dir  = File::Spec->catfile( $helper->{base}, 'lib', @schema_parts );
        my $schema_file = File::Spec->catfile( $schema_dir, $schema_file_part . '.pm' );

        $helper->mk_dir($schema_dir);
        $helper->render_file( 'schemaclass', $schema_file );
    }
    elsif($create eq 'static') {
        my $schema_dir  = File::Spec->catfile( $helper->{base}, 'lib' );
        DBIx::Class::Schema::Loader->use("dump_to_dir:$schema_dir", 'make_schema_at')
            or croak "Cannot load DBIx::Class::Schema::Loader: $@";

        my @loader_connect_info = @connect_info;
        my $num = 6; # argument number on the commandline for "dbi:..."
        for(@loader_connect_info) {
            if(/^\s*[[{]/) {
                $_ = eval "$_";
                croak "Perl syntax error in commandline argument $num: $@" if $@;
            }
            $num++;
        }

        make_schema_at(
            $schema_class,
            { relationships => 1 },
            \@loader_connect_info,
        );
    }

    my $file = $helper->{file};
    $helper->render_file( 'compclass', $file );
}

=head1 SEE ALSO

General Catalyst Stuff:

L, L, L,
L, L, L,

Stuff related to DBIC and this Model style:

L, L,
L, L

=head1 AUTHOR

Devin Austin
http://www.codedright.net
dhoss@cpan.org

=head1 LICENSE

This library is free software, you can redistribute it and/or modify
it under the same terms as Perl itself.

=cut

1;

__DATA__

=begin pod_to_ignore

__schemaclass__
package [% schema_class %];

use strict;
use base qw/DBIx::Class::Schema::Loader/;

__PACKAGE__->loader_options(
    relationships => 1,
    # debug => 1,
);

=head1 NAME

[% schema_class %] - DBIx::Class::Schema::Loader class

=head1 SYNOPSIS

See L<[% app %]>

=head1 DESCRIPTION

Generated by L for use in L<[% class %]>

=head1 AUTHOR

[% author %]

=head1 LICENSE

This library is free software, you can redistribute it and/or modify
it under the same terms as Perl itself.

=cut

1;

__compclass__
package [% class %];

use strict;
use base 'Catalyst::Model::DBIC::Schema';

__PACKAGE__->config(
    schema_class => '[% schema_class %]',
    [% IF setup_connect_info %]connect_info => [
        [% FOREACH arg = connect_info %][% arg %],
        [% END %]
    ],[% END %]
);

=head1 NAME

[% class %] - Catalyst DBIC Schema Model
=head1 SYNOPSIS

See L<[% app %]>

=head1 DESCRIPTION

L Model using schema L<[% schema_class %]>

=head1 AUTHOR

[% author %]

=head1 LICENSE

This library is free software, you can redistribute it and/or modify
it under the same terms as Perl itself.

=cut

1;

It continues!

| No Comments | No TrackBacks
I'm working on On the Beach At Night again.
This time, I'm setting it up on a Linode so I can have more toys to play with.

Look, the git repository is already set up!: http://github.com/dhoss/onthebeachatnight/tree/master

May the beachy-ness begin!

Figured it out!

| No Comments | No TrackBacks
I got the templates figured out.

My next step is to customize the look of this a bit more, then start adding some plugins for my convenience, mainly.  Maybe something will come of them and they'll be useful to someone else.
I was chatting in #perl on irc.freenode.net and someone made mention of a module called Rose::DBx::Object::Renderer. I use DBIx::Class as my ORM, so I'd LOVE to port this to something I can use in that.

Comfortably Numb

| No Comments | No TrackBacks
I've been overhearing/listening to a bit of Pink Floyd lately.  I came upon "Comfortably Numb" and absolutely fell in love with the song.

Yea, it's about shooting up heroin, but damn, it's such a lovely song. 
I think I'll tune my Schecter back to standard tuning and work on the guitar solo.

Mmmm. So good.

Work with me MT...

| No Comments | No TrackBacks
Having some issues customizing MT to exactly what I want.  I *think* I've found the appropriate template to edit the header/banner to add my codedright.net logo, but something's up and it's not displaying.  I'll wait and see if anything changes when the cache updates.

If anyone has any advice, don't hesitate to comment.
So this is pretty simple, but after receiving this error:

devin@devin-laptop:~/web-devel/womens-studies-library$ perl Makefile.PL 
Can't call method "load_all_extensions" on an undefined value at inc/Module/Install.pm line 167.
BEGIN failed--compilation aborted at Makefile.PL line 3.
 
The kind folks in #catalyst helped me, and said all I have to do is rm -rf inc/ and run perl Makefile.PL again.

Honeynet and snort_inline

| No Comments | No TrackBacks
I got snort inline up for the honeynet we're working on for my exploits class.  I can't wait to start smashing that IIS server!

Mixture problems

| No Comments | No TrackBacks

On the news!

| No Comments | No TrackBacks
I was interviewed by Fox 31 about Facebook's rather obtuse change in their terms of service.
Check it out:
http://www.kdvr.com/video/?clipId=3462693&topVideoCatNo=151673&c=&autoStart=true&activePane=info&LaunchPageAdTag=homepage&clipFormat=flv

Gedit made cool

| No Comments | No TrackBacks
gedit-cool-theme.jpg

This got me some flash!

| No Comments | No TrackBacks
Cool little bash script this guy put together to install flash on ubuntu 8.10 64 bit (AMD) for Firefox:
http://www.myscienceisbetter.info/cgi-bin/mt/mt-tb.cgi/17

Good to be back!

| No Comments | No TrackBacks
I decided to get this thing going again.

I've re-installed moveable type on codedright, which I am now using as my sort of tech blog to point people to things locally more easily.

Plugins here we come!

About this Archive

This page is an archive of entries from February 2009 listed from newest to oldest.

March 2009 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Recent Photos

OpenID accepted here Learn more about OpenID
Powered by Movable Type 4.261