My WordPress plugins

By , September 14, 2011 8:44 pm

I attended a great Seattle WordPress Developer Meetup this evening and a hot topic was what plugins to use for various things. I decided that until we have an official WordPress Seattle Developer's website I will post the plugins I am fond of here. Feel free to comment with better plugins or ideas for new plugins!

  • AlexaRank - Shows your website ranking compared to millions of other websites. This is just a fun plugin
  • AntiSpam Bee - Amazing plugins that stops 99.9% of all spam in it's tracks. Love it, install it on all client installs
  • AntiVirus - Helps protect your blog against known exploits and injections. Seems to work very well. I generally install it for all clients
  • Blog Metrics - Interesting plugin that shows metrics about the posts on your blog. I rarely actually check this but it is interesting sometimes.
  • CLI Switch - Super fun plugin that switches your WordPress website into a terminal. Try it here http://ben.lobaugh.net/blog/cli. A fairly pointless plugin overall
  • CodeHighlighter - Awesome plugin for posting code snippets. Changes highlighting mode per language. Unfortunately it is not available anymore, though you can email me if you want a copy.
  • Events Manager - A very powerful and capable events plugin. I highly recommend trying this one out
  • FancyBox for WordPress - Makes all the images in a post pop up in a pretty fancybox dialog
  • FoxyShop - Powerful yet easy to use looking shopping cart. Disclaimer: I have not used the plugin actively yet
  • Google Analytics for WordPress - Does like it says, adds the javascript for Google Analytics to the posts. Works well
  • Tweet, Like, Google +1 and Share - Adds simple, discreet sharing buttons to your posts. Fastest plugin for social sharing I have used
  • WP SlimStat - WordPressified version of SlimStat. Simply an awesome plugin that collects stats you can view right in WordPress. I use these stats much more than Google Analytics. It is also generally easier for clients to learn.

There you go. Try not to look for vulnerabilities in those and hack me now ;)

Introducing paz: a simple packaging and deployment tool for PHP projects on Windows Azure

By , September 9, 2011 5:57 am

These days PHP works well on Windows Azure, and there are some great tools available in the Windows Azure SDK for PHP that will help you build, package and deploy your applications. Even though there are some excellent tools available in the PHP SDK they still require a good amount of effort and complexity to properly get from your PHP application running locally in Windows Azure. With that in mind I set out to create a tool that takes the headache out of getting your existing PHP application off your hard drive and into Windows Azure with paz. paz is a simply packaging and deployment tool for PHP projects on Windows Azure. Simply give it the path to your project and let the magic happen. In a few short seconds you will have either a project running in a local Windows Azure development environment or a package ready to be  uploaded to Windows Azure itself. The following is an example of a command that will create a deployment package:

paz -in path/to/sources

After the command runs you will be able to find the package in path/to/sources/build.

paz is still in the infant stages but if you are doing work around Windows Azure with PHP I highly encourage you to check out this simple and easy to use tool. Send me some feedback on Github with bugs, likes, dislikes and feature requests. I also highly encourage you to read the tutorials put out by the Microsoft Interoperability Team about PHP on Windows Azure on the AzurePHP website

You can find documentation and sorce code for paz on the Github project page at http://github.com/blobaugh/paz

In this release paz does not provide the functionality to deploy that package it creates but there is hard work being done to implement it!

PHP: Recursively remove a directory and all files and folder contained within

By , August 22, 2011 5:16 pm

The rmdir function of PHP cannot remove a directory if it has anything inside of it, whether it be files or folders. The following method can be used to recursively remove all the files and folders from the directory, and will remove the directory itself. To use it simply copy the code into your application and call rrmdir with the path to the directory you would like to remove.

 
/**
 * Recursively removes a folder along with all its files and directories
 *
 * @param String $path
 */
function rrmdir($path) {
     // Open the source directory to read in files
        $i = new DirectoryIterator($path);
        foreach($i as $f) {
            if($f->isFile()) {
                unlink($f->getRealPath());
            } else if(!$f->isDot() && $f->isDir()) {
                rrmdir($f->getRealPath());
            }
        }
        rmdir($path);
}
 

PHP: Recursively create directories

By , August 22, 2011 4:49 pm

The mkdir function in PHP is great for creating directories, but what if you need to create a new directory structure? For example, you run mkdir("/this/is/a/path") but only "/this" exists. mkdir will fail because /this/is/ does not exist. The way to solve this is to pull the path apart and check each segment to ensure that it exists and create it if it does not exist.I created a recursive mkdir function and would like to share it with you. To get this to work simply copy the function into your code and call rmkdir instead of PHP's mkdir.

 
function rmkdir($path) {
    $path = str_replace("\\", "/", $path);
    $path = explode("/", $path);
 
    $rebuild = '';
    foreach($path AS $p) {
 
        if(strstr($p, ":") != false) {
            echo "\nFound : in $p\n";
            $rebuild = $p;
            continue;
        }
        $rebuild .= "/$p";
        echo "Checking: $rebuild\n";
        if(!is_dir($rebuild)) mkdir($rebuild);
    }
}
 

ZDD: Time for a new headsail setup

