自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(64)
  • 收藏
  • 关注

原创 UNIX网络编程(1)-简介

1.bzero函数bzero 等同于memset(void * str,0,size_t n)  2.inet_pton函数inet_pton将点分十进制的IP地址转为网络字节序的地址,如inet_pton(AF_INET, "202.182.0.25",&servaddr.sin_addr) 3.time()函数c标准函数库函数,返回从1970-01-01...

2011-10-06 17:31:21 99

原创 UNIX编程(15)-进程间通信

. 管道 #include <unistd.h>int pipe(int filedes[2]); Returns: 0 if OK, 1 on error参数filedes返回两个文件描述符:filedes[0]为读而打开,filedes[1]为写而打开。 例:经由管道父进程向子进程传递数据#include...

2011-08-07 12:09:21 134

原创 UNIX编程(14)-高级IO

1.非阻塞IO对于一个给定的描述符有两种方法对其指定非阻塞IO1)如果调用open获得描述符,则可指定O_NONBLOCK标志2)对于一个已经打开的描述符,则可调用fcntl由该函数打开O_NONBLOCK文件状态标志 #include "apue.h"#include <errno.h>#include <fcntl.h>char ...

2011-08-03 21:36:40 131

原创 UNIX编程(13)-守护进程

1.守护进程的编程规则1)用umask将文件模式创建屏蔽字设置为02)调用fork,然后使父进程退出3)调用setsid创建一个新会话4)将当前工作目录更改为根目录5)关闭不再需要的的文件描述符6)某些守护进程打开/dev/null使其具有文件描述符0,1,2,例:初始化一个守护进程  #include "apue.h"#include <sysl...

2011-08-02 21:59:15 98

原创 UNIX编程(12)-线程控制

1.线程限制某些系统有线程的限制,可以通过sysconf函数来查询2.线程属性如想修改线程的属性,则可以在pthread_create调用时,传递pthread_attr_t类型指针参数   #include <pthread.h>int pthread_attr_init(pthread_attr_t *attr);int pthr...

2011-07-27 15:26:52 108

原创 UNIX编程(11)-线程

1.线程标识每个线程都有一个线程ID,线程ID只在它所属的进程环境有效线程ID比较函数 #include <pthread.h>int pthread_equal(pthread_t tid1, pthread_t tid2); Returns: nonzero if equal, 0 otherwise线程获得自...

2011-07-27 14:34:35 104

原创 UNIX编程(10)-信号

1.signal函数  #include <signal.h>void (*signal(int signo, void (*func)(int)))(int); Returns: previous disposition of signal (see following) if OK, SIG_ERR on error一...

2011-07-20 21:18:41 99

原创 UNIX编程(9)-进程关系

1.终端登录2.网络登录3.进程组 #include <unistd.h>pid_t getpgrp(void); Returns: process group ID of calling process #include <unistd.h>pid_t getpgid(pid_t...

2011-07-12 14:41:58 103

原创 UNIX编程(8)-进程控制

1.进程标识符每个进程都有一个非负整数表示的唯一进程ID  #include <unistd.h>pid_t getpid(void); Returns: process ID of calling process pid_t getppid(void); Returns: parent p...

2011-07-09 11:37:12 127

原创 tomcat JAVA_OPTS配置

JAVA_OPTS="$JAVA_OPTS -Xmx1024M -Xms1024M -Xmn512M -XX:PermSize=128M -XX:MaxPermSize=128M -Xss256K -XX:+DisableExplicitGC -XX:SurvivorRatio=1 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSParallelR...

2011-07-08 16:04:10 326

原创 UNIX编程(7)-进程环境

1.main 函数c程序总是从main函数开始执行,当内核执行c程序时,在调用main前先调用一个特殊的启动例程,启动例程从内核获得命令行参数和环境变量值,然后为按上述方式调用main做好安排2.进程终止有8种方式使进程终止:1)从main返回2)调用exit3)调用_exit或_Exit4)最后一个线程从其启动例程返回5)最后一个线程调用pthread_exit...

2011-07-01 15:07:55 83

原创 UNIX编程(6)-系统数据文件和信息

1.口令文件口令文件存储在/etc/passwd中,是一个ASCII文件用用户名或UID获取passwd结构体信息的函数#include struct passwd *getpwuid(uid_t uid);struct passwd *getpwnam(const char *name);获取口令文件中所有内容#include struct pas...

2011-06-28 16:35:25 100

原创 UNIX编程(5)-标准IO库

