Chip and Jared,
Sorry for not being specific about this. My problem did arise, because the user
might interfere, or change these values from time to time. In other words, they
are not ever-static. But they need to be stored in the modified version, so
that this will be the value that is being retrieved next time the app is run.
Anyway, thanks for all help. The first Alpha version of my app should be quite
ready. Simple as it may be. I might need a couple of testers, though.
So, let me just explain shortly what the app is doing.
For all of us, who are shopping online, and who like to buy from abroad, there
is an ever ongoing challenge of calculating what a given price - in a foreign
currency - actually will sum up to in your local currency. If for instance, you
live in the US, and buy a lot of stuff from Canada, that is priced in Canadian
dollars, you will have to keep calculating the actual price in US Dollars, so
as to see if it is worth to buy from abroad.
Not a big deal. If the Currency Exchange Rate is 1.03, You can always bring up
the calculator of Windows, and enter the US * 1.03. But when you are operating
with several currencies, since you are buying stuff from different parts of the
world (like if you are shopping places like EBay), it becomes a bit more of a
challenge. You then will keep remembering what the Exchange rate is for British
Pounds, Canadian dollars, and Australian dollars, along with Euros.
My small app - for the moment called CCalc - will keep remembering the actual
exchange rate for each currency. The user can easily change - or update - the
rate for a given currency, or have the app displaying what the stored rate is.
First he has entered the rate for a currency, he can enter things like:
CN59.23
And if the Exchange Rate is set to 1.03, he will get the result
61.01
spoken.
Again, he could have entered things like
£10.92
for getting the exchanged sum of a buying in British Pounds, and have the final
sum spoken.
Entering things like
AU=1.24
will set the Exchange Rate for Australian dollars to 1.24. This might explain
why I needed to store the values, but eventually have a chance to update the
values, depending on a user input.
At last, if the user wants to know what the stored rate is for a given
currency, he would enter things like:
?NOK
(That is the currency text, along with a question mark), and here get the rate
for the Norwegian Krone.
There is a few minor limitations, the way the app stands today. These will be
sorted soon as I can get my hands and time on it. But if anyone has the
interest of testing the app, please contact me at
[email protected]
.
Thanks again for all assistance.
----- Original Message -----
From: Chip Orange
To: [email protected]
Sent: Saturday, September 10, 2011 3:37 AM
Subject: RE: What is the best way to store a dictionary?
Hi David,
you don't really say if your app will need to update these values (say for
instance because of something the user does), or if they are not ever changing,
so you only need to display/speak them to the user?
If you only need to display them to the user, then the XML file is perfect
for this; there's no problem in adding as many strings as you like; any other
code in your app generated by the WEScripting Framework or anything else will
just ignore them, and as you say, you can internationalize it very easily.
If you do need to change them, but you only have say a hundred or two, then a
.ini file will do fine. yes, you can put numbers or strings in .ini keys. You
could for instance have each .ini entry consist of the string value equals and
it's associated number. (such as USA=1.02).
hth,
Chip
------------------------------------------------------------------------------
From: David [mailto:[email protected]]
Sent: Friday, September 09, 2011 5:05 PM
To: [email protected]
Subject: What is the best way to store a dictionary?
Obviously I don't know much about storing things, from a script. Smile.
My problem is, that I need to store information, holding two 'columns'. I
thought at first of using a dictionary. Secondly I was considering the usage of
the app's INI file. But I am really not sure any longer, what would be the way
to handle this the most smart. Thing is that I need to store info like:
Australia 6.5
USA 5.55
Denmark 1.0398
Europe 9.02
As you can see, I will need a set of 'keys', with textual names. These has to
go along with a corresponding set of decimal numbers.
As I said, I was considering using the INI file. But somehow, I got it from
the reference manual of WE, that you only can store integers for the INI file.
Is that so, or am I messing up my mind here.
I then thought of using the XML file, and store a set of strings there. But
these would have to be seperate from other strings in the XML file, or how
would my app distinguish them from strings of more general kind in my XML file.
Is there a way of 'grouping' strings in the XML? The benefit of the XML, of
course, would have been that I could have translated the textual keys into each
languge supported; of which there would be no way in the INI file. But it is
not a too big problem, since the info the user really would need to get in
touch with here, is the set of decimal values; hence he might not care too much
of the textual notation.
Any good workaround for my issue? Thanks,