ITeye博客

非RD非PM

yuanyu5237 · 共 60 篇文章

C++ Programming Tutorial 12 char Array

#include <iostream> #include <cmath> #include <cstdlib> #include <cstring> using namespace std; int main() { char tuna[6] = {'b', 'u', 'c', 'k', 'y', '\0'}; cout << tuna << endl; char bacon[] = "bacon mmmm good"; cout << bacon << endl; cout << strlen(bacon) << endl; cin.get(); return 0; }

2014-07-03 15:28 · 评论(0)

C++教程60 类模板

#include <iostream> using namespace std; template <class T> class Bucky{ T first, second; public: Bucky(T a, T b) { first = a; second = b; } T bigger(); }; template <class T> T Bucky<T>::bigger() { return (first>second?first:second); } int main() { Bucky <int> bo(69, 105); cout << bo.bigger() << en…

2014-07-03 15:12 · C/C++ · 评论(0)

C++教程59 函数模板

#include <iostream> using namespace std; template <class FIRST, class SECOND> FIRST smaller(FIRST a, SECOND b) { return (a<b?a:b); } int main(){ int x = 89; double y = 56.78; cout << smaller(x, y) << endl; }

2014-07-03 15:07 · C/C++ · 评论(0)

nginx源码分析 好的资料

0.1.0 source code: http://hg.nginx.org/nginx/rev/551102312e19 http://hg.nginx.org/nginx/tags 内存池: http://www.alidata.org/archives/1390 http://blog.chinaunix.net/uid-24830931-id-3764858.html http://blog.csdn.net/v_july_v/article/details/7040425 http://blog.chinaunix.net/uid-24517549-id-4032067.html …

2014-01-09 00:31 · nginx · 评论(0)

nginx+node.js+mangodb+forever搭建的精准问答网站

最近用nginx+node.js+mangodb+forever搭建了一个 精准问答 网站: jingzh.com 大致的思路:用群体智慧实现答案的精准性,通过大众的力量来把一个问题的答案改进得越来越精确和实用,后人不断修正前人的观点,最初主要在程序员之间传播,不打算广泛的推广和运营,具体实现如下 1. 用户无需登录,任何人可以提问,任何人可以回答。 2. 问题发布后不能编辑,每个IP每天最多发布3个问题。 3. 每个问题的答案可以无限编辑,但每个IP每天只能编辑10次答案。 4. 只显示每个问题的最新答案,要查看答案修改历史,需要点击答案历史链接。 5. 每个问题都有标签,用户可以根据标签…

2013-12-17 11:26 · JAVA · 评论(0)

nginx源码阅读笔记-1-configure

0.7.69 configure文件源码 #!/bin/sh # Copyright (C) Igor Sysoev . auto/options . auto/init . auto/sources test -d $NGX_OBJS || mkdir $NGX_OBJS echo > $NGX_AUTO_HEADERS_H echo > $NGX_AUTOCONF_ERR echo "#define NGX_CONFIGURE \"$NGX_CONFIGURE\"" > $NGX_AUTO_CONFIG_H if [ $NGX_DEBUG = YES ]; then have=NGX_D…

2013-10-02 20:58 · nginx · 评论(0)

nutch和solr安装

vmware7+ubuntu12.04 1,下载文件nutch1.5 http://mirror.bjtu.edu.cn/apache/nutch/1.5/ solr3.6: http://mirror.bjtu.edu.cn/apache/lucene/solr/3.6.0/ 2,解压,bin/nutch需要添加可执行权限,执行后显示 Usage: nutch [-core] COMMAND 3,配置nutch: conf/nutch-site.xml 创建文件夹urls,假如文件seed.txt,在文件内加入要爬取的网站:http://www.sina.com.cn/ 修改conf/re…

2012-10-03 20:37 · JAVA · 爬虫 · 评论(0)

hadoop及mahout安装

环境:虚拟机vmware7+ubuntu12.04 1,先下载需要的文件: 【注意】:版本问题很重要 jdk,eclipse,maven hadoop: http://mirror.bjtu.edu.cn/apache/hadoop/common/hadoop-1.0.3/ 我其实先下载了0.2.0 mahout: http://labs.renren.com/apache-mirror/mahout/0.7/ 2,安装jdk,下载的rpm包,需要安装alien,然后用alien把rpm转换成deb,再使用dpkg安装 3,eclipse解压,我用的helios版 4,maven解压,配置环…

2012-10-02 12:29 · JAVA · LINUX · 评论(1)

内存拷贝函数

见下图

2012-08-14 10:44 · 面试题 · 评论(0)

简单epoll多线程服务器

学习 /* Linux 2.6 x86_64 only*/ #include <pthread.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <stdio.h> #include <fcntl.h> #include <arpa/inet.h> #include <sys/epoll.h> #include <sys/errno.h> #include <sys/socket.h> #define THREAD_MAX 20 #define LISTEN_MAX 20 #define SERVE…

2012-07-30 15:14 · C/C++ · 评论(3)

简单epoll服务器

学习 #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <string.h> #include <sys/types.h> #include <netinet/in.h> #include <sys/socket.h> #include <sys/wait.h> #include <unistd.h> #include <arpa/inet.h> #include <openssl/ssl.h> #include <openssl/err.h> #include <fcntl.h> #include <sys…

2012-07-30 15:04 · C/C++ · 评论(0)

一个多进程框架

从别处找来的,记一下,学习~ /*============================================================================= # # Description: 多进程的一个框架,大家可以直接使用,已经经过功能测试和压力测试。 # 编译:g++ forkwork_use.cpp -o forkwork_use # =============================================================================*/ #include <iostream> #include <…

2012-07-30 12:04 · C/C++ · 评论(0)

linux下使用oracle instantclient远程连接服务器

我使用securecrt远程到服务器上,想从这台服务器访问另外一台机器上的oracle。用的是redhat,64位机器。服务器上的oracle版本11.2。 1,先下载软件, http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html 因为我既想用sqlplus访问,又想写php程序访问,所以下载了: oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.…

2012-07-05 10:22 · database & sql · 评论(0)

css浏览器兼容性等笔记[长期更新]

1,很多时候如果不在html页面顶部添加dtd,就会出现很多奇怪的问题,典型的是IE中的文字和内容无法居中,具体dtd详解请参见: http://www.w3school.com.cn/tags/tag_doctype.asp 2,IE中margin浮动产生双倍距离:此时使用display:inline 3,IE中字体可无限小,但chrome最小为12px,所以为了兼容,最好字体大于等于12px 4,IE中没有min-width,有时候为了使容器的大小固定,可以同时设置3个属性,width,min-width,max-width相等 5,文字换行,一般可word-wrap:break-wor…

2012-06-29 10:24 · 面试题 · 评论(0)

mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication

我在使用easyPHP的时候,连mysql连不上,报错 写道 mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication 原因应该是密码长度或者格式不对,解决办法: SET old_passwords = 0; UPDATE mysql.user SET Password = PASSWORD('testpass') WHERE User = 'testuser' limit 1; SELECT LENGTH(Password) FROM mysql.user WHERE User = 'testuse…

2012-06-14 09:45 · database & sql · 评论(0)