compression

Fiddler doesn't decompress gzip responses

限于喜欢 提交于 2019-12-04 22:22:24
I use Fiddler to debug my application. Whenever the response is compressed by server, instead of decompressed response, Fiddler shows unreadable binary data: /* Response to my request (POST) */ HTTP/1.1 200 OK Server: xyz.com Date: Tue, 07 Jun 2011 22:22:21 GMT Content-Type: text/html; charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive X-Powered-By: PHP/5.3.3 Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Content-Encoding: gzip 14 ���������������� 0 How can I get the response decompressed? I use

Bitmap compressed with quality=100 bigger file size than original

佐手、 提交于 2019-12-04 21:34:55
问题 I am trying to send an image to a server. Before sending it, I am reducing its size and quality, and then fixing any rotation issue. My problem is that, after rotating the image, when I save it, the file is bigger than before. Before rotation size was 10092 and after rotation is 54226 // Scale image to reduce it Bitmap reducedImage = reduceImage(tempPhotoPath); // Decrease photo quality FileOutputStream fos = new FileOutputStream(tempPhotoFile); reducedImage.compress(CompressFormat.JPEG, 55,

Why is php gzip output not working for me?

半腔热情 提交于 2019-12-04 20:56:42
I have this code: <?php // Include this function on your pages function print_gzipped_page() { global $HTTP_ACCEPT_ENCODING; if( headers_sent() ){ $encoding = false; }elseif( strpos($HTTP_ACCEPT_ENCODING, 'x-gzip') !== false ){ $encoding = 'x-gzip'; }elseif( strpos($HTTP_ACCEPT_ENCODING,'gzip') !== false ){ $encoding = 'gzip'; }else{ $encoding = false; } if( $encoding ){ $contents = ob_get_contents(); ob_end_clean(); header('Content-Encoding: '.$encoding); print("\x1f\x8b\x08\x00\x00\x00\x00\x00"); $size = strlen($contents); $contents = gzcompress($contents, 9); $contents = substr($contents, 0

Why am I not getting my original string after compression and decompression?

[亡魂溺海] 提交于 2019-12-04 19:37:28
I am currently trying to use the java.util.zip.* package to perform lossless compression/Decompression. And I have used apache's jar to encode and decode the String used as an argument in Base64 charset. Following in my code with two static methods one each for compression and one for decompression. import java.io.UnsupportedEncodingException; import java.nio.charset.Charset; import java.util.zip.*; import org.apache.commons.codec.binary.Base64; public class main { public String compress(String stringToCompress) throws UnsupportedEncodingException { //System.out.println("String to Be

Removing duplicate subtrees from binary tree

可紊 提交于 2019-12-04 19:27:05
问题 I have to design an algorithm under the additional homework. This algorithm have to compress binary tree by transforming it into DAG by removing repetitive subtrees and redirecting all these connections to one left original subtree. For instance I've got a tree (I'm giving the nodes preorder): 1 2 1 3 2 1 3 The algorithm have to remove right connection (right subtree that means 2 1 3) of 1 (root) and redirect it to left connection (because these substrees are the same and left was first in

Spark: saveAsTextFile without compression

♀尐吖头ヾ 提交于 2019-12-04 18:42:07
问题 By default, newer versions of Spark use compression when saving text files. For example: val txt = sc.parallelize(List("Hello", "world", "!")) txt.saveAsTextFile("/path/to/output") will create files in .deflate format. It's quite easy to change compression algorithm, e.g. for .gzip : import org.apache.hadoop.io.compress._ val txt = sc.parallelize(List("Hello", "world", "!")) txt.saveAsTextFile("/path/to/output", classOf[GzipCodec]) But is there a way to save RDD as a plain text files, i.e.

How can I Compress a directory with .NET?

南笙酒味 提交于 2019-12-04 18:40:10
问题 I have a directory that contains several files. I want compress this folder to a zip or tar.gz file. How can I do his work in C#? 回答1: You can use DotNetZip Library. It has quite rich and useful features. EDIT: string[] MainDirs = Directory.GetDirectories(DirString); for (int i = 0; i < MainDirs.Length; i++) { using (ZipFile zip = new ZipFile()) { zip.UseUnicodeAsNecessary = true; zip.AddDirectory(MainDirs[i]); zip.CompressionLevel = Ionic.Zlib.CompressionLevel.BestCompression; zip.Comment =

IIS 7.5 ASP.NET-4 Gzip compression

吃可爱长大的小学妹 提交于 2019-12-04 18:14:16
问题 I just can't seem to get GZIP compression enabled for my ASP.NET 4 application. Only javascript files seem to get compressed. The page, css and others dont get compressed. The response header of a not compressed CSS file is: Content-Type text/css Last-Modified Mon, 09 Aug 2010 20:10:34 GMT Accept-Ranges bytes Etag "5d71bdecfe37cb1:0" Server Microsoft-IIS/7.5 Date Sat, 28 Aug 2010 14:33:56 GMT Content-Length 3364 And for a Javascript file that gets compressed (scriptresource.axd): Cache

Pre-compress static files in IIS 6

别来无恙 提交于 2019-12-04 17:17:16
I am implementing Gzip compression for CSS and JS files on my site and just need to double check something. Is the file compressed on every request? or is it collected and sent from the Temporary folder (if the file exists)? I just want to be sure that my files are not compressed on every request. Also, is this a default behaviour or do I need some extra configurtion? And last, do I need to worry or configure something when using hash tags in the path (to inform the browser that the file has changed) and static file compression? or it should work with no problem. Edit: I am just using static

Is there any java compression utility

社会主义新天地 提交于 2019-12-04 17:14:33
I need to (un)zip some files and after some googling I haven't found any utility for doing it. I know I can do it with built-in java.uitl.zip.* classes but isn't there any utility, that will make it easer, best like this: SomeClass.unzip("file_name.zip", "target_directory"); or SomeClass.zip("source_directory", "target_file_name.zip", recursively); I don't want to handle streams. Just file, or better just file names... VonC How about the Deflater/Inflater classes mentioned in the question " What’s a good compression library for Java? ". I know the current interfaces proposed by Java are Stream