ITeye博客

mywebcode的博客

mywebcode · 共 2181 篇文章

Heibernate 入门笔记(一)---第一个demo

最近在学heibernate,是看马士兵老师的视频学的,在这里总结一下,做点笔记。关于heibernate的优点,大家可以在网上 百度,这里不做赘述,直接讲怎么使用heibernate 步骤一:新建项目,导入jar包 在这里讲一种新的导入jar包的方法,首先在myEclipse中点击windows>>preferences>>java>>Buid Path>>User Libraries 在右侧点击New ,在打开的窗口中输入"hibernate",点击OK,选择hibernate,点击Add jars,导入所需的jar包,我这里导入的比较多,大家按实际情况导入,然后点击OK; 新建一个ja…

2014-04-17 17:23 · 评论(0)

用 Map 扩展switch

#include <iostream> #include <iterator> #include <string> #include <map> using namespace std; // 函数指针定义 typedef void (* switchcallback)(void); void displayA() { cout << "Aaaaa" << endl; } void displayB() { cout << "Bbbbb" << endl; } void displayC() { cout << "Ccccc" << endl; } int main() { map <str…

2014-04-17 15:30 · 评论(0)

spring quartz自动定时任务配置

先来看一个例子,(在结合自己的项目来看。) Spring中可以通过配置方便的实现周期性定时任务管理,这需要用到以下几个类: org.springframework.sche du ling.quartz.MethodInvokingJobDetailFactoryBean--配置需要调度的Bean的某个方法org.springframework.scheduling.quartz.SimpleTriggerBean--定时器,负责配置启动时间、执行周期org.springframework.scheduling.quartz.SchedulerFactoryBean--触发器,负责配置所有定…

2014-04-17 14:57 · 评论(0)

Cannot get a connection, pool error Timeout waiting for idle object

使用Spring的HibernateDaoSupport时的getSession()3个方法的区别 在继承了HibernateDaoSupport的Dao中,有三种方式获取session,三种方式的区别是什么,一直很困扰,近期工作不是很忙,就查了一下。 this.getsession this.getHibernateTemplate().getSessionFactory().getCurrentSession() this.getHibernateTemplate().getSessionFactory().OpenSession 以上三种方式的区别如下: (1) this.getses…

2014-04-17 14:01 · 评论(0)

node.js第九课(fs文件操作)

 介绍:fs模块是文件操作的封装,它提供了文件的读取,写入,更名,删除,遍历目录,链接POSIX文件系统操作。与其他模块不同的是, fs模块中所有的操作都提供了异步和同步两个版本,例如读取文件内容函数异步方法:readFile(),同步方法readFileSync()。 一、fs.readFile(filename,[encoding],[callback(err,data)])是最简单的读取文件的函数。 参数:filename:读取的文件名。 encoding 文件的字符编码 ANSI callback 回调函数提供两个参数err和data,err表示有没有错误发生,data是文件内容…

2014-04-17 13:10 · 评论(0)

STL 之map,multimap

目录 头文件: #include <map> map和multimap的唯一区别:map中不可以包含重复键值,而multimap中可以。 构造方法 mType<type1,type2> tmap() 默认构造方法 mType<type1,type2> tmap(beg,end) 通过迭代器构造 示例: map<int,string> intmap; map<string,string > othermap; multimap<int,string> stringMultiMap; multimap<string, string > otherStringMultiMap; 注:1,C++中m…

2014-04-17 13:02 · 评论(0)

STL map<string,string> 未能从“const std::string”为“const std::_Revranit<_RanIt,_Base> &”推导 模板 参数

虽然老是犯错。其实解决方法很简单, 忘了加:#include<stirng>

2014-04-17 11:26 · 评论(0)

配置ArcGIS Server10.0之后,报错ManagedPipelineHandler,如何解决?

具体报错信息为: HTTP错误500.21-InternalServerError处理程序“ESRI-Services-Integrated”在其模块列表中有一个错误模块“ManagedPipelineHandler” 解决方法如下: 原因是.netframework安装在前,IIS安装在后。或者按照IIS后,.net framework被修改过。 尝试通过控制台运行aspnet_regiis.exe命令: aspnet_regiis.exe-u aspnet_regiis.exe-i Windows路径为:C:\Windows\Microsoft.NET\Framework\v4.0.30…

