ImageMagick Notes
- 尺寸缩放
convert -resize 640x960 input.jpg output.jpg
convert -resize 75% input.jpg output.jpg
- 去除多余 Exif 等信息
convert -strip input.jpg output.jpg
- 调节压缩比例
convert -quality 75% input.jpg output.jpg
Happy in life
及时行善,能帮别人的时候就伸手帮一把,对你来说是举手之劳,对别人就是暖心之举。
及时行乐,善待自己,不必要那么累。
py2exe notes
Python 2.6 以上版本报错:
error: MSVCP90.dll: No such file or directory
Python 2.5 及以下运行时需要的 runtime DLL 是 MSVCR71.dll,这个打包时候会自动包含进来;Py2.6 及以上运行时需要的 runtime DLL 是 MSVCR90.dll,这个需要手动加载。在 setup.py options 字典添加 “dll_excludes”: [“MSVCP90.dll”] 解决。via
几个 options 参数 via:
- optimize:2 => extra optimization
- includes:list of module names to include
- compressed:1 => create a compressed zipfile
- bundle_files:1 => bundle everything, including the Python interpreter
application failed to initialize properly (0xc0000142) 应用程序正常初始化(0xc0000142)失败
在 setup.py data_files 添加 (“Microsoft.VC90.CRT”, [‘MSVCR90.dll’,’Microsoft.VC90.CRT.manifest’]),留意 Microsoft.VC90.CRT.manifest
Yes I Can!
接下来的工作学习方向:
- iPhone/Android 开发。
- Python/PHP Web 开发。
- Web 前端尤其是 JavaScript 的学习。
谨记:
- 多沟通,一个小时解决不了的问题就问,节省时间,提高效率。
- 做事有计划。
- 多写文档。
One month in Beijing
真快,一个月一闪而过。
很宽松的工作环境,没有打卡没有限时,敏捷快速的开发模式,要的就是个效率。
团队人很好,很照顾我这个年龄最小工作经验最少的。每天下午的水果时间,每周三的北语羽毛球,玩的很 high.
用自己喜欢的东西做一些有意思的东西,把兴趣和工作结合起来无疑是一种幸福。
自己技术上还很弱,整体结构设计把握不住,细节实现考虑不足,还有很多要学。
Keep moving.
os.walk() digging into the specified level
os.walk() 指定递归遍历深度。
def walklevel(some_dir, level=1):
some_dir = some_dir.rstrip(os.path.sep)
assert os.path.isdir(some_dir)
num_sep = len([x for x in some_dir if x == os.path.sep])
for root, dirs, files in os.walk(some_dir):
num_sep_this = len([x for x in root if x == os.path.sep])
if num_sep + level <= num_sep_this:
del dirs[:]
重点是 del dirs[:],置空 dirs,递归到此结束。
BaseHTTPServer serving Gziped content
BaseHTTPServer 使用 gzip 压缩处理 html/xml 文档。
import cStringIO, gzip
zbuf = cStringIO.StringIO()
zfile = gzip.GzipFile(mode='wb', compresslevel=6, fileobj=zbuf)
zfile.write(xmlstring)
zfile.close()
compressed_content = zbuf.getvalue()
self.send_response(200)
self.send_header("Content-Type", "text/xml")
self.send_header("Content-Length", str(len(compressed_content)))
self.send_header("Content-Encoding","gzip")
self.end_headers()
self.wfile.write(compressed_content)
self.wfile.flush()
妈,生日快乐;妹,生日快乐
太失败了,居然忘掉了妈和妹妹的生日,忘的一干二净,过了十天才想起来。
早上给家里打电话,爸说忘了就忘了呗,泪水一下子出来。
妈,生日快乐,身体健康!
妹,生日快乐,开开心心每一天!
想家了,想你们了。
Get parameters from BaseHTTPServer http POST request
Get parameters from BaseHTTPServer http POST request. 获取 BaseHTTPServer.BaseHTTPRequestHandler POST 请求参数。
def do_POST(self):
params = cgi.parse_qs(self.rfile.read(int(self.headers.getheader('Content-Length'))))
Happy Birthday to My Girl!
妞妞生日快乐!
爱你乖~