A blog is fast becoming a standard part of many web sites and many web providers offer free blogging software. At Cobblers, however, we like to roll our own. A home-brewed blog is easier to integrate into the site and can be more easily adapted for different requirements.

The most interesitng part - the online editor - is hidden behind a login, so unfortunately you cannot see it. It uses the excellent CKEditor which is free to use for non-commercial sites, and a bargain to purchase if you want to use it on a site which earns money.

If you really want to have a go with it, there is a demo on the CKEditor web site.

The backend is mySQL with some simple PHP to manage the data entry and retrieval.
I'll have to add some filtering once the number of entries gets past 10 or so, but I'll cross that bridge when I come to it. Should not be too hard. Actually the software is easy - it's getting the user interface right which is the difficult problem.

Heres one with a picture   

Posted On: 2011-02-21 18:14:30

In which we insert an image

Having problems with the image insertion. When you choose an image a pop-up appears and you use this to choose your pic. So I choose my pic then click OK on the pop-up. The pop-up disappears, the image is inserted into the edit area, but the browser window does not regain focus. So cannot click anything ! The only thing you can do is refresh the page...and so you lose all your changes - including the image - because you cannot click "Save".  This is an interesting problem !

More on this later

OK - I fixed it. I was using a PHP script to initiate the editor instance - as shown in the developer documentation. I tried it in different parts of the page, including right at the very end, just before the body tag, but it made no difference. Once the dialog for the picture insert  had been displayed, focus would not return to the browser window.

Then I tried the javascript initiator - and no problem, it worked straight away. So that's the way to do it. There's no technical reason why it has to be PHP initiation. 

A few more things to add to this. It would be useful to have an alert if you try to refresh the screen or leave it, when there is unsaved work in the editor. It's easy to forget to save  -  then 10 minutes work has gone. And the text in the Title and Strap input boxes needs to be escaped for quotes. Righ now, typing something like "it's" in either of those two boxes will crash mySQL.  Then we have to get the uploader working, so that I can upload images. Finally we need to try CKFinder - a file browser which works on your web site - how neat is that - so you don't have to remember the names of images. Finally - Ajax for the div which contains the editor.

Inserting and Uploading images   

Posted On: 2011-03-04 16:53:18

Discovering how to upload images and insert them

Here's a photograph of the album sleeve of  one of the LPs I used to play a lot. The late George Melly was a man who lived life in his own, special way and brought a lot of fun into the lives of people who watched him doing it !

Anyway, it's here because this is the first picture I have uploaded from within the editor, using code I wrote myself for the file uploader and for the file browser. The missing link - how to callback the editor from the file browser with the url of the picture you want to insert,  was supplied by a chap called Don Jones, and you can find the details here. His method worked first time without any twiddling being needed - so thanks Don. The ckeditor Developer documentation has nothing to say about this vital link - perhaps they want you to buy their file browser/uploader.

So that's all the pieces in place now to make a proper blog. Just need to tidy up the file browser a bit and we are good to go..

Clive New   

Posted On: 2011-03-05 16:45:05

Clive in his favourite position - behind a pint of beer

Here's a picture of Clive New, the founder, leader and musical adviser to the Maryland Jazz Band. It was taken in June 2005 at the West Tytherley Village Show. Clive  died only a few months after this picture was taken and  I still miss him. It does not seem possible that it was nearly six years ago.

