2014 年文章归档
共 291 篇文章
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
用 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
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
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
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
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
STL map<string,string> 未能从“const std::string”为“const std::_Revranit<_RanIt,_Base> &”推导 模板 参数
虽然老是犯错。其实解决方法很简单, 忘了加:#include<stirng>
2014-04-17 11:26
配置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
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
STL 总结
目录 STL 的主要组成部分是:容器,迭代器和算法 STL容器是类 迭代器用来遍历容器中的每个元素 算法用来操作容器中的元素 容器的主要种类有顺序容器、关联容器和容器适配器 三种预定义的顺序容器是向量,队列和表 向量容器使用动态数组存储和管理数据 由于数组是一种随机访问的数据结构,所以向量中的元素可以随机访问 实现向量容器的类是vector 在向量容器中插入元素使用的操作是insert和push_back 从向量容器中删除元素的操作是pop_back,erase,clear 可以使用typedef iterator 声明一个向量容器的迭代器,其为vector 类的public 成员 在所有容…
2014-04-16 14:41
MongoDB中的_id和ObjectId
_id和ObjectId MongoDB中存储的文档必须有一个"_id"键。这个键的值可以是任何类型的,默认是个ObjectId对象。 在一个集合里面,每个集合都有唯一的"_id"值,来确保集合里面每个文档都能被唯一标识。如果有 两个集合的话,两个集合可以都有一个值为"123"的"_id"的键,但是每个集合里面只能有一个"_id" 是123的文档。 1.ObjectId ObjectId是"_id"的默认类型。它设计成轻量型的,不同的机器都能用全局唯一的同种方法方便地生成它。 这是MongoDB采用ObjectId,而不是其他比较常规的做法(比如自动增加的主键)的主要原因,因为在多个 …
2014-04-16 14:22
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
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
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
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
node.js第七课(全局对象和全局变量)
概念:所有属性都可以在程序的任何地方访问,即全局变量。在JavaScript中,通常window是全局对象,而Node.js的全局对象是global, 所有全局变量都是global对象的属性,如:console、process等。 一、全局对象与全局变量 global最根本的作用是作为全局变量的宿主。满足以下条件成为全局变量: 1.在最外层定义的变量 2.全局对象的属性 3.隐式定义的变量(未定义直接赋值的变量) 在Node.js中不可能在最外层定义变量,因为所有用户代码都是属于当前模块的,而模块本身不是最外层上下文。 二、process 它用于描述当前Node.js进程状态的对象。提…
2014-04-16 09:21
node.js第六课(包管理器和代码调试)
一、如何使用包管理器 Node.js包管理器,即npm是Node.js官方提供的包管理工具,它已经成了Node.js包的标准发布平台,用于Node.js包的发布、传播、依赖控制。 (1)获取一个包 npm [install/i] [package_name] 例如安装express包: npm i express 卸载包: npm uninstall 包名 [-g] 查看当前所有包: npm list .... 帮助链接: http://www.cnblogs.com/bluefrog/archive/2012/08/14/2639085.html (2)本地模式和全局模式 npm在默…
2014-04-15 23:38
STL 之count,count_if,max,max_element,min,min_element和random_shuffle
返回 count:在指定区间上统计指定值出现的次数。 count_if:条件统计 max:判断两个数值中的较大值 max_element:查找指定区间的最大元素 min:判断两个数值中的较小值 min_element:查找指定区间的最小元素 random_shuffle:用来将指定区间上的元素按随机顺序排列 声明: #include <algorithm> template <class inputItr,class Type> iterator_traits<inputItr>::difference_type count(inputItr first,inputItr last,cons…
2014-04-15 19:11
STL 之reverse,reverse_copy,rotate,rotate_copy
返回 作用:倒置或调换区间元素的位置 声明: #include <algorithm> template <class biDirectionalItr> void reverse(biDirectionalItr first, biDirectionalItr last); template <class biDirectionalItr, class outputItr> outputItr reverse_copy(biDirectionalItr first, biDirectionalItr last,outputItr destFirst); template <class fo…
2014-04-15 17:46
STL 之adjacent_find, merge,inplace_merge
返回 adjacent_find: 查找符合某一准测的连续元素的首次出现 merge:合并有序列表,结果仍是一个有序列表 inplace_merge:合并有序连续序列 声明: #include <algorithm> template<class forwardItr> forwardItr adjacent_find(forwardItr first, forwardItr last); template<class forwardItr, class binaryPredicate> forwardItr adjacent_find(forwardItr first, forwardIt…
2014-04-15 16:54