Share my knowledge, feel my life. Eric Shan' Blog myBloggie 2.1.6 © 2005   
Mar 2025 April 2025 May 2025
S M T W T F S
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30    
Categories
About[5]
Blackberry[1]
dotNet and C Charp[1]
IPhone[10]
Life[4]
Unix&Linux[19]
WEB programming[16]
Windows API[5]
Windows Mobile[1]
Windows Multimedia[4]
Recent
CentOS mount CDrom and USB
CentOS GHOST(幽灵)漏洞修复方法
centos 改变语言并立即生效
centos vpn 接通后无法连接internet
让vlc播放中文字幕不出乱码
centos 取消屏保
php中ob_flush和flush的用法
CentOS检查,添加,删除自启动服务
CentOS中开机自动启动某个服务
Top命令中的翻页
Archives
February 2010[4]
September 2009[1]
August 2009[1]
January 2009[7]
October 2008[10]
June 2008[2]
December 2007[14]
November 2007[5]
May 2007[9]
April 2007[3]
March 2007[10]
User List
Eric Shan[66]
Search
Syndication
19 Dec 2014   04:47:48 pm
php中ob_flush和flush的用法
[url]

http://www.60ke.cn/html/wlbc/phpbc/2014/1128/16536.html[/url]
Category : WEB programming | Posted By : Eric Shan | Comments[0] | Trackbacks [0]
24 Oct 2011   07:48:39 pm
Using SSH to cross Chinese internet Firewall- 用SSH翻墙
In recent technology, WEB hosting with SSH ftp upload function is quite normal and almost becomes a standard service, but do you know it can be used as a Socket proxy. This is useful when you need cross the firewall (in China we called it GFW). Below is a quick introduction on how to do it.

1. Find a host plan with SSH service provided, e.g. an affordable service like Joomjump (USD 9.99 per year, unlimited bandwidth), and write down the user name and password of the your service account, let's say 'myUserName' and 'myPassword'.

2. Download the proxy software Tunnelier.exe, and run it for installation. After that you can start to input your server IP address, your user ID and password, the port is normally 22 if your service vendor did not change it (see picture I). In the service tab, enable the socket proxy service like picture II. If you do not want to see Tunnelier open the ftp window, you can choose not to open ftp when start it (pic III).




3. In your IE or firefox, change the proxy settings, and make sure the port is what you have setup in Tunnelier.



Now enjoy your private proxy server now, and don't be suffered any more.

用SSH翻墙大致有三步。

1. 找一个可以提供SSH FTP服务的海外空间商,例如9.99刀一年不限流量的Joomjump ,记下购买后得到的服务器地址,用户名和密码。
2.下载 Tunnelier.exe,然后运行并安装,安装完成后设置几个东西,输入服务器地址,用户名,密码。在Service里设置激活sock/ proxy http forwarding, 如果你不想每次在打开Tunnelier时看到ftp,那就关掉它。
3.在IE里修改proxy参数,把其它都填空,唯独输入socket既可。
Category : WEB programming | Posted By : Eric Shan | Comments[0] | Trackbacks [0]
07 Feb 2010   01:11:46 am
超稳定的翻强工具Astrill, 及邀请码
输入下列邀请码.
ASTRILL-BETA-682705-MCYXX

到https://www.astrill.com/去注册新用户和下载软件.
Category : WEB programming | Posted By : Eric Shan | Comments[0] | Trackbacks [0]
01 Feb 2010   08:41:44 pm
翻墙利器-paperbus
Paperbus是个不错的proxy软件, 代价是经常看广告, 速度目前飞快, 不知将来用的人多了会不会还是这样.

他们的主页http://www.paperb.us.

发email 给ride@paperb.us 会自动把安装程序发给你.
Category : WEB programming | Posted By : Eric Shan | Comments[0] | Trackbacks [0]
18 Mar 2009   03:58:11 am
TNTSoft mobile software store
Visit http://store.tntsoft.com. It focus on Mobile phone software.
Category : WEB programming | Posted By : Eric Shan | Comments[0] | Trackbacks [0]
17 Mar 2009   05:19:13 am
Feedburner中文乱码 - Feedburner Chinese display problem
如果xml里用的是GB2312的话Feedburner可能会出乱码.解决的办法是把xml转成UTF-8.

There will be some problem display Chinese when the RSS have XML encode of GB2312, the solution is to convert the XML into UTF-8 encoding.

在php下GB2312转UTF-8有代码.

To convert from GB2312 to UTF-8

