摘要: JavaBean是一种可重复使用、且跨平台的软件组件。JavaBean可分为两种:一种是有用户界面的另外一种是是没有用户界面的,主要负责处理事务(如数据运算,操纵数据库)的JavaBean。Jsp通常访问的是后一种JavaBean。JSP和JavaBean搭配使用的优点:1.使得HTML与JAVA程... 阅读全文
posted @ 2015-06-18 14:18 tilly_chang 阅读(777) 评论(0) 推荐(0) 编辑
摘要: 引言: 有种特殊情况,当两个类需要相互引用形成一个”环形“引用时,无法先定义使用。 这时候需要用到前向申明但是前向申明的类不能实例化。 1 #pragma once 2 3 #include "B.h" 4 class A 5 { 6 public: 7 A(); 8 ~A();... 阅读全文
posted @ 2015-06-17 22:02 tilly_chang 阅读(673) 评论(0) 推荐(0) 编辑
摘要: sevlet response有一个重定向的方法我们先介绍一下。1.HttpServletResponse对象的sendRedirect(String local)方法称作重定向。如果location地址前面加上"/",则表示相对于Servlet容器的根来请求,即http://localhost:8... 阅读全文
posted @ 2015-06-11 17:07 tilly_chang 阅读(231) 评论(0) 推荐(0) 编辑
摘要: 1.本文分析一下request对象中getParameter方法及getAttribute的差异及使用场景。这个关系到servlet的生命周期很简单的一个例子,上代码页面1 :request1.jsp 1 2 6 7 8 9 110 11 12 13 ... 阅读全文
posted @ 2015-06-03 17:32 tilly_chang 阅读(427) 评论(0) 推荐(0) 编辑
摘要: 回顾一下生产者消费者模型。 #include #include #include #include #include #include #include #define ERR_EXIT(m) \ do { \ perror(m);\ exit(EXIT_FAILURE);\ }while(0) #define CONSUMER... 阅读全文
posted @ 2015-03-16 14:46 tilly_chang 阅读(237) 评论(0) 推荐(0) 编辑
摘要: 创建一个新的线程 int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg); thread:返回线程ID attr:设置线程的属性,attr为NULL表示使用默认属性。 s... 阅读全文
posted @ 2015-03-14 14:47 tilly_chang 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 关于内存共享的几个函数 1.用来创建一个共享内存 int shmget(key_t key, size_t size, int shmflg); key:这个共享内存的段的名字 size:共享内存的大小 shmflg:由九个权限标志构成,它们的用法和穿件文件时使用的mode权限一样 成功返回非负整数,即该内存共享端的标识码;失败返回-1; int main(int argc, ... 阅读全文
posted @ 2015-03-12 14:00 tilly_chang 阅读(195) 评论(0) 推荐(0) 编辑
摘要: server端代码: server 从队列的mtype=1接收数据 在发到mtype=pid(client的进程id) #include #include #include #include #include #include #include #define MSGMAX 8192 #define ERR_EXIT(m) \ do { ... 阅读全文
posted @ 2015-03-01 18:25 tilly_chang 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 介绍: 1.消息队列提供了一个从一个进程向另外一个进程发送数据块的方法 2.每个数据块都被认为是有一个类型,接收者进程接收的数据块可以有不同的类型值 3.消息队列也有管道一样的不足,就是每个消息最大的长度是有上限的(MSGMAX),每个消息队列 的总的字节数是有上限的(MSGMNB),系统上消息队列的总数也是有一个上限的。 每个IPC对象都在内核维护着一个数据结构, 消息不同于刘... 阅读全文
posted @ 2015-03-01 15:47 tilly_chang 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 1.socketpair 2.sendmsg/recvmsg 3.UNIX域套接字传递描述字 功能:创建一个圈双工的流管道 原型: int socketpair(int domain, int type, int protocol, int sv[2]); 参数 domain :协议家族 type: 套接字种类 protocol:协议种类 sv:返回的套接字... 阅读全文
posted @ 2015-02-27 14:49 tilly_chang 阅读(620) 评论(0) 推荐(0) 编辑