12 2013 档案
摘要:django的模型from django.db import models""" A model pair to map car and its manufacturer"""class Manufacturer(models.Model): brand = models.CharField(max_length=100) location = models.CharField(max_length=100) def __unicode__(self): return self.brand class Meta: ordering =
阅读全文
摘要:django User model operationthis tutorial will guide us to know how to manipulate django User model.Read User object derived from databasefrom django.contrib.auth.models import User# Those two lines are different even if there is only one user 'admin' who registered beforeauser = User.objects
阅读全文
摘要:Here I got a very neat plugin for vim which is awesome indeed.It's from youtube years before.So let's check this out. :)http://www.youtube.com/watch?v=67OZNp9Z0CQ&noredirect=1you can download the reference tools here: https://github.com/klen/python-mode#how-to-installSomeone mentioned ab
阅读全文
摘要:Read by linux/GNU commandsLet's follow and start from here:http://django-tastypie.readthedocs.org/en/latest/tutorial.html#creating-resourcesAccording to tastypie's concept, Tastypie properly handles the Accept header.So we can use linux/GNU commands to do some fancy things!Bash script to get
阅读全文
摘要:tastypie is a good thing.Haven't test it thoroughly. Gonna need some provement.Now I will introduct how to use tastepie for newbies.Let me introduce all the equipments I have to deploy tastypie.1) linuxmint 132) virtualenv ( sudo apt-get install python-virtualenv )3) install django==1.5 in the v
阅读全文
摘要:Its one of the primary authors' lecture on pyCon: http://www.youtube.com/watch?v=Zv26xHYlc8s&noredirect=1What is Tastypie A REST framework for django Designed for extension Supports both Model & non-Model datafor more information, please visit http://tastypieapi.org1) make good use of HT
阅读全文
摘要:dango, 怎么说呢,什么东西都内置了,什么东西都是自己的东西。用过flask, cherrypy, web.py, pyramid 等等python 框架后,再选用dango 觉得,理念有很大的区别。藏着掖着的嫌疑比较大,高度封装,但是操作起来貌似省事情。时间久了会不会python的标准库不知道怎么用了,呵呵~这里一些简单的资料也许挺有用的。http://django-chinese-docs.readthedocs.org/en/latest/intro/tutorial01.htmlhttp://django-chinese-docs.readthedocs.org/en/latest
阅读全文
摘要:原文地址:http://www.cnblogs.com/XL-Liang/archive/2012/05/03/2481310.html这个地址也许更有帮助:http://www.cppblog.com/zzg/archive/2009/05/29/86066.html(这里有很多关于数据库处理的技巧)这么做,是新建了一个虚拟机,把数据库服务器放在虚拟机里面跑,然后通过虚拟机配置端口映射。一个电脑母机里面有很多子机的服务。这样有助于模拟与演示。1、登陆mysql数据库 mysql -u root -p 查看user表mysql> use mysql;Database changedmys
阅读全文
摘要:This is a great tutorial about tmux quick start:http://www.youtube.com/watch?v=wKEGA8oEWXw&noredirect=1and its text script , just read it :)http://timestream.net/screencasts/tmux-script.txtHere's the very nice functionailities.1)install tmux2)tmux works in this way.terminal ----- Tmux client
阅读全文
摘要:http://kivy.org/docs/api-kivy.uix.gridlayout.html?highlight=gridlayout#kivy.uix.gridlayoutIt's so nice to try this one:from kivy.app import Appfrom kivy.uix.gridlayout import GridLayoutfrom kivy.uix.label import Labelfrom kivy.uix.textinput import TextInputfrom kivy.uix.button import Buttonclass
阅读全文
摘要:Now that you've successfully coded an app. Now you want to deploy it to Android.So now we would need to have a look of this, from its official site:http://kivy.org/docs/guide/packaging.htmlLet's check this out.Mainly for Android .http://kivy.org/docs/guide/packaging-android.htmllet's do
阅读全文
摘要:http://kivy.org/docs/guide/basic.html#quickstartI followed this tutorial about how to create basic kivy application*********************Creating a kivy application is as simple as:sub-classing theAppclassimplementing itsbuild()method so it returns aWidgetinstance (the root of your widget tree)instan
阅读全文
摘要:Let's talk about kivy's EventDispatcher here:The codes I have tried here:codes here:from kivy.event import EventDispatcherclass MyEventDispatcher(EventDispatcher): def __init__(self, **kwargs): self.register_event_type('on_test') super(MyEventDispatcher, self).__init__(**kwargs) ...
阅读全文
摘要:[转]python普通继承方式和super继承方式原文出自:http://www.360doc.com/content/13/0306/15/9934052_269664772.shtml原文的错误,已经被我修改掉了。普通继承:class FooParent(object): def __init__(self): self.parent='Im the parent.' print 'Parent' def bar(self, message): print message, 'from Parent'class FooChild(Foo...
阅读全文
摘要:Python tips: 什么是*args和**kwargs?原文地址:http://www.cnblogs.com/fengmk2/archive/2008/04/21/1163766.html先来看个例子:def foo(*args, **kwargs): print 'args = ', args print 'kwargs = ', kwargs print '---------------------------------------'if __name__ == '__main__': foo(1,2,3,4) fo
阅读全文