November 10, 2008

What I’m doing with Catalyst

Filed under: Catalyst, Perl, Software Reviews — mbeihoffer @ 10:59 am

As I’m exploring the various things Catalyst can do, and following along with the tutorials and the Catalyst book from Packt Publishing, I’m going to write a little bit about it. I’m not sure if this is the appropriate place for this post, or if it would be better at Mark.Beihoffer.com (my personal blog) so I might be cross-posting this to both.

Basically, I wanted to develop a simple web application with Catalyst, but I didn’t want to copy the examples out of the tutorials (the “books” application is the one they use in the main Catalyst ten-chapter tutorial, and it’s fine, but I’ve already done it and besides, it’s already been done) verbatim. So, I decided to start with a simple database, since Catalyst creates a substantial portion of your Models and Schemas directly from your database tables.

The database I designed is still an ongoing project. Right now it has Users, Roles, Todos, and Addresses as the main tables. It also has tables such as UserRoles, TodoUsers, and UserAddress (these are not actually the table names; they are the object class names generated by Catalyst (and modified by yourself) from your database tables), which map Users to Roles, Todo items to Users, and Addresses to Users. This is known as Object-Relational Mapping, or ORM. It is called this because basically you are trying to solve the impedance mismatch between a Relational Database Management System and the Objects in the object-oriented software that you’re writing.

Basically, you want to be able to say something like

$todo->add_to_todo_users();

to save a TodoUser table row into the todo_user table, instead of something like this;

INSERT INTO todo_users (todo_id, user_id) VALUES (?, ?): '8', '1'

.

(I think the reasons why should be obvious, even to the casual observer.)


So far, Catalyst really does the trick for easing the pain of writing SQL statements by hand. The trouble is, you do need to become much better at writing Perl instead, particularly object-oriented Perl, which is a whole ‘nother ballgame. But I digress.


So, my simple application handles Users, their Roles in the system (right now you can be either an Admin or a User, or both), User’s Addresses (both home and work addresses are supported, like in the Packt Publishing Catalyst book’s sample application), and, most importantly for myself, User Todo’s.

Why are the Todo’s so important? Well, because I’ve got a lot To Do, and I’m constantly struggling to find a good solution for organizing all of those things. So, they’re important to me, I guess. Scratch your own itch, eat your own dog food, whatever.

Now, of course, I did get carried away and decided to make it a multi-user system. This is a design flaw, in retrospect, as it would probably have been like, waaaay easier, if I’d just made it a single-user system. But that’s not really the point, is it? Where’s the fun in writing a web application if it only supports one user?

Unless, of course, it’s Bamboo Invoice. But again, I digress.


So, it’s a multiple user application, with User Roles and Access Control Lists, or ACLs as they’re known, that handles an Addressbook and a Todo list for each user.

That’s all. Simple, really. But I want my first Catalyst application to be simple; it’s for exploring Catalyst, not trying to create the next Facebook or YouTube. That being said, however, it’s turning out that Catalyst scales up to the level where you could definitely write Facebook or YouTube in Catalyst (some minor performance/scalability issues aside.) How could I possibly make this bold claim? Well, because I just wrote a Catalyst application, and I only used 1/10th of Catalyst’s features, and an insignificantly small fraction of a percent of available Catalyst plugins and Perl modules.


One thing about my application that I am very pleased with is the ability for an Admin user to add normal Users through a web-based form. I am particularly proud of the fact that I was unhappy with how passwords were being stored in plain text in the database (thanks for providing me with ample nightmare material, Reddit and Slashdot and K5) instead of being stored as password hashes, as they always should be.

None of the tutorials or the book indicated how to do this, so I ended up having to integrate the Perl module Digest::SHA1 into my application in order to correctly generate password hashes, and then I needed to explore the HTML::FormFu Perl module (and Catalyst plugin) fairly in-depth in order to figure out how to extract the password from the form after it is submitted, create a hash from the password, and then save the new user object to the database, rather than having the user saved immediately upon form submission, which was why the passwords were being saved in plain old clear text. This was trickier than it sounds, but I eventually figured it out and wrote the necessary custom methods.

