Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: How to "zip" a big string to small ?

by pysome (Scribe)
on Oct 29, 2008 at 03:29 UTC ( [id://720144]=note: print w/replies, xml ) Need Help??


in reply to Re: How to "zip" a big string to small ?
in thread How to "zip" a big string to small ?

Thanks your reply.
1)The big string ,i mean the string is large enough,about 8-10k
2)I use the SqlServer ( varchar(max) ) to store the string.
3)I just compress common string ,eg.:
my $string = " aaaaaaaaaaaaaaaaaaaaaaaa sdfsdf bbbbbbbbbbb sdfsdfsdf sdfffffffff sdfsdf < tabl> sfsdfffffffffffffffffffffffffffffffffffffffffff ... much and more .... "

Replies are listed 'Best First'.
Re^3: How to "zip" a big string to small ?
by dHarry (Abbot) on Oct 29, 2008 at 08:07 UTC
    1)The big string ,i mean the string is large enough,about 8-10k

    This doesn’t strike me as "big".

    2)I use the SqlServer ( varchar(max) ) to store the string.

    SQLServer should have not trouble handling those strings.

    3)I just compress common string ,eg.:...

    Any of the suggested compression alternatives should work for you. Based on the example you provide I assume that you will obtain excellent compression ratios.

    I would like to draw your attention to one more alternative: RLE which stands for Run Length Encoding. It doesn’t give you a great compression ration but it’s very simple and therefore fast. I have found a Perl implementation for it which can be found here (I did not tested it though)

      Thanks again.
      Now, I can compress the big string by "Compress::Zlib::compress" just like this:
      my $f = <DATA>; my $dest = compress($f); #print $dest; __DATA__ big big string ssssssssssssssssssssssss mmmmmmmmmmmmmmmmmmmmmmmmm as long as possible...
      Now i wanna know whether or not the "$dest" can be stored into DB( column type varchar)
      And how to recover the original string($f) later.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://720144]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-19 20:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found