6V8 - Production of my Mind

Home page > Outdated > Contributing Dashboard > Conversion backend

Conversion backend

 
Sometime, I would get on some American/English documents that would contains some measures in units I do not know (Fahrenheit, miles, etc...) as I live in Switzerland.
backend | 17 November 2003, by Mortimer

So I thought: "This might be a job for dashboard". This backend take MEASURE clues of the form "10.34oF" (a number followed by some unit) and translate it to an understandable unit system.

            These conversion are defined in ".dashboard/backend-data/conversion/config.xml". This file use a XML format to describe each conversion. Each node represent a conversion:


<Conversion Enabled="true" From="oF" To="oC" Factor="0.55" Add="-17,6">

here are the attributes description:

 Enabled

specify if we should use this conversion

 From

specify the unit to convert from

 To

specify the unit to convert to

 Factor

specify the multiplicator to make the conversion (double)

 Add

specify a value to add after the multiplication (double)

The From string is in fact the string that will be searched for in the measure clue to identify what conversion to make, therefore there can only be one From tag by unit string (still you can have a conversion tag for "oF" and "Fahrenheit").

The To string is an indication of what string should be displayed: 32oF will then be displayed as 0oC.

Conversion are linear: y = factor*X+add

Date of online publication: 17 November 2003
last-update: 20 November 2003
Forum messages 0
visits:
2657

Creative Commons Attribution NonCommercial ShareAlike 2.5  License
 
 

The most read articles

 
©
Pierre Andrews
York, uk
| Site Map | Site created with SPIP 1.9.2c [10268] | RSS | template by IZO, Mortimer. | clicky stats
the recent the published first
the recent the published first
the recent the published first
the recent the published first
the recent the published first