There’s one thing we got to get, Heyes….

…and that’s out of this business!”

One of the TV highlights of the week for me in the early 1970s was the TV series ‘Alias Smith and Jones‘, following the adventures of two outlaws on probation, Hannibal Heyes and Kid Curry, as they attempted to stay ahead of the law and out of trouble. At the start of every episode, we’d see the two being pursued on horseback, with Curry shouting the above lines to Heyes.

This week I finally decided that I need to get ‘out of the business’ of freelance web development.  I have a nice part time day job, involvement with a startup, and currently enough freelance work to keep things ticking over.  But teh freelance web work will never, ever, make me a good income again, and if I’m going to do anything with my freelancing time, I need to find something else.

What triggered this?  I quoted for a WordPress related job – install, configure, tweak the theme and apply a few small mods to the installation. Admittedly not one of the world’s great technical tasks, but a nice job.  I quoted at my ‘lowest rate’ – £20.00 / hr – this was a UK based customer, and I expected to take about 10 hours to do the job.  I replied a mail later in the day telling me that I’d not been successful as another UK based freelancer had come in at a lower rate.  Of £5.00 per hour.

A fiver an hour.  Less than I’d get sweeping floors in McDonalds. Rates like that are pretty common from suppliers of services based in the Far east, but from a UK based develoeper, it’s scary.  Because it means that the market for some types of development work has become commoditised, price driven and almost at the level of ‘will work for food’.

So…time to get out.  It’s no longer worth it.  Fortunately I have a few ‘specialist’ areas of software development I can fall back on, but am wondering now whether it’s time to take a while different approach.  With a flexible permanent job available to me, maybe it’s time to look at other things to do and leave software development work to the sweatshops of the far east and the UK?

I’ve been thinking of things that are not ‘commodity’ – maybe get my old woodworking skills back?  Or try something new? Art? Something to do with my interest in vintage radio? Who knows.  Perhaps focusisng on the permanent job and doing bits of freelance work or something new for ‘beer money’ is the way forward these days.

Very, very sad.  How long before other parts of our technology and ‘creative’ industries become sub-minimum wage sweatshops?

Configuring MOWES on a USB Stick

There’s an old saying that you can neither be too thin  or have too much money.  I’d like to add to that list – you can’t have too many web servers available on your PC.   For the non-geeks amongst you, a web server is a program that runs on a computer to ‘serve up’ web pages.  because I write web software for part of my living, I run my own web server on my PC.  Actually, that’s not quite true…because there are two main web servers used today – Microsoft’s IIS and Apache – I have two.  And today I decided that it would be really useful to have a web server and associated software on a USB stick that I could plug in to computers to demonstrate my web applications out on client sites.

I decided to use the MOWES installation – after all, it’s designed to run on USB sticks – and as well as the standard Apache, PHP and mySQL I decided to also install Mediawiki and WordPress.  As well as being used for demonstrations, I decided that I’d also like to have a portable Wiki to use for note taking / book research when I’m on my travels, and run a demonstration instance of WordPress.

Installation

The simplest installation involves putting a package together on the MOWES website, downloading it to your PC and installing it.  To get started with this, Google for MOWES and select what you want to install.

NOTE – when this post was written I pointed to a particular site.  That site – chsoftware.net – now reports back as a source of malware, so I’ve removed the link.

For my purposes I chose the full versions of Apache, mySQL 5 , PHP5,  ImageMagick, Mediawiki, WordPress, and phpMyAdmin.  This selection process is done by ticking the displayed checkboxes – if you DON’T get a list of checkboxes for the ‘New Package’ option, try the site again later – I have had this occasionally and it will eventually give you the ‘ticklist’ screen.

Tick the desired components and download the generated package.

Plug in your USB stick, and unzip and install the MOWES package as per their instructions.  First thing to note here is that you may need to keep an eye on any requests from the computer for allowing components access to the firewall.  The default settings will be Port 80 for the Apache web server and 3306 for mySQL.  If these aren’t open / available – especially the mySQL one – then the automatic install of the packages by the MOWES program will fail miserably.

Once you have the files installed on your memory stick, then you can configure them.

Configuration

If you never intend to run the installation on any PC that has a local Web Server or instance of mySQL, then you don’t need to do anything else in terms of configuration.  You might like to take a look at ‘Tidying Up’ section below.

If you ARE going to use the USB Stick on PCs that may have other web servers or mySQL instances running, then it’s time to come up with a couple of ports to use for your USB stick that other folks won’t normally use on their machines.  The precise values don’t matter too much – after all, the rest of the world won’t be trying to connect to your memory stick – but be sensible, and avoid ports used by other applications.

I eventually chose 87 for the Apache Web Server, and 4407 for mySQL – 87 fitted with my own laptop where I already have a web server at Port 80 and another one at Port 85, and I run mySQL at the standard port of 3306.  NOTE that if you run the installation using an account with restricted privileges, you may not be able to open the new ports you use.

In order to configure the MOWES installation you’ll need a text editor of some sort – Windows Notepad will do at a push.  You’ll be editing a couple of files on the USB stick, as follows:

apache2\conf\httpd.conf

