Roger Luo

超越梦想一起飞
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

03 2013 档案

摘要:以前得到DataSet的时候都是利用直接写sql语句(适合初学者) public static DataSet GetDs(string sqlstr) { ds = new DataSet(); sqlconn = new SqlConnection(); sqlconn.ConnectionString =... 阅读全文

posted @ 2013-03-26 19:20 Roger Luo 阅读(7798) 评论(0) 推荐(0)

摘要:wstring to string string CUtility::TCHAR2char(TCHAR* tchStr){ int iLen = 2*wcslen(tchStr); char* chRtn = new char[iLen+1]; memset(chRtn, 0, iLen + 1); wcstombs(chRtn,tchStr,iLen+1); ... 阅读全文

posted @ 2013-03-26 14:59 Roger Luo 阅读(1485) 评论(0) 推荐(0)

摘要:如何获取DataGridViewCheckBoxCell的值 方法1,需要给DATAGRIDVIEW控件添加事件CellContentClick,这里我将CHECKBOX放在数据列的第一个所以我判断参数中COLUMNINDEX是否为0,同时需要注意的是使用属性EditedFormattedValue,不能使用Value值,因为Value值是旧值。 private void dg... 阅读全文

posted @ 2013-03-26 12:48 Roger Luo 阅读(564) 评论(0) 推荐(0)

摘要:本次TSQL语法例子是基于SQL SERVER来编写的 首先需要判断对应的数据库对象是否存在,以下给出了如何判断存储过程以及表来判断 USE MASTER;IF OBJECT_ID(N'MASTER.DBO.TESTADD', N'P') IS NOT NULLDROP PROCEDURE [DBO].[TESTADD];GO数据库中所有的数据对象可以查看附录1。附录一Obje... 阅读全文

posted @ 2013-03-25 20:03 Roger Luo 阅读(287) 评论(0) 推荐(0)

摘要:MD5的简单的例子 using System.Security.Cryptography;using System.Text;static public void Main() { string line, ret; while (true) { line = Console.ReadLine(); by... 阅读全文

posted @ 2013-03-25 18:58 Roger Luo 阅读(364) 评论(0) 推荐(0)

摘要:需要SQL Server 2008支持 右键数据库中创建存储过程,创建TSQL文本或者使用MSSQL提供的存储过程模板(在database\Programmablity\Store Procedures右键导入模板) 然后编写一个简单的存储过程如下: USE MASTER;IF OBJECT_ID(N'MASTER.DBO.TESTADD', N'P') IS NOT NULLDROP PR... 阅读全文

posted @ 2013-03-24 21:19 Roger Luo 阅读(437) 评论(0) 推荐(0)

摘要:原因:1.查看表对应列是否是nvarchar或者nchar,他们能够使用unicode支持中文字符;2.查看更新或者插入语句中是否使用N,来声明更新字符串需要支持中文,如下说是:INSERT TABLE1 (COLUMN1, COLUMN2) VALUES (N'张三', N'李四') 阅读全文

posted @ 2013-03-24 19:52 Roger Luo 阅读(1913) 评论(0) 推荐(0)

摘要:class ComplexA{public: ComplexA(int len):_l(len), _p(new char[_l]){cout<<"ComplexA::ComplexA"<<endl;} ~ComplexA(){cout<<"ComplexA::~ComplexA"<<endl; if (_p != nullptr) delete _p;}private: ... 阅读全文

posted @ 2013-03-18 21:01 Roger Luo 阅读(1442) 评论(1) 推荐(0)

摘要:Q:构造函数中涉及的大量内存分配以及复杂对象变量的初始化失败应该如何处理 应该放在initialize list里面 ClassA():objb(new ClassB) 这样如果失败了一些构造好的对象也会自动析构掉 有些方法: ClassA::ClassA(){ objb = new ClassB(); if(objb == NULL) { ... 阅读全文

posted @ 2013-03-18 13:38 Roger Luo 阅读(325) 评论(0) 推荐(0)

摘要:In Boost library, there are totally three libraries to support regex parser, regex, xpressive and .. the xpressive library is static compile, that means it will cause a lot of time to build your proj... 阅读全文

posted @ 2013-03-18 10:26 Roger Luo 阅读(303) 评论(0) 推荐(0)

摘要:private void ResheshState(string msg){ if (lblState.InvokeRequired == true) { lblState.BeginInvoke((MethodInvoker)delegate { lblState.Text = msg; }); } e... 阅读全文

posted @ 2013-03-17 23:04 Roger Luo 阅读(183) 评论(0) 推荐(0)

摘要:TCP初始化连接三次握手吧:发SYN包,然后返回SYN/ACK包,再发ACK包,连接正式建立。关闭连接要四次握手:发FIN包,ACK包,FIN包,ACK包,四次握手。因为TCP连接是全双工,我关了你的连接,并不等于你关了我的连接。 客户端TCP状态迁移: CLOSED->SYN_SENT->ESTABLISHED->FIN_WAIT_1->FIN_WAIT_2->TIME_WAIT->... 阅读全文

posted @ 2013-03-17 17:54 Roger Luo 阅读(364) 评论(0) 推荐(0)

摘要:bind function adapter (included <functional>) Introduce: bind(op, args, …) Binds args to op Simple Code auto pfn = std::bind(std::plus<int>(), std::placeholders::_1, 10);cout<<pfn(7); // 17 N... 阅读全文

posted @ 2013-03-16 17:30 Roger Luo 阅读(355) 评论(0) 推荐(0)

摘要:Go to Project Property Page/Cofniguration Properties General/Configuration Type, change as “Dynamic Library(.dll)” C/C++/Code Generation/Runtime Library, change as “/MDd” C/C++/Preprocessor/Preproc... 阅读全文

posted @ 2013-03-16 15:28 Roger Luo 阅读(332) 评论(0) 推荐(0)

摘要:C++ fstream fin;fin.open(filename, ios::in);if (!fin.good()){ cerr<<"Failed to open "<<filename<<endl; return -1;}fin.seekg(0, ios::end);size_t len = fin.tellg();char * raw = new char[len+1]... 阅读全文

posted @ 2013-03-16 12:55 Roger Luo 阅读(230) 评论(0) 推荐(0)

摘要:静态变量需要在.cpp初始化,否则报错连接错误, 对于原始数据, int, double, … simple.h class Simple{public: Simple(void); ~Simple(void); static int GetInt(void);private: static int _i;};simple.cpp int Simple::Ge... 阅读全文

posted @ 2013-03-15 17:15 Roger Luo 阅读(6027) 评论(0) 推荐(0)

摘要:内存映射文件 内存映射文件与虚拟内存有些类似,通过内存映射文件可以保留一个地址空间的区域,同时将物理存储器提交给此区域,只是内存文件映射的物理存储器来自一个已经存在于磁盘上的文件,而非系统的页文件,而且在对该文件进行操作之前必须首先对文件进行映射,就如同将整个文件从磁盘加载到内存。由此可以看出,使用内存映射文件处理存储于磁盘上的文件时,将不必再对文件执行I/O操作,这意味着在对文件进行处理时将不... 阅读全文

posted @ 2013-03-05 16:27 Roger Luo 阅读(2718) 评论(0) 推荐(0)

摘要:IO notification has 6 models 1. synchronous completion for “fast” I/O 2. polling 3. signaling the device kernel object directly 4. signaling an event object provided when I/O started 5. pos... 阅读全文

posted @ 2013-03-05 15:25 Roger Luo 阅读(320) 评论(0) 推荐(0)

摘要:MSSQL 2008 Using entity framework 1. Preparation Install SQL Server 2005 or Higher, link Install SQL Server 2000 Sample Databases, link Install .NET Framework 3.0 or Higher 2. Check whether Insta... 阅读全文

posted @ 2013-03-05 15:13 Roger Luo 阅读(945) 评论(0) 推荐(0)

摘要:Create file HANDLE hFile = ::CreateFile(lpcszFileName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAY... 阅读全文

posted @ 2013-03-05 11:27 Roger Luo 阅读(289) 评论(0) 推荐(0)

摘要:Compression 阅读全文

posted @ 2013-03-05 10:43 Roger Luo 阅读(255) 评论(0) 推荐(0)

摘要:Configuration of MySQL on C# project. 1. Download the assembly from MySQL binary on installing MySQL connector .NET 2. Copy it to your project’s build out directory, such as ‘$ProjectDIR/Bin/Debug’ ... 阅读全文

posted @ 2013-03-03 18:52 Roger Luo 阅读(388) 评论(0) 推荐(0)

摘要:Modify password for root user 1. using root account to log on mysql mysql>set password =password(‘yourpwd’); mysql>flush privileges; 2. using grant statement mysql>grant all on *.* to root@’local... 阅读全文

posted @ 2013-03-03 15:58 Roger Luo 阅读(521) 评论(0) 推荐(0)

摘要:Synchronously loading image PictureBox pbx = new PictureBox();pbx.Image = Image.FromFile(filename);or PictureBox pbx = new PictureBox();pbx.Load(filename); // filename could be the url file:/... 阅读全文

posted @ 2013-03-02 18:36 Roger Luo 阅读(7239) 评论(0) 推荐(0)

摘要:1. Preparation Download the installation package(.iso) on msdn website. 2. Installation Guide Load iso file by virutal tool, recommend to use the virtual cd-rom control panel tool whichi is publis... 阅读全文

posted @ 2013-03-02 16:44 Roger Luo 阅读(402) 评论(0) 推荐(0)

摘要:Assuming there are two panels in a winform, show like below. Panel1 Panel2 Panel1.dock is left. Panel2.dock is fill. Right now, add a status bar at the bottom of this wi... 阅读全文

posted @ 2013-03-02 09:57 Roger Luo 阅读(5523) 评论(1) 推荐(1)