Which, speaking of HTML::FormFu, brings me to my next topic: how Catalyst provides you with multiple choices in terms of how you want to handle forms.


Although the last time I went through the tutorial they were using something called HTML::Widget, and this time they provide you with the choice of using either HTML::FormFu or FormBuilder, I eventually weighed all the available options I was aware of and decided to go with HTML::FormFu for the long term.

I won’t go into too much detail about how I reached this decision, but suffice it to say that HTML::Widget is now deprecated and will no longer be maintained, and that my experience with FormBuilder from the Packt book left a little to be desired, which lead me to HTML::FormFu as the One True Form Module and Catalyst Plugin of Which Little Besides the Kitchen Sink is Left to the Imagination.

The documentation for FormFu is substantial, to say the least. I’ve only scratched the surface with it, so far, but I’m impressed with the architecture of how the module is used so far; it works beautifully with Template Toolkit, which is the View portion of the MVC framework I’m using (I’m mostly using it because almost all the tutorials and book examples use TT; there are other options such as Mason, Petal, and, er, well, lots of options.) to render the site into HTML.

FormFu handles form validation for you, so you can just specify what kind of data you require in the form configuration file and it will automatically generate errors and ask the user to re-submit the form if they don’t fill it out correctly. This is obviously a huge improvement over writing laboriously lengthy regular expressions to check, for instance, if a valid email address has been submitted.

FormFu will also automatically populate your form with information from your database, which is wonderful if you’d like to be able to update database objects (can I call them database objects yet, or do I still have to call them table rows?) such as changing a User’s Address or whatnot.

It then does the form validation in accordance with your specifications, which are written in fairly simple configuration files along with the basic form layout. There are a wide variety of constraints to choose from, many of which I know absolutely nothing about, but I have high hopes for the future.

Finally, after the form has been submitted and validated, it is simply saved into your database with a simple method call. Easy, peasy! It really couldn’t get much easier than this.

One caveat: FormFu is officially Beta software, so the API is evolving and will probably break a few times before the 1.x release is out.

For my simple Todo-list and Addressbook application, this is fine. For your large, production web application, this may not be the case.


In fact, I have to hesitantly and somewhat reluctantly admit that Catalyst makes me a little bit nervous sometimes due to the enormous amount of dependencies involved. Hopefully as I progress as a Catalyst programmer this feeling will fade, but right now I’ve just seen too many rather abrupt changes in the Catalyst documentation (particularly the tutorials have significantly changed, recently) as well as the recommended Catalyst best practices and which modules and plugins to use, for instance.

Aside from that, I must admit that it’s been both challenging and fun to work on this application. I must emphasize that right now it’s only running on my laptop, and there is no real plan to release the code or have a site “go live” with the application running, because it’s still beta code (there are bugs, I’ll admit that much), and I also don’t want to jump the gun by releasing crap code, which this application very well may be (time will tell, I suppose.)

This may change, however. In the meantime, I’m going to go to bed dreaming about what *real* applications I could create with Catalyst, now that I’m gaining familiarity with the tools.


Catalyst is actually much more than a toolset; it’s a workbench, utility belt, Swiss Army scalpel, and
hydrogen fuel cell on wheels. Sometimes it’s a little bit overwhelming, what all it can do. I’m just trying to be patient and not be too frustrated with the seemingly slow pace of my progress with it.

October 22, 2008

Using Catalyst to Develop Web Applications

Filed under: Catalyst, Perl, Programming, Projects — mbeihoffer @ 12:04 pm

I’ve recently been honing my chops with Perl’s Catalyst framework; working my way through the tutorials, reading the module documentation, creating sample applications, and whatnot. The framework has a steep (for me, at least) learning curve, but I believe that overall it will improve my productivity and increase the maintainability of my web applications.

When you create a skeleton application, the framework installs the core MVC modules under your project directory, and it includes a web server built right in to the application, so you can launch the app right away without having to configure Apache’s mod_perl or fastcgi. It’s really nice to have the server open in a console window while you’re serving the site so you can see the stack trace and server responses while you’re browsing the site on the same system.

