Friday 9 February 2007

GMapbook v1.2 is released

GMapbook v1.2 is available now!

1. What is GMapbook?
GMapbook is a guestbook based on Google Maps API. Now it is fully based on the popular AJAX technology. It is simple, steady and easy to use. Why not make it on your site? Now I can provide single-user version for downloading. And from now on, I will made it a serious software, not just a toy.

2. Requirment
PHP 5.0 or above, MySQL 3.3 or above
If you don't have a server meeting the requirement, you can simply apply a free webspace at http://www.ifastnet.com as I did.

3. Downloading
Not available now. Due to a harddisk error, Javascript source code lost, development stopped.
Please refer to version 2.0

4. Installation
For new users, read "readme.txt" first, and install it following the instructions. Or simply visit the "http://your gmapbook path/install.php
You must have a Google Maps API key, and I already give a link in the installing page. You can follow it and get your own key.

If you can install Wordpress, I think it won't be hard for you to install it.

5. BUG Reporting
Just visit here and post a comment. That's OK!

6. Change Log
v1.2 Add a interface for manually locating
v1.1 Fix the IE7's incompatibility
v1.1 First release

7. TO-DO List:
a. Recently, some function is a little inconvenient, more javascript is needed to improve that;
b. Now only PHP+MySQL platform is supported, ASP+MSACCESS version may be available, too(since it is fully based on AJAX, it should be easy);
c. An plugin for WordPress may be developed;

Saturday 3 February 2007

How to Increase Pagerank

Here, I am not telling you to promote the quality of your webpages, to exchange links with high ranked site, and to do some cheating. Just look at the picture below:

 

What I have done is just adjusting the RSS links' position, and the pagerank goes from 1 to 5.

Amazing!?

But just kidding, it's because Google Toolbar is awful, which malfunctions easily, and even make firefox unstable. Yet, it's so convinient that I could bear to restart the browser again and again.

 

I wrote this bullshit just because I was wondering which place MS Live Writer will upload that picture to. But the fact told me it couldn't do that and asked me to upload it to an FTP server.  It cannot upload it to picasa.

Friday 2 February 2007

Compress Webpage Even the Server doesn't support GZIP

Use gzip compression, you can save a lot of band width and your visitors also get better loading speed. But some odd servers do not enable this function. Now here is method to do it manually with php code.

First, save the highlighted code in the end of the page
Then, make your page like this

<?php?
include('gzipOut.php'); //first include our functions
?>
..................
..................//Put your content here
..................
<?php?
doGzipout(); //finally call gzip function
?>

Simple, right?
It's tricky, yet at most circumstances, we don't need it.





<?php
ob_start
();//Open flush
ob_implicit_flush(0);//
//*****************************************************************//
//Name:canGzip()
//Function:Check whether the client support gzip
//Parameter:
//Return Value: "gzip", "x-gzip", False
//*****************************************************************//
function canGzip()
{
//if (headers_sent() connection_status)

//return false;

if (strpos('King'.$_SERVER["HTTP_ACCEPT_ENCODING"], 'gzip') !== false)

return
"gzip";

if (
strpos('King'.$_SERVER["HTTP_ACCEPT_ENCODING"], 'x-gzip') !== false)

return
"x-gzip";

return
false;
}

//*****************************************************************//
//Name:doGzipOut($level, $debug)
//Function:compress the data in the flush and output
//Parameter:$level-compression level, 0 = no, 9 = max
// $debug-whether to output debug information, 1 = output, 0 = no
//Return Value:
//*****************************************************************//
function doGzipOut($level = 1, $debug = 0)
{

$ENCODING = canGzip();
if (
$ENCODING)
{
echo
"n<!-- Use compress $ENCODING -->n";

$contents = ob_get_contents();
ob_end_clean();

if (
$debug)
{
$s = "<p>Not compress length: ".strlen($contents);

$s .= "<br/>Compressed length: ".strlen(gzcompress($contents,$level));

$contents .= $s;
}

header("Content-Encoding: $ENCODING");
echo
"x1fx8bx08x00x00x00x00x00"; //???

$size = strlen($contents);
$crc = crc32($contents);
$contents = gzcompress($contents, $level);

$contents = substr($contents, 0, strlen($contents) - 4); //???

echo $contents;
echo
pack('V',$crc);
echo
pack('V',$size);

exit;
}
else
{
ob_end_flush();
exit();
}
}

