« Archives in January, 2006

rar command line

If you need to break down a large file into multiple smaller ones, try rar:

rar a -v10000k test.log.rar test.log
# break a 4GB file into 700MB files quickly (lowest compression level)
rar a -m0 -v700000k SAMPLE_DVD.rar SAMPLE_DVD.ISO

rsync – find repository size

To find repository size before downloading, use –dry-run

$# rsync --dry-run --recursive mirrors.tds.net::rsync
....
sent 62 bytes  received 8161 bytes  5482.00 bytes/sec
total size is 52792107  speedup is 6420.05

That shows RSYNC mirror takes about 50MB.

Does GoogleBot run JavaScript?

Yes, Googlebot does execute JavaScript code. I have an AJAX vote form with Yes/No links. The links are in AJAX form. Something like this: href=”javascript:vote(‘Yes’);” and the database records these votes. I got many votes from GoogleBot. Its User-Agent string is like this: Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html). Now it’s annoying since I do not want the bot to vote.

PHP: strtotime & Windows

It looks like PHP 5.1 on Windows doesn’t understand the time zone string “UTC”

The Planet & Server Owner Privacy

It’s quite simple to do a whois on an IP hosted at ThePlanet and get extra information about the person. Implications: good & bad

root# [~]# whois 70.85.27.85 -h rwhois.theplanet.com -p 4321
[Querying rwhois.theplanet.com]
[rwhois.theplanet.com]
%rwhois V-1.5:003eff:00 whois.theplanet.com (by Network Solutions, Inc. V-1.5.9.5)
network:Class-Name:network
network:ID:THEPLANET-BLK-13
network:Auth-Area:70.84.0.0/14
network:Network-Name:TPIS-BLK-70-85-27-0
network:IP-Network:70.85.27.80/28
network:IP-Network-Block:70.85.27.80 - 70.85.27.95
network:Organization-Name:[xxxx xxxx]
network:Organization-City:Warriewood
network:Organization-Zip:1622
network:Organization-Country:AU
network:Description-Usage:customer
network:Server-Pri:ns1.theplanet.com
network:Server-Sec:ns2.theplanet.com
network:Tech-Contact;I:abuse@theplanet.com
network:Admin-Contact;I:abuse@theplanet.com
network:Created:20041129
network:Updated:20041129

%referral rwhois://root.rwhois.net:4321/auth-area=.
%ok

FlashObject 1.3 version check

A correction to FlashObject 1.3 when checking for player version, I got the warnings in Firefox.

Google wasting 200 gigs of bandwidth a day?

Even though the analysis has flaws, content optimization + content compression are distinctive. See the source for AdSense:

http://pagead2.googlesyndication.com/pagead/show_ads.js

It’s already quite compact before the webserver gzipped it further. I don’t believe that is the same javascript version developers are viewing internally, I imagine they would see comments and meaningful function names.

read more | digg story

wget & mod_gzip

wget & curl are very good command line tools to test and pretend to be any browser. Here I’m testing Google webservers and support for content compression.

# pretend to be Firefox 1.5
wget –server-response –user-agent “Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5″ –header=”Accept-Encoding: gzip, deflate” http://www.google.com

# pretend to be IE6
wget –server-response –user-agent “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)” –header=”Accept-Encoding: gzip, deflate” http://www.google.com

Testing Google JavaScript Compression
wget –server-response –user-agent “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)” –header=”Accept-Encoding: gzip, deflate” http://www.google-analytics.com/urchin.js

wget –server-response –user-agent “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)” –header=”Accept-Encoding: gzip, deflate” http://pagead2.googlesyndication.com/pagead/show_ads.js

Connecting to pagead2.googlesyndication.com|64.233.187.104|:80... connected.
HTTP request sent, awaiting response...
  HTTP/1.0 200 OK
  P3P: policyref="http://www.googleadservices.com/pagead/p3p.xml", CP="NOI 
DEV PSA PSD IVA PVD OTP OUR OTR IND OTC"
  Last-Modified: Thu, 29 Dec 2005 19:55:11 GMT
  Content-Type: text/javascript; charset=UTF-8
  Content-Encoding: gzip
  Server: CAFE/1.0
  Cache-Control: private, x-gzip-ok=""
  Content-Length: 2268
  Date: Wed, 18 Jan 2006 22:03:43 GMT
  Connection: Keep-Alive
  Length: 2,268 (2.2K) [text/javascript]

JavaScript compression with Dojo Rhino

http://dojotoolkit.org/~alex/js_with_compress.jar

This is a modified version of Rhino (the Mozilla JS interpreter written in Java). We (the Dojo project) have added a “compressor” method to the built-in Decompile class. Since we’re operating on the token stream from the parser, this system is somewhat less prone to errors and “overzealousness”. A new “-c” flag sends the “compressed” version of the input to stderr. Normal invocation is:

java -jar js_with_compress.jar -c in.js > out.js 2>&1

This tool will NOT mangle your public APIs. We’re using it as a part of the build process in Dojo and it’s been working well for some time now. It’s much less error prone than the regexp-based stripper we used in netWindows.

Source for the tool (i.e., a zipped up version of my anonymous CVS checkout) is available in the same directory as the Jar file.

Regards

Comment by Alex Russell

mod_gzip/mod_deflate, JavaScript & IE problem

Description: They are not a very good combination as problems have been reported in different applications with JavaScript not loading when served with mod_gzip/mod_deflate on. The error is not deterministic and cannot guarantee 100% error replication but it happens frequent enough.

Affected: The problem only occurs in Internet Explorer (6 and probably lower versions) and refreshing (F5) the page will load the script again. Firefox and Opera do not have this problem.

Solution: a temporary solution is to turn off mod_gzip/deflate in Apache at least for JavaScript in IE.

Reference: http://www.schroepl.net/projekte/mod_gzip/browser.htm