一周学会Mootools 1.4中文教程:序论
一周学会Mootools 1.4中文教程:(1)Dom选择器
一周学会Mootools 1.4中文教程:(2)函数
一周学会Mootools 1.4中文教程:(3)事件
一周学会Mootools 1.4中文教程:(4)类型
一周学会Mootools 1.4中文教程:(5)Ajax
一周学会Mootools 1.4中文教程:(6)动画
一周学会Mootools 1.4中文教程:(7)汇总收尾
作者:Magic
MySQL快速复制数据库
mysqldump 21cake_249 -u root -p1 --add-drop-table | mysql 21cake_249.bk -u root -p1
ECstore nginx配置
ECstore采用pathinfo做资源定位,所以要求$_SERVER环境变量中必须要有PATHINFO或则ORGI_PATHINFO
一般在apache或者iis下都没有什么问题,但是在nginx下需要对配置文件做一些设置才可以
这些设置主要是在php fast cgi的配置文件中,设置代码为
set $real_script_name $fastcgi_script_name; if ($fastcgi_script_name ~ "(.+?.php)(/.+)") { set $real_script_name $1; set $path_info $2; } fastcgi_param SCRIPT_FILENAME $document_root$real_script_name; fastcgi_param SCRIPT_NAME $real_script_name; fastcgi_param PATH_INFO $path_info;
可参考我的nginx配置
利用VPS+Chrome SwitchySharp插件 进行翻墙
一般新买的VPS都会装好SSH服务,并提供了root来远程管理的,我用的vps装的ubuntu系统,ssh己装好。要用ssh代理来翻墙也很容易,为了避免和我的管理账户冲突,我新建了一个ssh用户,并且禁用了该用户的shell。以下是相关命令:
$groupadd sshfq (增加组sshfq) $useradd -d /home/sshfq -m -g sshfq -s /bin/false sshfq (增加用户sshfq创建同名目录并属于组sshfq并禁止shell) $passwd sshfq (修改sshfq密码)
这样服务器端就设置完成了。
如果要修改服务器监听ssh的端口,可 运行如下命令:
ssh -qTfnN -D 端口 sshfq@你VPS的IP
接下来Chrome安装好SwitchySharp进行以下配置即可
Tips:
ssh -qTfNn
用于建立纯端口转发用途的ssh连接,参数具体含义如下:
-q
: quiet模式,忽视大部分的警告和诊断信息(比如端口转发时的各种连接错误)-T
: 禁用tty分配(pseudo-terminal allocation)-f
: 登录成功后即转为后台任务执行-N
: 不执行远程命令(专门做端口转发)-n
: 重定向stdin为/dev/null
,用于配合-f
后台任务
Mac用port安装nginx
安装macport
到http://www.macports.org/install.php下载macports
安装nginx:运行
sudo port install nginx spawn-fcgi
安装php:运行
sudo port install php53 fcgi php53-cgi php53-mysql php53-curl php53-iconv php53-mcrypt
安装imagick: 运行
sudo port install php53-imagick
nginx配置
进入
cd /opt/local/etc/nginx
创建sites-avalaible和sites-enabled文件夹
参考附件的配置文件,编辑nginx.conf, fastcgi.conf, mime.types
参考附件的配置文件在sites-available中创建web配置文件
php 配置
error_reporting = E_ALL & ~E_NOTICE display_errors = On date.timezone = Asia/Shanghai short_open_tag = On
开启自启动配置
将以下代码保存至/Library/LaunchDaemons/org.macports.nginx.plist
<?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "<span style="text-decoration: underline;">http://www.apple.com/DTDs/PropertyList-1.0.dtd</span>" > <plist version='1.0'> <dict> <key>Label</key><string>org.macports.nginx</string> <key>ProgramArguments</key> <array> <string>/opt/local/bin/daemondo</string> <string>--label=nginx</string> <string>--start-cmd</string> <string>/opt/local/sbin/nginx</string> <string>;</string> <string>--pid=fileauto</string> <string>--pidfile</string> <string>/opt/local/var/run/nginx/nginx.pid</string> </array> <key>Debug</key><false/> <key>Disabled</key><true/> <key>KeepAlive</key><true/> </dict> </plist>
将以下代码保存至/Library/LaunchDaemons/org.macports.phpfcgi.plist
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "<span style="text-decoration: underline;">http://www.apple.com/DTDs/PropertyList-1.0.dtd</span>"> <plist version="1.0"> <dict> <key>Label</key><string>org.macports.phpfcgi</string> <key>Debug</key><false /> <key>OnDemand</key><false /> <key>RunAtLoad</key><false /> <key>EnvironmentVariables</key> <dict> <key>PHP_FCGI_CHILDREN</key><string>2</string> <key>PHP_FCGI_MAX_REQUESTS</key><string>5000</string> </dict> <key>LaunchOnlyOnce</key><true /> <key>ProgramArguments</key> <array> <string>/opt/local/bin/spawn-fcgi</string> <string>-C 2</string> <string>-p 9000</string> <string>-f /opt/local/bin/php-cgi53</string> </array> </dict> </plist>
运行
sudo launchctl load -w /Library/LaunchDaemons/org.macports.nginx.plist
运行
sudo launchctl load -w /Library/LaunchDaemons/org.macports.phpfcgi.plist
运行
sudo lsof -i:80
和
sudo lsof -i:9000
检查nginx和fastcgi是否分别正常监听80和9000端口
如果安装php扩展,安装后重启fastcgi即可
sudo killall php-cgi53
sudo php-cgi53 -b 127.0.0.1:9000 &
jquery event after ajax load
jquery event after ajax load
$( document ).ajaxComplete(function() { $(".body_box .table").fixedtableheader(); });
php 高并发 memcache 锁
<br /> private function lock(){<br /> $lock_name = "mb_lock";<br /> $memcache = new Memcache();<br /> $memcache->connect("127.0.0.1", 11211);<br /> $locked = $memcache->add($lock_name, 1, false, 30);<br /> if($locked){<br /> return true;<br /> }else{<br /> $wait = 1;<br /> while ($wait) {<br /> if(!$locked){<br /> usleep(rand(1,100)*1000);<br /> $locked = $memcache->add($lock_name, 1, false, 30);<br /> CakeLog::write("debug","wait:".$wait);<br /> $wait ;<br /> if($wait == 10){<br /> break;<br /> }<br /> }else{<br /> return true;<br /> }<br /> }<br /> }<br /> return $locked;<br /> }</p> <p> private function un_lock(){<br /> $lock_name = "mb_lock";<br /> $memcache = new <a href="http://www.cillap.com/">beste online casino</a> Memcache();<br /> $memcache->connect("127.0.0.1", 11211);<br /> return $memcache->delete($lock_name, 0);<br /> }</p> <p> function test(){<br /> $locked = $this->lock();<br /> if($locked){<br /> // usleep(1000*100);<br /> $this->loadModel("AbTest");<br /> $data = $this->AbTest->find("first",array("conditions"=>array("sold"=>0)));<br /> if(!empty($data)){<br /> $this->loadModel("AbAddTest");<br /> $this->AbAddTest->create();<br /> $this->AbAddTest->save(array("test_id"=>$data["AbTest"]["id"],"time"=>time()));<br /> $data["AbTest"]["sold"] = 1;<br /> $this->AbTest->save($data);<br /> }</p> <p> CakeLog::write("debug","success");<br /> echo "success";<br /> $this->un_lock();<br /> }else{<br /> echo "error";<br /> CakeLog::write("debug","success");<br /> }</p> <p> }<br />
<br /> home$ ab -n 1000 -c 10 http://local.www.xd.com/games/test<br />
在未使用memcache锁时,使用ab进行并发测试,会有很大几率出现重复数据的插入。
在使用memcache锁后,用ab进行并发测试,已经解决了上述问题
git reset 掉的代码如何找回
可以使用以下命令
git reflog
52a0ed7 HEAD@{25}: checkout: moving from vipv2 to 52a0ed74630feeb471e59d8d100304b61abcbce1^0 b6f1023 HEAD@{26}: commit: 抽奖消耗积分总计表 2621edf HEAD@{27}: rebase finished: returning to refs/heads/vipv2 2621edf HEAD@{28}: pull --rebase origin vipv2: vip抽奖算法、领取vip礼券 c428408 HEAD@{29}: checkout: moving from vipv2 to c4284082fa64a14bacc9b0fff07277fc911fdf5a^0 b1d4dd2 HEAD@{30}: commit: vip抽奖算法、领取vip礼券 1af22e3 HEAD@{31}: rebase finished: returning to refs/heads/vipv2 1af22e3 HEAD@{32}: checkout: moving from vipv2 to 1af22e3df26beb6294280c682d8faab13d2e4d93^0 926712d HEAD@{33}: rebase finished: returning to refs/heads/vipv2
找到丢失的提交号
然后最傻瓜的方式可以使用
git cherry-pick b1d4dd2
jerseys sport-official sports jerseys
From China’s affordable, quality assurance of cheap shirts big run!
First we need to know is that our company has the greatest cheap jersey international-based sales network, if you buy cheap jerseys from us, we can help you save at least 60% of the price and we can guarantee that all freight borne by us, the consumer who is not dig and freight!
With the promotion of ball games, and its related products are also increasingly international, including shirts, ball caps, socks and shoes and other equipment, the network which acts as a very good medium, then we produce cheap shirts We have a lot of outstanding brands, including Adidas, JOMA, Nike, Puma, soldiers and so on.
We signed a sales agreement with the manufacturers, all export shirts are shipped directly from the production line to your home, which is in the middle will not have anyone charge you fees or touch your shirt. Cheap shipping is our guarantee, you only need to provide your body height we will be able to provide you with the quickest and easiest to report!
Come to talk about our cheap jerseys it, we all know that China is the world’s ancient silk products a big country, we cheap jerseys produce cheap shirts can help you keep cool on the court, but on the pitch you can keep cool is to win a major factor! We are using polyester cotton jersey can quickly draw your body sweat,
So you can beat the opponent on the shirt!
A smart consumer will choose the appearance and quality of the goods themselves, and make informed judgments. Our cheap jerseys these two are able to ensure that our shirts are very cheap jerseys unique in the details, no http://www.innathydepark.com/cheap-jerseys-free-shipping.html matter what your body type is what we can for you to make a suitable cheap jersey. Style and diverse, each team uniforms we have here the original and contains a lot of silk shirts, can be repeated washing,
so clothing is definitely a value for money! Favorite quickly click to buy it!
Related Articles:
- Wholesale NFL Jerseys-Wholesale jerseys online shop
- Cheap jerseys from China, all goods free shipping!
- Cheap Authentic MLB Jerseys With Paypal From China
- Cheap jerseys from China – Clearance sold!
- The Ultimate Guide to buy cheap jerseys
- Cheap jerseys from China – Clearance sold!
- Cheap Nfl Nba Nhl Mlb Jerseys Free Shipping From China
- Cheap Soccer Jerseys, Uniforms & Shirts On Sale
php过滤html标签
php过滤html的函数:strip_tags(string) 这样就可以过滤掉所有的html标签了。
如果想过滤掉除了<img src=””>之外的所有html标签,则可以这样写:strip_tags(string,”<img>”);
过滤除了<img src=””><p>xxx</p><b></b>之外的所有html标签,则可以这样写:strip_tags(string,”<img><p><b>”);