使用virtualenv创建python项目环境

virtualenv 能够创建干净的python库环境.避免污染python项目环境 yum install -y virtualenv –no-site-packages参数是指不从全局的Python中携带任何第三方库 [vvv@node1 test-workspace]$ virtualenv –no-site-packages test_env Using base prefix ‘/usr’ New python executable in /home/vvv/test-workspace/test_env/bin/python3.6 Also creating executable in /home/vvv/test-workspace/test_env/bin/python Installing setuptools, pip, wheel…done. [vvv@node1 test-workspace]$ cd test_env/ [vvv@node1 test_env]$ source bin/activate (test_env) [vvv@node1 test_env]$ pip freeze # 指定python版本 virtualenv –no-site-packages test_env –python=python3.6 # 安装需要的库 # pip install six… Continue reading 使用virtualenv创建python项目环境

Published
Categorized as py

svg to png or pdf

将svg转化成png或者pdf.不过性能不好.如果svg有几十M,会很慢. # ! encoding:UTF-8 import cairosvg import os def svg_to_png(from_dir, target_dir): “”” very slow :param from_dir: :param target_dir: :return: “”” return _export(from_dir, target_dir, “png”) def _export(from_dir, target_dir, export_type): files = os.listdir(from_dir) for fileName in files: path = os.path.join(from_dir, fileName) if os.path.isfile(path) and fileName[-3:] == “svg”: file_handle = open(path) svg = file_handle.read() file_handle.close() export_path = os.path.join(target_dir,… Continue reading svg to png or pdf

Published
Categorized as language, py

写一段c++,碰到5个问题

创建子线程的时候,在for循环里面,在栈中初始化子线程的变量,结果变量地址被覆盖。需要用new,在堆里分配。 使用除法,结果变量没有初始化。 结构体中使用到的引用,全部使用指针。 给函数传参数的时候,将指针的值传过去,结果参数被默认在栈里新分配一个。 以前取巧的用法,导致程序无法正常关闭

Published
Categorized as language

G1GC LOG

G1提供了两种GC模式,Young GC和Mixed GC,两种都是完全Stop The World的。 * Young GC:选定所有年轻代里的Region。通过控制年轻代的region个数,即年轻代内存大小,来控制young GC的时间开销。 * Mixed GC:选定所有年轻代里的Region,外加根据global concurrent marking统计得出收集收益高的若干老年代Region。在用户指定的开销目标范围内尽可能选择收益高的老年代Region。 内容来源于: Java Hotspot G1 GC的一些关键技术

Published
Categorized as java Tagged

Why does the JVM consume less memory than -Xms specified?

You’re looking at the resident memory – that is, the physical RAM consumed. See here for more info. The virtual memory, however, is the memory consumed by your application, including the memory swapped out (to disk). You’ll see there’s a closer correspondance with the virtual memory and your -Xms settings. why-does-the-jvm-consume-less-memory-than-xms-specified

Published
Categorized as java