Sign in to follow this  
Followers 0
Newb

Suggestion for exercising/compression methods

3 posts in this topic

Hi all and happy new year too!

I need a suggestion by you guys :x

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: ABBAABBAABBAKPEEKPEEKPEEej390jojnkwjsqABBAABBADOBODOBOABBAKPEEEnwuw9qeh9

Program will read it like this: ABBAABBAABBAKPEEKPEEKPEEej390jojnkwjsqABBAABBADOBODOBOABBAKPEEEnwuw9qeh9

As you see every similar string found in it should be noticed, and it should be replaced like this:

ABBA=X

KPEE=Y

DOBO=L

And the result would be:

XXXYYYej390jojnkwjsqXXLLXYnwuw9qeh9

Resulting in a compression of the file.

The decompression legend

ABBA=X

KPEE=Y

DOBO=L

would 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... :P


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.

Share this post


Link to post
Share on other sites



Newb,

Disaster! :shifty:

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! :nuke:

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: :P

et - 12
in - 34
ex - 56
id - 78
eu - 90

Happy New Year. :x

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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! :D

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: :lol:

et - 12
in - 34
ex - 56
id - 78
eu - 90

Happy New Year. :nuke:

M23

AHAH! You always have good words for me! :shifty:

Anyway, well, if that project is so bad, I will try to do replaces in that text :P

Tnx for suggestions. Happy new year :x


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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0