上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 59 下一页
  2014年1月2日
摘要: Today I ran across a situation where I needed to programmatically remove specific elements from a KML file. I was already using Python's ElementTree library for my KML processing, so I attempted to use ElementTree's remove() method. The remove() method can only removesubelements, requiring a 阅读全文
posted @ 2014-01-02 11:00 一个人的天空@ 阅读(478) 评论(0) 推荐(0) 编辑
  2013年12月27日
摘要: VirtualAlloc 一次分配 1PAGE 以上的 RAM. 每次分配都是 PAGE 的整数倍. 你不会想为了分配 1 个 BYTE 的空间而浪费剩下的 4095 字节. OK, 你可以自己写算法, 多分配几 PAGE. 然后每次分配少量数据时就从那几 PAGE 中划分出来. KERNEL32 提供了一个解决办法, 用 HeapAlloc/GlobalAlloc 分配 RAM. 这样, KERNEL32 帮助完成分配动作, 并且尽量在减少用于跟踪空闲区域和已占用区域消耗的数据结构.很久以前也有个产品叫做 WINDOWS. 那时候的 WINDOWS 是 16BIT 的, 地址空间有些紧俏, 阅读全文
posted @ 2013-12-27 15:30 一个人的天空@ 阅读(764) 评论(0) 推荐(0) 编辑
  2013年12月25日
摘要: 这是一个使用A* search算法解迷宫的问题,细节请看:http://www.laurentluce.com/posts/solving-mazes-using-python-simple-recursivity-and-a-search/Laurent Luce的A* search算法有点问题,我这边运行是死循环,稍微修改了一下。import heapqclass Cell(object): def __init__(self, x, y, reachable): self.reachable = reachable self.x = x s... 阅读全文
posted @ 2013-12-25 10:21 一个人的天空@ 阅读(2094) 评论(0) 推荐(0) 编辑
  2013年12月20日
摘要: This article describes the Python threading synchronization mechanisms in details. We are going to study the following types: Lock, RLock, Semaphore, Condition, Event and Queue. Also, we are going to look at the Python internals behind those mechanisms.The source code of the programs below can be fo 阅读全文
posted @ 2013-12-20 15:55 一个人的天空@ 阅读(1393) 评论(0) 推荐(1) 编辑
  2013年12月13日
摘要: Many times in the past I had to run an interactive command-line shell under the Local SYSTEM account. That is, a CMD window on your desktop running under the system account. This technique is extremely useful in many cases, for example to debug ERROR_ACCESS_DENIED type errors that are coming from a 阅读全文
posted @ 2013-12-13 14:36 一个人的天空@ 阅读(658) 评论(0) 推荐(0) 编辑
  2013年12月10日
