UNIX Count total number of lines in all files recursively

Recently I have been working on a fairly large product alongside one other developer and out of interest was keen to discover roughly how many lines of code we had written between us.

The following snippets use the wc command and can be run on the command line to output the total number of new line characters present in all files within a directory recursively.

wc -l `find /path/to/directory/ -type f`

Continue reading

WordPress Custom Shortlink Domain Plugin

If you are like myself and have an alternative or shorter domain name that you would prefer to use for the built-in WordPress URL shortening service, then this may just be the perfect plugin for you.

The Custom Shortlink Domain plugin was committed to the WordPress Plugin Directory today (2012-04-07) and provides the ability to override the domain name used. Continue reading

Eclipse Indigo LDAP Browser plugin installation guide

If you have recently installed or upgraded to Eclipse Indigo 3.7.x and require use of the LDAP browser functionality to connect to and manage an LDAP server from within Eclipse, rather than downloading the entire Apache Directory Studio you can simply install the LDAP browser plugin.

To install this plugin you will need to launch the Eclipse Indigo application and in the main menu bar go to Help > Install New Software. Continue reading

Using front-end AJAX requests in your WordPress plugins

Although it is fairly uncommon to be adding AJAX functionality to your WordPress plugins, it can be necessary for it to be added. Luckily it is quite easy and straight forward to integrate the required components as and when they are required.

To help explain how this can be achieved, we will be creating a plugin called “Ajax Example“, stored in the folder “ajax-example” inside the plugin directory of your WordPress install.

Continue reading

Forcing a WordPress plugin to be loaded before all other plugins

When you activate a plugin via the WordPress admin panel it calls the action hook “activated_plugin“, which updates the “active_plugins” site option stored in the database to determine which plugins your site should load.

The option value is a serialized array of the active plugins saved in alphabetical order according to the plugin directory and file name, for example:

Continue reading

Adding custom columns to the WordPress comments admin page

Adding custom columns to the WordPress admin pages is fairly easy, however not all the filters available to you are displayed on Plugin API Filter Reference page. The following article will take you through the process of adding additional columns to the comments admin page using two undocumented filters.

If you are not a plugin author intending to use this functionality within a plugin, you should place the following code examples into your theme’s functions.php file.

Continue reading

Connecting to an Apple Time Capsule Disk over the internet (WAN) using Windows

If you are like myself and sitting on the fence between Windows and Apple based products, you may want to communicate between Windows1 and your Apple Time Capsule Disk both locally (LAN) and via the internet (WAN).

Setting up the Time Capsule Disk as just a local network drive is fairly easy2, however there is little instruction on sharing disks over WAN if you’re using Windows.

Continue reading

WordPress append page slug to body class

Styling different pages in WordPress is a relatively easy process if you make use of the default body classes that are made available to you, especially the unique page ID class “page-id-123“.

The problem with using the ID class to identify an individual page is that a page ID can quite easily change when working with a development version or even migrating your blog from one install to another. Continue reading

How to remove the Admin Bar in WordPress 3.1 correctly

Although the WordPress Admin Bar can be hidden by a user visiting their profile page in the Admin Panel (Users > Your Profile), there may be a situation where you want to force the removal without instructing the user to amend their settings or updating their settings automatically.

When the issue of removing the Admin Bar first cropped up, the solution was to remove the associated init action, however this is not the correct method of disabling it and should not be used. Continue reading

Fixing the incorrect auto date and time on the iPhone 4

If you are having problems with your iPhone 4 displaying the incorrect date and time when using the “Set Automatic” option, there are a number of possible solutions that could fix the problem.

The issue in my case seemed to be caused by the the phone shutting down automatically due to an empty battery, although there may be other causes. Continue reading