Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Helping new arrivals find out about source code examples

On 30th July, nearly 5300 people arrived at source code examples on our web site from Google searches, from 4000 unique IP addresses.

How do I know that? From analysing our log files:

-bash-3.2$ grep 'GET \/resources\/ex\.php.*\.google\.' ac_20090730 | grep -v Googlebot | wc
5382 129055 1832168
-bash-3.2$ grep 'GET \/resources\/ex\.php.*\.google\.' ac_20090730 | grep -v Googlebot | awk '{print $1}' | sort | uniq | wc
4000 4000 56647
-bash-3.2$


... and 30th July was just a typical weekday; the number halves on Saturday and Sunday (down from 4000 to 1594) which confirms to me that the majority of these are genuine professional visitors and not automata.

-bash-3.2$ grep 'GET \/resources\/ex\.php.*\.google\.' ac_20090801 | grep -v Googlebot | awk '{print $1}' | sort | uniq | wc
1594 1594 22433
-bash-3.2$


Do these people find what they're looking for? Now that is a far more difficult question. And to be honest with you (gawd - I hate that phrase - I try to always be honest!), I don't know the answer, nor even how to find out.

I do know that I write about our source code examples here on The Horse's Mouth from time to time, but that the search engines are often landing our visitors at the source code itself, which until a few minutes ago had no link back to the relevant entry here - so a valuable resource that could help people (and has taken a lot of putting together) was underutilised.

There's no way I want to add a manual operation to each source code page to place back links in there, and fortunately the source code pages are all generated by a single PHP script. So I run the following in my business logic:

# File exists - is it described on the blog?
#desc_line = "";
$qblog = mysql_query("select entry_id, entry_title from mt_entry where entry_text like \"%$module/$name%\"");
while ($rro = mysql_fetch_row($qblog)) {
if ($desc_line == "") {
$desc_line = "For further documentation on this example, ";
$pnn = $rro[0]."_".preg_replace('/[^a-z0-9]+/i','-',$rro[1]);
$desc_line .= "<a href=http://www.wellho.net/mouth/$pnn.html>select here</a>";
} else {
$pnn = $rro[0]."_".preg_replace('/[^a-z0-9]+/i','-',$rro[1]);
$desc_line .= " or <a href=http://www.wellho.net/mouth/$pnn.html>here</a>";
}
}


and the following in my web helpers:

<?php if ($desc_line) { ?>
<p style='margin: 10px; border: solid; border-color: teal;'>
<table border=0 cellpadding=4><tr><td>
<?= $desc_line ?></td></tr></table></p>
<?php } ?>


The fact that the blogging software is written in a different language (Perl), and wasn't written by us, doesn't make any difference - we can still write code to access the database, just bearing in mind that it's possible that the format could change on a future major upgrade.

How does this work ... Very Well, Thank You! If I was talking about how a Lua function can return multiple values, I might provide you with a link to the source code here ... and if you follow that link to test it out, you'll find an extra, teal coloured box now provided automatically at the top of the page to allow you to link back to the blog (in its archive form, for permanence!)

For examples that have been 'mentioned in dispatches' several times, you get a series of links (could be improved later!), and for pages which are web examples, there is often a similarly highlighted link to a page where you can actually run the example. A good example of both of these is the Spell Checker in PHP which I wrote three years ago now during quiet evenings on a Perl course in Saudi Arabia.

P.S. Our extra dictionary words are here if you want to find the second bit of that last example ... and by telling you I have automatically added a back link to this page!
(written 2009-08-03, updated 2009-08-04)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
H113 - Using MySQL Databases in PHP Pages
  [104] mysql_connect or mysql_pconnect in PHP? - (2004-10-30)
  [515] MySQL - an FAQ - (2005-12-03)
  [572] Giving the researcher power over database analysis - (2006-01-22)
  [581] Saving a MySQL query results to your local disc for Excel - (2006-01-29)
  [647] Checking for MySQL errors - (2006-03-15)
  [666] Database design - get it right from first principles - (2006-04-02)
  [723] Viewing images held in a MySQL database via PHP - (2006-05-17)
  [915] Paging through hundreds of entries - (2006-11-05)
  [937] Display an image from a MySQL database in a web page via PHP - (2006-11-22)
  [947] What is an SQL injection attack? - (2006-11-27)
  [1010] Dates, times, clickable diarys in PHP - (2006-12-28)
  [1561] Uploading to a MySQL database through PHP - examples and common questions - (2008-03-02)
  [1983] Keeping PHP code in database and running it - (2009-01-09)
  [2071] Setting up a MySQL database from PHP - (2009-03-08)
  [2259] Grouping rows for a summary report - MySQL and PHP - (2009-06-27)
  [2432] Using print_r in PHP to explore mysql database requests - (2009-10-01)
  [2447] MySQL stored procedures / their use on the web from PHP - (2009-10-10)
  [2561] The future of MySQL - (2010-01-03)
  [2628] An example of an injection attack using Javascript - (2010-02-08)
  [3035] How to display information from a database within a web page - (2010-11-07)
  [3455] MySQL, MySQLi, PDO or something else - how best to talk to databases from PHP - (2011-09-24)
  [4378] What FGW passengers want to talk about / and PHP programming to find out - (2015-01-01)
  [4483] Moving from mysql to mysqli - simple worked example - (2015-05-03)

A166 - Web Application Deployment - Linux Utilities
  [63] Almost like old times - (2004-09-26)
  [71] Comparators in Linux and Unix - (2004-10-03)
  [1361] Korn shell course - (2007-09-22)
  [1366] awk - a powerful data extraction and manipulation tool - (2007-09-25)
  [1690] Conversion of c/r line ends to l/f line ends - (2008-06-28)
  [2145] Using the internet to remotely check for power failure at home (PHP) - (2009-04-29)
  [2484] Finding text and what surrounds it - contextual grep - (2009-10-30)
  [2638] Finding what has changed - Linux / Unix - (2010-02-17)
  [3446] Awk v Perl - (2011-09-18)
  [3764] Shell, Awk, Perl of Python? - (2012-06-14)
  [3902] Shell - Grep - Sed - Awk - Perl - Python - which to use when? - (2012-10-22)
  [4586] Extending your bash shell with aliases, functions and extra commands - (2015-11-28)
  [4682] One line scripts - Awk, Perl and Ruby - (2016-05-20)


Back to
Graphics in Lua - an example using the gd library
Previous and next
or
Horse's mouth home
Forward to
Uploading and Downloading files - changing names (Perl and PHP)
Some other Articles
What search terms FAIL to bring visitors to our site, when they should?
Java Collection Objects in the java.util package
Looking for a practical standards course
Uploading and Downloading files - changing names (Perl and PHP)
Helping new arrivals find out about source code examples
Graphics in Lua - an example using the gd library
For Lua Programmers AND for Town Planners
How to make a Risotto (PHP build style)
Guadalajara - a special tour of a lovely city
New Lua Examples - for last weeks delegates
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/2320_Hel ... mples.html • PAGE BUILT: Sun Oct 11 16:07:41 2020 • BUILD SYSTEM: JelliaJamb