@staticmethod def instance(): """Returns a global `IOLoop` instance. Most applications have a single, global `IOLoop` running on ...
分类:
其他好文 时间:
2014-09-22 14:36:42
阅读次数:
199
在app的module里的build.gradle文件中,在android { ...}里面加上这样一段代码,即可修改生成的apk的文件名。
android.applicationVariants.all { variant ->
def file = variant.outputFile
variant.outputFile = new File(fil...
分类:
其他好文 时间:
2014-09-22 12:49:12
阅读次数:
201
类 / 对象【《快学Scala》笔记】一、类1、Scala中的类是公有可见性的,且多个类可以包含在同一个源文件中;1 class Counter{2 private var value = 0 //类成员变量必须初始化,否则报错3 4 def increment(){ /...
分类:
其他好文 时间:
2014-09-22 02:24:41
阅读次数:
245
#pip??install??tornado
#cat??web.py
import?tornado.ioloop
import?tornado.web
class?MainHandler(tornado.web.RequestHandler):
????def?get(self):
????????self.write(‘hello,world...
分类:
其他好文 时间:
2014-09-21 22:13:51
阅读次数:
324
TableDefinition 的对象,就是我们在写 migrate 的时候使用的对象 t如下class SomeMigration "ActiveRecord::ConnectionAdapters::TableDefinition" end end def down ... ...
分类:
其他好文 时间:
2014-09-21 20:22:51
阅读次数:
198
创建 migration 需要继承自 ActiveRecord::Migration 类,常见如下:class SomeMigration < ActiveRecord::Migration def up end def down endendclass SomeMigration < ...
分类:
其他好文 时间:
2014-09-21 16:58:51
阅读次数:
211
任何Python程序都可以作为模块导入;在导入自己的模块时,需要添加路径:
import sys
sys.path.append('absolute-path');
(__pycache__是执行main.py时创建的)
hello.py内容:
def sayHello():
print('hello,world')
main.py...
分类:
编程语言 时间:
2014-09-20 21:26:49
阅读次数:
243
对象是组成JavaScript的基本单元,在JS中,一切东东其实都是对象,而且功能非常强大,它不仅风格独特,功能也与众不同。一、引用(reference)贵族娱乐城引用的概念是JS的基础之一,它是指向对象实际位置的指针。见下面的例子:1varitems =newArray("abc","def","...
分类:
Web程序 时间:
2014-09-20 16:03:49
阅读次数:
355
函数的定义def square_sum(a+b) c = a**2+b**2 print c函数的功能是求两个数的平方和return 可以返回多个值,相当于返回一个tuplereturn a,b,c在Python中,当程序执行到return的时候,程序将停止执行函数内余下的语句。return并不.....
分类:
编程语言 时间:
2014-09-20 02:16:06
阅读次数:
255
函数在编程语言中是很重要的一部分吧,在面向对象的语言中一般称为方法。在python中定义一个函数很简单:def functionName(): #statement一个很简单的例子,斐波那契数列:>>> def fib(n): a,b=0,1 while a>> fib(20)0 1 1 2 ...
分类:
编程语言 时间:
2014-09-19 22:22:46
阅读次数:
342