Bye Perl

Larry Wall creator of Perl

Larry Wall Perl

It’s been a long time in the making, and I should have done it two years ago, but I’m finally all bit rid Perl entirely from my web application development and deployment ecosystem.

You know 10 or 15 years ago, Perl was actually doing some interesting things. I thought mod_perl had a chance to be the next big web application platform, but it didn’t. I love mod_perl and I think it actually works great.

For me though, what’s most interesting about Perl is that it’s not seen a major language upgrade in how many years? I vaguely remember Perl 4, so 5 has been out for well over a decade. And Perl 6 will release after the next Duke Nukem game comes out. There is this, but it looks sketchy, incomplete and lacks the CPAN repository.

Basically, Perl is stale. It’s old. It’s antiquated. It’s no longer necessary.

There’s nothing I can do with Perl that I can’t do with a PHP framework like Symfony, Java, or any other modern programming language. And I can do it with fewer lines of code, fewer bugs, greater performance and using a language in which I can hire other people can maintain.

And so Perl, it is time we say farewell. I’ll miss the challenge, but I’m moving on and I think you should too.

Synch two directories with rsync

If you’ve ever thought, “What’s the easiest why to quickly synch two remote directories?”

If I were going to sync up two remote directories I would do this.

rsync -avz .

If I ran this command in a directory called Maildir.backup, all of the contents of the remote Maildir would be in there.

If I ran this command instead.

rsync -avz .

Noting the lack of a trailing slash on the source directory, in this case a Maildir directory would be created, if it didn’t already exist.

Sometimes I use rsync when I’m migrating servers. I’ll do an initial rsync of the old server applications to the new server. That will allow me to test out all of the applications to make sure I didn’t miss anything. Once I’m satisfied with the new server, I’ll run rsync again and pull down any changes that may have happened on the old server so that the two servers are totally synched before flipping the switch.

It’s also super handy for backing up directories.

Joddit Global CSS Fixed for WordPress 4

I really like the simple CSS plugin — Joddit Global CSS. It works great. Well, it worked great until I upgraded to WordPress 4. Then it broke.

After upgrading, I couldn’t see any of my stylesheets via the admin interface, but they were still loading.

So I posted a message to the author of the plugin to let them know there’s a bug and that I’d be happy to help out with fixing it.

I didn’t hear back from the author, but it seemed like an easy enough thing to fix, which it was.

The problem with the Joddit Global CSS plugin is that it uses the WP_List_Table class that comes with WordPress. You aren’t supposed to do that.

According to the WordPress documentation, plugin and theme developers are supposed to make a copy of the version of WP_List_Table and include it with the plugin or theme that needs it. The one included with WordPress is subject to change and will break code that relies on it directly, even sub-classing it is wrong. That’s what happened with Joddit Global CSS.

So I made a copy of the version of WP_List_Table (class-wp-list-table.php) from WordPress 3.9.2 and put it in the plugin lib director. I changed the name of the class from WP_List_Table to My_List_Table to avoid collisions with WordPress core and other plugins or themes that could load WP_List_Table.

So if you’re running WordPress 4 and you can’t see your Joddit Global CSS stylesheets in the admin, just run my tweaked fork.

In your plugins directory, after you delete or remove the version of Joddit Global CSS is in there, clone my Git fork of the plugin.

git clone

How to Add a Linux User for Mail but Not Login

I’ve had to, from time-to-time, create users on Linux boxes that need to connect via IMAP to get email, but they can’t SSH or login to the server.

There are certainly more elaborate ways to solve this problem, but here’s my ghetto solution.

When creating the user set their shell to /bin/false.

useradd --shell /bin/false gack

Now when gack tries to SSH into the server, he can’t get in. But gack can get email via IMAP using SSL to encrypt gack’s password. The SSL part isn’t technically necessary, but only a fool would be sending plain text passwords around like that.

I remember researching this and I initially I thought the –disabled-login on useradd would do the trick, but no. It’s strange, on my Debian server, the man page for useradd doesn’t even mention –disabled-login, but it’s totally an option.

