w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
nginx gzip not working on browser but curl works
Your curl command works because it sends a HEAD request, instead of a GET request. Try curl with verbose mode: curl -Iv -H "Accept-Encoding: gzip,deflate" http://www.ihezhu.com/ You will get the same result as in browser with curl -i -H "Accept-Encoding: gzip,deflate" http://www.ihezhu.com/ "text/html" is always compressed. So it has nothing to do with gzip_types directive. This happened to me before when my upstream server was using http 1.0 instead of http 1.1. Have you tried the following? gzip_http_version 1.0; [update] Your nginx compile option seems normal. It's hard to understand how url length directly affects nginx on gzip. Checked the nginx source code. nothing on url is used to determine gzip. Based on the source code, there are 2 possible causes: Your php code ret

Categories : Nginx

Web Deploy Command Line Logs in Event Logs (Updated / Inserted / Deleted Files) in event logs
I don't believe you can log the activities to the event log, but what you can do is use the -xml parameter to output the changes in XML format. You could then use this to log to the event log via a Powershell script, for example.

Categories : Iis

What is Matrix.frustumM(mProjMatrix, 0, -ratio, ratio, -1, 1, 3, 7); in OpenGL ES 20?
View frustum is just a visual representation of perspective projection that is used to convert 3D point in the world coordinate space to the 2D point on the screen. There're multiple ways to define the projection matrix (at least that I used personally): By specifying 6 clip planes By specifying aspect ratio, far and near clipping planes, field of view angle But in the end they all end up as a single 4x4 perspective transform matrix. Here is a must read article.

Categories : Java

Where is my nginx being configured? Changing nginx.conf still brings me to the 'Welcome to nginx' page
when you rewrited the nginx.conf in the folder of source code of nginx and installed it firstly, it will be copied to /usr/local/nginx/conf/nginx.conf (without specially modification of the configure in the folder of source code). But when you do this secondly, the nginx.conf in the folder of source code will be copied to /usr/local/nginx/conf/nginx.conf.defualt,and it usually don't work unless you use nginx -c /usr/local/nginx/conf/nginx.conf.defualt to assign its configure file evertime. There is a line NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" in your script above,which indicates the configure file clearly. To handle this, I suggest rewrite /usr/local/nginx/conf/nginx.conf (not the one in the folder of source code) instead.

Categories : Nginx

How to conveniently store common logs and client specific logs
I would have an xml file that contain the appenders to specify what packages go into what log file. You can then load the xml file in your application entry point. Below is an example I have used in my current project <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <!-- appenders --> <appender name="console" class="org.apache.log4j.ConsoleAppender"> <param name="Target" value="System.out" /> <param name="threshold" value="error" /> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="[%t] %p %c - %m%n" /> </layout> </appender> <appender name="codebaseXAppender" class="org.apache.log4j.RollingFileAppender"> <

Categories : Java

How to set intellij to show logs in the logs tab and not the output tab
In the application server Run/Debug configuration open the Logs tab and specify the full log file path there. You can just search your disk for algo_js.log file and specify its location.

Categories : Spring

Get iPhone Logs(not crash logs)
Got a breakthrough!!. We need to re-direct NSLog to a file like this and then access the file. - (void)redirectNSLogToDocumentFolder{ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *fileName =[NSString stringWithFormat:@"%@.log",[NSDate date]]; NSString *logFilePath = [documentsDirectory stringByAppendingPathComponent:fileName]; freopen([logFilePath cStringUsingEncoding:NSASCIIStringEncoding],"a+",stderr); } http://objcolumnist.com/2009/12/19/redirecting-nslog-to-a-log-file/

Categories : IOS

Video aspect ratio is not correct, I set a ratio of 1.333 and the video has 1:1
MY texture view had this: @Override protected void onMeasure(int paramInt1, int paramInt2) { int i = View.MeasureSpec.getSize(paramInt1); setMeasuredDimension(i, i); } To fix it, I've changed it into: @Override protected void onMeasure(int paramInt1, int paramInt2) { int i = View.MeasureSpec.getSize(paramInt1); int j = View.MeasureSpec.getSize(paramInt2); setMeasuredDimension(i, j); }

Categories : Android

