编程
programming
在启动nginx之前还需要添加nginx用户组,否则会提示
[emerg]: getpwnam(“nginx”) failed
添加用户组
sudo adduser --system --no-create-home --disabled-password --group nginx
原来又是个bug http://qc.embarcadero.com/wc/qcmain.aspx?d=71796 去注册表HKEY_CURRENT_USER\Software\Borland\BDS\5.0\Transfer 一看就明白了![]()
看http://qc.embarcadero.com/wc/qcmain.aspx?d=20086
fpc编译结果一样!
type TVector = array of integer; TMatrix = array of array of integer; procedure TForm1.Button1Click(Sender: TObject); var A, B : TMatrix; C, D : TVector; begin SetLength(C, 2); C[0] := 1; //this duplicates the vector D := Copy(C); D[0] := 2; //correctly shows "1" ShowMessage(IntToStr(C[0])); SetLength(A, 2, 2); A[0,0] := 1; //this should duplicate the matrix B := Copy(A); B[0,0] := 2; //oops: it shows "2" ShowMessage(IntToStr(A[0,0])); end;
改
source = args.encode("utf-8") cmd = "java -jar -Djava.awt.headless=true \"%s\" -charset UTF-8 -pipe" % (self.plantuml_jar) {{{ #!PlantUML @startuml skinparam defaultFontName simsun 软件 -> Bob: Authentication Request Bo汉字b --> Alice: Authentication Response Alice -> Bob: Another authentication Request Alice <-- Bob: another authentication Response @enduml }}}
import time import datetime today = datetime.datetime.today()+ datetime.timedelta(days =10) print today
import csv def unicode_csv_reader(utf8_data, dialect=csv.excel, **kwargs): csv_reader = csv.reader(utf8_data, dialect=dialect, **kwargs) for row in csv_reader: yield [unicode(cell, 'utf-8') for cell in row] spamReader =unicode_csv_reader(open('a.csv', 'rb')) for row in spamReader: print ', '.join(row)
下午网上检索了下Python排列组合代码还真多!
自己测试的是用循环实现,检索到的都是递归,还是循环快点!
要用py写彩票分解合并代码可是会少很多行!
强!很好用!
#http://code.activestate.com/recipes/577031-simple-permutations/ def perm(chars, m, wrd="", wrds=[]): if len(wrd) == m: return wrd for i in range(0, len(chars)): w = perm(chars, m, wrd+chars[i]) if type(w) == type(""): wrds.append(w) return wrds
#http://code.activestate.com/recipes/190465/ def xcombinations(items, n): if n==0: yield [] else: for i in xrange(len(items)):
还是 D快 写两个彩票号码分解函数,99转4,还不到400万注!
delphi代码执行0。几秒,
而python 要 大于16秒![]()
也就是说1台服务器跑d写的程序搞定的
要换py得 N台才能扛住![]()
Drupal theme by Kiwi Themes.