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.

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.

November 22, 2006

MoinMoin

Filed under: Blog, Projects, Software Reviews — mbeihoffer @ 3:57 am

I wasn’t too pleased with the MediaWiki installation, so I went ahead and got MoinMoin installed instead.

One of the things I didn’t like about MediaWiki was that it seems really slow; hopefully, the MoinMoin installation will be faster due to the way it’s configured.

I chose to do the installation under Apache with the FastCGI module, which should in theory make the pages load up quickly. It was fairly tricky for me to get the installation setup correctly; the MoinMoin documentation is fairly involved and a nefarious multi-stepped process. The section about Apache VirtualHosts directives was particularly non-helpful.

Anyway, I don’t know what it’s for, exactly, or what we’re going to do with it, but we have a wiki now.

SugarCRM Upgrade

Filed under: Blog, Projects, Software Reviews — mbeihoffer @ 1:50 am

I went ahead and upgraded SugarCRM to 4.5f, fearing that if we waited too long, we’d have problems upgrading in the future.

Overall it went well; there were some permissions problems before I was able to upgrade, but the SugarCRM upgrader warned me about them beforehand so I had a chance to fix them before the upgrade script crapped out halfway through, which is how things used to be handled.

After the install, there were a couple error messages at the top of every page, including that fabulous “Could not connect to Sugar Server: please correct your Proxy Server settings in the Admin section” which appeared in bright red on every page. This I was able to fix somehow by clearing my cookie for sugar.dragonfly-networks.com, although I’m not sure why this worked.

The last error was something telling me to upgrade my Studio files in the admin section; the admin section didn’t have any options for upgrading these files at first, but logging out of Sugar and logging back in seemed to fix it so I could upgrade the files. Everything appears to be working well in Sugar now, so we should be ok for a while.
While doing this upgrade I was also trying to use the mysqldump utility to run a database backup of the sugarcrm database before upgrading. I ended up having to install PHPMyAdmin instead, and ran the backups from there, which worked but spurred me into investigating the source of the errors I was getting from mysqldump.

After slogging through a variety of forums and finding out how other people fixed the issue, I found an interesting post from a gentleman who mentioned how to look at theĀ  mysql open-file-limits variable from within mysql, and found that our setting was way too low for the amount of databases and files we’re using these days. It was somehow set to 510 open files, and I was able to increase it to 1710, but it should really be around 8192 ideally, and although that was the parameter I passed to mysqld_safe when startingĀ  it, apparently there may be some kind of limit built in to OpenBSD that is preventing it from reaching the higher limit.

I’m not sure how to fix this, although I may be able to work around it using some ulimit commands or whatnot.

In any case, everything is working now, so I might call it a night before I break something.

November 18, 2006

MediaWiki installation

Filed under: Blog, Projects, Software Reviews — mbeihoffer @ 5:10 pm

I got MediaWiki installed and configured. I put the installation here at beta.dragonfly-networks.com/wiki.
A few notes:

  • It seems really slow. Even just opening up the main page takes 5-8 seconds in my browser. If you’re going to criticize font resizing in Firefox on Linux for not being fast enough, well, this is slower.
  • Installing MediaWiki was a lot easier than the first Wiki engine I tried (MoinMoin, a Python-based wiki engine.) MediaWiki is a simple, three-step installation process, super easy to do.
  • I gave up on MoinMoin after getting through the first three pages of installation instructions.
  • MoinMoin looks like it’s faster than MediaWiki, and also, I liked the look and feel better.
  • I might still feel ambitious sometime and go ahead and replace the MediaWiki installation with MoinMoin (or another Wiki engine, depending on your feedback and the other resources available online.)

That being said, it’s installed and ready to go. Go ahead and try it out and let me know what you think.