现在位置: 首页 > tibia发表的所有文章
  • 08月
  • 06日
综合 ⁄ 共 3000字 评论关闭
source:http://effbot.org/zone/python-with-statement.htm Fredrik Lundh | October 2006 | Originally posted to online.effbot.org Judging from comp.lang.python and other forums, Python 2.5’s new withstatement seems to be a bit confusing even for experienced Python programmers. As most other things in Python, the with statement is actually very simple, once you understand the problem it’s trying to solve. Consider this piece of code: set things up try: do something fina......
阅读全文
  • 01月
  • 09日
编程语言 ⁄ 共 1214字 评论关闭
Lua回调函数实例 local m = {} local list = {name="hello",age=12} m.call_back_fun_print = function(printID) print(printID .. "-->" .. list[printID]) end m.add_list = function(key,value,call_back_fun) key = tostring(key) list[key] = value call_back_fun(key) end m.add_list("address","beijing",m.call_back_fun_print) --address-->beijing return m C++回调函数实例 #include <stdlib.h> #include <iostream> using namespace std; typedef void(*Fun)(int,int,int); /......
阅读全文
  • 08月
  • 21日
综合 ⁄ 共 5298字 评论关闭
1.内购——应用内购买                       我所说的内购——也可以说是应用内购买 大家都知道通过苹果应用程序商店有三种主要赚钱的方式: 1.直接收费(与国内大部分用户的消费习惯相悖,如果要收费,直接收高的,别收6块钱) 2.广告(降低用户体验 应用程序名称带Lite可以添加广告) 3.内购 至于设计哪些卖钱?产品经理需要认真考虑和调研的。记录用户行为是可以帮助产品经理确认哪些收费! 所以要做好游戏,一定要研究心理,要研究哲学,哈哈。   2.内购的类别有哪几种呢?                ......
阅读全文
  • 05月
  • 16日
综合 ⁄ 共 230字 评论关闭
Xcode 错误- Could not launch app - No such file or directory Error. 蛋疼的一个XCode bug,基本上应该不是工程本身问题。 解决方法: 1、拔掉设备,删除之前Build的内容 2、退出Xcode,不是关闭窗口 3、删除那个/Users/XXX/Library/Developer/Xcode/DerivedData/XXX-grgrmtzqajhyqgghabyjttajwbsm文件夹 4、启动XCode连接设备,现在应该OK了
阅读全文
  • 05月
  • 14日
综合 ⁄ 共 1907字 评论关闭
<span style="font-size:14px;">#include <opencv\cv.h> #include <opencv\highgui.h> #include <stdio.h> int main( int argc, char** argv ){ IplImage* pFrame = NULL; IplImage* pFrImg = NULL; IplImage* pBkImg = NULL; CvMat* pFrameMat = NULL; CvMat* pFrMat = NULL; CvMat* pBkMat = NULL; CvCapture* pCapture = NULL; int nFrmNum = 0; cvNamedWindow("video", 1); cvNamedWindow("background",1); cvNamedWindow("foreground",1); c......
阅读全文
  • 05月
  • 13日
综合 ⁄ 共 684字 评论关闭
Binary search is a famous question in algorithm. For a given sorted array (ascending order) and a target number, find the first index of this number in O(log n) time complexity. If the target number does not exist in the array, return -1. 样例 If the array is [1, 2, 3, 3, 4, 5, 10], for given target 3, return 2. 挑战 If the count of numbers is bigger than MAXINT, can your code work properly? class Solution { /** * @param nums: The integer array. * @param target: T......
阅读全文
  • 04月
  • 16日
综合 ⁄ 共 1950字 评论关闭
  内存未对齐是指cpu要读取N字节数据,但数据的起始地址不能被N所整除,导致效率降低,甚至异常的出现。例如当cpu读取一个int类型的变量,而变量地址是0x10005的时候就产生未对齐访问。 自然对齐:     N字节的数据类型需要放在起始地址为被N整除的地址这称为自然对齐。并不是所有体系结构的计算机带都要求自然对齐,有的可以指定对齐方式。但是为了达到好的可移植性编写代码的时候最好都用自然对齐方式。 未对齐的影响     未对齐的内存访问在不同的体系结构中会有不同的效果:有一些计算机可以透明的处理未对齐访问,但效率会降......
阅读全文
  • 04月
  • 12日
综合 ⁄ 共 7400字 评论关闭
文章目录 谁能覆盖谁: 描述 代码 线段树的特性: 开多大数组来存线段树? 线段树表示的区间长度为k, 则叶节点个数k,线段树作为一棵 完全二叉树,它的总节点个数为n=2*k-1。  并且: 线段树的左右子树 叶节点个数相差不超过1.  假定线段树的深度为h。则深度h对应的满二叉树节点个数为2^h-1. 下面证明: 2^h - 1 >= n > (2^(h-1) -1), 可以用反证法证明 首先,证明引理1:随着线段树的节点个数 2*k-1 增大,  深度不会出现反而减小的情况。 归纳法即可: k=1: h = ......
阅读全文
  • 03月
  • 16日
综合 ⁄ 共 4449字 评论关闭
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <windows.h> #include "avformat.h"#include "avcodec.h"#include "swscale.h" #pragma comment (lib, "avcodec.lib")#pragma comment (lib, "avformat.lib")#pragma comment (lib, "avutil.lib")#pragma comment (lib, "swscale.lib") #ifndef _WINGDI_#define _WINGDI_ typedef struct tagBITMAPFILEHEADER {        WORD    bfType;        DWORD   bfSize;        WORD    bfReserved1;        WORD    bfReserved2;        DWORD......
阅读全文
  • 02月
  • 22日
综合 ⁄ 共 1952字 评论关闭
Problem Description Angel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, M <= 200) matrix. There are WALLs, ROADs, and GUARDs in the prison. Angel's friends want to save Angel. Their task is: approach Angel. We assume that "approach Angel" is to get to the position where Angel stays. When there's a guard in the grid, we must kill him (or her?) to move into the grid. We assume that we moving up, down, right, left takes us 1 unit time,......
阅读全文
  • 02月
  • 09日
综合 ⁄ 共 4550字 评论关闭
原文地址: http://www.aboutyun.com/forum.php?ctid=3&mod=viewthread&tid=7476 Openstack各种部署工具介绍 问题导读: Openstack最早的安装脚本,通过直接git源码,进行安装的是哪个部署工具?Rackspace Private Cloud是一个什么工具?puppet在openstack中可以用来做什么?Folsom安装脚本是否支持quantum与nova network?雅虎搞的Openstack安装脚本,用什么语言写的?redhat系列部署工具都有哪些?Fuel这是Mirantis出品的部署安装工具,2013年10月份,推出他的3.2版本,让人很震撼,基本算是把Openstack所有的部署都web......
阅读全文
  • 01月
  • 17日
综合 ⁄ 共 3493字 评论关闭
  有一些场景,我们需要向用户展示一系列的页面。比如我们正在开发一个看漫画的应用,可能就需要向用户展示一张一张的漫画图片,用户使用手指滑动屏幕,可以在前一幅漫画和后一幅漫画之间切换。这个时候ViewFlipper就是一个很好的选择。 1)View切换的控件—ViewFlipper介绍 ViewFilpper类继承于ViewAnimator类。而ViewAnimator类继承于FrameLayout。 查看ViewAnimator类的源码可以看出此类的作用主要是为其中的View切换提供动画效果。该类有如下几个和动画相关的方法。 setInAnimation:设置View进入屏幕时候使用的动画。该方法有......
阅读全文