Catalyst also includes support for user authentication and authorization, so you can plug in those modules and get started on your application without having to worry about how you’re going to secure your application or get user logins working. It also supports form validation through the FormValidator plugin, which makes validating user input a breeze, which is an enormous timesaver over the old ways of doing form validation.

The manual is extensive, with a ten chapter tutorial included, so you can follow along and build the sample application yourself, which is quite helpful in understanding how the framework organizes all the files in your application. You can check the code for the tutorial out from a Subversion repository, which is nice if you’re not interested in doing a lot of typing.

I’m still learning Catalyst, so I’m not really the best person to ask about maintaining applications with it, but so far, it’s been fascinating to learn and I’m eager to get started on a live application soon for one of our new domains. We’ve just registered five more domain names, and I don’t know what we’re going to do with a few of them yet, but they’re registered for three years so hopefully we’ll have time to get a few things up and running, and I plan to use Catalyst to launch sites based on custom code.

Ruby on Rails, Django, Symfony, and CakePHP are all good alternatives to Catalyst, if Perl isn’t your language of choice, but as for myself, I personally have a lot invested in my Perl education and I’d like to be able to write web applications in the language I’m most comfortable with. I don’t mind PHP that much, so I tinkered with Symfony and CakePHP a bit this summer, and Ruby is very interesting to me, but I don’t have much experience with Ruby, so I think using Perl will be faster and more productive for me personally.

PHP is certainly a popular option these days, but I’m not a huge fan of it so far for serious coding, although I’m not opposed to giving it a shot now that PHP5 has decent object support built-in.

In short, Catalyst supplies the die-hard Perl coder with a great MVC framework similar to Ruby on Rails, with access to a large library of modules and plug-ins, and excellent flexibility in terms of what you decide to use for a Model. The tutorial uses SQLite for the examples, but MySQL and PostgreSQL are supported as well, and since the Model is abstracted out of the application, it should make it easy to change database back-ends if you don’t like SQLite or want to support multiple kinds of database for your application.

One thing I haven’t yet tried to accomplish is to get a Catalyst application running under an Apache VirtualHost, which would be ideal as that’s what we run on our web server. I’m sure it won’t be too problematic, but you never know. Perhaps that’s what I should do next, before I start coding an application in earnest, before I get to the stage of launching the application and realize I have no idea how to get it to run under Apache VirtualHosts.

Wish me luck!

Karn Skating Dynamics

Filed under: Design, Projects, WordPress Themes — mbeihoffer @ 11:33 am

We’ve recently launched the Karn Skating Dynamics website. This project was really fun to work on; Barry, Beau, and Jodi Karn are all really great people and fun to work with, and the project allowed us to work with the fantastic Revolution Pro theme pack from Brian Gardner.

Here’s a screenshot from the site’s front page:

Karn Skating Dynamics

Karn Skating Dynamics

Karn Skating Dynamics is the largest skating school of its kind in North America. The year round school has up to 450 students per week. In addition, we train and work to share our knowledge with hundreds of teams, coaches, hockey associations and clubs throughout the US and Canada. All told over the years, Karn Skating Dynamics has taught tens of thousands of students from the mites to the pros.

March 15, 2007

Long time, no update

Filed under: Blog, Projects — mbeihoffer @ 8:44 pm

Well, it’s been so long since I posted anything, I forgot my password to log in here, so I had to reset it, as usual.

I feel lazy. It’s not that I haven’t really had anything to write about, rather, I’ve been so immersed in a few highly intensive projects, I haven’t hardly had enough time to post anything.

So. What’ve I been up to? Well, Dragonfly Networks is still plugging along - we’re working on a few web sites. The new project we got today sounds really interesting; the owner of the site seems to have a pretty clear idea about what kind of functionality and layout the site should have. That sometimes makes it a lot easier - I like people who have a strong vision of what they’re trying to do with their site; it’s pretty easy to implement features if they’re well thought-out.

Anyway. so enough about work. I’m here today to post a l’il something about why I’ve been so busy, and what I’ve been working on, and why it’s important to me. There are also some peripheral elements to my life that have occurred lately which have caused me to spend a considerable amount of time and energy on non-computer-related tasks - I hesitate to venture a guess as to why this would be.

Anyway, so; I’ve been mostly very busy trying to master a set of toolkits, engines, modules, and whatnot, not for any particular project so far, but simply because I’d like to be prepared when large(r) projects come down the pipeline.

For a long time, I felt somewhat torn about the various programming languages that are out there; reading Reddit every day (back when it was still young and extremely geek-chic), well, reading Reddit every day lead me to the idea that all I needed to do was to learn CSS, Ruby on Rails, and Lisp, and I could expect to have laurel wreaths thrown at my feet by nubile, young venture capitalists, and that they would stop at nothing to seduce me.

So, yeah. I got the Lisp book, (thanks, Nick!), and the Ruby Pickaxe book, and was on my way.

Sort of. The problem here is that it takes a huge investment of time and energy to truly learn either one of those languages (I did learn CSS, but that’s because it’s easy enough for even a slow thinker such as myself to figure out how to use.)

I even spent a considerable amount of time getting Ruby on Rails to work on OpenBSD, which was certainly a challenge. I was eventually successful getting the default Rails app to work, which is actually pretty cool, in a lot of ways.

Lisp, on the other hand, well - although I enjoy reading the book from time to time, I must admit that I don’t have any clue whatsoever about how to actually write anything worthwhile yet, although it looks like Lisp has some serious horsepower for solving a wide variety of problems.

But I digress. In any case, I still feel a little weird putting Rails on my CV, and honestly, it wasn’t until recently that I came to appreciate just how powerful and flexible it can be to develop on a well-engineered MVC framework. (such as Rails.)

Of course, I didn’t learn this from Rails; in fact, I hate to admit it, but after spending some time working with Ruby, PHP, Python, Perl, and a few other languages, it became fairly clear to me that many of the frameworks that are available are still relatively immature. PHP in particular has a dearth of frameworks that are stable, well-documented, well-engineered, and sufficiently decoupled enough to be useful when developing a new application.

I looked at a few, such as CakePHP, but mostly came away from the experience feeling leary about whether or not it would be wise to invest a large amount of time into learning a somewhat questionable framework.

In any case, so, I dabbled with CakePHP, Python’s “Twister” application framework, Ruby on Rails, PHP’s Smary templating engine, and many others, and found that I was becoming disillusioned with the available systems, and felt uncomfortable about how much time I would have to invest in order to come away from any of those projects with anything resembling a useful skill.

Also, it must now be mentioned that, although I should probably know better by now, when it comes down to it, I am now and probably always will be a Perl junkie. It’s my favorite language. Sure, Ruby looks compelling, what with it’s clean syntax, amazing object oriientation, etc, and Python ain’t bad either, and I’m sure I’ll dabble in lots of languages in the years to come, but what it comes down to is this.

I know Perl pretty danged well.

It does a helluva lot of stuff pretty damned well.

It’s got a massive module library (CPAN), and many of the modules on CPAN (unlike, say, the ones in PHP’s Pear) are fairly mature, rigorously tested, and generally stable and useful.

So, you know. I started tinkering with Perl frameworks a while back, maybe three or four years ago, when there weren’t a whole lot to choose from. I studied POE, for instance, with a vengeance, and I’m glad I did, even though I probably won’t be using it for anything important. And I looked at Maypole, which is super cool, but doesn’t seem t have any active development going on right now.

Anyway, to make a long story short, there I was, using Perl, (and feeling pretty good about having successfully integrated Perl with the Eclipse IDE, but that’s another story), and, well, I”m not going to bore you with the details of what it’s like setting up a Subversion server on OpenBSD, or why there are some seriously cool Perl modules coming out of Japan right now, or how, even though it’s WAY harder to learn, hard to administer, and seems like overkill for a lot of my projects, PostgreSQL is just WAAY BETTER THAN MySQL FOR LOTS OF REASONS.

But I digress. And, besides my neverending struggle to get Eclipse, Subversion (i.e. Subclise), PostgresQL, E.P.I.C., and everything else I’ve been working on to play nicely together, I eventually decided to spend some time with Perl, because I *really really really* wanted to try out Catalyst.

You know. CATALYST. It’s, uh, it’s a rapid-applicatiion-development framework, based on the MVC design pattern, with many extremely useful modules that make developing a complex web application MUCH easier than before. Seriously, it’s super tight. It’s like Ruby on Rails, but for Perl. Which, although I’m sure that concept makes a lot of people shudder, I was pleased as punch to discover, because I sure as hell don’t know Ruby well enough to develop anything with Rails, and honestly, I don’t really know if I’m smart enough.

So, after a little quantum entablement, we wrapped things up at the bar, and headed over to the lab to try out this Catalyst stuff, and see if it’s any different or (let’s just say, uh, “usable”) from the other newfangled frameworks that are out.there.

To make a long story even longer, well. I spent some time with Catalyst, and, uh. well.

HOLY CRAP CATALYST IS SUPER COOL.

And, even though it’s taken me like, three months to learn, and I still have no idea what I’m doing sometimes, I’ve been keeping busy trying to learn all of the crazy stuff Catalyst can do for me.

More tomorrow, I’m falling asleep, yo.

January 13, 2007

Links, Explained

Filed under: Blog — mbeihoffer @ 1:44 pm

This is a beta test for an exciting new music website I’m developing with my friends. I wish I could describe it better, but since I can’t hand out passwords willy-nilly due to the nature of the work, it will have to remain a mystery until I have the proper clearances.

This is my employer, Dragonfly Networks. I am currently a partner in the business with my cousin.

This is a WordPress-based site we built for a local business. It was interesting to see how WordPress can be used in a more sales-oriented fashion. I’d like to add a shopping cart module sometime, and I wish their was a free NewsLetter plugin for WordPress. (The Semiologic plugin looks good, but it is part of a $300 bundle.)

This is an interesting site by my uncle, who is an attorney. He initially was blogging on some custom software I wrote for him back in 2000-2001, but eventually we decided that WordPress made more sense, and it’s been working very well. He gets quite a bit of traffic, probably due to the longevity of the site and archived sections. Plus, he’s pretty smart about what to write, and likes to feed certain keywords into his posts.

This is my friend Estelle’s web site. She is a massage therapist, and also makes jewelry, which she’s been taking photos of and posting on her site. I’d like to help her with the site sometime, so far I haven’t had any input into it.

This is my friend J.D.’s web site. He’s pretty smart, knows quite a bit about computers and coding, and politics and stuff, too.

This is my girlfriend’s web site for her letterpress printing business. They use a couple old-fashioned printing presses to create absolutely divine paper goods. I’ve been learning quite a bit about design from her. She’s amazing on her Mac G5 with Photoshop and Quark Xpress and whatnot.

This is Nick’s friend Alex Koprowski, who runs a glass-blowing studio in Northeast Minneapolis. I believe this site was also built on WordPress, but Nick took care of that.

This site is a pretty simple migration of an old Microsoft FrontPage-based site to WordPress. The project was interesting because we decided to re-use the layout, and swap out the engine completely. It worked all right for a while, but I’m probably going to redesign it fairly soon to make it more sophisticated.

This is the local hosting provider we use. It’s run by my good friend Tom Kleinschmidt, who I’ve known for quite some time. They do very good work, and although they’re a little more spendy, we feel it’s worth it.

This is J.D.’s politically-oriented website. He recently migrated it to WordPress, and I think they’ve been pretty happy with the results so far.

This is a commercial site we made for a group of attorneys in Minneapolis specializing in cases filed under the False Claims Act.

This is my little sister’s MySpace profile. I miss her - she moved to California a while back. I don’t go to MySpace very often, but it’s nice to be able to see what she’s up to these days.

Anyway, I just wanted to explain the links in my blogroll. Nobody ever does that. Maybe it will be a new trend.

This site is actually just a total mess of beta code I’ve had kickin’ around for a while. (Which explains why the site is unreadable right now.)

Basically, I use it to experiment with the WordPress codebase, and also to serve as a repository for my enormous and ever-growing link collection. I’ve installed the beta version of my WordPress PostCat2LinkCat plugin, which is nifty because it lets me show different link categories on different post archives of the site, so you can expect to see a lot of my CSS references in the Design section (and CSS subsection.)