The MJB were playing at West Tytherley ( it's near Romsey, Hampshire ) that day. What a great place - so far out in the sticks that no-one's mobile phone worked. Maybe they have put in another cell since then.

Clive's principal was that there was only one way to do anything - HIS way, and he could be very irascible when applying it. But he never held a grudge and had a lifetime's experience in music, so most of what he said made a lot of sense.

My first small band gigs were done with him and he offered much encouragment and support in the early, frightening days ! 

HTML5 and CSS3   

Posted On: 2011-03-07 09:47:36

The Next Best Thing - but still waiting for the browsers to catch up

If you are viewing this using Google Chrome, then the HTML5  picture (like the others in this blog) will have rounded corners, courtesy of CSS3.

If however you are using IE - even the very latest IE9 - you will not see them. Firefox does not do rounded corners either. It's a bit like the bad old days between about 1995 and 2000 when every variety of browser did something different with HTML markup and desigining webpages which worked  with all of them was a most frustrating job.

Let's hope that by the end of 2011 all the major browsers will support CSS3.


Posted On: 2012-01-22 12:08:54

And another problem or two

Making a halloween face from a pumpkinHaven't used this for month's. Wanted to use it on a live site, so it seemed a good idea to post an article or two to refresh my memory on how it all works and hangs together

Shock and Horror  #1: When I came to upload this picture I got a "file too big" error. (It's 3,8Mb in original form). Reduced it to 50kB and uploads OK. The maximum size you can upload is set in php.ini and on a shared server you can't twiddle it yourself. I've EMailed my host asking what value they use by default and if they will make it bigger.

I'm sure I went through all of this a couple of years ago on the same host - but it's too long ago to remember what happened.

More news later when I have heard from my hosting company. Ah - here it is... I remembered what the fix is just after I posted them a help ticket....run the site using phpFast CGI which you can install yourself.

Shock and Horror #2. Then I came to another problem which was a bit trickier . Whenever I came to save something which had an image in it, the modsecurity module on my host's Apache server  kicked in, denying me access and locking me out for an hour. This made it hard to troubleshoot.  I'm sure it didn't do this when I first installed this editor.

The clue was in the server  logfile - it was the contents of the form field which contains all this stuff which had spooked it - probably the border width=1 parameter in the  image tag. I passed the info to my hosting company and they did two things for me (1) Helped me carry on with the development by putting my IP on a white list until the problem was resolved , and (2) Asking the company which provides the security module to adjust their rules. This is still going on at the moment (27 Jan 12) but I'm certain it will get resolved.

So many thanks my host 34sp.com for sorting this out. They are the bees knees in my opinion.



File Name Change.   

Posted On: 2012-01-27 12:00:36

Making sure we never get a duplicate photo name

The upload scheme for picture files is simple. They   just get parked into a folder. There is no database entry (yet). So it's possible that two people with the same type of camera, and hence the same file naming scheme could both try and upload and save a file like IMG_1234.jpg. So they get renamed to unixtime.jpg for example. This  guarantees the names will always be different.

Later on I will add a proper filing scheme for the pictures, so that they can be correctly identifed. Thus it will be possible to delete them when an article is deleted, and also make thumbnails which can be used for the pick list.

OK - that worked. The picture left me as salzburg.jpg but is stored as 1327665655.jpg


Ford's smallest car   

Posted On: 2012-04-24 12:55:40

It's a model !

Just a progress note. Still problems with uploading large files - this wouldn't upload until I had reduced it to 1024px (90Kb) from the original  3355px (3.65Mb). Will look at that later.

Another problem: The editing page for the blog database pops up a javascript confirm() message when you click the "Delete" button and shows you the Title so you know which entry is going to be zapped. But js hiccups if the title contains a quote or single quote. Had to use the php function addslashes() to the data as it comes out of the database.

Another problem: Later versions of Chrome don't work correctly with ckeditor. One big problem is that the call to the window which shows the pictures available for insertion into the text does not actually open the window. You need version 3.6.3 or later of ckeditor to fix this problem.

And if you are close to Southampton (UK) check out Bursledon Brickworks - great place to visit for all  the family. That's where the above picture was taken - April 2012.

Mostar Bridge   

Posted On: 2012-11-28 21:00:06

But it is not really about the bridge !

I've been using 34sp.com as my web host for years and been very pleased with the service they provided. But recently the performance has gone right off the boil. Many days there are periods of two or three hours when there is no ftp, no email and no web sites on my reseller account. Now I know that shared hosting is a compomise between cost and stability. But it never used to be like this - just the occasional glitch now and again. Now it's every day.

So I'm casting around for a new host. Right now (27 Nov 2012) this website, which yesterday was on 34sp's machine, is now on HostPapa. Had a problem with this very application - had to change the way the text is escaped before it's saved to the database, but after sorting that out, everything seems to be OK.

The online help is OK, but trying to use the chat or post a support ticket eventually ends up with a blank page, so not entirely convinced it's worth the effort to change. Keen prices though and lots of extras. Difficult choice ! And I gave up waiting for HostPapa's web site to respond when attempting to transfer in a domain from 34sp.

Perfection is hard to find.

Try a VPS   

Posted On: 2013-11-10 11:18:13

Take control of your hosting

Tate ModernQ: What has the picture got to do with VPS ? A: Nothing The walls belong to Tate Britain and I think they look great. Once you've looked at that you can read the VPS stuff below.

I've done a couple of web sites recently where the owners / users wanted to upload a substantial number of pictures. The folks concerned have no idea about Photoshop and pxels and  max  file sizes. They just want to bung the SD card into the slot on the PC and upload.  It was pointless to ask them to keep the file size below about 3Mb.  

I needed a host which would reliably accept uploads of up to 10Mb and which had enough PHP  memory to let GD reduce the size to 300px or whatever. 10Mb seems to be about the largest file size produced by a modern compact digital camera in jpg mode.  It seemd to me, after lots of experiments, that it was not the file size, per se, whcih broke the upload. Most often the files would be uploaded OK, but PHP would run out of memory when reducing the file to the size I needed,

None of the shared hosting plans offer this, so I decided to see what a VPS could offer. I tried one about 6 months ago. To save money I opted not to have a front end ( eg cPanel or Plesk ) so I was left with Putty and a unix command line.  Not being a unix expert I was at the bottom of a very steep leaning curve. I figured out the FTP / DNS etc and actually got a couple of sites running, but that took me three days and I still had not tackled SMTP / POP,  security, backup, hosting other users , running mySQL and PHP and the various other services which tend to get taken for granted. So I quit.

This time I have got a service which has cPanel with unlimited acounts. I initially tried it for 1 month, but have now decided to keep it. It's not cheap, but it works really well. I'm going to move all the sites from my current  host to this one to help mitigate the cost.

Although it's "your" server, cPanel sets up Apacche , PHP amd mySQL with safe, sensible values and you can then tweak the ones you need to get the service you want. I tweaked PHP memory to be 256Mb. Normal hosting plans seem to use  64Mb. I've twiddled a few other thimgs as well. Check out  Heart if you are interested.


Posted On: 2013-11-10 20:22:26

A web site in minutes

Wordpress LogoWhat is the quickest way to get a web site up and running ? 

There are many answers to this question. One tool which is frequently mentions is Wordpress . So I thought I would give it a go. You can find my Wodpress site here.

In a few words.... 

  • Easy to set up
  • Tricky to move to another server once installed
  • Thousands of plugins / bolt on goodies. Too many really - how do you choose the one you want ?
  • Not easy to produce static pages

I made the template using Artisteer and it certainly helps to give the site a distinctive look


Posted On: 2013-11-10 20:34:36

A very useful CMS

Loomla Content Management SystemAnother tool - Joomla -  for producing instant web sites. This is a CMS ( content management system ) and much more complex than Wordpress.

You can see my Joomla development site here . I think I have made a lot of progress in a short time - though still many things to sort out. I had a "Hello World" page up and running wthin about 10 minutes of starting the installation.

It takes a lot of getting used to - the workflow is quite different from when you are building a web site the normal way.  Initially I had ( & I am sure you will too if you try it) a lot of confusion around the purpose & use of plugins , components and modules. 

It seems to ne able to do most things you'd want. Sometimes you have to be inventive ( eg getting a Google Map opnto a page), The only major thing I have not found is a simple solution for reading & writing to an SQL database - e.g. a customer list. I will probably have to figure out how to write my own plugins. That will be an interesting challenge. !

Oh - and yes - I did try Drupal. but after an hour I still hadn't got the damned thing installed, so I gave up on it. (Problems with an .htaccess file, which my Apache server objected to, big time)

So this looks to be viable. I' have decided to do  a production site with it & see how we get on. And the documentation is good - much better than that with Wordpress.

The Medway and Rochester   

Posted On: 2014-05-19 13:03:15

Taking the Dickens trail

Apropos of nothing in particular, here is a picture of Rochester Cathedral taken from the top of Rochester Castle. We went there 16th May to have a look round and see what there is to see connected with Charles Dickens.

Not a great deal actually. The house where he lived ( Gad's Hill ) is currently a school, so no visits there. The house which appears in Great Expectations as Miss Havishams House (Restoration House) is only open June thru September. Eastgate House, which features in Pickwick Papers as Westgate House is closed for restoration until 2015. And there was no trace down by the river of the "River Trips" advertised in the visitor's leaflet available from Tourist Information.

The grub in the Cathedral Close Cafe was terrible.

But... the weather was grand. The old town is very pretty and there are some excellent pubs - we visited "Ye Arrow" by the Cathedral. The Guildhall Museum was open and it  has some great exhibits,  The Cathedral and the Castle are also well worth a visit - the view from the top of the Keep ( from where the picture was taken) is stunning.

New Forest Show   

Posted On: 2014-10-20 14:16:10

Stuff about stuff which has nothing to do with The New Forest Show

New Forest OwlThis fine owl was strutting his stuff at the New Forest Show (August 2014). Lost of great things to see, excellent beer to drink and tasty food to eat. Too much to see in one day though.

NetBeans IDE Version 8 crapped out on me the other day. I have been using it for 5 years or so without any problems and had got very familiar with it. Then - all of a sudden - every time I fired it up it would announce that it was "re-making indexes" and would go away for about 20 minutes.  So, after a bit of research I downloaded a trial version of PHPStorm. It  is excellent - had my first  project up and running within a matter of minutes and since then I haven't looked back. Lots of excellent features for PHP programmers.  Very good keyboard shortcuts. Great editable templates. Fantastic hinting when you put the pointer over a method, class, variable etc... It's not free, so I will be shelling out some dosh soon. Worth it, though.

Finally - replace the mechanical boot disk in your PC with an SSD. The speed improvement is astonishing. I just put a Samsung 256gB SSD in my 6 year old PC and it has been transformed. Boots up into Win 7 in seconds rather than minutes. ~The best upgrade I ever fitted.