?>

Thursday 1 February 2007

Google Pagerank Hacking?

Many people know Google employs some strange hash method to validate whether the input parameter is valid, especially for pageranks.
Accidentally, I just browsed the javascript file of Google Toolbar for Firefox and found something interesting. See it below:

GPR_HASH_SEED="Mining PageRank is AGAINST GOOGLE'S TERMS OF SERVICE. Yes, I'm talking to you, scammer.";
GPR_toHex8=function(num){
return(num<16?"0":"")+num.toString(16)
};
GPR_hexEncodeU32=function(num){
var result=GPR_toHex8(num>>>24);
result+=GPR_toHex8(num>>>16&255);
result+=GPR_toHex8(num>>>8&255);
return result+GPR_toHex8(num&255)
};
GPR_awesomeHash=function(value){
var kindOfThingAnIdiotWouldHaveOnHisLuggage=16909125;
for(var i=0; i<value.length; i++){
kindOfThingAnIdiotWouldHaveOnHisLuggage^=GPR_HASH_SEED.charCodeAt(i%GPR_HASH_SEED.length)^value.charCodeAt(i);
kindOfThingAnIdiotWouldHaveOnHisLuggage=kindOfThingAnIdiotWouldHaveOnHisLuggage>>>23kindOfThingAnIdiotWouldHaveOnHisLuggage<<9
}
return GPR_hexEncodeU32(kindOfThingAnIdiotWouldHaveOnHisLuggage)
};


This is almost the original code in toolbar.js, and I made some tiny modifications to make it readable and workable. The only function that needs to be called is GPR_awesomeHash(Some_String)

The prefix GPR here must be the acronym of Google PageRank. This is the Hash method they use. It is really awesome if you read this sentence:

"Mining PageRank is AGAINST GOOGLE'S TERMS OF SERVICE. Yes, I'm talking to you, scammer."

I am not willing to disobey GTOS, so I will not give you the code to get pagerank value.

You can do that yourself. It is quite easy. Yes, I'm talking to you, scammer.

What I am interested in is actually something else, say "Google Dictionary"?
Using Google Toolbar, we can translate most English word to our own language by pointing the word. Usually, this dictionary is in some DAT files in the plugin folder which seems not too difficult to crack. You may try!

But Google also offers an online interface to retrieve word meaning. Luckily, they use the same hash method. The URL format is below:
http://www.google.com/tbproxy/dictionary?ie=UTF-8&oe=UTF-8&text=SomeEnglishWord&langpair=en%7CLanguageCode&sig=HashCode

Language code: zh-CN for simplified Chinese, fr for French, jp for japanese, etc
Hash code: "8"+GPR_awesomeHash(the english word you look up for)

The number 8 is kind of miracle. Also, in the hashmethod, the number 16909125 may have some special meaning, too. Yet, I don't know.

Here are some example links for this dictionary, the word is HAPPY
Simplified Chinese:
http://www.google.com/tbproxy/dictionary?ie=UTF-8&oe=UTF-8&text=happy&langpair=en%7Czh-CN&sig=8b0082ea0

Traditional Chinese:
http://www.google.com/tbproxy/dictionary?ie=UTF-8&oe=UTF-8&text=happy&langpair=en%7Czh-TW&sig=8b0082ea0

French:
http://www.google.com/tbproxy/dictionary?ie=UTF-8&oe=UTF-8&text=happy&langpair=en%7Cfr&sig=8b0082ea0

Korean:
http://www.google.com/tbproxy/dictionary?ie=UTF-8&oe=UTF-8&text=happy&langpair=en%7Cko&sig=8b0082ea0

How to use GMapbook

It is simple to use GMapbook, yet a friend make a video to show how to use it.
Here it is.


You Own Google Map Guestbook - video powered by Metacafe