The problem is that while –disabled-login does in fact disable the login, it does so by putting an ! in the /etc/shadow file for the user’s password. If the user’s password in the /etc/shadow file is an exclamation point, they can’t login, but they also can’t get email either, since they’re account is disabled. It makes sense.

If however, you set the user’s shell to /bin/false, she can get email but can’t login via SSH.

And if you forget the –shell parameter when calling useradd, you can just edit the /etc/passwd file and set it there.

Tip Jar

If you think what I’m publishing here is worth more than nothing and you want to see me keep publishing, leave a tip.

When I bartend, I get a buck for pouring someone a beer, the shit I’m doing here is worth at least a dollar.

And no, I don’t want to sell ads.

Configure Netbeans to Auto-upload Files using SFTP

Here’s how to configure Netbeans to automagically upload files to a server using SFTP.

Before you can begin, you have to have a Netbeans project. No, wait, you actually need to have Netbeans installed. So if you don’t have Netbeans installed, or you don’t know what Netbeans is, you should go get it. If you’re an emacs user, this tutorial will be totally meaningless.

Open Netbeans.

Select a project properties and select “Run Configuration” under Categories.

In the “Run As,” select “Remote Web Site (FTP, SFTP).”

Screen shot 2014-10-17 at 10.23.09 AM

Now setup a “Remote Connection.” To do that click the Manage button.
Screen shot 2014-10-17 at 10.23.57 AM
Add and configure your server connection and select whether it’s FTP or SFTP. Do people still use FTP?

Once you’ve got the connection configured, you can set the “Upload Directory.” That’s the directory on the server where your files will land.

You can choose to upload your files manually, on save or on run. I’m usually doing this sort of thing because I can’t execute the code on my local machine, so I upload on save.

Netbeans IDE



My preferred editor for at least 10 years was emacs. I still love emacs and use it often, but Netbeans has definitely won me over.

Is Netbeans perfect? Not by a long shot. I find the keyboard controls to be clunky and difficult to make work for how I prefer to code, but I’ve figured it out.

What I really like, is the ability to integrate Netbeans into various development environments.

Sometimes I find myself working with version controlled source code. That’s awesome. But sometimes I get stuck dealing with an organization that, for some insane reason, doesn’t use version control. So the auto-upload SFTP on save feature is really nice.

I also like the color coding, syntax highlighting and quick formatting controls in Netbeans.

What I hate about Netbeans is that it’s a resource pig. And if I leave it open long enough, it eventually makes my workstation unusable and I have to restart Netbeans.

But for me, Netbeans is a better editor than emacs. It’s just easier. I guess I’m getting old and lazy.

Common Alerting Protocol Version 1.1

For my job building web services for the government, I’m currently tasked with adding an alert feature to the state’s amber alert system.

To do that I’m going to build a Common Alerting Protocol version 1.1 feed.

The sample Common Alerting Protocol version 1.1 looks like this.

<?xml version="1.0" encoding="utf-8"?>
 <alert xmlns"urn:oasis:names:tc:emergency:cap:1:1">
 <event>Child Abduction</event>
 <senderName>LOS ANGELES POLICE DEPT - LAPD</senderName>
 <headline>AMBER ALERT</headline>
 <description>DATE/TIME: 06/11/03, 1915 HRS. VICTIM(S): KHAYRI DOE JR. M/B BLK/BRO 3'0", 40
 BRO EYE. VEHICLE: 81' BUICK 2-DR, BLUE (4XXX000).</description>
 <contact>DET. SMITH, 77TH DIV, LOS ANGELES POLICE DEPT-LAPD AT 213 485-2389</contact>
 <areaDesc>Los Angeles County</areaDesc>

I found this CAP file format validator to be useful.

Improve Google Adwords Performance with Placements

Screen Shot 2014-10-15 at 9.56.20 AM
A low Google Adwords click-thru rate could be because of the sites your ads are running. Adjusting your ad campaign placements can greatly improve your click-thru rate and your ad performance.

