Newb Posted January 1, 2011 Share Posted January 1, 2011 Hi all and happy new year too!I need a suggestion by you guys I'm a low level autoit programmer (and autoit is the only language i know).I've already made some programs myself that helped me a lot in learning how a computer works, and how autoit works.Now, since I have to learn to manage string in various ways, for exercising I was thinking about making a program which compresses files following a far too simple concept. I would read raw data from any file (Have you ever dragged a file into the notepad? That's it) and check with string reading (or eventually with RegExes) for similar longest strings in the whole file, then replace them with a single charachter which isn't present in that file, or with a customized combination, shorter than the ones found by the program. Decompression will be the same, but opposite.Pratical Hypotetical Example:File Raw Data is: ABBAABBAABBAKPEEKPEEKPEEej390jojnkwjsqABBAABBADOBODOBOABBAKPEEEnwuw9qeh9Program will read it like this: ABBAABBAABBAKPEEKPEEKPEEej390jojnkwjsqABBAABBADOBODOBOABBAKPEEEnwuw9qeh9As you see every similar string found in it should be noticed, and it should be replaced like this:ABBA=XKPEE=YDOBO=LAnd the result would be:XXXYYYej390jojnkwjsqXXLLXYnwuw9qeh9Resulting in a compression of the file.The decompression legend ABBA=XKPEE=YDOBO=Lwould be stored in the file in some header for the decompression, which will be the opposite process.That's it. What do you think, this could fit an exercise or it would be a disaster for me to try doing it?In that second case, could you provide me some good exercising with strings?PS: I know this is not you typical math-based compression method... and i don't know anything about how zlib, or other compression system works... so well, i put myself in your hands... I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 1, 2011 Moderators Share Posted January 1, 2011 Newb,Disaster! You would need to spend a lot of time just creating a file which met the (very strict) requirements to have enough repeatable sections while missing sufficient characters to permit sensible replacements. It might well take longer that the code to "compress" it.If you want to practice with string, then I suggest you you parse some text and look for letter sequences to replace, but only when the sequence is a whole word and not just part. That means you have to cope with spaces, capitalisation, line endings and beginnings, string start and end. There are some very simple ways to do this with SREs - but coding something using the String* functions should keep you out of mischief for a while! Here is a piece of standard text to start with:Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.Try to replace the following letter combinations with the corresponding numbers - but only if they are not part of another word: et - 12 in - 34 ex - 56 id - 78 eu - 90Happy New Year. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Newb Posted January 1, 2011 Author Share Posted January 1, 2011 Newb, Disaster! You would need to spend a lot of time just creating a file which met the (very strict) requirements to have enough repeatable sections while missing sufficient characters to permit sensible replacements. It might well take longer that the code to "compress" it. If you want to practice with string, then I suggest you you parse some text and look for letter sequences to replace, but only when the sequence is a whole word and not just part. That means you have to cope with spaces, capitalisation, line endings and beginnings, string start and end. There are some very simple ways to do this with SREs - but coding something using the String* functions should keep you out of mischief for a while! Here is a piece of standard text to start with: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Try to replace the following letter combinations with the corresponding numbers - but only if they are not part of another word: et - 12 in - 34 ex - 56 id - 78 eu - 90 Happy New Year. M23 AHAH! You always have good words for me! Anyway, well, if that project is so bad, I will try to do replaces in that text Tnx for suggestions. Happy new year I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now