编程

programming

CSDN 真白痴

由 非洲饿鱼 于 星期三, 12/21/2011 - 20:44 发表

broken heartcsdn真白痴竟然明文保存用户密码!电驴一查 csdn 600 就。。。。

nginx: [emerg] getpwnam("nginx") failed

由 非洲饿鱼 于 星期五, 08/19/2011 - 11:38 发表

在启动nginx之前还需要添加nginx用户组,否则会提示

[emerg]: getpwnam(“nginx”) failed

添加用户组

sudo adduser --system --no-create-home --disabled-password --group nginx

删除Delphi 2007 无效的菜单actionclientitem9

由 非洲饿鱼 于 星期六, 07/23/2011 - 10:13 发表

原来又是个bug http://qc.embarcadero.com/wc/qcmain.aspx?d=71796 去注册表HKEY_CURRENT_USER\Software\Borland\BDS\5.0\Transfer 一看就明白了cheeky

Delphi多维数组Copy有问题!

由 非洲饿鱼 于 星期日, 07/17/2011 - 20:11 发表

看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;

让Trac PlantUML Plugin支持汉字

由 非洲饿鱼 于 星期五, 07/15/2011 - 18:34 发表


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
}}}

Delphi 64位!不错!

由 非洲饿鱼 于 星期二, 07/12/2011 - 19:17 发表

不错!很好!加油!laugh

日期相加

由 非洲饿鱼 于 星期一, 07/11/2011 - 15:44 发表

import time
import datetime
 
today = datetime.datetime.today()+ datetime.timedelta(days =10)
print today

读取UTF8 CSV文件

由 非洲饿鱼 于 星期一, 07/11/2011 - 10:57 发表

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排列组合代码

由 非洲饿鱼 于 星期日, 07/03/2011 - 16:17 发表

下午网上检索了下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)):

还是Delphi快

由 非洲饿鱼 于 星期五, 07/01/2011 - 21:59 发表

还是 D快 写两个彩票号码分解函数,99转4,还不到400万注!

delphi代码执行0。几秒,

而python 要 大于16秒broken heart

也就是说1台服务器跑d写的程序搞定的

要换py得 N台才能扛住crying

同步内容
Drupal theme by Kiwi Themes.