• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

String Data Compression

New Here ,
Dec 11, 2008 Dec 11, 2008

Copy link to clipboard

Copied

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?


TOPICS
Advanced techniques

Views

822

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Dec 11, 2008 Dec 11, 2008

Copy link to clipboard

Copied

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?...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 11, 2008 Dec 11, 2008

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Dec 11, 2008 Dec 11, 2008

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 11, 2008 Dec 11, 2008

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 11, 2008 Dec 11, 2008

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 11, 2008 Dec 11, 2008

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Dec 11, 2008 Dec 11, 2008

Copy link to clipboard

Copied

Hi,

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 11, 2008 Dec 11, 2008

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 11, 2008 Dec 11, 2008

Copy link to clipboard

Copied

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,030308,06010...

[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/

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 13, 2008 Dec 13, 2008

Copy link to clipboard

Copied

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.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 12, 2008 Dec 12, 2008

Copy link to clipboard

Copied

> 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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 15, 2008 Dec 15, 2008

Copy link to clipboard

Copied

LATEST

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


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation