« February 2009 | Main | April 2009 »

March 31, 2009

MySQL - looking for records in one table that do NOT correspond to records in another table

Q: Can you give an example where I can retrieve all the records of a table "users" where there are no corresponding records in other table "user_role"

A: No (sorry - I'm too busy to set up tables of these names for a demo) but I DO have an example that show you.

We have a table of agents (realtors) and a table of properties they are selling.
• with a regular join, you get all matching records

&bull with a left join, you get all matching records PLUS a row for all the records in the left hand table that don't have anything matching them in the right table

• with a left join and a "where [fieldname] is NULL, you get all the records in the first table that have nothing matching in the second.

Note - you must use is and not = to compare to NULL; NULL is not a value (it is the absence of a value!) so nothing can be equal to it!

mysql> select agent,aid,agid,locate,sid from agents
 join sales on aid=agid;
+--------------------------+-----+------+-------------------+-----+
| agent                    | aid | agid | locate            | sid |
+--------------------------+-----+------+-------------------+-----+
| Kavanaghs                |  10 |   10 | Semington         |   1 |
| Kavanaghs                |  10 |   10 | Melksham          |   2 |
| Kavanaghs                |  10 |   10 | Atworth           |   3 |
| Town and Country Estates |   8 |    8 | Westbury          |   4 |
| Town and Country Estates |   8 |    8 | Trowbridge        |   5 |
| Halifax                  |   6 |    6 | Melksham          |   6 |
| Halifax                  |   5 |    5 | Trowbridge        |   7 |
| Alder King               |   1 |    1 | Trowbridge        |  17 |
| Halifax                  |   5 |    5 | Hilperton         |   8 |
| Jayson Kent              |   4 |    4 | Melksham          |   9 |
| Alder King               |   1 |    1 | Trowbridge        |  18 |
| Jayson Kent              |   4 |    4 | Melksham          |  10 |
| DK Residential           |   3 |    3 | Semington         |  12 |
| DK Residential           |   3 |    3 | Hilperton         |  13 |
| Connells                 |   2 |    2 | Westbury          |  14 |
| Connells                 |   2 |    2 | Trowbridge        |  15 |
| Jayson Kent              |   4 |    4 | Semington         |  20 |
| Connells                 |   2 |    2 | Little Twittering |  21 |
| Greg Pullen              |   7 |    7 | Wenduine          |  22 |
| Jayson Kent              |   4 |    4 | Westbury          |  23 |
+--------------------------+-----+------+-------------------+-----+
20 rows in set (0.07 sec)
 
mysql> select agent,aid,agid,locate,sid from agents 
left join sales on aid=agid; 
+--------------------------+-----+------+-------------------+------+
| agent                    | aid | agid | locate            | sid  |
+--------------------------+-----+------+-------------------+------+
| Alder King               |   1 |    1 | Trowbridge        |   17 |
| Alder King               |   1 |    1 | Trowbridge        |   18 |
| Connells                 |   2 |    2 | Westbury          |   14 |
| Connells                 |   2 |    2 | Trowbridge        |   15 |
| Connells                 |   2 |    2 | Little Twittering |   21 |
| DK Residential           |   3 |    3 | Semington         |   12 |
| DK Residential           |   3 |    3 | Hilperton         |   13 |
| Jayson Kent              |   4 |    4 | Melksham          |    9 |
| Jayson Kent              |   4 |    4 | Melksham          |   10 |
| Jayson Kent              |   4 |    4 | Semington         |   20 |
| Jayson Kent              |   4 |    4 | Westbury          |   23 |
| Halifax                  |   5 |    5 | Trowbridge        |    7 |
| Halifax                  |   5 |    5 | Hilperton         |    8 |
| Halifax                  |   6 |    6 | Melksham          |    6 |
| Greg Pullen              |   7 |    7 | Wenduine          |   22 |
| Town and Country Estates |   8 |    8 | Westbury          |    4 |
| Town and Country Estates |   8 |    8 | Trowbridge        |    5 |
| Davies and Davies        |   9 | NULL | NULL              | NULL |
| Kavanaghs                |  10 |   10 | Semington         |    1 |
| Kavanaghs                |  10 |   10 | Melksham          |    2 |
| Kavanaghs                |  10 |   10 | Atworth           |    3 |
| Andrews                  |  14 | NULL | NULL              | NULL |
| Eddy and Isaac           |  16 | NULL | NULL              | NULL |
| Boris and Boris          |  15 | NULL | NULL              | NULL |
+--------------------------+-----+------+-------------------+------+
24 rows in set (0.00 sec)
 
mysql> select agent,aid,agid,locate,sid from agents 
left join sales on aid=agid where sid is NULL;
+-------------------+-----+------+--------+------+
| agent             | aid | agid | locate | sid  |
+-------------------+-----+------+--------+------+
| Davies and Davies |   9 | NULL | NULL   | NULL |
| Andrews           |  14 | NULL | NULL   | NULL |
| Eddy and Isaac    |  16 | NULL | NULL   | NULL |
| Boris and Boris   |  15 | NULL | NULL   | NULL |
+-------------------+-----+------+--------+------+
4 rows in set (0.01 sec)
 
mysql> 

 

Posted by gje at 11:54 AM | Comments (0)


Related topics: via article database
More about Graham Ellis of Well House Consultants
Useful link: MySQL training

March 30, 2009

Why most training fails ...

"Why most training fails ..." ... a headline from a newsletter / newsfeed which comes in to me each morning. [article] And most of what the article says is true.

To quote from the article: "While these methods may get high marks from participants, research (ignored by many training professionals) shows they rarely change behaviour on the job. Knowing isn't the same as doing; good intentions are too easily crushed by old habits."

The methods being discussed / listed include "lectures ("spray and pray"), inspirational speeches or videos, discussion groups and simulation exercises".


We're very much aware that a critical aspect of training is that what we teach is retained by, and used by our delegates once they get back to their place of work / onto the job. And we make an effort to ensure that the subjects learned are indeed subsequently applied. Mind you, we're very lucky in that the subjects we teach, and the roles that our delegates are in, leave those delegates little choice but to apply what they have learned in their job roles.

So ... how do we, consciously, attempt to ensure that the use of technologies and skills learned on our courses are used into the future by as many or our delegates as possible:

• Our training is subject rather than concept base. You come along to us to Learn to program in Python and if you have to program 'back at the office', you'll have little choice but to apply these skill. But we help that along ...

• We ask each and every delegate about their background, and what they will be doing with the subject being learned, and we encourage each of them to bring their own data, tell us what their data looks like, do practical exercises which are relevant to them and are the first step of what they will be doing with the subject back in their office.

• We lecture. Then we demonstrate (and the demonstrations vary to be relevant for the particular delegates), then we set a practical. There's a cynical saying in training. "Tell them what you will tell them, tell them, then tell them what you have told them and they may remember it." But perhaps it's not all that cynical - it's reinforcement. There's no way that even the brightest of people can remember every work said throughout a 3 to 5 day course!

• We follow up. All examples from the notes are published on our web site, delegate's work is emailed back to them, and they can visit our forum or archived previous forum or email me later to ask questions. We even provide a web site form for ANYONE to use to encourage people. The 'stiff British upper lip" style of "I won't want to trouble you" sometimes clicks in, and we remind delegates that we want them to ask; it's in our interest that they apply the subject and recommend others to us later, rather than forgetting us.

• We keep group sizes small - no more that 8 on a public course so that there is plenty of time for the tutor to deal with individual's specific needs in terms of subjects and pace.

• we encourage people to keep in touch via our blog and my Twitter feed. And to drop in and see us at the Hotel / training centre.

With our infectious enthusiasm, our reinforcement, our real-use examples and our follow ups, we seem to do pretty well in the 'effectiveness' stakes, but we're always looking to improve on that. And I am humbly grateful that our topics are not 'blue sky concept' ones but things that are really useful and used by our delegates when they get back to their own desks. We're in an area of training which is naturally very effective indeed in the first place.

Posted by gje at 08:21 AM | Comments (0)


Related topics: via article database

March 29, 2009

Funny Amusing, Funny Amazing and The Smarts

Funny Amusing and Funny Amazing ... that was the title of a paper back book that Dad bought for half a crown when I was young, and it was so much fun looking down the rib-tickling things on the left had side of each spread, and the jaw-dropping things on the right.

It's funny [amusing] how one word can have several meanings - indeed, when I'm running Perl courses, I often write on the board "Reading ..." and ask people to pronounce the word. Of course, I could complete the sentence with "is a place" and it would be 'Redding', or "is a skill" in which case it would be 'Reeding'.
And in Perl ...

@reading is a list where each element is a separate scalar or
@reading is a scalar which is the number of elements in a list or
@reading (in quotes) is a string which comprises all the members of the list joined together into a scalar, with a space between each of them.

How did I come up with this article today? Chris tells me that two smart delelegates have checked in already (isn't Skype great!) and I respond with "I have better not come in to work in jeans and teashirt." But it turns out that he was meaning Smart (Intelligent) rather than Smart (Well Dressed).

Posted by gje at 08:12 PM | Comments (0)


Related topics: via article database

March 28, 2009

How to tweet automatically from a blog

How to Tweet from a Blog

I'm using the MoveableType Blog software for "The Horses's Mouth" ... and I want to tweet my subject line for each new post. But I'm lazy, so I have set it up to happen automatically.

1. I post my blog entry in the usual way

2. I have added the following script at /home/wellho/tweeter/blogtweet on my server:

<php
mysql_connect("127.0.0.1","databaseuser","databasepassword");
mysql_select_db("wellho");
$rs = mysql_query("select entry_id,entry_title from mt_entry order by entry_id desc limit 1");
$hv = mysql_fetch_assoc($rs);
$leid = file_get_contents("blogtweet.txt");
if ($leid == $hv[entry_id]) exit();
`curl --basic --user wellho:twitterpassword --data status="[diary] - $hv[entry_title] - http://www.wellho.net/mouth/$hv[entry_id]_.html" http://twitter.com/statuses/update.xml`;
$fh = fopen("blogtweet.txt","w");
fputs($fh,$hv[entry_id]);
fclose($fh);
?>

See update (at end of this post) w.r.t. this code, which needed update, August 2009

3. I have added a regular timed (crontab) job on the server as follows:

10,25,45,58 * * * * cd /home/wellho/tweeter; /usr/local/bin/php blogtweet > /dev/null

So - about every 15 to 20 minutes - my server checks if a new blog entry has been added. And if it has, it uses curl to submit an update to twitter.

Note:

a) If I submit two blog items very quickly in succession, the first one may not be tweeted.

b) There is a time lapse of up to 20 minutes between me blogging and tweeting.

c) My script isn't 'clever' if I include quotes in my subject line

d) I haven't (in this simple example) checked the blog entry to make sure that it's actually been published.

e) An alternative curl that I tried (and worked) using Json was as follows:
curl -u wellho:twitterpassword -d status="Trying to Autotweet" http://twitter.com/statuses/update.json

Update - 9th August 2009 - The --basic option no longer works - indeed, tweets using it are simply being lost. Remove the option and carry on as before. I suspect that this change relates to the problems that Twitter have had over the last few days.

Posted by gje at 06:02 PM | Comments (0)


Related topics: via article database

Learning to Twitter / what is Twitter?

Have you come across Twitter - http://twitter.com. I expect some of the folks who read here will have done so!

Twitter is a "microblog" - a message of up to 140 characters that you can update as often as you like ... and that message is called a tweet. Boris Johnson, Barak Obama, Steven Fry all twit ... and have lots of followers. And Graham Ellis has just started to twit under the user name wellho and - err - doesn't actually have any followers yet.

It looks like one of the interesting things about Twitter is that you can read combined tweets from lots of different people - you can 'follow' and knwo what's going on with a lot of people all on the same page.

Will I have time to keep tweet'in as well as all the other things I do? Perhaps not, but I am experimenting with tweeting automatically from this blog - so that the subject lines will provide blog links and people can watch my blog purely on headlines, along with watching other twits (I suspect I'm not supposed to use that name!)

My userid is wellho and you can see my rudimentary page at http://twitter.com/wellho.

Posted by gje at 05:32 PM | Comments (0)


Related topics: via article database

March 27, 2009

Hire Car, from Atlanta Airport

It's only 3 days since we landed back in the UK ... yet it seems an age ago. I have written an incredible number of emails, created a new forum, and dealt with more than one major issue that's of the nature that I can't blog about it. This morning, I was up at 04:30 and prepared breakfast for over 20 people.

So this picture, taken at Ellijay in Georgia, seems like it's from a different age rather than Sunday evening!

I'm not usually one for cars, but there's something about the PT Cruiser that I find attractive, and I've enjoyed being driven in Sister-in-law Pat's car of that type. But what's the chance of a hire car company such as Alamo coming up with such a vehicle? Well ... stranger things have happened.

At Atlanta Airport, gone are the days of "your car is in row D space 98" (where D stands for distant, and numbers start at 1!), and it's now - "these are the midsize cars. Take whichever you like" and, yes, this car was amongst them. I have to say it's a good, customer satisfaction move on the part of Alamo - we certainly left the airport feeling that we had made a positive choice, rather than being foisted with a car which the sales rep had chosen for us from the bottom of the stack when we chose not to buy all the insurances and an upgrade.

In fact - I have to give the lady at the hire car counter top marks for explaining the insurances carefully and NOT coming across as if she was trying to sell them all, and double credit for helping us get in touch with Tyler and Alyssa to let them know we were in the country. I didn't take a note of your name - but thank you, for making it such a great welcome. And do you know what? I expect we'll hire from Alamo next time too, even if they're a few dollars more.

Posted by gje at 04:30 PM | Comments (0)


Related topics: via article database

March 26, 2009

Ruby Programming and Rails - 4 different courses in one

Week commencing Monday, 13th July ... is Ruby week!

If you're looking to learn to program in Ruby, you'll want to attend our four day Learning to Program in Ruby course.

If you're already a programmer, but in another programming language, and you need to convert to Ruby, start on the Tuesday and take our three day Ruby Programming course instead.

Will you be using Ruby within the Rails / web environment? If so, we're running an extra day on the Friday - that's Friday, 17th July - which is an introduction to the Rails environment. This extra day costs £350.00 (without accommodation) or £410.00 (with accommodation the night before).

So you have four choices - and whether or not you've programmed before, and whether or not you need Rails as well as Ruby, this is the week that you can learn it!

Posted by gje at 05:41 AM | Comments (0)


Related topics: via article database

Useful link: Ruby training

March 25, 2009

Ask the Tutor - Open Source forum

Well - I've taken the plunge!

When I installed a YaBB forum some seven years ago, I never imagined that it would grow as big as it did, with hundreds of posts on each of the subjects covered. And with that growth came growth panes where the forum became "Pot Bound" - unable to grow any further. So, over the last couple of hours (and in answer to a "where is there a good Expect forum?" question I have installed a Simple Machines Forum called "Ask the Tutor" to replace "Opentalk".

The URL is http://www.wellho.net/ask

The main intent of the forum is to give past delegates on courses somewhere they can ask questions and share experiences, but I'm happy for others to register and post up good, Open Source, questions too. That way, the forum will develop and help everyone.

So - please visit "Ask the Tutor", register, and say "Hello".

Posted by gje at 07:36 PM | Comments (0)


Related topics: via article database

March 24, 2009

What do people think of our Apache httpd / Tomcat course?

We train a lot of well known (no - make that VERY well known) names, as well as smaller organisations, and contractors and individuals too. And we thrive on customer feedback and recommendation - yet at the same time, we respect the privacy of our clients. So the following is reproduced with permission, and I'm only going to tell you that it's "A large UK service provider" who wrote it ...

Dear Graham,

It was good to meet you last week. Thank you for the excellent introduction into Apache and tailoring the content for our own requirements.

Feedback from the team has been excellent and I myself thought it was also superbly delivered and fully met the agreed objectives.

Only other thing suggestion (I have now realized…) we could have made it 3 days and had more on troubleshooting and customizing logs for Apache and web apps.

But we have now got a solid foundation to move forward and discover for ourselves J

I will keep you in mind for any of our future needs and pass your details on within our organization,

Here’s some additional feedback I gathered:

Score from 1 to 5 , with 1 being the ‘Best’
1 Appropriate to my role and responsibilities = 1
1 Usefulness for platform issues /trouble shooting = 1
1 Assist with further analysis and enhancements of the platform = 1
1 Trainers knowledge and course delivery =1
1 Facilities and accommodation =1

Any other comments : Well presented course clearly delivered.

Score from 1 to 5 , with 1 being the ‘Best’
1 Appropriate to my role and responsibilities = 1
1 Usefulness for platform issues /trouble shooting = 2
1 Assist with further analysis and enhancements of the platform = 2
1 Trainers knowledge and course delivery = 1
1 Facilities and accommodation = 1

Any other comments : Excellent introduction to the subject, well presented and good environment.

If you have any questions please don’t hesitate to contact me.

Best regards,

Thank you Xxxx - much appreciate the feedback.

The comments related to a private, 2 day course that we ran at Well House Manor last week for a group of 5 delegates, who stayed with us. The course agenda was based on our public Deploying Apache httpd and Tomcat course, but with some of less relevant issues (e.g. some of the connectors) covered only in outline, and with the addition of material on ab (ApacheBench), JMX, Jconsole, Garbage Collection and JMeter added.

I am in agreement with the review that the course could usefully have extended to a third day in this case, but "time is money" and customers have limited budgets - we don't attempt to stretch material to fill extra time, preferring to deliver a short, quite intensive course.

Posted by gje at 11:10 PM | Comments (0)


Related topics: via article database

March 23, 2009

A B C D of GA and TN

Pictures from this weekend ...

Amicalola, Georgia


more pictures

Blue Ridge, Georgia


more pictures


Copperhill, Tennessee


more pictures


Ducktown, Tennessee


more pictures

Posted by gje at 12:31 PM | Comments (0)


Related topics: via article database

Visiting Family

Lisa and I have been spending a few days with son Tyler and his wife Alyssa in Georgia - all four of us are pictured here at the Amicalola falls (which you can see through the trees because the leaves are, as yet missing), with another passing early season visitor taking the picture for us. It's one of those tourist spots where everyone says "hi", rather than one of those spots where everyone pushes for their place in line!

Tyler and Alyssa are living on the Georgia and Tennessee border - and you'll see how literally they ARE on the border from this picture, with the state line running right through their apartment block (and through their own apartment too). This is Copperhill, TN - and McCaysville, Georgia.

It's been a catch-up weekend, and a chance to talk past, present and future. A chance to get to know Alyssa a little better. And as you can see from this picture, Tyler and Alyssa are very much looking forward. A lovely couple, and I'm proud to have them as part of our family, all a part that we haven't seen as often as we would have liked. I remember one of our friends describing it as "Damned Geography", and and of you folks who have a spread out family will know what I mean.

I like this picture, and I think it sets a theme and a route forward. I don't know exactly where Tyler and Alyssa will end up in life, but they are clearly - so clearly - a couple and suited for each other; on the same wavelength if you like. They've already had a number of those bumps and jolts, and been strengthened by them. And I look forward to that strength growing and to them developing / moving on to something (and perhaps somewhere) they'll really blossom and enjoy.

Posted by gje at 11:22 AM | Comments (0)


Related topics: via article database

Should I maintain the programming code on my own website?

A Question from my inbox:

Graham,

[snip]

I did lot of FORTRAN programming myself in 80's, but mostly as a tool for solving engineering problems. For about 15 months, I maintained a 27000 line raw FORTRAN code, written by 8 Ph.D. souls. In 1998, I created a passive website for myself (Bridge problems and solution), and in 2001, switched to postnuke CMS. Over time, I lost my skills in coding, and lost touch too. Thus, when comment spamming infested my website www.demicoma.com, I simply threw in the towel, and stopped site updation.

Perhaps, I rationalised by postulating that I could not do both the form and content based myself and that was why the site was languishing. Today, after the recession bit our engg. activity, I have more time on hand and was thinking whether that postulate was correct. Basically, the question is, should I, a bridge expert-author-commentator of international standing, maintain the bridge site as well!!

I ask you because you seem to have so many websites and you seem to be managing both the form and content rather effortlessly (pardon my use of the term - but I guess you know what I mean). Of course, the form and content are intertwined in a special way for your work, and it would not be so for anyone else. Leaving aside that aspect, could you please let me know your views on this issue?

thanks and regards,

And my answer:

Dear Xxxxxx,

Yes, I remember you and them well. And that was an enjoyable course to give.

Your question is a superb one (in fact - would you mind me sharing my answer to you with readers of my blog, as I think it has more general interest) - in summary asking "should I do my own non-flat website work, or look for other means". That permission has been granted - Thank you

I can't answer that question for you - but I can give you some ideas, and they come down to the very first line of this answer where I said "and that was an enjoyable course to give". If you have the ability (which clearly you have, even if you would need to (re)learn some techniques), if you have the time (which you're indicating you might have), and if you would have the commitment (which is made - in my personal case at least - by getting enjoyment out of it), then yes, why not take on your own coding / updating / behind the scenes work?

But I can't tell you - who I have met only for a short time - what you enjoy, nor do I know how much time you really have. I see it as the most enormous compliment to our team (sorry if it wasn't intended that way!) when you talk about us looking after the site 'effortlessly'. I'm very happy it looks like that; behind the scenes, we have a site that has grown over the years and is very (needlessly) complex - 'for historic reasons' being an excellent excuse.

Because we wrote most of the software, it's easy to add a tweak here and a tuning there. But it is also easy for us to leave ourselves vulnerable to holes that we accidentally code in; they're not as bad as having a hole in something like PostNuke, because who in the community of hackers is going to bother to spread the world about our little hole which runs on only a single host as opposed to a piece of software that's running in quite a lot of places. But there are parts of our software that we did not write ourselves - the Forum and the Blog as complete 'units' for example, and other modules for Google maps, for identifying IP addresses down to geographic locations (Maxmind), for handline RSS feeds (magpierss), for generating graphics (phplot) and others which I'm sure I've overlooked as I put this answer together. Yet in most (no - I'll correct that - in ALL) of those cases we have tailored the code provided and gone beyond what the author's intent probably was. As an example, with the Blog software which is Moveable Type we extract the content into our own archives and search and ranking system so that we can tell Google via a site map something about relative ratings.

