Python

SCP on paramiko

import paramiko class SCPClient(paramiko.SSHClient): def read_response(self, stdout): c = ord(stdout.read(1)) if c == 0: return if c == -1: raise paramiko.SSHException("Remote scp terminated unexpectedly") if c != 1 and c != 2: raise param…

log2

In Python, there isn't a function equivalent to log2(3). You say import math def log2(n): math.log(n) / math.log(2) to get x in n = 2**x. I didn't know but it's quite common. I must study mathematic more.But I guess it is slow because it c…

Template engine by Python (continued)

Almost a week passed sinceTemplate engine by python - umitanuki::quartet Later, I introduce my idea. Ok, the main concept of my idea is "a template system that is written by indent-oriented language should be explicitly indented". What is …

Heated-up Matz's blog

Matz quoted http://mindblind.net/2008/01/24/attacking-php/ in his blog. Against his opinion, many people say like "PHP is a poor language", "PHP is not so bad", "PHPers are bad" or "PHPers are not so stupid". The blog was heated up.Matzに…

iterator of file object and tell()

There was a need to record each file pointer between ascii file lines. I just found the python documentation http://docs.python.org/lib/bltin-file-objects.html and thought you use file.tell() ary = [] lptr = 0 rptr = 0 f = open("file.txt")…

Template engine by python

Python is a powerful language. Through many languages I have written, it is one of the most comfortables. But template engine is an annoying problem in Python. I believe the reason for that is based on its indent system.For example, JSP ca…