摘要: - -------------------------------------------File文件操作---------------------------------------------用来将文件或者文件夹封装成对象方便对文件与文件夹进行操作File对象可以作为参数传递给流的构造函数.下面来看一下File类的构造方法:File file =newFile("a.txt");File file2 =newFile("C:\\file\\test\\a.txt");File d =newFile("C:\\file\\test\\&quo 阅读全文
posted @ 2013-03-24 20:37 xinyuyuanm 阅读(332) 评论(0) 推荐(0)
摘要: 1.用The SQL Server.NET Data Provider连接数据库 The SQL Server.NET Data Provider 是利用SqlConnection类来连接SQL Server7.0或更高版本的数据库,SqlConnection类位于名称空间System.Data.SqlClient下 代码如下: Dim sqlConnection1 As SqlClient.SqlConnection Dim strConnect As String=”data source=服务器名;initial catalog=数据库名;use... 阅读全文
posted @ 2013-03-24 20:35 xinyuyuanm 阅读(454) 评论(0) 推荐(0)
摘要: #include <vector>#include <iostream>using namespace std;void main(){ int i = 2, j; j = i++ + ++i; cout << j <<endl; //等于6 i = 2; i = i++ + ++i;//换((i++) + (++i));此种形式,依然等于7 cout << i <<endl; //等于7,为什么等于7呢? int n[] = { 1, 2, 3, 4 }; vector<int> vctInt(n, n + 阅读全文
posted @ 2013-03-24 20:34 xinyuyuanm 阅读(174) 评论(0) 推荐(0)
摘要: YKString类是对STL 中的std::wstring的功能扩展,没有什么好解释的了,就直接看代码吧。头文件:class YKString : public std::wstring{public: typedef std::wstring::size_type size_type; YKString() : std::wstring() {} YKString(const std::wstring& str, size_type pos = 0, size_type n = npos) : std::wstring(str, pos, n) {} YKString(const v 阅读全文
posted @ 2013-03-24 20:33 xinyuyuanm 阅读(329) 评论(0) 推荐(0)
摘要: 题目:有n个区间,[ai, bi), 统计不相交区间最多有多少个? 贪心策略:将这n个区间按bi由小到大排序,然后从前向后遍历,每当遇到不相交的区间就加入目标集合,遍历完成后就找到了最多的不相交区间。 正确性证明:参见http://blog.csdn.net/dgq8211/article/details/7534488 以下是HDUOJ2037的源代码:#include <iostream>#include <iomanip>#include <cmath>#define PI 3.1415927using namespace std;struct Act 阅读全文
posted @ 2013-03-24 20:31 xinyuyuanm 阅读(256) 评论(0) 推荐(0)
摘要: 表达式求值除了用文法实现之外,还可以直接用栈,将中缀表达式转化为后缀表达式。然后再用求表达式的值就轻而易举了。下面贴程序源码:(可能有点长,呵呵:)main.cpp#include"stack.cpp"#include"stack.h"#include<iostream>using namespace std;/** 该函数有两个功能* 1. 输入中缀表达式* 2. 将中缀表达式转化为后缀表达式* 形参为两个指针分别指向两个数组(一个储存数字,一个储存运算符)* 返回值是数字和运算符的总个数(若转化出错,返回-1)*/int change(d 阅读全文
posted @ 2013-03-24 20:29 xinyuyuanm 阅读(334) 评论(0) 推荐(0)
摘要: 这里的日期实现比较简单:采用的是UTC日期(现在还不涉及到其他日期格式的转换如Gregorian日历),且以星期一作为每周的第一天。剩下的就看代码吧:头文件:class UTIL_API YKDateTime{public: enum DT_FORM { DTF_YMDHMS1, //%Y-%m-%d %H:%M:%S,中文格式选此 DTF_YMDHMS2, //%m/%d/%Y %H:%M:%S DTF_YMDHM1, //%Y-%m-%d %H:%M,中文格式选此 DTF_YMDHM2, //%Y/%m/%d %H:%M DTF_YMD1, //%Y-%m-%d,中文格... 阅读全文
posted @ 2013-03-24 20:28 xinyuyuanm 阅读(284) 评论(0) 推荐(0)
摘要: KAZE算法资源:1. 论文: http://www.robesafe.com/personal/pablo.alcantarilla/papers/Alcantarilla12eccv.pdf 2. 项目主页:http://www.robesafe.com/personal/pablo.alcantarilla/kaze.html 3. 作者代码:http://www.robesafe.com/personal/pablo.alcantarilla/code/kaze_features_1_4.tar (需要boost库,另外其计时函数的使用比较复杂,可以用OpenCV的cv::getT.. 阅读全文
posted @ 2013-03-24 20:26 xinyuyuanm 阅读(1233) 评论(0) 推荐(0)
摘要: sql server 2005 自带了一个备份数据库的工具,叫“SQL SERVER 代理”,我们可以通过他来进行数据库的定时备份,具体流程如下:1.要启动 sqlserver 代理,必须先在 sqlserver 2005的配置工具SQL Server Configuration Manager 开启 Sql Server Agent 服务 2.通过SQL Server Management Studio进入数据库管理,打开“SQL SERVER 代理” 3.选择《作业》,右键点击《新建作业》,打开新建页面,名字根据你的数据库取名 4.点击左边的《步骤》,新建一个步骤,《名称》:随意,《类型》 阅读全文
posted @ 2013-03-24 20:24 xinyuyuanm 阅读(320) 评论(0) 推荐(0)
摘要: 在Lua中,你可以像使用number和string一样使用function。可以将function存储到变量中,存储到table中,可以当作函数参数传递,可以作为函数的返回值。 在Lua中,function跟其他值一样,也是匿名的。function被作为一个值存储在变量中,下面这个例子有点2,可以帮助理解:a = {p = print}a.p("Hello World") --> Hello Worldprint = math.sin -- 'print' now refers to the sin functiona.p(print(1)) --&g 阅读全文
posted @ 2013-03-24 20:23 xinyuyuanm 阅读(301) 评论(0) 推荐(0)