I guess what I am saying is "if you are capable (very clearly you are), if you have the time (it sounds like you might), if you would enjoy it so that you did a good job (that's the question I throw back to you), then YES it would be a good idea." But don't rule out the use of code that people have written already, and don't underestimate the time and effort it would take to write and maintain for the foreseeable future. I write to you from Blue Ridge, Georgia today - but look at my blog for the last few days (http://www.wellho.net/horse) and you'll see entries about how to move and rename a page without loosing ranking, and how to track down and trace intermittently manifesting bugs, so I'm never off duty.

While I was answering, it struck me that our "PHP techniques" weekend might be exactly what you need - it's coming up in 2 months. It's described at: [link] That's a new blog entry - it's been on my list to write up more formally since I first mentioned it to a few people (and we already have a booking) - another illustration of what goes on behind the scenes.

I hope that the above has been helpful - and if it's right, so see you in May (and if not, please feel free, still, to ask me further questions, etc! Whatever your decision, I'm sure you'll do fine!

Graham

Posted by gje at 10:49 AM | Comments (0)


Related topics: via article database

March 22, 2009

A room without a view

Lisa and I are staying at the Comfort Inn, in Blue Ridge. It's on a road called the "Outlook" and there are views from both sides of the hotel - on the ridge - to the mountains.

What a pity that some tw*t decided to build an oversized awning over the entrance to the hotel and block the view from a handful of the rooms, including ours ...

Posted by gje at 05:43 PM | Comments (0)


Related topics: via article database

PHP Course - for hobby / club / charity users.

Are you looking after a PHP based web site but want to do more with it? Perhaps it's the web site for your cricket club, your local school, or a charity or special interest group you work with?

What is this course all about?

Traditionally, our courses have run during the week and been aimed at commercial organisations - smaller groups of delegates, intensive courses to get the employees of those companies - for whom time is money - quickly and well trained during work hours. But more and more requests are coming our way for something that's more suited for the enthusiast / hobby end of the market. So we're running - as an experiment initially - a PHP techniques weekend. Here are the 'bullets':
• The course will be residential at our Melksham, Wiltshire training centre and hotel.
• It is aimed at those with some (not necessarily a lot) of PHP experience
• The objective of the two days is to ensure that you'll have a great learning weekend and leave able to do a lot more of what you want to do
• you'll be able to get back with the tutor - and perhaps with your fellow delegates - after the course with follow up questions
• and you'll have fun!

(If you have no prior PHP knowledge, this particular weekend isn't the one for you - please email me - graham@wellho.net)

This is an example that we'll have available during the course - showing current issues with train service (lines) and on the roads (spots) in the South West of England. It's a dynamic diagram so it may just be an outline - or it may be covered on data to indicate serious transport problems! See here for a detailed key.

When is the course and how does it run?

The course will be run by Well House Consultants who run a full training program in Open Source programming at their Well House Manor training centre in Melksham, Wiltshire where clients include many of the top uk companies, educational establishments and government bodies. The same equipment and training rooms will be used for this course, which will be lead by Graham Ellis who is the author of the material and Director of Well House.

Arrive on the evening of Friday, 22nd May 2009.

Settle in / get online / get set up using the course web server that will run your code, and get to know your fellow delegates.

Saturday, 23rd May

We'll start the day after an early breakfast with a review of PHP - a dash through the basics to help you pick up on any little missing holes in your knowledge, and to help you qualify your code so that you'll start looking at easy of writing and maintainance, and code security, as the future bedrock of your coding. Those might be low down your priority list at the moment, but they'll become critical on a popular site.

Linking a series of visits by the same user together into a session is a critical part of many web applications, and after coffee we'll look at sessions, and how to write good session code - you may have heard terms like "4 layer model" and MVC and we'll see how those design approaches can be applied, together with worked examples.

Lunch will be provided.

In the afternoon, we'll look at some specific subjects, with practical sessions and assistance based on our library of modules. Each delegate will be invited to broach a subject before these sessions begin, and we'll cover topics relevant to everyone. Here's a taster of some of the subjects on offer:

* Optimising your dynamic pages for the search engines such as Google
* Finding resources - already written code, modules, and answers
* Naughty Word Filtering, Spell Checking, suggesting similar words
* Checking your user is real (answer a question, type text from a graphic)
* Data Validation / making your site easy to use / Avoiding bloopers
* Getting users to sign in and maintaining user accounts. "Forgot my password"
* Credit card and other secure payment issues
* Linking web data to and from your other (nonweb) databases
* Consistent look and feel and flexibility - using CSS with PHP
* Cutting in feeds from other sites - RSS, SOAP and other options
* Identifying where in the world your visitor is coming from
* Did your visitor arrive via a search engine? What are they looking for?
* Making use of mapping resources such as Google on your site
* Providing User Feedback screens
* Writing for a wide variety of browsers
* Should we be using Flash / Ajax / Javascript?
* Should I use PHP objects?
* Producing dynamic maps, diagrams and graphs through PHP
* Sorting results by location
* Site searches - how to produce helpful results
* Caching and other loading issues
* Selecting your web space provider, and running your own server
* This list in not exhaustive - bring your code and questions

We'll run into the early evening - the training room will be accessible to you as late as you like, and the tutor around until mid evening if required.

Sunday, 24th May

After breakfast, a more formal session will look at the wider responsibility of running a web site - issues from copyright to data protection and privacy, and from usability through security, and from Disability Discrimination to Acceptable User and moderation policies. These may not be 'PHP Programming' subjects, but they are just as important for you to have a legal and successful web site.

After Coffee, we'll spend time on how to write secure, reusable code and how to deal with all manner of security issues. "Do I really need this for my little site that's concerned with the Netherhampton Rugby Club" you may ask. Yes, you do; if you leave an opening, you could find an application at www.netherhamptonrugbyclub.org.uk that you've forgotten about has become a hotbed of porn (I've been there!)

Late morning, and afternoon (lunch provided once again), we'll be back to the list of topics that was drawn up on Saturday.

Late afternoon, and a concluding summary ... and you can be on your way. You'll go away with a lot more knowledge of PHP - and a wider knowledge as to how it can be applied to your site. You'll go away with ideas, and with links and materials through which you can practically follow them up. And you'll leave with a support route and contacts with and through whom you can raise further issues.

Delegates are welcome to stay on Sunday evening and into Monday morning - Monday is a bank holiday, and there's a great deal to see in Wiltshire!

Pricing

For this weekend course, we are offering the following special prices:

Hotel Rooms: £80.00 per night (includes VAT)
Course: £100.00 per day (that's £115.00 inclusive of VAT)

So that's a total bill of £390.00, including VAT, for a 2 day residential weekend, or of £470.00 if you stay on until the Monday. Breakfast and lunch included, and there is a range of places to eat locally on Friday and Saturday evenings.

Couples or two people from the same organisation are welcome - the double / twin rate for a room is £90.00, so that's £640.00 (VAT inclusive) for 2 people on the course, or £730.00 if you stay over until Monday.

If you live in Bath, West Wiltshire, North Wiltshire, Frome or Kennett, you are welcome to book as a "day delegate" - £100.00 per day. If you live further afield then, sorry, the days are long and we recommend that you don't commute.

Please phone in or email if you want to check the suitability of this day for you, or if you want to book (01225 708225 / graham@wellho.net). 25% deposit requested with booking, rest due at the start of the course. We take cheques, Visa, MasterCard and AmEx and occasionally people have even paid in cash. You can also make an online transfer to our account ...

Second illustration - We identify our visitors by where they're visiting us from so that we can tell people to call 01144 1225 708225 from the USA, 0800 043 8225 from within the UK, and 0044 1225 708225 from elsewhere in Europe. On this map, we plot all the visitors from within the UK in the last 15 minutes, with larger dots for those of you who have visited larger numbers of pages. Other maps (see here cover Europe, and the whole world.

Posted by gje at 04:08 PM | Comments (0)


Related topics: via article database

Useful link: PHP training

Where is my new Apache httpd installed

When you're installing a software package you have the install script writer has a choice - whether to put it all in one place so that you can easily remove it again if it doesn't work for you, or whether to spread the elements far and wide so that each element is on an area of the disc which has an appropriate backup strategy and ownership. And the choice isn't a clear one - neither way of doing it is right or wrong - both are imperfect.

Most of us install much more software than we end up actually using, and the ability to try something out with the knowledge that we can remove it very easily if it doesn't work out is attractive - and that "install in one place" philosophy is the approach taken by the Open Source community. If something that you've put into /usr/local works out for you, it's not a big deal to move the start-up script into /etc/init.d and add a couple of links from /etc/rc3.d or /etc/rc5.d, nor to move the dynamic data area to some other area of the file system where it will be regularly backed up.

But even that moving of a few elements around may be more than the home user, wanting a minimal of computer knowledge, is prepared (or indeed able) to do, and that's where the Microsoft / packaged and with install wizzards to wave a wand and throw things into lots of places comes in - and is perhaps well suited for that market.

Here's a top level directory listing of a recently installed Apache httpd; the subdirectories will be similar for other open source installs, and if you're making your install permanent, this is the area where you'll want to (a) move a few things around and (b) change your configuration files so that the software 'knows' you have done so.

What have we in this directory?

bin, build, lib, include and modules should be left where they are - they are the programs associated with the installation, and all the extra bits of rarely-changing stuff that is brought in at run time. If you add modules such as jk or php (yes, PHP loads as a module), they will be in the modules subdirectory, for example.

You probably don't want to move conf although logically it might go into the /etc directory; it contains the configuration information for the software installed, and should be changed only rarely and only by the administrator - so having it in this well protected, read mostly, rarely backed up area is sensible.

This example is a web server - and so the data at the initial install is the data for the web site that its supports. And the default location is htdocs, with standard icons for automatic indexes in icons and the httpd manual in manual. The htdocs should - for sure - be moved (or, better a new one created elsewhere) and the config file /usr/local/apache2/conf/httpd.conf [default] changed to reflect the change at two places in the file, please note!. icons and manual should be left where they are, as you'll surely not be changing the icons nor altering the Apache manual, will you?

Programs that the web server can run (if and only if the facility has been switched on - Options ExecCGI - off by default) are in the cgi-bin directory, and you really should create a new one of those, and point your configuration file at it, if you're using the facility. It's usual to place the new cgi-bin directory as a sibling of the new htdocs, so that the changing web site (as looked after by a web site developer) is all in one neat bundle for backups / copies / looking after.

Finally, logging is to the logs directory. It's possible for you to choose to leave this where it is (but please add a crontab job to move the log file to an archive and start a new one every so often). You could also move it to a separate log are - /var/logs or /var/spool seem sensible places. And the third popular choice is to move the logs to another sibling of the new cgi-bin and htdocs, allowing the developer / web site maintainer direct access to them. On a major productions system, /var/summat is probably favoured; for something not quite so major, the sibling approach would be preferred. But it's very much a decision you should make based on the balance and use of the web server.

This subject is covered in some detail on our Linux Web Server course, and at a lesser level on our Deploying Apache httpd and Tomcat course, where the main topic is Tomcat which almost always sits behind a relatively lightly configured httpd.

Posted by gje at 09:52 AM | Comments (0)


Related topics: via article database

March 21, 2009

Blue Ridge and Melksham Chambers of Commerce

Seeing a sign marked "Fannin County - Chamber of Commerce" at the roadside here in Blue Ridge, Georgia, and being elected within the last few months as the President of Melksham's Chamber of Commerce on a platform of "Let's have this Chamber be a really effective voice and help for the businesses of Melksham", I decided to take the bull by the horns, pop in and say 'hello' and learn a bit about how a Chamber of Commerce works in the USA.

Both Fannin County and Melksham have populations of between 20,000 and 25,000 so the comparison seems a fair one - but the Chambers of Commerce are as different as chalk and cheese. Now that's party caused by the different statutory natures of the beasts - in the USA, The Chamber is partly (largely?) funded by a bed tax, levied by hotel and guest houses and self-catering outlets on our of town stayers - and in this county, a holiday area, there are some 1000 beds covered. And that places The Chamber (most of who's members are in the tourist business) in the role of Tourist Information Centre too. Here's me and a Jode Hanson of the Fannin County Chamber of Commerce in their own offices / TIC - open seven days a week for the area's businesses - and for the customers of those businesses too (and that largely means tourists).

In many ways, it's streets apart from the Melksham Chamber, which is still recovering from controversies, at a time before Lisa and I were in town, that related to whether or not the chamber should support certain local developments. For every member that the Melksham Chamber has, the Fannin County chamber has 25. And yet when I look at the Fannin County Chamber - and (we were told) it is one of the most successful around - I see many things happening which fit our aspirations too. Support of local businesses and their customers; supporting members; local networking; an information source.

Lisa and I came away with ideas. And with a variety of samples ranging from maps produced by the chambers to their member directories handed out to area visitors. And copies of member paperwork too, such as the chamber's literature advocating membership, listing benefits and including a joining up form. These will be reminders for us when we get back.

Before the month is out, you'll see more on the Melksham Chamber of Commerce - both here and elsewhere. Much of the preparation work has been done behind the scenes. But it was really great to see a bustling CoC here in Fannin County, giving us confirmation that what we're looking to do is universal, and along the right lines.

Posted by gje at 12:15 PM | Comments (0)


Related topics: via article database

If you have a spelling mistake in your URL / page name

What do I do if someone reports a spelling mistake on one of our pages? I check that they're right (OK - I usually know straight away that they ARE as I'm one of the world's worst spellers and often distort one word into another valid word), and fix the page. And drop them a brief "thank you" of course. It's actually a help to us to correct even quite small goofs - helps our huge web site look more professional, and the changes indicate to search engines that they're not just indexing a decaying archive.

But what if a spelling mistake extends to the URL? To correct or not to correct?

If there are links to the page, especially external ones (Q - how can you tell ... - you can't be sure, but your combined web log gives you a clue), or if it's been indexed by the search engines and is popular (Q - how can you tell ... A - same as previous answer), you don't want to loose the URL, nor do you want it to survive unmodified as the current / used link. So along comes - once again - our "superhero" - mod_rewrite.

Mod_rewrite can be used to rewrite the faulty location to the correct one, and you can place the page at the correct location. Or you could leave the page where it is, and use mod_rewrite to create a new URL for it. Perhaps better would be to relocate the page, and send out a "moved permanently" message to the browser - that's a return status 301.

The particular example that I had this a.m. related to my corruption of the name Pennines into Penines, in our "share" directory. The directory already has a .htaccess file, already has mod_rewrite enabled, so the extra line I added to do the "301" divert was:

RewriteRule ^penines\.(.*)$ /share/pennines.$1 [R=301,L]

Oh - and I moved the page ;-)

Try it out: penines.html (wrong) link and pennines.html (right) link

Posted by gje at 09:43 AM | Comments (0)


Related topics: via article database

March 20, 2009

Leading Lines

The lines in a photograph lead the eye to the distant point where they converge. Try that out with some recent pictures I have taken

Power lines cross the fields behind our HQ in Melksham - and the eye follows to where they meet the horizon

The hedge, the amphibian barrier, and the fence around the Melksham Oak school site converge into the distance, where your eye is naturally drawn

This seven lane highway is on the outskirts on Atlanta ... and the road lines and traffic naturally draw the eye to look at Atlanta Downtown which - although small - is significant in the picture

Even without any formal lines, aren't you looking to the front of this queue at Gatwick to see what we're waiting for?

Posted by gje at 01:55 PM | Comments (0)


Related topics: via article database

Tracking difficult bugs, the programmer / customer relationship

If you've been programming for a while, you have probably come across one or two of those code bugs that are really really really hard to reproduce, track down and fix. And yet - when you do track them down / fix them from live (production) code, your users / customers just shrug their shoulders and you get comments like "if it only took you a minute or two to fix when you found what it was, why on earth did it take you so long to find what it was in the first place?"

I've had one of these 'incidents' running over the last few days.

The support pledge to ask people who are in favour of, and would use and benefit from, an improved TransWilts train service (www.transwilts.org.uk) is backed up by a page that includes a list of signatories so far.

When I wrote it, it worked.

When I tested it, it worked.

When I revisited it, it worked.

When others visited it, it worked.

Then someone report it had failed - a big gap between the two columns of names, and the right-most column so squished that the names folded - fault.

I tested it again - visited the page and ... it worked.

Correspondence - "which browser are you using" and "what's your screen resolution, but the problem went away - even for the reporter, it worked.

I tried it the next day to make sure, and it worked.

Another failure report came in - fault.

And deciding that there had to be *something* in these reports I visited the page and (to be honest, to my surprise) I got fault using exactly the same browser that had previously been working. But at least I now had evidence on my screen, and I was able to capture the HTML of that evidence and see just WHY it was happening.

Here's the excuse explanation:

Around 10% of our signups ask that their name be withheld rather than appearing on our page. That's for people in the railway industry, for example, who want to show their support but can't have their names out on our site because of their jobs. As each name is added on to the display, our code says "am I exactly halfway through the names I have to display" and if the answer is 'yes', it starts a new column - thus giving two columns.

However, if there happened to be a "name withheld" exactly halfway through, the answer to that question will be 'yes' not once ... but twice (the program loop before AND the program loop after the name to be hidden) and so the new column code is run twice, and we ended up with an extra blank column; we also ended up with columns with a total width or 150% of the width of the table, which browsers may get confused about.

When you think about it, the explanation makes logical sense when looked at against the evidence, with more people signing up as the campaign runs, so the problem appearing and disappearing as a certain Mr M..... (name withheld!) is exactly halfway through or slides forwards or back a couple of places.

The solution was to replace:
if (($nsf + $anonc -1) == $halfway)
$names .= "<td><td width=50% valign=top class=nonitaltext>";

by:
if ($split == 0 and ($nsf + $anonc -1) == $halfway) {
$names .= "<td><td width=50% valign=top class=nonitaltext>";
$split=1; }

which rather brutally ensures only a single new column by adding a flag variable (which, yes, I have initialised before the start of the loop).

The solution doesn't answer he question "if the problem was so small, why did it take you so long?", but I hope that this article does - as a whole go some way to providing that answer.


As a footnote, I want to add further comment:

It is very easy - far TOO easy - for the programmer in these circumstances to assume that the problem is caused by user error - indeed, I incorrectly did so at first, and I apologise. The strong consideration must be given to user error, but not to the extend of it becoming an assumption.

It is hard on the user experiencing the problems too; should he / should he not keep reporting them - especially if intermittent - so a programmer who's dubious as to their validity.

And IN THIS PARTICULAR CASE, I want to thank L** who has been the primary reporter for his positive approach and good nature while we have been sorting it. L** - you're quite exceptional and I'm proud to have you as a friend as well as a colleague in campaign.

Posted by gje at 01:21 PM | Comments (0)


Related topics: via article database

C, C++ and C# ... Java and JavaScript

With all the words in the world, and the ability to make more up, isn't it astonishing that we have in our business some confusingly similar names for programming languages!

C v C++ v C#

C is the bedrock language that's used to write all the modern operating systems, device drivers, other languages, and also code that needs to be tuned / run very fast. Sometimes it's the "grandparent" language rather than the parent in the "is written in" relationship.

C++ is an object oriented language and truly is that very important OO element added to C, maintaining C compatibility. Yes, there ARE things in C which a good C++ programmer won't use as the have been superseded, but the similarity and compatibility is there.

C# is a different language. It is based on the design philosophies of C, and indeed of C++, but it removes the extra complexities imposed on C++ by the need to be compatible with C, and it's a much more recent language so can and does include decisions made to help coding be done more quickly at the expense of larger and slower final applications.

You'll notice that I have a link from the C and C++ paragraphs to our courses (we offer 2 in C - choose depending on whether you've programmed before or not, and 3 in C++ depending on whether you've programmed in C before, or programmed before in something else, or not programmed before!), but we do NOT offer a C# course. We have a whole lot of reasons why not - let me just start with (a) we don't know the language well enough and (b) it's a commercial language (Microsoft's) which doesn't fit with our Open Source model.

Java v JavaScript

Java is a very well established, Object Oriented language with a wide variety of applications. There are huge numbers of options, packages, technologies implemented in Java to the extent that it can become very confusing indeed - we offer courses on the language itself, on how it's used on the server (applets, servlets) and how to deploy it on the server (Tomcat).

JavaScript is a language that's built into browsers - "DHTML" - which allows local programming capabilities, and you'll find some examples on our web site. We can provide some training, but we don't offer a full formal public course as we don't go in to JavaScript in enough depth ourselves. JavaScript is also present / supported, server side, in .asp and .NET.

Other Similar names

PerlScript and Perl are the same language - the difference is more in the name than anything else, with the extra "script" being descriptive of how it works rather than in defining a different language. We are pleased to train you on either

Jython is Python - implemented in Java rather than directly in C. Which makes Jython (which shares its syntax with Python - so 'same language') an ideal language for run time / scripting changes, updates, tailoring of Java applications. We are please to train you on either

Posted by gje at 08:07 AM | Comments (0)


Related topics: via article database

Useful link: Java training

March 19, 2009

Melksham to Georgia

From Melksham at 04:00 to Blue Ridge, Georgia, at 17:30 (or 21:30 if you use the same time zone). Visiting Alyssa and Tyler. 2 cars, 2 buses, 1 railed transit, 1 aircraft. We started counting the number of queues we had to go through when we were at Gatwick, and we gave up counting ... while still at Gatwick. As you see, we're still very much online here and I have already sent a couple of answers to be in people's mailboxes by the morning. And please do phone in and book with Sharon (a.m.) or Chris (p.m.) who are holding the telephone and hotel fort. "Breakfast for 21 people tomorrow morning" Chris tells me. Pictures to follow in the morning ... I'm at our "second machine" where the screen really isn't big enough to do Photoshop work.

Posted by gje at 11:28 PM | Comments (0)


Related topics: via article database

March 18, 2009

The Longest Day - Wednesday, 28th September

You might have thought that the longest day was 21st June (in England) and 21st December (in Australia), but of course the longest day for a programmer is Wednesday, 28th September. That's the test day that you should use to see weather your text fits or whether your line folds ... the longest day in terms of being the longest piece of text!

Posted by gje at 08:21 AM | Comments (0)


Related topics: via article database

Changing the 404 - file not found - page in Tomcat

If you're running an Apache Tomcat web server, how do you customise your error documents? Add an <error-page> tag set into your web.xml file

To change this:

into this:


I added the following to by web.xml:

<error-page>
<error-code>404</error-code>
<location>/broken.html</location>
</error-page>

and put the following broken.html file into my web application:

<head>
<title>Sorry - no such page</title>
</head>
<body>
<h1>Oops - I don't have that page</h1>
This is our "error 404" page. Please
visit <a href=http://www.wellho.net>our
home page</a> to learn about our courses.
</body>

Do you want to know how to increase the amount of memory that the JVM gets given in Tomcat? That's in another post - here - which I promised today's delegates I would mention for them!

Posted by gje at 01:23 AM | Comments (0)


Related topics: via article database

March 17, 2009

Comparing Java Courses - what can we do?

In answer to the question "Graham - what options can you offer me for a course similar to [gave me URL of an advanced server side Java course run by another training company, but not scheduled until late summer]?" from a potential course booker. I replied ...

The description you have referred me to is a more advanced Java course that looks particularly at programming applications for use on a web server in Java, for delegates with prior Java experience in other fields. These days, we find that most people who are using Java are using it on the web, and that a combined "Programming in Java for the Web" type course - which covers both Java and the web stuff - is more relevant; there are relatively few delegates who know Java already, but need to add the web element.

So our published course schedule offers:

* Learning to program in Java - 5 days - covering basic programming principles, the Java language, and a somewhat lighter look at the advanced Servlet / JSP type course of the Learning Tree specification you sent me to compare to. See http://www.wellho.net/course/sjfull.html . This course is for delegates with no prior programming experience.

* Java Bootcamp - 4 days. Covering the Java language, and the same somewhat lighter look at the Servlet / JSP subjects of the previous course. See http://www.wellho.net/course/bjfull.html . This course is for delegates who do have prior programming experience, but in a language other than Java.

* Apache httpd / Tomcat deployment - 2 days. This course covers the running of web servers on which Java applications are running, and isn't a programming course at all - it's all about how to run servers that run third party written programs. See http://www.wellho.net/course/atfull.html

How can we help delegates who already know Java, but need to add in the Server side skills?

1. We've got the material / we can do this on private, tailored courses to match the exact needs of the client company. That's cost effective if there are three or more delegates to be trained at the same time - and that is often the case with Java, which is by nature a language that's used on larger projects where there are multiple (or even hordes of) programmers.

2. I would be willing to fill a gap in our schedule with a three day course covering this material that we already use on private courses - for experienced Java programmers, covering Servlets, the servlet life cycle, database access (although that's really a more general Java topic), maintaining state so that server requests can be linked into a complete application (a.k.a. sessions). JSPs, custom tags and the standard tag library, and an overview of Struts. Also covering the design issues to make sure that applications are going to be easy to use / maintain / upgrade, and will be robust.

Please let me know if you're interested in either of those options - the first one would vary in price depending on number of delegates and location, the second would be priced at 1030.00 + VAT per delegate - that's the residential cost at our Melksham, Wiltshire training centre including hotel room there for three nights. If the delegate(s) live in Wiltshire or nearby and can commute daily, the cost is 850.00 + VAT.

P.S. If it turns out that the delegates need to learn Java / aren't all that familiar with it, and the 4 day Java Bootcamp is right ... EXCEPT that they need to cover the Servlet and JSP topics in more detail, we can extend that course by 1 or 2 days (350.00 per extra day / 410.00 extra inc. room) to cover that extra material. Those days could follow directly on, or be after a short break.

Posted by gje at 05:22 AM | Comments (0)


Related topics: via article database

Useful link: Java training

C Programming v Learning to Program in C. Which course?

We offer two C courses - varying depending on the background of the delegates.

For delegates who have prior programming experience, our two day Programming in C course will help them convert from VB, or Perl or Java or Fortran or Cobol ... the course assumes a knowledge of programming techniques such as the use of variables, conditionals and loops, and the naming of blocks of code for re-use in what are know variously as "functions", "subroutines", "methods" or "procedures".

For delegates who are new to programming, our three day Learning to Program in C course covers the background principles that I've just mentioned above, and in the context of C programming, which is then followed on the second and third day by the same material as we cover on the C Programming course.

By offering two courses, we provide our delegates with a course that is far better tuned to their needs than a "one size fits all" course would do, and by joining the two courses together after the initial "learning to" day, we provide group interaction within the class for the benefit of all concerned - this use of an extra day on the front is something that we do with other languages that we teach too, and although it sometimes provides an element of questioning along the lines of "which course should I book?" it does allow us to provide a course which is gentle enough for the newcomer, AND a course which isn't boringly slow for the experience programmer who's converting.


If you're looking for other programming languages, you'll find we apply the same principle to PHP, Python, Ruby, lua, tcl, and Java.

In Perl, the two courses are combined from day 1, and in C++ we offer a third course, which is even more advanced in its starting point - it's for those who have prior expericence in the C language which forms a part of C++. So
Learning to program in C++ for newcomers to programming. 5 days.
C and C++ programming for delegates with prior programming experience - but NOT in C. 4 days.
C++ programming for delegate who are already C programmers, and who need to add C++ to their skills. 2 days.

Posted by gje at 04:14 AM | Comments (0)


Related topics: via article database

March 16, 2009

MySQL - licensing issues, even with using the name

MySQL is a really good database and it's been available for a very long time under an open source license - indeed this piece of text will be stored in a MySQL database when I've added it to our web site using the Movable Type software , and pulled back from there using both Movable type software (here), and also our own software (here). However, it has always been at the more commercial end of the Open Source movement, with tighter licensing conditions that most. That was the background for MySQL drivers being withdrawn from PHP at release 5 of PHP (if you want MySQL in release 5 of PHP, you have to download MySQL yourself, first, before you build as there's not a bundle - we do this on our LAMP deployment and Web Server Deployment courses. And that tighter license helped to add to the commercial value of the MySQL company which sold out about a year ago to Sun Microsystems for a reputed 1 billion dollars.

We've just received an email from Google - and I'm pretty sure it's genuine - telling us that we can no longer use the keyword "MySQL" in our Adwords campaigns. Because "MySQL" is a trademark.


> > ----------------------------------------------
> > Campaign: 'Wiltshire,' Ad Group: 'Ad Group #1'
> > ----------------------------------------------
> >
> > AD TEXT:
> >
> > Melksham, Wiltshire, UK
> > Perl PHP Java Tcl/Tk MySQL & Java
> > Scheduled and private courses
> > www.wellho.co.uk
> >
> > Action taken: Suspended - Pending Revision
> > Issue(s): Ad Text Trademark Term
> > ~~~~~~~~~
> >
> > SUGGESTIONS:
> > -> Ad Content: Please remove the following trademark from your ad:
> > mysql.

Now that's an interesting one!

I used to express an opinion that the MySQL folks had done their database a dis-service by having a license that restricted it so that it could no longer be part of the PHP distribution - in some quarters, the lack of the MySQL driver in the PHP distribution persuaded people NOT to upgrade / use a technology where two of the key element's players couldn't agree on a combined, Open Source download. And that it did not bode very well for the future. I may be wrong in that opinion as they seem to go from strength to strength and are probably (I've not got the commercial figures of course) doing a good job in making more people purchase rather than use the open source version.

I've plenty more to do than to do anything to fight to keep the MySQL as a Google keyword, and our model is open source, so I'll be suggesting to Chris who looks after the various campaigns that we update ads like the one above to push our Lua (on the most open of open source licenses, and also much more fun to teach as it's a language not a database) and Ruby courses ...

Posted by gje at 11:38 PM | Comments (0)


Related topics: via article database

Useful link: MySQL training

March 15, 2009

Books and distance learning from Well House Consultants?

A question from my ask the tutor page which really deserves adding to an "FAQ" ... so I'll publish the question and answer here

> Sender - Xxxx Xxxxxxxx (xxxx@xxxxxxxxxxxxx.co.uk)
>
> via page - /course/index.html
> do you do any books or distance learning courses

Hi, Xxxx

Thanks for writing / asking. The answer is "yes and no"

Bookwise, we do write and publish our own training notes to go with the courses, which are very thorough in what they cover, as they are designed to be useful to delegates after the course as well as *during*. There are samples at http://www.wellho.net/downloads/ and there is a complete download of the Java course and a few others at http://www.training-notes.co.uk/

Trainingwise, we specialise in providing public courses at our own centre, and for groups we also provide private courses at our centre or private courses on your on site - so we could travel to your location. However, we don't run courses via video links or use the other distance learning techniques as most of our clients are looking for a short, intensive course with immediate recourse to the tutor who's physically in the same location. There *is* a market for online training, training CDs, etc, but that's not quite the market we're in and we would be spreading ourselves too thinly if we tried.

One of the things that we have just scheduled may be of interest to you, though, as it's rather different to the traditional course and is intended for the budget conscious trainee - perhaps working on a club or charity site, or for his own business where it would be a huge decision to go away for a few days during the week. We're doing a two day residential "PHP workshop" at the end of May bank holiday - arrival on the Friday evening, departure on Sunday evening (or stay over to Monday morning if you want to see the area ;-) ) at a cost of 100 pounds per day (+VAT) - the hotel room being an extra 80.00 per night. Please do let me know if that (or anything similar) would be attractive to you.

Graham

Footnote added to this published version .. If you are interested in these weekend sessions - this first one being intended for people who know a bit of PHP but really want to make the best of it in their web site ... please ask. You could do so by filling in the PHP-handled form here where we use captcha scripts to have you re-type a word to ensure you're 'real' something covered over that weekend along with many other topics!

--
Graham Ellis
Well House Consultants, 404, The Spa, Melksham, Wilts, SN12 6QL
Well House Manor, 48 Spa Road, Melksham, Wiltshire, SN12 7NY
http://www.wellho.net - http://www.wellhousemanor.co.uk
0800 043 8225 (freephone) or +44 (0) 1225 708225 (phone)
email - graham@wellho.net , fax +44 (0) 1225 707126

Posted by gje at 11:13 AM | Comments (0)


Related topics: via article database

Do you support a decent train service? Please sign up!


Click on image to add your support or here to learn more first

Public transport across Wiltshire is truly appalling - after the 06:15 train from Swindon to Salisbury, there isn't another until 18:45, and if you catch the bus or make a dogleg train journey via Bath or via Reading (the two routes offered) you'll take the best part of two hours. That really a pretty poor link between the county's largest town and its city which are just 40 miles apart as the crow flies, and as the private car drives. It's not as if the train just passes through open countryside either - it "serves" the next three population centres of the county at Trowbridge, Chippenham and Melksham too.

We hear a lot about sustainable transport, and we hear a lot about encouraging the economy. We also hear of traffic jams and of people having to look harder and pay more for parking. And I was listening to a lecture recently where we were told of families dropping back from two cars to just one ... Wouldn't it be a sensible time to put some appropriate trains BACK on the TransWilts line which is still very much there (in fine condition) and ready to take them!

The way it works is that the railways change their timetables in May and December each year ... we're probably too late for May but we could be in time for December. A huge amount of background work has already been done. Timetable worked out. Train and crews earmarked. Financial options (to seed for first years) discussed. A new announcement by Geoff Hoon, the transport secretary, will allow the improvements to be rolled into the next round of railwatch franchising to help safeguard them into the far future. But it needs the final decision to be made.

The local transport authority in these parts is Wiltshire Council, who have been described as "pro road". They have various proposals out for the A350 at present, looking to rebuild / improve the best part of 20 miles over the next fifteen years (and would need to do more than that if they wanted to deal with certain remaining bottlenecks!). For the cost of 20 yards, they could 'seed' the rail service for a year - the government are happy for them to do so (I was talking in person with Ben Bradshaw, MP, Minister for the South West about it last Saturday) and First Great Western are willing to run the trains (I was also talking with Mark Hopwood, the MD of First Great Western on the same day). Wiltshire Council - unlike many other councils - weren't represented at that day's event and looking through the "apology" list I can't even spot their name there ... so it's my view that the profile of the case need to be brought rather more thoroughly to their attention.

We have local elections to Wiltshire Council coming up at the start of June. Now is an excellent time to be in touch with them, to let the incumbents who are standing again know that we are looking - amongst other things - at decent, sustainable public transport, and want then to provide such. We're also lobbying the other parties; it should not be party political, and I can confirm that the main alternative party has already budgeted for that "20 yards" which would give us a decent service. Another way of costing it is to say it's 1p per council tax bill per week.

Is it a good idea to cut travel time from Trowbridge to Swindon from 50 minutes to 35? And to be able to leave the car behind? And to have the travel provided in an all-inclusive way that means that you don't have to own a car to make the journey a practical commute? If you think so, please add your name to our pledge of support at www.transwilts.org.uk

Thank you!

P.S. If you want to know more before you add your name there are plenty of links from the page I have pointed you to ... and I and many others are happy to answer further questions!

Posted by gje at 06:34 AM | Comments (0)


Related topics: via article database

March 14, 2009

Jmeter - a first test case

Would you like to see how your web site performs under load? I mentioned ApacheBench (ab) in a recent post, but you can also use a tool like Jmeter. And although Jmeter is written in and runs in Java, you can use it to look at the performance of other servers and network resources too.

In famous "Blue Peter" jargon, 'here is one I put in the oven earlier' ...

... and the reason I put one in the oven earlier is because like all things Java, the documentation and setup looks very complicated at first.

How did I set this up?

0. I fired up Jmeter - previously downloaded and unpacked - making sure that a Sun JRE was 'top dog' in my PATH.

1. I started a new TEST PLAN

2. I added a THREAD GROUP
(4 users, 4 seconds ramp up, 200 loops)

3. I added an HTTP REQUESTS DEFAULT within Config Element
(wellho.net as the server but please use your own if you're following this!)

4. I added an HTTP REQUEST within Samplers
(path to /robots.txt)

5. I added a GRAPH RESULTS under listener

6. I saved the configuration as a .jmx file (robots.jmx)

and I chose "run" ...

Let me fill you in on those results. There were 800 samples taken as I asked for 200 sets of 4 samples, and I spread the sample sets out over 4 seconds apiece, so the total run time was about 3 minutes.

The sprinkling of black dots represent the individual samples and how long each of them took, with the blue line showing the average time and the purple line showing the median (time of the 50 percentile sample, which is a little bit different). The red and green lines are on different scales - the red line showing the deviation or variance which was high at first (probably because the first few samples would have been slow, the later samples consistently faster) and the green lines shows the throughput achieved - that starts low and rises, again because of early slow samples.

Right. Here is a stern lesson. Do NOT run Jmeter against a server that you don't own / don't have permission to try it out on. Tests like the one I have done above are cruel and can bring a server to its knees very quickly, so using Jmeter is a way to make yourself very unpopular! BUT if you're configuring a new environment it's a great tool!

I have only started to scratch the surface here ... as you put your first test plan together, follow what I have done on your own server .... and as you put your second plan together, have a look at the manual that covers it from Apache - in particular chapter 5 - here. You'll find it's very clever in terms of logging in, posted data, handling cookies and doing a lot more to simulate real traffic. Proceed further and you'll find that you can combine thread groups that are being run by different instances of Jmeter into a single report, and get some very sophisticated load testing running.

Posted by gje at 05:54 PM | Comments (0)


Related topics: via article database

Connecting jconsole remotely - the principles

BEWARE - this first is a "shows you how" and is insecure ... I am doing the demo this way because the security requirements add various issues that would complicate the first demonstration of principle.

1. Set up your SERVER to allow jmx remote connections on an otherwise unused port - we have done this by changing the Java options in the catalina.sh script - around line 188 in version 6.0.18 (ahead of the comment shown below) I added 2 lines:

JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=9876"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
# ----- Execute The Requested Command --------------------------

2. Restart the server via that catalina.sh script

3. Start the jconsole monitor

jconsole 192.168.200.215:9876

Now ... you should go back and add authenticated users ... lots of instructions available - here are some URLs to start you!

http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html#remote
http://forums.sun.com/thread.jspa?threadID=737279
http://java.sun.com/j2se/1.5.0/docs/guide/management/faq.html
http://blogs.sun.com/jmxetc/entry/troubleshooting_connection_problems_in_jconsole

If you want to try out this (and all the other Tomcat stuff) with us ... have a look at out Apache httpd / Tomcat course ... you may want to ask for an "extra day" too if you're wanting to go into the more advanced topics in detail.

Posted by gje at 04:16 PM | Comments (0)


Related topics: via article database

Using ApacheBench and jconsole to test and monitor Tomcat

jconsole lets you monitor Tomcat or another Java application so that you can see how much memory is in use, how many threads you have running, how many classes, etc.

Here's an example of a Tomcat server that was sitting virtually unused ... which we then exercised through ApacheBench - the ab utility that's supplied with Apache httpd, as follows:

ab -n 2000 -c 30 http://192.168.200.215:8080/whm_course/demo.jsp

That's calling for a page to be loaded 2,000 times - with a concurrency of 30 (in other words for there to be 30 connections all at the same time, simulating visits from 30 different places.

Not surprisingly, the effect of sending 30 concurrent requests was that Tomcat started another 30 threads to handle them (!) and those threads between them grabbed anothe4 4 Mbyes or so of memory. The cpu usage spiked to around 20%. What is interesting to note is that - once created - the threads live on in case further requests come in.

Posted by gje at 12:22 PM | Comments (0)


Related topics: via article database

Java - Memory Allocation and garbage collection

When you're running a dynamic application (and most of the languages we teach these days are dynamic), memory is allocated and released as necessary at run time, with allocation happening 'as required' and being released from time to time by a garbage collector - there is no point is collecting a few bytes of memory every time that there is some released as that would be very inefficient - rather like calling out your local council to collect your rubbish every time you finished a packet of crisps. So if you look at a graph of memory usage, you'll see a saw-toothed shape like this:

In Java, data (objects) are held in memory in different areas, and moved around between them, to make the memory management and garbage collection more efficient, and the memory areas each have their own names.

New objects are allocated memory in the Eden Space memory pool (as in created in Eden) and by the nature of most applications in which the majority of objects only survive for a short while, that's where they remain for their short lives. Here is a graph showing the size of Eden Space alone - you'll notice the same general saw toothed shape, but the curve drops virtually to zero at the base of every tooth:

At minor garbage collection time, objects which survive garbage collection are moved to the Survivor Space which, as the name implies, is used for objects that have a longer life span / expectancy. Here's a graph of survivor space - you'll see some gentle ups and downs but in general a much smoother curve!

And that minority of objects that aren't going to be going away but are 'around for the duration' become a part of the Tenure space. I wouldn't describe the graph for tenure as a curve - more like a straight line!

All four sample graphs are taken from jconsole, monitoring a Tomcat server that's ticking over with just a few test connections / pages being served.

There are also other memory pools used and shown by jconsole - there's the code cache where the code that's being run - both Tomcat itself and the classes it is running - resides, and you have permanent areas too - one "rw" (read / write) and one that is "ro" (read only). The code cache graph looks somewhere between the survivor and tenure in shape:

And the permanent areas are close to being flat files (I haven't reproduced them here!)

Posted by gje at 11:28 AM | Comments (0)


Related topics: via article database

Useful link: Java training

March 12, 2009

A lot has changed - but the memory lingers on

I got an email from a delegate I trained ten years ago - which goes to show just how long a week of training can be remembered. He wrote "I was trying to figure out how to return EOF in Java when Google showed site Well House. Well, I couldn't remember where I learned Perl but now I do! Sometime in 99 I took one of your Perl courses - which in fact did turn out to be exactly what I needed."

It's good to hear from people after all these years - it helps complete the loop and make it feel all that much more worthwhile knowing that people learn not only for the short but the medium and long term too. But - my goodness - a lot of water has flowed under the bridge in ten years!

I'll share my answer ... and help fill in any other past delegates who shourl stumble across our pages ... it's a small world after all

In "99", we were running our own Perl courses under contract at First Alternative who in those days had a training centre (since closed) at Harwell in Oxfordshire. In 2000, we opened our own training centre in Melksham, Wiltshire - initially for our Perl and Java courses, but we rapidly added Tcl, and since then other languages too, most notably (in terms of business volume!) Python and PHP.

We've specialised in the REALLY niche stuff, so that most of our delegates travel a long way to our courses - and that means that some 80% of delegates also want overnight accommodation - so in 2006, we expanded / opened a new training centre / hotel, where we now run all of our public courses. And we're teaching Linux, web server deployment, Lua, Ruby and MySQL - also C and C++ - in addition to those subjects mentioned above. Then we found that people coming to Melksham, or to visit Bath, like to stay with us because we're a full hotel ... and people want to hire our training rooms to run their own courses ... and we're now something of a 24 x 7 business!

I may be wrong ... but some vague bell tells me that you were with Oxford University of based near there. If I have committed the ultimate sin of mixing up my Oxfords and Cambridges - oops - I expect you'll forgive me.

Did you get your Java "eof" sorted? The answer will depend on what method you're using on what type of object ;-) .... with chance being that it will be a cardinal number like -1, a false, or an exception chucked back at you. Please do let me know if you are not resolved and I'll have a proper look within 24 hours - there's no limit to how long I like to help past students. In fact - I started a blog back in 2004 and I post useful answers such as this up there ... please do have a look at http://www.wellho.net/horse - for "The Horse's Mouth". And if you fancy a weekend away in Wiltshire, do come down and stay at the hotel ... you can refer to the library of around 700 books (100 on Java, 100 on Perl) and we can catch up on old times. Oh - the hotel web site is http://www.wellhousemanor.co.uk and past delegates can stay at the weekend at a special price of 70 pounds per room per night ;-)

Anyway - let me know if you need a hand with the Java, and if you're down our way (but not looking to stay) put in for a coffee. Good to hear from you!

Posted by gje at 01:42 PM | Comments (0)


Related topics: via article database

Why put Apache httpd in front of Apache Tomcat

Does it seem odd to you that Apache Tomcat is a web server ... and yet the majority of sites run with another web server - Apache httpd - in front of it. Why do they do it?

There's a whole host of reasons! They including better logging, load balancing, security, speed of serving static pages such as images, allowing other (non-Java) content to work efficiently on the same domain, more configuration flexibility and so on. I sometimes describe Tomcat as being like an aircraft that will get you from "a" to "b" .... but very few people actually want to go from "a" to "b" - they want to go from somewhere 20 miles from "a" to somewhere 40 miles from "b", so the need something else to complete the journey - a car, or httpd.

So we offer two web server courses - there's a course that covers Apache httpd alone - the majority of non-Java sites run with that server, and a course that covers Apache Tomcat, and also some Apache httpd and how the two interface - which suits that majority of Apache Tomcat users. Both courses are two days in duration - the 'pure httpd' one covering Apache httpd in a lot more detail that the combined course, where httpd is more likely to be used as a wrapper rather than a significantly configured workhorse.

Posted by gje at 10:46 AM | Comments (0)


Related topics: via article database

March 11, 2009

A New Advert for Well House Manor

Who are our hotel customers at Well House Manor? We have several distinct groups, and the question comes "how do we arrange our advertising to suit them all?" ... we really don't want guests who are visiting Melksham to attend a wedding at the weekend or meet up with family to be put of by our "business hotel" approach, nor do we want our business guests to think that we're just a leisure destination.

The Melksham Independent News is a well read local paper - distributed to many thousands of homes, and our advert in there (at least) can clearly tell the leisure visitors what we offer ... thus the advert above.

We're delighted to welcome people touring the area, coming to weddings in Wiltshire, visiting their relatives in town - there's absolutely no requirement for them to have any association with a local company. If you're looking for a quiet place, slightly luxurious rooms, freedom to come and go as you please without the feeling that you're putting the landlord out as you come back after midnight ... we may be the place for you. If you're looking for somewhere you can retreat away from the hub-bub of kids (we have a minimum guest age of 14) and perhaps have a 'second honeymoon' ... we may be the place for you. And if you don't usually sleep well when you're away from home - you want a soft bed, a spacious shower, and a library of books and DVDs ... we may be the place for you.

Link - hotel web site or call us on 01225 709638

Posted by gje at 03:05 PM | Comments (0)


Related topics: via article database

Supporting Parkinsons and Trains

Duncan Hames, our "Lib-Dem" candidate for the new Chippenham / Melksham / Bradford-on-Avon seat at the next election, is a keen supporter of our campaign to provide an appropriate train service across Wiltshire ... he's pictured here at the station the other week.

And he's braver than me - he's running in the Bath Half Marathon this Sunday - seeking sponsorship on behalf of the Parkinson's Society, brought about by a familiy connection. We get lots of requests for support and sponsorship, and there's only a tiny proportion we can take up - but this is one that I do, willingly support and I'm sure that Duncan would welcome you supporting him too - see his further details and sponsorship page. He say the run won't be pretty - I'll leave you to look at his picture on that page and decide for yourself.

Come the next general election ... and I'm going to be in the unusual position of having met the candidates for all three major parties, and for more than just a handshake. And I've got a great deal of admiration and respect for all three of them personally; it's going to be a difficult voting choice. And all three of them personally support an appropriate train service. Of course, one's not just voting for the person but for the party and policies too, and I can't help noticing that it was the current Labour Administration that cut the local train service to the current absurd setup in the first place, and the Wiltshire Tory Local Transport Authority who are very detached from providing financial support, whilst ploughing millions into proposals for roads which will be used by private cars (and not even buses). A decent train service up to the end of the current franchise would cost about as much as 50 yards of road

Posted by gje at 11:52 AM | Comments (0)


Related topics: via article database

March 10, 2009

Weekday or Weekend PHP, Python and Perl classes?

Should we run training courses during the week, or at weekends?

Our 'traditional' business has been 80% + employees of companies, government organisations and educational establishments who have wanted weekday courses, with the remaining fifth being independents and contractors who are somewhat flexible, but see weekend courses as a bonus as they're able to learn in what is their customer's non-prime time. Our 'traditional' business has also been in training delegates with a little programming background (at the least) in converting them ... from Cobol to Perl, from VB to PHP or from Matlab to Python.

But we're seeing changes - brought on by dynamic web sites moving from the specialist to the more general, brought on by people having more time and bringing dynamic web sites more into the hobby / club / new career line, and brought on by people with little IT experience taking on the roles formerly occupied by specialists who have now moved (or been moved) on. So there's a need for us to be able to train Learning to program in PHP as well as PHP Programming.

So we've added a "Learning to ..." day in front of most of our programming language courses - where delegates who are new to computer programming (or almost so) can learn some of the fundamental principles and learn them as they relate to their target language. These days mean that newcomers get a flying start - typically with a one-on-one day, helping them get up to speed for the main course, with demonstrations and practicals written to suit their particular needs.

And we have decided to add the extra days - in many cases - directly in front of the main (Monday starting) course, which puts the extra day on a Sunday. There's no 'right' solution here, but we have done it this way because:
a) It leaves the main course on weekdays
b) It reduces the working days that learners are out of their office
c) It avoids blocking the week with sparse training days
d) It allows a continuity from a learning day onto the main course

With 80% of delegates still 'converting', I expect these "Learning to" days to be sporadic in when they run (this is where our guarantee that once you have booked, we won't cancel is so important to you) ... but they are scheduled now for the rest of the year.

Learning to Program in C - 25th March
Learning to Program in Python - 29th March
Learning to Program in PHP - 19th April

Also ... Learning to Program in Lua, Learning to Program in Ruby, Learning to Program in Tcl, Learning to Program in C++ and Learning to Program in Perl ... click on the individual topic for desctiption and dates.

If you're looking to learn but must have weekdays ONLY ... or if you want a weekend ONLY set of sessions ... please email me, and we'll do our best to help.

Posted by gje at 11:27 PM | Comments (0)


Related topics: via article database

Useful links: Python training, Perl training, PHP training

March 09, 2009

Extra PHP Examples

Yesterday evening and this morning, I was helping with some specific PHP questions ... resulting in some new examples that I've put on the web site.

• A program which can be used / allows logins only between 3pm and 5pm on a Wednesday afternoon (and could easily be adapted to let people in at breakfast time on Fridays instead)
Demo and source

• A simple session demonstration, which allows and controls logins ... if you log in with user name "terry" and password "trotter" you can try it out.
Demo and source code for main page and source code for form generator

• And finally, and example of how you should (and Should NOT) echo large chunks of HTML from your PHP program ... I feel really sad when I see a book with loads of echo statements all down one side of the example, when a "here document" or an exit from PHP mode would be so much cleaner. The illustration is photographed from one of the books in our library, and shows the way constant text output should NOT be done. It makes my toes curl!
Run the code and see the source

Aside from these examples, I've added two more articles that relate to the session - the first is about how to set up a MySQL database through PHP and the second covers those vital ancillaries such as Usability, maintainability, and keeping the user in mind.

There is a lot - an awful lot - more to PHP that just this sprinkling of issues - these are just the ones that have come up in the last 24 hours, and for one particular person. If you're new to PHP, have a look at our PHP course; if you've got some PHP background but want to go further making real use of the power of the language, consider our PHP techniques workshop instead.

Posted by gje at 01:28 PM | Comments (0)


Related topics: via article database

Useful link: PHP training

Copyright, Portability and other nontechnical web site issues

Sometimes, I get so enmeshed in the technical that it's good to take a step back and look at our web site (and web sites in general) and say "what do we need to consider in the broader picture". I had this opportunity yesterday evening, as I ran a short session to look at some PHP issues.

A couple of broader questions ... for you to consider about your site ...

What do we need to consider as well as the code?

Copyright Do we have a copyright statement? Do we own copyright on all the images and any text we have copied and pasted on to the site? Do we have permission from the people who we show or quote to show or quote them?

Browser Portability We've developed the site on Internet Explorer. Does it work on Firefox and other browsers too? How does it look on a reduced size screen? Does it print nicely - and does it print nicely on both European and American paper sizes?

Security Is it open to injection attacks? Can submissions of inappropriate material be easily made to the site? Do we have any data files which have accidentally been given URLs?

Findability How easy are we to find through the search engines? Do we have URLs which will make our pages stand out? Are we found on the correct terms? When people arrive at our site, do they arrive at an appropriate page? Do our URLs remain unaltered so that search engines will continue to send people to pages that continue to exist?

Maintainability If When something has to be changed, how easy will it be? Can we add an extra box onto a form, an extra page into a navigable set, an extra validation check into a user entry and have that change be consistently applied once it's been written and tested a single time? Can we avoid ending up with a mish-mash of different fonts, colours and look-and-feels?

Usability Do people find what they want on our web site? And if they do, is it in a form that they can make the use of it that they want?

Disability Discrimination Is our site accessible to those with various disabilities - people who require larger text, people who are colour blind (that's 8% of males in this country), people who are dyslexic, and people who require the text to be provided in shorter blocks?

Who is [this] web site for?

That's a big question ... which I've answered with regard to our web site.

Prospective Delegates ... Start at our public course schedule or at details of private courses at our centre or at your office

Current Delegates ... will find all the examples on their course under the course schedule [example] Perl Programming, and updated notes indexed on The Horse's Mouth.

Past Delegates ... will find the source code of all the training course examples, plus technical articles, sorted training module by training module. There's a full module index for you to start from.

Hotel Guests ... are catered for by our Well House Manor web site, which has appropriate links back and forth.

Technical questioners ... should land on the subject that's of interest to them - for example Using MySQL databases from PHP. There's also a technical subject index available.

Staff ... have a common page here which contains all the critical information we need to access rapidly; if you visit the page, though, you'll only see limited information whereas we see the status of the hotel rooms, who is signed in on duty, notes back and forth between the staff, and an indicator as to what our front door greeting screen is saying.

Friends and family ... can keep updated via The Horse's Mouth where a proportion of articles will be "newsy" rather than technical and ...

Community Interest Where individual interests / groups with which we are concerned can start. We have Melksham Chamber of Commerce diary and news, we have the First Great Western Coffeeshop, and we we have the obscure like the Larkhill Military Railway at Druid's Lodge and Ratfyn Junction.

Posted by gje at 12:56 PM | Comments (0)


Related topics: via article database

March 08, 2009

Setting up a MySQL database from PHP

Yes ... training on a Sunday ;-) ... I've been setting up a MySQL database from a PHP script and testing it. A couple of bits of source to share.

1. The setup of the database:

<?php
mysql_connect("localhost","womble","wimbledon");
mysql_query("create database gerald");
mysql_select_db("gerald");
mysql_query("create table course(first text, second text)");
mysql_query('insert into course values("Upper","Lower")');
mysql_query('insert into course values("Smiff","Yones")');
?>

2. A page to test that it's there:

<?php
mysql_connect("localhost","womble","wimbledon");
mysql_select_db("gerald");
$rs = mysql_query("select * from course");
while ($rown = mysql_fetch_assoc($rs)) {
  $html .= "$rown[first] ... $rown[second]<br>";
  }
?>
<html>
<body>
Here it is <br>
<?= $html ?>
</body>
</html>


(We had to set it up this way as there is only FTP access to the server ... learn more about these things on our PHP courses and MySQL courses

Posted by gje at 09:51 PM | Comments (0)


Related topics: via article database

Useful links: PHP training, MySQL training

Converting to Perl - the sort of programs you will write

I've put many of the examples that I wrote during last week's Perl Course into our converting to Perl resource, and they've available for use and download from there, subject to the usual "use at your own risk" exclusion!

Where delegates are used to prescriptive, declared languages such as Cobol (or being more modern, Java!), the Perl ethoses of 'Perl assumes you know what you are doing" and 'you don't need to tell Perl - it can work it out' and 'if you leave out a variable name, it may assume $_' can cause a considerable degree of consternation and be quite hard to accept - after all, they have always been taught to remain in their seat until the aircraft comes to a complete halt, and the idea of getting up at 2500 feet and jumping out is alien to them, however safe the parachute of Perl might be, and however much quicker they'll get home by jumping out and landing in their own back garden rather than carrying on to some London airport from where they have to get land transport back home.

There's a wide variety of examples in that directory, then ... let me give you some tasters and you can then explore further ...

[link] to documentation and documentation comment example. With such a freeflow language as Perl, it's vital for you to comment it well and also provide user documentation.

[link] to an example that uses list processing; in Perl, there are many occasions where you don't need to write code to process every elememt of a list - built in functions do the looping for you resulting in shorter and faster running code

[link] to a context example. Languages like English use 'context' to add sense to works. If I write "Reading is a ...", you won't know if I'm referring to the town or the skill until I add the next work ... "Thames side" will tell you it's a town and "useful" will imply that it's probably the skill. Perl supports context too - you'll see different behaviours is some thing's used as a scalar, as a list, as a string within double quotes, or as an integer.

[link] to a 'live' web log file analysis example. This example uses many of the fundamental Perl elements (list, hashes, regular expressions and more) for the rapidly written analysis of a file. As an example during the course, I analysed my 35 Mbyte log file from the previous day, and this example is the code I wrote. You'll see how many hits we had to each page, and a sorted table showing what proportion of our traffic was for each of the pages, sorted by page traffic levels.

Illustration - In Perl, you use the < and > pair to say "read from" a file handle; there are 4 file handles always open and available - for reading you have ~STDIN and DATA (STDOUT and STDERR are for output) and you simply read from them an assign into a variable. No need to open, no need to declare the variable they're going on to as it will be automatically created ....

Posted by gje at 08:12 AM | Comments (0)


Related topics: via article database

Useful link: Perl training

March 07, 2009

Efficient calls to subs in Perl - avoid duplication, gain speed

When you call a sub in Perl (a subroutine - a named block of code), you pass in a list of parameters in the list called @_. It's easy and straightforward ... but as the length of your list increases, it starts to become less that efficient.

Say - for example - I had a 35 Mbyte log file (and I really did yesterday, when I was looking at our web server log) ... then passing it across to a sub would duplicate the list into @_, and if I copied it into a named list in the sub that would be a third copy - over 100 Mbytes of memory swallowed up. Here's how that code might look:

sub mygrep {
  ($look4,@within) = @_;
  @send_back = reverse(grep(/$look4/i,@within));
  return @send_back;
  }
open (FH,"shortie");
@stuff = <FH>;
@interesting = mygrep("horse",@stuff);
print @interesting;

But if you pass a REFERENCE to the list across to your sub, you can save yourself all the duplication - change @stuff to \@stuff in the call, collect the parameter in $within rather than @within inside the sub, then reference it via @$within rather than @within when you search through it. The code does not look much different:

sub mygrep {
  ($look4,$within) = @_;
  @send_back = reverse(grep(/$look4/i,@$within));
  return @send_back;
  }
open (FH,"shortie");
@stuff = <FH>;
@interesting = mygrep("horse",\@stuff);
print @interesting;

but the performance certain does change dramatically!

If you're a newcomer to Perl you may find this sort of thing perplexing .. but help is to hand! Subjects such as this are covered on our Perl Programming course. And if you're already somewhat into Perl, but want to go a little further, we run a Perl for larger projects course which covers handling of large data sets, object orientation, databases and more.


"Let me show you how that works ...."

Copying the list - lots of duplication
Passing a reference - only the one list

Posted by gje at 05:41 AM | Comments (0)


Related topics: via article database

Useful link: Perl training

March 06, 2009

Playing Catchup

Friday afternoon ... and a week in which a lot has happened comes to an end. A raft of pictures that have been taken to be shared, but alas have not yet been shared ....

A week long Perl Programming course ...

Breakfast for 33 (yes, that's thirty three!) at Well House Manor this morning ...

Seeing the traffic jamming the centre of Melksham this week, and thinking forward to what it might be like on 10 years time, when the town has grown by 50% ...

Standing in on the top of one of the most exposed buildings in Melksham as dawn broke, to take a picture of the only train that calls at Melksham during daylight hours ...

Explaining Perl's "Read from" operator, and how it handles files and STDIN.

At a quarter past five this morning ... walking past the bus stop on the way in to work ...

Spring, and crocuses push up through our gravel path

An archway at Well House Manor ...

And there's so much else not recorded in pictures too. A hardware failure on one of our dedicated servers located in a network centre in Germany, and getting that fixed. Response problems due to excess activity on our main server. "Snagging" at Well House Manor - that thankless but necessary task of going around and finding places where we could and should improve the product. And - always a thrill - showing new potential hotel customers around, and talking with new potential training course customers and having them enthused - yes, this is the product for me.

Posted by gje at 03:43 PM | Comments (0)


Related topics: via article database

March 05, 2009

Perl - lists do so much more than arrays

open (FH,"ac_20090225");
@stuff = <FH>;
@interesting = grep(/horse/i,@stuff);
print @interesting;

In Perl, an @ in front of a variable makes it into a list - and a list variable has the advantages of an array in other languages ... without the disadvantages. And it can do a lot more too.

In the example above, I've opened a large file and read THE WHOLE FILE into a list called @stuff. There's no need to say how big it will be - Perl works that out dynamically - and assigns one line of the incoming file to each list (array) element.

I've then filtered the list via Perl's built in grep function, looking for all the elements of the list which contain "horse", and putting them into another and shorter list (grep is like a filter - it selects rather than changes elements)

Finally, I've printed out just the interesting lines - the lines that contain 'horse' - from the shorter list.

The test file I used in this little example contained 147,720 lines (our daily web site log file), and the filtered output contained 782. But the script was not slow in running, because there are no loops in the script - there were just four lines to be interpreted and run, with the looping done at the efficient lower level within Perl itself.

From yesterday's Perl Programming course.

Posted by gje at 08:24 AM | Comments (0)


Related topics: via article database

Useful link: Perl training

March 04, 2009

Melksham Industrial

Around about the time of the Second World War, Melksham had a higher proportion of its are given over to industrial use than any other town in Great Britain - my source of this information being the current mayor. And to this day, this quiet little market town has a surprising range of industrial and business areas - from 'The Avon' (now Cooper Tires) and some of the big companies on Bowerhill, through to a whole peppering of other offices and works scattered in pockets through the town. Some, such as Spencer's have gone (via GEC Mechanical Handling), as has the Rope Factory. The dairy has become smaller industrial units, and there are a few structures like the grain silos which are out of use at present, but due to be demolished and replace by a new Countrywide and Asda complex. You've got new industry up in some of the old RAF Melksham Hangers too, and in purpose fitted factories as well. If you're looking for platform doors for stations, for rubber masks for use in hostile conditions, for personalised nuts, or to mail order National Trust souvenirs, Melksham is your place.

Industry is not designed to be pretty or beautiful, but never the less there are some places and parts where the geometry and colour provide a certain handsomeness, as illustrated by these pictures; both taken as part of a series yesterday morning, where I was answering to the challenge of photographing the station from the North, and which will be shared here and elsewhere in due course.

Posted by gje at 05:53 PM | Comments (0)


Related topics: via article database

March 03, 2009

Static mirroring through HTTrack, wget and others

Our web site is not best suited to off-line browsing these days - it may be flexible, but if you want to take a copy of it, but it onto a CD, then browse away from the Internet, please resist the temptation. Why is it NOT a good idea to 'blind mirror' us?

1. The Changing nature of our web site. Our pages are adaptive; if you browse from Aberdeen, you'll be offered pulldown menus asking if you're in Aberdeen, Inverness, Dundee, Perth, but if you're browsing from Bristol, you'll be offered Bristol, Bath, Newport, Taunton. If you're browsing with Internet Explorer, some adoption of the HTML will be made to accommodate non-standard features. Your previous visit history will be noted and you'll have different options highlighted as our page is presented in a way to help you navigate. None of these features can work from a mirror CD!

2. Our size. We've got around 15,000 different URLs on this web site ... pages ranging from pictures of Gosport Station to using Utility methods to construct objects of different type in Python, and it's unlikely that you'll want them all - so mirroring is a very slow and very blunt tool which hurts ...

3. Our bandwidth. It's a serious resource hog if you try to copy all of our pages. You're costing us a lot of bandwidth, you're slowing down others who are trying to use our site - basically, you're being antisocial (though probably not intentionally so!). And do you know the worst of it ...

4. Out of date. Your mirror copy will rapidly go out of date, as this is a dynamic site where new examples are added, links updated, and comments amended somewhere all the time. Having spent a lot of time creating a traffic jam, you'll find that the destination really wasn't worth going to.

5. Copyright issues. I am also concerned about our copyright issues; I appreciate that duplicating content is easy, but I would much rather provide a feed to people as they need pages than have - as I have found in the past - mirrored pages that have out-of-date or unaltered absolute links, and are said to be in our name - they get us a bad reputation when really they are an imitation, and ought to be the sincerest form of flattery.

If you're thinking of mirroring us ... please don't do it ... and if you have found this page unexpectedly ... our web site probably thinks that you are trying to mirror it, and is asking you not to do so!

How do we detect mirroring operations?

There are certain programs that do it, and we look for things like wget (link) and HTTrack (link) in our User Agent requests / logs. Such signals aren't going to find the people who try to hide what they're doing, but we have other flags that may find them. This is something we discuss on courses such as Linux Web Server which helps you with your httpd deployment.

How should you as a webmaster handle such bulk download requests?

First things first - work out what you want to do. Do you want to allow mirrors, allow part of the site to be mirrored, rudely lock and bolt the front door against mirroring, or hang up a polite sign that says 'please do not mirror'. And if you go for the latter, how do you get your mirrorers to actually read the sign?

If you've decided to restrict your users from mirroring, have a look at robots.txt, and have a look too at the environment variables that are set by the user agent and their use in conjunction with either deny directives or RewriteCond directives. And if you have common include files, you can put some database recording and monitoring in there to pick up unusual traffic flows that are the characteristic of mirroring attempts on larger sites ... all of which make very long subjects for a blog, but for excellent lunchtime discussions on a PHP techniques Workshop!

Posted by gje at 03:20 AM | Comments (0)


Related topics: via article database

March 02, 2009

East of Melksham Countryside

Lisa, Dad and I went out for a walk behind our home yesterday afternoon - the view above is from the fields, looking across to Snarleton Lane. The same sort of scene must repeat itself a thousand times across the land ... but it still has a certain beauty.

On the fields across towards Snowberry Lane, we saw evidence of the ridges and furrows from (?) medieval times - where the land had been strip cultivated:

A sign on the gate of the field talked of a planning application for 62 houses, and indeed the end of Snowberry Lane is a wide road that at present suddenly stops ... so it's very clearly a part of the plan. Indeed, I understand that there are some 750 housing units expected, so I suppose it will look like this:

But the countryside extends for miles; I'm not sure whether this particular picture is within the area planned for Melksham to expand, or without ... but there's several miles of country here before you get to Redstock or Bromham.

Posted by gje at 05:49 PM | Comments (0)


Related topics: via article database

Internal Dummy Connections on Apache httpd

Is your Apache httpd log file 'full' of entries like this?

xx.xxx.xx.xx - - [02/Mar/2009:05:08:45 +0000] "OPTIONS * HTTP/1.0" 200 - "-" "Apache/2.2.9 (Unix) PHP/5.2.6 (internal dummy connection)"

What causes them?

Your web keeps a number of spare 'slots' open to process new incoming requests, opening them up ahead of growing traffic. And at times that traffic is dropping off, it closes spare slots to allow memory to be released to other system users. This dummy connection / request is used to signal to a slot that it should shut-down, so you'll find a series of these messages cropping up as traffic falls.

Should I worry about them?

Not very much. Some of them are to be expected; if there are a very large number of them, though, it may be worth you altering some of your server settings - see this previous article for a description of how the slots are opened and closed.

Can I eliminate the from my logs?

Yes - add something like:
SetEnvIf Remote_Addr "xx\.xxx\.xx\.xx" dontlog
to your log file, and update your logging directive to use that setting:
CustomLog /var/log/apache2/access_log combined env=!dontlog

There's more detail of how this configuration change works at this off site resource, but bear in mind that you'll be fixing a symptom rather than curing an issue if you simply stop logging huge quantities of these messages.

The IP address given will be your server's own IP address. If it's someone else's, then THAT would be a concern!

Posted by gje at 05:15 AM | Comments (0)


Related topics: via article database

March 01, 2009

Virtual hosting and mod_proxy forwarding of different domains (httpd)

Let's say that you want to set up a single web server to look after several domains, but then have parts of those domains served by other 'back room' servers. This diagram give you the picture - a single incoming IP address / server with all the security and logging stuff on it (and probably handing a lot of the general traffic too), but other machine(s) in the background fulfilling other specific roles. I set up a configuration like this yesterday - as part of an httpd and Tomcat Deployment Course.

The main server is Apache httpd (I had it on 192.168.200.214 - see diagram) and it was serving a domain called "devizes". [technical note - devizes.wellho.net or something fully qualifies when you take this out to the internet!]. However, I wanted to add the domains "lavington" and "urchfont" to it, with parts of the Lavington domain forwarded to another server on the same machine, and the entire Urchfont domain forwarded to another machine - 192.168.200.215.

Using Apache 2.2.x, I uncommented the virtual host support line in httpd.conf, and configured the virtual host file in the extra directory ... using mod_proxy to forward my traffic. The Virtual host configuration file, with lots of extra annotation, is available here.

Notice that is doesn't matter what the background servers are running (httpd, Tomcat or something else), or whether they're on the same physical box or a different one. And the whole scheme will easily expand to using balancing with mod_proxy_balancer ... all of which are the subject of other resources you'll find here abouts!

Posted by gje at 09:43 AM | Comments (0)


Related topics: via article database

Tomcat 6 - Annotated Sample Configuration Files

When you download Tomcat, it's pretty much "plug and play" ... once you've got your PATH and JRE_HOME environment variables set correctly. However, it's very unlikely that the default configuration is what you want, or is secure in the way you would like it to be. So you'll require to change the various configuration files such as context.xml, server.xml, web.xml and perhaps tomcat-users.xml. And being open source, the number of options and facilities you can turn on and off is mindblowing and you need to know what you're doing.

<advert>We can help you on our deploying Apache httpd and Tomcat course</advert>. And we also provide sample files and resources on our web site - in fact I have just uploaded a major new resource - an annotated set of Tomcat 6 configuration files, as we tailor them on our course but with some fairly long explanations and advise embedded within them. And these sample files are available to anyone to download and use at their own risk.

server.xml - this is the main configuration file controlling what connectors are available for users to contact the server, how it deploys applications, what domains it supports, etc.

web.xml - the file which controls what type of Java applications are supported by this Tomcat, and how web addresses (URLs) are mapped onto them.

context.xml - a file with some extra controls, such as security issues concerned with certain types of servlets, and whether or not user's sessions are to survive a reboot of the server.

tomcat-users.xml - this file controls who can log in to various roles; when Tomcat is just installed, it's useful to set this file up so that the Tomcat manager can be used to stop and start individual applications, and to monitor the performance of Tomcat.

Note that - although Servlets and JSPs transfer pretty easily from Tomcat 5.0 and 5.5 up to Tomcat 6, there are quite substantial changes in the sample configuration files provided as part of the distribution, and it's unlikely that your Tomcat 5.5 config files will work on Tomcat 6, or vice versa. (And, yes, we do have 5.5 samples available for training too!)

Posted by gje at 09:10 AM | Comments (0)


Related topics: via article database

Database connection Pooling, SSL, and command line deployment - httpd and Tomcat

Yesterday (yes, that was a Saturday!) I was running a tailored Apache Tomcat training and consultancy day - a day on which I cover a lot of standard training material, but did so in relation to a particular application for the delegate(s).

Most of what I covered was in our own material (which we can print out even during the course!), but there were some topics that were or are best illustrated by web sites other than our. "Don't re-invent the wheel" they say - and indeed, I projected up / used the following web sites - amongst others - as sources during the day. I'm documenting them here, now ... for course attendees to be able to refer back, and to help give web visibility to resources that others may find useful too.

For SSL setup for apache httpd I referred to a page at securityfocus.com and that carried on to part 2. There are so many options with SSL, so much technology, that it can be hard to see the wood for the trees - but this example if far better than most. One question that arises time and time again is "how do I set up SSL on Tomcat" to which I answer "why do you want to?". Whilst there ARE some instances where you'll want to do it, it's far more common to set up SSL on an outward facing Apache httpd server, and use a non secure protocol such as http or ajp between Htttpd and Tomcat. After all - the place where you want the security is out in the big wide word of the internet, which httpd is looking after. It's an unusual situation where you want to secure all your traffic between a couple of computers that are on your own intranet, behind your own firewall and probably sitting next to each other in the rack!

Tomcat Manager is a good, interactive deployment tool ... but so often, system admin delegates want to (un)deploy an application from the command line. Now that SOUNDS like it will be easy, but it isn't. You can do it through ant - and there's a sample of deploying Java applications through ant on a page at ProjectCaroline.net. Why isn't there just an easy command line tool? Perhaps it's because of the whole security thing - to use the Tomcat Manager your JMX roles and realms all have to be set up via tomcat-users.xml, and a simple command line tool would need to consider this, and not provide a magnificent loophole to circumvent Java's security model.

On a lighter note, the tenth System Admin Appreciation day is on 31st July this year - see sysadminday.com.

And finally, if you're connecting to databases from within a web application hosted by Tomcat, you may want to use Database (JDBC) Connection pooling. Pooling allows each of your requests to carry on the same SQL session with the SQL server, rather than opening up and shutting down connections with a frequency that could have a serious impact on performance. See this page on onjava.com.

If you have this sort of question and would like my help, take an initial look at our deploying Apache httpd and Tomcat course. If the course agenda is such that we won't be able to answer all your specialised questions, let me know and we can either add an extra day for you or - if what you want is very different - run a special session. Email graham@wellho.net to ask about your own specific requirements.

Posted by gje at 06:56 AM | Comments (0)


Related topics: via article database