1 WinMain(hInst,hPrev,……) 2 { 3 MSG msg; 4
RegisterClass(……); 5 CreateWindow(……); 6 ShowWindow(……); 7 UpdateWindow(……); 8
while(GetMessage(……)) 9 {10....
windows下面可以主线程while loop接受input;但是觉得很丑。
linux没办法这样,可以用注册信号的办法。实现起来也不难:
#include "stdio.h"
#include "unistd.h"
#include "signal.h"
#include "error.h"
volatile bool isStop = false;
static void handl...
分类:
其他好文 时间:
2014-04-29 13:42:21
阅读次数:
418
We sometimes got memory leak problem, and we need to find the leaked memory, Here is a useful tool from MS, UMDH, it is included in WinDBG install package.
Here is a introduction on how to UMDH to identify memory leak problems...
分类:
其他好文 时间:
2014-04-29 13:38:21
阅读次数:
374
在windows下运行VMware创建的虚拟机时出错,无法运行。
错误提示大概为:
Failed to lock the file
Cannot open the disk 'D:\Windows Server 2008 R2 x64.vmdk' or one of the snapshot disks it depends on.
解决方法:
把虚拟机文件夹里【.lck】...
分类:
其他好文 时间:
2014-04-29 13:28:21
阅读次数:
366
Android SDK中有一个工具HierarchyView.bat,可以分析出模拟器中运行程序的界面设计层次;我们可以用此工具来分析自己的应用布局是否有优化的空间,也可以分析别人优秀的布局进行借鉴和学习。
使用HierarchyView.bat 非常简单:
1.启动模拟器;
2.运行要分析的程序;
3.在SDK目录下(如D:\AndroidHome\android-sdk-windows...
分类:
移动开发 时间:
2014-04-29 13:25:21
阅读次数:
416
6.3.3 实例对象
现在我们用实例对象做什么呢?实例对象唯一可用的操作就是属性引用。现在有两种合法的属性名称:数据属性和方法。
数据属性相当于smallTalk中的实例变量,C++中的数据成员。数据属性不需要申明。像局部连梁一样,当他们初次赋值的时候他们就存在了。例如,如果x是上面创建MyClass类的一个实例, 下面的代码块表示将会打印值16.这个值没有任何错误。
x.counter =...
分类:
编程语言 时间:
2014-04-29 13:15:21
阅读次数:
304
6.2.1 作用域和命名空间实例
下面的实例主要用来示范如何引用不同的作用域和命名空间,关键字global和nonlocalru如何影响变量绑定。
实例运行结果是:
After local assignment: test spam
After nonlocal assignment: nonlocal spam
After global assignment: no...
分类:
编程语言 时间:
2014-04-28 10:46:42
阅读次数:
356
6.2 Python作用域和命名空间
在介绍类之前,首先我想告诉你一些关于python作用域的规则。类的定义非常巧妙地运用了命名空间,你需要知道范围和命名空间的工作原理以能全面了解接下来发生的。 顺便说一下,关于这节讲到的知识对于任何优秀的python程序员非常有用。
让我们开始以一些定义开始。
命名空间(namespace)是一个从名称到对象的映射。大多命名空间目前用Python字典实现的...
分类:
编程语言 时间:
2014-04-28 10:31:42
阅读次数:
309
paip.python3 的类使用跟python2 的不同之处
#------python3的写法而且使用..
#class syllable(BaseClassA, BaseClassB):
class syllable():
i = 123 # 类成员
##todox selft.xxx is err,tips selef is not def
c...
分类:
编程语言 时间:
2014-04-28 10:24:40
阅读次数:
284