Open this file up and look for a line starting with Listen.  Change the number following it to the number you’ve chosen for your Apache Port – e.g. 87.

Now look for ‘ServerName’ – change the line to include the Port number – e.g. localhost:87

php5\php.ini

Open this file and find the line starting mysql.default_port.  Change the port referenced in this to the Port you have chosen for your mySQL installation.  E.g. mysql.default_port=4407

mysql\my.ini

Open the file and look for two lines like port=3306.  Change the port number to the one you have chosen – e.g. 4407 – port=4407.  There will be two lines like this in the file, one in the [client] section and one in the [server] section.

www\phpmyadmin\config.inc

This is the configuration file for the phpMyAdmin program that provides a graphical user interface on to the mySQL database.  Look for a line that starts with : $cfg[‘Servers’][$i][‘port’] and replace the port number in the line with (in this example) 4407.

And that, as they say, is that for the configuration files.  You can now start up the MOWES server system by running the mowes.exe program.  If all is working, after a few seconds your web browser will be started and will load the ‘home page’ of the MOWES installation.  With the configuration carried out in this article, the browser will show the url http://localhost:87/start/ and the page displayed will show links to WordPress, Mediawiki and phpmyadmin.

WordPress Configuration

The final stage of configuration is to make a change to WordPress that allows WordPress to run on a non-standard Apache port.  This needs to be done via phpmyadmin, as it involves directly changing database entries.  Open phpmyadmin, and then open the wordpress database from the left hand menu.

Now browse the wp_options table.  Find the record where option_name is ‘siteurl’ and change the option_value field to (for using a port number of 86) http://localhost:86/wordpress.  Now find teh record with option_name of ‘home’ and again change the option_value to http://localhost:86/wordpress.

Tidying Up

You may like to put an autorun.inf file on the root of your memory stick, so that when it is plugged in to a machine it will automatically start the MOWES system (if the machine is so configured).  The file can be created with a text editor and should contain the following:

[autorun]
open=mowes_portable\mowes.exe
label=Your Name for the Installation

And that’s that!

Enjoy!

WPMU Installation to support sub-domain blogs

wordpressI’m currently renovating a site of mine – Coffeehouse Chat – with a possible view to re-opening the Forum side of it with new and improved features – including better integration with Social Media and User Blog hosting on the site.  And there was the issue – I wanted to install WordPress-MU – the multi-user edition of WordPress – in such a ways so as to support user blogs in sub-domains on the main site domain – e.g. something like joesblog.blogs.coffeehousechat.co.uk

This is a two stage process that is outlined in the documentation.  the first part is the setting of Wildcards in the DNS settings for the server, and the second part is installing a .htaccess file that actually handles the processing of the redirected incoming requests.

Installing the .htaccess file is nice and easy.  the file is below – it comes with WordPress-MU named as htaccess.dist – simply put it in the directory containing the WordPress sofwtare and rename it to .htaccess.

RewriteEngine On
RewriteBase BASE/

#uploaded files
RewriteRule ^(.*/)?files/$ index.php [L]
RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteCond %{REQUEST_URI} ^.*/wp-admin$
RewriteRule ^(.+)$ $1/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . - [L]
RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

<IfModule mod_security.c>
<Files async-upload.php>
SecFilterEngine Off
SecFilterScanPOST Off
</Files>
</IfModule>

So in my case – WordPress-MU installed in a folder called blogs – this file goes in to that folder.

Now, the second part – the Wildcard DNS settings.  Some time ago when I set up an installation of WordPress-MU I had to get my hosting comapny to deal with this for me.  However, this time, a little advice from Samuel at Prime Hosting showed me how to set it up from within cPanel, so I’m going to share that with you here.  If you’re not using cPanel, there may be other ways in your own control panel to do this.

In my installation, WordPress-MU is installed in a fodler called blogs off the root of my public_html directory.  I have set up a subdomain – blogs.coffeehousechat.co.uk – to point to it, so that when a user enters this domain they go to the blog create / sign in page.  Now, after checking that this worked happily, I logged in to cPanel for the coffeehousechat.co.uk domain and selected the ‘Subdomains’ control from the Domains panel.

Now the cunning bit…note that this may not work for you in complicated web site set-ups where multiple redirects are involved – but it worked for me.

In the ‘Create a Subdomain’ box, (below) enter ‘*’ as the subdomain name – giving *.coffeehousechat.co.uk in my case – and enter the folder on the server where you want things to redirect to as the ‘Document Root’ – in my case public_html/blogs.

 

 CreateSubDomain

 

 

 

 

 

 

Once this is entered, press the create button.  The grid at the foot of the screen should be updated to reflect teh changes just made:

ListSubdomains

 

 

 

 

 

And that is that! 

A user entering, say, www.test.blogs.coffeehousechat.co.uk will be directed to that blog if it exists, or be prompted to create it.

A good time to upgrade WordPress!

Wordpress LogoI’ve just upgraded various blogs I look after – including my own – to WordPress 2.8.5.  This release is regarded as a ‘hardening’ release by WordPress themselves, and if you’re reasonably up to date the upgrade is a piece of cake – the automatic installer does it all for you.

