Kevin Hankens's blog

Migrating the Drupal way. Part I: creating a node.

My position with Acquia will find me helping out with a lot of migrations and upgrades. I'm going to embark on a multiple-part blog to discuss some of the common techniques that I use when moving clients to Drupal.

Migrating to Drupal can seem intimidating if you already maintain a database-driven website. However, populating a Drupal site with your current content might be easier than you think. Whether you are migrating from a popular CMS or a fully custom application, you can easily use Drupal modules to mimic your current data structures and migrate your data using a simple custom PHP script. I should note that while there are several different methods to accomplish this task, this happens to be my favorite.

Drupal wins best php-based open source CMS award!

Packt Publishing announced on Wednesday that they had awarded Drupal as the best Open Source Content Management System written on a PHP/MySQL platform. Moving ahead of last year's winner, Joomla, Drupal was credited with winning not only for the great feature set, but also for having such a great community.

It's a great time to be a drupalist. Click the digg link below to help spread the word!

First two days

Whew! The first two days have been awesome, but wicked tiring - yes I can say 'wicked' now that I'm back on the East coast :) Most new jobs you spend a few days poking around trying to find something to do. Not this one! I've been been setting up demos for potential clients, sitting in on project planning meetings, researching compatibilities, testing Acquia Drupal release candidates, and a lot more.

The "office" is way cool, the cool part is that there are no offices; everyone sits at the same level which gives you an idea of how much collaboration there is. People are constantly working together with different departments and after ten minutes you get a real appreciation for just how productive these people are. There are a lot of scrum-like practices, and things like the workspace arrangement give a high level of agility and visibility. I definitely feel like I'm a part of something that is constantly moving and evolving.

I'm still sans-Mel which is tough, but only three more nights and we'll be back together! I fly back on Friday to pick her and the animals up and we'll point back eastward.

Lots going on, but I'll try to keep my head above water :)

Empirical development and Scrum

Recently, I've been reading a book about Scrum methodology for software development. The book is titled Agile Software Development with Scrum, by Ken Schwaber and Mike Beedle. It's interesting to me because it really defines and encapsulates a lot of my theories in a way I have not been able to articulate on my own. It helps to define a process to create unique, unrepeatable results. I think it demonstrates a great way to build custom-tailored solutions for your clients.

Click through to read more...

AJAX with jQuery is wicked easy... for real!

I haven't had much time to play around with jQuery, but I've always been intrigued by how nicely it is used in Drupal. So, I decided to download it for a quick test. For those of you who might not be familiar with jQuery, it is a Javascript library that lets you create animations, DOM interactions, AJAX connections and more. I've used the YUI tools before which, while functional, are relatively cumbersome to implement. In stark contrast, in less than five minutes, I had downloaded the latest version of jquery and created an HTML page with a working asynchronous request.

1. Download the latest version of jQuery [jquery.com]

2. Read the quick how-to document on creating an AJAX request using the load() function.

3. Create an html file for the test with a function to call load(), which only requires one argument, though you can add key/value request variable pairs if you want to call a PHP script. You can also specify a callback function to perform after the request. We'll keep this simple for the time being:

<html>
<head>
  <script type="text/javascript" src="jquery.js"></script>
  <script type="text/javascript">
  function loadtest() {
    $("#loadtest").load("load.html");
    return null;
  }
  </script>
</head>
<body>
<a onClick = "loadtest();">Click here to test</a>
<div id = "loadtest">TEXT</div>
</body>
</html>

This sends a request to load.html and then populates the block id=loadtest with the response.

4. Create load.html

<strong>UPDATED TEXT</strong>

5. Seriously, that was it. Here's the working test

Now, this is obviously quite a rudimentary test lacking error checking and without proper callbacks, but I was shocked at how easy it was to implement. If you can get it up and running in five minutes, imagine what you could do in a day! The possibilities are vast!

Using sar to analyze server performance

Recently I've become addicted to the linux command sar (system activity reporter), which is reporting application for sadc (system activity data collector) that comes bundled with sysstat. This is a great way to see daily trends in resource usage like processor, memory, load averages, I/O and more. It comes bundled with RedHat distros, but you can also install it yourself via one of the RPM repositories.

Basically, there are two cron jobs that call sa1 and sa2. sa1 logs the current load, and sa2 compiles them into one daily log. The output can be displayed using sar.

The default settings create a log entry every ten minutes, but you can edit this by modifying the cron job that calls sa1 (RedHat puts it in /etc/cron.d/sysstat).

