compression

Automate zip file reading in R

空扰寡人 提交于 2019-11-26 19:51:47
问题 I need to automate R to read a csv datafile that's into a zip file. For example, I would type: read.zip(file = "myfile.zip") And internally, what would be done is: Unzip myfile.zip to a temporary folder Read the only file contained on it using read.csv If there is more than one file into the zip file, an error is thrown. My problem is to get the name of the file contained into the zip file, in orded to provide it do the read.csv command. Does anyone know how to do it? UPDATE Here's the

Create normal zip file programmatically

ε祈祈猫儿з 提交于 2019-11-26 19:45:30
问题 I have seen many tutorials on how to compress a single file in c#. But I need to be able to create a normal *.zip file out of more than just one file. Is there anything in .NET that can do this? What would you suggest (baring in mind I'm under strict rules and cannot use other libraries) Thank you 回答1: Edit: if you're using .Net 4.5 or later this is built-in to the framework For earlier versions or for more control you can use Windows' shell functions as outlined here on CodeProject by Gerald

What do you use to minimize and compress JavaScript libraries? [closed]

走远了吗. 提交于 2019-11-26 19:35:57
What do you use to minimize and compress JavaScript libraries? I use YUI Compressor . Seems to get the job done well! I've used YUI Compressor for a long time and have had no problems with it, but have recently started using Google Closure Compiler and had some success with it. My impressions of it so far: It generally outperforms YUI Compressor in terms of file size reduction. By a small amount on simple mode, and by a lot on advanced mode. Simple mode has so far been as reliable as YUI Compressor. Nothing I've fed it has shown any problems. Advanced "compilation" mode is great for some

Best compression algorithm for XML?

孤者浪人 提交于 2019-11-26 19:29:05
问题 I barely know a thing about compression, so bear with me (this is probably a stupid and painfully obvious question). So lets say I have an XML file with a few tags. <verylongtagnumberone> <verylongtagnumbertwo> text </verylongtagnumbertwo> </verylongtagnumberone> Now lets say I have a bunch of these very long tags with many attributes in my multiple XML files. I need to compress them to the smallest size possible. The best way would be to use an XML-specific algorithm which assigns individual

Using SharpZipLib to unzip specific files?

十年热恋 提交于 2019-11-26 19:28:59
问题 I'm trying to use SharpZipLib to pull specified files from a zip archive. All of the examples I've seen always expect that you want to unzip the entire zip, and do something along the lines of: FileStream fileStreamIn = new FileStream (sourcePath, FileMode.Open, FileAccess.Read); ZipInputStream zipInStream = new ZipInputStream(fileStreamIn); ZipEntry entry; while (entry = zipInStream.GetNextEntry() != null) { // Unzip file } What I want to do is something like: ZipEntry entry = zipInStream

How to implement GZip compression in ASP.NET?

孤街浪徒 提交于 2019-11-26 19:22:42
I am trying to implement GZip compression for my asp.net page (including my CSS and JS files). I tried the following code, but it only compresses my .aspx page (found it from YSlow ) HttpContext context = HttpContext.Current; context.Response.Filter = new GZipStream(context.Response.Filter, CompressionMode.Compress); HttpContext.Current.Response.AppendHeader("Content-encoding", "gzip"); HttpContext.Current.Response.Cache.VaryByHeaders["Accept-encoding"] = true; The above code is only compressing my .aspx page code (markup) not the CSS and JS files which is included as external files. Please

Minifying final HTML output using regular expressions with CodeIgniter

。_饼干妹妹 提交于 2019-11-26 19:06:50
问题 Google pages suggest you to minify HTML, that is, remove all the unnecessary spaces. CodeIgniter does have the feature of giziping output or it can be done via .htaccess . But still I also would like to remove unnecessary spaces from the final HTML output as well. I played a bit with this piece of code to do it, and it seems to work. This does indeed result in HTML that is without excess spaces and removes other tab formatting. class Welcome extends CI_Controller { function _output() { echo

Reducing video size with same format and reducing frame size

孤人 提交于 2019-11-26 18:48:54
问题 This question might be very basic Is there a way to reduce the frame size/rate of Lossy compressed (WMV, MPEG) format, to get a smaller video, of lesser size, with same format. Are there any open source or proprietary apis for this? 回答1: ffmpeg provides this functionality. All you need to do is run someting like ffmpeg -i <inputfilename> -s 640x480 -b 512k -vcodec mpeg1video -acodec copy <outputfilename> For newer versions of ffmpeg you need to change -b to -b:v : ffmpeg -i <inputfilename> -s

Python: Inflate and Deflate implementations

不打扰是莪最后的温柔 提交于 2019-11-26 18:31:23
I am interfacing with a server that requires that data sent to it is compressed with Deflate algorithm (Huffman encoding + LZ77) and also sends data that I need to Inflate . I know that Python includes Zlib, and that the C libraries in Zlib support calls to Inflate and Deflate , but these apparently are not provided by the Python Zlib module. It does provide Compress and Decompress , but when I make a call such as the following: result_data = zlib.decompress( base64_decoded_compressed_string ) I receive the following error: Error -3 while decompressing data: incorrect header check Gzip does no

With Mercurial, how can I “compress” a series of changesets into one before pushing?

流过昼夜 提交于 2019-11-26 18:24:23
Let's say I have a local and a remote Mercurial repository. Now, I start working on a feature. I work on it, and when I think it's done, I commit the changeset. Testing it a bit more, I find that I could further improve this feature by tweaking something in the code. I make the change and commit. 20 minutes later, I find there's a bug in this new feature, so I fix it and commit that too. I now have 3 changesets that I would really like to push to the remote repository as one changeset with message "Implementing feature X", for instance. How can I do this without much hassle? I believe I could