Posts By: jonny

Crossover Cable

My first crossover cable. I used the following diagram from Tournas Dimitrios’ Blog: So the normal ends of the cable is wired as T-568B as shown above on the right. So I cut one end and manipulated the wires as shown on T-568A above: Cut the wires to the same length then slide into the… Read more »

Image data does not exist. Please re-upload the image

I had this error message when uploading images in WordPress. Image dimensions were set to 0x0 and the thumbnails did not appear. A quick scan of the Apache logs PHP Warning:  copy(/var/www/vhosts/thedomain.com/httpdocs/wp-content/uploads/thephoto.jpg): failed to open stream: Permission denied in showed me that I needed to correct the permissions on the /wp-content/uploads directory to allow Apache… Read more »

LAMP Performance

The following scripts can help in determining good values for Apache and MySQL configurations based on the amount of memory available: MySQL Tuner Apache Tuner Apache Buddy The following will give  a list of Apache Modules loaded: apachectl -t -D DUMP_MODULES The following will give the memory usage of Apache: #!/bin/sh # apache_mem.sh # Calculate… Read more »

Remove Line Breaks with tr

I had a text file with multiple lines of input that I was manipulating using awk and sed but I found the following ‘tr’ command easiest to remove the line breaks: cat input.txt | tr -d ‘\n’

Apache Protect Multiple Locations

The configuration directive below is one I used to protect multiple URLs with a htpasswd file. So match (~) /url01/ or (|) /url02/ or (|) …. <Location ~ “/url01/|/url02/|/rfinlay1/|/cgribb5/|/lgrw01/|/ahll7/|/cki3/|/ele02/|/mm24/|/cmcc78/|/jmc8/|/gmc1/|/mmy82/|/eoa1/|/cs01/|/pr5/|/ln50/|/rc1/|/hd01/|/a05/|/e1/|/ss12/|/mm6/|/s75/|/gp01/” > AuthUserFile /etc/httpd/conf/.htpasswd-file AuthName “Restricted Access” AuthType Basic Require valid-user </Location>

BIND on CentOS 5

The version of Bind in the normal Red Hat / CentOS repositories is a little out of date. To get more up-to-date versions (9.7.4 at the time of writing) use the Centalt and EPEL repositories. Create the following file: vi /etc/yum.repos.d/centalt.repo And add the following to it: [CentALT] name=CentALT Packages for Enterprise Linux 5 –… Read more »

USB Multiboot Drive

This tool from pendrivelinux.com is a useful utility to help create a bootable USB pen drive with a menu system for booting into multiple operating systems. It works from within Linux/Ubuntu although there is a Windows tool available too. Useful for creating Live CDs for partitioning, virus checking, installing and includes persistent storage.

jQuery Reading Shakespeare XML

I was helping someone with some jQuery to read XML files of Shakespeare plays and this is what I came up with. Very incomplete but he so I can reference it in future…. shaXpeare shaXpeare The plays of Shakespeare with added X Factor Home Contents Play Choose a Play: Choose a PlayTRAGEDIESAntony and CleopatraCoriolanusHamletJulius CaesarKing… Read more »

Apache GeoIP Country Detection

Creating customised content based on the origin country of your website visitors requires installing the mod_geoip module for Apache and also the MaxMind GeoIP database as follows (on CentOS): mkdir ~/geoip cd  ~/geoip wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gz tar xzf GeoIP* cd GeoIP* ./configure make make check make install cd .. wget http://geolite.maxmind.com/download/geoip/api/mod_geoip2/mod_geoip2_1.2.5.tar.gz tar xzf mod_geoip2_1.2.5.tar.gz cd mod_geoip2_1.2.5… Read more »

Android Screenshots on Ubuntu

So I wanted to create screenshots of my HTC Hero Android phone from my Ubuntu desktop. So I … downloaded and extracted the android sdk to e.g. ~/programs cd into the ./tools directory run the ./android program Install any version specific stuff required sudo vi /etc/udev/rules.d/90-android.rules sudo service udev restart Unplug the phone and plug… Read more »