It doesn’t have a lot of post content yet, but expect to see more in the future. I basically just started blogging again for the first time in several years, but this is the first project I’ve really tried to steer in any particular direction so far.

Oh, yeppers. This is Tom Beedem’s website. He’s a local lawyer and a good friend of mine - I think he needs to start posting though.
What Are We Doing?

Basically, we’re trying to get more people in our business circles to create dynamic web sites with comments sections, feedback, syndication feeds, and well-organized content. It’s slow-going; many of our business clients are rather busy, and it’s hard for them to make time to post.

WordPress is absolutely spectacular as far as I’m concerned. Once you try it, it makes most of the other content management interfaces and blogging software look extremely primitive.

I don’t know why it’s so polished compared to, say, Drupal, which is another platform we use. They both use the TinyMCE text editor, which is a rich editing control for form submissions written in Javascript. However, Drupal’s TinyMCE implementation is a plugin, and it’s not very well integrated into the platform in my opinion. WordPress, on the other hand, is absolutely seamless.

My only complaint about WordPress so far is that I wish they would slow down the frequency of their upgrades! (That’s kind of a joke - I’m glad they’re so active.)

Seriously, though, it’s sort of a pain to have to go through the upgrade process every time they have a point release, which is around once every two or three months (sometimes even more frequently.)

I’d like to work on an automated upgrade plugin that would handle the process dynamically, but since our installations are hosted at different providers, and the access methods (i.e. ftp vs scp, phpMyAdmin vs. mysqldump, shell access vs. no shell access, etc) vary so much, it’s tough to code that sort of thing and expect it to work consistently.

Current Issues

Currently, I’m not having any major problems with our installations. There is one issue looming in the near future; apparently, at least one of our WordPress installations that was recently migrated from one server to another has suffered some kind of data conversion error within the MySQL database.

I’ve done a few hours research on the problem, which seems to stem from the way MySQL handles character sets, but haven’t figured out a solution yet. The WordPress output looks fine, but when trying to export the database from the phpMyAdmin control panel (or the WordPress Database Backup plugin) the SQL file has numerous occurences of text corruption.

I do expect that the problem can be fixed; if not, I’m sure it will be possible to index or spider the content through the website and find a way to re-import the data into a fresh MySQL install. This would, of course, be a last resort, but it’s an option.

Minor Complaints

Although I’m happy that work on WordPress continues to improve the codebase, and I am excited and happy to see the huge amount of momentum that the project has gained over the last few years, I am fairly sceptical that the changes made to the way the Link Management in 2.10-alpha releases are helpful. This is obviously a fairly subjective opinion, and although I agree that changes need to be made, I’m not very thrilled about the way they’re attempting to resolve the issue. I’ll write more on this later after I have more of a chance to fiddle with the 2.10-alpha and beta release.

January 8, 2007

Free Rounded Corners Plugin for the GIMP

Filed under: Blog, Design, GIMP Plugins — mbeihoffer @ 6:27 pm

To celebrate the New Year, we’re giving away our GIMP plugin - Rounded Corners 1.0.

RC1.0 is a Perl-fu plugin that shows up under Toolbox->Xtns->Render->Round Corners.

You select a foreground and background color for your corners, width and height, custom prefix, and output directory, and four PNG files are automatically generated. These files are intended to be used by HTML/CSS programmers and designers, and can be positioned with background-image tags in your CSS to produce nicely rounded corners instead of CSS’s typically, boxy looks.

December 27, 2006

Trying Nvu

Filed under: Design, Software Reviews — mbeihoffer @ 12:24 am

I’ve been looking for a good visual HTML/CSS editor, and although it was a bit of a handful to get it running, I now have Nvu running on my Debian laptop. I also just discovered Quanta Plus, which was installed by default with KDE (I think), so I’ll be attempting to learn one or both of these over the coming weeks.
When I found the Nvu website and read the summaries and looked at the screenshots, I got a tiny bit excited. It’s an open-source WYSIWYG editor for web pages that can (in theory) handle CSS, integrates with ftp/ssh site management, handles HTML forms, and is described on the Nvu website as being similar to Dreamweaver or Frontpage.

