無淚之城
郭宇翔的博客
郭宇翔的博客
四 2nd
现在我们以一个最简单的示例来帮助您快速对GeoGlobe二维地图API开发有一个全面的了解,并且有一个直观感性的认识。
下面的代码是在一个普通的HTML页面里加入一个以嘉应学院为中心点的640*480像素大小的卫星地图。
<!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>天地图GeoGlobe开发入门DEMO</title>
<script src="http://www.tianditu.com/guide/lib/GeoSurfJSAPI.js"
type="text/javascript"></script>
<script src="http://www.tianditu.com/guide/2d_samples/sampleCfg.js"
type="text/javascript"></script>
<script type="text/javascript">
function initialize() {
var map = new GeoSurf.PortalMap("frist_map");
map.loadLayerGroup(imageGroup);
map.setCenter(new GeoSurf.LonLat(116.12371, 24.33058), 14);
}
</script>
</head>
<body onload="initialize()" align=center>
<h1 style="marging:0 auto">天地图GeoGlobe开发入门DEMO---Yourtion.com</h1>
<div id="frist_map" style="width: 640px; height: 480px ; marging:0 auto"></div>
</body>
</html>
您查看此示例的实际效果:点击这里看Demo
四 1st
最近在做天地图是GIS集成··要输出HTML到JavaScript里面··涉及到代码转义什么的比较麻烦··所以写个PHP的function
分享一下:
function jsformat($str)
{
$str = trim($str);
$str = str_replace('\\s\\s', '\\s', $str);
$str = str_replace(chr(10), '', $str);
$str = str_replace(chr(13), '', $str);
$str = str_replace(' ', '', $str);
$str = str_replace('\\', '\\\\', $str);
$str = str_replace('"', '\\"', $str);
$str = str_replace('\\\'', '\\\\\'', $str);
$str = str_replace("'", "\'", $str);
return $str;
}
使用就不用说了··就是直接调用jsformat($str)
三 24th
最近在弄Wordpress的sina登陆··但是在登陆之后老是会出现:
Catchable fatal error:Object of class WP_Error could not be converted to string in formatting.php on line 2818
研究了很久终于找到解决方法。
三 23rd
继续前面的文章《新浪微博OAuth认证详解及验证数据储存》,现在我们就使用它来发布微博。
我们已经将用户新浪微博的oauth_token和oauth_secret保存到
$_SESSION['oauth_token']=$result['oauth_token'];
$_SESSION['oauth_secret']=$result['oauth_secret'];
三 20th
最近想做个调用CMD命令并取得结果的程序··找了一下··共享代码
procedure CheckResult(b: Boolean);
begin
if not b then
raise Exception.Create(SysErrorMessage(GetLastError));
end;
function RunDOS(const CommandLine: string): string;
var
HRead, HWrite: THandle;
StartInfo: TStartupInfo;
ProceInfo: TProcessInformation;
b: Boolean;
sa: TSecurityAttributes;
inS: THandleStream;
sRet: TStrings;
begin
Result := '';
FillChar(sa, sizeof(sa), 0);
//设置允许继承,否则在NT和2000下无法取得输出结果
sa.nLength := sizeof(sa);
sa.bInheritHandle := True;
sa.lpSecurityDescriptor := nil;
b := CreatePipe(HRead, HWrite, @sa, 0);
CheckResult(b);
FillChar(StartInfo, SizeOf(StartInfo), 0);
StartInfo.cb := SizeOf(StartInfo);
StartInfo.wShowWindow := SW_HIDE;
//使用指定的句柄作为标准输入输出的文件句柄,使用指定的显示方式
StartInfo.dwFlags := STARTF_USESTDHANDLES or STARTF_USESHOWWINDOW;
StartInfo.hStdError := HWrite;
StartInfo.hStdInput := GetStdHandle(STD_INPUT_HANDLE); //HRead;
StartInfo.hStdOutput := HWrite;
b := CreateProcess(nil, //lpApplicationName: PChar
PChar(CommandLine), //lpCommandLine: PChar
nil, //lpProcessAttributes: PSecurityAttributes
nil, //lpThreadAttributes: PSecurityAttributes
True, //bInheritHandles: BOOL
CREATE_NEW_CONSOLE,
nil,
nil,
StartInfo,
ProceInfo);
CheckResult(b);
WaitForSingleObject(ProceInfo.hProcess, INFINITE);
inS := THandleStream.Create(HRead);
if inS.Size > 0 then
begin
sRet := TStringList.Create;
sRet.LoadFromStream(inS);
Result := sRet.Text;
sRet.Free;
end;
inS.Free;
CloseHandle(HRead);
CloseHandle(HWrite);
end;
使用方法也很简单···就是调用Function;
三 18th
数据库是WEB大多数应用开发的基础。如果你是用PHP,那么大多数据库用的是MYSQL也是LAMP架构的重要部分。
PHP看起来很简单,一个初学者也可以几个小时内就能开始写函数了。但是建立一个稳定、可靠的数据库确需要时间和经验。下面就是一些这样的经验,不仅仅是MYSQL,其他数据库也一样可以参考。
1、使用MyISAM而不是InnoDB
最新评论