compression

Is it better to encrypt a message and then compress it or the other way around? Which provides more security?

a 夏天 提交于 2019-11-28 07:24:00
I have the assumption there is no added protection at all. There is no difference in the security provided, but because of the way compression algorithms work, you are probably going to get better compression if you compress first then encrypt. Compression algorithms exploit statistical redundancies (such as those that exist in natural language or in many file formats) in the data which should be eliminated when you encrypt it, therefore an encrypted message shouldn't be able to be compressed all that well. From the wikipedia article : However, lossless data compression algorithms will always

zip/compress a folder full of files on android

China☆狼群 提交于 2019-11-28 06:53:36
I need to zip up a "project" folder to allow users to share projects via email. I found a class for zipping up multiple files into one zip, but I need to keep the folder structure in my zip. Is there any way to achieve this on android? Thanks in advance. HailZeon This code should do the trick. Note: you must add file write permissions to your app by adding the WRITE_EXTERNAL_STORAGE permission to your manifest.xml file. /* * * Zips a file at a location and places the resulting zip file at the toLocation * Example: zipFileAtPath("downloads/myfolder", "downloads/myFolder.zip"); */ public boolean

JavaScript: Decompress / inflate /unzip /ungzip strings [closed]

感情迁移 提交于 2019-11-28 06:17:29
I'm looking for JavaScript implementation of string inflating algorithms. I want to compress on the server side (Java), and decompress on the client side (JavaScript). I've found: unzip strings in javascript That one is marked as answered with an answer for different problem. Other answers are also for something else (unzipping files in ZIP format). JavaScript inflate implementation (possibly FF 3.6 only) This is closest to what I need. However I'd like to have some alternatives. Suggestions? Thanks, Ondra Update: I have quite a specific use case, please don't answer "Don't do that in

python zipfile module doesn't seem to be compressing my files

拜拜、爱过 提交于 2019-11-28 06:09:00
I made a little helper function: import zipfile def main(archive_list=[],zfilename='default.zip'): print zfilename zout = zipfile.ZipFile(zfilename, "w") for fname in archive_list: print "writing: ", fname zout.write(fname) zout.close() if __name__ == '__main__': main() The problem is that all my files are NOT being COMPRESSED! The files are the same size and, effectively, just the extension is being change to ".zip" (from ".xls" in this case). I'm running python 2.5 on winXP sp2. This is because ZipFile requires you to specify the compression method. If you don't specify it, it assumes the

Compress Videos using android MediaCodec api

自闭症网瘾萝莉.ら 提交于 2019-11-28 06:06:43
I want to compress locally saved video file to a smaller size in order to upload to a server. Since i used MediaCodec , i have found some tips to compress video . Here are the steps that i followed 1) . Extracted the media file using MediaExrtactor and Decoded it. 2) . Creates the Encoder with required file format 3) . Create muxer to save file in local storage. (not complete) Question : But i dont know how to encode the already decoded stream and save the stream in to the local storage using MediaMuxer. public class CompressMedia { private static final String SAMPLE = Environment

Closure Compiler options

◇◆丶佛笑我妖孽 提交于 2019-11-28 05:36:47
问题 I want to use Closure Compiler to minify/compress JS code. the problem is that it doesn't minify as well as I expect it to. consider the code below. when I pass the string var func = function ( someArgument ) { alert ( someArgument ); return someArgument; } I expect the minified code to rename "someArgument" to something much shorter, like "a". is that the way it is or am I doing something wrong? TIA public static void Compress( String src ) { ByteArrayOutputStream err = new

Free JavaScript obfuscators? [closed]

五迷三道 提交于 2019-11-28 05:35:10
I'm looking for a free JavaScript obfuscator. Would compression be enough? What tools would you recommend? Of course, I don't need military-style obfuscation, I need a simple way to prevent kiddies from stealing my javascript by looking at the source or by using something simple such as unescape(). Thanks, Tom Loki Your problem is that no matter how much you compress it or hide it, eventually the browser has to interpret it. The best you can do is renaming all variables to meaningless random vars, and removing all comments and whitespace. A few good tools: http://www.dev411.com/dojo/javascript

Python bz2 uncompressed file size

前提是你 提交于 2019-11-28 05:34:41
问题 I am using Python 2.7. I have a .bz2 file, and I need to figure out the uncompressed file size of its component file without actually decompressing it. I have found ways to do this for gzip and tar files. Anyone know of a way for bz2 files? Thanks very much 回答1: I suspect this is impossible due to the nature of bz2 format and compressing techniques it uses. Here is a quite good description of the both format and the algorithms http://en.wikipedia.org/wiki/Bzip2#File_format You will never know

Is there a built-in zip library in .NET 3.5?

早过忘川 提交于 2019-11-28 05:19:10
Is there a built-in zip library in .NET 3.5? If not, what are the popular open source .net zip libraries. There is no built-in library. There are open-source options. DotNetZip is one. Simple, easy to use. It has good features: AES Encryption, regular encryption, streams, ZIP64, file comments, Unicode, progress events, more. And it's free and open source. Here's some sample code. // extract all Photoshop files larger than 100mb using (ZipFile zip1 = ZipFile.Read(ZipFileName)) { var LargePhotoShopFiles = zip1.SelectEntries("name = *.psd and size > 100mb"); foreach (ZipEntry e in

Tools to optimize (remove redundancy and merge) CSS? [closed]

孤街醉人 提交于 2019-11-28 05:14:25
I'm searching for a good CSS compress, merge and optimization tool. I have found tools that clean the CSS but they don't optimize the overwrites. Here is a basic example: a{color:#000} and on another line the a color is overwritten with this: a{color:#fff} Does anyone know of a tool that can clean the unused CSS, that was overwritten and keep just the applied style? I don't particularly understand what you mean by "clean unused CSS", but in any case, I'll throw two tools at you, and maybe one will work ( the good ol' shotgun approach ). CSS Lint seems to point out "duplicate properties". There