If you haven’t tweaked your Google Adwords placements, there’s a good chance your ads are getting tons of impressions on sites that will likely not lead to a click, for instance, GMail.

To fix this, login in to your Adwords account.

Click on a campaign.

Click on Display Network tab.

Click on Placements tabs.

It should look something like this.

Google Adwords Screenshot Google Adwords Placement Edit Menu

Look through the list of sites your ads are running on. Look for the ones that are generating a ton of impressions, but very few clicks. Look for sites that are irrelevant to your ad campaign. Click the checkbox for sites you want to exclude.

Rather than excluding from the Ad Group, I recommend scrolling to the top of the list, click the Edit button and select exclude the selected sites from the entire campaign.

How To Insert Custom WordPress Plugin and Widget into any WordPress Post or Page

Screen Shot 2014-10-14 at 4.02.55 PMHave you ever wondered how to create a custom WordPress plugin and a custom WordPress widget, and you want to be able to embed your new custom WordPress widget in any page or post? If so, you my friend have come to the right place.

Keep reading and you will learn how to install a custom WordPress plugin and a custom WordPress widget. You will also learn how to insert aforementioned custom WordPress widget into any WordPress post or page.

To show you how to do all of this, install a this WordPress plugin called percentager. Just download it, clone it, fork it, or whatever from Github.

If you’re cloning, in your wp-content/plugins directory run this:

git clone

Obviously if you forked it, you need to change the URL.

Let’s digress for one second. Why are we installing a WordPress plugin called “percentager”?

Figuring out the percent different between two numbers is something I have to do often. Embarrassingly, I have to think about how to do it for a minute. I can always come up with the correct answer, but it takes me longer than I think it should.

So instead of waiting to get smarter, I just created this little WordPress plugin and a custom WordPress widget, shown here.

Percent Change Calculator

The difference between X and Y is a Z

This WordPress custom plugin consists of the following files.

Your percentager.php file should look like this.

With the percentager custom WordPress plugin installed and activated, let’s add it to a post. You activated it right? If not, do that before continuing.

To add the percentager custom WordPress widget to a post or page, you have to install AMR Shortcode Any Widget. Do that.

Once you have the AMR Shortcode Any Widget installed and activated, go to Appearance -> Widgets. There you will now see “Widgets for Shortcodes.” You should also see the Percentager widget. Drag Percentager onto the “Widgets for Shortcodes” box.

Now Percentager is available to be included in a posts and pages.

Create a post and add this to the body in Text mode.

[do_widget Percentager]

If you did everything correctly, and I didn’t mess up my instructions, you should see the Percentager widget in your new blog post. It’s a great way to customize pages and posts with custom WordPress plugins and widgets.

I hope you enjoyed this post. If you need help customizing your WordPress site, I’m available for hire, send me a message.

Writers Demand a Living Wage

Writers need to stop working for chump change.

If you’re a writer and you work for less than $200 a day, you are a chump. Just think about it, if you work 8 hours a day at $200 a day, that comes out to only $25 an hour. And for self-employed people that’s before you pay both sides of the payroll tax.

Just the other day I was working with an editor for Smashing Magazine on a story pitch. Everything was great until we started discussing money.

The story was to be about Symfony. It was to show designers and developers how to spin up a Symfony framework, and to demonstrate how quickly one can utilize Symfony to get to the creative stage quickly.

To write a story like that with a working Symfony sample application would take several days. I would have included at least one interview.

The editor wanted to pay me $250. I wanted $800. The editor wasn’t able, or willing, to pay me what I wanted. He did assure me that my story would reach a large audience. While Smashing Magazine has a large audience, that apparently doesn’t equate to paying writers what they’re worth. I’ve been published hundreds and hundreds of times and don’t get excited about getting a byline. Therefore, I won’t be writing for Smashing Magazine.

More writers need to be willing to walk away from a bad deal. Accepting low rates for your writing is ruining it for everyone.

I understand that noobs need to do what they need to do get published, but once you’ve established yourself as a professional writer and you can write with a voice, expect to be paid, and if you aren’t, walk away.