Wordpress Search and Replace

I just ran across a Wordpress search and replace plugin.  I don’t have an immediate use for it, but with how much search and replace I do, I know it will come in handy.

The plugin allows you to enter a search query, select places to search and enter a replacement query.  There are all kinds of useful applications for this.

How to Mount an ISO Disk Image on Windows 7

I had previously been using daemon tools to mount image files, but there isn’t a version for Windows 7 yet.  Someone I work with needed to mount an ISO in Windows 7, so I found another way, using PowerISO.  Power ISO is easy enough to use and did the job on 7, so I’m happy with it for now.

Given that Daemon Tools has become a bit of bloatware, I might stick with PowerISO.  We’ll see.

Managed Software Betas

Are you spending valuable development time working on managing your online beta?  Prefinery has made this process a lot easier with managed solutions including adding a website splash page, taking sign ups and rolling out users when ready.  It even exports data to highrise if your group is using highrise for organization.

Prefinery is a complete outsourcing solution for the whole beta invite process.  Let your developers spend time on your product, not on the invite process.

Center an Unordered List

I’ve always thought centering LI elements was impossible. Here’s an basic example of how to do it:

#footer-menu { text-align:center; list-style-type:none; margin: 0; padding: 0; }
#footer-menu li { display:inline; padding: 0 10px; }
<ul>
     <li><a href="#">Page 1</a></li>
     <li><a href="#">Page 2</a></li>
     <li><a href="#">Page 3</a></li>
     <li><a href="#">Page 4</a></li>
     <li><a href="#">Page 5</a></li>
</ul>

Drupal vs. Wordpress

I’ve been working on a Drupal site this past week or two. I had done absolutely zero with Drupal before that and had to essentially power learn the CMS just for this project. As this was straying away from my comfort zone, Wordpress, I started keeping in mind comparisons to Wordpress. I have to admit I am still a noob to Drupal and don’t know all the tricks so the below opinions should be taken with my situation in mind.

Drupal
Pros:

Integrated PHP into Content - Wordpress has different plugins that let you use PHP in posts but Drupal is far and away more efficient at this.

Awesome User SystemThe user system on Drupal works really well and very extendable with really advanced permissions.

Integrated AdministrationContent administration is built right into the main theme. Wordpress has 2 different sides, the site and the admin backend.

BlocksThis is more a neutral than a pro. Blocks can get annoying to edit here and there when Wordpress sidebar widgets are much easier. This is more like Joomla, in that you set different sets of content into specific areas of the page called blocks.

Cons:

Manual Module InstallWordpress lets you search and automatically install plugins right from the backend

Complicated ThemingCreating themes was very complicated in Drupal, at least for me. There are a few strange things when you are new to Wordpress, The Loop for example. But I had a much harder time with drupal.

Lack of customization
This is the most frustrating thing for me. I like what modules do for me but I need to style the output I get back. For most of my issues I had to go in and edit functions inside the module files and even the core files itself. That is some really advanced stuff for a supposed user-friendly Content Management System. In Wordpress, I RARELY had to edit plugins since they offer enough css to style it or plenty of other options. If I did you could edit it in the backend or in dreamweaver in glorious COLOR. Drupal uses a .module extension which you have to add to Dreamweaver to tell it it is safe to even open it. Plus there is no color scheme to a .module extension even though its all php. Thanks for the hassle. Also, the Wordpress plugin/hook system is much easier to understand then the Drupal API layering.

Debugging
This might only be my case but I ran into multiple problems where what was showing is not even close to the logic used. What my source html and CSS code was listing contradicted what my eyes say. I have just noticed a weak error layer with Drupal.

Documentation/VersionsDrupal comes in a few different versions but the problem is many have drastic changes. How something is coded is changed in each version. You can’t say you know Drupal unless you know how to make a site in each version, 4, 5, AND 6. Wordpress has compatibility issues between versions, mainly in plugins, but change in actual core functions is VERY minimal in WP. Drupal’s multiple version also resonate a whole other problem. Documentation is HORRIBLE. Drupal’s home site will tell you how to do different functions in each version but not alot of example or variations or implementations, and most of all a huge lack of help when trying to find out what arguments a function takes and what they do. Worse yet, to find solutions for your issues on any other site is a nightmare since how you handle something in Drupal 5 could be completely different than 6.

