본문 바로가기

IT라이프/Linux11

M2Crypto 설치 on Mac OS X 10.8 아래 차례대로 설치하면 되겠다.처음부터 M2Crypto 설치하기전에 2 개가 먼저 설치되어야 한다. 우선 OpenSSL 을 설치 1. Installing the OpenSSL headershttp://www.openssl.org/source/ $ cd openssl-x-x-x$ ./Configure --prefix=/usr/local darwin64-x86_64-cc$ make && make test$ sudo make install 다음에는 swig 을 설치 2. Installing the swig with out PCRE(Perl Compatible Regular Expressions)http://www.swig.org/download.html $ cd swig-x.x.x$ ./configure --.. 2013. 10. 9.
Django template 変数繰り返し 変数名説明forloop.counter現在のループ回数番号 (1 から数えたもの)forloop.counter0現在のループ回数番号 (0 から数えたもの)forloop.revcounter末尾から数えたループ回数番号 (1 から数えたもの)forloop.revcounter0末尾から数えたループ回数番号 (0 から数えたもの)forloop.first最初のループであれば True になりますforloop.last最後のループであれば True になりますforloop.parentloop入れ子のループの場合、一つ上のループを表します 2013. 9. 30.
8자리 유니크코드 만들기 회사에서 일을 하다가 고유아이디를 만들어서 넣어야 할 일이 생겼다.아래 방법으로 약 49억개(?)의 경우의 수가 만들어진다고 하는데... 뭐 유저가 그렇게 될일은하늘이 두쪽이 나도 없을테이고...아래 방법으로 시작해보았다. CRC32 를 이용할때는 binascii 을 임포트해서 사용한다.LONG 형으로 바꿨다가 문자열로 다시 바꿔야 하는 작업이 필요하다. import binasciiimport struct text = "고유아이디"crc = binascii.crc32(text) def crc2hex(crc): res='' for i in range(4): t=crc & 0xff crc >>= 8 res='%02x%s' % (t, res) print res print "CRC32(hex1):", crc2h.. 2013. 9. 30.
반응형