Centos6.5手动升级GCC
服务器需要安装opencc,编译需要gcc4.6以上版本,而centos6.5默认只能到4.4,所以需要手动升… Read More »
服务器需要安装opencc,编译需要gcc4.6以上版本,而centos6.5默认只能到4.4,所以需要手动升… Read More »
先说下 snowflake 的具体组成: 毫秒时间戳差值+机器编码+流水号 因为 php 不是常驻内存的,所以… Read More »
直接看代码吧
1 2 3 |
$str = '早在2008年,红旗曾展示了旗下的全新SUV概念车,该车在设计上融入了很多中国元素,例如天安门、戈之类的中国文化符号。按照红旗的规划,这款SUV将有望在2015年左右正式推出。而在本届上海车展上,我们确实看到了它的身影。'; $arr = preg_split('//u', $str, -1, PREG_SPLIT_NO_EMPTY); print_r($arr); |
看过网上的一些例子都过于复杂,包含了官方的phpsdk那一大坨东西,理论上我只需要简单的上传文件而已,不需要那… Read More »
去了趟敦煌,又拍了些照片,回来整理照片的时候,发现电脑里有原本就有20来个G的照片,而且已经不知道哪些照片都是… Read More »
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
server { listen 80; server_name test.anerg.com; root /data/www/imgtest; index default.html default.php index.php index.html; location /images/ { set $needCreateImg 0; if (!-f $request_filename) { set $needCreateImg "${needCreateImg}1"; } if ($uri ~* "/images/([0-9a-zA-Z]+)_(\d+x\d+).(gif|jpg|jpeg|png)") { set $needCreateImg "${needCreateImg}2"; } if ($needCreateImg = "012") { set $filePath "$document_root/images/$1_$2.$3"; set $originalPath "$document_root/images/$1.$3"; set $fileSize "$2"; set $fileExt "$3"; set $reqFile "$1_$2.$3"; rewrite_by_lua ' function file_exists(name) local f=io.open(name,"r") if f~=nil then io.close(f) return true else return false end end local image_sizes = {"155x155", "400x400","104x104", "50x50", "40x40", "56x56", "172x172","800x600"}; function table.contains(table, element) for _, value in pairs(table) do if value == element then return true end end return false end if table.contains(image_sizes, ngx.var.fileSize) and file_exists(ngx.var.originalPath) then local command = "gm convert " .. ngx.var.originalPath .. " -thumbnail " .. ngx.var.fileSize .. " -background white -gravity center -extent " .. ngx.var.fileSize .. " " .. ngx.var.filePath; os.execute(command); ngx.req.set_uri("/images/" .. ngx.var.reqFile, true); else ngx.exit(404); end; '; } } location = /favicon.ico { log_not_found off; access_log off; } } |
我们知道,在html的页面中,所有空格和换行符其实都会占据一定的空间,即使使用了gzip压缩,在传输过程中依然… Read More »
1 2 |
sort: sort.c:701:inittables_mb: 断言“mblength != (size_t)-1 && mblength != (size_t)-2”失败。 已放弃 |
解决方法 [crayon-5df37caf1… Read More »
注意你的运行环境,64位机器跟32位机器的代码不同 64位版本: [crayon-5df37caf1a4261… Read More »
目前项目是由多台机器在提供的,他们的代码都一致,但是我又不想写crontab去定时同步代码,因为万一服务器之间… Read More »