2014-04-16 15:24 · 评论(0)

C++ 基本数据类型字节数

#include <iostream> using namespace std; int main() { cout << "Size of bool = " << sizeof(bool) << endl; cout << "Size of char = " << sizeof(char) << endl; cout << "Size of short = " << sizeof(short) << endl; cout << "Size of unsigned short = " << sizeof(unsigned short) << endl; cout << "Size of in…

2014-04-16 14:57 · 评论(0)

STL 总结

目录 STL 的主要组成部分是:容器,迭代器和算法 STL容器是类 迭代器用来遍历容器中的每个元素 算法用来操作容器中的元素 容器的主要种类有顺序容器、关联容器和容器适配器 三种预定义的顺序容器是向量,队列和表 向量容器使用动态数组存储和管理数据 由于数组是一种随机访问的数据结构,所以向量中的元素可以随机访问 实现向量容器的类是vector 在向量容器中插入元素使用的操作是insert和push_back 从向量容器中删除元素的操作是pop_back,erase,clear 可以使用typedef iterator 声明一个向量容器的迭代器,其为vector 类的public 成员 在所有容…

2014-04-16 14:41 · 评论(0)

MongoDB中的_id和ObjectId

 _id和ObjectId MongoDB中存储的文档必须有一个"_id"键。这个键的值可以是任何类型的,默认是个ObjectId对象。 在一个集合里面,每个集合都有唯一的"_id"值,来确保集合里面每个文档都能被唯一标识。如果有 两个集合的话,两个集合可以都有一个值为"123"的"_id"的键,但是每个集合里面只能有一个"_id" 是123的文档。 1.ObjectId ObjectId是"_id"的默认类型。它设计成轻量型的,不同的机器都能用全局唯一的同种方法方便地生成它。 这是MongoDB采用ObjectId,而不是其他比较常规的做法(比如自动增加的主键)的主要原因,因为在多个 …

2014-04-16 14:22 · 评论(0)

node.js第八课(常用工具包util和事件EventEmitter)

一、util全局变量 1.util.inherits(constructor,superConstructor) 此方法是一个实现对象间原型继承的函数。javaScript通过原型赋值来实现继承。 定义了一个基础对象Base,它有sayHello(),原型方法为showName,使用Sub对象继承与Base, 可访问showName方法,不可访问sayHello方法。console.log(obj);//不对打印对象的原型函数; 2.util.inspect(object,[showHidden],[depth],[colors]) 此方法是一个将任意对象转换为字符串的方法,通常用于调试和错…

2014-04-16 14:11 · 评论(0)

STL 之accumulate,adjacent_difference,inner_product,partial_sum

返回 accumulate,adjacent_difference,inner_product,partial_sum 这些算法都是数字算法,因此只能操作数字类型的数据。 头文件 #include <numeric> 声明: #include <numeric> template <class inputItr, class Type> Type accumulate(inputItr first, inputItr last, Type init); template <class inputItr, class Type, class binaryOperation> Type accu…

2014-04-16 13:24 · 评论(0)

STL 之includes,set_intersection,set_union,set_difference,set_symmetric_difference

返回 includes,set_intersection,set_union,set_difference,set_symmetric_difference都是集合论中的操作。这些算法都假定指定区间类的元素已经有序。 includes:A∈B set_intersection:A∩B set_union:A∪B set_difference:A-B set_symmetric_difference:(A-B)∪(B-A) 1,includes 声明: #include <algorithm> template <class inputItr1, class inputItr2> bool i…

2014-04-16 11:13 · 评论(0)

STL 之for_each,transform

返回 for_each:对指定区间中的每个元素使用指定的函数进行访问及处理,所用的函数作为参数传递给该函数。 transform:元素传输 声明: #include <algorithm> template <class inputItr,class function> function for_each(inputItr first,inputItr last,function func); template <class inputItr, class outputItr, class unaryOperation> outputItr transform(inputItr first,…

2014-04-16 09:50 · 评论(0)