- 博客(58)
- 资源 (6)
- 收藏
- 关注
转载 golang 守护进程
package daemonimport ( "os" "os/exec" "syscall" "time" "github.com/inconshreveable/log15")type DaemonState intconst ( DaemonInit DaemonState = iota DaemonStart DaemonStop)type Daem...
2018-08-04 14:46:56
3920
转载 线程本地存储实例
// Copyright (C) 2001-2003// William E. Kempf//// Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0
2017-05-12 10:40:03
413
转载 Wicket + Spring integration example
jump :http://www.mkyong.com/wicket/wicket-spring-integration-example/This tutorial demonstrates how to integrate Wicket with Spring framework.Libraries in this article :Wicket v1.4.17wic
2016-07-21 20:04:57
765
转载 boost 最短路径 johnson
#include #include #include #include #include #include #include #include #include intmain(){ using namespace boost; typedef adjacency_list<vecS, vecS, undirectedS, no_property,
2015-04-29 10:27:06
815
转载 确定GPU/CPU bound
确定GPU/CPU boundglClear/swapbuffer或某次drawcall占用大量时间=>GPU boundhide特定模型或关掉特定效果之后fps大涨=>GPU bound游戏暂停(逻辑&动画不更新)之后fps大涨=>CPU bound
2015-01-08 17:24:27
1891
转载 调用剖析 callgrind
callgrindhttp://blog.sina.com.cn/s/blog_757dbe670101ioal.html
2014-11-13 10:31:15
1318
转载 pthread_jion
#include #include #include #include #include #pragma warning (disable:4716)void * pthread_func_test(void * arg);int main(){ pthread_t thread1,thread2; pthread_create(&thread1,NULL,pthr
2014-11-06 18:29:21
708
转载 C++标准里 string和wstring
在C++标准里定义了两个字符串string和wstring typedef basic_string string; typedef basic_string wstring; 前者string是常用类型,可以看作char[],其实这正是与string定义中的_Elem=char相一致。而wstring,使用的是wchar_t类型,这是宽字符,用于满足非
2014-11-06 11:13:23
54566
1
转载 php format var_dump
// format var_dump function dump($var, $echo=true,$label=null, $strict=true) { $label = ($label===null) ? '' : rtrim($label).' '; if(!$strict) { if (ini_get('h
2014-07-03 12:18:15
1759
原创 example for bind
class people{public: people(const string& name) :_name(name) { } void SaySomething(const string& msg) const { cout<<_name<<" said: "<< msg << endl; }private: string _name;};void run
2014-06-23 16:48:47
635
转载 各种移动GPU压缩纹理的使用方法
转自:http://www.cnblogs.com/luming1979/archive/2013/02/04.html介绍了各种移动设备所使用的GPU,以及各个GPU所支持的压缩纹理的格式和使用方法。1.移动GPU大全目前移动市场的GPU主要有四大厂商系列:1)ImaginationTechnologies的PowerVRSGX系列代表型号:Pow
2013-03-14 11:11:09
2437
转载 程序崩溃,但暂停的位置不在错误发生的行的解决方法
如果经常遇到程序Crash但暂停的位置不在错误发生的行,可以检查一下VC的Exceptions设置: Debug>Exceptions 在设置界面中把C++ Exceptions和Win32 Exceptions都选中,这样出现错误(例如数组越界,坏指针)立刻在错误的地方中断。而不是在控制台输出一个First Chance exceptions地址,却中断到不正确的代码行。
2013-02-22 09:03:59
716
原创 [python]获取文件夹大小
import osfrom os.path import join, getsizeadrFloder = "E:\\pythontest\\adr"iosFloder = "E:\\pythontest\\ios"for root, dirs, files in os.walk(iosFloder): ##print (root,dirs,files)
2013-01-23 23:35:42
713
转载 C/C++语法知识:typedef struct 用法详解
第一篇:typedef struct与struct的区别1. 基本解释typedef为C语言的关键字,作用是为一种数据类型定义一个新名字。这里的数据类型包括内部数据类型(int,char等)和自定义的数据类型(struct等)。在编程中使用typedef目的一般有两个,一个是给变量一个易记且意义明确的新名字,另一个是简化一些比较复杂的类型声明。至于typedef有什
2013-01-15 13:49:22
552
转载 lua面向对象编程之点号与冒号的差异详细比较
转自:http://luaer.diandian.com/post/2011-10-09/5673234首先,先来一段在lua创建一个类与对象的代码 01 Class = {} 02 Class.__index = Class 03 04 function Class:new(x,y) 05 local temp = {}
2012-07-26 09:57:13
730
转载 读未知大小文件
#include #include using namespace std; ifstream ifile( "test.dat ", ios::binary); ifile.seekg(0, ios::end); int filelen = ifile.tellg(); char *pbuf = new char[file
2012-07-19 15:18:25
803
转载 NeHe OpenGL第三十三课:TGA文件
原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://yarin.blog.51cto.com/1130898/381885NeHe OpenGL第三十三课:TGA文件加载压缩和未压缩的TGA文件:在这一课里,你将学会如何加载压缩和为压缩的TGA文件,由于它使用RLE压缩,所以非常的简单,你
2012-06-27 11:19:07
694
转载 OpenGL中位图的操作(glReadPixels,glDrawPixels等)
转自:http://blog.sina.com.cn/s/blog_4151e7490100g2m5.htmlOpenGL中位图的操作(glReadPixels,glDrawPixels和glCopyPixels应用举例)1、 BMP文件格式简单介绍BMP文件是一种像素文件,它保存了一幅图象中所有的像素。这种文件格式可以保存单色位图、16色或256色
2012-06-25 09:30:44
1049
转载 first opengl
#include #include #includevoid myDisplay(void){ glClear(GL_COLOR_BUFFER_BIT); glRectf(-0.5f, -0.5f, 0.5f, 0.5f); glFlush(); printf ("display done\n");}int main(){ glutIn
2012-06-21 13:42:37
530
转载 C++ 内存池 -- C++ Memory Pool
http://www.rosoo.net/a/201010/10268.htmlhttp://www.codeproject.com/cpp/MemoryPool.asp
2012-05-31 12:20:18
536
转载 关于 23 种设计模式的有趣见解
在网络上流畅很广的一篇旧文,暂时没找到原作者,目前所看到的最早转载时间是 2005 年 2 月 28 日。作者用轻松的语言,形象解释了 23 种模式,有很好的启发作用。创建型模式1、FACTORY—追MM少不了请吃饭了,麦当劳的鸡翅和肯德基的鸡翅都是MM爱吃的东西,虽然口味有所不同,但不管你带MM去麦当劳或肯德基,只管向服务员说“来四个鸡翅”就行了。麦当劳和肯德基就是生产鸡翅的Fa
2012-05-28 21:00:13
560
转载 霍夫曼编码压缩算法
转自伯乐在线http://blog.jobbole.com/20091/前两天发布那个rsync算法后,想看看数据压缩的算法,知道一个经典的压缩算法Huffman算法。相信大家应该听说过 David Huffman 和他的压缩算法—— Huffman Code,一种通过字符出现频率,Priority Queue,和二叉树来进行的一种压缩算法,这种二叉树又叫Huffm
2012-05-23 20:54:44
2290
转载 wsting <---> string
#include std::string ws2s(const std::wstring& ws){ std::string curLocale = setlocale(LC_ALL, NULL); // curLocale = "C"; setlocale(LC_ALL, "chs"); const wchar_t* _Source = ws.c_str
2012-05-17 11:48:23
1555
转载 四元數與旋轉
http://caterpillar.onlyfun.net/Gossip/ComputerGraphics/QuaternionsRotate.htm在討論「四元數」之前,我們來想想對三維直角座標而言,在物體旋轉會有何影響,可以擴充三維直角座標系統的旋轉為三角度系統(Three-angle system),在Game Programming Gems中有提供這麼一段:
2012-04-19 21:54:41
722
转载 c++对象导出到lua
转自:http://www.cnblogs.com/ringofthec/archive/2010/10/26/luabindobj.html这些东西是平时遇到的, 觉得有一定的价值, 所以记录下来, 以后遇到类似的问题可以查阅, 同时分享出来也能方便需要的人, 转载请注明来自RingOfTheC[ring.of.the.c@gmail.com] 虽然有
2012-04-14 12:35:33
1003
原创 结果,你猜。。
#include #include using namespace std;class Wedgit{public: Wedgit() { objectId = count++; cout<<"default :"<< objectId <<endl; } Wedgit(const Wedgit& b):data(b.data) { objectId = cou
2012-04-06 17:55:32
511
转载 DrawText 显示平面文字
函数:DrawText说明:显示平面文字,此函数与 API 函数 DrawText 的用法类似。用法:ct3DX.DrawText d3dFont, color, TextString, nRECT, Format参数:d3dFont As D3DXFont D3d字体,可用 CreateFont 创建该字体对象。 color As Long 文字颜色,ARGB
2012-03-30 10:20:16
2227
原创 模板函数 的 一些测试
如果有下列一模板函数:templateT fun(T a){ return a;};则在使用时有两种方法:// 方法一fun(5);// 方法二fun(5);而如果是这样的话templateT fun(TT a){ return a;};是可以用fun(5);或者fun(5)但是如果想用下面这种省略参数的方法,
2012-03-27 23:00:12
427
转载 cout 格式化输出
转载自:http://www.cnblogs.com/walfud/articles/2047096.html将 cout 的 flag 保存到变量, 以便修改后的恢复 ostream::fmtflags old = cout.flag() ; // 无参将返回当前 flag 值 cout.flag(old) ;
2012-02-19 00:42:25
1318
转载 专心打造自己,把自己打造成一个优秀的人,一个有用的人,一个独立的人,比什么都重要。
有一次在北大讲座,遇到一位学生问我,“老师,你说学习重要,还是经营人脉重要?”看着他一脸大杂烩的表情,我先拿出本子记下了这个问题,然后告诉他说,这是个比较大的话题,我会仔细写篇文章放在网上的,然后给了他我的博客地址 。而后又补了一句,“相信我,所谓的人脉就算重要,也根本没他们说的那么重要”。 让我们细说从头。先动脑思考一下,你愿意与什么样的人成为朋友?从幼儿园开始,每个人就都已经有一些选
2012-02-12 15:04:00
1601
原创 const成员函数
#include using namespace std; class Widget { public: Widget(int value):m_value(value){} int GetValue()const // 成员函数的const版本 { cout << "IN : int GetValue()const" << endl;
2012-01-14 18:49:36
717
转载 我们社会的普遍价值观
总有这么一批人小时候,他们问你“在哪儿上学啊?”因为他们想知道是普通校还是名校“考了第几啊?”因为他们想知道成绩是好还是不好可他们却不会问你“喜欢学习吗?”“对哪方面感兴趣?”这就是社会的普遍价值观 后来,还是这批人碰见了你,还是问你“在哪儿读大学(研究生)呢?”“学什么
2012-01-11 09:59:39
1207
原创 CEGUI对回调函数的封装
#include using namespace std;// 回调函数 虚基类class SlotFunctorBase {public: virtual ~SlotFunctorBase() {}; virtual bool operator()(bool flag) = 0;};// 普通函数的封装类class FreeFunctionSlot : public Slo
2012-01-09 14:00:16
1287
2
转载 空指针为什么能调用成员函数?(转载)
发现了一个空指针调用函数成功的例子,很奇怪就查了一下资料,如下:举个简单的例子,假如有如下的一段代码:class MyClass{public: int i; void hello() { printf("hello\n"); } void print() { printf("%d\n", i);
2012-01-09 11:29:33
2634
转载 <类模板 的 成员函数的特化>及<类 的 成员模板函数的特化>
#include "stdio.h"template class Sample{public: void print() {printf("print template\n");}};void Sample::print() {printf("print int\n");};// 调用int main(){ Sample a; a.print(); Sample
2012-01-09 09:47:24
2100
转载 PIMPL 模式的实现及应用。
看一些开源库,里面好多类有一个**IMPL。经查询还是有些门道和说法的。查询了一些相关资料。(英文没有翻译,挺简单的。)PIMPL 也可以称为一种设计模式了。现在摘录如下:pimpl 手法在 C++ 里已是“高手”们广泛运用的成熟方法之一,它的优点很多,诸如降低编译依赖、提高重编译速度之类的工具性优势自不待赘言,而其对“保持接口稳定性”的优点更值得称道。It makes it po
2012-01-04 13:41:42
891
2
转载 C++ 工厂方法2
#include #include #include class DeviceBase;typedef DeviceBase* (*FactoryFunction)();class DeviceFactory{public:static void Register(std::string name, FactoryFunction instanceFunction){ m
2011-12-29 15:37:27
942
1
转载 C++ 工厂方法
Singleton.h#pragma once#ifndef SINGLETON_H#define SINGLETON_Htemplateclass Singleton{public: static T& Instance();protected: Singleton(){} virtual ~Singleton(){} /** * 防止拷贝复制 */priv
2011-12-29 12:46:00
664
原创 c++ 参数个数不确定
#include #include #include "stdarg.h"using namespace std;struct Params { enum ParamsType{NILL,INT,CHAR,DBL}; ParamsType type; union { int noParams; int intParams; char char
2011-12-10 15:11:54
2967
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人