compression

Create new FileStream out of a byte array

ε祈祈猫儿з 提交于 2019-12-01 07:16:56
I am attempting to create a new FileStream object from a byte array. I'm sure that made no sense at all so I will try to explain in further detail below. Tasks I am completing: 1) Reading the source file which was previously compressed 2) Decompressing the data using GZipStream 3) copying the decompressed data into a byte array. What I would like to change: 1) I would like to be able to use File.ReadAllBytes to read the decompressed data. 2) I would then like to create a new filestream object usingg this byte array. In short, I want to do this entire operating using byte arrays. One of the

Logging raw and compressed HTTP responses in ASP.NET & IIS7

烈酒焚心 提交于 2019-12-01 07:11:49
问题 Along the lines of this question I want to create a HttpModule that will do some custom logging of requests and responses for us. Using the code in the most popular answer for that question I've got a HttpModule up and running which does indeed work: class PortalTrafficModule : IHttpModule { public void Dispose() { // Do Nothing } public void Init(HttpApplication context) { context.BeginRequest += new EventHandler(context_BeginRequest); context.EndRequest += new EventHandler(context

need help on how to encode words using huffman code

跟風遠走 提交于 2019-12-01 07:02:25
问题 how do you encode words using the huffman code such as NEED 回答1: Huffman encoding basically uses variable-length bit strings to represent tokens (generally characters with a couple of exceptions). The more common a token is, the shorter it's bit-length is and this is (usually) dynamic as the stream is processed. There are usually two special tokens, ESCAPE and END-STREAM. Encoding maintains a dictionary which is basically a lookup of the bit sequences to get a token. Initially it contains

Libarchive to extract to a specified folder?

。_饼干妹妹 提交于 2019-12-01 06:54:13
Anybody can help show examples of using libarchive to extract ZIP files to a specified folder? It looks like the sample programs provided ( untar.c , tarfilter.c and minitar ) all extracts the archive to the current working directory. Is there a way to say "extract to this folder and below" to libarchive and not clobber the program's active folder? One of the main drivers is that the extraction code will be run in a background thread, and thus changing the program working directory may create problems. Also this will be used in an iOS application (iPhone, iPad), which is picky on what folders

Uncompressing a .Z file with Python

北城余情 提交于 2019-12-01 06:49:08
问题 I'm trying to uncompress a *.Z file using Python. I downloaded it via FTP (binary mode). The file successfully uncompresses with 7zip (whose "info" on the file says it's of type "Z"). The original file can be found at ftp://cddis.gsfc.nasa.gov/gps/products/1860/igr18600.sp3.Z. I've read up on the use of the zlib module in Python and have some test code I'm using: import zlib comp_data = open('C:\Temp\igr18600.sp3.Z', 'rb').read() print(comp_data[0:10]) uncomp_data = zlib.decompress(comp_data)

Wav audio file compression not working

こ雲淡風輕ζ 提交于 2019-12-01 06:47:01
Is it possible to compress a wav audio file without reducing the sampling rate? I have an audio file with 256 bit rate and sampling rate - 8000Hz. I would just like to reduce the bit rate to 128/64 kbs I tried converting to mp3 and back to wav, ffmpeg -i input.wav 1.mp3 ffmpeg -i "1.mp3" -acodec pcm_s16le -ar 4000 out.wav but this reduced sampling rate as well. ffmpeg -i "1.mp3" -acodec pcm_s16le -ab 128 out.wav has default 256 bit rate PCM ("WAV") is uncompressed, so -b:a / -ab is ignored. Calculating PCM bitrate Assuming a stereo input, 8000 samples per second, 16 bits per sample: sample

Compress data in php and uncompress in javascript [closed]

£可爱£侵袭症+ 提交于 2019-12-01 06:42:05
Greerings all Is there a way to compress data sent from php (server) and then uncompress the data using javascript (client)? Thanking you I have to agree with @Domenic's answer here. @Nishchay Sharma is way off. The only thing I'll add is if you want to do this on a per-script basis rather than configuring your entire server to compress everything, it's trivial to accomplish your goal by using PHP's gzencode() function coupled with a header call: http://www.php.net/manual/en/function.gzencode.php For instance, let's say you are retrieving a huge set of data via an Ajax call to a PHP page. You

How to unzip/extract 7z compressed files in ios

风流意气都作罢 提交于 2019-12-01 06:16:55
I need to unzip/extract 7z compressed files in ios , Can anyone say the libraries used to do this,where are those libraries available to download.I there any sample project to do this ,let me know 7-Zip Lzma SDK - is a multi-language SDK for handling 7-zip files. Mo Dejong has created an example demonstrating how to use the LZMA SDK to decompress 7-zip libraries on iOS devices. You can find the example on his website here . iOS9 comes with LZMA support (encoder until level 6, decoder all levels). Of course this only helps if you just need the compression – if you absolutely need to read the 7z

Android - how to compress or downsize an image?

亡梦爱人 提交于 2019-12-01 06:14:41
ImageButton avatarButton = (ImageButton) findViewById(R.id.ImageButton_Avatar); avatarButton.setImageResource(R.drawable.avatar); strAvatarFilename = "Image.jpg"; final Uri imageUriToSaveCameraImageTo = Uri.fromFile(new File(Environment.getExternalStorageDirectory()+"/Folder/"+strAvatarFilename)); avatarButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent pictureIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); pictureIntent.putExtra( MediaStore.EXTRA_OUTPUT, imageUriToSaveCameraImageTo ); startActivityForResult(Intent.createChooser

Variable length integer encoding

ぐ巨炮叔叔 提交于 2019-12-01 06:06:54
I am attempting to reverse engineer an LZ1/LZ77 decompression algorithm. The length of an area of the decode buffer/window to be output is encoded in the file as a variable length integer. I've read as much as I can about variable length integer encoding and the method being used in this case does not appear to be like any others I have seen. Perhaps to avoid patent issues or maybe just to obfuscate. The included code might not be quite complete but it is working on at least several files at this point. I cannot see how, if at all, the formulas being used below could be reduced into something