摘要: 什么是json:JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式。易于人阅读和编写。同时也易于机器解析和生成。它基于JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999的一个子集。JSON采用完全独立于语言的文本格式,但是也使用了类似于C语言家族的习惯(包括C, C++, C#, Java, JavaScript, Perl, Python等)。这些特性使JSON成为理想的数据交换语言。JSON建构于两种结构:“名称/值”对的集合(A collec 阅读全文
posted @ 2013-12-10 17:58 一个人的天空@ 阅读(69185) 评论(0) 推荐(3) 编辑
  2013年12月9日
摘要: How would you get the command line of a process? Some people have suggested that you use remote thread injection, callGetCommandLine(), then IPC the result back. This might work most of the time on Windows XP, but on Windows Vista it doesn’t work on system and service processes. This is becauseCreat 阅读全文
posted @ 2013-12-09 11:31 一个人的天空@ 阅读(2501) 评论(0) 推荐(0) 编辑
  2013年12月2日
摘要: 使用Linux shell是我每天的基本工作,但我经常会忘记一些有用的shell命令和l技巧。当然,命令我能记住,但我不敢说能记得如何用它执行某个特定任务。于是,我开始在一个文本文件里记录这些用法,并放在我的Dropbox里,现在,向大家分享这个文件。这个文件我会不断的更新。需要注意一点的是,有些用法需要在你的Linux系统里安装额外的软件。UPDATE: November 25, 2013检查远程端口是否对bash开放:echo >/dev/tcp/8.8.8.8/53 && echo "open"让进程转入后台:Ctrl + z将进程转到前台:fg 阅读全文
posted @ 2013-12-02 15:00 一个人的天空@ 阅读(583) 评论(0) 推荐(0) 编辑
  2013年11月25日
摘要: 通过types模块的类成员来判断,其实所有python中的类型都是这个types模块中类型的实例。import typestype(x) is types.IntType # 判断是否int 类型type(x) is types.StringType #是否string类型type(x) is types.InstanceType #是否是自定义的实例对象, isinstance函数不支持比较这个通过已知类型比较,因为python中所有相同类型的对象他们所引用的类型都是同一个,所以可以通过如下的方式对比:type(x) == types(1) # 判断是否int 类型type(x) == ty 阅读全文
posted @ 2013-11-25 16:57 一个人的天空@ 阅读(2675) 评论(0) 推荐(0) 编辑
  2013年11月21日
摘要: This disables the Windows File System Redirector.When a 32 bit program runs on a 64 bit operating system the paths to C:/Windows/System32 automatically get redirected to the 32 bit version (C:/Windows/SysWow64), if you really do need to access the contents of System32, you need to disable the file s 阅读全文
posted @ 2013-11-21 11:43 一个人的天空@ 阅读(784) 评论(0) 推荐(0) 编辑
摘要: 这段时间,都在做Ring3层的普通32bit程序兼容64bit操作系统的代码修改,在此记录修改和学习心德。编程领域太广,任何人经历有限,本人不是专家,所以我一贯原则是:用到的时候,才去研究,在去记录。只要个人的基础知识扎实,吸收一些新的东西,还是蛮顺利的。1.64bit操作系统的重定向机制以及目的在64bit操作系统中,为了无缝兼容32bit程序的运行,64bit的Windows操作系统采用重定向机制。目的是为了能让32bit程序在64bit的操作系统不仅能操作关键文件文夹和关键的注册表并且又要避免与64bit程序冲突。微软采用重定向机制的原理很简单,说白了就是让关键文件/文件夹或者关键注册表 阅读全文
posted @ 2013-11-21 11:02 一个人的天空@ 阅读(682) 评论(0) 推荐(0) 编辑
  2013年11月18日
摘要: 今天使用ConfigParser解析一个ini文件,报出如下错误: config.read(logFile) File "C:\Python26\lib\ConfigParser.py", line 286, in read self._read(fp, filename) File "C:\Python26\lib\ConfigParser.py", line 482, in _read raise MissingSectionHeaderError(fpname, lineno, line)MissingSectionHeaderError: Fil 阅读全文
posted @ 2013-11-18 14:42 一个人的天空@ 阅读(21628) 评论(0) 推荐(0) 编辑
  2013年11月15日
摘要: vc得到屏幕的当前分辨率方法: 1.Windows API调用 int width = GetSystemMetrics ( SM_CXSCREEN ); int height= GetSystemMetrics ( SM_CYSCREEN ); 如果想动态自适应分辨率的变化,处理WM_DISPLAYCHANGE消息. 2.获得分辨率 BOOL EnumDisplaySettings( LPCTSTR lpszDeviceName, // display device DWORD iModeNum, // graphics mode LPDEVMODE lpDevMode // graphic 阅读全文
posted @ 2013-11-15 15:39 一个人的天空@ 阅读(5273) 评论(0) 推荐(0) 编辑
  2013年10月23日
摘要: Visual Studio 2008 (formely code-named ‘Orcas’) has several important updates for VC++ and MFC. Among them the possibility to create syslinkcontrols, command or split buttons and network address controls. In this post I will show how you can work with the syslink control. The control provides a way 阅读全文
posted @ 2013-10-23 16:35 一个人的天空@ 阅读(1690) 评论(0) 推荐(0) 编辑
摘要: 转自:http://blog.csdn.net/zdl1016/archive/2009/10/11/4654061.aspx我想说一句“我日,我讨厌KMP!”。KMP虽然经典,但是理解起来极其复杂,好不容易理解好了,便起码来巨麻烦!老子就是今天图书馆在写了几个小时才勉强写了一个有bug的、效率不高的KMP,特别是计算next数组的部分。其实,比KMP算法速度快的算法大把大把,而且理解起来更简单,为何非要抓住KMP呢?笔试出现字符串模式匹配时直接上sunday算法,既简单又高效,何乐而不为?说实话,想到sunday算法的那个人,绝对是发散思维,绝对牛。当我在被KMP折磨的够呛的时候,我就琢磨, 阅读全文
posted @ 2013-10-23 12:24 一个人的天空@ 阅读(15428) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 59 下一页