MyLife

记录一些关于我的点点滴滴。

InputStream、byte[] 互转

InputStream转byte[]

private byte[] getBytesFromInputStream(InputStream is) throws IOException {
ByteArrayOutputStream bytestream = new ByteArrayOutputStream();
int ch;
while ((ch = is.read()) != -1) {
bytestream.write(ch);
}
byte imgdata[] = bytestream.toByteArray();
bytestream.close();
return imgdata;
}

byte[]转InputStream

byte[] data;
InputStream is = new ByteArrayInputStream(data);

http://mingkg21.javaeye.com/blog/431067

修复Ubuntu 9.10

昨晚破解Win7失败,导致又进不来Win7了@_@,修复一下吧。
首先光碟启动Ubuntu,非安装进入Ubuntu下的控制台。

sudo mount /dev/sda6 /mnt
//如果要你的/boot是单独分区的话,需要运行以下命令
sudo mount /dev/sda6 /mnt/boot
sudo grub-install --root-directory=/mnt/ /dev/sda

进入Ubuntu系统后,在运行以下命令

sudo update-grub
sudo grub-install /dev/sda

如果你想修改启动顺序阿,启动默认时间阿,可以修改
/boot/grub/grub.cfg
这个和Grub1的配置文件有点不同,因为Ubuntu 9.10使用的是Grub2了。

GoogleWaveInvite

Google Wave邀请

今天收到了Google Wave的邀请种子,截个图纪念一下。

GoogleWaveInvite

现在Google Wave是白菜价了,没人要了。

[译]在Ubuntu或者Debian中安装PCRE库( Perl 5 Compatible Regular Expression Library )

原文地址:

Ubuntu / Debian Install PCRE Library ( Perl 5 Compatible Regular Expression Library )

http://www.cyberciti.biz/faq/debian-ubuntu-linux-install-libpcre3-dev/

I need to compile few application and I need Perl 5 Compatible Regular Expression Library (PCRE). Under CentOS I can use a package called pcre-devel, but Debian do not have the same. How do I install pcre-devel under Debian / Ubuntu Linux?

我需要编译一些应用程序,同时也需要Perl 5 兼容正则表达式库(PCRE)。在CentOs下,我可以使用一个叫pcre-devel,但是Debian可就不一样了。我怎样在Debian/Ubuntu  Linux下安装pcre-devel呢?

Perl-compatible regular expression library. PCRE has its own native API, but a set of “wrapper” functions that are based on the POSIX API are also supplied in the library libpcreposix. Note that this just provides a POSIX calling interface to PCRE: the regular expressions themselves still follow Perl syntax and semantics. The header file for the POSIX-style functions is called pcreposix.h. To install PCRE, type thy following command:

Perl兼容正则表达式库(PCRE)有自己原生API,但是这一系列封装函是基于POSIX API,而POSIX API也支持libpcreposix库。这样只要提供一个POSIX的调用接口给PCRE后,正则表达式本身仍遵循Perl的语法和语义。POSIX-style的头文件是pcreposix.h,所以,安装PCRE,需要运行以下命令。

sudo apt-get update
sudo apt-get install libpcre3 libpcre3-dev

你可能还需要安装
sudo apt-get install openssl libssl-dev

开始写Nginx的Module

首先访问Nginx下载

wget http://sysoev.ru/nginx/nginx-0.8.22.tar.gz

待续~~

参考资料:
**http://nutrun.com/weblog/hello-world-nginx-module/

http://blog.zhuzhaoyuan.com/2009/08/creating-a-hello-world-nginx-module/

http://hi.baidu.com/kissdev/blog/item/f47622de19efa75fccbf1a90.html

http://www.tech-q.cn/thread-85-1-1.html

http://www.evanmiller.org/nginx-modules-guide.html

蜘蛛猛于虎

唉,这个蜘蛛太暴力了。

124.115.4.198
124.115.0.164
124.115.0.25
124.115.0.156
124.115.0.110
124.115.0.16
124.115.0.157
124.115.4.191
124.115.4.197
124.115.0.168
124.115.0.138
124.115.0.111
124.115.0.101
124.115.0.21
124.115.0.27
124.115.0.23
124.115.0.103
124.115.4.193
124.115.0.105
124.115.0.109
124.115.0.22
124.115.0.166
124.115.0.104
124.115.0.107
124.115.0.141
124.115.4.194
124.115.0.165
124.115.4.195
124.115.0.163
124.115.4.190
124.115.0.158
124.115.0.169
124.115.0.20
124.115.0.171
124.115.4.204
124.115.0.170
124.115.0.108
124.115.4.203
124.115.4.202
124.115.0.19
124.115.0.167
124.115.0.159
124.115.0.26
124.115.0.18
124.115.0.139
124.115.0.160
124.115.0.106
124.115.4.196
124.115.0.17
124.115.0.14
124.115.4.200
124.115.4.201
124.115.0.140
124.115.4.205
124.115.0.24
124.115.4.199
124.115.0.100
124.115.4.192
124.115.0.15
124.115.0.142
124.115.0.28
124.115.0.162
124.115.0.161
124.115.0.102

论中国查封Twitter的蝴蝶效应及对全球经济的影响

欢迎光临~~