This would be helpful on some projects, obviously; my current technique of having a console window open with a screen session running, with the stylesheet on one screen, the header on another, the sidebar on another, the footer on yet another screen, (I know - it’s absolutely insane! but on the other hand, once you learn how to toggle from screen to screen with keyboard commands, it’s nearly instantaneous, and then you can alt-tab to your browser, hit F5, and see what your edits did, pretty quickly) well; that technique works fairly well for me, but it’s certainly a little cumbersome.

Ideally, I’d have a dual-screen setup when I do web development, with Firefox open and full-screened on the right, and the CSS/HTML files I’m editing on the left. I’d be able to make edits to the stylesheet, and whenever I saved the edit, the Firefox session would detect the file change and refresh the page automatically. That would be pretty slick.

Also, it would be helpful to be able to use a small set of graphic-design tools (i.e. bucket fill, gradient fill, replace color, etc) on a page mockup in realtime. Actually, Dreamweaver would be a fairly useful tool for the work I do (and for our company) if it ran on Linux, was free, and handled W3C compliant HTML generation a little better.

In any case, I’ll be updating this post every once in a while to let you know how it goes.

December 21, 2006

PostCat2LinkCat Plugin for WordPress

Filed under: Blog, Projects, WordPress Plugins — mbeihoffer @ 7:45 pm

I just finished writing my first WordPress plugin, which was quite educational.

You can get the php file here - sorry I didn’t zip it or tarball it up. Maybe version 0.3 will come with zippyness.

It works with WordPress 2.05, but probably won’t work when 2.1 comes out, due to the major database changes they’re rolling out (primarily, they are merging the two tables wp_categories and wp_linkcategories, so wp_linkcategories won’t be around for much longer.)

I wrote this plugin because, aside from writing a custom Category template for each WordPress Post category, there was no simple way to associate a link category with a Post Category. Basically, what I wanted to do was to associate certain link collections with certain Post categories, so if you’re browsing the Design Category, it might show you links from the CSS and Color Theory link category.

What’s nice about it is that it enables you to associate multiple link cats with specific Post cats, so you can have an assortment of links randomly appear in the sidebar (or wherever you want, I guess.)

The plugin does add a database table to your WordPress database called wp_postcat2linkcat, which is where it stores the associations, and it also adds a screen under your Admin->Manage page so you can choose which categories go with each other. I tried to code the plugin as closely to the WordPress Plugin API pages and tutorials as possible, but this plugin does come with no real warranty, so use it at your own risk. ;-)
I’m not too disappointed that WordPress 2.1 is going to make this plugin obsolete - I just joined the Testers group so I’ll be beta testing 2.1 myself. Maybe I can adapt the plugin and make it a little bit more sophisticated - right now I’m only using it on an old test site of mine, but I’m sure in a week or two I’ll want more features.

Installation: Download the file. Stick it in your “plugins” directory. Activate.

Usage: Find the template file where you want the links to appear - I recommend the sidebar.php file, although you could put them anywhere really. I avoided using any Template Tags that required being in the Loop to work, so you’re not limited to using the pc2lc_get_links() function in any specific area.

Simplified usage: After installing the plugin, just go to Manage->Post2Link Categories and assign some link categories to your Post categories. Then, just edit your sidebar.php file and insert the line
where you want the links to appear.

More complex usage: You can specify the following parameters (exactly similar to the parameters that are available with the get_links() function)

‘between’, show_images, ‘order’,
show_description,show_rating, limit,
show_updated, echo); ?>

This is obviously a lot more effort, but on the other hand, you get a lot of control over how the links will be generated and formatted.

I’ll try and document it more later - time for a break.

Northstar Irrigation

Filed under: Design, Projects, WordPress Themes — nick @ 4:58 am

So I guess I’m a Web Developer. At least in the sense that I can build a web site for my friend and his irrigation business. This is the first site that I have done on my own, and I have to say that….it’s OK.

I think the biggest change this time around is that I have a much better grasp of how WordPress (PHP) and CSS function together to render the dynamic HTML that the user sees when they visit the actual site.

Although I’m a long ways off from writing an entire style sheet on my own, the theme that I developed for the site is mine (inasmuch as editing a few lines of the style sheet make you a theme developer).

