|
|
2012年1月17日
第一步:收藏夹段js
javascript:void(function(d,a,c,b){a[c]&&typeof a[c].showValidImages=='function'?a[c].showValidImages():(b=a.createElement('script'),b.id='huaban_script',b.setAttribute('charset','utf-8'),b.src='http://huaban.com/js/pinmarklet.js?'+Math.floor(+new Date/1E7),a.body.appendChild(b))}(window,document,'__huaban'));
如果js已经加载,就运行showValidImages()的方法。 没有,则加载js:http://huaban.com/js/pinmarklet.js 对a标签下的img能识别出来。
第二步:提取pinmarklet.js 把线上的js保存到本地huaban.js。 43K,一千多行的代码,经过初步的压缩。 从第一步的效果看,功能是遍历页面,组装成采集页面,再提交采集。
线索:变量"__huaban" var global="__huaban"; document[global]._loaded=!0, document[global].showValidImages=showImagesAndInitPinBtn
_loaded 初始化标记。
线索:showValidImages方法。 document[global].showValidImages=showImagesAndInitPinBtn
方法1:showImagesAndInitPinBtn 字面意思明显。很好的命名。 var a=getCurrentPageImagesWithEncapsulation(); showImages(a),initPinBtn(a),window.scroll(0,0) a的数据结构:
w=242 h=284 src=http://s4.42qu.us/img/jpg/book/3.jpg img=[object HTMLImageElement] alt= img2=[object HTMLImageElement] _parentNode=null [{container:c,w:b.width,h:b.height,src:b.src,img:b,description:e+(d&&d.innerText||""),img2:b}]
方法2:getCurrentPageImagesWithEncapsulation 参数初始 var _document=d||document;eImages=eImages||[],opts=opts||{}; 遍历img
for(i=0;i<_document.images.length;i++){ var img=_document.images[i]; //alert(img);//[object HTMLImageElement] }
isValidImage(img)&&(img=encapsulateImage(img),opts&&(img._parentNode=opts.parentNode||null),eImages.push(img))
function isValidImage(a){return a.style.display=="none"||a.className=="ImageToPin"||a.width<100||a.height<100?!1:!0}
如果img上加上class ImageToPin,就可以跳过被花瓣抓的命运。:)
getVideoOnCustomerPage(_document,eImages); 一些视频的处理。
eImages.push(img)
遍历背景图background-image等。 checkbgimgs
filters bgimgs
遍历iframes
var iframes=_document.getElementsByTagName("iframe"); for(var i=0;i<iframes.length;i++)
方法3:function showImages(a) c.onclick=function(){return pinImage(a),b()};
方法4:function initPinBtn(a){generatePinBtn(),registerImagesForPinBtn(a)}
方法5:generatePinBtn 生成采集按钮。
方法6:registerImagesForPinBtn(a) 注册鼠标事件。
方法7:取消按钮:
var b=function(){ return c.parentNode.removeChild(c), d.parentNode.removeChild(d), showingImage=!1, selectedText="", showFlash(), window.scroll(0,lastScrollY), !1 },
方法8:采集按钮:pinImage http://www.w3school.com.cn/htmldom/met_win_open.asp
var e={ media:a.big_img?a.big_img.src:d.src, url:c, w:a.big_img?a.big_img.width:d.width, h:a.big_img?a.big_img.height:d.height, alt:d.alt, title:a.title||document.title, description:a.description||"", media_type:a.media_type||"", video:a.video||"" };
全局参数:
var siteDomain="huaban.com",主域 imageRoot="http://"+siteDomain+"/img",图片路径 bookmarkletUrl="http://"+siteDomain+"/bookmarklet/",书签路径 domChanged=!1, selectedText="", lastScrollY=0, isShareBtn=!1, pinBtn=null, hidePinBtnTimer=null, currentImage=null, imageDesc="", showingImage=!1, itemUrl="", skip=!1, skiphrefs=["http://www.diandian.com/wall"];
技巧1: (function(){alert("test");})(); 定义个方法,直接运行。好处是把一些临时变量圈起来了,不容易和其它代码发生冲突。
技巧2:alert("\u4f60\u73b0"); js文件里,避免出现中文。
技巧3:!0 代替 true
技巧4:|| && 语法。
基础方法: function isIE(){return/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)} function isSafari(){return/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)} function isPinable(a) 判断是否局域网地址。 function generateTag(a,b){var c=document.createElement(b||"div");return c.id=global+"_"+a,c}生成一个节点。
正则表达式: http://hzjavaeyer.group.iteye.com/group/wiki/2276-JavaScript-Core
看js代码,用的是MyEclipse,有括号对应功能。
存疑:代码里用了大量的','号。不知道和';'号比,有什么优势。
2011年11月7日
官网:http://gearman.org/
gearman-0.7.0.tgz php扩展 gearman-mysql-udf-0.5.tar.gz gearmand-0.14.tar.gz c版的server[还有java,perl版的] yugene-Gearman-Monitor-ed34347.zip 监控 https://github.com/yugene/Gearman-Monitor 监控
http://baike.baidu.com/view/2926980.htm http://www.cnblogs.com/cocowool/archive/2011/08/18/2145144.html
跨多种环境部署 Gearman http://www.ibm.com/developerworks/cn/opensource/os-gearman/index.html 利用开源的Gearman框架构建分布式图片处理平台-张宴 http://blog.s135.com/dips/
Gearman是一个用来把工作委派给其他机器、分布式的调用更适合做某项工作的机器、并发的做某项工作在多个调用间做负载均衡、或用来在调用其它语言的函数的系统。 Gearman提供了一种通用的程序框架来将你的任务分发到不同的机器或者不同的进程当中。它提供了你进行并行工作的能力、负载均衡处理的能力,以及在不同程序语言之间沟通的能力。Gearman能够应用的领域非常广泛,从高可用的网站到数据库的复制任务。总之,Gearman就是负责分发处理的中枢系统,它的优点包括: 开源:Gearman免费并且开源而且有一个非常活跃的开源社区,如果你想来做一些贡献,请点击 。 多语言支持:Gearman支持的语言种类非常丰富。让我们能够用一种语言来编写Worker程序,但是用另外一种语言编写Client程序。 灵活:不必拘泥于固定的形式。您可以采用你希望的任何形式,例如 Map/Reduce。 快速:Gearman的协议非常简单,并且有一个用C语言实现的,经过优化的服务器,保证应用的负载在非常低的水平。 可植入:因为Gearman非常小巧、灵活。因此您可以将他置入到现有的任何系统中。 没有单点:Gearman不仅可以帮助扩展系统,同样可以避免系统的失败。
目录
Gearman 简介 Gearman运行过程 Gearman新版本介绍 安装 Gearman 展开
Gearman 简介 通常,多语言多系统之间的集成是个大问题,一般来说,人们多半会采用 WebService 的方式来处理此类集成问题,但不管采用何种风格的 WebService,如 RPC 风格,或者 REST 风格,其本身都有一定的复杂性。相比之下,Gearman 也能实现类似的作用,而且更简单易用。 Gearman运行过程 一个Gearman请求的处理过程涉及三个角色:Client -> Job -> Worker。 Client:请求的发起者,可以是 C,PHP,Perl,MySQL UDF 等等。 Job:请求的调度者,用来负责协调把 Client 发出的请求转发给合适的 Work。 Worker:请求的处理者,可以是 C,PHP,Perl 等等。 因为 Client,Worker 并不限制用一样的语言,所以有利于多语言多系统之间的集成。 甚至我们通过增加更多的 Worker,可以很方便的实现应用程序的分布式负载均衡架构。 Gearman新版本介绍 Gearman 1 月 16 日发布了 c 语言的 0.2 版本,gearman 提供了一个 work 传递其他机器,或者调用其他机器功能的框架,通过 gearman 你可以实现并行的工作,负载均衡处理,调用其他语言的函数。它可以应用在多种场合,从高可用性的 web 服务到数据库复制,换句话说,它是分布式处理的中枢神经。gearman 早期是 sixpart 实现的 perl 语言开发的版本,名字来源于“Manager”,这一框架只负责分发要做的工作,本身并不做任何实际的工作。(这点与 spread toolkit 相同 译者注)。 安装 Gearman 安装 Gearman server and library tar zxf gearmand-0.8.tar.gz[1] cd gearmand-0.8 ./configure make make install 安装 Gearman PHP extension tar zxf gearman-0.4.0.tgz cd gearman-0.4.0 phpize ./configure make make install 编辑 php.ini 配置文件加载相应模块并使之生效: extension = "gearman.so"
/www/wdlinux/php/bin/phpize ./configure --with-php-config=/www/wdlinux/php/bin/php-config make && make install
/www/wdlinux/php/bin/php --info | grep gearman 2. In another terminal, change to this source directory and run:
/www/wdlinux/php/bin/php examples/reverse_worker.php
3. In another terminal, change to this source directory and run:
/www/wdlinux/php/bin/php examples/reverse_client.php
启动Job: gearmand -d 如果当前用户是 root 的话,则需要这样操作: gearmand -d -u root 缺省会使用 4730 端口,下面会用到。 注意:如果找不到 gearmand 命令的路径,别忘了用 whereis gearmand 确认。gearmand: /usr/local/sbin/gearmand
以守护进程启动: gearmand -L 192.168.0.1 -p 4730 -u root -d
编写 Worker worker.php 文件内容如下: <?php $worker= new GearmanWorker(); $worker->addServer('127.0.0.1', 4730); $worker->addFunction('reverse', 'my_reverse_function'); while ($worker->work()); function my_reverse_function($job) { return strrev($job->workload()); } ?> 设置后台运行 work php worker.php & 编写 Client client.php 文件内容如下: <?php $client= new GearmanClient(); $client->addServer('127.0.0.1', 4730); echo $client->do('reverse', 'Hello World!'), "\n"; ?> 运行 client php client.php 输出:!dlroW olleH 出于方便的考虑,Worker,Client 使用的都是PHP,但这并不影响演示,实际应用中,你完全可以通过 Gearman 集成不同语言实现的 Worker,Client。或许此时你还想了解前面提到的负载均衡功能:很简单,只要增加多个 Worker 即可,你可以按照 worker.php 的样子多写几个类似的文件,并设置不同的返回值用以识别演示效果。然后依次启动这几个 Worker 文件,并多次使用 client.php 去请求,你就会发现 Job 会把 Client 请求转发给不同的 Worker。 命令行工具 如果你觉得安装 PHP 之类的东西太麻烦的话,你也可以仅仅通过命令行工具来体验 Gearman 的功能: 启动 Worker:gearman -w -f wc -- wc -l & 运行 Client:gearman -f wc < /etc/passwd
--一些意外,我没遇到。 1 program_options需要编译或者引用libs/program_options目录的源代码 2 编绎时要用g++ -o simple simple.cpp -lboost_program_options -L/usr/local/lib http://www.cnblogs.com/cocowool/archive/2011/08/18/2144142.html Linux上安装Boost C++ Libraries Gearman要依赖于 Boost C++ Libraries 中的 program_options 库,并且需要的版本大于 1.39。笔者的CentOS 5.2 系统中自带的 1.33 不能满足需求,在自己安装的过程中会遇到一些问题,建议参考 Boost 官方手册中的 Easy Build and Install 这部分。
安装Gearman之后,第一次启用可能会遇到 error while loading shared libraries: libgearman.so.1 这个问题。可以用下面的方法解决: 当运行 /usr/local/sbin/gearmand -d 时出现 error while loading shared libraries: libgearman.so.1 运行一下 /sbin/ldconfig -v ,然后再去运行gearman就可以了
ldconfig命令的用途,主要是在默认搜寻目录(/lib和/usr/lib)以及动态库配置文件/etc/ld.so.conf内所列的目录 下,搜索出可共享的动态链接库(格式如前介绍,lib*.so*),进而创建出动态装入程序(ld.so)所需的连接和缓存文件.缓存文件默认为/etc /ld.so.cache,此文件保存已排好序的动态链接库名字列表. ldconfig通常在系统启动时运行,而当用户安装了一个新的动态链接库时,就需要手工运行这个命令.
需要小心的一件事情是数据的共享。Gearman 不进行所交换数据的任何转换或操作。对于这里使用的简单字符串和整数没有问题,但是不能共享 PHP 中的数组值并期望能在 Java 语言中被理解。对于这种类型的交互,可以使用很多结构化数据标准中的一种,比如 JavaScript Object Notation (JSON) 或 XML。另外,如果您在处理来自数据库的信息,只要共享 ID 或者找到需要处理的数据时要用到的信息即可,或者使用 memcached 这样的透明方法(尽管可能仍然需要 JSON 或等价物)。
------------- test -z "/usr/local/lib/pkgconfig" || /bin/mkdir -p "/usr/local/lib/pkgconfig" /usr/bin/install -c -m 644 support/gearmand.pc '/usr/local/lib/pkgconfig'
Installing shared extensions: /www/wdlinux/php-5.2.17/lib/php/extensions/no-debug-non-zts-20060613/
/www/wdlinux/php/bin/php examples/reverse_worker.php [可运行多个,实现负载] /www/wdlinux/php/bin/php examples/reverse_client.php
1.传值一个name,一个序列化参数。
Gearman 的高级特性 在一个 Web 应用程序内可能有许多地方都会用到 Gearman。可以导入大量数据、发送许多电子邮件、编码视频文件、挖据数据并构建一个中央日志设施 — 所有这些均不会影响站点的体验和响应性。可以并行地处理数据。而且,由于 Gearman 协议是独立于语言和平台的,所以您可以在解决方案中混合编程语言。比如,可以用 PHP 编写一个 producer,用 C、Ruby 或其他任何支持 Gearman 库的语言编写 worker。
一个连接客户机和 worker 的 Gearman 网络实际上可以使用任何您能想象得到的结构。很多配置能够运行多个代理并将 worker 分配到许多机器上。负载均衡是隐式的:每个可操作的可用 worker(可能是每个 worker 主机具有多个 worker)从队列中拉出作业。一个作业能够同步或异步运行并具有优先级。
Gearman 的最新版本已经将系统特性扩展到了包含持久的作业队列和用一个新协议来通过 HTTP 提交工作请求。对于前者,Gearman 工作队列保存在内存并在一个关系型数据库内存有备份。这样一来,如果 Gearman 守护程序故障,它就可以在重启后重新创建这个工作队列。另一个最新的改良通过一个 memcached 集群增加队列持久性。memcached 存储也依赖于内存,但被分散于几个机器以避免单点故障。
Gearman 是一个刚刚起步却很有实力的工作分发系统。据 Gearman 的作者 Eric Day 介绍,Yahoo! 在 60 或更多的服务器上使用 Gearman 每天处理 600 万个作业。新闻聚合器 Digg 也已构建了一个相同规模的 Gearman 网络,每天可处理 400,000 个作业。Gearman 的一个出色例子可以在 Narada 这个开源搜索引擎(参见 参考资料)中找到。
2011年10月29日
Sub Macro1() Sheets("Sheet1").Select Range("A1").Select Selection.Copy Sheets("公式").Select Range("A1").Select ActiveSheet.Paste Range("D1").Select Application.CutCopyMode = False Selection.Copy '拷贝日期 Sheets("ALL").Select Call moveEmpty Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False ActiveCell.FormulaR1C1 = ActiveCell.Value Selection.Copy Call copyData("Service")
'---------------拷贝数据---- Call copyImpl("all classes", "ALL") End Sub
Sub copyData(sheetName) Sheets(sheetName).Select Call moveEmpty ActiveSheet.Paste End Sub
Sub copyImpl(strNamespace, sheetName) Sheets("Sheet1").Select selectRange (strNamespace) Application.CutCopyMode = False Selection.Copy Sheets(sheetName).Select ActiveCell.Offset(0, 1).Select ActiveSheet.Paste End Sub
Sub selectRange(stringv)
Range("A1").Select Dim i As Integer i = 0 While (ActiveCell.Value <> stringv) ActiveCell.Offset(1, 0).Select i = i + 1 If i > 200 Then GoTo ttt End If Wend ttt: Dim cell Set cell = ActiveCell.Cells Debug.Print cell.Row Debug.Print cell.Column Range(cell, Cells(cell.Row, cell.Column + 4)).Select
End Sub
'移动到空行 Sub moveEmpty() Dim i As Integer i = 2 Cells(i, 1).Select While (ActiveCell.Value <> "") i = i + 1 Cells(i, 1).Select Wend End Sub
用了有一阵子了,希望下次写时,能少查一点vba的资料。
基本上用宏录制,再略改改就帮忙做一些重复工作了。
2011年10月9日
摘要: 1. 如何创建嵌套的过滤器://允许你减少集合中的匹配元素的过滤器,//只剩下那些与给定的选择器匹配的部分。在这种情况下,//查询删除了任何没(:not)有(:has)//包含class为“selected”(.selected)的子节点。.filter(":not(:has(.selected))")2. 如何重用元素搜索var allItems = $("div.item");var keepList = $("div#container1 div.item");//现在你可以继续使用这些jQuery对象来工作了。例如,//基于复 阅读全文
2011年9月23日
1.从svn获取指定版本。
命令行:svn update svnworkpath --username xxx --password xxx -r head
$cmd = "svn update..." $ar = array(); $status = 0; exec($cmd, $ar, $status);
返回的结果包含以下内容:
A 002/ftp_upload.php
U 002/main.php
D 002/config.php
2.处理成本地路径和服务器上传路径:
function svnMessage($remoteArr,$localArr,$CONFIG_PG,$CONFIG_DIR)
{
/*
* local dir
*/
for($ctr = 0;$ctr < count($localArr)-1; $ctr++)
{
//$localArr[$ctr] = str_replace ($CONFIG_FLG,'',$localArr[$ctr]);
$istr = stripos($localArr[$ctr], $CONFIG_PG);
$localArr[$ctr] = substr($localArr[$ctr],$istr);
$localArr[$ctr] = str_replace ('\\','/',$localArr[$ctr]);
}
echo "本地路径:<br />\r\n";
for($ctr = 0;$ctr < count($localArr)-1; $ctr++)
{
echo $localArr[$ctr];
echo "<br />\r\n";
}
/*
* remote dir
*/
for($i = 0;$i < count($remoteArr)-1; $i++)
{
//$remoteArr[$i] = str_replace ($CONFIG_PG,'',$remoteArr[$i]);
$imstr = stripos($remoteArr[$i], $CONFIG_PG);
$remoteArr[$i] = substr($remoteArr[$i],$imstr+strlen($CONFIG_PG));
$remoteArr[$i] = $CONFIG_DIR.str_replace ('\\','/',$remoteArr[$i]);
}
echo "<br />\r\n上传路径:<br />\r\n";
for($i = 0;$i < count($remoteArr)-1; $i++)
{
echo $remoteArr[$i];
echo "<br />\r\n";
}
}
3.连接到ftp
$conn = ftp_connect($ftp_ip) or die("Could not connect");
ftp_login($conn,$ftp_user,$ftp_pass);
4.上传时区分A,U,D和文件或文件夹
function ftp_handle_one($conn,$aud,$localfile,$remotefile)
{
echo "$aud,$localfile,$remotefile\r\n";
$r= true;
if($aud == 'D'){
//删除时,找不到本地文件,无法判断是否文件夹。
try{
$r = ftp_delete($conn,$remotefile);
echo "删除文件 $remotefile --> $r\r\n";
if(!$r){
$r = removeDir($conn,$remotefile);
echo "删除目录 $remotefile --> $r\r\n";
}
}catch(Exception $e){
echo '捕获异常: ' . $e->getmessage() . "<br/>错误代码:" . $e->getcode().'<br/>\r\n';
echo "------\r\n";
}
}else if($aud == 'A'){
if(is_dir($localfile)){
$r = ftp_mkdir($conn,$remotefile);
echo "创建目录 $remotefile --> $r\r\n";
}else{
$r = ftp_upload_one($conn,$localfile,$remotefile);
echo "创建文件 $remotefile --> $r\r\n";
}
}else if($aud == 'U'){
if(is_dir($localfile)){
//ftp_rmdir($conn,$remotefile);
}else{
$r = ftp_upload_one($conn,$localfile,$remotefile);
echo "更新文件 $remotefile --> $r\r\n";
}
}
}
5.递归删除一个目录
function removeDir($conn, $dirName )
{
$arr = ftp_rawlist($conn,$dirName);
//是个目录时,默认会有三行
//array(3) {
// [0]=>string(7) "total 0"
// [1]=>string(56) "drw-rw-rw- 1 user group 0 Sep 23 13:56 ."
// [2]=>string(57) "drw-rw-rw- 1 user group 0 Sep 23 13:56 .."
//}
if(count($arr)>=3)
{
for($i = 3;$i < count($arr); $i++)
{
$isdir = substr($arr[$i],0,1);
$filename = substr($arr[$i],55);//取文件名。
$filename = "$dirName/$filename";
echo "$isdir||$filename";
echo "\r\n";
if($isdir =="d")
{
removeDir($conn,$filename);
}else{
ftp_delete($conn,$filename);
}
}
ftp_rmdir($conn,$dirName);
return true;
}else{
return false;
}
}
6.上传一个文件
function ftp_upload_one($conn,$localfile,$remotefile)
{
// 开始
$fp = fopen($localfile, 'r');
$ret = ftp_nb_fput($conn, $remotefile, $fp, FTP_BINARY);
while ($ret == FTP_MOREDATA)
{
// 加入其它要执行的代码
echo "....";
// 继续传送...
$ret = ftp_nb_continue ($conn);
}
if ($ret != FTP_FINISHED)
{
echo "上传文件中发生错误...";
exit(1);
}
return true;
}
感觉php对ftp,命令行支持得很好。脚本写得很方便。
1.引用
<link type="text/css" href="css/ui-lightness/jquery-ui-1.8.14.custom.css" rel="stylesheet" />
<link type="text/css" href="css/ui.jqgrid.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.14.custom.min.js"></script>
<script type="text/javascript" src="js/grid.locale-cn.js"></script>
<script type="text/javascript" src="js/jquery.jqGrid.min.js"></script>
注意jqGrid放grid.locale-cn.js的后面。否则会报错。
2.纯js示例
jQuery("#editgrid").jqGrid({
datatype: "local",
height: 450,
colNames:['编号','用户名', '性别', '邮箱', 'QQ','手机号','出生日期'],
colModel:[
{name:'id',index:'id', width:200, sorttype:"int"},
{name:'userName',index:'userName', width:200},
{name:'gender',index:'gender', width:90},
{name:'email',index:'email', width:125,sorttype:"string"},
{name:'QQ',index:'QQ', width:100},
{name:'mobilePhone',index:'mobilePhone', width:120},
{name:'birthday',index:'birthday', width:100, sorttype:"date"}
],
sortname:'id',
sortorder:'asc',
viewrecords:true,
rowNum:10,
rowList:[10,20,30],
pager:"#gridPager",
caption: ""
}).navGrid('#gridPager',{edit:true,add:true,del:true});
var mydata = [
{id:"1",userName:"polaris",gender:"男",email:"fef@163.com",QQ:"33334444",mobilePhone:"13223423424",birthday:"1985-10-01"},
{id:"2",userName:"李四",gender:"女",email:"faf@gmail.com",QQ:"222222222",mobilePhone:"13223423",birthday:"1986-07-01"},
{id:"3",userName:"王五",gender:"男",email:"fae@163.com",QQ:"99999999",mobilePhone:"1322342342",birthday:"1985-10-01"},
{id:"4",userName:"马六",gender:"女",email:"aaaa@gmail.com",QQ:"23333333",mobilePhone:"132234662",birthday:"1987-05-01"}
];
for(var i=0;i<=mydata.length;i++)
jQuery("#editgrid").jqGrid('addRowData',i+1,mydata[i]);
<table id="editgrid"></table> <div id="gridPager"></div>
3.可编辑字段的配置
colModel:[
{name:'id',index:'id', width:55,editable:false,editoptions:{readonly:true,size:10},formatter: 'integer', formatoptions:{thousandsSeparator:","}},
{name:'invdate',index:'invdate', width:80,editable:true,editoptions:{size:10},formatter:'date', formatoptions: {srcformat:'Y-m-d',newformat:'Y/m/d'}},
{name:'name',index:'name', width:90,editable:true,editoptions:{size:25}},
{name:'amount',index:'amount', width:60, align:"right",editable:true,formatter:'currency',formatoptions:{thousandsSeparator:" ", decimalSeparator:",", prefix:"€"}},
{name:'tax',index:'tax', width:60, align:"right",editable:true,editoptions:{size:10}},
{name:'total',index:'total', width:60,align:"right",editable:true,editoptions:{size:10}},
{name:'closed',index:'closed',width:55,align:'center',editable:true,edittype:"checkbox",editoptions:{value:"Yes:No"}},
{name:'ship_via',index:'ship_via',width:70, editable: true,edittype:"select",editoptions:{value:"FE:FedEx;TN:TNT"}},
{name:'note',index:'note', width:100, sortable:false,editable: true,edittype:"textarea", editoptions:{rows:"2",cols:"20"}}
],
4.服务器返回的json格式
$responce->page = 2;//当前页
$responce->total = 3;//总页
$responce->records = 20;//总条数
for($i=0;$i<10;$i++){
$responce->rows[$i]['id']=$i;
$responce->rows[$i]['cell']=array($i,date("Y-m-d H:i:s"),'中主');
}
echo json_encode($responce);
5.xml格式
echo "<?xml version='1.0' encoding='utf-8'?$et\n";
echo "<rows>";
echo "<page>1</page>";
echo "<total>1</total>";
echo "<records>1</records>";
// be sure to put text data in CDATA
while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
echo "<row>";
echo "<cell>". $row[account_id]."</cell>";
echo "<cell>". $row[name]."</cell>";
echo "<cell>". $row[acc_num]."</cell>";
echo "<cell>". $row[debit]."</cell>";
echo "<cell>". $row[credit]."</cell>";
echo "<cell>". $row[balance]."</cell>";
echo "<cell>". rand(0,1)."</cell>";
echo "<cell>". $row[level]."</cell>";
echo "<cell>". $row[lft]."</cell>";
echo "<cell>". $row[rgt]."</cell>";
if($row[rgt] == $row[lft]+1) $leaf = 'true';else $leaf='false';
echo "<cell>".$leaf."</cell>";
echo "<cell>true</cell>";
echo "</row>";
}
echo "</rows>";
6.提交的数据
_search false
nd 1311834540399
page 1
rows 10
sidx id
sord desc
_search true
filters
nd 1311836578173
page 1
rows 10
searchField id
searchOper eq
searchString
sidx id
sord desc
7.单元格编辑
cellurl:"<?php echo site_url("admin/demo/edit2")?>",
cellEdit: true,
参考:
http://blog.sina.com.cn/s/blog_4496b0890100ri4d.html
http://blog.csdn.net/gengv/article/details/5714834
2011年7月12日
摘要: .net很久没用了,最近要做个小工具下载一个https的内容,想来想去还是.net的环境最方便。java要装jdk,python也要python的环境,php有php的环境。主要功能代码都从网上收集,这里记录一些片段,用作备份。1.登录https if (url.StartsWith("https", StringComparison.OrdinalIgnoreCase)) { ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(C 阅读全文
2011年6月23日
摘要: js日志:var msg_id = 0;function wl(msg){msg_id++;$('#log').append(""+msg_id+":"+msg+"<br/>");}查看对象所有属性:function allPrpos(obj) { var props = ""; for(var p in obj){ if(typeof(obj[p])=="function"){ obj[p](); }else{ props+= p + "=" + 阅读全文
2011年6月3日
摘要: 一,楔子SAE平台上的应用,使用的是PHP语言。这么好的环境,不禁手痒。做一个WEB监控来测试一下吧。需求:设置一些URL和字符,定时去获取内容,验证字符。记录获取内容的用时,验证通过表示正常,验证不通过表示异常。将会用到SAE的Cron,FetchURL和Mysql.二,框架内置应用的框架中,就ci_sae有过了解,那就用它了。进入SAE->我的应用->应用向导,找到ci_sae,点击安装。会有一个弹窗向导,选择应用[ertong],选择版本[2],下一步。框架就安装好了。运行SDK,把代码同步到本地。目录一般在这里:/sdk目录/apps/ertong/2code 项目代码目录 阅读全文
2011年6月2日
摘要: 偶然间发现了SAE,用google搜索“Sina App Engine”,发现文章大都是2009年11月的。看来有些来迟了,现在不火啦?我发现的时候,已经正式开放注册了。那就进去体验一下吧。一。LOADING...地址:http://sae.sina.com.cn用新浪微博帐号可直接登录,然后通过邮箱,手机两重验证。就算进入SEA的环境了。免费帐户可建10个应用,每个应用可放10个版本,相当于可以放100份代码在上面。十分给力啊。二。新应用下载SDK,http://sae.sina.com.cn/?m=sdk,这是一个上下传代码的工具,解压后直接运行am.exe即可。首先要新建app,这一步要 阅读全文
|