byytj
byytj · 共 63 篇文章
ConnObj
zhang_jianhua-hz@vanceinfo.com 和 liu_xi-linda@vanceinfo.com #pragma once #include <stdio.h> #include <string> #include <list> #include <iostream> #import "c:\Program Files\Common Files\System\ADO\msado15.dll" no_namespace rename("EOF", "adoEOF") using namespace std; class ConnObj { public: _Connect…
2013-01-31 00:12 · 评论(0)
ConnPool
//ConnObj *co = ConnPool::GetInstance()->GetConn(); //_ConnectionPtr m_pConnection = co->conn; #pragma once #include <stdio.h> #include <string> #include <list> #include <iostream> #import "c:\Program Files\Common Files\System\ADO\msado15.dll" no_namespace rename("EOF", "adoEOF") #include "ConnObj.…
2013-01-21 21:44 · 评论(0)
curl
在使用curl做POST的时候, 当要POST的数据大于1024字节的时候, curl并不会直接就发起POST请求, 而是会分为俩步, 1. 发送一个请求, 包含一个Expect:100-continue, 询问Server使用愿意接受数据 2. 接收到Server返回的100-continue应答以后, 才把数据POST给Server 这是libcurl的行为. 具体的RFC相关描述: http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.2.3 于是,这样就有了一个问题, 并不是所有的Server都会正确应答100-cont…
2013-01-14 23:29 · 评论(0)
curl_writer
#include <string> #include <iostream> #include <curl/curl.h> #include <sys/time.h> #include <unistd.h> using namespace std; size_t curl_writer(void *buffer, size_t size, size_t count, void * stream) { std::string * pStream = static_cast<std::string *>(stream); (*pStream).append((char *)buffer, size…
2013-01-05 00:25 · 评论(0)
This exception may be expected and handled.
http://hi.baidu.com/ah__fu/item/fca037dd57c73b57d73aae49 http://technet.microsoft.com/zh-cn/magazine/bb385216(zh-tw,VS.90).aspx http://download.csdn.net/download/guestcode/2394123
2012-12-28 21:45 · 评论(0)
恼人的boost::asio::async_read_until
恼人的boost::asio::async_read_until 2012-12-04 10:09:51 我来说两句 收藏 我要投稿 最近为服务器添加XMLSocket与Flash进行通信, 这种协议其实是一种以\0结尾的字符串协议, 为了让asio兼容此协议, 我从文档找到了async_read_until异步读取系列, 这个函数的原理时, 给定一个streambuf, 和一个分隔符, asio碰到分隔符时返回, 你可以从streambuf中读取需要的数据. 看似很简单, 我很快写好一个demo与Flash进行通信, 结果发现在一个echo逻辑速度很快时, 服务器居然乱包了, 网上查了下,…
2012-12-27 23:21 · 评论(0)
cccccccccc
http://blog.csdn.net/gamecreating/article/details/7698719 http://blog.csdn.net/zunceng/article/details/7742788 析构过程中内存相关错误的绝大多数原因 今天记录一下长久以来屡次犯的错,每次都是换一种方法编码来绕过这个问题实现功能的,因为这个问题太过隐蔽,导致今天才发现其中真正的原因...下面进行问题描述: 1 std::map<std::string, Value> keyValue; // 在函数内部分配的堆栈对象(局部变量) 2 ReadData(keyValue);// 从dll…
2012-12-21 00:55 · 评论(0)
222222
char ConvertHexChar(char ch) { if((ch>='0')&&(ch <='9')) return ch-0x30; else if((ch>='A')&&(ch <='F')) return ch-'A'+10; else if((ch>='a')&&(ch <='f')) return ch-'a'+10; else return (-1); } int String2Hex(string str,char a[]) //返回的是a的长度 { int hexdata,lowhexdata; int hexdatalen=0; int len=str.size(…
2012-12-14 02:13 · 评论(0)
111111
// t4.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <string> #include <iostream> #include <cctype> #include <algorithm> /* 入口参数:pSrc 源十六进制数据 出口参数:dest 存放运算结果 返回:true 转换成功 false 失败 */ bool Hex2String(unsigned char *pSrc,std::string &dest,int nL) { char bu…
2012-12-14 01:23 · 评论(0)
aes s
/////////////////////////////// // http://mingcn.cnblogs.com // // xelz CopyRight (c) 2010 // /////////////////////////////// #include "stdafx.h" #include "string.h" #include "AES.h" AES::AES(unsigned char* key) { unsigned char sBox[] = { /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ 0x63,0x7c,0x77,0x7b,0x…
2012-12-12 22:49 · 评论(0)
boost filesys
对于 I/O 操作较多的程序,这样的不一致就意味着需要进行大量的工程工作才能在平台间移植代码。正是因为这个原因,我们才引入了 Boost Filesystem Library。这个广泛使用的库提供了安全、可移植且易用的 C++ 接口,用于执行文件系统操作。可以从 Boost 站点免费下载此库。 使用 boost::filesystem 的第一个程序 在深入研究 Boost Filesystem Library 的更多细节之前,请看一下 清单 1 中所示的代码;此代码使用 Boost API 确定某个文件的类型是否为 Directory。 清单 1. 用于确定某个文件的类型是否为 Direct…
2012-12-05 23:16 · 评论(0)
file mng
#include <boost/optional.hpp> optional<path> path dir; typedef recursive_directory_iterator rd_iterator; for(rd_iterator pos(dir);pos!=end;++pos) { if(!is_directory(*pos) && pos->path().filename()==filename) { ... } }
2012-12-05 22:59 · 评论(0)
bbbbbbbb
一.同步定时器,如下: #include <iostream> #include <boost/asio.hpp> #include <boost/date_time/posix_time/posix_time.hpp> int main(int argc,char** argv){ boost::asio::io_service ios; boost::asio::deadline_timert(ios,boost::posix_time::seconds(2)); std::cout<<t.expires_at()<<std::endl; t.wait(); std::cout<<"he…
2012-12-04 00:33 · 评论(0)
sql2005 pool
#include "StdAfx.h" #include "ConnPool.h" #include <algorithm> #define MIN_COUNT 10 #define MAX_COUNT 100 HANDLE hMutex; ConnPool::ConnPool(void) { this->Init(); } ConnPool::~ConnPool(void) { } ConnPool* ConnPool::cpInst = NULL; ConnPool* ConnPool::GetInstance() { if(NULL==cpInst) { cpInst = new Co…
2012-11-26 01:05 · 评论(0)
queue sample
http://www.iteye.com/topic/477412 #include "StdAfx.h" #include "TaskQueue.h" #include <process.h> #include <boost/thread/shared_mutex.hpp> #include <boost/thread.hpp> using namespace std; typedef boost::shared_mutex rwmutex; typedef boost::shared_lock<rwmutex> readLock; typedef boost::unique_lock<r…
2012-11-19 00:09 · 评论(0)