2008-06-13

安裝 Red5 on Linux 的心得

注意:Installing Red5 on Linux Open Source Flash 中某些動作不合用,比較舊

底下是我使用的不一樣的指令


yum install subversion

svn co http://svn1.cvsdude.com/osflash/red5/java/server/trunk
red5

mv red5 /usr/

export JAVA_HOME=/usr/java/jdk1.6.0_06

export _JAVA_OPTIONS="-Xmx128m" #修改最大記憶體用量 for vps

ant

./red5.sh &


測試是否成功:開二個http://localhost:5080/demos/BallControl.swf,按「連線」讓「綠燈」亮。托拽二個畫面,有同步即成功

參考來源:http://www.cnblogs.com/phinecos/archive/2007/11/26/973109.html

要改對外開放的ip

conf/red5.properties 修改此文件就行,記得iptables打開所有須要的port,將0.0.0.0的ip改為本機實體ip

有些範例是這樣

rtmp.host_port = 0.0.0.0:1935

http.host = your.server.com

http.port = 5080

rtmpt.host = 0.0.0.0

rtmpt.port = 8088

debug_proxy.host_port = 1936

proxy_forward.host_port = 127.0.0.1:5080

rtmp.threadcount = 4

2008-06-03

iframe 的 innerhtml

我有使用mootool.js

function FRAME(id){
var i;
if ( i = $(id) ){
if (i.contentDocument) {
var d = i.contentDocument;
} else if (i.contentWindow) {
var d = i.contentWindow.document;
} else {
var d = window.frames[id].document;
}
return d;
}else return null;
}
alert(FRAME(id).body.innerHTML);

當IFRAME的內文 只有 script 時,如下:

< script >alert('z-win.com');< /script >


innerHTML 將會是空字串
若內文是
< b>z-win.com< /b>
< script >alert('z-win.com');< /script >


就會正常回傳全部內文

php adodb :: ado-mssql 的 variant Object問題

目前的版本是 adodb498.gz 及 adodb504a.gz

發現 使用 ado-mssql時,
bigint 的 資料

print_r($f->value);
//會回傳 variant Object
echo($f->value);
//才會回傳 正確數值

但對於int的格式就都能回傳正碼數值

我解決的方式如下
/**
*fix VT
*/
function fix_VT($v){
if ( is_array($v) || is_object($v) ){
foreach($v as $i => $v2){
$v[$i] = $this->__fix_VT($v2);
}
return $v;
}else{
return $this->__fix_VT($v);
}
}
/**
*fix VT base function
*/
function __fix_VT($value){

$t = $this->VT_MetaType($value);
if ( $t == '' ) return $value;
switch($t) {

case 'I': return intval($value);
case 'N': return floatval($value);
/*
case 'C': return 'VARCHAR';
case 'XL': return (isset($this)) ? $this->typeXL : 'TEXT';
case 'X': return (isset($this)) ? $this->typeX : 'TEXT'; ## could be varchar(8000), but we want compat with oracle
case 'C2': return 'NVARCHAR';
case 'X2': return 'NTEXT';

case 'B': return 'IMAGE';

case 'D': return 'DATETIME';
case 'T': return 'DATETIME';
case 'L': return 'BIT';

case 'R':
case 'I1': return 'TINYINT';
case 'I2': return 'SMALLINT';
case 'I4': return 'INT';
case 'I8': return 'BIGINT';

case 'F': return 'REAL';
*/
default:
return $value;
}


}
/*
OLEDB types

enum DBTYPEENUM
{ DBTYPE_EMPTY = 0,
DBTYPE_NULL = 1,
DBTYPE_I2 = 2,
DBTYPE_I4 = 3,
DBTYPE_R4 = 4,
DBTYPE_R8 = 5,
DBTYPE_CY = 6,
DBTYPE_DATE = 7,
DBTYPE_BSTR = 8,
DBTYPE_IDISPATCH = 9,
DBTYPE_ERROR = 10,
DBTYPE_BOOL = 11,
DBTYPE_VARIANT = 12,
DBTYPE_IUNKNOWN = 13,
DBTYPE_DECIMAL = 14,
DBTYPE_UI1 = 17,
DBTYPE_ARRAY = 0x2000,
DBTYPE_BYREF = 0x4000,
DBTYPE_I1 = 16,
DBTYPE_UI2 = 18,
DBTYPE_UI4 = 19,
DBTYPE_I8 = 20,
DBTYPE_UI8 = 21,
DBTYPE_GUID = 72,
DBTYPE_VECTOR = 0x1000,
DBTYPE_RESERVED = 0x8000,
DBTYPE_BYTES = 128,
DBTYPE_STR = 129,
DBTYPE_WSTR = 130,
DBTYPE_NUMERIC = 131,
DBTYPE_UDT = 132,
DBTYPE_DBDATE = 133,
DBTYPE_DBTIME = 134,
DBTYPE_DBTIMESTAMP = 135

ADO Types

adEmpty = 0,
adTinyInt = 16,
adSmallInt = 2,
adInteger = 3,
adBigInt = 20,
adUnsignedTinyInt = 17,
adUnsignedSmallInt = 18,
adUnsignedInt = 19,
adUnsignedBigInt = 21,
adSingle = 4,
adDouble = 5,
adCurrency = 6,
adDecimal = 14,
adNumeric = 131,
adBoolean = 11,
adError = 10,
adUserDefined = 132,
adVariant = 12,
adIDispatch = 9,
adIUnknown = 13,
adGUID = 72,
adDate = 7,
adDBDate = 133,
adDBTime = 134,
adDBTimeStamp = 135,
adBSTR = 8,
adChar = 129,
adVarChar = 200,
adLongVarChar = 201,
adWChar = 130,
adVarWChar = 202,
adLongVarWChar = 203,
adBinary = 128,
adVarBinary = 204,
adLongVarBinary = 205,
adChapter = 136,
adFileTime = 64,
adDBFileTime = 137,
adPropVariant = 138,
adVarNumeric = 139

add by loa 2008-06-03
VT_MetaType is for check variant MetaType ,because returns is not a useful value,like bigint of mssql data
*/
function VT_MetaType($v)
{
if (is_object($v)) {
if (PHP_VERSION >= 5) $t = @variant_get_type($v);
else $t = $v->type;
}else return $v;
if ($t===null) return '';
switch ($t) {
case 0:
case 12: // variant
case 8: // bstr
case 129: //char
case 130: //wc
case 200: // varc
case 202:// varWC
case 128: // bin
case 204: // varBin
case 72: // guid
if ($len <= $this->blobSize) return 'C';

case 201:
case 203:
return 'X';
case 128:
case 204:
case 205:
return 'B';
case 7:
case 133: return 'D';

case 134:
case 135: return 'T';

case 11: return 'L';

case 16:// adTinyInt = 16,
case 2://adSmallInt = 2,
case 3://adInteger = 3,
case 4://adBigInt = 20,
case 17://adUnsignedTinyInt = 17,
case 18://adUnsignedSmallInt = 18,
case 19://adUnsignedInt = 19,
case 20://adUnsignedBigInt = 21,
return 'I';
default: return 'N';
}
}