在某些情况下,我们需要定义自己的异常并且抛出先定义一个错误:1 class MyError(BaseException):2 def __init__(self):3 pass上面定义了一个叫MyError的类,继承自BaseException。在Python中,所有的错误都...
分类:
编程语言 时间:
2014-09-28 00:55:50
阅读次数:
193
因为xcode版本不同,最新的xcode已经不提供我们老版本可以随意创建的空白文档了(而是纯粹的什么都没有的project,是的,什么都没有),所以我们建立在单MVC模板之上,本例以及之前的所有的代码都是在ViewController.m中书写,而不是在AppDelegate.m中。所以我们这里的父视图其实是self.view而不是self.window,所以这里我们讲解的window其实在我们的模板里面只是view的子视图。...
分类:
移动开发 时间:
2014-09-27 20:29:00
阅读次数:
242
WebDriverWait(self, driver, timeout).until(self, method,message=' ')def until(self, method, message=''): """Calls the method provided with the ...
分类:
Web程序 时间:
2014-09-27 16:36:50
阅读次数:
151
有很多对于文本框的编辑和结束编辑的设置需要用到文本框协议,即UITextFieldDelegate:先在AppDelegate.h中加入协议,然后就可以在ViewController.m中使用。比如我们本例中对t1这个文本框对象设置了代理,代理self,即本视图控制器类,所以在本类中使用的方法都会影响t1,即可以设置t1。(最后几句为猜测,后续继续学习看是否如此)。...
分类:
移动开发 时间:
2014-09-27 15:17:29
阅读次数:
169
import unittestclass SimpleUnitTest(unittest.TestCase): def test_Fail(self): self.failUnless(True) def test_Fail(self): self.failI...
分类:
编程语言 时间:
2014-09-27 12:43:19
阅读次数:
355
#include #include #include #include void *thread1(void *arg){ printf("start thread (%u)\n", (unsigned)pthread_self()); printf("thread (...
分类:
其他好文 时间:
2014-09-27 01:39:38
阅读次数:
222
#include #include #include #include //取消线程,是否会释放线程的所有资源?例子:void *thread1(void *arg){ printf("start thread (%u)\n", (unsigned)pthread_self());} ...
分类:
编程语言 时间:
2014-09-27 01:09:09
阅读次数:
270
#include#include#include#include#includevoid *consumer(void *p){ static a = 0; a++; printf("<<<<(%u),%d\n", (unsigned)pthread_self(), a...
分类:
其他好文 时间:
2014-09-27 01:05:09
阅读次数:
233
#include #include #include #include #include void *consumer1(void *p){ do{ printf("<<<(%u),%d\n", (unsigned)pthread_self(),1); ...
分类:
其他好文 时间:
2014-09-27 00:49:19
阅读次数:
219
#include #include #include #include #include void *consumer(void *p){ do{ printf("<<<<(%u),%d\n", (unsigned)pthread_self(), (unsigned int)p...
分类:
其他好文 时间:
2014-09-27 00:28:39
阅读次数:
215