By , August 15, 2011 8:51 pm

I am having tons of fun with my new toy zzZippety Doh Dah, however after piloting Neptune's Car for a few hours the race bug has bitten me. There is nothing like screaming along the water with the wind trying to rip your hair off and the sails straining to get away from the rigging! Unfortunately ZDD has a set of rather old sails. Not only are the sails old, the head sail is the wrong size for the boat! The bottom of the sail gets caught up on the life lines and is not able to fully flair out and make that beautiful shape that sets the heart aflutter.

I am going to move the front lifelines down so the sail will go over the top. That should help until I get the new jib furler setup that I am wanting.

Take a look at this picture I took with my phone while out today. Notice the bottom of the sail all bunched up on the lifeline. Could have squeezed another knot or two out if it was not hung up.

Now check this out, the lifelines are entirely hidden behind that sail. This happens when I tack and is annoying because I cannot get the sail out over the side to fill with air unless is over steer first.

If anyone happens to know of a furler that fits a North American Spirit 23 please let me know!

Unplugging the fuel system on an outboard motor

By , August 3, 2011 8:08 am

zzZippety Doo Dah has a 7.5 horse power Honda outboard hanging off the transom. In the past this motor has been solid, firing up after one or two pulls on the cable.  The past two times I have taken it out however, the motor had all sorts of issues staying running at low RPMs. The throttle had to be at least half open, which meant lots of noise and high RPMs, not to mention causing the sailboat to scream around the marina when I pulled out. I had a similar problem to this a couple years ago with my 1965 VW Bus where the outlet of the fuel tank was full to junk and fuel simply was unable to get to the motor unless the motor was working hard enough to suck it out. After consulting with the good Mike of the beautiful sailboat Serenity we both came to the conclusion that this was probably the same issue with the outboard. Hoping for a cheap fix I hopped over to a store and picked up some Gumout Fuel System Cleaner and added it to my tank. After fiddling with the motor for a few minutes it roared to life. I let it idle high for a minute then yanked the throttle down quickly and viola! The motor sat there purring beautifully.

Then (after checking my lines of course!) I put the outboard in F and opened the throttle up to 3/4, let it run for a few seconds, and put it immediately back to idle with no issue. Been working great ever since.

Moral of the story is? Try the cheap solution first and you may be happily surprised! :D

New Toy: North American Spirit 23 – zzZippety Doo Dah

By , July 27, 2011 7:55 pm

This post is well overdue, by a couple of months actually...sorry.

