Figuring it out, what does “> /dev/null 2>&1″ mean?

From time to time I’ve come across this in line of code, especially when editing a crontab (such as the example below):

5 * * * *  /var/www/username/bin/update_website.sh > /dev/null 2>&1

I found a great article over at xaprb.com that does a pretty good job of explaining it.

Given that context, you can see the command above is redirecting standard output into /dev/null, which is a place you can dump anything you don’t want (often called the bit-bucket), then redirecting standard error into standard output (you have to put an & in front of the destination when you do this).

The short explanation, therefore, is “all output from this command should be shoved into a black hole.” That’s one good way to make a program be really quiet!

Posted in Code, Development | Leave a comment

Display WordPress comments on the home page

From time to time I run across a theme / template where I’ll need to display comments along with the posts on a home / category page. What’s worked well for me is to call a function called “get_approved_comments()“, which needs to know one argument, the post id. The site I’m working on now uses something real similar to the code below: Continue reading

Posted in Code, Development, Web, WordPress | Tagged , , , | Leave a comment

Rotating clouds in the background

This is from a piece of code I hacked up about 9 months ago. It was pretty fun, but kind of a time waster.  Luckily, my employer also got a kick out of it when they saw it. We didn’t use it in production, until the site was at the end of it’s lifespan & even then, you could only see it through an easter egg in the site. Continue reading

Posted in Code, Development, Web | Leave a comment

How I appreciate exceptions

Especially, when it comes to software or services online. For example, a few weeks ago, I found out Google App’s allows our church to upgrade our account from standard to educational since we are a non-profit 5o1c(3) organization. And as our churches Creative Director / System’s Administrator, it makes my job easier; knowing I just got more support, larger storage size for email & tools to help our church collaborate with each other (which the standard version did a really good job at this too). Continue reading

Posted in Development, Technology, Web | Leave a comment

Copying a file from a remote *nix computer to my local machine

Secure File Copy or “scp” is one of those handy tool’s I use from time to time when ssh’d into another server or computer. It’s also one of those I don’t use enough to remember and always have to look up. So, I figured I might as well put it out there in a location I know I can remember (besides Google).

Ok, so on my “terminal” window (I’m on a mac, but pretty sure it’s the same for any other *nix machine, with maybe just a few variances in syntax), I type the following:

Continue reading

Posted in Code, Development | Leave a comment

Listing out Database Table Names

Ok, for WordPress & WPMU, let me preface this post with saying standard WordPress tables can be found by using the $wpdb object (paste the below code and you might be surprised on what’s available to you).

echo "<pre>"; print_r($wpdb); echo "</pre>";

But, let’s say the plugin you’re working with in WordPress isn’t in the $wpdb object & you still need to grab a list of non-standard tables, I’ve been using the below code to grab the information I need. Continue reading

Posted in Code, Development, Web, WordPress | Leave a comment

Plugin: WP-CMS Post Control

One plugin that comes in real handy for a lot of the campaigns we work on is called WP-CMS Post Control. It’s not a power house plugin that changes a core functionality of WordPress, but one that makes working with WordPress defaults a little less annoying.

For us, the two most common settings we change are found right under the General Settings sub-heading; uploader type and post/page autosave. For many of you that work with WordPress day in & day out, you can imagine how handy this may be, but for others who don’t know, I’ll explain a little further. Continue reading

Posted in Development, Plugins, Web, WordPress | Tagged , , | Leave a comment

Enabling, Disabling the WordPress debug setting

This is a handy feature that took a little while to figure out, but’s nice when WordPress is throwing you a blank page and you can’t figure out why.

To enable WordPress debugging on either MU or the standard version open up the wp-config.php file. Continue reading

Posted in Development, SilentGap, Web | Tagged , , , , , , , , | Leave a comment