Restarting nginx: nginx: [alert] Unable to start the Phusion Passenger watchdog because its executable
Passenger takes what you set in the file nginx.conf by passenger_ruby, for example: passenger_root /home/dev/.rvm/gems/ruby-1.9.3-p448/gems/passenger-4.0.5; passenger_ruby /home/dev/.rvm/wrappers/ruby-1.9.3-p448/ruby;

Categories : Ruby

Can a server run Nginx for some sites and Apache Nginx Reverse Proxy for others?
server { server_name example.com; location / { # assuming apache is on port 81 for example proxy_pass; # to make apache detect the host header proxy_set_header Host $host; } # if you have assets folders, you can let nginx serve them directly, # instead of passing them to apache location /images { # or /css or /js .. etc try_files $uri =404; } } Note: in the case of assets, sometimes some sites serve assets through rewrites, or even handled by the application it self, you can pass it to apache by adding that in the assets location as a fallback like this location /images { try_files $uri @apache; } location @apache { proxy_pass; } In apache you create a virtual host <Virtua

Categories : Apache

what is the difference between printing from a class or returning the output and printing from a function
constructors can't return values. They always return the created object. So you will get in $output the created object of your class sql_output_two_rows and not the string. Restructre the code (maybe static function for formatting or create an extra function for that)

Categories : PHP

Print Natural Sequence with help of 2 threads(1 is printing even and 2'nd is printing odd)
This could be an exercise on threads and lock monitors, but there is nothing to do in parallel that give you advantages. In your code when a thread 1 (OddThread or EvenThread) ends his work and prints out "Odd Thread Finish" (or "Even Thread Finish") the other thread 2 is waiting a notify() or a notifyAll() that never will happen because the first is over. You have to change EvenThread and OddThread adding a synchronized block with a notify call on commShare just after the while cycle. I removed the second if-branch because in this way you don't continue to check the while condition but get a wait on commShare soon. class EvenThread implements Runnable { private Share commShare; private int number = 2; public EvenThread(Share obj) { this.commShare = obj; } p

Categories : Java

How to use gzip if it has not been enabled
No. There are no way to gzip your content if the gzip mod is not enabled and if you can't use htaccess files as far as I know... You can have a look to the gzdeflate PHP function, if you want, but you will be able to compress only your php files. The other files (js, css, images) will be uncompressed.

Categories : Apache

Gzip only files containing "*foo*" over SSH
I assume you mean archive into a single tar file? Not individual .gz files? Try this: (assumes there aren't too many files) find . -name "*foo*" | xargs tar cvzf archive.tar.gz An alternative is to do something like: find . -name "*foo*" > list.txt tar cvzf archive.tar.gz -T list.txt #(works only with gnu tar, not bsd i think)

Categories : Linux

XML File Gzip and PHP
Ok I got it working using curl then createing an XML object (I think!) $ch = curl_init(); curl_setopt($ch,CURLOPT_ENCODING , "gzip"); // set url curl_setopt($ch, CURLOPT_URL, $url); //return the transfer as a string curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // $output contains the output string $output = curl_exec($ch); curl_close($ch); //print_r($output); $oXML = new SimpleXMLElement($output); The results are compatible with my script and can be parsed to extract the data :0)

Categories : PHP

AFHTTPClient and gzip
If someone has the same problem, here is my solution (Godzippa didn't work for me, so I used different library to encode data): - (id)initWithBaseURL:(NSURL *)url { self = [super initWithBaseURL:url]; if (!self) { return nil; } [self setDefaultHeader:@"Content-Type" value:@"application/json"]; [self setDefaultHeader:@"Content-Encoding" value:@"gzip"]; [self registerHTTPOperationClass:[AFJSONRequestOperation class]]; return self; } -(void)postPath:(NSString *)path parameters:(NSDictionary *)parameters success:(void (^)(AFHTTPRequestOperation *, id))success failure:(void (^)(AFHTTPRequestOperation *, NSError *))failure { NSData *newData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:NULL]; newData = [newData gzipDeflate];

Categories : IOS

tar/gzip excluding certain files
gzip will always handle files individually. If you want a bundled archive you will have to tar the files first and then gzip the result, hence you will end up with a .tar.gz file or .tgz for short. To get a better control over what you are doing you can find the files first using the command you already posted (with -print insted of the gzip command), put them into a file and use this file (=filelist.txt) to uinstruct tar with what to archive tar -T filelist.txt -c -v -f myarchive.tar

Categories : Linux

gzip and return as string
I am sure that you looked into http://php.net/manual/en/function.gzcompress.php make sure that you have php version PHP 4 >= 4.0.1, PHP 5 string gzcompress ( string $data [, int $level = -1 [, int $encoding = ZLIB_ENCODING_DEFLATE ]] ) This function compress the given string using the ZLIB data format. For details on the ZLIB compression algorithm see the document "» ZLIB Compressed Data Format Specification version 3.3" (RFC 1950). <?php $compressed = gzcompress('Compress me', 9); echo $compressed; ?> Note: This is not the same as gzip compression, which includes some header data. See gzencode() for gzip compression. Parameters data The data to compress. level The level of compression. Can be given as 0 for no compression up to 9 for maximum com

Categories : PHP

gzip a folder and its subfolders on the fly
It's a little unclear what you're after, since gzip has no notion of files - just bytes to be compressed - you need an archive format like tar to combine a bunch of files and directories into a single stream, and then you can gzip that. If you just want some compressed archive format, the JDK's ZipOutputStream will let you use zip compression. If you specifically need gzip format, there are a number of implementstions of tar output streams out there - use one of those and pipeline it into the JDK's gzip output stream.

Categories : Java

Is this a bug in this gzip inflate method?
Yes, looks like a bug. According to this annotated example from the zlib site, Z_BUF_ERROR is just an indication that there is no more output unless inflate() is provided with more input, not in itself a reason to abort the inflate loop abnormally. In fact, the linked sample seems to handle Z_BUF_ERROR exactly like Z_OK.

Categories : Python

Apply GZIP to SVG - WebConfig
Are your .svg files served up with the correct content type (image/svg+xml)? When served without a proper Content-Type in the response, the compression modules will not compress the response.

Categories : Asp Net

GZip compression from code
You can achieve this using an action filter. public class CompressFilter : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext filterContext) { HttpRequestBase request = filterContext.HttpContext.Request; string acceptEncoding = request.Headers["Accept-Encoding"]; if (string.IsNullOrEmpty(acceptEncoding)) return; acceptEncoding = acceptEncoding.ToUpperInvariant(); HttpResponseBase response = filterContext.HttpContext.Response; if (acceptEncoding.Contains("GZIP")) { response.AppendHeader("Content-encoding", "gzip"); response.Filter = new GZipStream(response.Filter, CompressionMode.Compress); } else if (acceptEncoding.Contains("DEFLATE")) {

Categories : Asp Net Mvc

How to GZIP google maps
Related to the linked explanation, you browser must send these 2 headers: Accept-Encoding: gzip User-Agent: my program (gzip) Accept-Encoding: be sure that your browser supports gzip(I would say when your browser isn't older than 15 years, you don't need to do anything, he will support GZIP and already sends this header) User-Agent: it depends on the used browser how to apply it. In Firefox you must modify the setting general.useragent.override and set it to the desired string(e.g. Firefox(gzip)) . Type about:config in the adressbar, search for the setting and modify it. But usually you don't need to change anything when you use a common browser, the maps already will be delivered in GZIP(the article is related to google-apps) Note: It may have side-effects when you modify the user

Categories : Google Maps

GZip completely breaks CSS
Ignoring a compressed CSS file is exactly the behavior I'd expect. Most browsers don't know how to unzip a file, so they just look at the zipped file, don't know what to do with it, and say "this CSS file is malformed; I'm ignoring it". There are ways to make a CSS file a little smaller - mostly by stripping out unneeded whitespace - but for the most part you're stuck loading the whole thing. If it's taking too long to load, find some way to simplify it. How big is this CSS file, anyway? If it's so big that loading it slows down your page loads, that's actually kind of impressive. And the user's browser should cache it after it's been loaded once and then not need to download it again on subsequent pages. Could it be slowing down not because of the load time, but because there are so many

Categories : CSS

How to enable GZIP for Magento
Use both gzip and browser caching to speed up your site then test it at Google speed insights: http://developers.google.com/speed/pagespeed/insights/ <IfModule mod_headers.c> # YEAR <FilesMatch ".(ico|gif|jpg|jpeg|png|flv|pdf)$"> Header set Cache-Control "max-age=29030400" </FilesMatch> # WEEK <FilesMatch ".(js|css|swf)$"> Header set Cache-Control "max-age=604800" </FilesMatch> # 45 MIN <FilesMatch ".(html|htm|txt)$"> Header set Cache-Control "max-age=86400" </FilesMatch> </IfModule> <ifModule mod_gzip.c> mod_gzip_on Yes mod_gzip_dechunk Yes mod_gzip_item_include file .(html?|txt|css|js|php|pl|asp|html)$ mod_gzip_item_include handler ^cgi-script$ mod_gzip_item_include mime ^text/.* mod_gzip_item_include mime ^applicat

Categories : Magento

Disable gzip compression in chrome
Chrome doesn't seem to expose this setting, but what you can do is the following: get the ModHeader plugin for Chrome: https://chrome.google.com/webstore/detail/modheader/idgpnmonknjnojddfkpgkljpfnnfcklj?hl=en (or any other that allows you to fiddle with your browser request headers) set a new custom header accept-encoding to either: an empty value or gzip;q=0,deflate;q=0 either should work

Categories : Google Chrome

gzip/zip in Classic ASP / VB Script for eBay API
For base64-encoding a string see this answer. For gzip compression you could try this component (never used it myself, though) or shell out to a gzip executable: Set sh = CreateObject("WScript.Shell") sh.Run "C:path ogzip.exe filename" gzip for Windows can be found here.

Categories : Api

gzip compression tool usage
Assuming you're on a *NIX machine, you can use gzip -c FILE > FILE.gz to write the gzipped data to a different file. The -c writes to stdout, and the > redirects stdout to a file. If you have many you could try a loop in Bash: for file in *.js do gzip -c "$file" > "${file}.gz" done Also, be really really certain your server falls back on the nongzipped versions if the client doesn't support it!

Categories : Javascript

Resteasy generally enable GZIP
No, there is no way with annotations to enable gzip for all resources. If you wanted to forego adding the annotation to every class you could create a servlet filter that looks at the incoming headers and gzips the response on the way out.

Categories : Misc

Sitecore MVC - gzip compression error
You should probably enable gzip in your web.config <system.webServer> <httpCompression directory="%SystemDrive%inetpub tempIIS Temporary Compressed Files"> <scheme name="gzip" dll="%Windir%system32inetsrvgzip.dll"/> <dynamicTypes> <add mimeType="text/*" enabled="true"/> <add mimeType="message/*" enabled="true"/> <add mimeType="application/javascript" enabled="true"/> <add mimeType="*/*" enabled="false"/> </dynamicTypes> <staticTypes> <add mimeType="text/*" enabled="true"/> <add mimeType="message/*" enabled="true"/> <add mimeType="application/javascript" enabled="true"/> <add mimeType="*/*" enabled="false"/> </staticTypes> </ht

Categories : Asp Net Mvc

C++ Inflate gzip char array
Assuming you are giving inflate an appropriate and complete "compressed stream", and there is enough space to output the data, you would only need to call inflate once. Edit: It is not written out as clearly as that in the zlib documentation, but it does say: inflate decompresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may introduce some output latency (reading input without producing any output) except when forced to flush. Of course, for any stream that isn't already "in memory and complete", you want to run it block by block, since that's going to have less total runtime (you can decompress while the data is being received [from network or filesystem pre-fetch caching] for the next block). Here's the wh

Categories : C++

Python Gzip - Appending to file on the fly
That works in the sense of creating and maintaining a valid gzip file, since the gzip format permits concatenated gzip streams. However it doesn't work in the sense that you get lousy compression, since you are giving each instance of gzip compression so little data to work with. Compression depends on taking advantage the history of previous data, but here gzip has been given essentially none. You could either a) accumulate at least a few K of data, many of your lines, before invoking gzip to add another gzip stream to the file, or b) do something much more sophisticated that appends to a single gzip stream, leaving a valid gzip stream each time and permitting efficient compression of the data. You find an example of b) in C, in gzlog.h and gzlog.c. I do not believe that Python has a

Categories : Python

How do i Gzip responses using require.js in node.js
At ZingProject.com, we use Express 3.2.6 and like you, we ensure gzip compressing like this: app.use(express.compress()); Transfer sizes verified in Chrome were 20%-80% smaller with by just adding this line so we know that works. How are you verifying that the transfers are NOT compressing? In Chrome inspector, on the network tab you will see a transfer size with two numbers. One is the amount of network data transferred, and the other is the actual uncompressed size of the file. If the numbers are different, your compression is working correctly. If the numbers are the same, something is indeed off. Firebug only shows you the network transfer size, so you will have to turn compression on and off, and compare the sizes of transfers with each if you are using Firefox.

Categories : Node Js

How enable gzip in puma server
I think that you should use Nginx or Apache for gzip compression. You can try this link Puma will only serve the application. Compression, expiration time and other stuff related to the application files are reverse proxy stuff.

Categories : Ruby On Rails

Why does Gzip compress my css & javascript but not my HTML/php?
Not sure exactly what the issue might be but perhaps an easy fix would be to try something like... <IfModule mod_deflate.c> <FilesMatch ".(css|htm|html|js|php|txt|xml)$"> SetOutputFilter DEFLATE </FilesMatch> </IfModule> ...which should setup compression on popular file extensions including PHP. I personally think this format is much easier for a human to read too. Bonus!

Categories : Apache

Find and gzip files in subdirectories
Since we don't have to recurse, I'd approach it not with find but with globbing and a for loop. If we're in the Calc directory, echo * will give us all the directory names: ~/Docs/Calc$ echo * 2011 2012 2013 It just so happens that we can use a for loop to iterate over these and tar them up in the usual way: for year in *; do tar czf $year.tar.gz $year done If you want the resulting tarballs in the year directories, you could add an mv after the tar command. I'd be hesitant to put the tarball in the directory from outset or tar might start trying to tar its own output into itself.

Categories : Bash

Httpclien 4 gzip Post-Data
HttpClient 4.3 APIs: HttpEntity entity = EntityBuilder.create() .setText("some text") .setContentType(ContentType.TEXT_PLAIN) .gzipCompress() .build(); HttpClient 4.2 APIs: HttpEntity entity = new GzipCompressingEntity( new StringEntity("some text", ContentType.TEXT_PLAIN)); GzipCompressingEntity implementation: public class GzipCompressingEntity extends HttpEntityWrapper { private static final String GZIP_CODEC = "gzip"; public GzipCompressingEntity(final HttpEntity entity) { super(entity); } @Override public Header getContentEncoding() { return new BasicHeader(HTTP.CONTENT_ENCODING, GZIP_CODEC); } @Override public long getContentLength() { return -1; } @Override public boolea

Categories : Http

Gzip issue with multiprocessing pool
See http://docs.python.org/2/library/multiprocessing.html#programming-guidelines You should guard calling part with "if name == main...". Or that part will be run by child process. Explicitly pass resources to child processes. (ohandle, lock) I modified your code to not use lock and not to share ohandle. Instead I used temporary file. (fn + '.temp') Caution: You should check filenames. If there is any file with '.temp' suffix, my code could delete your data. import os def process(fn): out_fn = fn + '.temp' with open(fn) as f, open(out_fn, 'w') as f2: for l in f: sometext = dosomething(l) print >> f2, sometext return out_fn if __name__ == '__main__': some_file_list = ... pool = Pool(processes=4) ohandle = gzip.open('o

Categories : Python

CMS Cache, Gzip and Cloudflare can they all work together?
can CMS caching mechanism (For example Joomla cache), Gzip compression and Cloudflare work all together in perfect harmony? Yes, plus they all do slightly different things. Cloudflare caches the static content, eg images and stylesheets. Fresh page HTML is still downloaded by every visitor on every page. Gzip compression comes into play both with Cloudflare and your server. By default Cloudflare automatically compresses content passing through it's system, Files not passing through Cloudflare can be compressed by your server, Caching and gzip compression by htaccess , though since you are using Joomla, the easiest way to enable this is from the control panel > system > global configuration > server > Gzip Page Compression. This will decrease download times for the page HTML

Categories : Caching

WebClient and Gzip compression is faster?
Short answer is usually Yes. Long answer, It depends. on the following: Is the Server configured to compress responses or not. Whether the request is for a dynamic or static content. (some servers do not compress dynamic content) Bandwidth and latency between server and client. Size of the response being returned, on small responses it wont make big a difference. Also note, that adding the "accept-encoding" on the client side, tells the server "I understand gzip/deflate" and does not force the server to compress response.

Categories : C#

© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.