Ben barden

Latest Posts From

Developer Discussion: What Do You Use For AJAX in PHP?

Developer Discussion: What Do You Use For AJAX in PHP?

A quick question with a potentially longer discussion. What do you use for AJAX in PHP, and why?

XAJAX is a simple way to do it, and this is the approach I’ve been using for some time. In very simple terms, you write PHP methods that can be called from JavaScript by prefixing the method name with xajax_.

Tips for Working With Dates in PHP

Tips for Working With Dates in PHP

I’ve often found dates in PHP to be a bit of a pain to manage. A variety of similar functions in the language make it unnecessarily complicated to do what you need to do.

Getting the current date is one thing, but how about adding a set number of days to a date in the future? It’s possible, but not particularly intuitive. Here are a few tips to…

Error Reports: How to Isolate a Bug

Error Reports: How to Isolate a Bug

Whether you’re a tester reporting bugs or a developer who’s trying to clarify a bug report, isolating bugs can be something of an art.

Some bugs are really obvious, such as if you go to a site and every page is down with a server error. Other bugs are much harder to report, as they only occur in certain circumstances. Here are some tips for…

How To: Build Features That Work Really Well

How To: Build Features That Work Really Well

You’ve been asked to build a jump box that will allow users to type into a box and search for a customer id. This is a really simple feature – so how do you build it?

The trick is to build the basic functionality, and then try it out. See what you’ve missed, then go back and make some tweaks. This isn’t so much about fixing a bug or two – it’s…

Database Planning: Avoid Missed Fields

Database Planning: Avoid Missed Fields

Back when we showed you how logging can save you, we touched on the subject of listing fields prior to building your database.

Once you’ve been building software for a while, you may find yourself jumping into the development stage before you’re ready. In some cases this may work just fine, but if you end up missing some critical functionality…

How To: Speed Up the WordPress Admin Panel on a VPS

How To: Speed Up the WordPress Admin Panel on a VPS

A few weeks back, I gave some tips for how to speed up WordPress on a VPS. Several readers suggested using WP-SuperCache. This is a good suggestion, but in my case, it didn’t work.

After a bit of investigation, I discovered that the load issues appeared to be coming from the WordPress admin panel. As far as I’m aware, WP-SuperCache won’t help…

Rollyo: A Fast Way to Make a Searchable Aggregator

Rollyo: A Fast Way to Make a Searchable Aggregator

Rollyo is a simple way to “roll your own search engine”. You can get started by choosing a few pre-defined categories – these contain a list of URLs that you can add to.

It gets a bit more interesting though if you add your own URLs though. From the homepage, click “Create Searchroll” and you can build a custom search engine.

Error Messages: Help Users to Understand What Went Wrong

Error Messages: Help Users to Understand What Went Wrong

Error messages. Not the critical ones that require admin intervention, but those informative bits of text telling you that you missed a field on a form.

Chances are, you won’t see a 100% success rate when people fill in a form on your site. The more complex the form, the more likely it is that people won’t reach the end.

Forms should be easy to…

Developer Discussion: Do You Use Helpers?

Developer Discussion: Do You Use Helpers?

It’s Friday, so it seems like a good opportunity for a discussion post. Today we’ll be talking about helpers – basically, any kind of tool that makes your life easier as a developer.

As the name suggests, helpers can be quite helpful. Apparently, developers are lazy, so anything that makes life easier for us is good. Right?

PHP Security: Sanitizing Strings, Validating Values, and Interrogating Integers

PHP Security: Sanitizing Strings, Validating Values, and Interrogating Integers

Trust no-one. Not just a tag-line for The X-Files, it’s also sound advice when dealing with data supplied by users.

Whether a user is trying to do something nasty or they’ve just hit an unfortunate combination of keys, you shouldn’t assume that what you’re saving is trouble-free. Here are some tips for validating input in your PHP application.

Exploratory Testing: An Unscripted Quest For Bugs

Exploratory Testing: An Unscripted Quest For Bugs

Exploratory testing is a form of quality checking that does not rely on test scripts. A tester is let loose on the system, often with very little introduction, and they are encouraged to report any and all issues they find.

As you’re doing exploratory testing, you attempt to use the system as a user who doesn’t understand where they need to go…

6 Tips for Building Coherent Site Navigation

6 Tips for Building Coherent Site Navigation

When building a website, getting the navigation right is absolutely critical. A poorly conceived approach to site navigation will confuse and frustrate users, and this isn’t the way to get a lot of people using your site.

A big part of this challenge is that you don’t always start with a lot of links, but more may be added as the site develops…

Hack of the Day: Upgrading the TinyMCE Emotion Plugin With PHP

Hack of the Day: Upgrading the TinyMCE Emotion Plugin With PHP

TinyMCE is an extremely powerful WYSIWYG editor that is easy to set up. It comes with a good selection of plugins, which were designed to work without the need for server-side scripts, such as PHP.

One plugin I quite like is the Emotion plugin (yes – it’s Emotion rather than Emoticon – I’m trying not to type it the wrong way). However, it’s a…

Keeping a Change History: How Logging Can Save You

Keeping a Change History: How Logging Can Save You

Keeping a history of changes to your data can be invaluable if something goes wrong. They may also help to analyse the data when things are working well, but you need to know when and how a change occurred.
Here are a few things you should consider including in your application to ensure it’s easy to track changes.

Form Fields: Clearly Identifying the Limits

Form Fields: Clearly Identifying the Limits

The question of how big a form field should be isn’t just about how much you can type into the box. It’s also about how it looks, and whether the user understands how much they can type in before they hit the end of the box.
If you’ve ever filled in a form where it’s not obvious how much you can type in, it can become a very frustrating…

Quick Tip: Assume Root Without Changing Directory

Quick Tip: Assume Root Without Changing Directory

This is a tip I found by accident due to hitting a key twice. The result was a bit of a surprise.
If you only need to run a few commands as root, typing sudo before the command will allow you to do this.
However, it’s sometimes useful to assume root so you don’t have to type sudo in front of every command.

Interview with Richard Clark

Interview with Richard Clark

Today sees our first full interview here at ReadWriteHack, with Richard Clark, a web developer from New Zealand. Richard is a coder who runs a one-man business designing and implementing code, networks and systems for clients at every scale, from tiny silicon valley startups to national corporates and government departments.
He has designed and…

How To: Backup and Restore Your MySQL Database

How To: Backup and Restore Your MySQL Database

Backing up your database is absolutely vital if the data is of any importance. This will save you in the event of an accidental deletion, either due to a slip of the finger or a major failure in your code.

If you’re familiar with phpMyAdmin, then you may be able to export and import your database from there. But this approach doesn’t work too well…

Hack of the Day: Using Flot to Display a Graph

Hack of the Day: Using Flot to Display a Graph

Logging statistics is a two-stage process. First, you need to collect the information and store it. Next, you need to expose this information to end users.

It’s quite simple to display a table of stats for users to look at, and this is a good option if you need to provide a detailed breakdown. But for analysing large datasets or simply providing…

Tips For Logging Your Own Statistics

Tips For Logging Your Own Statistics

Google Analytics (GA) is a decent service for tracking activity on your site, however, there are times when it may be necessary to log some statistics yourself.

By its nature, GA does not include any information that would allow you to identify who visited a page or clicked a link. Also, GA does not give immediate updates – you have to wait up…