compression

Decompress bz2 files

丶灬走出姿态 提交于 2019-11-29 06:03:28
问题 I would like to decompress the files in different directories which are in different routes. And codes as below and the error is invalid data stream. Please help me out. Thank you so much. import sys import os import bz2 from bz2 import decompress path = "Dir" for(dirpath,dirnames,files)in os.walk(path): for file in files: filepath = os.path.join(dirpath,filename) newfile = bz2.decompress(file) newfilepath = os.path.join(dirpath,newfile) 回答1: bz2.compress/decompress work with binary data: >>>

AVAssetWriter How to create mov video with no compression?

痞子三分冷 提交于 2019-11-29 05:12:55
I'am creating a video from an array of images. The purpose of my work is to create a .mov video with no compression. I have see in developer library that it exist a key "AVVideoCompressionPropertiesKey" but I don't know how to specify no compression with this key. Could you help me please? Here is my sample code : NSDictionary *videoCleanApertureSettings = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:320], AVVideoCleanApertureWidthKey, [NSNumber numberWithInt:480], AVVideoCleanApertureHeightKey, [NSNumber numberWithInt:10], AVVideoCleanApertureHorizontalOffsetKey,

Compressing big number (or string) to small value

烂漫一生 提交于 2019-11-29 04:33:34
My ASP.NET page has following query string parameter: …?IDs=1000000012,1000000021,1000000013,1000000022&... Here IDs parameter will always have numbers separated by something, in this case , . Currently there are 4 numbers but normally they would be in between 3 and 7 . Now, I am looking for method to convert each big number from above into smallest possible value; specifically compressing value of IDs query string parameter. Both, compressing each number algorithm or compressing whole value of IDs query string parameter are welcome. Encode or decode is not an issue; just compressing the value

Why can't hadoop split up a large text file and then compress the splits using gzip?

為{幸葍}努か 提交于 2019-11-29 04:26:16
I've recently been looking into hadoop and HDFS. When you load a file into HDFS, it will normally split the file into 64MB chunks and distribute these chunks around your cluster. Except it can't do this with gzip'd files because a gzip'd file can't be split. I completely understand why this is the case (I don't need anyone explaining why a gzip'd file can't be split up). But why couldn't HDFS take a plain text file as input and split it like normal, then compress each split using gzip separately? When any split is accessed, it's just decompressed on the fly. In my scenario, each split is

ASP.NET MVC compression options in IIS6

核能气质少年 提交于 2019-11-29 04:04:19
问题 For now I'm stuck with IIS6 for ASP.NET-MVC (as in I cant upgrade to Server 2008 yet). It doesnt seem to know that my RESTful URLS are dynamic files and isn't compressing them. All my old .aspx files are compressed (as seen in Fiddler), but not the '/products/1001' type URLS. Is there any way to get IIS6 to compress my ActionResults in IIS6 without using something like an ActionFilter for compression. I'm assuming IIS7 is clever enough to know they're dynamic right. Bonus points if you can

What is the canonical method for an HTTP client to instruct an HTTP server to disable gzip responses?

元气小坏坏 提交于 2019-11-29 03:23:11
I thought this was a simple google search, but apparently I'm wrong on that. I've seen that you should supply: Accept-Encoding: gzip;q=0,deflate;q=0 in the request headers. However, the article that suggested it also noted that proxies routinely ignore that header. Also, when I supplied it to nginx, it still compressed the response message body. http://forgetmenotes.blogspot.ca/2009/05/how-to-disable-gzip-compression-in.html So, how do I tell a web server to disable compression on the response message body? Chawathe Vipul Do you wish encoding to be disabled altogether? Then skip the Accept

Compress and decompress a Stream with Compression.DeflateStream

天涯浪子 提交于 2019-11-29 03:06:51
I am trying to compress and decompress a Stream using Compression.DeflateStream . Compressing seems to work correctly since the code below compresses my Stream to a 110 bytes long array. However, reading the decompressed Stream results in an empty string. class Program { static void Main(string[] args) { // Compress a random string value string value = Path.GetRandomFileName(); byte[] compressedBytes; using (var writer = new StreamWriter(new MemoryStream())) { writer.Write(value); writer.Flush(); writer.BaseStream.Position = 0; compressedBytes = Compress(writer.BaseStream); } // Decompress

CSS Minimizer?

ε祈祈猫儿з 提交于 2019-11-29 02:54:16
问题 Do you know of an online CSS compressor that helps remove redudant/ineffecient CSS declarations and replaces it with more optimized CSS? Meaning, I know that a lot of "compressors" exist that simply remove tabs, remove comments, etc. But what I'm looking for is something smart enough to know that: border-top: 1px solid red; border-bottom: 1px solid red; border-right: 1px solid red; border-left: 1px solid red; is the same as the more efficient: border: 1px solid red; UPDATE : The CSS I'm

Error Deflate And Inflate With zLib

女生的网名这么多〃 提交于 2019-11-29 02:53:18
I'm trying to compile the zpipe.c example in my Linux(Ubuntu 8.04) with gcc, but I'm getting some errors, take a look: [ubuntu@eeepc:~/Desktop] gcc zpipe.c /tmp/ccczEQxz.o: In function `def': zpipe.c:(.text+0x65): undefined reference to `deflateInit_' zpipe.c:(.text+0xd3): undefined reference to `deflateEnd' zpipe.c:(.text+0x150): undefined reference to `deflate' zpipe.c:(.text+0x1e8): undefined reference to `deflateEnd' zpipe.c:(.text+0x27b): undefined reference to `deflateEnd' /tmp/ccczEQxz.o: In function `inf': zpipe.c:(.text+0x314): undefined reference to `inflateInit_' zpipe.c:(.text

PHP Manual GZip Encoding

早过忘川 提交于 2019-11-29 02:48:34
问题 I was testing my website with Page Speed and the result was around 70/100. Enable Compression was the first and most important factor in slowing it down. I know that I can do that by modifying the php.ini to automatically do that but I was more interested in the manual method ( gzencode ). The problem is either all browsers fail in opening the website (Firefox: "The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.", Chrome: "303, ERR