1 import java.net.InetAddress;2 3 public class T {4 public static void main(String args[]) throws Exception {5 byte[] bs = new byte[] { (byte) 1...
分类:
编程语言 时间:
2014-09-16 15:54:30
阅读次数:
220
从没用过C++STL中的exception(异常类),在使用rapidxml,操作XML文件时,发现在一个抛出异常的错误。关注了下,就模范着做。我也专门写了个函数来分配内存,如果发现分配不成功,就抛出STL中的bad_alloc异常,发现还不错,程序显得更规范些(自我觉得,呵呵)。其实了,在写程序时...
分类:
编程语言 时间:
2014-09-16 12:32:10
阅读次数:
150
转:http://blog.csdn.net/dotneterbj/article/details/8021200一个由C/C++编译的程序占用的内存分为以下几个部分1、栈区(stack)— 由编译器自动分配释放 ,存放函数的参数值,局部变量的值等。其操作方式类似于数据结构中的栈。2、堆区(heap...
分类:
其他好文 时间:
2014-09-16 12:30:50
阅读次数:
323
本文演示,使用Socket进行网络聊天之群聊,实现客户端给"局域网"网段里面的所以机器发送广播,当发送“886”的时候,表示客户端关闭。
1)客户端,给服务器发送数据,发送“886”表示关闭客户端。
2)服务器,一直监听9527端口,将监听到的数据打印在控制台上。
3)客户端+服务器版本,实现既可以发送数据,又可以接受数据的多线程聊天程序。
需要注意的几点是:1)这里是给局域网发送广播。 2)局域网广播地址:192.168.1.255 3)如果弹出Exception in thread "main" j...
分类:
编程语言 时间:
2014-09-16 10:47:20
阅读次数:
240
浅谈java异常机制
下班闲来无事,看看java基础知识,做一下总结
异常机制:是java提供的一个解决突发事件或者误操作的一种控制流程的一种解决方案
Throwable 所有错误或者异常的超类,包含两个子类Error和Exection
其中Error错误是程序无法处理的,如内存溢出、机器断电等
Exception异常包括运行时异常和编译时异常
运行时异常类均继承Run...
分类:
编程语言 时间:
2014-09-16 00:20:49
阅读次数:
277
用两个栈实现队列的效果,可以入栈,出栈,判空等。。。
实现的栈基本功能
lstack.h
#ifndef _LSTACK_H
#define _LSTACK_H
#include
using namespace std;
// 基于链式表的堆栈
class Stack {
public:
// 构造过程中初始化为空堆栈
Stack (void) : m_top (NULL) {}
/...
分类:
其他好文 时间:
2014-09-15 22:56:39
阅读次数:
481
先序遍历:
void preOrder(Node *p) //非递归
{
if(!p) return;
stack s;
Node *t;
s.push(p);
while(!s.empty())
{
t=s.top();
printf("%d\n",t->data);
s.pop();
if(t->ri...
分类:
其他好文 时间:
2014-09-15 19:36:09
阅读次数:
152
其他配置均没有任何问题,在从SQLServer2005迁移到SQLServer2012的时候一直出现这个问题
org.hibernate.exception.JDBCConnectionException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter....
分类:
数据库 时间:
2014-09-15 19:32:59
阅读次数:
221
/*to solve the problem ,i think we can use stack to maintain the numbers,and list to keep it sorted,which is very important to find the Median number....
分类:
其他好文 时间:
2014-09-15 19:07:19
阅读次数:
181
制作ssh rpm 包升级后,ssh无法登录系统,报错如下: PAM?unable?to?dlopen(/lib64/security/pam_stack.so):?/lib64/security/pam_stack.so:?cannot?open?shared?object?file:?No?such?file?or?dir...
分类:
其他好文 时间:
2014-09-15 18:01:09
阅读次数:
705