Now if I got a little more comfortable in Drupal AND I had to build a huge community-type site, I would consider Drupal. Just the user system would save a bunch of time that way. But for any other type of site I can’t see any reason not to use Wordpress.

I guess this post wasn’t a very close argument in my mind. A more close comparison might have been Joomla vs. Drupal but I’m not sure if I could make a verdict on that. But the point of this post is…after a week or so of pure Drupal grinding all I could do was think about Wordpress as if she was the girl that got away.

PHP: Recursively chmod(), chown() and chgrp()

I recently needed a way to recursively modify file permissions.  I was able to accomplish this with a few basic recursive functions, chmodr(), chownr() and chgrpr():

chmodr()

function chmodr($path, $filemode)
{
    if (!is_dir($path))
        return chmod($path, $filemode);
 
    $dh = opendir($path);
    while (($file = readdir($dh)) !== false)
	{
        if($file != '.' && $file != '..')
		{
            $fullpath = $path.'/'.$file;
            if(is_link($fullpath))
                return FALSE;
            elseif(!is_dir($fullpath) && !chmod($fullpath, $filemode))
                    return FALSE;
            elseif(!chmodr($fullpath, $filemode))
                return FALSE;
        }
    }
 
    closedir($dh);
 
    if(chmod($path, $filemode))
        return TRUE;
    else
        return FALSE;
}

chownr()

function chownr($path, $owner)
{
    if (!is_dir($path))
        return chown($path, $owner);
 
    $dh = opendir($path);
    while (($file = readdir($dh)) !== false)
	{
        if($file != '.' && $file != '..')
		{
            $fullpath = $path.'/'.$file;
            if(is_link($fullpath))
                return FALSE;
            elseif(!is_dir($fullpath) && !chown($fullpath, $owner))
                    return FALSE;
            elseif(!chownr($fullpath, $owner))
                return FALSE;
        }
    }
 
    closedir($dh);
 
    if(chown($path, $owner))
        return TRUE;
    else
        return FALSE;
}

chgrpr()

function chgrpr($path, $group)
{
    if (!is_dir($path))
        return chgrp($path, $group);
 
    $dh = opendir($path);
    while (($file = readdir($dh)) !== false)
	{
        if($file != '.' && $file != '..')
		{
            $fullpath = $path.'/'.$file;
            if(is_link($fullpath))
                return FALSE;
            elseif(!is_dir($fullpath) && !chgrp($fullpath, $group))
                    return FALSE;
            elseif(!chgrpr($fullpath, $group))
                return FALSE;
        }
    }
 
    closedir($dh);
 
    if(chgrp($path, $group))
        return TRUE;
    else
        return FALSE;
}

Amazon Releases Relational Database Service (Amazon RDS)

Amazon has released a new cloud service, the relational database service.  The service allows a sysadmin to launch an EC2 instance running MySQL without the trouble of patch management and backup.  The instance is fully MySQL compliant so any code which runs against a MySQL database should be fully functional, including native MySQL connectors.

While the Amazon instances are fairly scalable, there is no word yet on clustering multiple instances for redundancy or capacity.

Outside of Amazon’s marketing speak, it also saves the headache of trying to save your MySQL data to elastic block store instead of to your ec2 storage, which isn’t persistent.

From Amazon’s point of view, RDS will increase the ease of use of EC2 and probably sell more instances.

Replacing the Hard Disk on a Mac Mini

I was thinking about doing this until I saw how involved it was.  My Mac Mini has 160 GB of storage, which is not even close to enough.  I am confident I would succeed in the upgrade, but considering the drive is a 2.5 inch drive anyway, the cost to benefit ratio just isn’t there.  I think instead I’ll look for some good network attached storage.

I Love MySecureShell

MySecureShell is an application which modifies SFTP to allow chrooted connections and remove shell access.  I couldn’t be more impressed with how it works or how easy it is to set up.

However…

Lately, the debian and ubuntu repositories haven’t been working.  Installing packages by hand is somewhat annoying.  I know, it’s nothing compared to compiling from source, but still annoying.

Consider this my formal proposal to host MySecureShell’s Debian and Ubuntu repositories, mysecureshell.free.fr.  Since I can’t seem to reach the developers, I hope they reach me.

How To: Recursively Search Text Files on Linux

I have often used a handy script to recursively search text files on a linux machine (recursively grep). The script is written by Joe Grossberg and is currently on version 2.0.  The second version adds handy colorful output.