漂定

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 16 下一页

2014年1月20日

摘要: 1 /** 2 * 手机分辨率转化类 3 */ 4 package com.wu.mynews.util; 5 6 import android.content.Context; 7 8 public class DensityUtil { 9 10 /**11 * 根据手机的分辨率从 dp 的单位 转成为 px(像素)12 * @param context13 * @param dpValue14 * @return15 */16 public static int dip2px(Context contex... 阅读全文
posted @ 2014-01-20 10:45 漂定 阅读(178) 评论(0) 推荐(0) 编辑

2014年1月19日

摘要: #### 方案一:PHP 5.3 以上版本,使用pthreads PHP扩展,可以使PHP真正地支持多线程。多线程在处理重复性的循环任务,能够大大缩短程序执行时间。我之前的文章中说过,大多数网站的性能瓶颈不在PHP服务器上,因为它可以简单地通过横向增加服务器或CPU核数来轻松应对(对于各种云主机,增加VPS或CPU核数就更方便了,直接以备份镜像增加VPS,连操作系统、环境都不用安装配置),而是在于MySQL数据库。如果用 MySQL 数据库,一条联合查询的SQL,也许就可以处理完业务逻辑,但是,遇到大量并发请求,就歇菜了。如果用 NoSQL 数据库,也许需要十次查询,才能处理完同样地业务逻辑, 阅读全文
posted @ 2014-01-19 11:40 漂定 阅读(541) 评论(0) 推荐(0) 编辑

摘要: 1 $keyword,'from'=>$from); 31 }32 33 //以下为测试 34 //在搜索引擎搜索个关键词,进入网站 35 $word = search_word_from(); 36 if(!empty($word['keyword'])){ 37 echo '关键字:'.$word['keyword'].' 来自:'.$word['from']; 38 } 39 ?> 阅读全文
posted @ 2014-01-19 11:12 漂定 阅读(456) 评论(0) 推荐(0) 编辑

摘要: 1 <?php 2 /** 3 * 检测文件编码 4 * @param string $file 文件路径 5 * @return string|null 返回 编码名 或 null 6 */ 7 function detect_encoding($file) { 8 $list = array('GBK', 'UTF-8', 'UTF-16LE', 'UTF-16BE', 'ISO-8859-1'); 9 $str = file_get_contents($file);10 foreach ($list a 阅读全文
posted @ 2014-01-19 11:09 漂定 阅读(323) 评论(0) 推荐(0) 编辑

2014年1月15日

摘要: fp = fopen($filepath, 'rb'); //二制方式打开 $this->firstip = $this->get4b(); //第一条ip索引的绝对偏移地址 $this->lastip = $this->get4b(); //最后一条ip索引的绝对偏移地址 $this->totalip = ($this->lastip - $this->firstip) / 7; //ip总数 索引区是定长的7个字节,在此要除以7, register_shutdown_function(array($this, "close 阅读全文
posted @ 2014-01-15 14:01 漂定 阅读(234) 评论(0) 推荐(0) 编辑

2013年12月31日

摘要: function animateGoTop() { var top = $(document).scrollTop(); var end = 0; var dur = 500; var t = 0; var ts = setInterval(function() { ... 阅读全文
posted @ 2013-12-31 13:27 漂定 阅读(442) 评论(0) 推荐(0) 编辑

2013年12月30日

摘要: 1.第一次给变量赋值时,别忘记var关键字 给一个未声明的变量赋值,该变量会被自动创建为全局变量,在JS开发中,应该避免使用全局变量。 2.使用===替换== 并且永远不要使用=或!=。[10] === 10 // is false[10] == 10 // is true'10' == 10 // is true'10' === 10 // is false[] == 0 // is true[] === 0 // is false'' == false // is true but true == "a" is false 阅读全文
posted @ 2013-12-30 09:18 漂定 阅读(152) 评论(0) 推荐(0) 编辑

2013年12月27日

摘要: acl操作# 查看操作的分区支不支持acldumpe2fs -h /dev/sda2 | grep aclDefault mount options: user xattr acl 代表支持acl如果不支持方法一:#mount -o rw,acl /dev/loop0 /mnt 挂载mount -o remount,acl /dev/sda2 #重新挂载并支持acl方法二:vi /etc/fstab/dev/sda2 /web ext4 defaults,acl 0 2这样就支持了标签挂载方法:LABEL=web /backup ext4 defaults 0 2#相关参数说明语法:setf. 阅读全文
posted @ 2013-12-27 10:11 漂定 阅读(331) 评论(0) 推荐(0) 编辑

2013年12月26日

摘要: 1.【在protected目录下建立文件夹vendor/smarty,把smarty的类包放入其中】2.【在extensions目录下边建立文件CSmarty.php】//CSmarty.php文件具体内容如下(意思自己体会理解):template_dir =SMARTY_VIEW_DIR.self::DS.’tpl’; $this->compile_dir =SMARTY_VIEW_DIR.self::DS.’tpl_c’; $this->caching = true; $... 阅读全文
posted @ 2013-12-26 20:28 漂定 阅读(535) 评论(0) 推荐(0) 编辑

2013年12月25日

摘要: 一. Webkit浏览器(1) 第一种写法:background:-webkit-gradient(linear ,10% 10%,100% 100%,color-stop(0.14,rgb(255,0,0)),color-stop(0.5,rgb(255,255,0)),color-stop(1,rgb(0,0,255)));第一个参数:表示的是渐变的类型linear线性渐变第二个参数:分别对应x,y方向渐变的起始位置第三个参数:分别对应x,y方向渐变的终止位置第四/五/N个参数:设置渐变的位置及颜色(2)第二种写法:这种写法比较简单,而且效果比较自然background:-webkit-g 阅读全文
posted @ 2013-12-25 13:02 漂定 阅读(29225) 评论(0) 推荐(0) 编辑

上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 16 下一页