PDA

View Full Version : Programming Puzzle 21 - Got ini ?


ABC123

Tom Cone Jr
08-28-2011, 07:32 PM
Your manager has been talking to her colleagues (always a potential source of trouble, mind you), and she's decided that when your application opens, certain configuration information should be retrieved from disk and read into a series of global variables. You've told her that you can do this easily using native Alpha Five tables, but her friends have convinced her the app should use an ".ini" file, instead.

She wants your customer to be able to store organization name, organization address, organization phone and fax numbers, and organization e-mail address, using a text file called "system_info.ini" stored in your database folder. The text file should contain a single long string of text. Use delimiters you choose to separate the string into its parts. Each part should be stored in reverse order.

Your task grasshopper is to write an autoexec script for your database that will check to see if the INI file is already present. If it's not there then the script should prompt the user to supply the organization information and then store it on disk in the specified INI file. As mentioned each piece of the information should be obfuscated by reversing the sequence of its letters.

Have fun.

-- tom

DaveM
08-29-2011, 07:04 PM
No takers?

This one would be fun if I had the time.

Mike Wilson
09-02-2011, 12:28 PM
OK, I'll take. Can't be letting the professor down.

Later,
The one labeled with AE is the correct one. Haven't been able to delete the wrong one. Got it to delete, never mind.

aschone
09-07-2011, 10:46 PM
A different approach

Caveat

1) No error checking is being done in the xDialog

2) When writing the ini file I am stripping the control Line feeds out of the string generated by the property_to_string() function; however when converting the string back to a property variable I am not replacing the control line feeds. While this works currently there is no guaruntee it will continue to work in future versions of Alpha5.

Mike Wilson
09-08-2011, 03:37 PM
Andrew,
Good use of property. Not to cut in on Tom's pickypicky, but the directions say this:

Each part should be stored in reverse order
I believe you have the entire string in reverse order not each part. With those instructions, I believe the intent is that:
ABC, DEF, GHI would be CBA, FEG, IHA and not IHG, FED, ABC

aschone
09-08-2011, 09:19 PM
Andrew,
Good use of property. Not to cut in on Tom's pickypicky, but the directions say this:

I believe you have the entire string in reverse order not each part. With those instructions, I believe the intent is that:
ABC, DEF, GHI would be CBA, FEG, IHA and not IHG, FED, ABC

Details :smile: