Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
For 2021 - online Python 3 training - see ((here)).

Our plans were to retire in summer 2020 and see the world, but Coronavirus has lead us into a lot of lockdown programming in Python 3 and PHP 7.
We can now offer tailored online training - small groups, real tutors - works really well for groups of 4 to 14 delegates. Anywhere in the world; course language English.

Please ask about private 'maintenance' training for Python 2, Tcl, Perl, PHP, Lua, etc.
Updating a page strictly every minute (PHP, Perl)

For the Clock exercise that I mentioned in my last entry, I need to update the page once a minute. Exactly once a minute. At the start of the minute.

I'm using client pull, where the browser asks for the next page - so my basic request is:
<meta http-equiv="refresh" content="60; url=/clock/now.php">
but that will neither refresh at the start of the minute, nor be exact - with update times and delays taken into account, a handful of times in each hour will be missed out (I know this - I tried it) as the 60 seconds starts from the time the new page is received, not from the previous page.

So I have adjusted the time as follows:
$togo = 61 - date("s");
if ($togo < 15) $togo = 15;

to calculate how long before we trigger - it's going to trigger 1 second into the next minute, and will be selfcorrecting to allow for page transmission times. The business with the "15" is to ensure that initial pages display for at least 15 seconds, even if - by rights - they should be refreshed quicker. That will help avoid an irritating refresh. And the client pull instruction becomes:
<meta http-equiv="refresh" content="<?= $togo ?>; url=/clock/now.php">



The example above is "Client Pull". There's also a complete "Server Push" example, written in Perl, using the same algorithm available for you here
(written 2007-05-14)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
W511 - Web and Intranet - Further Aspects
  [528] Getting favicon to work - avoiding common pitfalls - (2005-12-14)
  [876] Making pages clearer - easy Disability Discrimination Act Compliance - (2006-09-23)
  [1001] .pdf files - upload via PHP, store in MySQL, retrieve - (2006-12-19)
  [1970] Plagarism - who is copying my pages? - (2009-01-02)

W502 - Web and Intranet - HTML Document Anatomy
  [857] Strikingly busy - (2006-09-06)
  [993] Positioning with Cascading Style Sheets - (2006-12-16)
  [1160] HTML - example of a simple web page - (2007-04-24)
  [1431] Getting the community on line - some basics - (2007-11-13)
  [1463] All the special characters in HTML ... - (2007-12-07)
  [1811] Alternative URLs using % symbol encoding - (2008-09-27)
  [2246] What difference does using the XHTML standard really make? - (2009-06-18)
  [2675] Redirecting to your main domain for correct security keys - (2010-03-13)
  [3517] Tags used in writing this blog - (2011-11-12)
  [3563] How big is a web page these days? Does the size of your pages matter? - (2011-12-26)
  [4034] The VERY basics of a web page ... and web site - (2013-03-09)

Q110 - Object Orientation and General technical topics - Programming Algorithms
  [202] Searching for numbers - (2005-02-04)
  [227] Bellringing and Programming and Objects and Perl - (2005-02-25)
  [642] How similar are two words - (2006-03-11)
  [1157] Speed Networking - a great evening and how we arranged it - (2007-04-21)
  [1391] Ordnance Survey Grid Reference to Latitude / Longitude - (2007-10-14)
  [1840] Validating Credit Card Numbers - (2008-10-14)
  [1949] Nuclear Physics comes to our web site - (2008-12-17)
  [2189] Matching disparate referencing systems (MediaWiki, PHP, also Tcl) - (2009-05-19)
  [2259] Grouping rows for a summary report - MySQL and PHP - (2009-06-27)
  [2509] A life lesson from the accuracy of numbers in Excel and Lua - (2009-11-21)
  [2586] And and Or illustrated by locks - (2010-01-17)
  [2617] Comparing floating point numbers - a word of caution and a solution - (2010-02-01)
  [2894] Sorting people by their names - (2010-07-29)
  [2951] Lots of way of converting 3 letter month abbreviations to numbers - (2010-09-10)
  [2993] Arrays v Lists - what is the difference, why use one or the other - (2010-10-10)
  [3042] Least Common Ancestor - what is it, and a Least Common Ancestor algorithm implemented in Perl - (2010-11-11)
  [3072] Finding elements common to many lists / arrays - (2010-11-26)
  [3093] How many toilet rolls - hotel inventory and useage - (2010-12-18)
  [3102] AND and OR operators - what is the difference between logical and bitwise varieties? - (2010-12-24)
  [3451] Why would you want to use a Perl hash? - (2011-09-20)
  [3620] Finding the total, average, minimum and maximum in a program - (2012-02-22)
  [3662] Finding all the unique lines in a file, using Python or Perl - (2012-03-20)
  [4325] Learning to program - what are algorithms and design patterns? - (2014-11-22)
  [4401] Selecting RECENT and POPULAR news and trends for your web site users - (2015-01-19)
  [4402] Finding sum, minimum, maximum and average in Python (and Ruby) - (2015-01-19)
  [4410] A good example of recursion - a real use in Python - (2015-02-01)
  [4652] Testing new algorithms in PHP - (2016-02-20)
  [4656] Identifying the first and last records in a sequence - (2016-02-26)
  [4707] Some gems from an introduction to Python - (2016-10-29)