1.流的定向freopen函数清除一个流的定向,fwide设置流的定向#include #include int fwide(FILE *fp, int mode);如果mode的参数值为负,fwide将试图使指定的流是字节定向的。如果mode的参数值为正,fwide将试图使指定的流是宽定向的。如果mode的参数值为0,fwide将不试图设置流的定向, 但返回标...

2011-06-27 16:55:33 86

原创 UNIX编程(4)-文件和目录

1.stat,fstat,lstat函数#include int stat(const char *restrict pathname, struct stat *restrict buf);int fstat(int filedes, struct stat *buf);int lstat(const char *restrict pathname, struct...

2011-06-23 16:56:33 118

原创 UNIX编程(3)-文件IO

1.open函数#include int open(const char *pathname, int oflag, .../*mode_t mode */);oflag参数:O_RDONLY 只读打开O_WRONLY 只写打开O_RDWR 读写打开这三个必须指定一个下面是可选的:O_APPEND 每次写时都追加到文件的尾端O_CREAT 若此...

2011-06-21 17:45:26 95

原创 UNIX编程(2)-UNIX标准化

1.ISO c2.IEEE POSIX3.Single UNIX Specification (XSI)4.查看系统限制的函数#include long sysconf(int name);long pathconf(const char *pathname, int name);long fpathconf(int filedes, int name)...

2011-06-15 11:41:40 88

原创 UNIX编程(1)-基础知识

1.登陆名登陆名放在/etc/passwd口令文件中,口令文件中的登陆项由7个以冒号分隔的字段组成,他们是:登陆名,加密口令,用户ID,用户组ID,注释字段,起始目录,shell程序daemon:x:2:2:daemon:/sbin:/sbin/nologin2.文件和目录例:列出目录中所有的文件[code="c"]#include "apue.h"#include ...

2011-06-15 10:54:40 113

原创 mysql忘记root密码处理重置

mysql忘记root密码处理重置如果 MySQL 正在运行,首先结束mysql进程: killall mysqld 启动 MySQL (非正常方式起动):/usr/local/mysql/bin/mysqld_safe –skip-grant-tables & 这样就可以不需要密码进入 MySQL :/usr/local/mysql/bin/mysql -u root -p (要...

2011-05-20 17:39:00 73

原创 java编译和打包

javac -classpath hadoop-*-core.jar -d playground/classes➥ playground/src/WordCount.javajar -cvf playground/wordcount.jar -C playground/classes/

2011-05-20 14:38:07 254

原创 android3.1开发环境配置

1. 安装JDK1.6+2. 安装eclipse3.5+3. 下载sdkhttp://developer.android.com.nyud.net/sdk/index.html我下载的是android-sdk_r11-windows.zip地址:http://dl.google.com/android/android-sdk_r11-windows.zip下载完后解压到D:...

2011-05-16 17:09:19 109

原创 hadoop-0.21.0安装

[color=red]1. 准备机器:总共三台机器192.168.200.102 xen(namenode,jobtracker)192.168.200.88 vps79(datenode,tasktracker)192.168.200.88 vps78(datenode,tasktracker)2. 修改hosts 文件三台机器的hosts(/etc/hosts...

2011-05-16 16:22:16 80

原创 mysql导出数据为excel

1.导出select * from test outfile '/tmp/reg.xls'将导出数据放在/tmp目录下2.编码转换因为excel默认编码是GB3212,数据中有中文是需进行转换,转换命令iconv -futf8 -tgb2312 -oreg2.xls reg.xls转换如果失败:iconv: illegal input sequence at posi...

2011-04-28 13:23:05 113

原创 solr1.4使用(6)- dismax request handler

dismax 的几个配置的说明1.tie,增加得分的,一般值为0.12.3.pf4.bf5.qs6.ps

2010-08-28 22:10:57 90

原创 solr1.4使用(5)- 函数查询

函数查询就是导入一个计算得分的组件。他不是用来代替lucene的得分算法,而是增加到现存的得分。函数查询的两种方式:1.用standard request handler和_val_ 假字段可以使用函数查询的字段的注意事项1)字段必须indexed2)字段不能是multi-valued3)在文本分析中不超过一个词被索引4)仅数字字段的值可以直接被函数引用5)如果被索...

2010-08-28 21:49:59 115

原创 solr1.4使用(4)- 查询参数

