共26页: 首页 上一页 7 8 9 10 11 12 13 14 15 下一页 末页 
摘要: Let say you installed PHP and run it for a month, but now you want to use curl in PHP.But so bad that you didn't install this extension when you installed PHP. That is to say, now you want to add PHP extension. Here is an example to install curl extension.apache2 is in/usr/local/apache2php is in阅读全文
posted @ 2012-01-09 15:53 DavidHHuan 阅读(426) 评论(0) 编辑
摘要: Here is an example of how to develop a widget (yes, widget is also an extension in Yii) in Yii.Let say you want to display something with widget in the page, of course you can place your widget in protected/componentswhen there are one or two classes inside. But when there is a lot of them,it is har阅读全文
posted @ 2012-01-09 10:37 DavidHHuan 阅读(322) 评论(0) 编辑
摘要: Here we will use CLinkPager for example.when using CLinkPager widget, we always follow this way: <?$this->widget(‘CLinkPager’,array('pages'=>$pages,'pageSize'=>15,))?>Here we set it to display 15 items per page. But if we have many action view page with CLinkPager, we 阅读全文
posted @ 2012-01-04 16:02 DavidHHuan 阅读(304) 评论(1) 编辑
摘要: That is just a simple example here:<?php/****Export&importsql**@authordavidhhuan*/classDLDatabaseHelper{/***Exportthesqltoafile**@authordavidhhuan*@parambool$withData:Whethertoexporttheinsert-dataatthesametime*@parambool$dropTable:Addtodropthetableornot*@paramstring$saveName:thesavedfilename*阅读全文
posted @ 2011-12-30 00:03 DavidHHuan 阅读(2325) 评论(0) 编辑
摘要: 遇到一个情况,就是用 jquery ajax 调用的数据,有两种情况:一是普通字符串;二是 json 格式;这样的话就要根据不同的返回值来处理了。google了一下,发现通过正则是比较简单的方法了,代码如下:$.ajax({type:'get',url:url,success:function(data){//判断返回值不是json格式if(!data.match("^\{(.+:.+,*){1,}\}$")){//普通字符串处理}else{//通过这种方法可将字符串转换为对象data=eval("("+data+")"阅读全文
posted @ 2011-12-28 10:01 DavidHHuan 阅读(2920) 评论(0) 编辑
摘要: javascript 如何在 ajax 直接传递数组呢?比如说,我有这样的数组:vararr=[1,2,3];在 $.ajax({})里面是不能直接传过去的!不过呢,如果把数组弄成是对象来操作的话,就没问题了,具体例子如下:vararr={};arr['block_301']={};arr['block_302']={};arr['block_301']['block_301_1']='block_301_1';arr['block_301']['block_301_2']='阅读全文
posted @ 2011-12-26 11:04 DavidHHuan 阅读(455) 评论(0) 编辑
摘要: functionhtml_encode(str){vars="";if(str.length==0)return"";s=str.replace(/&/g,"&gt;");s=s.replace(/</g,"&lt;");s=s.replace(/>/g,"&gt;");s=s.replace(//g,"&nbsp;");s=s.replace(/\'/g,"'");s=s.replace阅读全文
posted @ 2011-10-26 11:04 DavidHHuan 阅读(246) 评论(0) 编辑
摘要: Ubuntu系统升级到11.10,mysql启动不了,提示ERROR2002(HY000):Can'tconnecttolocalMySQLserverthroughsocket'/var/run/mysqld/mysqld.sock'(2)找来找去,发现原来真的没有这个文件。。。只有用终极办法,重装mysql卸载:sudoapt-getautoremove--purgemysql-server-5.0sudoapt-getremovemysql-serversudoapt-getautoremovemysql-serversudoapt-getremovemysql-阅读全文
posted @ 2011-10-15 10:41 DavidHHuan 阅读(229) 评论(0) 编辑
摘要: 这里用到了jquery的ajax。页面: $.ajax({type:'POST',url:'http://www.yourwebsite.com',beforeSend:function(XMLHttpRequest){XMLHttpRequest.setRequestHeader("request_type","ajax");},data:'test=test',success:function(rs){alert('ok');}}});PHP代码:echoisset($_SERVER[&阅读全文
posted @ 2011-09-30 14:20 DavidHHuan 阅读(502) 评论(2) 编辑
摘要: The article comes from:http://www.apaddedcell.com/easy-php-debugging-ubuntu-using-xdebug-and-vimA debugger helps greatly when testing or bug fixing in...阅读全文
posted @ 2011-09-28 22:18 DavidHHuan 阅读(428) 评论(0) 编辑
摘要: After i installed netbeans7.0, the language of is Chinese, thought i am a chinese, but of netbeans, i am not similar with the interface of Chinese, so i have to change the language to english.open the /path_to_netbeans/etc/netbeans.conf, add the code as below:netbeans_default_options="-J-client阅读全文
posted @ 2011-09-28 21:50 DavidHHuan 阅读(142) 评论(0) 编辑
摘要: \s 匹配任何空白字符,包括空格、制表符、换页符等等。等价于 [ \f\n\r\t\v]。很多情况下,都是用length来直接判断字符串是否为空,如下:varstrings='';if(string.length==0){alert('不能为空');}但如果用户输入的是空格,制表符,换页符呢?这样的话,也是不为空的,但是这样的数据就不是我们想要的吧。其实可以用正则表达式来把这些“空”的符号去掉来判断的varstrings='';if(strings.replace(/(^\s*)|(\s*$)/g,"").length==0)阅读全文
posted @ 2011-09-23 11:04 DavidHHuan 阅读(12701) 评论(0) 编辑
摘要: 在创建网站的时候,很多时候都需要输入一些中文的段落来填充页面,大多数会是找一些新闻之类的来复制粘贴。以下代码是利用php来随机生成一些中文段落,以便用来测试。GBK版:<?phpheader('Content-type:text/html;charset=gbk');functioncreateWords($words=128){$seperate=array(",","。","!","?",";");$strings='';for($i=0;$i<$阅读全文
posted @ 2011-09-23 00:07 DavidHHuan 阅读(806) 评论(1) 编辑
摘要: 如以下命令:查找/home/davidhhuan/www/tao文件夹下面所有包含StorebaseApp字眼的php文件find/home/davidhhuan/www/tao-typef-name"*.php"|xargsgrep"StorebaseApp"阅读全文
posted @ 2011-09-22 14:45 DavidHHuan 阅读(246) 评论(0) 编辑
摘要: In fact that, i do not remember whether it is w3c strict or wcag2.0A, in a link ( <a href="xxx"></a>), we can not use target="_blank" to open the link in a new page.here we can use onclick to pass the requirement. Code as: <ahref="http://www.cnblogs.com/davidh阅读全文
posted @ 2011-09-22 14:31 DavidHHuan 阅读(314) 评论(0) 编辑
共26页: 首页 上一页 7 8 9 10 11 12 13 14 15 下一页 末页