Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
Python and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Lua, etc
 
Relative or absolute milkman

Rather contrary to current trends, we've just started taking regular deliveries of milk (+ bread + eggs) at our training centre from the local milkman. As we grow busier, it's more effective to have someone deliver to us as part of his round rather than having to make a special trip out. And our "mint on the pillow" approach to training means we really want to provide real milk rather than powder for the real coffee.

Monday's delivery - ace. Fine. AOK. A little bit of a stocking up order for the start of (another) busy week. For this morning, we asked for 5 pints of semi-skimmed milk. Sure - we got them. And a pint of Channel Island. And a pint of full fat. And bread. And eggs ...

At first thought - had our instructions been ignored? No - it turns out that our Milkman took our instruction as a relative path (i.e. changes from what we had on Monday) rather than an absolute path. Perhaps we should have written C:\ or / on the front of the order?

Why is this relevant to Horse's Mouth? Because so often people write their programs using a relative path when they would be better using an absolute, or vice versa, and it's a reminder worth making. Just this morning, I answered a question on Opentalk where my writer was having problems, I suspect, because of a changed current directory and a relative path.

When we look at file handling in Perl (or take a second or even a third look) - or when we get involved with file handling in PHP or Python or our other languages, we always try to stress careful file name selection in order to ensure that the user's script works correctly no matter what their current directory. I think I'll start telling my "milkman story" to help people appreciate the importance.
(written 2004-11-10, updated 2006-06-05)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
H109 - PHP - Input / Output
  [4483] Moving from mysql to mysqli - simple worked example - (2015-05-03)
  [3424] Divide 10000 by 17. Do you get 588.235294117647, 588.24 or 588? - Ruby and PHP - (2011-09-08)
  [3159] Returning multiple values from a function call in various languages - a comparison - (2011-02-06)
  [3029] PHP data sources - other web servers, large data flows, and the client (browser) - (2010-11-04)
  [2964] An introduction to file handling in programs - buffering, standard in and out, and file handles - (2010-09-21)
  [1780] Server overloading - turns out to be feof in PHP - (2008-09-01)
  [1442] Reading a file multiple times - file pointers - (2007-11-23)
  [1113] File and URL reading in PHP - (2007-03-20)
  [1096] Sample script - FTP to get a file from within PHP - (2007-03-01)
  [1094] PHP fread - truncated data - (2007-02-27)
  [997] Most recent file in a directory - PHP - (2006-12-18)
  [709] Handling huge data files in PHP - (2006-05-04)
  [653] Easy feed! - (2006-03-21)
  [616] printf - a flawed but useful function - (2006-02-22)

P207 - Perl - File Handling
  [3839] Spraying data from one incoming to series of outgoing files in Perl - (2012-08-15)
  [3830] Traversing a directory in Perl - (2012-08-08)
  [3548] Dark mornings, dog update, and Python and Lua courses before Christmas - (2011-12-10)
  [3326] Finding your big files in Perl - design considerations beyond the course environment - (2011-06-14)
  [2833] Fresh Perl Teaching Examples - part 2 of 3 - (2010-06-27)
  [2821] Chancellor George Osborne inspires Perl Program - (2010-06-22)
  [2818] File open and read in Perl - modernisation - (2010-06-19)
  [2405] But I am reading from a file - no need to prompt (Perl) - (2009-09-14)
  [2233] Transforming data in Perl using lists of lists and hashes of hashes - (2009-06-12)
  [1861] Reactive (dynamic) formatting in Perl - (2008-10-31)
  [1860] Seven new intermediate Perl examples - (2008-10-30)
  [1841] Formatting with a leading + / Lua and Perl - (2008-10-15)
  [1709] There is more that one way - Perl - (2008-07-14)
  [1467] stdout v stderr (Tcl, Perl, Shell) - (2007-12-10)
  [1416] Good, steady, simple example - Perl file handling - (2007-10-30)
  [1312] Some one line Perl tips and techniques - (2007-08-21)
  [867] Being sure to be positive in Perl - (2006-09-15)
  [702] Iterators - expressions tha change each time you call them - (2006-04-27)
  [618] Perl - its up to YOU to check your file opened - (2006-02-23)
  [255] STDIN, STDOUT, STDERR and DATA - Perl file handles - (2005-03-23)
  [12] How many people in a room? - (2004-08-12)

Y110 - Python - File Handling
  [4717] with in Python - examples of use, and of defining your own context - (2016-11-02)
  [4708] Scons - a build system in Python - building hello world - (2016-10-29)
  [4663] Easy data to object mapping (csv and Python) - (2016-03-24)
  [4593] Command line parameter handling in Python via the argparse module - (2015-12-08)
  [4451] Running an operating system command from your Python program - the new way with the subprocess module - (2015-03-06)
  [4438] Loving programming in Python - and ready to teach YOU how - (2015-02-22)
  [3764] Shell, Awk, Perl of Python? - (2012-06-14)
  [3558] Python or Lua - which should I use / learn? - (2011-12-21)
  [3465] How can I do an FTP transfer in Python? - (2011-10-05)
  [3442] A demonstration of how many Python facilities work together - (2011-09-16)
  [3083] Python - fresh examples from recent courses - (2010-12-11)
  [2870] Old prices - what would the equivalent price have been in 1966? - (2010-07-14)
  [2282] Checking robots.txt from Python - (2009-07-12)
  [2011] Conversion of OSI grid references to Eastings and Northings - (2009-01-28)
  [183] The elegance of Python - (2005-01-19)


Back to
A Parallel for Perl 6
Previous and next
or
Horse's mouth home
Forward to
Expiration dates or times on web pages
Some other Articles
History around you
A case of case
The next generation of programmer
Expiration dates or times on web pages
Relative or absolute milkman
A Parallel for Perl 6
Avoid the wheel being re-invented by using Perl modules
Training notes available under Open Distribution license
Friday, busy week!
URLs - a service and not a hurdle
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., 2019: 404 The Spa • Melksham, Wiltshire • United Kingdom • SN12 6QL
PH: 01225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/114_Rela ... lkman.html • PAGE BUILT: Sat May 27 16:49:10 2017 • BUILD SYSTEM: WomanWithCat