So, to look at today's load averages, you could use the -q flag:
$ sar -q
The output is similar to the load averages in the uptime command: current, five and fifteen minute load average figures.

Or, to look at today's memory usage, use the -r flag:
$ sar -r
the output of memory is very similar to that of top showing free, cached, swap, etc.

The logs are kept by default in /var/log/sa/sa[day], so to look at the memory usage for the first of the month, use:
$ sar -r -f /var/log/sa/sa01

But beware that these logs get rotated, so if there is a particular day that you need to save, be sure to create an archive somewhere.

I've been using sar daily. It's a great way to get a feeling of how your site is performing during varying traffic and can be a great tool to help diagnose bottlenecks. There are a slew of options that you can use with sar to report on different aspects like processes, TTY, switching, swapping and a lot more that you may or may not need.

Happy tracking!!

To Acquia, Andover and Beyond

Well, it's official. I just accepted a position with Acquia as a Senior Technical Consultant. After several interviews and a whirlwind trip to Andover, they saw reason to offer me a job :)

It will be a very bittersweet moment when I leave VeloNews, but the new job will open a door to a much larger world of website development. My job will entail helping companies migrate to, and/or integrate with, Drupal. I will also be leading groups of Acquia Partners to help foster relationships within the Drupal community. The philosophy of Acquia is really refreshing. We will be working hard to support the community with a conscious effort to not take business away from other Drupal professionals. In fact, it's the opposite. Acquia intends to subcontract as much work as possible to its partners. It is really the community that makes Drupal so special, so Acquia has a big interest in giving back as much as possible.

So, we head back East. Boulder feels like a blur. After two Tours de France and the site relaunch, we've barely had time to settle in. The one thing that will be missed though, will be the friends we've made out here... them and the bike paths :) Being close to Melissa's family will be great, and living in a state with humidity will feel fantastic. Andover felt really good to me, and Acquia is the kind of company that will really help me grow personally and professionally.

And the adventure continues...

Drush is sweet!

I've been playing around with an awesome Drupal module recently called Drush, which is a CLI interface for common Drupal functions. It's just a PHP script that bootstraps Drupal and calls modules within the Drush module. You can do cool stuff like from managing contributed modules and executing SQL queries, right from the terminal. I've got my head buried in the terminal for ten hours a day anyway, might as well be able to do some Drupal stuff there!

Install is fairly easy:

  1. Download the latest Drush modules for your version
  2. Install them as you would install a normal module
  3. Execute:
    php sites/all/modules/drush/drush.php

    from your Drupal site's root directory, or add the "-r /path/to/drupal" flag. You might also have to include the "-l http://siteurl.com" flag if you have a multi-site installation

  4. Create a path alias in your .bash_profile, .profile, etc. shell config to, sort of, put it in your path:
    alias drush='php /path/to/sites/all/modules/drush/drush.php -r /path/to/drupal/root'
    1. And, voila! You can now check the watchdog, run cron, run simpletests and a lot more without leaving the comfort of your favorite shell. I'm kind of stoked to write some custom modules to do some other common stuff.

Finally a design I like!

I've been monkeying with my site design over the past week or so (hit refresh twice if you see any weirdness or don't see the colorful top border) and I've finally got it where I like it. I resurrected the little fixed border at the top from my old site. Here's the CSS in case you care:

#top_border {
background:#ffffff url(/sites/all/themes/kevin/images/stars_border.gif) top left repeat-x;
position:fixed;
top:0px;
left:0px;
height:8px;
width:100%;
z-index:99;
border-bottom:1px solid #666666;
}

Also, a fun little hack to get a little "torn paper" tail on the end of each entry:

ul li.blog_usernames_blog {
display:block;
margin:25px -15px -15px -16px;
padding:15px;
width:572px;
background:#ffffff url(/sites/all/themes/kevin/images/div_node_bottom.gif) top left no-repeat;
}

The only messy part was to create a node-page.tpl.php and add that ul to the bottom of the template so that the effect works on pages.

This whole design thing is pretty fun. I could just keep changin 'er every day, but in the interest of doing something productive [read: I should be cleaning the toilet] I think I'll leave it where it is for a bit!

Long-Term Planning

If you've seen the movie Bottle Rocket, you have to check out this link to screenshots of Dignan's long-term planning notebook. Frickin genious. It reminds me of the times when we were little and we'd create club manifestos for the BMX trails in the woods behind the house with rules like: "No Swearing!"

[littlebanana.com] | From [kottke.org]

Syndicate content