- 博客(51)
- 资源 (3)
- 收藏
- 关注
Activity简介
Android中Activity的生命周期之两层循环:1. onStart ==> onRestart ==> onResume ==> onPause ==> onStop (可视为生命周期,是获得焦点与失去焦点的交替)onPause ==> onResume ==> onPause (Activity始终是可见的,是获得焦点的循环) Act...
2014-12-22 18:01:34
262
原创 python魔法方法、属性和迭代器(1)
python基础教程 第九章总结:1. 关于__**__的方法,一般都是在使用到相关功能是会自动调用;2. 在关于多层迭代生成器时,如果迭代的是字符串的话,首先是没有必要;其次这样会陷入死循环中,因为字符串的首字母取出来迭代时,首字母会继续被当做一个字符串来无穷迭代。3.生成器主要由:生成器函数与生成器迭代器组成。4. 生成器的方法有send(),在3.0版本中使用next(s...
2014-06-07 16:15:48
158
原创 python 更加抽象
python基础教程第七章 更加抽象 总结:1. 在使用继承时,先继承类中的方法会覆盖后继承类中的同名方法2. 在实例化是,self只得都是实例化类,即使对于继承类3. 一个成员变量会在所有类中公用,要注意命名...
2014-06-04 15:56:49
113
原创 python抽象(1)
关于函数参数方面挺独特的点:1. 参数是字符串(元组以及数字)时, 是不可变的,只能被新的值覆盖。具体例子如下:2. 参数是数据结构如列表时,两个变量同时引用一个列表的时候,它们的确是同时引用一个列表。具体例子如下: 如果想避免这种情况时,就要将整个列表复制,得到一个列表的副本。如: ...
2014-05-28 09:32:10
111
原创 python 字符串
python 字符串小节:python3.3版本中maketrans()方法已被抛弃,转换成了内建函数bytearray.maketrans()、bytes.maketrans()、str.maketrans()。translate()与replace()的区别是前者替换时是一一对应,长度一样,后者没有长度限制。可参考官方文件https://docs.python.org/3.3/...
2014-05-19 16:31:59
111
原创 python
《python基础教程》第一章:基础知识熟悉篇(python3.2 表示八进制如010 需写成0o10!)[img]http://dl2.iteye.com/upload/attachment/0097/2067/9bcb1d50-fb80-311d-933f-39a84d5e9f34.png[/img][img]http://dl2.iteye.com/upload/atta...
2014-05-16 17:04:06
201
原创 python sequence
《python基础教程》第二章序列篇:列表与元组[img]http://dl2.iteye.com/upload/attachment/0097/2046/2990059b-7925-3cbc-8812-b7d8eccef129.png[/img]
2014-05-16 16:49:03
155
原创 静态变量与实例变量,Math 三方法的使用规则
静态变量static 是相对于类而活动的,不需要实例对象,只要程序加载了类的字节码,静态变量就会被分配空间;实例变量则是相对于对象活动的,是对象的属性,必须要有分配内存给该对象。Math类中提供了三个与取整有关的方法:ceil、floor、round,这些方法的作用与它们的英文名称的含义相对应。1. ceil的英文意义是天花板,该方法就表示向上取整;2. floor的英文意...
2014-02-20 15:44:43
90
原创 new String和String中的equlas VS. ==
在JAVA中,String的使用:1.String a = "abc";2.String b = "abc";3.String c = new String("abc");以上的区别:1中只会创建一个对象"abd",并把"abc"存放在字符常量池中,当2又要赋值"abc"时,则会从字符常量池中搜索看是否已存在,如果存在,则直接指向"abc"。
2014-02-20 15:17:32
110
原创 python django | models
学习大牛的网站:models类修改后数据库也应同样更新,但是syncdb命令仅仅创建数据库里的表,并不对数据模型进行同步修改或者删除。此时需要手动在数据库里进行相应的修改活在删除之前表运行syncdb重新创建。手动修改过程:1. sudo python manage.py sqlall depotapp 查看表的所有字段2. sudo python manage.py dbsh...
2013-06-21 19:57:43
86
原创 python django | test
之前用JUnit比较多,发现其实它们语法都很类似,也不多说了,把大神的代码写了一遍,运行的command: sudo python manage.py test depotapp
2013-06-21 04:52:27
84
原创 python django | bootstrap
1. 在Ubuntu12下想安装SCIM,把ibus都卸载了,结果没能成功。。。放弃了一段时间想用英语更新发现英语跟不上,最后还是默默的又把ibus安装回来了。。。sudo apt-get install ibus-gtk ibus-qt4 ibus-pinyin ibus-pinyin-db-open-phrasesudo apt-get install ibus-pinyin ibus...
2013-06-21 03:33:57
95
原创 python django | django-groundwork
django (1.5)1. python manage.py groundwork appname Modelname2. move contents of the new 'urls.py' file to the project's 'urls.py', then delete the former file3. remove the new 'settings.py' fi...
2013-06-21 00:57:54
119
原创 python django | sqlite3
1. python django-admin.py startproject projectname2. python manage.py startapp appname3. models.py==>data {ID is default defined}4. sqlite3 development.sqlite35. update setting.py {DATABASES...
2013-06-19 00:09:14
80
原创 django | mvc
brief introduction of MVC:1. Model: the basic data structures of your application2. View: the User Interface (UI)3. Controller: is a [color=red]pure fabrication[/color] placed between the GUI an...
2013-06-18 21:56:48
60
原创 python thread(communicate, join,queue) practices
[url]http://www.cnblogs.com/holbrook/archive/2012/02/23/2365420.html[/url]""" python多线程编程(7):线程间通信很多时候,线程之间会有互相通信的需要。常见的情形是次要线程为主要线程执行特定的任务,在执行过程中需要不断报告执行的进度情况。前面的条件变量同步已经涉及到了线程间的通信(threadin...
2013-06-17 07:36:26
98
原创 python thread practices
materials:[url]http://www.cnblogs.com/holbrook/archive/2012/02/23/2365420.html[/url]"""" Python中使用线程有两种方式:函数或者用类来包装线程对象。1、 函数式:调用thread模块中的start_new_thread()函数来产生新线程。线程的结束可以等待线程自然结束,也可以在线程函数中...
2013-06-17 07:33:57
75
原创 python GUI(Tkinter) practices
import Tkinterclass Test: def __init__(self,master): frame=Tkinter.Frame(master) frame.pack() self.button=Tkinter.Button(frame,text='Quit',fg='red',command=frame.quit) self....
2013-06-17 07:32:16
135
原创 Ubuntu下python Django apache环境搭建
if you encounter these problems during your installation:1. no module named modpython[color=red] solution: download the modpython.py, and copy to '/usr/local/lib/python2.7/dist-packages/django...
2013-06-17 07:26:14
65
原创 Google python logpuzzle.py (python 2.7)
#!/usr/bin/pythonimport osimport reimport sysimport urllib"""Logpuzzle exerciseGiven an apache logfile, find the puzzle urls and download the images.Here's what a puzzle url looks li...
2013-06-13 20:37:05
124
原创 Google python copyspecial.py(python 2.7)
#!/usr/bin/pythonimport sysimport reimport osimport shutilimport commandsimport zipfile"""Copy Special exercise"""# +++your code here+++# Write functions and modify main() to...
2013-06-13 10:55:24
322
原创 Google python babyname.py (python 2.7)
#!/usr/bin/pythonimport sysimport re"""Baby Names exerciseDefine the extract_names() function below and change main()to call it.For writing regex, it's nice to include a copy of th...
2013-06-12 02:49:17
278
原创 Google python mimic.py (python 2.7)
#!/usr/bin/python -ttRead in the file specified on the command line.Do a simple split() on whitespace to obtain all the words in the file.Rather than read the file line by line, it's easier to...
2013-06-10 06:46:40
484
原创 Google python wordcount.py (python 2.7)
#!/usr/bin/python -ttThe main() below is already defined and complete. It calls print_words()and print_top() functions which you write.1. For the --count flag, implement a print_words(filena...
2013-06-10 05:12:19
191
原创 Google python string1.py(python 2.7)
#!/usr/bin/python -tt# Basic string exercises# Fill in the code for the functions below. main() is already set up# to call the functions with a few different inputs,# printing 'OK' when each...
2013-06-10 01:03:55
161
原创 Google python list2.py (python 2.7)
#!/usr/bin/python -tt# D. Given a list of numbers, return a list where# all adjacent == elements have been reduced to a single element,# so [1, 2, 2, 3] returns [1, 2, 3]. You may create a new...
2013-06-10 00:35:54
147
原创 Google python list1.py(python 2.7)
# A. match_ends# Given a list of strings, return the count of the number of# strings where the string length is 2 or more and the first# and last chars of the string are the same.# Note: pytho...
2013-06-09 20:27:50
165
原创 pythonchallenge 20 code (python2.7)
absolutely lost...reference:http://past.makto.me/post/2011-11-26/18573723>>> import urllib>>> web=urllib.urlopen('http://butter:fly@www.pythonchallenge.com/pc/hex/unreal.jpg')>>> print web.i...
2013-06-09 04:34:42
91
原创 Pythonchallenge Level 19 (python 2.7)
After looking into the source codesome key words attracted me: 'encoding:base64' 'indian.wav'another interesting hint is about the pic: the colours for the the mainland and ocean are exchangedNo...
2013-06-09 04:32:31
90
原创 Pythonchallenge Level 18 (python 2.7)
the difference between these two images are brightness level, hence go to the 'brightness.html'download 'delta.gz' and unzip the filelook into the dataset, the regular stuff would come out...>...
2013-06-08 01:32:21
62
原创 Pythonchallenge Level 17 (python 2.7)
I spent much more time on this problem.the information behind this pic: 1. the image from level42. lots of cookies==> go into the corresponding cookies of level4 and you will find a hint:'yo...
2013-06-08 01:32:10
97
原创 Pythonchallenge Level 16 (python2.7)
This rule in my view is not so easy to figure out....however, the code is generated depends on others' solution:>>> data=[]>>> image=Image.open('/home/****/Downloads/mozart.gif')>>> for i in...
2013-06-08 01:32:01
69
原创 Pythonchallenge Level 15 (python2.7)
what kinds of information can you remember for a calendar? year?date?month?weekdays?leapyear?... try to find these from the imagethe code is:>>> import calendar>>> for year in range(1006,1997,10...
2013-06-08 01:31:51
71
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人