Here she is:

screenshot.png

Download the NorthstarIrrigation theme right here: northstarirrigationtar.gz

December 4, 2006

SimplePie Plugin

Filed under: Blog, Projects, WordPress Plugins — mbeihoffer @ 4:18 am

I’ve been working with the SimplePie WordPress plugin today on some of the sites we maintain, and also have been dabbling with a few other WordPress plugins.

The SimplePie plugin is designed to make it easy to include RSS syndicated content on a WordPress site. It handles RSS and ATOM feeds fairly well. I had some major trouble getting it to work on the False Claims Act web site, where I was using it to pull content from Bob’s blog and also from Bob’s main site feed.

The troubles I had, which I finally resolved, stemmed from the fact that since the FCA site is hosted on HostingAve’s servers, and because Tom Kleinschmit had at one point set up DNS records for http://www.rpcmnlaw.com, the server was looking in the wrong place for Bob’s web site, instead of over at Pair’s server which is where Bob’s site is actually hosted.

I was able to fix it by logging into HostingAve’s server and changing the DNS records, which solved the problem - it took me a lot longer to troubleshoot and fix than I’d like to admit.

While I was at it, I went ahead and upgraded Bob’s blog to Wordpress 2.05. It was fairly easy. I also re-enabled comments on his site, and turned on Akismet to help handle the crushing load of the ~600 or so spam comments he’s accumulated on the site so far. I went through and deleted all the spam. I also got RSS syndication working between his blog site, his main site, and the False Claims site, so now headlines from the three sites appear at various places around each other’s sites. I don’t know if that was wise, but it’s pretty cool that when you look at Bob’s profile page on the False Claims site, you see links to his latest blog posts and also any new content published to Drupal.
I also have been using the Smart Ping module with WordPress, on Bob’s site where it is now installed, on the False Claims site, and also on the Dragonfly Networks Beta site. It handles the whole XML-RPC Ping-o-matic thing a little better than the default WordPress ping engine, and logs the various transactions as well, so you know if it’s working better.

There is also the WordPress Head Meta Description plugin, which creates meta tags automatically for you based on the page’s content in WordPress; hopefully, this will help drive some traffic to the sites. I’m not sure if any search engines really trust Meta tags anymore, but it can’t hurt, right?

LAPTOP NEWS UPDATE

Well, it took just about forever, but I finally got a semi-decent working installation of Linux on my laptop. It’s still got some issues, but I’m happily running Debian Etch right now, and most things are working well. I had numerous problems with my ThinkPad’s networking card, which totally sucked up at least a half a day’s worth of troubleshooting and testing, but it’s working all right now and I wrote some shell scripts to help manage the transitions between the various wireless networks I use.

I spent a goodly amount of time learning whole bunches about Linux networking, in the process, so that’s helpful.

Also, here is my xorg.conf file.

It doesn’t do anything special yet, but it works with my Logitech USB wheel mouse and ThinkPad touchpad.
I am still having some slight problems with my wireless card; sometimes after rebooting the card will not see the wireless network, no matter how many times I try and set the iwconfig configuration settings by hand, it simply just doesn’t see anything until I reboot (again.) I’m going to try and spend some time on it this week, as I believe there are some other alternate wireless drivers I can use with the card, but until then, I’ll be hobbling along like Jenni, except with less fashion sense.

(Speaking of Jenni, she just poked her head in to tell me to come to bed, so I’d better wrap this up.)

FALSE CLAIMS ACT ARTICLE

I spent part of my morning writing an article for the Attorneys Against Government Fraud. There was a very lengthy and interesting New York Times article about an auditor at the Department of the Interior who has filed a lawsuit against an oil company under the False Claims Act. I came across the article via a summary analysis on Daily Kos and thought it beared further investigation.

The attorney group really needs some more content if they expect that site to fly. They’re currently just running on fumes, and there is only so much we can do with changing the layout, adding photos, etc, to improve the site’s ability to attract attention. However, I feel that the new layout may inspire them to contribute more content, at least to some degree.

In the meantime, I’m going to post various articles of interest to the site and try and sustain the momentum.