12 Replies Latest reply on Dec 15, 2008 4:03 PM by fober1

    String Data Compression

    grotycom
      Is there a way to take a long string and compress it into a much shorter string?

      Here's an example string, a comma-delimited set of values:

      cd,1111-1111-11-1,d120700000a72cbj001c,46808598,60,1,030308,060108

      I'd like to shrink it down to a 10-12 character string that a user can input.

      Does anyone know of any tools to perform this?


        • 1. Re: String Data Compression
          Daverms Level 3
          Hi,

          You want to limit the user to enter a string that is of 10-12 characteres?... Or else you want to shrink a long input into a shorter string?...
          • 2. Re: String Data Compression
            grotycom Level 1
            I want to shrink that string into something shorter.

            Then provide that shortened string to the user who would then enter it into a form and I would expand it out to it's original length and values and process the comma-delimited values.
            • 3. Re: String Data Compression
              Daverms Level 3
              Then, you might need this "Abbrevate" udf,

              http://cflib.org/udf/abbreviate

              What it does is, it output the string to your desired length with ellipsis at the end.. (Search Azadi's post in some old threads...)

              HTH
              • 4. Re: String Data Compression
                grotycom Level 1
                That doesn't seem to do it.

                Here's my predicament:

                This string represent a coupon

                cd,1111-1111-11-1,d120700000a72cbj001c,46808598,60,1,030308,060108

                All of the necessary information is in that string.

                Current process involves tucking that away in a barcode, so it is simply scanned into the system.

                The new process that I'd like to put in place is to send the user a code via email that they can enter into a form.

                I am trying to get away from maintaining a massive database with all of these coupon codes and attaching a unique identifier to each record that the use would enter. It's just a lot of data I don't want to store in a database. So I'd like to compress that string to a unique value and just translate it.
                • 5. Re: String Data Compression
                  Level 7
                  Daverms wrote:
                  > Then, you might need this "Abbrevate" udf,
                  >
                  > http://cflib.org/udf/abbreviate
                  >
                  > What it does is, it output the string to your desired length with ellipsis at
                  > the end.. (Search Azadi's post in some old threads...)
                  >
                  > HTH
                  >

                  Actually I think grotycom is asking for tool(s) that would take a long
                  string and encrypt|encode it into a shorter string that can be used for
                  input and then decrypted|decoded back into it's original string.

                  I have done this with the hash() function to store long strings as
                  unique shorter strings, but it does not allow for the reverse decoding
                  back to the original string. I am not aware of any tools that do this,
                  but I'm sure they are out there somewhere.

                  • 6. Re: String Data Compression
                    grotycom Level 1
                    quote:

                    Originally posted by: Newsgroup User
                    Daverms wrote:
                    > Then, you might need this "Abbrevate" udf,
                    >
                    > http://cflib.org/udf/abbreviate
                    >
                    > What it does is, it output the string to your desired length with ellipsis at
                    > the end.. (Search Azadi's post in some old threads...)
                    >
                    > HTH
                    >

                    Actually I think grotycom is asking for tool(s) that would take a long
                    string and encrypt|encode it into a shorter string that can be used for
                    input and then decrypted|decoded back into it's original string.

                    I have done this with the hash() function to store long strings as
                    unique shorter strings, but it does not allow for the reverse decoding
                    back to the original string. I am not aware of any tools that do this,
                    but I'm sure they are out there somewhere.





                    Exactly - Hash won't work.
                    • 7. Re: String Data Compression
                      Daverms Level 3
                      Hi,

                      Why can't you use the "Encrypt" and "Decrypt" functions?..
                      • 8. Re: String Data Compression
                        grotycom Level 1
                        quote:

                        Originally posted by: Daverms
                        Hi,

                        Why can't you use the "Encrypt" and "Decrypt" functions?..


                        Encrypted strings are longer and definitely not user friendly.
                        • 9. Re: String Data Compression
                          Level 7
                          but if you are sending your users an email - why not include a simple
                          link they can click on in the email?
                          that link would have a url parameter - either your original full string
                          or an encrypted one - something like:
                          http://somesite.com/somepage.cfm?c=cd,1111-1111-11-1,d120700000a72cbj001c,46808598,60,1,03 0308,060108

                          [in the email tell your users to click on the included link or
                          copy/paste it into their browser]

                          somepage.cfm is your form page - make it insert the #url.c# variable
                          into appropriate form field automatically, or parse #url.c# first and
                          insert parts of the string into appropriate fields - basically do
                          whatever you need to do with that string.
                          [obviously also include some checks to make sure url.c is there and is
                          in correct format and the values it contains are valid]

                          hth

                          Azadi Saryev
                          Sabai-dee.com
                          http://www.sabai-dee.com/
                          • 10. Re: String Data Compression
                            Level 7
                            > cd,1111-1111-11-1,d120700000a72cbj001c,46808598,60,1,030308,060108
                            >
                            > All of the necessary information is in that string.
                            >
                            > Current process involves tucking that away in a barcode, so it is simply
                            > scanned into the system.

                            Doesn't a barcode also have a number? Why dont you give them the number
                            associated with the bar code?

                            --
                            Adam
                            • 11. Re: String Data Compression
                              Level 7
                              The output of the encrypt function includes mostly special characters. Not
                              very user friendly. It also outputs double and single quotes that have to
                              be account for also.

                              Jeff



                              "grotycom" <webforumsuser@macromedia.com> wrote in message
                              news:ghrh6l$jsf$1@forums.macromedia.com...
                              >
                              quote:

                              Originally posted by: Daverms
                              > Hi,
                              >
                              > Why can't you use the "Encrypt" and "Decrypt" functions?..

                              >
                              > Encrypted strings are longer and definitely not user friendly.


                              • 12. Re: String Data Compression
                                fober1 Level 1

                                Hi,
                                I don't know of any ZIP-like functionality for text strings, and my recommended
                                solution would be the database with all the coupon codes that you have already
                                mentioned, and don't want to us.

                                But here's another thing you could try:
                                In the coupon code each comma separated value probably has a meaning:
                                cd,1111-1111-11-1,d120700000a72cbj001c,46808598,60,1,030308,060108

                                As example:d120700000a72cbj001c may be an expiration date. That could
                                be represented much shorted with a "number of days since 01/01/2000".
                                1111-1111-11-1 may be the partnumber for a product, which should have
                                a much shorter record ID in the database. "CD", if you have the partnumber
                                you may not need the identifier for the category since you get that from
                                the product record.
                                So "cd,1111-1111-11-1,d120700000a72cbj001c", could become 1234-1287-EF.
                                (ES represents a checksum, so customer can not just "build" the code they would like)

                                cheers,
                                fober