google gears on firefox2
Problem: the latest google gears version 0.3.11.0 can't install on firefox2.0.0.12.
Resolution: download google gears 0.3.2.0 version from neyric's blog , install it and restart firefox, google gears works.
Problem: the latest google gears version 0.3.11.0 can't install on firefox2.0.0.12.
Resolution: download google gears 0.3.2.0 version from neyric's blog , install it and restart firefox, google gears works.
发表者 俞 伟军 位置在: 3/22/2008 11:26:00 PM 0 评论
标签: Firefox , Gears , Google , JavaScript , offline
发表者 俞 伟军 位置在: 3/22/2008 08:11:00 PM 0 评论
John Resig published a great article on his blog, which brought out a smiple javascript inheritance resolution:
发表者 俞 伟军 位置在: 3/22/2008 02:20:00 PM 0 评论
标签: Class , Inheritance , JavaScript , Resig , super
IE7:
alert(/x/.test(function(){'x';}))
// => true
(function(){'x';}).toString();
// => "(function(){'x';})"
FF2:
alert(/x/.test(function(){'x';}))
// => false
(function(){'x';}).toString();
// => "function () { }"
发表者 俞 伟军 位置在: 3/21/2008 04:50:00 PM 0 评论
标签: Firefox , Function , IE7 , toString()
1. install soap4r
$> gem install soap4r
2. run soap request
driver = SOAP::RPC::Driver.new
driver.wiredump_dev = STDERR if $DEBUG
driver.wiredump_file_base = "soap_result"
......
3.get error as below:
C:/ruby/lib/ruby/1.8/openssl/ssl.rb:91:in `post_connection_check': hostname not match (OpenSSL::SSL::SSLError)
from C:/ruby/lib/ruby/gems/1.8/gems/httpclient-2.1.2/lib/httpclient.rb:1052:in `post_connection_check'
from C:/ruby/lib/ruby/gems/1.8/gems/httpclient-2.1.2/lib/httpclient.rb:1467:in `connect'
from C:/ruby/lib/ruby/1.8/timeout.rb:56:in `timeout'
from C:/ruby/lib/ruby/1.8/timeout.rb:76:in `timeout'
from C:/ruby/lib/ruby/gems/1.8/gems/httpclient-2.1.2/lib/httpclient.rb:1454:in `connect'
from C:/ruby/lib/ruby/gems/1.8/gems/httpclient-2.1.2/lib/httpclient.rb:1311:in `query'
from C:/ruby/lib/ruby/gems/1.8/gems/httpclient-2.1.2/lib/httpclient.rb:932:in `query'
from C:/ruby/lib/ruby/gems/1.8/gems/httpclient-2.1.2/lib/httpclient.rb:2131:in `do_get_block'
... 7 levels...
from C:/ruby/lib/ruby/gems/1.8/gems/soap4r-1.5.8/lib/soap/rpc/proxy.rb:143:in `call'
from C:/ruby/lib/ruby/gems/1.8/gems/soap4r-1.5.8/lib/soap/rpc/driver.rb:181:in `call'
发表者 俞 伟军 位置在: 3/20/2008 06:41:00 PM 0 评论
发表者 俞 伟军 位置在: 3/19/2008 10:51:00 PM 0 评论
get response body of specified web page using php5, such as google homepage.
发表者 俞 伟军 位置在: 3/19/2008 11:36:00 AM 0 评论
Class ActionController::Base
filter_parameter_logging(*filter_words) {|key, value| ...}
Replace sensitive paramater data from the request log. Filters paramaters that have any of the arguments as a substring. Looks in all subhashes of the param hash for keys to filter. If a block is given, each key and value of the paramater hash and all subhashes is passed to it, the value or key can be replaced using String#replace or similar method.
Examples:
filter_parameter_logging
=> Does nothing, just slows the logging process down
filter_parameter_logging :password
=> replaces the value to all keys matching /password/i with "[FILTERED]"
filter_parameter_logging :foo, "bar"
=> replaces the value to all keys matching /foo|bar/i with "[FILTERED]"
filter_parameter_logging { |k,v| v.reverse! if k =~ /secret/i }
=> reverses the value to all keys matching /secret/i
filter_parameter_logging(:foo, "bar") { |k,v| v.reverse! if k =~ /secret/i }
=> reverses the value to all keys matching /secret/i, and
replaces the value to all keys matching /foo|bar/i with "[FILTERED]"
发表者 俞 伟军 位置在: 3/18/2008 10:28:00 AM 0 评论
标签: API , filter_parameter_logging , Logs , Rails
72.14.219.190 yourblogname.blogspot.com
add this line to /etc/hosts or C:\windows\system32\drivers\etc\hosts file end.
首先,在任意目录( 比如C:\)下面,建立一个proxy.pac文件(文本文件,用notepad来写即可)
在该文件中,写入以下内容:
发表者 俞 伟军 位置在: 3/16/2008 04:00:00 PM 1 评论
$> man ls
.....
-G Enable colorized output. This option is equivalent to defining
CLICOLOR in the environment. (See below.)
-w Force raw printing of non-printable characters. This is the
default when output is not to a terminal.
1. Download the C API from http://www.maxmind.com/download/geoip/api/c/
2. Do the following to build and install GeoIP:
{{{
./configure
make
make check
sudo make install
}}}
3. Download the ruby API from http://www.maxmind.com/download/geoip/api/ruby/
4. Do the following to build and install GeoIP ruby:
{{{
ruby extconf.rb --with-geoip-include=/usr/local/include
make
sudo make install
}}}
5. Install mod_geoip
{{{
sudo apxs -i -a -L/usr/local/lib -I/usr/local/include -lGeoIP -c mod_geoip.c
}}}
6. place
{{{
<IfModule mod_geoip.c>
GeoIPEnable On
GeoIPDBFile /usr/local/share/GeoIP/GeoIP.dat
LoadModule geoip_module /usr/lib/httpd/modules/mod_geoip.so
</IfModule>
}}}
inside your httpd.conf file.
If mod_geoip doesn't work, try taking the LoadModule geoip_module line outside the
If you get a "libGeoIP.so.1: cannot open shared object file: No such file or directory" error, add /usr/local/lib to /etc/ld.so.conf then run
/sbin/ldconfig /etc/ld.so.conf
7. mod_geoip can't install on Mac OSX because some unknown problem.
8. GeoIp ruby module install on Mac OSX is also some problem, but can install follow instruction of INSTALL
9. ruby example:
require 'net/geoip'
# access_type # Net::GeoIP::TYPE_DISK and Net::GeoIP::TYPE_RAM
#
g = Net::GeoIP.new(Net::GeoIP::TYPE_DISK)
# g = Net::GeoIP.open(db_filename[, access_type])
puts g.country_code_by_addr('220.181.37.55')
puts g.country_code_by_name('www.baidu.com')
puts g.country_code3_by_addr('220.181.37.55')
puts g.country_code3_by_name('www.baidu.com')
puts g.country_name_by_addr('220.181.37.55')
puts g.country_name_by_name('www.baidu.com')
puts g.country_id_by_addr('220.181.37.55')
puts g.country_id_by_name('www.baidu.com')
# >> CN
# >> CN
# >> CHN
# >> CHN
# >> China
# >> China
# >> 48
# >> 48
# puts g.region_by_addr('220.181.37.55') # Invalid database type GeoIP Country Edition, expected GeoIP Region Edition, Rev 1
# puts g.region_by_name('www.baidu.com') # Invalid database type GeoIP Country Edition, expected GeoIP Region Edition, Rev 1
# g.database_info() # Misc database info
# g.update_database(your_key_here[,debug]) # Updates your database
Reference:
1. http://www.maxmind.com/download/geoip/api/ruby/INSTALL
2. http://rubyforge.org/scm/?group_id=947
3. http://www.maxmind.com/app/ruby
4. http://www.howtoforge.com/mod-geoip-apache2-debian-etch
5. http://www.maxmind.com/app/mod_geoip
在php中如果从一个form提交一个数组给php页面的时候,一般在form中就将对应的变量写为: name="arr[]", 这样就可以在接收页面直接用php取到$arr = $_POST["arr"];取到这个数组,如果用get方法传送的query String是这样子的话: ?arr=1&arr=2&arr=3 时, php则在用$_GET["arr"]获得arr时则会只得到最后赋值的3,这是php处理query String的方法。
对于SERVER一端还是会正常收到这个请求的query String: ?arr=1&arr=2&arr=3,仍可以用server端的脚本语言重新对参数进行分析,也可以用javascript在client端分析query String。
javascript compress query string:
发表者 俞 伟军 位置在: 3/15/2008 07:05:00 PM 0 评论
标签: JavaScript , jQuery , Parameters , PHP , Query , Resig , String
copy axis webapp to tomcat webapp and visit:
http://localhost:8080/axis/happyaxis.jsp
Axis Happiness Page
Examining webapp configuration
.....
Found JAXP implementation ( javax.xml.parsers.SAXParserFactory ) at an unknown location
Error: could not find class javax.activation.DataHandler from file activation.jar
Axis will not work.
See http://java.sun.com/products/javabeans/glasgow/jaf.html
solution: put activation.jar and mailapi.jar under the common\lib of the Tomcat. Other locations do not work.
By the way, Axis optional component XML security jar xmlsec.jar should put under the same place, tomcat/common/lib, if axis has not found it.
$> mkdir Tomcat
$> cd Tomcat
$> cp /System/Library/StartupItems/Apache/Apache ./Tomcat
$> cp /System/Library/StartupItems/Apache/StartupParameters.plist .
$> vi StartupParameters.plist
Warning: SoapClient::SoapClient() [function.SoapClient-SoapClient]: I/O warning : failed to load external entity "http://localhost:9090/test?wsdl" in test.php on line 13
google了一下,是因为PHP的openssl模块没有打开。
修改php.ini文件,去掉extension=php_openssl.dll前面的注释。
将PHP安装目录下的libeay32.dll 拷贝一份到system32目录下,重启Apache即可。
如果不行可以把ssleay32.dll也拷过去重启。
完成后可以在phpinfo()中看到类似消息如下:
openssl
OpenSSL support enabled
OpenSSL Version OpenSSL 0.9.8e 23 Feb 2007
若想对标准输入、输出、错误输出等进行重定向(redirect)时,可以使用IO#reopen:
STDOUT.reopen("/tmp/foo", "a+")
不建议使用: $stdout = File.open("/tmp/foo", "a+"), 这还有个输出缓存的过程,需要用IO#sync(IO#fsync)或者是IO#flush才会将输入写入log中。
Reference:
http://www.ruby-lang.org.cn/forums/archiver/tid-39.html
# Object mixes in the Kernel module, making the built-in kernel functions globally accessible. The instance methods of Object are defined by the Kernel module.
p Kernel.instance_methods(false).length # 42 # Object instance methods
p Kernel.methods(false).length # 65 # Kernel module methods
p Module.instance_methods(false).length # 34 # Module instance methods, Kernel module is instance of Module class.
p Kernel.methods.length # 134
kernel_instance_methods = Kernel.instance_methods(false)
kernel_module_methods = Kernel.methods(false)
module_instance_methods = Module.instance_methods(false)
kernel_methods = [] # 134
Kernel Module include module methods(such as puts/p/gsub...) and module instance methods(such as __id__/__send__/id/send/object_id...), Object class has not defined instance methods, its instance methods are mixed in from Kernel module.
Kernel.methods include three group methods: object instance methods and Kernel module methods and instance methods of class Module.
class A
def self.method1
self.name
end
end
p A.method1
# A
p A.methods(false)
# ["method1"]
发表者 俞 伟军 位置在: 3/11/2008 11:37:00 AM 0 评论
标签: instance_methods , Kernel , Methods , Object , Relationship
line-height只对内联元素有效,对于块元素设置其实是作用在其内部的内联元素上。
水平七属性中margin-left、margin-right、width的值可以设置为auto,其他四个属性不能设置为auto。
水平七属性相加的值总是等于其父元素的width值。
margin的值可以取负值,padding和width不能取负值。
一行中,不同内联元素的内联框位置并不一定相同,根据line-hight、font-size计算,并受vertical-align影响。以下公式在vertical-align基于baseline的计算方法:
内联框的上边框位置:font-size - (font-size - line-height) / 2
内联框的下边框位置:font-size + (font-size - line-height) / 2
行间距等于该行中所有内联元素的内联框(inline-box)的最高位置减最低位置。
发表者 俞 伟军 位置在: 3/05/2008 04:37:00 PM 0 评论
标签: auto , CSS , inline-box , Margin
发表者 俞 伟军 位置在: 3/04/2008 11:54:00 AM 0 评论
标签: Bug , getElementById , id , IE , JavaScript , name
当将margin应用于内联元素时,margin的上下边距将不会影响到行高[产生的margin是存在的,不过因其是透明的故不能看得到],左右边距则会影响内联元素的左右间距。如果将一个将粗的border应用于内联元素上时,行高也不会发生变化,border将会覆盖其他元素的显示。
能够改变全文本的行间距的CSS属性只有:
1、line-height
2、font-size
3、vertical-align
发表者 俞 伟军 位置在: 3/03/2008 10:07:00 PM 0 评论
标签: CSS , font-size , HTML , line-height , Margin , vertical-align
1、当float的元素的margin为负值时,其周边元素内容可能会覆盖到float元素上面。当float元素宽度大于容器宽度并margin为负值时,会使得float元素在容器二边都超出。
2、position: absolute的元素的一系列上级元素如果具有position:absolute/relative/fixed属性时,会根据其上级元素进行绝对定位。如果其上级元素没有position属性,则根据整个html文档定位。