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
有时候我们会需要在界面上拖动view;uiview是继承于uiresponder的,所以可以响应触摸相关的事件。
重点是以下一组方法:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent...
分类:
移动开发 时间:
2014-04-29 13:41:20
阅读次数:
485
paip.输入法编程--英文ati化By音标原理与中文atiEn处理流程 python 代码为例
#---目标
1. en vs enPHati
2.en vs enPhAtiSmp
3.cn vs enPHati
4. cn vs enPhAtiSmp
#两个方法,一个获得enPhAtied代码,一个获得哪的smp版本..
def convert2atiEnPnNo...
分类:
编程语言 时间:
2014-04-28 10:47:43
阅读次数:
360
paip.性能跟踪profile原理与架构与本质-- python扫带java php
##背景
弄个个输入法音标转换atiEnPH工具,老是python性能不的上K,7k记录浏览过k要30分钟了.
##目标
分析一个程序的性能,最终都归结为回答4个基本的问题:
程序运行速度有多快?
运行速度瓶颈在哪儿?
程序使用了多少内存?
内存泄露...
分类:
编程语言 时间:
2014-04-28 10:46:41
阅读次数:
334
paip.元数据驱动的转换-读取文件行到个list理念 uapi java php python总结
#两个思路
1.思路如下:使用file_get_contents()获取txt文件的内容,然后通过explode()把获得的字符串转化为数组。获得数组长度可以使用count()函数
2.使用按照行读取api
在正则表达式中,有一个\n是newline的意思,又有一个\r是carri...
分类:
编程语言 时间:
2014-04-28 10:46:40
阅读次数:
304
当油量不够时从走过的油站中选最大加油量的
#include
#include
#include
#include
using namespace std;
#define MAX_N 10005
struct node{
int dist,fuel;
}t[MAX_N];
bool cmp(const node &a,const node &b)
{
return a.dist<b.dis...
分类:
其他好文 时间:
2014-04-28 10:44:43
阅读次数:
335
paip.utf-8,unicode编码的本质输出unicode文件原理 python
#别的语言,java php都是unicode,走十python不一样.
#enddef
#todo write to unicode encode
fileHandle = open ( r"c:\fmtSmpEnRst.txt", 'w',encoding="UTF-16"...
分类:
编程语言 时间:
2014-04-28 10:28:42
阅读次数:
374
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
paip.日志中文编码原理问题本质解决python
默认的python日志编码仅仅gbk...保存utf8字符错误..输出到个eric5的控制台十默认好像十unicode的,要是有没显示出来的字符,大概十字体问题..调整eric5的字体走ok兰.
#调用封装
from log import *
iniLog (r"c:\enPn2atiEnPh.log")
logx...
分类:
编程语言 时间:
2014-04-28 10:17:40
阅读次数:
395