compression

WCF REST Compression

这一生的挚爱 提交于 2019-11-28 08:44:22
I have a REST service that returns a large chunk of XML, about 150k worth. e.g. http://xmlservice.com/services/RestService.svc/GetLargeXML Therefore I want to compress the response from the server, as GZIP should reduce this to something much smaller. Having searched everywhere I cannot for the life of me find an example of how to perform compression for WCF REST services. Help!! NOTE: My service is hosted by a third party and I CANNOT do this via IIS as it is not supported by them. It is actually pretty easy to do this, at least with .NET 4.0 (I didn't test with 3.5). What I do is just let

Tomcat JSR356 Websocket - disable permessage-deflate compression

北城余情 提交于 2019-11-28 08:41:10
问题 I'm, working on a Java servlet which runs on a Tomcat 8.0.18 server and uses the JSR356 websocket API to communicate with a browser. By default Tomcat uses the "permessage-deflate" compression to compress the websocket messages in both directions. I want to use no websocket compression, how can it be turned off? I have tried to use the compression="off" option in the file server.xml but that didn't change anything. How can i turn it off? 回答1: Please try to add jvm option -Dorg.apache.tomcat

Compressing a web service response for jQuery

和自甴很熟 提交于 2019-11-28 08:38:15
I'm attempting to gzip a JSON response from an ASMX web service to be consumed on the client-side by jQuery. My web.config already has httpCompression set like so: (I'm using IIS 7) <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" staticCompressionDisableCpuUsage="90" staticCompressionEnableCpuUsage="60" dynamicCompressionDisableCpuUsage="80" dynamicCompressionEnableCpuUsage="50"> <dynamicTypes> <add mimeType="application/javascript" enabled="true"/> <add mimeType="application/x-javascript" enabled="true"/> <add mimeType="text/css" enabled="true"/> <add

Compress a PNG image with ImageMagick

自闭症网瘾萝莉.ら 提交于 2019-11-28 08:35:24
问题 To compress a JPEG image, I can do: $thumb = new Imagick(); $thumb->readImage("url"); $thumb->setImageCompression(Imagick::COMPRESSION_JPEG); $thumb->setImageCompressionQuality(80); However, I need to also compress PNG images (preserving alpha transparency) to keep sizes down. Is there a way to do it with ImageMagick? 回答1: pngquant effectively quantizes, or reduces the number of colours in an image till just before there is a discernible drop in quality. You can try something similar in

compression algorithm for sorted integers

只愿长相守 提交于 2019-11-28 08:35:12
I have a large sequence of random integers sorted from the lowest to the highest. The numbers start from 1 bit and end near 45 bits. In the beginning of the list I have numbers very close to each other: 4, 20, 23, 40, 66. But when the numbers start to get higher the distance between them is a bit higher too (actually the distance between them is aleatory). There are no duplicated numbers. I'm using bit packing to save some space. Nonetheless, this file can get really big. I would like to know what kind of compression algorithm can be used in this situation, or any other technique to save as

Decompress files with .7z extension in java

旧城冷巷雨未停 提交于 2019-11-28 08:28:11
问题 Can someone advice (give example) any appropriate and understandable way how to extract file or files with .7z extension basing upon InputStream. I have been examined the XZ for java api, but couldn't succeed. Waiting for any suggestion. 回答1: This code might help you. import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.RandomAccessFile; import java.util.Arrays; import net.sf.sevenzipjbinding

How to decompress gzipstream with zlib

回眸只為那壹抹淺笑 提交于 2019-11-28 08:09:39
问题 Can someone tell me which function I need to use in order to decompress a byte array that has been compressed with vb.net's gzipstream. I would like to use zlib. I've included the zlib.h but I haven't been able to figure out what function(s) I should use. 回答1: You can take a look at The Boost Iostreams Library: #include <fstream> #include <boost/iostreams/filtering_stream.hpp> #include <boost/iostreams/filter/gzip.hpp> std::ifstream file; file.exceptions(std::ios::failbit | std::ios::badbit);

Compressing IplImage to JPEG using libjpeg in OpenCV

不问归期 提交于 2019-11-28 07:51:39
So I have this problem. I have an IplImage that i want to compress to JPEG and do something with it. I use libjpeg. I found a lot of answers "read through examples and docs" and such and did that. And successfully written a function for that. FILE* convert2jpeg(IplImage* frame) { FILE* outstream = NULL; outstream=malloc(frame->imageSize*frame->nChannels*sizeof(char)) unsigned char *outdata = (uchar *) frame->imageData; struct jpeg_error_mgr jerr; struct jpeg_compress_struct cinfo; int row_stride; JSAMPROW row_ptr[1]; jpeg_create_compress(&cinfo); jpeg_stdio_dest(&cinfo, outstream); cinfo.image

Compress large Integers into smallest possible string

隐身守侯 提交于 2019-11-28 07:33:58
I have a bunch of 10 digit integers that I'm passing in a URL. Something like: "4294965286", "2292964213". They will always be positive and always be 10 digits. I'd like to compress those integers into the smallest possible form that can still be used in in a URL (aka letters and numbers are perfectly fine) and then uncompress them later. I've looked at using gzipstream but it creates larger strings, not shorter. I'm currently using asp.net so a vb.net or c# solution would be best. Thanks Yes. GZIP is a compression algorithm which both requires compressible data and has an overhead (framing

How does ASP.NET vNext handle Caching, Compression & MimeMap in config.json?

自闭症网瘾萝莉.ら 提交于 2019-11-28 07:32:28
问题 In previous versions all of these settings could be added and tweaked in the Web.Config file using something like the code below: <staticContent> <mimeMap fileExtension=".webp" mimeType="image/webp" /> <!-- Caching --> <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="96:00:00" /> </staticContent> <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files"> <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" /> <dynamicTypes> <add mimeType="text