<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Xydw Dot Com &#187; Codes &amp; Scripts</title>
	<atom:link href="http://www.xydw.com/category/codes/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xydw.com</link>
	<description>php cms, php program,php studio</description>
	<lastBuildDate>Wed, 14 Dec 2011 13:46:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>从官方在Win上安装PHP 5.3+和APACHE2.2X测试环境</title>
		<link>http://www.xydw.com/codes/201112/%e4%bb%8e%e5%ae%98%e6%96%b9%e5%9c%a8win%e4%b8%8a%e5%ae%89%e8%a3%85php-5-3%e5%92%8capache2-2x%e6%b5%8b%e8%af%95%e7%8e%af%e5%a2%83/</link>
		<comments>http://www.xydw.com/codes/201112/%e4%bb%8e%e5%ae%98%e6%96%b9%e5%9c%a8win%e4%b8%8a%e5%ae%89%e8%a3%85php-5-3%e5%92%8capache2-2x%e6%b5%8b%e8%af%95%e7%8e%af%e5%a2%83/#comments</comments>
		<pubDate>Wed, 14 Dec 2011 13:46:20 +0000</pubDate>
		<dc:creator>luckymouse</dc:creator>
				<category><![CDATA[Codes & Scripts]]></category>

		<guid isPermaLink="false">http://www.xydw.com/?p=129</guid>
		<description><![CDATA[虽然网上有很多一键安装包，但是如同PHP官方警告的，从官方下载单独安装包才是最好的选择。 安装Apache： http://httpd.apache.org/download.cgi 选择最新的安装包： Win32 Binary including OpenSSL 0.9.8r (MSI Installer): httpd-2.2.21-win32-x86-openssl-0.9.8r.msi 下载好后，直接打开就可以安装了。选择Custom，可以自由配置路径和模块。 提示：使用迅雷等工具下载，安装前一定要关闭掉迅雷，否则会因为80端口被占用而导致Apache启动失败！ 安装PHP： http://windows.php.net/download/ 除了Windows Nt，一定要记得选择线程安全的安装包： Installer VC9 x86 Thread Safe (2011-Aug-23 12:01:10) PHP 5.3 (5.3.8) 下载完成后打开即可安装，按照安装提示操作即可。 提示：可能出现以下错误： there is a problem with this Windows Installer package.A script required for this install to complete could not be run.Contact support personnel or package vendor [...]]]></description>
			<content:encoded><![CDATA[<p>虽然网上有很多一键安装包，但是如同PHP官方警告的，从官方下载单独安装包才是最好的选择。</p>
<p>安装Apache：</p>
<p>http://httpd.apache.org/download.cgi</p>
<p>选择最新的安装包：</p>
<p>Win32 Binary including OpenSSL 0.9.8r (MSI Installer): <a href="http://mirror.bjtu.edu.cn/apache//httpd/binaries/win32/httpd-2.2.21-win32-x86-openssl-0.9.8r.msi">httpd-2.2.21-win32-x86-openssl-0.9.8r.msi</a></p>
<p>下载好后，直接打开就可以安装了。选择Custom，可以自由配置路径和模块。</p>
<p><span style="color: #ff0000;">提示：使用迅雷等工具下载，安装前一定要关闭掉迅雷，否则会因为80端口被占用而导致Apache启动失败！</span></p>
<p>安装PHP：</p>
<p>http://windows.php.net/download/</p>
<p>除了Windows Nt，一定要记得选择线程安全的安装包：</p>
<p><a href="http://windows.php.net/downloads/releases/php-5.3.8-Win32-VC9-x86.msi">Installer</a> VC9 x86 Thread Safe (2011-Aug-23 12:01:10) PHP 5.3 (5.3.8)</p>
<p>下载完成后打开即可安装，按照安装提示操作即可。</p>
<p>提示：可能出现以下错误：</p>
<blockquote><p>there is a problem with this Windows Installer package.A script required for this install to complete could not be run.Contact support personnel or package vendor</p></blockquote>
<p>CMD里运行： regsvr32 scrrun.dll</p>
<p>再重新安装。</p>
<p>此处省略很多字……</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xydw.com/codes/201112/%e4%bb%8e%e5%ae%98%e6%96%b9%e5%9c%a8win%e4%b8%8a%e5%ae%89%e8%a3%85php-5-3%e5%92%8capache2-2x%e6%b5%8b%e8%af%95%e7%8e%af%e5%a2%83/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[php]vsprintf VS preg_replace</title>
		<link>http://www.xydw.com/codes/200905/vsprintf-vs-preg_replace/</link>
		<comments>http://www.xydw.com/codes/200905/vsprintf-vs-preg_replace/#comments</comments>
		<pubDate>Tue, 26 May 2009 00:53:03 +0000</pubDate>
		<dc:creator>luckymouse</dc:creator>
				<category><![CDATA[Codes & Scripts]]></category>

		<guid isPermaLink="false">http://www.xydw.com/?p=114</guid>
		<description><![CDATA[I want to formart a simple string in PHP. There are two ways to do this. One is vsprintf and another preg_replace. But who is faster?  I have tested both of them. I find that vsprintf run more faster while can parse string in many formart.  So why not use vsprintf to replcae preg_replace if [...]]]></description>
			<content:encoded><![CDATA[<p>I want to formart a simple string in PHP. There are two ways to do this. One is vsprintf and another preg_replace. But who is faster?  I have tested both of them. I find that vsprintf run more faster while can parse string in many formart.  So why not use vsprintf to replcae preg_replace if it is possible?</p>
<blockquote><p>&lt;?php<br />
//test start<br />
$start_time = microtime();</p>
<p>$f = &#8216;who is faster? Name: %1$s, Id: %2$s, Year: %3$s, Home: %4$s&#8217;;<br />
$arg = array(&#8216;Lucky Mouse&#8217;, &#8217;000000001(Xydw.com)&#8217;, &#8217;20090526&#8242;, &#8216;China On Earth 地球 &#8211; 中国&#8217;);</p>
<p>//preg_replace append 0 first<br />
array_unshift($arg, &#8216;null&#8217;);</p>
<p>for($i = 0; $i &lt; 1000; $i ++) {<br />
$a[] = preg_replace(&#8220;/%([0-9]+)\\\$s/e&#8221;, &#8216;$arg[$1]&#8216;, $f);<br />
//$a[] = vsprintf($f, $arg);<br />
}<br />
echo $a[0].&#8217;&lt;br /&gt;&#8217;;</p>
<p>//end test<br />
$end_time =  explode(&#8221; &#8220;, microtime());<br />
$end_time = $end_time[0] + $end_time[1];<br />
$start_time = explode(&#8221; &#8220;, $start_time);<br />
$start_time = $start_time[0] + $start_time[1];<br />
echo number_format($end_time &#8211; $start_time, 5);<br />
?&gt;</p></blockquote>
<p>vsprintf  finish in about : 0.01 s</p>
<p>preg_repace finish in about: 0.08s</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xydw.com/codes/200905/vsprintf-vs-preg_replace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>an idea to fix innerHTML to table in IE (firefox)</title>
		<link>http://www.xydw.com/codes/200905/an-idea-to-fix-innerhtml-to-table-in-ie-firefox/</link>
		<comments>http://www.xydw.com/codes/200905/an-idea-to-fix-innerhtml-to-table-in-ie-firefox/#comments</comments>
		<pubDate>Sat, 09 May 2009 01:40:04 +0000</pubDate>
		<dc:creator>luckymouse</dc:creator>
				<category><![CDATA[Codes & Scripts]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[innerHTML]]></category>
		<category><![CDATA[table]]></category>

		<guid isPermaLink="false">http://www.xydw.com/?p=105</guid>
		<description><![CDATA[I like to use innerHTML . It is fast and easy to use. But there are some problems under different browsers, such as innerHTML can&#8217;t use to insert to table elements under IE. I have search on google with this issue. There are no good idea to fix innerHTML to table. Someone use Jquery append [...]]]></description>
			<content:encoded><![CDATA[<p>I like to use innerHTML . It is fast and easy to use. But there are some problems under different browsers, such as innerHTML can&#8217;t use to insert to table elements under IE.</p>
<p>I have search on google with this issue. There are no good idea to fix innerHTML to table. Someone use Jquery append to instead. I prefer to use myself script for it is more light weight and fit for me. There are some other ideas beside use libs as Jquery. Someone use &#8220;&lt;div&gt;&#8221; tags between &#8220;&lt;td&gt;&#8221;, then innerHTML to &#8220;&lt;div&gt;&#8221;. This is useful, but can&#8217;t effect on table.  Also we can use InsertRows functions while this is not I prefer. Then how to use innerHTML to table or table elements perfectly ?</p>
<p>Finally, I have an good idea to fix this issue in IE and also tested under firefox. <strong>My idea is to replace whole table</strong>. Table elements are <strong>readonly</strong> under IE. So why we avoid table when use innerHTML ?</p>
<p>Example:</p>
<blockquote><p>&lt;div id=&#8221;mytable&#8221;&gt;<br />
&lt;table&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;domain&lt;/td&gt;<br />
&lt;td&gt;pr&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;xydw.com&lt;/td&gt;<br />
&lt;td&gt;5&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;/table&gt;<br />
&lt;/div&gt;</p></blockquote>
<blockquote><p>We would insert a row at bottom.</p>
<p>&lt;script type=&#8221;text/javascript&#8221;&gt;<br />
//get table div<br />
<strong> var table = document.getElementById(&#8216;mytable&#8217;);</strong></p>
<p>//store old table data, replace tbody, tbody will auto add under IE<br />
<strong> var old_data = table.innerHTML.replace(/&lt;\/*tbody&gt;/i, &#8221;);</strong></p>
<p>//the data we want to add<br />
<strong> var add_data = &#8216;&lt;tr&gt;&lt;td&gt;lovecms.com&lt;/td&gt;&lt;td&gt;4&lt;/td&gt;&lt;/tr&gt;&#8217;;</strong></p>
<p>//new data, find the tag we want to insert<br />
//we insert into end of the table, so find table<br />
//you can insert to anywhere, just find the tag<br />
<strong> var new_data = old_data.replace(/&lt;\/table&gt;/i, add_data + &#8216;&lt;/table&gt;&#8217;);</strong></p>
<p>//use my favourite innerHTML here<br />
//both IE and firefox is OK!<br />
<strong> table.innerHTML = new_data;</strong><br />
&lt;/script&gt;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.xydw.com/codes/200905/an-idea-to-fix-innerhtml-to-table-in-ie-firefox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP 正则匹配 特殊元字符</title>
		<link>http://www.xydw.com/codes/200804/php-%e6%ad%a3%e5%88%99%e5%8c%b9%e9%85%8d-%e7%89%b9%e6%ae%8a%e5%85%83%e5%ad%97%e7%ac%a6/</link>
		<comments>http://www.xydw.com/codes/200804/php-%e6%ad%a3%e5%88%99%e5%8c%b9%e9%85%8d-%e7%89%b9%e6%ae%8a%e5%85%83%e5%ad%97%e7%ac%a6/#comments</comments>
		<pubDate>Tue, 22 Apr 2008 08:44:05 +0000</pubDate>
		<dc:creator>luckymouse</dc:creator>
				<category><![CDATA[Codes & Scripts]]></category>

		<guid isPermaLink="false">http://www.xydw.com/?p=22</guid>
		<description><![CDATA[字符 描述 \ 将下一个字符标记为一个特殊字符、或一个原义字符、或一个后向引用、或一个八进制转义符。例如，'n' 匹配字符 "n"。'\n' 匹配一个换行符。序列 '\' 匹配 "" 而 "\(" 则匹配 "("。 ^ 匹配输入字符串的开始位置。如果设置了 RegExp 对象的 Multiline 属性，^ 也匹配 '\n' 或 '\r' 之后的位置。 $ 匹配输入字符串的结束位置。如果设置了RegExp 对象的 Multiline 属性，$ 也匹配 '\n' 或 '\r' 之前的位置。 * 匹配前面的子表达式零次或多次。例如，zo* 能匹配 "z" 以及 "zoo"。 * 等价于{0,}。 + 匹配前面的子表达式一次或多次。例如，'zo+' 能匹配 "zo" 以及 "zoo"，但不能匹配 "z"。+ 等价于 {1,}。 ? 匹配前面的子表达式零次或一次。例如，"do(es)?" 可以匹配 [...]]]></description>
			<content:encoded><![CDATA[<pre class="php"><strong>字符 描述 </strong>
<strong>\</strong>
将下一个字符标记为一个特殊字符、或一个原义字符、或一个后向引用、或一个八进制转义符。例如，'n' 匹配字符 "n"。'\n' 匹配一个换行符。序列 '\' 匹配 "" 而 "\(" 则匹配 "("。
<strong>^</strong>
匹配输入字符串的开始位置。如果设置了 RegExp 对象的 Multiline 属性，^ 也匹配 '\n' 或 '\r' 之后的位置。
<strong>$</strong>
匹配输入字符串的结束位置。如果设置了RegExp 对象的 Multiline 属性，$ 也匹配 '\n' 或 '\r' 之前的位置。
<strong>*</strong>
匹配前面的子表达式零次或多次。例如，zo* 能匹配 "z" 以及 "zoo"。 * 等价于{0,}。
+ 匹配前面的子表达式一次或多次。例如，'zo+' 能匹配 "zo" 以及 "zoo"，但不能匹配 "z"。+ 等价于 {1,}。
<strong>?</strong>
匹配前面的子表达式零次或一次。例如，"do(es)?" 可以匹配 "do" 或 "does" 中的"do" 。? 等价于 {0,1}。
<strong>{n}</strong>
n 是一个非负整数。匹配确定的 n 次。例如，'o{2}' 不能匹配 "Bob" 中的 'o'，但是能匹配 "food" 中的两个 o。
<strong>{n,}</strong>
n 是一个非负整数。至少匹配n 次。例如，'o{2,}' 不能匹配 "Bob" 中的 'o'，但能匹配 "foooood" 中的所有 o。'o{1,}' 等价于 'o+'。'o{0,}' 则等价于 'o*'。
<strong>{n,m}</strong>
m 和 n 均为非负整数，其中n &lt;= m。最少匹配 n 次且最多匹配 m 次。刘， "o{1,3}" 将匹配 "fooooood" 中的前三个 o。'o{0,1}' 等价于 'o?'。请注意在逗号和两个数之间不能有空格。
<strong>?</strong>
当该字符紧跟在任何一个其他限制符 (*, +, ?, {n}, {n,}, {n,m}) 后面时，匹配模式是非贪婪的。非贪婪模式尽可能少的匹配所搜索的字符串，而默认的贪婪模式则尽可能多的匹配所搜索的字符串。例如，对于字符串 "oooo"，'o+?' 将匹配单个 "o"，而 'o+' 将匹配所有 'o'。
<strong>. </strong>
匹配除 "\n" 之外的任何单个字符。要匹配包括 '\n' 在内的任何字符，请使用象 '[.\n]' 的模式。
<strong>(pattern)</strong>
匹配pattern 并获取这一匹配。所获取的匹配可以从产生的 Matches 集合得到，在VBScript 中使用 SubMatches 集合，在JScript 中则使用 {CONTENT}… 属性。要匹配圆括号字符，请使用 '\(' 或 '\)'。
<strong>(?:pattern)</strong>
匹配 pattern 但不获取匹配结果，也就是说这是一个非获取匹配，不进行存储供以后使用。这在使用 "或" 字符 (|) 来组合一个模式的各个部分是很有用。例如， 'industr(?:y|ies) 就是一个比 'industry|industries' 更简略的表达式。
<strong>(?=pattern)</strong>
正向预查，在任何匹配 pattern 的字符串开始处匹配查找字符串。这是一个非获取匹配，也就是说，该匹配不需要获取供以后使用。例如， 'Windows (?=95|98|NT|2000)' 能匹配 "Windows 2000" 中的 "Windows" ，但不能匹配 "Windows 3.1" 中的 "Windows"。预查不消耗字符，也就是说，在一个匹配发生后，在最后一次匹配之后立即开始下一次匹配的搜索，而不是从包含预查的字符之后开始。
<strong>(?!pattern)</strong>
负向预查，在任何不匹配Negative lookahead matches the search string at any point where a string not matching pattern 的字符串开始处匹配查找字符串。这是一个非获取匹配，也就是说，该匹配不需要获取供以后使用。例如'Windows (?!95|98|NT|2000)' 能匹配 "Windows 3.1" 中的 "Windows"，但不能匹配 "Windows 2000" 中的 "Windows"。预查不消耗字符，也就是说，在一个匹配发生后，在最后一次匹配之后立即开始下一次匹配的搜索，而不是从包含预查的字符之后开始
<strong>x|y </strong>
匹配 x 或 y。例如，'z|food' 能匹配 "z" 或 "food"。'(z|f)ood' 则匹配 "zood" 或 "food"。
<strong>[xyz]</strong>
字符集合。匹配所包含的任意一个字符。例如， '[abc]' 可以匹配 "plain" 中的 'a'。
<strong>[^xyz]</strong>
负值字符集合。匹配未包含的任意字符。例如， '[^abc]' 可以匹配 "plain" 中的'p'。
<strong>[a-z]</strong>
字符范围。匹配指定范围内的任意字符。例如，'[a-z]' 可以匹配 'a' 到 'z' 范围内的任意小写字母字符。
<strong>[^a-z]</strong>
负值字符范围。匹配任何不在指定范围内的任意字符。例如，'[^a-z]' 可以匹配任何不在 'a' 到 'z' 范围内的任意字符。
<strong>\b</strong>
匹配一个单词边界，也就是指单词和空格间的位置。例如， 'er\b' 可以匹配"never" 中的 'er'，但不能匹配 "verb" 中的 'er'。
<strong>\B</strong>
匹配非单词边界。'er\B' 能匹配 "verb" 中的 'er'，但不能匹配 "never" 中的 'er'。
<strong>\cx</strong>
匹配由x指明的控制字符。例如， \cM 匹配一个 Control-M 或回车符。 x 的值必须为 A-Z 或 a-z 之一。否则，将 c 视为一个原义的 'c' 字符。
<strong>\d</strong>
匹配一个数字字符。等价于 [0-9]。
<strong>\D</strong>
匹配一个非数字字符。等价于 [^0-9]。
<strong>\f</strong>
匹配一个换页符。等价于 \x0c 和 \cL。
<strong>\n</strong>
匹配一个换行符。等价于 \x0a 和 \cJ。
<strong>\r</strong>
匹配一个回车符。等价于 \x0d 和 \cM。
<strong>\s</strong>
匹配任何空白字符，包括空格、制表符、换页符等等。等价于 [ \f\n\r\t\v]。
<strong>\S</strong>
匹配任何非空白字符。等价于 [^ \f\n\r\t\v]。
<strong>\t</strong>
匹配一个制表符。等价于 \x09 和 \cI。
<strong>\v</strong>
匹配一个垂直制表符。等价于 \x0b 和 \cK。
<strong>\w</strong>
匹配包括下划线的任何单词字符。等价于'[A-Za-z0-9_]'。
<strong>\W</strong>
匹配任何非单词字符。等价于 '[^A-Za-z0-9_]'。
<strong>\xn</strong>
匹配 n，其中 n 为十六进制转义值。十六进制转义值必须为确定的两个数字长。例如， '\x41' 匹配 "A"。'\x041' 则等价于 '\x04' &amp; "1"。正则表达式中可以使用 ASCII 编码。.
<strong>\num</strong>
匹配 num，其中 num 是一个正整数。对所获取的匹配的引用。例如，'(.)' 匹配两个连续的相同字符。
<strong>\n</strong>
标识一个八进制转义值或一个后向引用。如果 \n 之前至少 n 个获取的子表达式，则 n 为后向引用。否则，如果 n 为八进制数字 (0-7)，则 n 为一个八进制转义值。
<strong>\nm</strong>
标识一个八进制转义值或一个后向引用。如果 \nm 之前至少有is preceded by at least nm 个获取得子表达式，则 nm 为后向引用。如果 \nm 之前至少有 n 个获取，则 n 为一个后跟文字 m 的后向引用。如果前面的条件都不满足，若  n 和 m 均为八进制数字 (0-7)，则 \nm 将匹配八进制转义值 nm。
<strong>\nml</strong>
如果 n 为八进制数字 (0-3)，且 m 和 l 均为八进制数字 (0-7)，则匹配八进制转义值 nml。
<strong>\un</strong>
匹配 n，其中 n 是一个用四个十六进制数字表示的 Unicode 字符。例如，\u00A9 匹配版权符号 (?)。</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.xydw.com/codes/200804/php-%e6%ad%a3%e5%88%99%e5%8c%b9%e9%85%8d-%e7%89%b9%e6%ae%8a%e5%85%83%e5%ad%97%e7%ac%a6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>tow php code cost double memory</title>
		<link>http://www.xydw.com/codes/200804/tow-php-code-cost-double-memory/</link>
		<comments>http://www.xydw.com/codes/200804/tow-php-code-cost-double-memory/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 01:37:11 +0000</pubDate>
		<dc:creator>luckymouse</dc:creator>
				<category><![CDATA[Codes & Scripts]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.xydw.com/?p=21</guid>
		<description><![CDATA[I got a error to use a 2M string in php code.But the php settings memory limit is 8M. Fatal error: Allowed memory size of **** bytes exhausted (tried to allocate *** bytes) Then I check the php code, I find there are some codes cost more memory. $tmp = &#8220;string&#8221;.$tmp.&#8221;string&#8221;; I change those codes [...]]]></description>
			<content:encoded><![CDATA[<p>I got a error to use a 2M string in php code.But the php settings memory limit is 8M.</p>
<p>Fatal <strong>error</strong>: Allowed <strong>memory</strong> size of **** bytes exhausted (tried to allocate *** bytes)</p>
<p>Then I check the php code, I find there are some codes cost more memory.</p>
<p>$tmp = &#8220;string&#8221;.$tmp.&#8221;string&#8221;;</p>
<p>I change those codes to:</p>
<p>$tmp = &#8220;string&#8221;.$tmp;</p>
<p>$tmp .= &#8220;string&#8221;;</p>
<p>It works!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xydw.com/codes/200804/tow-php-code-cost-double-memory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP function to get google PR</title>
		<link>http://www.xydw.com/codes/200804/php-function-to-get-google-pr/</link>
		<comments>http://www.xydw.com/codes/200804/php-function-to-get-google-pr/#comments</comments>
		<pubDate>Mon, 07 Apr 2008 07:32:52 +0000</pubDate>
		<dc:creator>luckymouse</dc:creator>
				<category><![CDATA[Codes & Scripts]]></category>

		<guid isPermaLink="false">http://www.xydw.com/?p=20</guid>
		<description><![CDATA[&#60;?php // 3/20/2008 - Updated by Roger Collins (http://www.rogercollins.com/) // to remove graphing step //PageRank Lookup v1.1 by HM2K (update: 31/01/07) //based on an alogoritham found here: http://pagerank.gamesaga.net/ //settings &#8211; host and user agent $googlehost=&#8216;toolbarqueries.google.com&#8217;; $googleua=&#8216;Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5&#8242;; echo getpr(&#8220;http://www.xydw.com&#8221;); //convert a string to a 32-bit integer function [...]]]></description>
			<content:encoded><![CDATA[<p><code><span style="color: #000000;"><span style="color: #0000bb;">&lt;?php</p>
<p></span><span style="color: #ff8000;">// 3/20/2008 - Updated by Roger Collins (http://www.rogercollins.com/)</p>
<p>// to remove graphing step</span></span></code></p>
<p>//PageRank Lookup v1.1 by HM2K (update: 31/01/07)</p>
<p>//based on an alogoritham found here: http://pagerank.gamesaga.net/</p>
<p>//settings &#8211; host and user agent</p>
<p><span style="color: #0000bb;">$googlehost</span><span style="color: #007700;">=</span><span style="color: #dd0000;">&#8216;toolbarqueries.google.com&#8217;</span><span style="color: #007700;">;</p>
<p></span><span style="color: #0000bb;">$googleua</span><span style="color: #007700;">=</span><span style="color: #dd0000;">&#8216;Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5&#8242;</span><span style="color: #007700;">;</span></p>
<p>echo getpr(&#8220;http://www.xydw.com&#8221;);</p>
<p><span style="color: #ff8000;">//convert a string to a 32-bit integer</p>
<p></span><span style="color: #007700;">function </span><span style="color: #0000bb;">StrToNum</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$Str</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$Check</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$Magic</span><span style="color: #007700;">) {</p>
<p></span><span style="color: #0000bb;">$Int32Unit </span><span style="color: #007700;">= </span><span style="color: #0000bb;">4294967296</span><span style="color: #007700;">; </span><span style="color: #ff8000;">// 2^32</span></p>
<p><span style="color: #0000bb;">$length </span><span style="color: #007700;">= </span><span style="color: #0000bb;">strlen</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$Str</span><span style="color: #007700;">);</p>
<p>for (</span><span style="color: #0000bb;">$i </span><span style="color: #007700;">= </span><span style="color: #0000bb;">0</span><span style="color: #007700;">; </span><span style="color: #0000bb;">$i </span><span style="color: #007700;">&lt; </span><span style="color: #0000bb;">$length</span><span style="color: #007700;">; </span><span style="color: #0000bb;">$i</span><span style="color: #007700;">++) {</p>
<p></span><span style="color: #0000bb;">$Check </span><span style="color: #007700;">*= </span><span style="color: #0000bb;">$Magic</span><span style="color: #007700;">;</p>
<p></span><span style="color: #ff8000;">//If the float is beyond the boundaries of integer (usually +/- 2.15e+9 = 2^31),</p>
<p>//  the result of converting to integer is undefined</p>
<p>//  refer to http://www.php.net/manual/en/language.types.integer.php</p>
<p></span><span style="color: #007700;">if (</span><span style="color: #0000bb;">$Check </span><span style="color: #007700;">&gt;= </span><span style="color: #0000bb;">$Int32Unit</span><span style="color: #007700;">) {</p>
<p></span><span style="color: #0000bb;">$Check </span><span style="color: #007700;">= (</span><span style="color: #0000bb;">$Check </span><span style="color: #007700;">- </span><span style="color: #0000bb;">$Int32Unit </span><span style="color: #007700;">* (int) (</span><span style="color: #0000bb;">$Check </span><span style="color: #007700;">/ </span><span style="color: #0000bb;">$Int32Unit</span><span style="color: #007700;">));</p>
<p></span><span style="color: #ff8000;">//if the check less than -2^31</p>
<p></span><span style="color: #0000bb;">$Check </span><span style="color: #007700;">= (</span><span style="color: #0000bb;">$Check </span><span style="color: #007700;">&lt; -</span><span style="color: #0000bb;">2147483648</span><span style="color: #007700;">) ? (</span><span style="color: #0000bb;">$Check </span><span style="color: #007700;">+ </span><span style="color: #0000bb;">$Int32Unit</span><span style="color: #007700;">) : </span><span style="color: #0000bb;">$Check</span><span style="color: #007700;">;</p>
<p>}</p>
<p></span><span style="color: #0000bb;">$Check </span><span style="color: #007700;">+= </span><span style="color: #0000bb;">ord</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$Str</span><span style="color: #007700;">{</span><span style="color: #0000bb;">$i</span><span style="color: #007700;">});</p>
<p>}</p>
<p>return </span><span style="color: #0000bb;">$Check</span><span style="color: #007700;">;</p>
<p>}</span></p>
<p><span style="color: #ff8000;">//genearate a hash for a url</p>
<p></span><span style="color: #007700;">function </span><span style="color: #0000bb;">HashURL</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$String</span><span style="color: #007700;">) {</p>
<p></span><span style="color: #0000bb;">$Check1 </span><span style="color: #007700;">= </span><span style="color: #0000bb;">StrToNum</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$String</span><span style="color: #007700;">, </span><span style="color: #0000bb;">0&#215;1505</span><span style="color: #007700;">, </span><span style="color: #0000bb;">0&#215;21</span><span style="color: #007700;">);</p>
<p></span><span style="color: #0000bb;">$Check2 </span><span style="color: #007700;">= </span><span style="color: #0000bb;">StrToNum</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$String</span><span style="color: #007700;">, </span><span style="color: #0000bb;">0</span><span style="color: #007700;">, </span><span style="color: #0000bb;">0x1003F</span><span style="color: #007700;">);</span></p>
<p><span style="color: #0000bb;">$Check1 </span><span style="color: #007700;">&gt;&gt;= </span><span style="color: #0000bb;">2</span><span style="color: #007700;">;</p>
<p></span><span style="color: #0000bb;">$Check1 </span><span style="color: #007700;">= ((</span><span style="color: #0000bb;">$Check1 </span><span style="color: #007700;">&gt;&gt; </span><span style="color: #0000bb;">4</span><span style="color: #007700;">) &amp; </span><span style="color: #0000bb;">0x3FFFFC0 </span><span style="color: #007700;">) | (</span><span style="color: #0000bb;">$Check1 </span><span style="color: #007700;">&amp; </span><span style="color: #0000bb;">0x3F</span><span style="color: #007700;">);</p>
<p></span><span style="color: #0000bb;">$Check1 </span><span style="color: #007700;">= ((</span><span style="color: #0000bb;">$Check1 </span><span style="color: #007700;">&gt;&gt; </span><span style="color: #0000bb;">4</span><span style="color: #007700;">) &amp; </span><span style="color: #0000bb;">0x3FFC00 </span><span style="color: #007700;">) | (</span><span style="color: #0000bb;">$Check1 </span><span style="color: #007700;">&amp; </span><span style="color: #0000bb;">0x3FF</span><span style="color: #007700;">);</p>
<p></span><span style="color: #0000bb;">$Check1 </span><span style="color: #007700;">= ((</span><span style="color: #0000bb;">$Check1 </span><span style="color: #007700;">&gt;&gt; </span><span style="color: #0000bb;">4</span><span style="color: #007700;">) &amp; </span><span style="color: #0000bb;">0x3C000 </span><span style="color: #007700;">) | (</span><span style="color: #0000bb;">$Check1 </span><span style="color: #007700;">&amp; </span><span style="color: #0000bb;">0x3FFF</span><span style="color: #007700;">);</span></p>
<p><span style="color: #0000bb;">$T1 </span><span style="color: #007700;">= ((((</span><span style="color: #0000bb;">$Check1 </span><span style="color: #007700;">&amp; </span><span style="color: #0000bb;">0x3C0</span><span style="color: #007700;">) &lt;&lt; </span><span style="color: #0000bb;">4</span><span style="color: #007700;">) | (</span><span style="color: #0000bb;">$Check1 </span><span style="color: #007700;">&amp; </span><span style="color: #0000bb;">0x3C</span><span style="color: #007700;">)) &lt;&lt;</span><span style="color: #0000bb;">2 </span><span style="color: #007700;">) | (</span><span style="color: #0000bb;">$Check2 </span><span style="color: #007700;">&amp; </span><span style="color: #0000bb;">0xF0F </span><span style="color: #007700;">);</p>
<p></span><span style="color: #0000bb;">$T2 </span><span style="color: #007700;">= ((((</span><span style="color: #0000bb;">$Check1 </span><span style="color: #007700;">&amp; </span><span style="color: #0000bb;">0xFFFFC000</span><span style="color: #007700;">) &lt;&lt; </span><span style="color: #0000bb;">4</span><span style="color: #007700;">) | (</span><span style="color: #0000bb;">$Check1 </span><span style="color: #007700;">&amp; </span><span style="color: #0000bb;">0x3C00</span><span style="color: #007700;">)) &lt;&lt; </span><span style="color: #0000bb;">0xA</span><span style="color: #007700;">) | (</span><span style="color: #0000bb;">$Check2 </span><span style="color: #007700;">&amp; </span><span style="color: #0000bb;">0xF0F0000 </span><span style="color: #007700;">);</span></p>
<p>return (<span style="color: #0000bb;">$T1 </span><span style="color: #007700;">| </span><span style="color: #0000bb;">$T2</span><span style="color: #007700;">);</p>
<p>}</span></p>
<p><span style="color: #ff8000;">//genearate a checksum for the hash string</p>
<p></span><span style="color: #007700;">function </span><span style="color: #0000bb;">CheckHash</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$Hashnum</span><span style="color: #007700;">) {</p>
<p></span><span style="color: #0000bb;">$CheckByte </span><span style="color: #007700;">= </span><span style="color: #0000bb;">0</span><span style="color: #007700;">;</p>
<p></span><span style="color: #0000bb;">$Flag </span><span style="color: #007700;">= </span><span style="color: #0000bb;">0</span><span style="color: #007700;">;</span></p>
<p><span style="color: #0000bb;">$HashStr </span><span style="color: #007700;">= </span><span style="color: #0000bb;">sprintf</span><span style="color: #007700;">(</span><span style="color: #dd0000;">&#8216;%u&#8217;</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$Hashnum</span><span style="color: #007700;">) ;</p>
<p></span><span style="color: #0000bb;">$length </span><span style="color: #007700;">= </span><span style="color: #0000bb;">strlen</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$HashStr</span><span style="color: #007700;">);</span></p>
<p>for (<span style="color: #0000bb;">$i </span><span style="color: #007700;">= </span><span style="color: #0000bb;">$length </span><span style="color: #007700;">- </span><span style="color: #0000bb;">1</span><span style="color: #007700;">; </span><span style="color: #0000bb;">$i </span><span style="color: #007700;">&gt;= </span><span style="color: #0000bb;">0</span><span style="color: #007700;">; </span><span style="color: #0000bb;">$i </span><span style="color: #007700;">&#8211;) {</p>
<p></span><span style="color: #0000bb;">$Re </span><span style="color: #007700;">= </span><span style="color: #0000bb;">$HashStr</span><span style="color: #007700;">{</span><span style="color: #0000bb;">$i</span><span style="color: #007700;">};</p>
<p>if (</span><span style="color: #0000bb;">1 </span><span style="color: #007700;">=== (</span><span style="color: #0000bb;">$Flag </span><span style="color: #007700;">% </span><span style="color: #0000bb;">2</span><span style="color: #007700;">)) {</p>
<p></span><span style="color: #0000bb;">$Re </span><span style="color: #007700;">+= </span><span style="color: #0000bb;">$Re</span><span style="color: #007700;">;</p>
<p></span><span style="color: #0000bb;">$Re </span><span style="color: #007700;">= (int)(</span><span style="color: #0000bb;">$Re </span><span style="color: #007700;">/ </span><span style="color: #0000bb;">10</span><span style="color: #007700;">) + (</span><span style="color: #0000bb;">$Re </span><span style="color: #007700;">% </span><span style="color: #0000bb;">10</span><span style="color: #007700;">);</p>
<p>}</p>
<p></span><span style="color: #0000bb;">$CheckByte </span><span style="color: #007700;">+= </span><span style="color: #0000bb;">$Re</span><span style="color: #007700;">;</p>
<p></span><span style="color: #0000bb;">$Flag </span><span style="color: #007700;">++;</p>
<p>}</span></p>
<p><span style="color: #0000bb;">$CheckByte </span><span style="color: #007700;">%= </span><span style="color: #0000bb;">10</span><span style="color: #007700;">;</p>
<p>if (</span><span style="color: #0000bb;">0 </span><span style="color: #007700;">!== </span><span style="color: #0000bb;">$CheckByte</span><span style="color: #007700;">) {</p>
<p></span><span style="color: #0000bb;">$CheckByte </span><span style="color: #007700;">= </span><span style="color: #0000bb;">10 </span><span style="color: #007700;">- </span><span style="color: #0000bb;">$CheckByte</span><span style="color: #007700;">;</p>
<p>if (</span><span style="color: #0000bb;">1 </span><span style="color: #007700;">=== (</span><span style="color: #0000bb;">$Flag </span><span style="color: #007700;">% </span><span style="color: #0000bb;">2</span><span style="color: #007700;">) ) {</p>
<p>if (</span><span style="color: #0000bb;">1 </span><span style="color: #007700;">=== (</span><span style="color: #0000bb;">$CheckByte </span><span style="color: #007700;">% </span><span style="color: #0000bb;">2</span><span style="color: #007700;">)) {</p>
<p></span><span style="color: #0000bb;">$CheckByte </span><span style="color: #007700;">+= </span><span style="color: #0000bb;">9</span><span style="color: #007700;">;</p>
<p>}</p>
<p></span><span style="color: #0000bb;">$CheckByte </span><span style="color: #007700;">&gt;&gt;= </span><span style="color: #0000bb;">1</span><span style="color: #007700;">;</p>
<p>}</p>
<p>}</span></p>
<p>return <span style="color: #dd0000;">&#8217;7&#8242;</span><span style="color: #007700;">.</span><span style="color: #0000bb;">$CheckByte</span><span style="color: #007700;">.</span><span style="color: #0000bb;">$HashStr</span><span style="color: #007700;">;</p>
<p>}</span></p>
<p><span style="color: #ff8000;">//return the pagerank checksum hash</p>
<p></span><span style="color: #007700;">function </span><span style="color: #0000bb;">getch</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$url</span><span style="color: #007700;">) { return </span><span style="color: #0000bb;">CheckHash</span><span style="color: #007700;">(</span><span style="color: #0000bb;">HashURL</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$url</span><span style="color: #007700;">)); }</span></p>
<p><span style="color: #ff8000;">//return the pagerank figure</p>
<p></span><span style="color: #007700;">function </span><span style="color: #0000bb;">getpr</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$url</span><span style="color: #007700;">) {</p>
<p>global </span><span style="color: #0000bb;">$googlehost</span><span style="color: #007700;">,</span><span style="color: #0000bb;">$googleua</span><span style="color: #007700;">;</p>
<p></span><span style="color: #0000bb;">$pr </span><span style="color: #007700;">= </span><span style="color: #0000bb;">0</span><span style="color: #007700;">; </span><span style="color: #ff8000;">// default return</p>
<p></span><span style="color: #0000bb;">$ch </span><span style="color: #007700;">= </span><span style="color: #0000bb;">getch</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$url</span><span style="color: #007700;">);</p>
<p></span><span style="color: #0000bb;">$fp </span><span style="color: #007700;">= </span><span style="color: #0000bb;">fsockopen</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$googlehost</span><span style="color: #007700;">, </span><span style="color: #0000bb;">80</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$errno</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$errstr</span><span style="color: #007700;">, </span><span style="color: #0000bb;">30</span><span style="color: #007700;">);</p>
<p>if (</span><span style="color: #0000bb;">$fp</span><span style="color: #007700;">) {</p>
<p></span><span style="color: #0000bb;">$out </span><span style="color: #007700;">= </span><span style="color: #dd0000;">&#8220;GET /search?client=navclient-auto&amp;ch=$ch&amp;features=Rank&amp;q=info:$url HTTP/1.1\r\n&#8221;</span><span style="color: #007700;">;</p>
<p></span><span style="color: #ff8000;">//echo &#8220;&lt;pre&gt;$out&lt;/pre&gt;\n&#8221;; //debug only</p>
<p></span><span style="color: #0000bb;">$out </span><span style="color: #007700;">.= </span><span style="color: #dd0000;">&#8220;User-Agent: $googleua\r\n&#8221;</span><span style="color: #007700;">;</p>
<p></span><span style="color: #0000bb;">$out </span><span style="color: #007700;">.= </span><span style="color: #dd0000;">&#8220;Host: $googlehost\r\n&#8221;</span><span style="color: #007700;">;</p>
<p></span><span style="color: #0000bb;">$out </span><span style="color: #007700;">.= </span><span style="color: #dd0000;">&#8220;Connection: Close\r\n\r\n&#8221;</span><span style="color: #007700;">;</span></p>
<p><span style="color: #0000bb;">fwrite</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$fp</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$out</span><span style="color: #007700;">);</span></p>
<p><span style="color: #ff8000;">//$pagerank = substr(fgets($fp, 128), 4); //debug only</p>
<p>//echo $pagerank; //debug only</p>
<p></span><span style="color: #007700;">while (!</span><span style="color: #0000bb;">feof</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$fp</span><span style="color: #007700;">)) {</p>
<p></span><span style="color: #0000bb;">$data </span><span style="color: #007700;">= </span><span style="color: #0000bb;">fgets</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$fp</span><span style="color: #007700;">, </span><span style="color: #0000bb;">128</span><span style="color: #007700;">);</p>
<p></span><span style="color: #ff8000;">//echo $data;</p>
<p></span><span style="color: #0000bb;">$pos </span><span style="color: #007700;">= </span><span style="color: #0000bb;">strpos</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$data</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8220;Rank_&#8221;</span><span style="color: #007700;">);</p>
<p>if(</span><span style="color: #0000bb;">$pos </span><span style="color: #007700;">=== </span><span style="color: #0000bb;">false</span><span style="color: #007700;">){} else{</p>
<p></span><span style="color: #0000bb;">$pr</span><span style="color: #007700;">=</span><span style="color: #0000bb;">substr</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$data</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$pos </span><span style="color: #007700;">+ </span><span style="color: #0000bb;">9</span><span style="color: #007700;">);</p>
<p></span><span style="color: #0000bb;">$pr</span><span style="color: #007700;">=</span><span style="color: #0000bb;">trim</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$pr</span><span style="color: #007700;">);</p>
<p></span><span style="color: #0000bb;">$pr</span><span style="color: #007700;">=</span><span style="color: #0000bb;">str_replace</span><span style="color: #007700;">(</span><span style="color: #dd0000;">&#8220;\n&#8221;</span><span style="color: #007700;">,</span><span style="color: #dd0000;">&#8221;</span><span style="color: #007700;">,</span><span style="color: #0000bb;">$pr</span><span style="color: #007700;">);</p>
<p>return </span><span style="color: #0000bb;">$pr</span><span style="color: #007700;">;</p>
<p>}</p>
<p>}</p>
<p></span><span style="color: #ff8000;">//else { echo &#8220;$errstr ($errno)&lt;br /&gt;\n&#8221;; } //debug only</p>
<p></span><span style="color: #0000bb;">fclose</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$fp</span><span style="color: #007700;">);</p>
<p>}</p>
<p>return </span><span style="color: #0000bb;">$pr</span><span style="color: #007700;">;</p>
<p>}</span></p>
<p><span style="color: #0000bb;">?&gt;</p>
<p></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.xydw.com/codes/200804/php-function-to-get-google-pr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript scrollbar</title>
		<link>http://www.xydw.com/codes/200804/javascript-scrollbar/</link>
		<comments>http://www.xydw.com/codes/200804/javascript-scrollbar/#comments</comments>
		<pubDate>Tue, 01 Apr 2008 12:47:44 +0000</pubDate>
		<dc:creator>luckymouse</dc:creator>
				<category><![CDATA[Codes & Scripts]]></category>

		<guid isPermaLink="false">http://www.xydw.com/?p=13</guid>
		<description><![CDATA[http://www.n-son.com/scripts/jsScrolling/jsScrollbar.html it is a very good and useful scripts. Preparation Before initializing the scrollbar, you must create a jsScroller object. So if you haven&#8217;t, follow the previous tutorial and find out how! First thing is the HTML: &#60;div id="Scrollbar-Container"&#62; &#60;div class="Scrollbar-Up"&#62;&#60;/div&#62; &#60;div class="Scrollbar-Down"&#62;&#60;/div&#62; &#60;div class="Scrollbar-Track"&#62; &#60;div class="Scrollbar-Handle"&#62;&#60;/div&#62; &#60;/div&#62; &#60;/div&#62; Again, &#8220;Scrollbar-Container&#8221; can be change to [...]]]></description>
			<content:encoded><![CDATA[<div id="wrapper"><a href="http://www.n-son.com/scripts/jsScrolling/jsScrollbar.html" target="_blank">http://www.n-son.com/scripts/jsScrolling/jsScrollbar.html</a></div>
<div>it is a very good and useful scripts.</p>
<h2></h2>
<h2></h2>
<h2>Preparation</h2>
<p>Before initializing the scrollbar, you must create a jsScroller object. So if you haven&#8217;t, follow the previous tutorial and find out how!</p>
<p>First thing is the HTML:</p>
<pre>&lt;div id="Scrollbar-Container"&gt;
&lt;div class="Scrollbar-Up"&gt;&lt;/div&gt;
&lt;div class="Scrollbar-Down"&gt;&lt;/div&gt;
&lt;div class="Scrollbar-Track"&gt;
&lt;div class="Scrollbar-Handle"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</pre>
<p>Again, &#8220;Scrollbar-Container&#8221; can be change to anything you want, you just need to be able reference this element like with jsScroller. The other divs inside have to have those class names, however. The only ones required for  the scrollbar to work are the track and handle. The up and down buttons are not necessary. The up, down, and handle buttons can also be images if you desire.</p>
<p>As far as CSS goes, the only things you have to set are the height and  positioning for the track and handle. The track must be absolute or relative,  and the handle must be absolute.</p>
<h2>Constructor</h2>
<pre>new jsScrollbar(jsScroller, scrollbarContainer, auto, eventHandler);</pre>
<p><code>jsScroller</code> is an instance of jsScroller.js, <code>scrollbarContainer</code> is the element that contains all the components for the scrollbar, <code>auto</code> is a boolean value that when set to true makes the whole scrollbar disappear when the content doesn&#8217;t fill up the whole area and when set to false makes just the handle disappear, and <code>eventHandler</code> is a function that can change the look fo the scrollbar components when they are clicked on and such. This will be discussed a little later in the tutorial.</p>
<p>An example of implementation:</p>
<pre>//You have to have a jsScroller along with the jsScrollbar
var wrapper = document.getElementById("Scroller");
var barWrapper = document.getElementById("Scrollbar-Container");
var scroller = new jsScroller(wrapper, 400, 200);
var scrollbar = new jsScrollbar(scroller, barWrapper, true);</pre>
<h2>Methods</h2>
<p>This uses the same <code>.scrollTo</code>, <code>.scrollBy</code>, <code>.reset</code>, and <code>.swapContent</code> functions as jsScroller. They should be used in place of the jsScroller functions.</p>
<h2>The Event Handler</h2>
<p>The fourth parameter that you can pass to jsScrollbar is a reference to a function that can change the way the scrollbar looks when its clicked on and such. Two parameters are passed: the object that generated the action, and the type of action (mouseup, or mousedown). You could also add your own parameter for getting the event object if you so desire.</p>
<p>An example of an event handler:</p>
<pre>function scrollbarEvent (o, type) {
if (type == "mousedown") {
//if its the track, make its color #E3E3E3, otherwise make it #BBB
if (o.className == "Scrollbar-Track")  {
o.style.backgroundColor = "#E3E3E3";
} else {
o.style.backgroundColor = "#BBB";
}
} else {
//return the colors for when the mouse button is let off
if (o.className == "Scrollbar-Track") {
o.style.backgroundColor = "#EEE";
} else {
o.style.backgroundColor = "#CCC";
}
}
}</pre>
<p>To pass this to the constructor, just use the function name as a variable name. So in this case I would pass <code>scrollbarEvent</code> as my fourth argument.</p>
<h2>Examples</h2>
<p><a title="example 2" href="http://www.n-son.com/scripts/jsScrolling/example2.html">example2.html</a>, <a title="example 3" href="http://www.n-son.com/scripts/jsScrolling/example3.html">example3.html</a>, and <a title="example 4" href="http://www.n-son.com/scripts/jsScrolling/example4.html">example4.html</a></p>
<h2>Quirks</h2>
<p>Using <code>img</code> tags isn&#8217;t recommended for the scrollbar handle. Most browsers start their little dragging action, and don&#8217;t have a way to cancel it like IE does. I prefer to use divs with a background image.</p>
<p>Safari selects all the text when trying to drag the handle. I hope someone can enlighten me and tell me how to fix this!</p>
<p>Everythings peachy keen as far as I know!</p>
<h2>Useful Properties</h2>
<p>These are properties that you can access that may help you in making scripts:</p>
<p><code class="bold">.auto, .eventHandler</code></p>
<p>The arguments passed to the constructor. These can be changed at any point if you desire</p>
<p><code class="bold">._up, ._down, ._yTrack, ._yHandle</code></p>
<p>References to the components of the scrollbar.</p>
<p><code class="bold">._disabled</code></p>
<p>A boolean value that sets whether the scrollbar can be clicked on or not. This is automatically set by the script, but it can be changed at any point if you wish to disable the scrollbar.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.xydw.com/codes/200804/javascript-scrollbar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Modify wordpress themes special links</title>
		<link>http://www.xydw.com/codes/200803/modify-wordpress-themes-special-links/</link>
		<comments>http://www.xydw.com/codes/200803/modify-wordpress-themes-special-links/#comments</comments>
		<pubDate>Mon, 31 Mar 2008 15:32:06 +0000</pubDate>
		<dc:creator>luckymouse</dc:creator>
				<category><![CDATA[Codes & Scripts]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.xydw.com/?p=12</guid>
		<description><![CDATA[In some wordpress themes may be you would find some links can not be modified, even if you can not find where there are. How to modify them?Follow me&#8230; First you find the file which you think those links will be. Then try search by some tools such as Notes, ZDE. If you do not [...]]]></description>
			<content:encoded><![CDATA[<p>In some wordpress themes may be you would find  some links can not be modified, even if you can not find where there are.  How to modify them?Follow me&#8230;</p>
<p>First you find the file which you think those links will be.</p>
<p>Then try search by some tools such as Notes, ZDE.</p>
<p>If you do not get results, don&#8217;t close the file. Because the code may be just in the file.It is encoded.</p>
<p>Try to find decode functions as base64_decode or gzinflate.Run them, then you will find the links.</p>
<p>For exmaple:</p>
<blockquote><p>gzinflate(base64_decode(&#8216;rZGxboQwDIbn8hRWFuhykdqtzYXh5i5Hh24oQO5iKSSIhFLevgaa6oZKt3SIEjv+f3+WS5kJ8yxFOZgBal3kbzqq/PEVSik4fWSZmCy0VoVwZBZDZJR6EBalUGBGfTmyXdtYf0V38UU+hvBUT6PdXRhEjFansrVFtbgOWxU1RIMBAtJrCuiucK6qH9UNkVBNMyaXs1bWLlBhP1gNyQm9Y5LEgq+1MvErOkR6h7f1fa9dDPVd8HejwRJ3iJBEED0QEQw+UIDu7xFOqfq/ZzExDi+cz/N8+Fq6+UBY/Bd8zUCIU4eeyY81qLbg1mxDnIe6p7UXWyvaOJ/sdnX4uQ/xDQ==&#8217;));</p></blockquote>
<p>Run the code ablove, you will get the result:</p>
<blockquote><p>?&gt;<br />
&lt;h3&gt;&lt;?php _e(&#8216;Meta&#8217;); ?&gt;&lt;/h3&gt;</p>
<p>&lt;ul class=&#8221;list&#8221;&gt;</p>
<p>&lt;li&gt;&lt;a href=&#8221;&lt;?php bloginfo(&#8216;rss2_url&#8217;); ?&gt;&#8221; title=&#8221;&lt;?php _e(&#8216;Syndicate this site using RSS&#8217;); ?&gt;&#8221;&gt;&lt;?php _e(&#8216;&lt;abbr title=&#8221;Really Simple Syndication&#8221;&gt;RSS&lt;/abbr&gt;&#8217;); ?&gt;&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&#8221;&lt;?php bloginfo(&#8216;comments_rss2_url&#8217;); ?&gt;&#8221; title=&#8221;&lt;?php _e(&#8216;The latest comments to all posts in RSS&#8217;); ?&gt;&#8221;&gt;&lt;?php _e(&#8216;Comments &lt;abbr title=&#8221;Really Simple Syndication&#8221;&gt;RSS&lt;/abbr&gt;&#8217;); ?&gt;&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&#8221;http://www.xydw.com/&#8221; title=&#8221;xydw studio&#8221;&gt;Xydw Studio&lt;/a&gt;&lt;/li&gt;<br />
&lt;?php wp_meta(); ?&gt;</p>
<p>&lt;/ul&gt;</p>
<p>&lt;/div&gt;&lt;?php</p></blockquote>
<p>Replace the machine language to what you can understand.Then you can modify them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xydw.com/codes/200803/modify-wordpress-themes-special-links/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

