compression

Theory: Compression algorithm that makes some files smaller but none bigger?

瘦欲@ 提交于 2019-12-22 08:00:11
问题 I came across this question; "A lossless compression algorithm claims to guarantee to make some files smaller and no files larger. Is this; a) Impossible b) Possible but may run for an indeterminate amount of time, c) Possible for compression factor 2 or less, d) Possible for any compression factor?" I'm leaning towards (a), but couldn't give a solid explanation as to why. (I'll list the thoughts a friend and I came up with as a possible answer) 回答1: By the pigeon-hole principle, given a

IIS Dynamic Compression Failing

你离开我真会死。 提交于 2019-12-22 06:43:32
问题 I'm trying to get Dynamic Compression on IIS 8.5 to work (particularly with JSON). I'm using Windows Server 2012, IIS 8.5 and a very simple ASP.NET MVC site returning an ActionResult in the form of JSON. Firstly I have done all the usual steps, enabling Dynamic Compression in IIS at the server and site level, edited my applicationHost.config with the correct MIME types, frequency etc. I have enabled FailedRequestTrace logging, and what is strange is that my request is reporting a successful

curl command a gzipped POST body to an apache server

不想你离开。 提交于 2019-12-22 06:09:49
问题 With mod_deflate properly activated on my apache 2.2 server, I am trying to send a gzipped body via curl command line. All tutorials I have seen say to add -H'Content-Encoding: gzip' and gzip my body file, however this fails: echo '{ "mydummy" : "json" }' > body gzip body curl -v -i http://localhost/mymodule -H'Content-Encoding: gzip' --data-binary @body.gz My apache module receives 0 bytes And in my apache error.log if LogLevel is set to debug I get: [Thu Jun 01 14:29:03 2017] [debug] mod

Decode byte array to bitmap that has been compressed in Java

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-22 05:47:24
问题 I am compressing a bitmap in the following way Bitmap bmpSig = getMyBitMap(); int size = bmpSig.getWidth() * bmpSig.getHeight(); ByteArrayOutputStream out = new ByteArrayOutputStream(size); bmpSig.compress(Bitmap.CompressFormat.JPEG, 100, out); byte[] bytSig = out.toByteArray(); I am then trying to display the image in an Android ImageView from the byte array. When I do this I get an image that is completely black image. ImageView myImg = (ImageView) findViewById(R.id.img_view); myImg

What languages or methods allow graphics & music demos to fit in 64kb EXEs?

橙三吉。 提交于 2019-12-22 05:24:20
问题 How is it possible that in a 64kb compiled exe, these programs can generate such crazy visuals, complete with matching music? An example: Ars Nova By Phantom Lord (YouTube video of the demo running) This program's only 64kb in size! How did they do that? Are they using some sorts of pre-existing objects, shaders, etc. inside DirectX or something like that? What languages do they even use? Is there some sort of guide to this stuff? EDIT: Another mind-blowing demo. How? http://www.scene.org

Where can I find a lossless compression algorithm, which produces headerless outputs?

独自空忆成欢 提交于 2019-12-22 05:16:17
问题 Does anyone of you know a lossless compression algorithm, which produces headerless outputs? For example do not store the huffman tree used to compress it? I do not speak about hard coded huffman trees, but I like to know if there is any algorithm that can compress and decompress input without storing some metadata in its output. Or is this even theoretically impossible? 回答1: Adaptive Huffman coding does exactly that. More generally, the term adaptive coding is used to describe entropy codes

How should I extract compressed folders in java?

孤街浪徒 提交于 2019-12-22 04:12:47
问题 I am using the following code to extract a zip file in Java. import java.io.*; import java.util.zip.*; class testZipFiles { public static void main(String[] args) { try { String filename = "C:\\zip\\includes.zip"; testZipFiles list = new testZipFiles( ); list.getZipFiles(filename); } catch (Exception e) { e.printStackTrace(); } } public void getZipFiles(String filename) { try { String destinationname = "c:\\zip\\"; byte[] buf = new byte[1024]; ZipInputStream zipinputstream = null; ZipEntry

Compress numpy arrays efficiently

我的梦境 提交于 2019-12-22 03:30:16
问题 I tried various methods to do data compression when saving to disk some numpy arrays . These 1D arrays contain sampled data at a certain sampling rate (can be sound recorded with a microphone, or any other measurment with any sensor) : the data is essentially continuous (in a mathematical sense ; of course after sampling it is now discrete data). I tried with HDF5 (h5py) : f.create_dataset("myarray1", myarray, compression="gzip", compression_opts=9) but this is quite slow, and the compression

How to extract zip file using dotnet framework 4.0 without using third party dlls [closed]

天大地大妈咪最大 提交于 2019-12-22 03:19:41
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I'm in a fix. I need to download a zip file from network location and then decompress it on local machine and use the files. The only constraint is that I cannot use any third party dll. 回答1: In .NET framework 4.5 now there is System.IO.Compression.ZipFile.ExtractToDirectory(String, String) method. 回答2: I'm not

Compressing Object in Dot Net

為{幸葍}努か 提交于 2019-12-22 01:29:40
问题 I want to Compress an Object in dot net to reduce its size and then UnCompress it on in my client application. Thanks, Mrinal Jaiswal 回答1: I have update the code there was a problem with older version. Here is a function which serialize and compress and viceversa. public static byte[] SerializeAndCompress(object obj) { using (MemoryStream ms = new MemoryStream()) { using (GZipStream zs = new GZipStream(ms, CompressionMode.Compress, true)) { BinaryFormatter bf = new BinaryFormatter(); bf