2013年3月25日

linux 统计

摘要: 统计文件行数(单个文件):wc -l file例如:homer@ubuntu:~/workspace/android/game$wc -l LGameAndroid2DActivity.java906LGameAndroid2DActivity.java统计目录所有文件行数(全部目录):find . -name *.java | xargs wc -l例如:homer@ubuntu:~/workspace/android$find . -name *.java | xargs wc -l 817 ./game/core/LHandler.java 140 ./game/core/LFlic.. 阅读全文

posted @ 2013-03-25 19:05 misoag 阅读(159) 评论(0) 推荐(0) 编辑

2013年3月6日

php 得到上周,本周,上月,本月,本季度,上季度

摘要: <?phpdate_default_timezone_set('PRC');date("Y-m-d H:i:s", strtotime(" +2 year"));date("Y-m-d H:i:s", strtotime(" +2 month"));date("Y-m-d H:i:s", strtotime(" +2 week"));date("Y-m-d H:i:s", strtotime(" +2 day")) 阅读全文

posted @ 2013-03-06 15:21 misoag 阅读(1049) 评论(0) 推荐(0) 编辑

2013年2月20日

网站统计中的数据收集原理及实现

摘要: http://blog.codinglabs.org/articles/how-web-analytics-data-collection-system-work.html 阅读全文

posted @ 2013-02-20 14:53 misoag 阅读(133) 评论(0) 推荐(0) 编辑

PHP5定时任务ignore_user_abort 和crontab

摘要: 为了定时更新某一文件,需要程序自动运行,从网上搜到了两种方法:ignore_user_abort() 和crontabignore_user_abort()函数搭配set_time_limit(0)和sleep($interval)即可实现程序自动运行更新,下面是一个实例<?phpignore_user_abort(); //即使Client断开(如关掉浏览器),PHP脚本也可以继续执行.set_time_limit(0); // 执行时间为无限制,php默认的执行时间是30秒,通过set_time_limit(0)可以让程序无限制的执行下去$interval=60*5; // 每隔5分 阅读全文

posted @ 2013-02-20 14:02 misoag 阅读(355) 评论(0) 推荐(0) 编辑

2013年2月18日

PHP CURL 使用代理访问服务器

摘要: 使用CURL库访问代理服务器function curl_string ($url,$user_agent,$proxy){ $ch = curl_init(); curl_setopt ($ch, CURLOPT_PROXY, $proxy); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent); curl_setopt ($ch, CURLOPT_COOKIEJAR, "c:\cookie.txt"); ... 阅读全文

posted @ 2013-02-18 16:41 misoag 阅读(38608) 评论(2) 推荐(0) 编辑

Ubuntu下配置nginx作为http代理服务器

摘要: 修改/etc/nginx/sites-available下的default文件内容为:server { server_name 42.121.107.174; resolver 8.8.8.8; resolver_timeout 5s; location / { proxy_pass $scheme://$host$request_uri; proxy_set_header Host $http_host; p... 阅读全文

posted @ 2013-02-18 16:39 misoag 阅读(653) 评论(0) 推荐(0) 编辑

2013年2月5日

Ubuntu 安装 PHP cURL

摘要: 如果你在用PHP, 你可能需要用到cURL, 这是其中最流行的插件. PHP CURL插件需要通过libcurl来实现, Daniel Stenberg创建的一个库, 能够和许多不同类型协议的web服务器进行通信连接。架设你已经安装了LAMP. 需要安装cURL 在你的Linux计算机上,比如Ubuntu,运行一下命令行在终端:sudo apt-get install curl libcurl3 libcurl3-dev php5-curl安装完毕之后,需要重新启动apache, 在终端运行命令:sudo /etc/init.d/apache2 restart 阅读全文

posted @ 2013-02-05 11:11 misoag 阅读(6387) 评论(1) 推荐(1) 编辑

2013年2月4日

Ubuntu搭建代理服务器

摘要: Squid是全功能的HTTP/1.0代理服务器,也近乎完整的兼容HTTP/1.1。Squid提供丰富的访问控制、认证和日志环境用以网站代理服务器和内容服务应用。本文简单介绍了如何架设一台透明Squid代理服务器。Squid可用于HTTP,HTTPS,FTP等网站的缓存代理服务器。它能通过缓存和重用那些经常被访问的网页l来降低带宽,改善反应速度。Squid有很强的访问控制,是一个出色的服务器加速器。安装Squid安装squid和squid-commonsudo aptitude install squid squid-common编辑squid配置文件sudo vi /etc/squid/squ 阅读全文

posted @ 2013-02-04 13:26 misoag 阅读(18591) 评论(0) 推荐(0) 编辑

PHP CURL HTTPS POST

摘要: function vpost($url,$data){ // 模拟提交数据函数 $curl = curl_init(); // 启动一个CURL会话 curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址 curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查 curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1); // 从证书中检查SSL加密算法是否存在 curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER[ 阅读全文

posted @ 2013-02-04 12:57 misoag 阅读(11041) 评论(0) 推荐(1) 编辑

2013年1月24日

Ubunt搭建PHP+mysql+apache

摘要: Ubuntu建立(apache+php+mysql)+phpmyadminUbuntu建立apache+php+mysql基本的支持环境。暂时还不应用zend优化,因此这里就不涉及到zend optimizer的安装了。其实在ubuntu系统中中安装远比在windows系统中设置更为容易,而且在终端下设置更省事。1、安装Apache服务sudo apt-get install apache2然后按照提示即完成apahce的安装了。这里 可以打开http://127.0.0.1,即可看于是It works2、安装php5sudo apt-get install php5sudo apt-get 阅读全文

posted @ 2013-01-24 10:47 misoag 阅读(4021) 评论(0) 推荐(0) 编辑

导航