C语言 c++ php mysql nginx linux lnmp lamp lanmp memcache redis 面试 笔记 ppt 设计模式 问题 远程连接

  2012年11月10日
摘要: 例如给出字串: %B4%BA或 %E6%98%A5如何判断应该是使用UTF-8还是GBK进行URLDecode?思路1 通用方法:假定它是 GBK 的编码 ,则将其转换成 utf-8 然后再转换回来后与没有转换之前是相等的。这样假设成立,也就是GBK编码。思路2iconv转换编码时 如果转换遇到错误 会抛出异常 扑捉异常即可 <?php //测试url编码到底是gbk 还是utf8编码 $url="%B4%BA"; check_type1($url); check_type2($url); function check_type1($url){ ... 阅读全文
posted @ 2012-11-10 00:42 思齐_ 阅读(2297) 评论(0) 推荐(0) 编辑
  2012年11月9日
摘要: 原理:下载文件时设置一个cookie,客户端利用js间隔性检测cookie,如果检测到则服务端对下载的文件处理完毕,然后通知客户端http://johnculviner.com/post/2012/03/22/Ajax-like-feature-rich-file-downloads-with-jQuery-File-Download.aspx下载地址:https://github.com/johnculviner/jquery.fileDownload/blob/master/src/Scripts/jquery.fileDownload.js/** jQuery File Download 阅读全文
posted @ 2012-11-09 17:52 思齐_ 阅读(2801) 评论(0) 推荐(0) 编辑
摘要: 方式1:<script>var parser = document.createElement('a');parser.href = "http://example.com:3000/pathname/?search=test#hash";parser.protocol; // => "http:"parser.hostname; // => "example.com"parser.port; // => "3000"parser.pathname; // => 阅读全文
posted @ 2012-11-09 01:16 思齐_ 阅读(1130) 评论(0) 推荐(0) 编辑
  2012年11月4日
摘要: 1.zendstudio中为svn加快捷键:打开window–preferences–General–Keys为svn的添加,更新,检出,提交等加上快捷键,保存。然后测试发现不起作用,研究后发现解决方案:打开windows–Customize Perspective(自定义视图)–Command Groups Availability,找到SVN,打勾保存,再测svn快捷键,起作用了!!2.文件显示版本号: 打开 : windows ->preferences->General->Appearance->Lable Decorations 勾选其中的 SVN 项即可同时 阅读全文
posted @ 2012-11-04 23:27 思齐_ 阅读(4346) 评论(0) 推荐(0) 编辑
  2012年10月31日
摘要: $a = 3;$b = 5;var_dump(5 || $b = 7);//boolean(true)if($a = 5 || $b = 7) { //|| 的优先级比赋值预算的要高 var_dump($a); //boolean(true) $a++; $b++;}echo $a . " " .  阅读全文
posted @ 2012-10-31 23:19 思齐_ 阅读(335) 评论(0) 推荐(0) 编辑
  2012年10月29日
摘要: 用归纳法来理解递归步进表达式:问题蜕变成子问题的表达式结束条件:什么时候可以不再是用步进表达式直接求解表达式:在结束条件下能够直接计算返回值的表达式逻辑归纳项:适用于一切非适用于结束条件的子问题的处理,当然上面的步进表达式其实就是包含在这里面了。递归算法的一般形式:void func( mode){ if(endCondition) { constExpression //基本项 } else { accumrateExpreesion //归纳项 mode=expression /... 阅读全文
posted @ 2012-10-29 23:57 思齐_ 阅读(791) 评论(0) 推荐(0) 编辑
摘要: /** * * 递归小练习 */$a = array( array(' a ',array(' e ',array(' f '))), array(' b '), array(' c '),);var_dump($a);$b = array_map('trims', $a);/** * * 递归处理数组 */function trims($str){ if(is_array($str)){ foreach ($str as $k=>$v){ $str[$k] = trims($v); } }e 阅读全文
posted @ 2012-10-29 22:30 思齐_ 阅读(220) 评论(0) 推荐(0) 编辑
  2012年10月28日
摘要: 1.使用httpd -M查看是否有mod_deflate模块 或者查看你的httpd.conf文件中LoadModules有没有这个mod_deflate模块开启如果已经开启 复制一下到httpd.conf中即可<ifmodule mod_deflate.c>AddOutputFilter DEFLATE html xml php js css</ifmodule> 2.还可以在php中开启gzip压缩ob_start("ob_gzhandler"); 阅读全文
posted @ 2012-10-28 17:17 思齐_ 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 1.php默认的包含路径为 .;C:\php\pear 即为当前目录和C:\php\pear目录2.如果设置ini_set("include_path", ""); 则改变为默认们目录(即为上面的)运行时的包含顺序:1.如果为绝对路径 则直接包含, 并结束(找不到直接退出).2.如果是是相对路径((形如./file, ../dir/file) 则跳过include_path的作用逻辑, 直接解析相对路径(找不到直接退出) 注意:在使用相对路径的包含文件的情况下,如果一个文件被另一个文件所包含,则这个文件的”相对“则指的是包含他的那个文件3.都不是以上两种 阅读全文
posted @ 2012-10-28 10:33 思齐_ 阅读(9115) 评论(0) 推荐(0) 编辑
  2012年10月24日
摘要: 闭包的样列例子1:闭包中局部变量是引用而非拷贝function say667() { // Local variable that ends up within closure var num = 666; var sayAlert = function() { alert(num); } num++; return sayAlert;} var sayAlert = say667();sayAlert()因此执行结果应该弹出的667而非666。例子2:多个函数绑定同一个闭包,因为他们定义在同一个函数内。function setupSomeGlobals() { ... 阅读全文
posted @ 2012-10-24 23:44 思齐_ 阅读(584) 评论(0) 推荐(0) 编辑