A few years back I became interested in sailboats when a friend began looking for one, and my aunt began telling me stories of her time living aboard a sailboat. I started doing some research of my own and after several months I came to the conclusion that when I moved back near the Puget Sound I would be interested in acquiring my own sailboat. Over the next couple years I regularly read articles on sailing and specific sailboats, surfed Yacht World looking at types, sizes, and prices, and checking out Craigslist to see what was available nearby. Originally I wanted to get a large sailboat that I could live on (trust me, it's way cheaper in Seattle to live on a boat than to rent an apartment!) but after sitting down and defining my life goals over the next two years I realized the trade off would not allow me to accomplish my primary long term goal, but a smaller sailboat without live aboard features might do fine. The only problem with small sailboats is that I do not like the way most of them look. Lines are very important to me and little sailboats just aren't all that great to look at.

Fast forward to two months ago, I was sitting at my desk at work waiting for a project to build and hopped on Craigslist looking at...you guessed it, sailboats. Up pops a post for a North American Spirit 23 within a 50 minute drive. I loved it! The lines are beautiful and it is a rare boat, which makes me like it all the more as I like to have something just a little different (I drive a 1965 VW Bus remember?). I called the seller and went out the next day to take a look. The hull was in great condition, paint needed redone, and the motor was in the shop, but she was gorgeous. I wanted her, but I forced myself to walk away and think it over. As you guessed I did in fact buy the sailboat, the next day. I figured she was cheap enough that it would not matter if something bad happened, like finding out I hate sailing. Lucky for me I knew I would love it and I do.

It is my extreme joy to introduce to you now zzZippety Doo Dah, a 1977 Spirit 23 who has found a loving new owner in me.

zzZippety Doo Dah - pic from previous owner

I purchased her in Everett, Washington and motored all the way to Bremerton, Washington due to lack of wind. It was a long trip(s). I hopped from marina to marina, making a route from

  • Everett to Edmonds
  • Edmonds to Elliot Bay
  • Elliot Bay to Bremerton

each hope took at least 4 hours and was completed around my regular work schedule. Everything went smoothly once I actually made it out of the Everett marina, however while still inside the breakwater in Everett my outboard Evenrude 15 hp bit the dust. The seller told me he had it rebuilt and installed it the day before I picked up the boat, however when I pulled the top off it clearly had never been rebuilt, the yacht repairman confirmed my suspicion. The next morning I had a shiny new (well it's a used motor) Honda 7.5 hp outboard hanging off my boat and was ready to take off on my adventure. The Honda ran great all the way down to Bremerton and does not give me any problems if I give the enginve time to warm before putting a load on her.

And there you go, the story and the boat. Every boat has something the owner wants to change and here is my short list (luckily small sailboats are relatively cheap to work on!)

  • New rigging
  • Replace all running lights with LED bulbs
  • Install a new depth finder
  • Run new life lines
  • Pick up some new sails (mine work but are old and worn)
  • Scrape all the growth off the hull (years worth, clearly the seller had not cleaned it like he said...)
  • Repaint the hull and change the color
  • Sew up some new cushion coves for the cabin (the cabin is HUGE for this small of a boat)
  • Look for a cheap manual headsail furler (nice to have but optional)
  • Install an automatic electric bilge pump (the owner of the beautiful Hello Gorgeous sailboat donated an extra for my cause, thanks Jody!)
  • Lube up the track for the mainsail (right now it is a chore to get the sail down :( , it should just drop)

There it is, my list. And now Here are some pictures for your viewing pleasure!

Piloting Neptune’s Car

By , July 24, 2011 11:29 pm

This evening I received a pleasure few will have, the chance to pilot the beautiful award winning racing sailboat Neptune's Car. Neptune's Car is a beautiful 1989 Santa Cruz 70' racing sailboat designed by Bill Lee for racing from California to Hawaii. Neptune's Car has won awards at races an she is fast!

Neptune's Car

When she is not out racing, Neptune's Car is used by Sailing Seattle as a private charter. Several times a day she takes enthralled passengers across Elliot Bay in the Puget Sound. A friend was in town for a visit so I booked us on the 2.5 hour sunset cruise and after talking to the 2 crew members for about a half hour they asked me to take the helm, which I piloted from for the rest of the cruise!

She is big, she is beautiful, handles like a dream, turns on a dime, and cuts through the water like a hot knife through butter.

Law regulates the maximum sail area for charter boats and she had an 85% headsail up. The crew guessed she would make around 12 knots as a general max, but the wind had gone down significantly through the day and was pretty low.Even still I got her up to 11.9 knots and quite impressed the crew and myself, though I think I scared the daylights out of the passengers since I had her heeled over so far her rail was almost in the water.

It is not a night I will soon (or ever) forget. Sailboat racing has forever injected itself into my blood stream and I have to have more!

EDIT:: Snapped a picture of her docked the next day

Neptune's Car docked at Sailing Seattle

PHP 5: Recursively move or copy files

By , July 15, 2011 1:01 pm

I was looking for a quick code example on recursively moving files with PHP and I only saw code snippets using PHP 5. I like using the new and powerful features of PHP 5 when doing file system interactions so I wrote two quick PHP 5 functions that will move or copy directories and files recursively. That means your entire file tree will be moved or copied. The following is the code you can use for reference with your own recursive move or copy functions.

Move

 
/**
 * Recursively move files from one directory to another
 *
 * @param String $src - Source of files being moved
 * @param String $dest - Destination of files being moved
 */
function rmove($src, $dest){
 
    // If source is not a directory stop processing
    if(!is_dir($src)) return false;
 
    // If the destination directory does not exist create it
    if(!is_dir($dest)) {
        if(!mkdir($dest)) {
            // If the destination directory could not be created stop processing
            return false;
        }
    }
 
    // Open the source directory to read in files
    $i = new DirectoryIterator($src);
    foreach($i as $f) {
        if($f->isFile()) {
            rename($f->getRealPath(), "$dest/" . $f->getFilename());
        } else if(!$f->isDot() && $f->isDir()) {
            rmove($f->getRealPath(), "$dest/$f");
            unlink($f->getRealPath());
        }
    }
    unlink($src);
}
 

Copy

 
/**
 * Recursively copy files from one directory to another
 *
 * @param String $src - Source of files being moved
 * @param String $dest - Destination of files being moved
 */
function rcopy($src, $dest){
 
    // If source is not a directory stop processing
    if(!is_dir($src)) return false;
 
    // If the destination directory does not exist create it
    if(!is_dir($dest)) {
        if(!mkdir($dest)) {
            // If the destination directory could not be created stop processing
            return false;
        }
    }
 
    // Open the source directory to read in files
    $i = new DirectoryIterator($src);
    foreach($i as $f) {
        if($f->isFile()) {
            copy($f->getRealPath(), "$dest/" . $f->getFilename());
        } else if(!$f->isDot() && $f->isDir()) {
            rcopy($f->getRealPath(), "$dest/$f");
        }
    }
}
 

How to find your Reason 5 license key with the Record 1.5 upgrade

By , July 7, 2011 6:43 am

Recently I tried to install the Record 1.5 upgrade for Reason owners. When i ran the Reason 5 installer I was asked for a license key, which I could not find in the box. As it turns out Propellerhead does not supply you with a Reason 5 license in the Record 1.5 for Reason owners box. There is however a license for Record. Here is what you do to get your Reason 5 license.

- Visit the Propellerhead website and logn to your account or create a new account if you do not have one
- Find the card containing your Record license and registration key
- Navigate to "Your Products" and enter a new Record product
- After you have successfully registered Record, return to your products page and you will see a license for Reason 5

I am not sure about the thought process that went into this weirdness, but I am glad to finally be rocking Record 1.5 and Reason 5!

Theme by Blam Designs
Based on Themocracy