`
yy_gy
  • 浏览: 34230 次
  • 性别: Icon_minigender_2
社区版块
存档分类
最新评论
文章列表
在JAVA中,String的使用: 1.String a = "abc"; 2.String b = "abc"; 3.String c = new String("abc"); 以上的区别: 1中只会创建一个对象"abd",并把"abc"存放在字符常量池中,当2又要赋值"abc"时,则会从字符常量池中搜索看是否已存在,如果存在,则直接指向"abc"。而对于3,则会创建两个对象,分布式new String 和 "abc"。 new S ...
学习大牛的网站: models类修改后数据库也应同样更新,但是syncdb命令仅仅创建数据库里的表,并不对数据模型进行同步修改或者删除。此时需要手动在数据库里进行相应的修改活在删除之前表运行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 ...
之前用JUnit比较多,发现其实它们语法都很类似,也不多说了,把大神的代码写了一遍, 运行的command: sudo python manage.py test depotapp
1. 在Ubuntu12下想安装SCIM,把ibus都卸载了,结果没能成功。。。放弃了一段时间想用英语更新发现英语跟不上,最后还是默默的又把ibus安装回来了。。。 sudo apt-get install ibus-gtk ibus-qt4 ibus-pinyin ibus-pinyin-db-open-phrase sudo apt-get install ibus-pinyin ibus-pinyin-db-android 之后启动ibus, 在小键盘标识处设置ibus的preferences的input method,最后设置system的语言支持为ibus 2. 作为一只小菜鸟,继续 ...
django (1.5) 1. python manage.py groundwork appname Modelname 2. move contents of the new 'urls.py' file to the project's 'urls.py', then delete the former file 3. remove the new 'settings.py' file as well !!! 4. remember to add the path of your templates directory to 'TEMPLATE_DIRS' in the project ...
1. python django-admin.py startproject projectname 2. python manage.py startapp appname 3. models.py==>data {ID is default defined} 4. sqlite3 development.sqlite3 5. update setting.py {DATABASES, INSTALLED_APPS} 6. python manage.py validate {succeed if 0 errors found} 7. python manage.py sqlall a ...
brief introduction of MVC: 1. Model: the basic data structures of your application 2. View: the User Interface (UI) 3. Controller: is a pure fabrication placed between the GUI and the internal logic of the system to decouple them Note: a pure fabrication is a design class which does not correspond t ...
http://www.cnblogs.com/holbrook/archive/2012/02/23/2365420.html """ python多线程编程(7):线程间通信 很多时候,线程之间会有互相通信的需要。常见的情形是次要线程为主要线程执行特定的任务,在执行过程中需要不断报告执行的进度情况。前面的条件变量同步已经涉及到了线程间的通信(threading.Condition的notify方法)。更通用的方式是使用threading.Event对象。 threading.Event可以使一个线程等待其他线程的通知。其内置了一个标志,初始值为False。线 ...
materials:http://www.cnblogs.com/holbrook/archive/2012/02/23/2365420.html """" Python中使用线程有两种方式:函数或者用类来包装线程对象。 1、  函数式:调用thread模块中的start_new_thread()函数来产生新线程。线程的结束可以等待线程自然结束,也可以在线程函数中调用thread.exit()或thread.exit_thread()方法。 import time import thread def timer(no,interval):   cnt ...
import Tkinter class Test:   def __init__(self,master):     frame=Tkinter.Frame(master)     frame.pack()     self.button=Tkinter.Button(frame,text='Quit',fg='red',command=frame.quit)     self.button.pack(side='left')     self.hi_there=Tkinter.Button(frame,text='hello',command=self.say_hi)     self.h ...
if you encounter these problems during your installation: 1. no module named modpython    solution: download the modpython.py, and copy to '/usr/local/lib/python2.7/dist-packages/django/core/handler' 2. no module named server.settings(your project name.settings)     solution: check the urls in your ...
#!/usr/bin/python import os import re import sys import urllib """Logpuzzle exercise Given an apache logfile, find the puzzle urls and download the images. Here's what a puzzle url looks like: 10.254.254.28 - - [06/Aug/2007:00:13:48 -0700] "GET /~foo/puzzle-bar-aaab.jpg HTTP/1.0 ...
#!/usr/bin/python import sys import re import os import shutil import commands import zipfile """Copy Special exercise """ # +++your code here+++ # Write functions and modify main() to call them def get_specials(dir):   com='ls '+ dir   status,output=commands.getstat ...
#!/usr/bin/python import sys import re """Baby Names exercise Define the extract_names() function below and change main() to call it. For writing regex, it's nice to include a copy of the target text for inspiration. Here's what the html looks like in the baby.html files: ... < ...
#!/usr/bin/python -tt Read 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 read it into one giant string and split it once. Build a "mimic" dict that maps each word tha ...
Global site tag (gtag.js) - Google Analytics