Alpha DevCon 2018
Results 1 to 6 of 6

Thread: Programming Puzzle 21 - Got ini ?

  1. #1
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,300

    Default Programming Puzzle 21 - Got ini ?

    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

  2. #2
    "Certified" Alphaholic DaveM's Avatar
    Real Name
    Dave Mason
    Join Date
    Jul 2000
    Location
    Hudson, FL
    Posts
    5,919

    Default Re: Programming Puzzle 21 - Got ini ?

    No takers?

    This one would be fun if I had the time.
    Dave Mason
    dave@aldaweb.com

    Skype is dave.mason46

  3. #3
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    4,132

    Default Re: Programming Puzzle 21 - Got ini ?

    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.
    Attached Files Attached Files
    Last edited by Mike Wilson; 09-02-2011 at 12:37 PM.
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  4. #4
    "Certified" Alphaholic
    Real Name
    Andrew Schone
    Join Date
    Dec 2005
    Location
    Kansas
    Posts
    1,044

    Default Re: Programming Puzzle 21 - Got ini ?

    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.
    Attached Files Attached Files
    Andrew

  5. #5
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    4,132

    Default Re: Programming Puzzle 21 - Got ini ?

    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
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  6. #6
    "Certified" Alphaholic
    Real Name
    Andrew Schone
    Join Date
    Dec 2005
    Location
    Kansas
    Posts
    1,044

    Default Re: Programming Puzzle 21 - Got ini ?

    Quote Originally Posted by Mike Wilson View Post
    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
    Andrew

Similar Threads

  1. Programming Puzzle 3 - Fractions, anyone?
    By Tom Cone Jr in forum Xbasic Programming Puzzles
    Replies: 7
    Last Post: 11-08-2011, 05:40 AM
  2. Programming Puzzle 11 - More Loops
    By Tom Cone Jr in forum Xbasic Programming Puzzles
    Replies: 11
    Last Post: 08-20-2011, 04:50 PM
  3. Programming Puzzle 10 - Sweets on a budget
    By Tom Cone Jr in forum Xbasic Programming Puzzles
    Replies: 8
    Last Post: 08-15-2011, 10:59 AM
  4. Programming Puzzle 13 - Paycheck Amount?
    By Tom Cone Jr in forum Xbasic Programming Puzzles
    Replies: 3
    Last Post: 08-12-2011, 02:27 PM
  5. Programming Puzzle 12 - Perfect Squares
    By Tom Cone Jr in forum Xbasic Programming Puzzles
    Replies: 4
    Last Post: 08-12-2011, 02:21 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •