safari网站全屏
用户需要在Safari手动将网站添加到主屏幕后才能够实现网站全屏。具体方式是在
里面添加如下内容:您可能已经知道这-但你可以摆脱地址栏 with:document.body.onload = function(){setTimeout(“window.scrollTo(0,1);”,100) ;} ;
要创建一个本机应用程序更的假象,你可以禁用滚动:document.body.ontouchmove =功能(E){e.preventDefault ();};
nginx的一个安装脚本
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
ldconfig
/usr/sbin/groupadd web
/usr/sbin/useradd -g web web
mkdir soft
cd soft
wget http://www.nginx.org/download/nginx-1.1.7.tar.gz
tar -zxvf nginx-1.1.7.tar.gz
wget http://wiki.nginx.org/images/7/78/Ngx_http_log_request_speed.tar.gz
wget https://nodeload.github.com/giom/nginx_accept_language_module/tarball/master –no-check-certificate -O nginx_accept_language_module.tar.gz
cd nginx-1.1.7
cd contrib
wget http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip
perl geo2nginx.pl < GeoIPCountryCSV.zip >geo.conf
cd ..
tar -zxvf ../Ngx_http_log_request_speed.tar.gz
tar -zxvf ../nginx_accept_language_module.tar.gz
sed -i -e ‘s/”nginx/”mws/g’ -e ‘s/1\./2\./g’ -e ‘s/”NGINX/”MWS/g’ src/core/nginx.h
./configure –prefix=/usr/local/nginx/ –with-http_stub_status_module –with-http_ssl_module –with-http_realip_module –add-module=ngx_http_log_request_speed –add-module=ngx_http_set_lang
make && make install
javascript解析lyric文件
http://directguo.com/code/lrc/
solr tomcat utf8搜索乱码
redirectPort="8443" URIEncoding="UTF-8" />
加了URIEncoding=”UTF-8″ 就好了。。
Segmentation fault php debug
调试个脚本程序,总是报这个,烦死我了
echo core > /proc/sys/kernel/core_pattern
ulimit -c unlimited
继续执行脚本
Segmentation fault (core dumped)
找到core文件
gdb /usr/local/php/bin/php core.1725
Program terminated with signal 11, Segmentation fault.
#0 0x000000000070bcd2 in gc_zval_possible_root (zv=0xfb0cec0) at /root/install/php-5.3.8/Zend/zend_gc.c:143
143 GC_ZOBJ_CHECK_POSSIBLE_ROOT(zv);
大体知道怎么回事。。
org.apache.solr.common.SolrException: Error loading class ‘solr.VelocityResponseWriter’ at org.apache.solr.core.SolrResourceLoader.findClass
solr 3.1 安装 多个core的时候由于在example里面加了一级目录,所以全部报错!
org.apache.solr.common.SolrException: Error loading class ‘solr.VelocityResponseWriter’ at org.apache.solr.core.SolrResourceLoader.findClass
在core0/conf/solrconfig.xml里面
前面要多加一层../
加完了还是不好用,我干脆给他disable吧。。
关了这个,最后好了。。nnd..
mmseg4j solr 3.1安装
http://code.google.com/p/mmseg4j/
下载最新版本
unzip 到mm目录
cp data /usr/local/solr/example/solr/data
cp dist /usr/local/solr/example/dist
cp mmseg4j-all-1.8.5.jar /usr/local/tomcat/webapp/solr/lib/
可能需要mkdir lib这个目录
SEVERE: org.apache.solr.common.SolrException: Error loading class ‘com.chenlb.mmseg4j.solr.MMSegTokenizerFactory’
应该是lib放错了位置
放到solr_home中就好了
放到/usr/local/solr/example/solr/lib(lib要建立)
然后重启,就好了

rz sz 安装
http://ohse.de/uwe/releases/lrzsz-0.12.20.tar.gz
http://ohse.de/uwe/software/lrzsz.html
这东西装完以后指令是lrz lsz….
给入array(数组)搜寻键值,将其unset
//给入DATA搜寻键值,将其unset
//数据 , 查找的键值 , 最大搜索深度
function clearByKey(&$data,$keyName,$maxSearch) {
$maxSearch--;
if ($maxSearch < 0) return;
foreach ( $data as $key => &$val ) {
if ( $key == $keyName ) {
unset ($data[$key]);
}
elseif ( is_array ($val) ) {
clearByKey($val,$keyName,$maxSearch);
}
}
}
php redis的一个client
https://github.com/nicolasff/phpredis
php.ini不能被识别
phpinfo()里面打出的php.ini路径下有php.ini但是load里面是空
查看php-fpm的用户,chown php.ini用户 chmod php.ini 重启php-fpm 搞定。。
这个问题很奇怪,改完了以后,还是有的时候好有的时候坏了,头疼
php指令行上,可以使用php -c /usr/local/etc/php.ini 来代替之前的php指令
我还修改了/usr/bin/php-fpm (或者你的启动脚本在service里面)
php_opts=”–fpm-config $php_fpm_CONF -c /usr/local/etc/php.ini”
仿ga的一个php开源代码
http://piwik.org/download-guide/
很基础的一个功能。
nginx 复杂逻辑配置思路
map $remote_addr $whiteList {
default 1;
182.151.205.165 0;
119.6.97.141 0;
}
set_from_accept_language $lang en ja ru it fr de es zh;
set $accLang 0$whiteList;
if ( $lang = ‘zh’ ) {
set $accLang 1$whiteList;
}
if ( $country != ‘CN’) {
set $accLang 0$accLang;
}
if ( $country = ‘CN’) {
set $accLang 1$accLang;
}
set $allowNow 0;
if ( $accLang ~ “^(.+)0$”) {
set $allowNow 1;
}
if ( $accLang = “001″) {
set $allowNow 1;
}
总的来说就是将多个条件结果拼接成010的串,然后通过正则来匹配符合条件,最终得出0或者1,这么写代码很傻,不过哦好歹我实现了:)
nginx的一个简单配置
wget http://www.nginx.org/download/nginx-1.1.7.tar.gz
tar -zxvf nginx-1.1.7.tar.gz
wget http://wiki.nginx.org/images/7/78/Ngx_http_log_request_speed.tar.gz
wget https://nodeload.github.com/giom/nginx_accept_language_module/tarball/master –no-check-certificate -O nginx_accept_language_module.tar.gz
cd nginx-1.1.7
cd contrib
wget http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip
perl geo2nginx.pl < GeoIPCountryCSV.zip >geo.conf
cd ..
tar -zxvf ../Ngx_http_log_request_speed.tar.gz
tar -zxvf ../nginx_accept_language_module.tar.gz
sed -i -e ‘s/”nginx/”mws/g’ -e ‘s/1\./2\./g’ -e ‘s/”NGINX/”MWS/g’ src/core/nginx.h
./configure –prefix=/usr/local/nginx/ –with-http_stub_status_module –with-http_ssl_module –with-http_realip_module –add-module=ngx_http_log_request_speed –add-module=ngx_http_set_lang
make && make install
userid on;
userid_name uid;
userid_domain xxx.com;
userid_path /;
userid_expires 365d;
做个gif以便分析log
location = /_.gif {
empty_gif;
expires -1;
userid on;
userid_name _x;
userid_domain milanoo.com;
userid_path /;
userid_expires 365d;
if ( $uid_set ~ “^_x=(.+)$” ) {
set $uid $1;
}
if ( $uid_got ~ “^_x=(.+)$” ) {
set $uid $1;
}
log_format albertLog ‘$remote_addr – $uid – $time_local ^-^ “$http_referer” ^-^ “$args” ^-^ $http_Accept_Language – $http_user_agent’;
if ( $http_referer ) {
access_log logs/fx.log albertLog;
}
}
php X-Powered-By 去除
修改php.ini
expose_php = Off
或者nginx header_hidden
利用nginx user 模块进行A/B test
userid on;
userid_name uid;
userid_domain milanoo.com;
userid_path /;
userid_expires 365d;
if ( $uid_set ~ “^uid=(.{9})(.)(.+)$” ) {
set $serp $2;
set $uid $1$2$3;
}
if ( $uid_got ~ “^uid=(.{9})(.)(.+)$” ) {
set $serp $2;
set $uid $1$2$3;
}
set $fa A;
if ( $serp ~ “(A|B|C|D)” ) {
set $fa B;
}
##这个也可以出C方案D方案,就和 $serp分吧,但是必须是1/16的。。
log_format main ‘$uid_got – $serp – $uid_set’; //debug Log
access_log logs/php.log main; //debug//
#####要想做a/b test对$serp进行正则即可。。###
fastcgi_pass 127.0.0.1:9000;
fastcgi_param FA $fa #将方案号传递给php $_SERVER['FA']
fastcgi_param UID $uid; #传递给php $_SERVER['UID']
处理nginx user模块的sid 获得时间戳
$str = “D616AD4D”;
$splited = str_split($str, 2);
$splited = array_reverse($splited);
$str = implode(”, $splited);
print hexdec($str);
?>
nginx 安全策略学习
http://yp.oss.org.cn/software/show_resource.php?resource_id=1030
Recent Comments