P406 - Perl - More CGI Programs and Facilities
  [641] Simple but rugged form handling demo - (2006-03-10)
  [1009] Passing GET parameters through Apache mod_rewrite - (2006-12-27)
  [2321] Uploading and Downloading files - changing names (Perl and PHP) - (2009-08-04)

P404 - Perl - Extending Flexibility Using CGI
  [426] Robust checking of data entered by users - (2005-08-27)
  [590] Danny and Donna are getting married - (2006-02-03)
  [1365] Korn Shell scripts on the web - (2007-09-25)

H112 - PHP - Further Web Page and Network Handling
  [220] When to use Frames - (2005-02-19)
  [314] What language is this written in? - (2005-05-17)
  [345] Spotting a denial of service attack - (2005-06-12)
  [356] Sudoku helper or sudoku cheat - (2005-06-23)
  [372] Time calculation in PHP - (2005-07-08)
  [376] What brings people to my web site? - (2005-07-13)
  [410] Reading a news or blog feed (RSS) in your PHP page - (2005-08-12)
  [425] Caching an XML feed - (2005-08-26)
  [443] Server side scripting of styles to suit the browser - (2005-09-12)
  [451] Accessing a page via POST from within a PHP script - (2005-09-26)
  [484] Setting the file name for a downloaded document - (2005-11-03)
  [537] Daily Image Santafied - (2005-12-22)
  [542] Morning image, afternoon image - (2005-12-26)
  [565] Using PHP to output images, XML, Style sheets, etc - (2006-01-15)
  [603] PHP - setting sort order with an associative array - (2006-02-13)
  [675] Adding PHP tags to an old cgi program - (2006-04-08)
  [767] Finding the language preference of a web site visitor - (2006-06-18)
  [789] Hot answers in PHP - (2006-07-02)
  [847] Image maps for navigation - a straightforward example - (2006-08-28)
  [904] Of course I'll tell you by email - (2006-10-25)
  [936] Global, Superglobal, Session variables - scope and persistance in PHP - (2006-11-21)
  [1114] PHP Image upload script - (2007-03-21)
  [1183] Improving searches - from OR to AND? - (2007-05-11)
  [1210] PHP header() function - uses and new restrictions - (2007-05-30)
  [1355] .php or .html extension? Morally Static Pages - (2007-09-17)
  [1379] Simple page password protection - PHP - (2007-10-04)
  [1485] Copyright and theft of images, bandwidth and members. - (2007-12-26)
  [1495] Single login and single threaded models - Java and PHP - (2008-01-04)
  [1496] PHP / Web 2 logging - (2008-01-06)
  [1505] Script to present commonly used images - PHP - (2008-01-13)
  [1515] Keeping staff up to date on hotel room status - (2008-01-22)
  [1518] Downloading data for use in Excel (from PHP / MySQL) - (2008-01-25)
  [1549] http, https and ajp - comparison and choice - (2008-02-22)
  [2632] Shipping a test harness with your class in PHP - (2010-02-12)
  [2679] How to build a test harness into your PHP - (2010-03-16)
  [2729] Uploading a document or image to its own URL via a browser - (2010-04-18)
  [2918] Downloading a report from the web for further local analysis - (2010-08-13)
  [3036] Sending out an email containing HTML from within a PHP page - (2010-11-07)
  [3432] 3 digit HTTP status codes - what are they, which are most common, which should be a concern? - (2011-09-11)
  [3540] Easy session example in PHP - keeping each customers data apart - (2011-12-06)
  [3568] Telling which ServerAlias your visitor used - useful during merging domains - (2012-01-04)
  [3918] Multiple page web applications - maintaining state - PHP - (2012-11-10)
  [4070] Passing variable between PHP pages - hidden fields, cookies and sessions - (2013-04-26)
  [4483] Moving from mysql to mysqli - simple worked example - (2015-05-03)


Back to
Two new pages / sites
Previous and next
or
Horse's mouth home
Forward to
What shape is your shake?
Some other Articles
Smart English Output - via PHP and Perl ? : operator
Save the Forum - A regular clean sweep
Meet, greet and welcome
What shape is your shake?
Updating a page strictly every minute (PHP, Perl)
Two new pages / sites
Themes for the web site
Finding resources - some pointers
Painting a masterpiece in PHP
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., 2021: 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/1187_Upd ... Perl-.html • PAGE BUILT: Sun Oct 11 16:07:41 2020 • BUILD SYSTEM: JelliaJamb