- 博客(52)
- 收藏
- 关注
Activity简介
se ==> onResume ==> onPause (Activity始终是可见的,是获得焦点的循环) Activity相当于交互窗口,常用布局有五种:LinearLayout、TableLayout、RelativeLayout、FrameLayout、AbsoluteLayout(Tips:会用到的长度单位:px:表示屏幕实际的象素;dp也就是dip,这个和sp基本类似。如果设置表示长度、高度等属性时可以使用dp或sp。但如果设置字体,需要使用sp
2014-12-22 18:01:34
139
原创 python
d5e9f34.png[/img][img]http://dl2.iteye.com/upload/attachment/0097/2069/6fa1cc48-8556-3c78-ae00-7dc3aa9de73c.png[/img]
2014-05-16 17:04:06
128
原创 python django | models
数据库里进行相应的修改活在删除之前表运行syncdb重新创建。手动修改过程:1. sudo python manage.py sqlall depotapp 查看表的所有字段2. sudo python manage.py dbshell 使用django提供的dbshell增加字段 sqlite> begin; sqlite> alter table depotapp_product add column date_available data not null
2013-06-21 19:57:43
78
原创 python django | bootstrap
sudo apt-get install ibus-gtk ibus-qt4 ibus-pinyin ibus-pinyin-db-open-phrasesudo apt-get install ibus-pinyin ibus-pinyin-db-android之后启动ibus, 在小键盘标识处设置ibus的preferences的input method,最后设置system的语言支持为ibus2. 作为一只小菜鸟,继续跟着牛人网站学习django: 2.1 下载bootstr
2013-06-21 03:33:57
94
原创 python django | django-groundwork
le as well!!!4. remember to add the path of your templates directory to 'TEMPLATE_DIRS' in the project's 'settings.py' file 5. add 'django-groundwork' in the settings.py file {InSTALLED_APPS}if errors about the django version and something like
2013-06-21 00:57:54
58
原创 python django | sqlite3
, INSTALLED_APPS}6. python manage.py validate {succeed if 0 errors found}7. python manage.py sqlall appname {generate database model based on the models.py}8. python manage.py syncdb {create db}
2013-06-19 00:09:14
93
原创 django | mvc
d the internal logic of the system to decouple themNote: a pure fabrication is a design class which does not correspond to anything in the domain, e.g. Collection, Factories, UI components...If you want to learn more, please search 'GRASP' or 'Genera
2013-06-18 21:56:48
56
原创 python thread(communicate, join,queue) practices
是次要线程为主要线程执行特定的任务,在执行过程中需要不断报告执行的进度情况。前面的条件变量同步已经涉及到了线程间的通信(threading.Condition的notify方法)。更通用的方式是使用threading.Event对象。threading.Event可以使一个线程等待其他线程的通知。其内置了一个标志,初始值为False。线程通过wait()方法进入等待状态,直到另一个线程调用set()方法将内置标志设置为True时,Event通知所有等待状态的线程恢复运行。还可以通过isSet()方法查询
2013-06-17 07:36:26
278
原创 python GUI(Tkinter) practices
button.pack(side='left') self.hi_there=Tkinter.Button(frame,text='hello',command=self.say_hi) self.hi_there.pack(side='left') def say_hi(self): print 'hi there, this is a test!'win=Tkinter.Tk()Test=Test(win)win.mainloop()fro
2013-06-17 07:32:16
57
原创 Ubuntu下python Django apache环境搭建
/core/handler'[/color]2. no module named server.settings(your project name.settings)[color=red] solution: check the urls in your apache2 config file-->httpd.conf or default, especially the 'PythonPath'[/color]for example:1. create a new p
2013-06-17 07:26:14
60
原创 Google python logpuzzle.py (python 2.7)
ke:10.254.254.28 - - [06/Aug/2007:00:13:48 -0700] "GET /~foo/puzzle-bar-aaab.jpg HTTP/1.0" 302 528 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6""""[colo
2013-06-13 20:37:05
49
原创 Google python copyspecial.py(python 2.7)
call themdef get_specials(dir): com='ls '+ dir status,output=commands.getstatusoutput(com) specials=[] for special in output.split(): if re.findall(r'__(\w+)__',special): specials.append(special) return specialsdef to_di
2013-06-13 10:55:24
281
原创 Google python babyname.py (python 2.7)
e targettext for inspiration.Here's what the html looks like in the baby.html files:...Popularity in 1990....1MichaelJessica2ChristopherAshley3MatthewBrittany...Suggested milestones for incremental development: -Extract the year a
2013-06-12 02:49:17
401
原创 Google python mimic.py (python 2.7)
readit into one giant string and split it once.Build a "mimic" dict that maps each word that appears in the fileto a list of all the words that immediately follow that word in the file.The list of words can be be in any order and shoul
2013-06-10 06:46:40
578
原创 Google python wordcount.py (python 2.7)
me) function that countshow often each word appears in the text and prints:word1 count1word2 count2...Print the above list in order sorted by word (python will sort punctuation tocome before letters -- that's fine). Store all the words as low
2013-06-10 05:12:19
133
原创 Google python string1.py(python 2.7)
function is correct.# The starter code for each function includes a 'return'# which is just a placeholder for your code.# It's ok if you do not complete all the functions, and there# are some additional functions to try in string2.py.# A. do
2013-06-10 01:03:55
181
原创 Google python list2.py (python 2.7)
list or# modify the passed in list.def remove_adjacent(nums): [color=red] for num in nums: if nums.index(num)0 and len(list2)>0: if list1[-1] > list2[-1]: temp.append(list1.pop(-1)) else: temp.append(list2.pop(-1
2013-06-10 00:35:54
92
原创 Google python list1.py(python 2.7)
n does not have a ++ operator, but += works.def match_ends(words): [color=red]temp=0 for string in words: if len(string)>=2 and string[0]==string[len(string)-1]: temp+=1[/color] return temp# B. front_x# Given a list of str
2013-06-09 20:27:50
85
原创 pythonchallenge 20 code (python2.7)
nfo()X-Powered-By: PHP/5.3.3-7+squeeze8Content-Type: image/jpegContent-Range: bytes 0-30202/2123456789Connection: closeDate: Fri, 07 Jun 2013 13:11:35 GMTServer: lighttpd/1.4.28>>> opener1=urllib.FancyURLopener()>>> open
2013-06-09 04:34:42
76
原创 Pythonchallenge Level 19 (python 2.7)
te: I copied the 'indian.wav' on my laptopmy code below:>>> import base64>>> wf=open('/home/..../indian.wav')>>> d=base64.decodestring(wf)>>> t=open('/home/..../df.wav','w')>>> import wave>>
2013-06-09 04:32:31
79
原创 Pythonchallenge Level 18 (python 2.7)
>> import gzip>>> f=gzip.open('/home/****/Downloads/deltas.gz')>>> data=f.read()>>> data=data.splitlines()>>> import difflib>>> left=[]>>> right=[]>>> for row in data: lef
2013-06-08 01:32:21
92
原创 Pythonchallenge Level 17 (python 2.7)
u+should+have+followed+busynothing...'then repeat level 4 processes with the url (........./busynothing=....)find the correct valueat the same time, during the loop, all pages including a cookie, try to figure out useful info.Anyway, the code:&
2013-06-08 01:32:10
79
原创 Pythonchallenge Level 16 (python2.7)
range(0,480):data=[image.getpixel((j,i)) for j in range(0,640)]for p in range(0,640):if data[p]==195:new=data[p:]+data[:p]break;for m,x in enumerate(new):image.putpixel((m,i),x)>>> image.save('c.gif')the answer is 'romance.html'
2013-06-08 01:32:01
105
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人