It might also be a good time to take a look at your WordPress setup in general.  Good practice with any website installation tehse days states that the less you have on a website, the less places there are for malware to hide, so one thing to do immediately is to remove any unused themes or plugins – use your FTP client to back them up if you can’t lay your hands on your originals.  If you do decide to change theme or use the Plugins again, just install them.  Whilst there are some nasties that lurk in the ‘Default’ theme, it’s probably best to leave that installed because it gives you a fallback position if a Plugin breaks your custom theme.

If you have statistics running, take a good look at any ‘spikes’ in the page views.   I use the WordPress stats package and find it perfectly adequate for my needs – which is basically stroking my ego to see if people are reading what I write.  Looking at my page view, I noticed a spike over 3 days early last week – twice as many hits on the site as usual.  Unless you’ve recently done a push for readership, or have blogged on a matter of wide interest, this can indicate a compromise of your site – as I found.

The stats package provides a list of search terns that are used Looking at things in more detail I noticed that whilst the pages accessed were familiar to me, the search terms that were used to get there were most certainly not.  ‘Girlfriends boobs’ is not something I tend to write about on this site!!  Now, given that those terms must have been on the site somewhere to get the hit.  I took a look at the logs provided by my hosting company, and also wandered around my site with FTP.  I DID find evidence of some dodgy looking links, buried in a sub-directory inside teh WordPress installation being accessed by looking at the logs.  However, checking with FTP revealed noting – I realsied that my upgrade to 2.8.5 had wiped out the evidence.  I’ve not had any similar strange search terms showing up since then.

So – summing up:

  1. Keep upgraded.
  2. Remove anything you don’t need.
  3. Install some simple stats and watch Page Views for unexpected spikes.  Get a ‘feel’ for the normal sort of readership levels of your site.
  4. Keep an eye on search terms used to get to your blog.  If ‘odd’ search expressions turn up then start ferreting around. If you have a Google account, register your site with Google and keep an eye on unfollowable links, etc.  Learn what logs are available from your hosting provider and use them.

That’s my lesson for today on WordPress!  As for the upgrade – 2.8.5 works like a charm and has no bad habits that I can find!

Upgrading to WordPress 2.5.1 – some notes for the nervous

There’s a few basic rules that we can all follow and learn from in life.

You know the stuff:

  • Never play cards with a man called Mississipi Slim
  • Always walk a mile in the other mans shoes – you have his shoes, and you’re a mile away from him.
  • Don’t eat the yellow snow.

To that I might add – Be wary of upgrading software when you don’t need to do it!

I’ve just upgraded ‘Joe’s Jottings’ to the most recent version of WordPress and whilst it only took me an hour or so, it could easily cause some serious pain for folks less happy with a little database hacking.

I followed the basic upgrade instructions given here – and on completion attempted to log in to the system.  Now, this is soemthing I do every day, so it’s reasonable to assume that I can remember my password.  And, just in case, I have it noted down soemwhere…so…I was rather peeved when WordPress rather politely told me I’d got it wrong.  Never mind…I can order up a new password.

Following the instructions, I received a mail containing a link that included a URL containg a ‘key’, and on clicking on this was told that the key was invalid.  A closer look at the key indicated why; it contained a couple of ‘&’ characters, which would be treated as splitting the key in to multiple fields when entered in to a browser!

Guys…this is REALLY naff!

Anyway – as I needed to get the blog sorted and checked I opened up the database, went to the relevant user record in the database and changed the value of the ‘user_activation_key’ field in the record to a word that didn’t contain any nasty characters.  I then took that word, pasted it over the value of the old key in the URL I’d been sent, and posted that in my browser window.  The result was I soon received the new password.

There is a proper fix – http://trac.wordpress.org/changeset/7837?format=zip&new=7837

Note that if you’ve already requested a password change you’ll have to blank out the user_activation_key field before you can make use of this fix. 

Anyway – apart from that, it now works fine.  But by ‘eck, it was a hairy 30 minutes sorting this out.

 

 

Link Listing in WordPress

WordPress supports the ‘Blogroll’ model for links, which works fine for links but I wanted to be able to put together a series of pages listing links on different subjects for my CommunityNet project.

For example, I wanted to have links grouped into such topics as ‘Think Tanks’, ‘Animal Welfare Groups’, etc.  I couldn’t work out a way of doing this in a manageable fashion through the existing WordPress functionality.  I had a look around for Plugins but found nothing that seemed sensible for what I wanted, so I decided to ‘homebrew’. 

Continue reading

WordPress Template Pages

I use WordPress to run a few other websites, such as my CommunityHost site, and wanted to add a form to support a mailing list.  My hosting company, Servage, supports mailing lists and I’ve used them with some success, so I didn’t need to re-invent the wheel and decided that the best bet would be to somehow get the HTML form that Servage supply on to a WordPress page.

I did try the obvious – just paste the HTML source code in to a page – and that was about as effective as the proverbial cat flap in an elephant house.  So I then decided to create a new template page containing the code.  And for all who’re interested, here’s what I did in Version 2.3.x.

Continue reading