gzip

Apply GZIP compression to a CSV in Python Pandas

Deadly 提交于 2019-12-31 09:12:07
问题 I am trying to write a dataframe to a gzipped csv in python pandas, using the following: import pandas as pd import datetime import csv import gzip # Get data (with previous connection and script variables) df = pd.read_sql_query(script, conn) # Create today's date, to append to file todaysdatestring = str(datetime.datetime.today().strftime('%Y%m%d')) print todaysdatestring # Create csv with gzip compression df.to_csv('foo-%s.csv.gz' % todaysdatestring, sep='|', header=True, index=False,

CSS/JS GZip Compression with Asp.Net

試著忘記壹切 提交于 2019-12-31 09:06:05
问题 I am currently on a hosted Virtual Server, I want to enable GZip compression for my Asp.Net 3.5 site, how do I go about starting? I have tried using 'packed' JS files, but they don't work, I am assuming it's because they are not handled correctly...? 回答1: GZIP should be handled by IIS , what version of IIS are you running? The client is responsible for asking the server for a GZiped version. The server will be looking for two things, the request is http 1.1, and a header of Accept-Encoding:

How do I list contents of a gzip file without extracting it in python?

拜拜、爱过 提交于 2019-12-31 04:39:06
问题 I've got a huge *.tar.gz file and I want to see the list of files contained in it without extracting the contents (preferably with mtimes per file). How can I achieve that in python? 回答1: You can use TarFile.getnames() like this: #!/usr/bin/env python3 import tarfile tarf = tarfile.open('foo.tar.gz', 'r:gz') print(tarf.getnames()) http://docs.python.org/3.3/library/tarfile.html#tarfile.TarFile.getnames And if you want mtime values you can use getmembers(). print([(member.name, member.mtime)

How to load a gzipped rdf file to rdf4j Repository?

北城以北 提交于 2019-12-31 04:22:32
问题 I want to load a gzipped rdf file into a org.eclipse.rdf4j.repository.Repository . During the upload, status messages must be logged to the console. The size of my rdf file is ~1GB of uncompressed or ~50MB of compressed data. 回答1: Actually an RDF4J repository will automatically process a compressed (zip/gzip) file correctly, already. So you can simply do this: RepositoryConnection conn = ... ; // your store connection conn.add(new File("file.zip"), null, RDFFormat.NTRIPLES): If you want to

psycopg2 copy_expert() - how to copy in a gzipped csv file?

天涯浪子 提交于 2019-12-31 03:41:12
问题 If my table is schema_one.table_five and my file name is file_to_import.csv.gz, what args do I give the copy_expert() cmd in order to copy the file contents into the table? Here's what I'm trying: this_copy = '''COPY schema_one.table_five FROM STDIN with CSV''' this_file = "file_to_import.csv.gz" con = psycopg2.connect(dbname=dbname, host=host, port=port, user=user, password=password) cur = con.cursor() cur.copy_expert(this_copy, this_file) This produces an error: cur.copy_expert(this_copy,

psycopg2 copy_expert() - how to copy in a gzipped csv file?

和自甴很熟 提交于 2019-12-31 03:41:09
问题 If my table is schema_one.table_five and my file name is file_to_import.csv.gz, what args do I give the copy_expert() cmd in order to copy the file contents into the table? Here's what I'm trying: this_copy = '''COPY schema_one.table_five FROM STDIN with CSV''' this_file = "file_to_import.csv.gz" con = psycopg2.connect(dbname=dbname, host=host, port=port, user=user, password=password) cur = con.cursor() cur.copy_expert(this_copy, this_file) This produces an error: cur.copy_expert(this_copy,

How to request a gzipped / compressed SOAP response?

狂风中的少年 提交于 2019-12-31 03:08:24
问题 i used the wsimport tool to create a soap client which is working very well. Now I like to request a compressed response from the server because the responses can be quite big. I don't know if the server is able to send compressed content. As far as I know I have to add something like "Accept-Encoding: gzip" in the request. How and where do I do that? Thanks 回答1: If your using ksoap jar for soap request then you need to set your compress method name on your header request. To set header your

How to request a gzipped / compressed SOAP response?

社会主义新天地 提交于 2019-12-31 03:08:02
问题 i used the wsimport tool to create a soap client which is working very well. Now I like to request a compressed response from the server because the responses can be quite big. I don't know if the server is able to send compressed content. As far as I know I have to add something like "Accept-Encoding: gzip" in the request. How and where do I do that? Thanks 回答1: If your using ksoap jar for soap request then you need to set your compress method name on your header request. To set header your

Compressing and decompressing streams

百般思念 提交于 2019-12-30 18:25:24
问题 I found this article about simple proxy server implemented in JAVA: http://www.java2s.com/Code/Java/Network-Protocol/Asimpleproxyserver.htm The code simply gets some stream from the client, after sends it to the server and after it gets stream from the server and sends the response to the client. What I would like to do is to compress this streams before it is sent and decompress after it is received. I found the class GZIPInputStream but I'm not sure how to use it and what I found on

Decompressing a .gz file via PHP

坚强是说给别人听的谎言 提交于 2019-12-30 10:34:27
问题 I need to be able to decompress through PHP some data that I have in a string which uses the gzip format. I need to do this via PHP, not by calling - through system for example - an external program. I go to the documentation and I find gzdecode. Too bad it doesn't exist. Digging further through google it appears this function was implemented in PHP6, which I cannot use. (Interestingly enough gzencode exists and is working). I believe - but I'm not sure - that the gzip format simply has some