C0015,好帮手CA4001,320×240,ARM,COM6 4800 C0017,好帮手CA3126,4 […]
提车时注意事项
一、合格证说明说等 *)出厂日期(必须是一个月内生产的) *)车架号 *)发动机号 *)产品合格证(号码与车架 […]
ownCloud的Nginx配置
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 58 59 60 61 62 63 64 65 66 67 |
upstream php-handler { server 127.0.0.1:9000; #server unix:/var/run/php5-fpm.sock; } server { listen 80; server_name example.com; return 301 https://$server_name$request_uri; } server { listen 443 ssl; server_name example.com; ssl_certificate /etc/ssl/nginx/cert.pem; ssl_certificate_key /etc/ssl/nginx/cert.key; root /var/www; client_max_body_size 1000M; # set max upload size fastcgi_buffers 64 4K; # ownCloud blacklist location ~ ^/owncloud/(?:\.htaccess|data|config|db_structure\.xml|README) { deny all; error_page 403 = /owncloud/core/templates/403.php; } location / { index index.html; } location /owncloud/ { error_page 403 = /owncloud/core/templates/403.php; error_page 404 = /owncloud/core/templates/404.php; rewrite ^/owncloud/caldav(.*)$ /remote.php/caldav$1 redirect; rewrite ^/owncloud/carddav(.*)$ /remote.php/carddav$1 redirect; rewrite ^/owncloud/webdav(.*)$ /remote.php/webdav$1 redirect; rewrite ^(/owncloud/core/doc[^\/]+/)$ $1/index.html; # The following rules are only needed with webfinger rewrite ^/owncloud/.well-known/host-meta /public.php?service=host-meta last; rewrite ^/owncloud/.well-known/host-meta.json /public.php?service=host-meta-json last; rewrite ^/owncloud/.well-known/carddav /remote.php/carddav/ redirect; rewrite ^/owncloud/.well-known/caldav /remote.php/caldav/ redirect; try_files $uri $uri/ index.php; } location ~ \.php(?:$|/) { fastcgi_split_path_info ^(.+\.php)(/.+)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param HTTPS on; fastcgi_pass php-handler; } # Optional: set long EXPIRES header on static assets location ~* ^/owncloud(/.+\.(jpg|jpeg|gif|bmp|ico|png|css|js|swf))$ { expires 30d; access_log off; # Optional: Don't log access to assets } } |
CentOS7 Nginx FastCGI sent in stderr: “Primary script unknown”
Hello world!
将被O2O模式改造的6大行业:衣食住行、变美、咨询
那些将被O2O改造的6个行业有几个共同点:1,受众也就是潜在用户对互联网接受程度高;2,这些行业提供的服务或者 […]
利用proxychains在终端使用socks5代理
项目主页:https://github.com/rofl0r/proxychains-ng Linux下使用 […]
解决禅道zentaopms用IP无法访问SVN源码
原因: SVN访问采用https配置,用ip访问时https无法显示,需要认证 解决: 禅道中访问svn源码时 […]
VisualSVN Server配置禁止IP访问
在安装目录下\VisualSVN Server\conf 更改httpd.conf加入 Include con […]
Maven发布文件包括jar、pom、source及javadoc
首先检查maven deploy plugin版本,有部分属性是高版本才能用,可以查看文档:http://ma […]
解决Jetty找不到jar包中tld文件
使用spring-mvc框架时,jetty找不到spring.tld和spring-form.tld 只能把s […]
读取Java文件到byte数组的三种方式
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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.RandomAccessFile; import java.nio.ByteBuffer; import java.nio.MappedByteBuffer; import java.nio.channels.FileChannel; import java.nio.channels.FileChannel.MapMode; public class FileUtils { /** * the traditional io way * @param filename * @return * @throws IOException */ public static byte[] toByteArray(String filename) throws IOException{ File f = new File(filename); if(!f.exists()){ throw new FileNotFoundException(filename); } ByteArrayOutputStream bos = new ByteArrayOutputStream((int)f.length()); BufferedInputStream in = null; try{ in = new BufferedInputStream(new FileInputStream(f)); int buf_size = 1024; byte[] buffer = new byte[buf_size]; int len = 0; while(-1 != (len = in.read(buffer,0,buf_size))){ bos.write(buffer,0,len); } return bos.toByteArray(); }catch (IOException e) { e.printStackTrace(); throw e; }finally{ try{ in.close(); }catch (IOException e) { e.printStackTrace(); } bos.close(); } } /** * NIO way * @param filename * @return * @throws IOException */ public static byte[] toByteArray2(String filename)throws IOException{ File f = new File(filename); if(!f.exists()){ throw new FileNotFoundException(filename); } FileChannel channel = null; FileInputStream fs = null; try{ fs = new FileInputStream(f); channel = fs.getChannel(); ByteBuffer byteBuffer = ByteBuffer.allocate((int)channel.size()); while((channel.read(byteBuffer)) > 0){ // do nothing // System.out.println("reading"); } return byteBuffer.array(); }catch (IOException e) { e.printStackTrace(); throw e; }finally{ try{ channel.close(); }catch (IOException e) { e.printStackTrace(); } try{ fs.close(); }catch (IOException e) { e.printStackTrace(); } } } /** * Mapped File way * MappedByteBuffer 可以在处理大文件时,提升性能 * @param filename * @return * @throws IOException */ public static byte[] toByteArray3(String filename)throws IOException{ FileChannel fc = null; try{ fc = new RandomAccessFile(filename,"r").getChannel(); MappedByteBuffer byteBuffer = fc.map(MapMode.READ_ONLY, 0, fc.size()).load(); System.out.println(byteBuffer.isLoaded()); byte[] result = new byte[(int)fc.size()]; if (byteBuffer.remaining() > 0) { // System.out.println("remain"); byteBuffer.get(result, 0, byteBuffer.remaining()); } return result; }catch (IOException e) { e.printStackTrace(); throw e; }finally{ try{ fc.close(); }catch (IOException e) { e.printStackTrace(); } } } } |
关于iOS Push Notification的响应问题
简单总结一下推送消息的相应情况 1. 当程序处于关闭状态收到推送消息时,点击图标会调用- (BOOL)appl […]
设置XCode工程的Build编号与svn保持一致
在XCode中选择TARGETS–Build Phase–Add Build Phas […]
WIN7下黑苹果懒人版硬盘安装not a HFS partition注意问题
1 分区时不要格式化,有人提出用FAT,WIN7没有格式化FAT选项,所以不格式化,分配一个卷标就行了 2 以 […]
Vsftpd配置虚拟目录
用vsftp来配置访问其它目录, 比如: /home/a 映射为 ftp://localhost/a /hom […]
VisualSVN Server限制内网访问某些版本库
因为VisualSVN Server采用Apache作为服务器,因此可以设置Apache的访问限制。 在安装完 […]
Mac远程桌面链接Windows
一直用Mac的Royaltsx连接各种终端,今天连接Windows7旗舰版的时候,突然无法连接了,账户和密码正 […]
Mysql Access denied for user ‘root’@’localhost’ (using password:YES) 解决方案
输入“mysql -uroot -pmyadmin”后出现以下错误: “Access denied for u […]
ThinkPHP的Url链接美化
例如你的原路径是 http://localhost/test/index.php/index/add 那么现在 […]
谈mysql中utf8和utf8mb4区别
一、简介 MySQL在5.5.3之后增加了这个utf8mb4的编码,mb4就是most bytes 4的意思, […]
应用服务器配置SSL证书 + HTTPS站点
一、Nginx 1,生成SSL证书 2,nginx配置 [crayon-686676e639216153169 […]
利用openssl生成ssl服务器证书
0. 前期准备工作
1 2 3 4 5 6 7 8 9 |
cd ~/ mkdir ssl cd ssl mkdir demoCA cd demoCA mkdir newcerts mkdir private touch index.txt echo '01' > serial |
1. 制件 CA 证书 […]
Yii2前后台启用UrlManager以及.htaccess的设置方法
下载了Yii2 Advanced之后,启动一看,发现其默认是不启用UrlManager的。Url还是Get式的 […]
Mac OS X mysql_connect报告“No such file or directory”错误的解决方法
今天在MacBookPro上安装wordpress时,安装程序一直报错说连不上数据库。mysql客户端可以正常 […]
linux expect自动登录ssh,ftp
expect是一种能够按照脚本内容里面设定的方式与交互式程序进行“会话”的程序。根据脚本内容,Expect可以 […]