Retiring, March 2020 - sorry, you have missed our final public course.
The Coronavirus situation has lead us to suspend public training - which was on the cards anyway, with no plans to resume
Please ask about private 'maintenance' training for Python, Tcl, Perl, PHP, Lua, etc
Happily continuing private consultancy / programming work
Easy conversion - image formats, currencies and distances
If you're converting between distances (inches, feet, metres, centimetres, metres, furlongs or perches), between currecies (dollars, euros, pounds, roubles, lira) or between graphic file formats (.jpg, .png, .gif, .xbm, .tiff), chances are you'll have any one of a large number of different inputs to change to any one of a large number of different outputs. With - for example - 10 currencies, you'll have 100 (one hundred) possible conversions - and the code will get much bigger and less practical with each new currency added.
The solution is to choose an intermediate standard - for example, to convert the incoming currency to the Euro, then from the Euro to the target currency. That reduces your 100 down to 20 conversions .... and if you had 20 currencies, it would reduce 400 down to 40.
I've got an illustrated example of this techinque on our PHP Techniques Workshop
- source code here
and the code may be run here
. It's also in use on our hotel currency page if guests with to pay in Euros or Dollars
- that's based on a more general exchange rate convertor here
Please consider with this technique that you need to be careful to avoid a loss of precision / information at the intermediate stage.
If your intermediate graphic file standard was .jpg ... it would be a poor choice. .jpg is a lossy standard which makes some compromises. Similarly, an 8 bit image standard would not be suitable.
If your exchange rate tables include commission or are not mid-rate, once again the double conversion I advocate above would lead to an incorrectly rounded result with some loss of data or accuracy. (The ECB tables we use ARE midrate, so there's not an issue!) (written 2008-05-21)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articlesH312 - PHP - Tips and Techniques 
The power of scripting - (2016-01-12) 
FileMaker Day to Unix Time conversion - (2015-02-15) 
PHP - some quick fixes if scripts have issues, and how to use our support - (2014-11-19) 
Problem ... I want to print a series of numbered forms - (2014-10-05) 
A comment on comments in PHP - (2013-04-28) 
How to set up short and meaningfull alternative URLs - (2010-10-02) 
How did I do THAT? - (2009-10-26) 
PHP preg functions - examples and comparision - (2009-07-08) 
Injection Attack if register_globals in on - PHP - (2009-02-04) 
Keeping PHP code in database and running it - (2009-01-09) 
PHP - Parse error: syntax error, unexpected $end ... - (2008-12-23) 
Two PHP include files to make easy web site indexing and navigation - (2008-06-21) 
Checking server performance for PHP generated pages - (2008-06-06) 
PHP Standalone - keyboard to screen - (2007-07-18) 
Dates, times, clickable diarys in PHP - (2006-12-28) 
Syntax checking in PHP - (2006-11-07) 
Hot answers in PHP - (2006-07-02)
Some other Articles
How do Google Ads work?Old Sarum airfield brings back fond memoriesls command - favourite optionsLooking for files with certain characteristics (Linux / Unix)Easy conversion - image formats, currencies and distancesThe tourists guide to LinuxExchange Rates - PHP with your prices in your users currencyUsing cookies and sessions to connect different URLs - PHPSeeing how others do it - PHP trainingUsing a utility method to construct objects of different types - Python
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
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).