Disable WordPress Auto-Saving
Open the WordPress Config File:
/wp-config.php
And add following code after the first set of functions :
define( ‘AUTOSAVE_INTERVAL’, 600 );
By Default this value is set to 60 (seconds), 600 equals 1 Hour,you can go higher, but i figure 1 hour is good for me.
Disable WordPress Revisions
Open the WordPress Config File:
/wp-config.php
And and following code after the first set of functions:
define( ‘WP_POST_REVISIONS’, 0 );
By Default this value is On (1), turn it off by setting it to Off (0) ( Zero ).
Related Blogs
Following is a quite simple html page I made for google adsense search result:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” lang=”UTF-8″>
<head>
</head>
<body>
<div align = “center”>
****google adsense search result code*****
</div>
</body>
</html>
I dont know what is the meaning of the first 2 lines:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” lang=”UTF-8″>
I used to close some browsers by following code:
puts “to close a certain previous browser”
Watir::IE.attach(:title, /google/).close
puts “to close a certain previous browser”
Watir::IE.attach(:title, /Internet/).close
puts “to close a certain previous browser”
Watir::IE.attach(:title, /Internet/).close
but when 2 or more watir programs run together, they stalled there. I don’t know the reason, so I tried the following code which worked ok:
sleep 1
puts “to close all the other browsers”
ie77.close_others
sleep 1
puts “to close current browser”
ie77.close
It is difficult to find the examples demonstrating how to combine two conditions in the if statement of ruby, I tried and found following code is ok:
tmp = rand(10)
if ((tmp > 5) && (ie77.text.include? ‘fine’))
puts “fine”
else
sleep 7
end
At watir we can submit texts to forms by such a code like : ie.text_field.set(), we could also append texts by the code such as ie.text_field.append(), following is an example:
require ‘watir’
include Watir
# Initialize the text to be submitted to a bbs
conts = []
File.open(‘goodword.txt’) do |f|
f.each_line{|l| conts << l}
end
#Initialize the advertising text to be appended
advs = []
File.open(‘adv.txt’) do |f|
f.each_line{|l| advs << l}
end
———
ie22.text_field(:name, ‘co’).set(conts[rand(conts.size)])
ie22.text_field(:name, ‘co’).append(“\n”)
ie22.text_field(:name, ‘co’).append(“\n”)
ie22.text_field(:name, ‘co’).append(“\n”)
ie22.text_field(:name, ‘co’).append(“\n”)
ie22.text_field(:name, ‘co’).append(advs[rand(advs.size)])
—–
“\n”    means change to a new line.
The following is the code to use watir for Page scraping:
require ‘watir’
include Watir
jinan = “http://homemsg.focus.cn/msgview/607/48996344.html”
ie21 = IE.new
ie21.goto jinanba
puts ie21.table(:index => 9, :class => /p9/).text
#puts ie21.table(:index => 11, :class => /p9/).html
The following is the code to use firewatir for Page scraping, the reson to use firewatir is that the watir will wait for the page load:
require ‘firewatir’
include FireWatir
jinanba = “http://homemsg.focus.cn/msgview/607/48996344.html”
ie21 = Firefox.new
ie21.goto jinanba
fout = File.new(“test.txt”, “w”)
fout.puts ie21.table(:index , 16).html
fout.close