This essay does not describe an existing computer program, just one that should exist. This essay is about a suggested student project in Java programming. This essay gives a rough overview of how it might work. I have no source, object, specifications, file layouts or anything else useful to implementing this project. Everything I have prepared to help you is right here.
This project outline is not like the artificial, tidy little problems you are spoon-fed in school, when all the facts you need are included, nothing extraneous is mentioned, the answer is fully specified, along with hints to nudge you toward a single expected canonical solution. This project is much more like the real world of messy problems where it is up to you to fully the define the end point, or a series of ever more difficult versions of this project and research the information yourself to solve them.
Everything I have to say to help you with this project is written below. I am not prepared to help you implement it; or give you any additional materials. I have too many other projects of my own.
Though I am a programmer by profession, I don’t do people’s homework for them. That just robs them of an education.
You have my full permission to implement this project in any way you please and to keep all the profits from your endeavour.
Please do not email me about this project without reading the disclaimer above.
Windows 9x/NT still use INI files in addition to the registry. A *.INI file has [sections], parameters and comments:
; sample ini file [USER PREFS] HOME URL=D:\mydir\index.html ; this is a comment on a line by itself MAX WINDOW HISTORY LINES=100 ; this is a tail end comment
The task of your program is to sort all the sections in alphabetical order and within each section sort all the parameters in order. Any sections without any entries are deleted. There may be duplicate sections in the orignal. Merge them. When there are duplicate parameters in a section, take the first one and ignore the rest. Delete any parameters with null values. For readability, put a blank line between sections.
The only thing tricky about this is handling comments. Does a comment belong with the parameter/section above or below? If there is a blank line separating it from one but not the other, the answer in obvious. If the comment is the first or last line of the file, again the answer is obvious. If you can’t resolve what to do with the comment you can handle the ambiguity in one of four configurable ways:
You could do the sorting and merging of duplicates in at least three ways:
Once you have that working, you can then create variants on a theme. Merge a small ini file of changes into a big one. Setting a parameter to nothing deletes the parameter. A section with no entries is deleted.
Compare two messy ini files and display the essential differences by creating a tidied, comment-less version of both and comparing the parse trees in RAM (Random Access Memory).
Get your friends to donate a variety of real-life messy INI files, the dirtier the better, for you to test your program on.
Once you have that working, create this variant. You create a template example ini file that contains all the currently legal sections and fields. You use that model to clean out a messy INI file that is full of junk fields left over from previous versions of the program.
I have implemented this project myself and you can download my source code.
This page is posted |
http://mindprod.com/project/inifiletidier.html | |
Optional Replicator mirror
|
J:\mindprod\project\inifiletidier.html | |
Please read the feedback from other visitors,
or send your own feedback about the site. Contact Roedy. Please feel free to link to this page without explicit permission. | ||
Canadian
Mind
Products
IP:[65.110.21.43] Your face IP:[3.135.206.212] |
| |
Feedback |
You are visitor number | |