??xml version="1.0" encoding="utf-8" standalone="yes"?>小说区亚洲自拍另类,久久久久亚洲av无码专区喷水,亚洲av无码av制服另类专区 http://www.tkk7.com/pattern/The palest ink is better than the best memory. zh-cn Sat, 10 May 2025 18:44:10 GMT Sat, 10 May 2025 18:44:10 GMT 60 Emacs Python Mode Cmds http://www.tkk7.com/pattern/archive/2008/11/12/240086.html汉辰 汉辰 Wed, 12 Nov 2008 06:11:00 GMT http://www.tkk7.com/pattern/archive/2008/11/12/240086.html http://www.tkk7.com/pattern/comments/240086.html http://www.tkk7.com/pattern/archive/2008/11/12/240086.html#Feedback 0 http://www.tkk7.com/pattern/comments/commentRss/240086.html http://www.tkk7.com/pattern/services/trackbacks/240086.html C-j: Insert a new line with the same indentation level as the current line
RET: Insert a new line with the same indentation level as the current line
C-M-a: Go to the beginning of the current function or class
C-M-e: Go to the end of the current function or class
C-M-h: Mark the current function or class for copying, etc.
C-M-x: Execute the current function or class
C-c C-b: Submit a bug report
C-c C-c: Execute the buffer (i.e., the file being displayed)
C-c C-d: Trace the stack of the process being executed
C-c C-h: Get context-based help
C-c TAB: Indent a highlighted (or marked) region
C-c C-k: Mark a block of text. Using this at the head of a class or function definition will mark the entire block.
C-c C-l: Shift the region to the left. If the cursor is in the middle of a region, the lower half of the region will shift.
C-c RET: Execute the current file, opening a new window to show the output.
C-c C-n: Jump to the next statement.
C-c C-p: Jump to the previous statement.
C-c C-r: Shift the region to the right. If the cursor is in the middle of a region, the lower half of the region will shift.
C-c C-s: Execute a Python command.
C-c C-t: Toggle shells
C-c C-u: Go up one block
C-c C-v: List the version of the Python mode
C-c C-w: Run PyChecker
C-c !: Open the Python interactive shell
C-c #: Comment the highlighted (marked) region
C-c :: Check the indentation off-set
C-c <: Shift the region to the left
C-c >: Shift the region to the right
C-c ?: Show Python mode documentation
C-c |: Execute the highlighted (marked) part of the current program.
]]>Java 6 Server VM 三个性能调优参数 http://www.tkk7.com/pattern/archive/2008/10/30/237619.html汉辰 汉辰 Thu, 30 Oct 2008 07:33:00 GMT http://www.tkk7.com/pattern/archive/2008/10/30/237619.html http://www.tkk7.com/pattern/comments/237619.html http://www.tkk7.com/pattern/archive/2008/10/30/237619.html#Feedback 0 http://www.tkk7.com/pattern/comments/commentRss/237619.html http://www.tkk7.com/pattern/services/trackbacks/237619.html --XX:+DoEscapeAnalysis, off by default
如果一个对象的所有引用都是限于某一局部范_(d)L对象上的?br />
--XX:+UseBiasedLocking, on by default
对多ơ取锁的操作Q比如@环,不释放Lease即锁已被释放,避免Ҏ(gu)的取Lease操作 Q最有效Q?br />
--XX:+EliminateLocks, on by default
如果一D代码经常性的加锁和解锁,在解锁与下次加锁之间又没q什么事情,则可以将多次加加锁解锁操作合q成一寏V也UCؓ(f)Lock Coarsening (锁粗?
http://www.infoq.com/articles/java-threading-optimizations-p1
]]>Python 字符~码转换要诀 http://www.tkk7.com/pattern/archive/2008/09/09/227971.html汉辰 汉辰 Tue, 09 Sep 2008 07:49:00 GMT http://www.tkk7.com/pattern/archive/2008/09/09/227971.html http://www.tkk7.com/pattern/comments/227971.html http://www.tkk7.com/pattern/archive/2008/09/09/227971.html#Feedback 1 http://www.tkk7.com/pattern/comments/commentRss/227971.html http://www.tkk7.com/pattern/services/trackbacks/227971.html python 有str object ?unicode object 两种字符? 都可以存攑֭W的字节~码Q但是他们是不同的typeQ这一点很重要Q也是ؓ(f)什么会(x)有encode 和decode?br />
encode ?decode在pyhton 中的意义可表CZؓ(f)
encode
unicode -------------------------> str
unicode <--------------------------str
decode
几种常用法:(x)
str_string.decode('codec') 是把str_string转换为unicode_string, codec是源str_string的编码方?br />
unicode_string.encode('codec') 是把unicode_string 转换为str_stringQcodec是目标str_string的编码方?br />
str_string.decode('from_codec').encode('to_codec') 可实C同编码的str_string之间的{?br />
比如Q?br />
>>> t = ' 长城 '
>>> t
' \xb3\xa4\xb3\xc7 '
>>> t.decode( ' gb2312 ' ).encode( ' utf-8 ' )
' \xe9\x95\xbf\xe5\x9f\x8e '
str_string.encode('codec') 是先调用pȝ的缺省codecLstr_string转换为unicode_stringQ然后用encode的参数codec去{换ؓ(f)最l的str_string. 相当于str_string.decode('sys_codec').encode('codec')?br />
unicode_string.decode('codec') 基本没有意义Qunicode 在python里只用一Uunicode~码QUTF16或者UTF32Q编译python时就已经定)Q没有编码{换的需要?nbsp;
注:(x)~省codec在site-packages下的sitecustomize.py文g中指定,比如
import sys
sys.setdefaultencoding( ' utf-8 ' )
]]> Emacs 中文?- Gnu Emacs 22/23 - Windows XP http://www.tkk7.com/pattern/archive/2008/07/28/218044.html汉辰 汉辰 Mon, 28 Jul 2008 05:47:00 GMT http://www.tkk7.com/pattern/archive/2008/07/28/218044.html http://www.tkk7.com/pattern/comments/218044.html http://www.tkk7.com/pattern/archive/2008/07/28/218044.html#Feedback 0 http://www.tkk7.com/pattern/comments/commentRss/218044.html http://www.tkk7.com/pattern/services/trackbacks/218044.html
|上讲述Emacs中文问题的帖子很多,不过很多是过时的或不完整的,q以Linux下居多。很?emacs讄看v来发生了(jin)作用Q但是在我的机器上不是显C方块,是半个中文字符。前者怀疑未配置好Emacs使其无法dpȝ字体Q后者怀疑字W宽度设|还有问题,苦于无暇q?br />
最后找CEmacs 中文化指南[http://17xie.com/read-103809.html ]Q讲qC(jin)在Windows下用了(jin)X11的BDF字体配置Emacs的过E,下蝲安装?jin)intlfontQ改?jin)相应的emacs讄QBingo!!!Q一试就通。不q字库还是GB2312的,x(chng)Mule-GBK 和BDF 字体配置在一P未成功?br />
贴张囑ֺ(jin)Z?br />
]]> Emacs 常用命o(h) http://www.tkk7.com/pattern/archive/2008/07/11/214342.html汉辰 汉辰 Fri, 11 Jul 2008 14:16:00 GMT http://www.tkk7.com/pattern/archive/2008/07/11/214342.html http://www.tkk7.com/pattern/comments/214342.html http://www.tkk7.com/pattern/archive/2008/07/11/214342.html#Feedback 0 http://www.tkk7.com/pattern/comments/commentRss/214342.html http://www.tkk7.com/pattern/services/trackbacks/214342.html EMacs 常用命o(h)集:(x)
C-x C-s 当前文g存盘
C-x s 所有文件存盘,Ҏ(gu)提示认是否保存指定文g
C-x C-b 列出~存
C-x C-f 查找文gQ如果不存在则新建,如果已打开则切换ؓ(f)当前文g
C-x 数字 关闭其它H,只显C当前主H体。也可以输入其它数打开多窗
C-x o 切换到另一个打开的窗
C-z 临时退出,在X中相当于最化Q在Console中可以用"fg"或?%emacs"q回?br />
C-x C-c 退?br />
C-u 数字 前缀参数Q常用于重复执行命o(h),如插??W:(x)C-u 8 *
M-x recover 文g?lt;回R> 恢复文gCơ自动保存的状态,常用于系l崩溃时
C-h m 当前模式的说明文?每种模式都略有些怸?br />
C-h i 常用shell命o(h)的说明文?br />
常用Ud命o(h)Q?br />
C-v 向下页
C-M-v 另一H向下翻?br />
M-v 向上页
C-l Ud到光标位|?br />
M- <- Ud文首
M- -> Ud文尾
C-a Ud行首 M-a Ud句首
C-e Ud行尾 M-e Ud句尾
C-p 上移一?br />
C-n 下移一?br />
C-b 左移一?nbsp; M-b 左移一?br />
C-f 右移一?nbsp; M-f 右移一?br />
常用~辑命o(h)Q?br />
C-k 删除到当前行?br />
M-k 删除到当前句?br />
C-g 中断执行
C-w Cut marked region
A-w Copy marked region
C-y 取回所有删除的行,默认昄最后删除的?br />
M-y C-y取回所有删除的行之后,切换昄之前删除的行
C-x C-x Mark the region from the current cursor to last mark point, 可以方便的重复Mark
C-x h Mark the whole buffer
C-x u 撤消
C-x C-a C-l Revert a buffer
g hDired mode buffer
常用查找命o(h)Q?br />
C-s 向前查找
C-r 向后查找
M-g M-g Goto a line
q入Hex mode M-x hexl-mode QC-c C-c 退?
换行Q?br />
不嫌?ch)的Q每ơM-x toggle-truncate-lines切换换行与不换行
一x(chng)逸的QM-x customize-optionQ输入truncate-partial-width-windowsQ将出来的设|页面中的参数改为offQ然后保?Save for future sessions)
另外说一句,M-x auto-fill-mode也是切换换行模式Q不q这是要在文章内定w插入回RW号
]]>用LaTex创徏目文 - Windows XP 下的 LaTex 配置 http://www.tkk7.com/pattern/archive/2008/07/08/213085.html汉辰 汉辰 Tue, 08 Jul 2008 06:20:00 GMT http://www.tkk7.com/pattern/archive/2008/07/08/213085.html http://www.tkk7.com/pattern/comments/213085.html http://www.tkk7.com/pattern/archive/2008/07/08/213085.html#Feedback 0 http://www.tkk7.com/pattern/comments/commentRss/213085.html http://www.tkk7.com/pattern/services/trackbacks/213085.html
LaTex 是用?0多年的排版工兗因其专业的排版质量和对大文档处理能力,行于学术界Q大多数研究生博士生都用它写自己毕业论文?br />
自己3q前曾也想用它写士论文Q但q于旉压力Q后来还是改用了(jin)WYSWYG的StarOfficeQSun的品,ZOpenOfficeQ?br />
不用WordQ因为用它编辑我?0论文时QL无可挽回地让我的机器崩溃Q当时系l还是Windows2000?br />
下面先离题谈一谈近期读E序员(sh)g道一书的两个体会(x)Q也想阐qC下我Z么对用LaTexl一创徏目文感兴?br />
1QDRY(Don't Repeat Yourself)Q这是作?Andrew Hunt/David Thomas)提到的重要原则,应诏d软g开发的各个斚w。其中一斚w暗示开发流E中应尽可能保持同一U别信息的储备唯一化,而不应有多处载体包含同别信息。比如从试规范应可以直接导出TestCaseQ数据库定义规范直接导出数据库脚本等{?br />
2Q工Ʋ善其事Q必先利其器。专业的E序员除?jin)熟?zhn)自己吃饭用的编E语a外,q需懂得各种辅助工具特别是Perl/Python/Shell一cȝ脚本语言Q因其广泛存在于各种q_中,q有很好的正则表辑ּ和纯文本操纵能力。例如,用他们可以帮助实现项目文的自动生成和发布等{。比如上面的信息导出是一个应用目标?br />
要达到这样地目的Q必要用纯文本作ؓ(f)信息载体。但是,对于?fn)惯于阅读WordQPDFQHTML{格式化文的h们来_(d)U文本却不太合适。所?q前的LaTex又Q现在我的眼前。LaTex 很符合DRY原则Q文档信息和格式化信息都用纯文本方式保存Q但最l发布Ş式可以用LaTex自动生成Q或PDFQ或HTMLQ自己选择?br />
LaTex难以学习(fn)是一大诟病,但是个h认ؓ(f)QY件开发文有比较l一的格式化规范Q只要有现成的模板,普通程序员可以通过短时间学?fn)掌握基本的~辑能力?br />
下面a归正传:(x)
大家旉都不多,W(xu)indows下用LaTex最方便的办法是安装MiCTex套装Q其主要包括MikTexQLaTex的一U实玎ͼ(j)QSciTEQLaTex文~辑器)(j)QTex4ht(LaTex文到Html转换器)(j){,q捆l了(jin)一些入门学?fn)资料?br />
LaTex内核无法识别越ASCII的编码,中文处理是以外挂的方式进行的。CJK是目前用的最多的LaTex的中文化包,MiCTex也包括了(jin)Q不q中文字体还需配置Q也可能因ؓ(f)我的pȝ是英文的XP所_(d)(j)?br />
比较?jin)网上Google到的资料Q?a style="color: #000000" >Helmer Aslaksen的这文章最全面和正的描述?jin)中文配|过E?br />
Chinese TeX Using the CJK LaTeX Package, Unicode TrueType Fonts and pdfTeX under Windows
http://www.math.nus.edu.sg/aslaksen/cs/cjk.html
MiCTex作者最q也提供?jin)一个中文字体自动配|工P可以很方便的生成各类字体配置文gQƈ支持UTF8或GBK~码Q很好用。我用它安装?jin)系l中的微软宋(hu)体,黑体。结果比上面Cyberbit字体好?br />
http://bbs.ctex.org/viewthread.php?tid=44496&extra=page%3D1
下面可以下蝲到其他免费字体文?br />
http://www.wazu.jp/gallery/Fonts_ChineseSimplified.html
Tex4ht是MiCTex捆绑的LaTex2Html转换工具Q英文很不错Q中文有炚w题,q要下功夫看看那里出问题。我自己很憧憬以HTML的Ş式发布和更新目文档Q简单实用,q个发布q程可以作ؓ(f)一个步骤加入每晚的Build?br />
]]> Fork-join Framework http://www.tkk7.com/pattern/archive/2008/06/26/210751.html汉辰 汉辰 Thu, 26 Jun 2008 02:11:00 GMT http://www.tkk7.com/pattern/archive/2008/06/26/210751.html http://www.tkk7.com/pattern/comments/210751.html http://www.tkk7.com/pattern/archive/2008/06/26/210751.html#Feedback 2 http://www.tkk7.com/pattern/comments/commentRss/210751.html http://www.tkk7.com/pattern/services/trackbacks/210751.html
写了(jin)一个MergeSort的测试例子,最l的排序用的是Java Collection Framework 自带的Arrays.sort()。在自己双核机器试了(jin)试,发现提升不是特别明显。Arrays.sort 本n很高效,Framework有thread之间协作和管理worker pool的开销Q所以必选择一个适合的数据量阚倹{下面是q行l果:
java -Xms64m -Xmx128m -cp C;/forkjoin/jsr166y.zip;C:/workspace/java.tij forkjoin.SortTask
Number of processor 2
=================Sequential ===================
Sorting takes 2617701971 to complete
=================ForkJoin ====================
Sorting takes 2284940405 to complete
找不到更多核的机器,有条件的同学可以试一把。另外,Brain Goetz (Java Concurrency in Practice作? 的文章可参考,他的试例子昄?jin)不错的性能提升(最?7?img alt="" src="/CuteSoft_Client/CuteEditor/images/face6.gif" align="absMiddle" border="0" />?2cpupȝQ,一?核或8核的能达?倍或5倍的SPEEDUP
Java thread and practice: Stick a fork in it Part 1 - http://www.ibm.com/developerworks/java/library/j-jtp11137.html
package forkjoin;
import jsr166y.forkjoin.RecursiveAction;
import jsr166y.forkjoin.ForkJoinPool;
import java.util.Random;
import java.util.Arrays;
public class SortTask extends RecursiveAction {
final static int ARRAY_LENGTH = 10000000 ;
final static int THRESHOLD = 3000000 ;
final int [] array;
final int lo;
final int hi;
public SortTask( int [] array, int lo, int hi) {
this .array = array;
this .lo = lo;
this .hi = hi;
}
private void sequentiallySort( int [] array, int lo, int hi) {
int [] units = new int [hi - lo + 1 ];
for ( int i = lo; i <= hi; i ++ )
units[i - lo] = array[i];
Arrays.sort(units);
for ( int i = lo; i <= hi; i ++ )
array[i] = units[i - lo];
}
private void merge( int [] array, int lo, int mid, int hi) {
int [] units = new int [hi - lo + 1 ];
int i = lo;
int j = mid + 1 ;
for ( int k = 0 ; k < units.length; k ++ ) {
if (array[i] <= array[j])
units[k] = array[i ++ ];
else if (array[i] > array[j])
units[k] = array[j ++ ];
if (i > mid)
for ( int m = j; m <= hi; m ++ )
units[ ++ k] = array[m];
else if (j > hi)
for ( int m = i; m <= mid; m ++ )
units[ ++ k] = array[m];
}
for ( int k = lo; k <= hi; k ++ )
array[k] = units[k - lo];
}
protected void compute() {
try {
if (hi - lo < THRESHOLD)
sequentiallySort(array, lo, hi);
else {
int mid = (lo + hi) >>> 1 ;
// System.out.println(mid);
forkJoin( new SortTask(array, lo, mid), new SortTask(array, mid + 1 , hi));
merge(array, lo, mid, hi);
}
} catch (Throwable t) {
t.printStackTrace();
}
}
/** */ /**
* @param args
*/
public static void main(String[] args) {
int [] sample = new int [ARRAY_LENGTH];
System.out.println( " Number of processor "
+ Runtime.getRuntime().availableProcessors());
Random seed = new Random( 47 );
for ( int i = 0 ; i < sample.length; i ++ ) {
sample[i] = seed.nextInt();
}
long start = System.nanoTime();
Arrays.sort(sample);
long duration = System.nanoTime() - start;
System.out.println( " ===============Sequential================== " );
System.out.println( " Sorting takes " + duration + " to compelte " );
int [] sample2 = new int [ARRAY_LENGTH];
for ( int i = 0 ; i < sample2.length; i ++ ) {
sample2[i] = seed.nextInt();
}
ForkJoinPool pool = new ForkJoinPool(Runtime.getRuntime()
.availableProcessors());
SortTask st = new SortTask(sample2, 0 , sample2.length - 1 );
start = System.nanoTime();
pool.execute(st);
while ( ! st.isDone()) {
}
duration = System.nanoTime() - start;
System.out.println( " ===============ForkJoin================== " );
System.out.println( " Sorting takes " + duration + " to compelte " );
}
}
]]>
վ֩ģ壺
þþþùAV鶹 |
99߹ۿƵ |
Ů͵Ʒ |
2018 |
Ļ˳ |
ƷþþþϼӰԺ
|
þþƷѹۿ |
˵Ӱѹۿ |
ƷƵһ |
߾Ʒ |
ձxxxxɫƵ߹ۿ |
þþþùƷѲ |
ٸ͵˾ƷƵ |
99߹ۿƵ |
שש |
һվ |
պȫƵۿѹۿ |
Ѵѧ߹ۿp |
պϵ
|
Ļһ |
˳վߵӰ |
վ߹ۿ |
av벻þ |
av |
˾þþùۿëƬ |
һƵ |
ѹۿþþƵ |
Ļ߿ |
Ƶһ |
gogoȫ |
ۺͼɫ40p |
ۺ˵ɫ |
˳ŷĻ |
˳ɳƵ |
aëƬվ |
߹ۿwwwѿ |
Ʒ |
ĻŮһ |
Ƶ߹ۿ |
av߹ۿַ |
ɫѲ |