solr查询请求参数:1.q:查询字符串2.q.op: and 或者or,说明是所有的词都必须匹配还是只要其中一个词匹配。如无说明,则缺省在schema.xml中设置。3.df:缺省的搜索field,如无说明,则在schema.xml中设置4.deftType:查询解析器,缺省lucene5.fq:查询过滤6.qt:查询类型,指定查询hanlder7.start:从搜索...

2010-08-14 18:18:12 92

原创 solr1.4使用(3)- 创建索引

一.solr 创建索引所需文件的格式:1.xml格式test.xml5432a2.binary格式仅solrj可用3.csv格式4.pdf,doc,xls,ppt等格式5.数据库直接导入(DIH)二、创建索引的方式1.http://localhost:8983/solr/update -H 'Content-type:text/xml; ...

2010-08-08 16:48:30 120

原创 solr1.4使用(2)-schema.xml说明

[code="xml"] ...

2010-08-01 23:01:12 113

原创 solr1.4使用(1)-solr安装和启动

1.安装JDK1.5+2.下载solrsolr下载地址:http://www.apache.org/dyn/closer.cgi/lucene/solr/,目前最新版本1.4.13.解压apache-solr-1.4.1至/usr/local下。4.启动 首先切换目录到example目录下,命令:cd /usr/local/apache-solr-1.4.1/example...

2010-07-02 09:49:14 111

原创 状态模式

[img]http://dl.iteye.com/upload/attachment/269572/785d09e9-7592-3657-9ab6-2cafb3538794.png[/img]Allow an object to alter its behavior when its internal state changes. The object will appear to cha...

2010-06-27 22:10:56 73

原创 观察者模式

[img]http://dl.iteye.com/upload/attachment/269570/b9ee5099-cf97-373a-bd29-14ee34ca47fa.png[/img]Define a one-to-many dependency between objects so that when one object changes state, all its depen...

2010-06-27 22:09:54 87

原创 备忘录模式

[img]http://dl.iteye.com/upload/attachment/260432/6124e75a-f518-3e99-b786-f1f285cdbb6f.png[/img]Without violating encapsulation, capture and externalize an object's internal state so that the ob...

2010-06-06 20:44:22 73

原创 中介者模式

[img]http://dl.iteye.com/upload/attachment/260423/7db0f907-fa26-3327-8369-f15c7e60c2b4.png[/img]Define an object that encapsulates how a set of objects interact. Mediator promotes loose coupling...

2010-06-06 20:18:00 91

原创 迭代器模式

[img]http://dl.iteye.com/upload/attachment/257220/7b7f00e7-2b64-33d4-a8c0-30d8d6c21159.png[/img] Provide a way to access the elements of an aggregate object sequentially without exposing its under...

2010-05-30 14:47:23 71

原创 解释器模式

[img]http://dl.iteye.com/upload/attachment/257218/5818ea4d-007c-3dff-9e27-6bd68ef62cbe.png[/img]Given a language, define a representation for its grammar along with an interpreter that uses the re...

2010-05-30 14:33:59 96

原创 命令模式

[img]http://dl.iteye.com/upload/attachment/250444/ab361d5e-979d-3b47-9aaa-85f214cacacc.png[/img] Encapsulate a request as an object, thereby letting you parameterize clients with different request...

2010-05-16 21:12:16 62

原创 责任链模式

[img]http://dl.iteye.com/upload/attachment/250430/4ae43fc9-5d83-3ece-a2e0-904229eecc9f.png[/img]Avoid coupling the sender of a request to its receiver by giving more than one object a chance to ha...

2010-05-16 20:49:45 93

装饰模式

[img]http://dl.iteye.com/upload/attachment/244154/a7a787c2-2151-3b5b-a1b0-e0bb9b279d68.png[/img]Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternati...

2010-05-04 14:00:44 55

组合模式

[img]http://dl.iteye.com/upload/attachment/244148/7c643938-81e7-3efe-b8b6-cae74a152201.png[/img]Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients tre...

2010-05-04 13:46:03 70

桥梁模式

[img]http://dl.iteye.com/upload/attachment/243998/7442eea6-3785-3db5-9be5-39e2047b42ba.png[/img]Decouple an abstraction from its implementation so that the two can vary independently.

2010-05-03 22:19:05 80

适配器模式

[img]http://dl.iteye.com/upload/attachment/243984/96034d37-6559-3b0a-b014-777483cd9381.png[/img] Convert the interface of a class into another interface clients expect. Adapter lets classes work t...

2010-05-03 22:06:31 77

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除