compression

Compression algorithm for JSON encoded packets?

梦想与她 提交于 2019-11-27 12:24:04
问题 What would be the best compression algorithm to use to compress packets before sending them over the wire? The packets are encoded using JSON. Would LZW be a good one for this or is there something better? 回答1: I think two questions will affect your answer: 1) How well can you predict the composition of the data without knowing what will happen on any particular run of the program? For instance, if your packets look like this: { "vector": { "latitude": 16, "longitude": 18, "altitude": 20 },

rpmbuild change compression format

别说谁变了你拦得住时间么 提交于 2019-11-27 12:19:15
问题 I try to pack some map files for our geoserver in an internal rpm package. For the build part, this is just to copy the files. I think this works as expected. But it takes terribly long to pack those 20GB of images. I've read that rpm internally compresses the data and that this can be done with several different compression algorithms. But, I don't have a clue which compression my rpm chooses and how I can influence this. I could not find any options for the rpmbuild command, nor for the

How to efficiently predict if data is compressible

不想你离开。 提交于 2019-11-27 12:16:31
问题 I want to write a storage backend to store larger chunks of data. The data can be anything, but it is mainly binary files (images, pdfs, jar files) or text files (xml, jsp, js, html, java...). I found most of the data is already compressed. If everything is compressed, about 15% disk space can be saved. I am looking for the most efficient algorithm that can predict with high probability that a chunk of data (let's say 128 KB) can be compressed or not (lossless compression), without having to

How do I gzip compress a string in Python?

二次信任 提交于 2019-11-27 12:15:56
How do I gzip compress a string in Python? gzip.GzipFile exists, but that's for file objects - what about with plain strings? Pick a suitable module from http://docs.python.org/library/archiving.html -- either gzip or zlib, depending on your exact needs. If you want to produce a complete gzip -compatible binary string, with the header etc, you could use gzip.GzipFile together with StringIO : import StringIO import gzip out = StringIO.StringIO() with gzip.GzipFile(fileobj=out, mode="w") as f: f.write("This is mike number one, isn't this a lot of fun?") out.getvalue() # returns '\x1f\x8b\x08\x00

Are there any downsides to using UPX to compress a Windows executable?

自古美人都是妖i 提交于 2019-11-27 11:54:24
I've used UPX before to reduce the size of my Windows executables, but I must admit that I am naive to any negative side effects this could have. What's the downside to all of this packing/unpacking? Are there scenarios in which anyone would recommend NOT UPX-ing an executable (e.g. when writing a DLL, Windows Service, or when targeting Vista or Win7)? I write most of my code in Delphi, but I've used UPX to compress C/C++ executables as well. On a side note, I'm not running UPX in some attempt to protect my exe from disassemblers, only to reduce the size of the executable and prevent cursory

How can I use the “compress/gzip” package to gzip a file?

拥有回忆 提交于 2019-11-27 11:35:01
问题 I'm new to Go, and can't figure out how to use the compress/gzip package to my advantage. Basically, I just want to write something to a file, gzip it and read it directly from the zipped format through another script. I would really appreciate if someone could give me an example on how to do this. 回答1: All the compress packages implement the same interface. You would use something like this to compress: var b bytes.Buffer w := gzip.NewWriter(&b) w.Write([]byte("hello, world\n")) w.Close()

How to compress JSON with PHP?

无人久伴 提交于 2019-11-27 11:16:48
问题 I'm writing a little analysis page which will help me hunt down bugs in an application. In essence it allows to visually compare actual data and log entries, plus perform a bit of analysis on the data. Since this is for debugging only and since I will be deploying this on the live site I want it to have as little server load as possible. Several of the analysis options will include rather heavy substring searching or n 2 operations, so I'm going to offload this to the client. This means that

How to use System.IO.Compression to read/write ZIP files?

久未见 提交于 2019-11-27 11:16:25
问题 I know there are libraries out there for working with ZIP files. And, you can alternatively use the functionality built into Windows for working ZIP files. But, I'm wondering if anyone has worked out how to use the tools built into the System.IO.Compression namespace within .NET for reading/writing ZIP files? Or, is it not possible using only this namespace? UPDATED: I've seem someone comment that the System.IO.Packaging namespace might be usefull with this also. Does anyone know exactly how

What is the best compression algorithm that allows random reads/writes in a file?

☆樱花仙子☆ 提交于 2019-11-27 11:15:13
问题 What is the best compression algorithm that allows random reads/writes in a file? I know that any adaptive compression algorithms would be out of the question. And I know huffman encoding would be out of the question. Does anyone have a better compression algorithm that would allow random reads/writes? I think you could use any compression algorithm if you write it in blocks, but ideally I would not like to have to decompress a whole block at a time. But if you have suggestions on an easy way

Free compression library for C# which supports 7zip (LZMA) [closed]

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 11:09:15
I have a program (written in C#) that reads/writes its data directly (direct file access without server) to firebird database files. For a better exchange I want to (un)compress them on import/export for a better exchange over the internet without the need of an external program to (un)compress them. I know #ziplib which supports Zip, GZip, Tar and BZip2. What else free compression libraries for C# do you know? Is there a .NET library which supports LZMA so i can read/write ".7z" files? splattne There is a good article written by Peter Bromberg: 7Zip (LZMA) In-Memory Compression with C# Shows