Archive for the ‘Tech’ Category

Using Apache Bench to load test your website

Monday, June 25th, 2012 | Life, Tech

Apache comes with a cool load testing script called Apache Bench, which lets you throw loads of requests at a URL. It comes bundled with Apache, so if you’re running the LAMP stack, you probably already have it.

The syntax is simple.

ab -n 1000 http://www.google.com/

This will throw a thousand requests at Google and then produce a report on how long it look. You can also use the -c option to set the number of concurrent requests. There are lots more options too – see the Apache docs for full details.

Less is more

Tuesday, June 19th, 2012 | Life, Tech

If you need to view a file on the terminal, the traditional way to do it is using more. More is fine. But less is better.

less filename

If is very similar to more, but has extended capabilities, for example you can go back as well as forward through a file.

Lazy bottom feeders

Saturday, June 16th, 2012 | Tech

For those of you who attended last year’s Secular Ball, you may remember that we did all the registrations though the website, SecularBall.org.

At the time we also registered SecularBall.com but those having come up for renewal, we decided only to renew the .org domain as barely anyone visits that, so having the .com isn’t even worth the $8 it would cost to renew it.

Anyway, someone recently sent me this email.

Hello,

I believe you’re the owner of secularball.org. I’ve got a proposition
concerning your website. Would you be interested in acquiring
secularball.com?

I understand that you may be concerned about the legitimacy of this.
If you’re a bit skeptical, I can upload an HTML page to verify
ownership beforehand. We can also use a third party escrow (who will
essentially ensure your money is safe until you retain complete
control over the domain name) for optimal security.

PS: I’m only emailing you because I believe you can benefit from this.
I do not intend to email you again unless you respond to this inquiry.

Regards,
Faheem.

It’s bad enough these lowly bottom feeders gouge out a living based on registering other people’s trademarks, but you would think that if you were in such a business you would have at least the basic common sense to do just a bit of research and see that we already were the owner of said domain until recently and obviously had no interest in it (or at least make reference to the idea of selling it back to us).

The Future of PHP

Thursday, June 14th, 2012 | Events, Programming, Tech

Last month, I went to a talk by Richard McIntyre on “The Future of PHP”.

Turns out, it’s JavaScript.

More and more these days, web applications are being developed with fat front end clients loaded with JavaScript, and the server-side processing is primarily used for data processing and APIs. So we’re seeing a shift from PHP being used as a somewhat front-end technology to merely (I say merely, there is a lot of work to do it) delivering the content in a format the JavaScript front end can consume.

Perhaps this is why we’ve seen a rise in the number of microframeworks, such as Silex, that I recently blogged about.

I think the overriding message I took away from the talk though is that they’re inventing development platforms faster than I can learn them! I’ve already got a large list of technologies and libraries I need to review and I think I came away from this talk with another half a dozen!

Really enjoyed the talk though, and if you’re interested in PHP and in the Leeds area you should definitely check out the Leeds PHP User Group who host such events on a monthly basis.

Creating a user in Unix

Wednesday, June 13th, 2012 | Life, Tech

Back to basics today. Creating a user and setting their password.

useradd test
passwd test

ImageMagick, Apache and Debian

Thursday, June 7th, 2012 | Life, Tech

Following on from my previous post about installing ImageMagick from source, to get it working with Apache you need to do the following. First, we need to install something from Pecl. So make sure you have the pecl command at hand – if not, install it.

apt-get install pear

Then run the following.

apt-get install php5-dev
pecl install imagick

Finally, add the extension to your php.ini.

extension=imagick.so

Foursquare

Tuesday, June 5th, 2012 | Tech, Thoughts

Recently, I stopped using Foursquare.

I really like the concept. Making every day life a little more fun. It’s good because it encourages you to go out and do new things – if only to get the Foursquare points, and anything that encourages people to go out and explore the big wide world is a positive.

However, I found it was just taking over a little too much. The first thing I would do when arriving at somewhere new to check in, and it was just taking too much time to log onto my phone all the time and check in somewhere. So I decided to go cold turkey and remove it from my phone.

Google wants your memory

Sunday, June 3rd, 2012 | Tech

By this point, most developers have realised that Firefox is a cludgey pile of crap that eats up all your memory, and made the switch to Chrome, those developer tools long since surpassed Firebug.

Recently though, I’ve been running out or memory a lot and I don’t think it’s accurate to say Chrome isn’t to blame. As it runs everything in different processes, it’s easy to miss how much memory it is eating up, but I found it using 620MB of memory with just four tabs open.

Activity Monitor

Of course having Netbeans eating up so much clearly isn’t helping either, but IDEs are always a bag of crap (Eclipse is worse, I miss Notepad++).

Compiling ImageMagick from source on Debian

Friday, June 1st, 2012 | Life, Tech

There is an RPM available for ImageMagick on Debian, but it isn’t the most update to date, so if you need all the new features, you’ll need to compile and install it from source. Luckily, it’s very easy to do.

wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
tar xvfz ImageMagick.tar.gz
cd 
./configure
make
make install
make check

Essential Drupal modules

Wednesday, May 30th, 2012 | Limited, Programming, Tech

Drupal is a great PHP-based CMS (content management system), but its true power is only unleashed when you use the modules system. Out of the box, Drupal provides basic functionality for creating and publishing content with additional functionality that can be added by installing modules, you have a far more powerful system.

In fact, most of the core functionality of Drupal is provided via modules as well. Drupal ships with a series of “core” modules which, should you wish to, you can disable. So if you don’t want the menu system, search, taxonomy or the help system, you can turn all of these off.

Beyond that though, Drupal can be extended significantly thanks to its reach ecosystem of modules (or plugins if you will) that provide significantly more functionality than the core system ships with. While you’ll need to find the right modules to match your needs, there are several that are considered the staple diet of Drupal developers.

Chaos Tool Suite
It may not look like anything special to get started with, but CT Tools provides an expensive range of APIs and systems which make developing with Drupal easier. It’s a platform to use when developing your own modules but also serves as a dependency for many other modules.

Views
The most installed module of any on the Drupal website, and it’s easy to understand why. Views is an incredibly powerful module which allows you to create custom pages that do various tasks – such as listing out a content type, sorting things a certain way, creating archives and many other tasks.

Entity Reference
At some point you will probably want to reference one entity to another. For example, on the Know Leeds website we have places and we have restaurant reviews. For each restaurant review we write, we want that to be linked to a certain restaurant (a place), and we do this with Entity Reference.

Pathauto
If you think you’re getting an exciting Greek named module, think again – it’s just the words path and auto put together. But it’s still a very useful module as it automatically creates friendly URLs without you having to type something in.

By default, Drupal won’t create a node reference for an article, it will just use the ID. You can override this by typing in something like article-title, but Pathauto will do this automatically. It’s good to install this from the start as it allows you to set up patterns for articles, categories and other systems so that you have uniform URLs across your site.

CAPTCHA and reCAPTCHA
reCAPTCHA is a fantastic took that stops spam and helps translate books at the same time. Using these two modules you can add reCAPTCHA to your site to stop spam bots registering accounts.

Taxonomy menu
This allows you to build an automatic menu out of a taxonomy set. So if you have categories as part of your taxonomy and you want to create a menu that automatically lists each category, this module will do it.