- 博客(216)
- 资源 (12)
- 收藏
- 关注
原创 boost progress_display实现进度条
boost progress_display实现进度条#include #include #include using namespace std;using namespace boost;int main(){ vector v(100); for ( int i = 0; i < 10000000; ++i) { v.pus
2012-08-29 17:29:21 9910
原创 boost_shared_ptr放入set和vector中
shared_ptr放入set和vector中#include #include #include #include #include using namespace std; struct Foo{ Foo(int _x) : x(_x){} ~Foo() { cout<<"~Foo()"<<endl; }
2012-08-29 12:22:09 12178 2
原创 BOOST 字符串查找示例
BOOST 字符串查找示例#include #include #include #include #include #include using namespace std;using namespace boost;int main(){ cout << "* Find Example *" << endl << endl; string
2012-08-28 11:15:09 8260
原创 boost array的使用
boost array的使用#include #include #include #include using namespace std;int main(){ boost::array array_temp = {{12, 8, 45, 23, 9}}; sort(array_temp.begin(), array_temp.end());
2012-08-27 18:08:54 4732
原创 boost库的使用_tuple
tuple的使用一 Boost::tuple 很多的时候我们经常需要为我们的函数返回多个值,一般的做法是通过传入非常量的指针或引用,但是这样的话可能可读性就要差一些,使用者可能需要确切的文档才能确定到底哪个是返回值,为了更好的可读性,我们可以使用class或struct来封装我们要返回的多个值,然后返回封装struct或class,但是使用这种方法的弊端就是增加的程序的代码量
2012-08-27 16:59:27 1707
原创 窗口框架
窗口框架1 . pe.asm .386 .model flat,stdcall option casemap:none include windows.inc include user32.inc includelib user32.lib include kernel32.inc includelib kernel32.lib ICO_MAIN eq
2012-08-14 14:28:08 1204 1
原创 asm 写hello world
hello world1. 写代码 HelloWorld.asm .386 .model flat,stdcall option casemap:none include windows.inc include user32.inc includelib user32.lib include kernel32.inc includelib kernel32.lib
2012-08-14 12:44:10 1751
原创 php _REQUEST变量的使用
getRequestInfo.php First Name: Last Name: E_Mail Address: Facebook URL: Twitter Handle: 在scripts目录下的showReques
2012-08-10 10:23:56 3246
原创 python gearman的应用
工作原理 :1. client生成任务后,thank you-- 后面加上数字2. worker接收到任务后,接收到数据,处理后(这里是在收到的数据后面加上.rar)向gearman服务的"test_name_mmg_ret"队列发送处理过的数据3. 提交任务的人就可以从"test_name_mmg_ret"得到处理后的结果了...运行worker,因为有的系统在发
2012-08-08 16:50:38 3476 2
转载 可爱的hello world
看到一hello world。。。 #define _________ } #define ________ putchar #define _______ main #define _(a) ________(a); #define ______ _______(){ #define __ ______ _(0x48)_(0x65)_(0x6C)
2012-08-06 18:00:46 864
原创 数据结构之Array
python数据结构之Arrayimport ctypesclass Array: def __init__(self, size): assert size > 0, "Array size must be > 0 " self._size = size pyArrayType = ctypes.py_object * size
2012-07-31 18:11:49 998
原创 python pygame模块的使用
import pygame, sysfrom pygame.locals import *#set up pygamepygame.init()windowSurface = pygame.display.set_mode((500, 400), 0, 32)pygame.display.set_caption("hello, world")BLACK = (0, 0, 0)
2012-07-26 15:29:58 3762
原创 python打log
import globimport loggingimport logging.handlersLOG_FILENAME='logging_rotatingfile_example.out'# Set up a specific logger with our desired output levelmy_logger = logging.getLogger('MyLogger')my
2012-07-26 11:46:19 2693
原创 html5中立体贴图有拖影问题的解决
var SEPARATION = 100; var AMOUNTX = 50; var AMOUNTY = 50; var container, stats; var controls; var camera, scene, renderer, particle; var mouseX = 0, mouseY = 0; var windowHalfX
2012-07-20 18:11:33 2594
转载 css.html实现照片墙
备注:最好在firefox或chrome运行,在IE效果没出现 -。-效果图:初始当鼠标移动到某一张图片时,另外也点击打开图片,会自动连接到大图片。代码如下:-----------NewFile.html--------html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.o
2012-07-20 15:12:03 5982
原创 html5中往矩形中贴图片
分两步:1. 画布大小就是矩形的大小 aaa 2. 画到矩形上的代码 var IMG_SRC = "./1.jpg"; function drawRect() { var canvas = document.getElementById("canvas"); var context = c
2012-07-20 14:11:19 2298
原创 html 画立体
three.js库 self html body { font-family: Monospace; background-color: #f0f0f0; margin: 0px;
2012-07-20 12:36:24 1560
转载 在putty中打开vi时复制文字到windows
复制的时候,如果直接用鼠标复制的时候,是又vim处理的,需要按住shift才是xterm处理的,后测试了下,果然可以,后来用vnc连server发现在vim中也是同样适用的,高兴
2012-07-19 10:55:42 4541
原创 javascript怎么在html中使用
Webville Tunes function init(){ var planet = document.getElementById("greenplanet"); planet.innerHTML = "Red Alert: hit by phaser fire"; var words1=["aaa", "bb
2012-07-19 10:54:49 1149
原创 python命令行参数解析OptionParser类
python参数解析from optparse import OptionParserparser = OptionParser(usage="usage:%prog [optinos] filepath")parser.add_option("-t", "--timeout", action = "store",
2012-07-15 13:52:27 7865
原创 python测试驱动开发
import unittestfrom main import Sampleclass SampleTest(unittest.TestCase): def setUp(self): print "create a new Sample" self._sample = Sample("b64e5843ca7db8199c405be565fa7f57")
2012-07-14 16:05:03 1685
原创 ping程序
ICMPPING程序代码:DWORD WINAPI ThreadProc(LPVOID lParam){ CInitSock initSock; HWND hWnd = (HWND)lParam; //从参数得到句柄 char szIp[64] ={0}; ::GetDlgItemTextA(hWnd, IDC_IP, szIp, sizeof(szIp)); //从控件得
2012-07-10 20:26:32 1150
原创 设置超时时间
设置超时时间BOOL SetTimeOut(SOCKET s, int nTime, BOOL bRecv){ int ret = ::setsockopt(s, SOL_SOCKET, bRecv?SO_RCVTIMEO:SO_SNDTIMEO, (char*)nTime, sizeof(nTime)); return ret!=SOCKET_ERROR;}
2012-07-10 10:15:37 795
原创 计算ICMP头的校验和:
计算ICMP头的校验和:USHORT checksum(USHORT* buff, int nSize){ unsigned long cksum=0; //将数据以字为单位加到cksum while (nSize > 1) { cksum += *buff++; nSize -= sizeof(USHORT); } //如果为奇数, 将最后一个字扩展到双字,再累加
2012-07-10 10:07:36 2879
原创 模板类的使用
advance的使用: list list_num; for (int i=0;i< 10; i++) { list_num.push_back(i); } list::iterator ops; ops = list_num.begin(); cout<<*ops<<endl; advance(ops, 3); cout<<*ops<<endl; advance(o
2012-07-09 16:18:21 898
原创 广播通信
广播通信代码框架:1. 协议都是:SOCKET s = ::socket(AF_INET, SOCK_DGRAM, 0);2. 服务端设置选项BOOL bBroadcast = TRUE;::setsockopt(s, SOL_SOCKET, SO_BROADCAST, (char*)&bBroadcast, sizeof(BOOL));3. 服务端向255.25
2012-07-08 18:06:07 1582
原创 模板类的使用
main.htemplate class actioncontainer{public: //构造函数 actioncontainer() { m_nRedoPos = 0; m_nUndoPos = 0; } //容器的接口函数 void add(T value); T redo(); T undo(); //容器的属性private: int m_nRe
2012-07-03 10:28:30 772
原创 取得当前时间
//取本地时间BOOL GetTime(string &mytime){ BOOL b_ret = TRUE; CHAR szBuf1[256]={0}; CTime tNow = CTime::GetCurrentTime(); sprintf(szBuf1,"%04u%02u%02u%02u%02u%02u",tNow.GetYear(),tNow.GetMonth(
2012-06-25 13:46:38 724
原创 VC读配置文件
char szBugCC[4096]={0}; int nRet = GetPrivateProfileSection("Setting", szBugCC, sizeof(szBugCC), BugConfig.c_str()); if (nRet > 0) { //过滤/0 /0 /00 DWORD dwIndex = 0; char szTemp[128]={0}; w
2012-06-25 11:46:59 951 1
原创 WSAEventSelect模型
4步走:1. //1. 事件句柄和套接字句柄表2. //2. 创建事件对象,并关联到新的套接字上3. //3. 在所有事件上等待 //对每个事件调用WSAWaitForMultipleEvents函数,以便确定它的状态4 //获取来到的消息,WSAEnumNetworkEvents会自动重置受信事件上代码:#include "InitSock.h"#include
2012-06-23 19:03:22 1001
原创 WSAAsyncSelect模型
TCPServer.cpp#include "TCPServer.h"#include "resource.h"#define WM_SOCKET WM_USER+1CMyApp theApp;BOOL CMyApp::InitInstance(){ //初始化套接字 WSADATA wsaData; WORD wVersionRequested = MAKEWORD(2
2012-06-23 17:39:03 1755
原创 I/O模型之select模型
代码:void main(){ CInitSock initSock; USHORT nPort = 9999; //监听的端口 SOCKET sListen = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (sListen == INVALID_SOCKET) { printf("socket error..."); r
2012-06-20 17:34:46 1083
原创 设置系统时间 系统时间网络更新
代码://根据返回的时间设置系统时间void setTimeFromTP(ULONG ulTime){ FILETIME ft; SYSTEMTIME st; //将基准时间转换成windows文件时间 st.wYear = 1900; st.wMonth = 1; st.wDay = 1; st.wHour = 0; st.wMinute = 0; st.wSecon
2012-06-20 16:50:50 1411
原创 得到本机的MAC,IP, MASK地址
#include "InitSock.h"#include #include #pragma comment(lib, "IPHLPAPI.lib")u_char g_ucLocalMac[6];DWORD g_dwGatewayIP;DWORD g_dwLocalIP;DWORD g_dwMask;BOOL GetGlobalData(){ PIP_ADAPTER_IN
2012-06-19 15:20:21 2282
原创 获取本机IP地址
#include "InitSock.h"#include void main(){ CInitSock initSock; char szHost[256] = {0}; ::gethostname(szHost, 256); hostent* pHost = ::gethostbyname(szHost); //in_addr是表示IP地址的结构 in_addr add
2012-06-19 14:46:24 927 2
原创 网络编程初始化类 CInitSock
网络编程初始化类#include #pragma comment(lib, "ws2_32.lib")class CInitSock{public: CInitSock(BYTE minorVer=2, BYTE majorVer=2) { WORD wVersionRequested = MAKEWORD(minorVer, majorVer); WSADATA
2012-06-19 14:27:22 3268
原创 取得本机IP代码
核心代码: //取得本机IP,在状态栏中显示 char szHostName[MAX_PATH] = {0}; ::gethostname(szHostName, MAX_PATH); hostent *pHost = gethostbyname(szHostName); if (pHost != NULL) { CString strIP; in_addr* addr =
2012-06-18 10:57:09 941
原创 修改函数代码HOOK的封装
对外的接口:1. 类初始化时对函数HOOK2. //取消挂钩void UnHook();3. //重新挂钩void ReHook();在初始化时HOOK的代码:*(DWORD*)(m_btNewBytes+1) = (DWORD)pfnHook;8个字节的代码地址 0xB8, 0x00, 0x00,0x40,0x00,0xFF,0xE0,0x00 只要把第二位和第
2012-06-16 15:58:11 1826
原创 封装远程注入类CreateRemoteThreadEx
类初始化时传入要注入的DLL文件名只使用两个函数// 注入DLL到指定的地址空间BOOL InjectModuleInto(DWORD dwProcessId);// 从指定的地址空间卸载DLLBOOL EjectModuleFrom(DWORD dwProcessId);.h#pragma once#include //在头文件中包含cl
2012-06-16 10:13:52 3683
原创 封装的IATHOOK类的使用
代码不稳定,对WINDOW 7不稳定,对XP也不稳定,木有意义,各位看官绕过吧。。 1. 主程序使用了对话框的框架2. 把IATHOOK类封装成DLL,在初始化时加载DLL,使用DLL的导出函数,此函数HOOK了MESSAGE消息。。。与此同时,此DLL会在加载的时候创建全局的IATHOOK类,把常见的几个函数LoadLibraryA,LoadLibraryW,LoadLibrar
2012-06-15 18:49:51 1484
EarthWorm_20180630版本.tgz
2020-06-19
多级线程注入穿墙技术
2012-05-10
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人