Code :
function gb2utf8($gbstr) {
global $CODETABLE;
if(trim($gbstr)=="") return $gbstr;
if(empty($CODETABLE)){
$filename = dirname(__FILE__)."/gb2312-utf8.table";
$fp = fopen($filename,"r");
while ($l = fgets($fp,15))
{ $CODETABLE[hexdec(substr($l, 0, 6))] = substr($l, 7, 6); }
fclose($fp);
}
$ret = "";
$utf8 = "";
while ($gbstr) {
if (ord(substr($gbstr, 0, 1)) > 0x80) {
$thisW = substr($gbstr, 0, 2);
$gbstr = substr($gbstr, 2, strlen($gbstr));
$utf8 = "";
@$utf8 = u2utf8(hexdec($CODETABLE[hexdec(bin2hex($thisW)) - 0x8080]));
if($utf8!=""){
for ($i = 0;$i < strlen($utf;$i += 3)
$ret .= chr(substr($utf8, $i, 3));
}
}
else
{
$ret .= substr($gbstr, 0, 1);
$gbstr = substr($gbstr, 1, strlen($gbstr));
}
}
return $ret;
}

function u2utf8($c)
{
for($i=0;$i<count($c);$i++)
$str="";
if ($c < 0x80) {
$str.=$c;
}
else if ($c < 0x800) {
$str.=(0xC0 | $c>>6);
$str.=(0x80 | $c & 0x3F);
}
else if ($c < 0x10000) {
$str.=(0xE0 | $c>>12);
$str.=(0x80 | $c>>6 & 0x3F);
$str.=(0x80 | $c & 0x3F);
}
else if ($c < 0x200000) {
$str.=(0xF0 | $c>>1;
$str.=(0x80 | $c>>12 & 0x3F);
$str.=(0x80 | $c>>6 & 0x3F);
$str.=(0x80 | $c & 0x3F);
}
return $str;
}
Category : WEB programming | Posted By : Eric Shan | Comments[0] | Trackbacks [0]
20 Jan 2009   07:30:01 am
Why use CDATA in XML
CDATA - (Unparsed) Character Data
The term CDATA is used about text data that should not be parsed by the XML parser.

Characters like “<" and "&" are illegal in XML elements.

"<" will generate an error because the parser interprets it as the start of a new element.

"&" will generate an error because the parser interprets it as the start of an character entity.

Some text, like JavaScript code, contains a lot of "<" or "&" characters. To avoid errors script code can be defined as CDATA.

Everything inside a CDATA section is ignored by the parser.

A CDATA section starts with "<![CDATA[" and ends with "]]>“:

Code :
<script>
<![CDATA[
function matchwo(a,b)
{
if (a < b && a < 0) then
{
return 1;
}
else
{
return 0;
}
}
]]>
</script>

In the example above, everything inside the CDATA section is ignored by the parser.

Notes on CDATA sections:
A CDATA section cannot contain the string “]]>”. Nested CDATA sections are not allowed.

The “]]>” that marks the end of the CDATA section cannot contain spaces or line breaks.
Category : WEB programming | Posted By : Eric Shan | Comments[0] | Trackbacks [0]
18 Jan 2009   12:21:04 pm
Let PHP running in background while browser think complete
I need a PHP to be able to flush out the output and close the connection to the browser while the rest of the PHP can still be running.

I find them here: http://php.mirror.camelnetwork.com/manual/en/features.connection-handling.php

Code :
Closing the users browser connection whilst keeping your php script running has been an issue since 4.1, when the behaviour of register_shutdown_function() was modified so that it would not automatically close the users connection.

sts at mail dot xubion dot hu
Posted the original solution:

<?php
header("Connection: close");
ob_start();
phpinfo();
$size=ob_get_length();
header("Content-Length: $size");
ob_end_flush();
flush();
sleep(13);
error_log("do something in the background");
?>

Which works fine until you substitute phpinfo() for
echo ('text I want user to see'); in which case the headers are never sent!

The solution is to explicitly turn off output buffering and clear the buffer prior to sending your header information.

example:

<?php
ob_end_clean();
header("Connection: close");
ignore_user_abort(); // optional
ob_start();
echo ('Text the user will see');
$size = ob_get_length();
header("Content-Length: $size");
ob_end_flush(); // Strange behaviour, will not work
flush(); // Unless both are called !
// Do processing here
sleep(30);
echo('Text user will never see');
?>

Just spent 3 hours trying to figure this one out, hope it helps someone
Category : WEB programming | Posted By : Eric Shan | Comments[0] | Trackbacks [0]
04 Jan 2009   10:02:02 am
Proxy Server works in China
http://proxypy.appspot.com/
Category : WEB programming | Posted By : Eric Shan | Comments[0] | Trackbacks [0]
04 Jan 2009   10:01:08 am
Calculate php execution time
The below php code can calculate how much time your PHP code costs.

Code :
<!-- put this at the top of the page -->
<?php
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
?>

<!-- put other code and html in here -->


<!-- put this code at the bottom of the page -->
<?php
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$totaltime = ($endtime - $starttime);
echo "This page was created in ".$totaltime." seconds";
>
Category : WEB programming | Posted By : Eric Shan | Comments[0] | Trackbacks [0]
 
1 2 Next
Template theme : aura
Powered by myBloggie Copyright © 2004 2006
-- myWebland --

Sponsed by TNTSoft Store