Some unsaved word files are stored in the following folder:
C:\Users\YOUR-USER-NAME\AppData\Roaming\Microsoft\Word\
In German system it is:
C:\Benutzer\YOUR-USER-NAME\AppData\Roaming\Microsoft\Word\
Try to check for every file under this folder and its sub-folder with the approximate modification time and size.
30 November, 2012
14 September, 2012
29 March, 2012
pass 2D array in C++ functions/c++中调用函数时传递2维数组
template < int M, int N >
void printMat(int (&mat) [M][N]) {
for (int i=0; i < M; i++)
{
for (int j=0; j < N; j++)
{
std::cout << mat[i][j] << "\t";
}
std::cout << std::endl;
}
return;
}
21 February, 2012
用perl在多个文件中替换
用perl在多个文件中替换
perl -pi -w -e 's/search/replace/g;' *.cpp
e.g.
perl -pi -w -e 's/.C>/.cpp>/g;' jni/ga/*
perl -pi -w -e 's/search/replace/g;' *.cpp
e.g.
perl -pi -w -e 's/.C>/.cpp>/g;' jni/ga/*
30 April, 2011
iphone
You are discouraged from overriding
description—if this method fires a fault during a debugging operation, the results may be unpredictable—and initWithEntity:insertIntoManagedObjectContext:. You should typically not override the key-value coding methods such as valueForKey: and setValue:forKeyPath:.04 April, 2011
enable auto spellcheck in Firefox
Type about:config in address bar, enter
Click on "I'll be careful, I promise!",
Type layout.spellcheckDefault on Filter,
Change the default value from 1 to 2.
Click on "I'll be careful, I promise!",
Type layout.spellcheckDefault on Filter,
Change the default value from 1 to 2.
24 March, 2011
javascript event 事件
| 属性 | 当以下情况发生时,出现此事件 | FF | N | IE |
|---|---|---|---|---|
| onabort | 图像加载被中断 | 1 | 3 | 4 |
| onblur | 元素失去焦点 | 1 | 2 | 3 |
| onchange | 用户改变域的内容 | 1 | 2 | 3 |
| onclick | 鼠标点击某个对象 | 1 | 2 | 3 |
| ondblclick | 鼠标双击某个对象 | 1 | 4 | 4 |
| onerror | 当加载文档或图像时发生某个错误 | 1 | 3 | 4 |
| onfocus | 元素获得焦点 | 1 | 2 | 3 |
| onkeydown | 某个键盘的键被按下 | 1 | 4 | 3 |
| onkeypress | 某个键盘的键被按下或按住 | 1 | 4 | 3 |
| onkeyup | 某个键盘的键被松开 | 1 | 4 | 3 |
| onload | 某个页面或图像被完成加载 | 1 | 2 | 3 |
| onmousedown | 某个鼠标按键被按下 | 1 | 4 | 4 |
| onmousemove | 鼠标被移动 | 1 | 6 | 3 |
| onmouseout | 鼠标从某元素移开 | 1 | 4 | 4 |
| onmouseover | 鼠标被移到某元素之上 | 1 | 2 | 3 |
| onmouseup | 某个鼠标按键被松开 | 1 | 4 | 4 |
| onreset | 重置按钮被点击 | 1 | 3 | 4 |
| onresize | 窗口或框架被调整尺寸 | 1 | 4 | 4 |
| onselect | 文本被选定 | 1 | 2 | 3 |
| onsubmit | 提交按钮被点击 | 1 | 2 | 3 |
| onunload | 用户退出页面 | 1 | 2 | 3 |
origin: http://www.w3school.com.cn/js/jsref_events.asp
java String[], array of String
in java one can return multi variables by return an array of String, String[]
public String[] foo(){
String[] resultSrtArr = new String[2];
resultStrArr[0] = Integer.toString( 321 );
resultStrArr[1] = "result";
return resultSrtArr;
}
public toCallFoo(){
String[] resultSrtArr = foo();
int a = Integer.parseInt( resultStrArr[0].trim() );
String str = resultStrArr[1];
}
10 March, 2011
09 March, 2011
groovy on grails / static constraints
q/问:Grails中的约束是什么意思?请给出3个示例。
a/答:跟数据库中的约束类似,在保存前,Grails会先使用它来验证Domain Class的各个属性,若不能通过,则无法保存或修改,例如:
more更多:
1.会影响到数据库模式的约束
nullable:验证是否可为null
inList:限制值在一个范围或集合内
maxSize(minSize):限制属性值大小,对应列大小
max(min):设定最大(小)值,属性必须是java.lang.Comparable
range:限定值范围,属性必须是java.lang.Comparable
scale:限定小数位
size:限定属性值大小范围
unique:限定唯一
2.其他的约束则有:
blank:验证字符串是否为empty
creditCard:验证字符串是否为信用卡
email:验证字符串是否为邮件地址
url:验证字符串是否是URL
matches:匹配正则表达式
notEqual:不等于
a/答:跟数据库中的约束类似,在保存前,Grails会先使用它来验证Domain Class的各个属性,若不能通过,则无法保存或修改,例如:
class Book {
String title
String author
static constraints = { //some constrains
title(blank: false) //cannot be blank 不能为空
// or empty
author(blank: false)//cannot be blank 不能为空
}
}
more更多:
1.会影响到数据库模式的约束
nullable:验证是否可为null
inList:限制值在一个范围或集合内
maxSize(minSize):限制属性值大小,对应列大小
max(min):设定最大(小)值,属性必须是java.lang.Comparable
range:限定值范围,属性必须是java.lang.Comparable
scale:限定小数位
size:限定属性值大小范围
unique:限定唯一
2.其他的约束则有:
blank:验证字符串是否为empty
creditCard:验证字符串是否为信用卡
email:验证字符串是否为邮件地址
url:验证字符串是否是URL
matches:匹配正则表达式
notEqual:不等于
02 February, 2011
26 January, 2011
white screen on Mac when screen sharing...
If you get a white screen when you using screen sharing.
Just try this: copied from http://www.artin.org/geekblog/2010/05/mac-screen-sharing-vnc-white-screen/
original: http://www.artin.org/geekblog/2010/05/mac-screen-sharing-vnc-white-screen/
Just try this: copied from http://www.artin.org/geekblog/2010/05/mac-screen-sharing-vnc-white-screen/
- Open a new Finder window.
- Click “Go” and then “Go to Folder” (or hit Command-Shift-G).
- Type in “/System/Library/CoreServices” and hit enter.
- Find the “Screen Sharing” application, click once to highlight.
- Click “File” and then “Get Info” (or hit Command-I).
- Find the checkbox labeled “Open in 32-bit mode” and check it.
- Close the Info window and Finder folder window.
original: http://www.artin.org/geekblog/2010/05/mac-screen-sharing-vnc-white-screen/
07 January, 2011
美国大学ANSYS网上教程网址[转自simwe仿真论坛]
[转自simwe仿真论坛]http://forum.simwe.com/thread-962894-1-1.html
美国, ANSYS, 教程, 大学, 网址美国, ANSYS, 教程, 大学, 网址
美国, ANSYS, 教程, 大学, 网址美国, ANSYS, 教程, 大学, 网址
26 October, 2010
24 October, 2010
Eigen Solvers
Eigen Solver:
PARPACK
Trilinos/Anasazi
JDBSYM
LOBPCG
PRIMME
Current Eigensolvers
Unlike ARPACK, which provides a single eigensolver, Anasazi provides a framework capable of describing a wide variety of eigenproblems and algorithms for solving them. Anasazi can currently solve complex and real, Hermitian and non-Hermitian, eigenvalue problems, via the following included methods:
* Block Krylov-Schur method, a block extension of A Krylov-Schur Algorithm for Large Eigenproblems, G. W. Stewart, SIAM J. Matrix Anal. Appl., 23, pp. 601-614 (2000).
* Block Davidson method described in A Comparison of Eigensolvers for Large-scale 3D Modal Analysis Using AMG-Preconditioned Iterative Methods, P. Arbenz, U. L. Hetmaniuk, R. B. Lehoucq, R. S. Tuminaro, Internat. J. for Numer. Methods Engrg., 64, pp. 204-236 (2005)
* LOBPCG, a stable implementation of Toward the optimal preconditioned eigensolver: Locally optimal block preconditioned conjugate gradient method, SIAM J. Sci. Comput., 23 (2001), pp. 517-541, as described in Basis selection in LOBPCG, U. L. Hetmaniuk and R. B. Lehoucq, J. Comput. Physics, 218, pp. 324-332 (2006)
* IRTR, an implicit version of the Riemannian Trust-Region Eigensolver, orginally described in A truncated-CG style method for symmetric generalized eigenvalue problems, P.-A. Absil, C. G. Baker, and K. A. Gallivan, J. Computational and Applied Mathematics, 189, pp. 274-285 (2006).
PARPACK
Trilinos/Anasazi
JDBSYM
LOBPCG
PRIMME
Current Eigensolvers
Unlike ARPACK, which provides a single eigensolver, Anasazi provides a framework capable of describing a wide variety of eigenproblems and algorithms for solving them. Anasazi can currently solve complex and real, Hermitian and non-Hermitian, eigenvalue problems, via the following included methods:
* Block Krylov-Schur method, a block extension of A Krylov-Schur Algorithm for Large Eigenproblems, G. W. Stewart, SIAM J. Matrix Anal. Appl., 23, pp. 601-614 (2000).
* Block Davidson method described in A Comparison of Eigensolvers for Large-scale 3D Modal Analysis Using AMG-Preconditioned Iterative Methods, P. Arbenz, U. L. Hetmaniuk, R. B. Lehoucq, R. S. Tuminaro, Internat. J. for Numer. Methods Engrg., 64, pp. 204-236 (2005)
* LOBPCG, a stable implementation of Toward the optimal preconditioned eigensolver: Locally optimal block preconditioned conjugate gradient method, SIAM J. Sci. Comput., 23 (2001), pp. 517-541, as described in Basis selection in LOBPCG, U. L. Hetmaniuk and R. B. Lehoucq, J. Comput. Physics, 218, pp. 324-332 (2006)
* IRTR, an implicit version of the Riemannian Trust-Region Eigensolver, orginally described in A truncated-CG style method for symmetric generalized eigenvalue problems, P.-A. Absil, C. G. Baker, and K. A. Gallivan, J. Computational and Applied Mathematics, 189, pp. 274-285 (2006).
09 October, 2010
openGL libs on mac os x
LDFLAGS += -dylib_file \ /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:\ /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib \ -framework Cocoa -framework OpenGL -framework Carbon -framework IOKit
26 April, 2010
Matplot-python [FROM http://www.kunli.info/2009/02/08/matplot-python-manual/]
【FROM http://www.kunli.info/2009/02/08/matplot-python-manual/】
本文是给自己的Matplot-python用法速查列表,并非任何正式文章,如果看不明白不用奇怪,不感兴趣的朋友直接跳过。
最近上Data Mining课作业老要求画图,反正都是用python做,实在厌倦了Gnuplot,所以决定完全投身Matplot怀抱。但因为使用频率不高,每次要 用的时候就感觉忘了,查manual太累,放狗搜又没有什么好的中文教程,所以把一些常用方法记录在这里,主要是几种常画图的典型例子。以后多接触一种, 就添加一种,随时更新。
顺便提一句,如果是pythoner,坚决推荐用matplot画图,方便程度仅次于matlab,但与python无缝接合。
典型的Matplot例子:
最简单的就是通过title,xlabel和ylabel设置,比如
x和y轴的范围设定是通过
有时候我们需要在坐标轴上放文字,比如在x轴上放置月份名称之类,这就需要xticks函数。其用法是比如
设置曲线特征
文字处理
text()命令可以被用来放置文字在绝对坐标轴上,用法是
这只是放置文字,还有一种需求是要求放置文字标注比如这种图:
这时候就要用到anotate()函数了,用法大概是这样的,
对于经常写公式的人来讲,可能latex的格式会感觉更加常用一点。这时候,可以在放置text之前先用
plt.plot最简单的形式就是take一组列表数据
plot还支持同时在一张图里面绘制多个图形,比如
画子图
用plt.subplot(xxx),第一个数字表示numrows,第二个表示numcols,第三个表示fignum。fignum的数量最高 也就是numrows乘以numcols。
如果是想产生多个图,每个图包含几个子图,那用figure()来控制图的数量。
画直方图
用函数
画分布图
函数
画Box Plot图
用matplot画Box Plot不知道有多方便,直接用函数
详细的属性控制参见这 里。
画幂函数图
例子
x = linspace(-4, 4, 200)
f1 = power(10, x)
f2 = power(e, x)
f3 = power(2, x)
plot(x, f1, 'r', x, f2, 'b', x, f3, 'g', linewidth=2)
axis([-4, 4, -0.5, 8])
text(1, 7.5, r'$10^x$', fontsize=16)
text(2.2, 7.5, r'$e^x$', fontsize=16)
text(3.2, 7.5, r'$2^x$', fonsize=16)
title('A simple example', fontsize=16)
savefig('power.png', dpi=75)
show()
显示图形中的数学公式
Matplotlib 可以支持一部分 TeX 的排版指令,因此用户在绘制含有数学公式的图形时会感到很方便并且可以得到比较满意的显示效果,所需要的仅仅是一些 TeX 的排版知识。下面的这个例子显示了如何在图形的不同位置上, 如坐标轴标签,图形的标题以及图形中适当的位置处,显示数学公式。相应的 Python 程序如下:
本文是给自己的Matplot-python用法速查列表,并非任何正式文章,如果看不明白不用奇怪,不感兴趣的朋友直接跳过。
最近上Data Mining课作业老要求画图,反正都是用python做,实在厌倦了Gnuplot,所以决定完全投身Matplot怀抱。但因为使用频率不高,每次要 用的时候就感觉忘了,查manual太累,放狗搜又没有什么好的中文教程,所以把一些常用方法记录在这里,主要是几种常画图的典型例子。以后多接触一种, 就添加一种,随时更新。
顺便提一句,如果是pythoner,坚决推荐用matplot画图,方便程度仅次于matlab,但与python无缝接合。
典型的Matplot例子:
题目,坐标轴设置import numpy as np
import matplotlib.pyplot as plt
def f(t):
return np.exp(-t) * np.cos(2*np.pi*t)
t1 = np.arange(0.0, 5.0, 0.1)
t2 = np.arange(0.0, 5.0, 0.02)
plt.figure(1)
plt.subplot(211)
plt.plot(t1, f(t1), ‘bo’, t2, f(t2), ‘k’)
plt.subplot(212)
plt.plot(t2, np.cos(2*np.pi*t2), ‘r–’)
最简单的就是通过title,xlabel和ylabel设置,比如
xlabel(”xxxx”, fontsize=18, color=”red”)这里title是某个axis的title,如果希望整个figure有title,那么需要用suptitle() 函数,用法和title是一样的。
x和y轴的范围设定是通过
plt.axis([0, 6, 0, 20])这就是表示x轴是0到6,y轴是0到20。也可以用xlim和ylim单独控制,比如ylim( ymin, ymax )当然还可以用yscale和xscale指定坐标轴的scale类型,分别是‘linear’ | ‘log’ | ‘symlog’,比如xscale("log")还可以通过yaxis.grid和xaxis.grid控制怎么显示网格,是否显示网格。grid的函数是这样的grid(self, b=None, which=’major’, **kwargs)如果用yaxis.grid (false),就表示不用显示y轴方向的网格。
Set the axis grid on or off; b is a boolean use which =
‘major’ | ‘minor’ to set the grid for major or minor ticks
有时候我们需要在坐标轴上放文字,比如在x轴上放置月份名称之类,这就需要xticks函数。其用法是比如
xticks( arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue') )这里,第一个参数表示放置位置,第二个是放置内容。设置曲线特征
lines = plt.plot(x1, y1, x2, y2)
# use keyword args
plt.setp(lines, color='r', linewidth=2.0)
# or matlab style string value pairs
plt.setp(lines, 'color', 'r', 'linewidth', 2.0)如果希望知道有哪些属性可以指定,可以传递对象给setp()函数,比如具体能控制的属性参见这 里。In [69]: lines = plt.plot([1,2,3])
In [70]: plt.setp(lines)
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
…snip
文字处理
text()命令可以被用来放置文字在绝对坐标轴上,用法是
text(60, .025, r'$\mu=100,\ \sigma=15$', horizontalalignment='left', verticalalignment='top')放置的东西前面加个r表示包括数学公式。具体能控制的属性可以参见属 性列表。具体的数学公式和符号的表达方式参见这 里。这只是放置文字,还有一种需求是要求放置文字标注比如这种图:
这时候就要用到anotate()函数了,用法大概是这样的,
plt.annotate('local max', xy=(2, 1), xytext=(3, 1.5), arrowprops=dict(facecolor='black', shrink=0.05), )第一个参数是要放置的文字,第二个参数是要指向的坐标,第三个是放置文字的坐标,最后一个是箭头属性。相关属性设置参见这 里。对于经常写公式的人来讲,可能latex的格式会感觉更加常用一点。这时候,可以在放置text之前先用
rc('text', usetex=True)然后与文字有关的地方都用r”"来引用,比如title(r"\TeX\ is Number $\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!",
fontsize=16, color='r')画函数plt.plot最简单的形式就是take一组列表数据
plt.plot([1,2,3])此时plot自动将其认为是y轴的数据,x轴数据自动分配,相当于是plt.plot([0,1,2],[1,2,3])也就是说,对于plot,标准形式是plt.plot([1,2,3,4], [1,4,9,16])当然,后面可以跟控制表示形式的参数,比如plt.plot([1,2,3,4], [1,4,9,16], 'ro')就表示用红色点表示,而不是直线。参数默认是’b-’,表示蓝色直线。plot还支持同时在一张图里面绘制多个图形,比如
import matplotlib.pyplot as plt
plt.plot(x1, y1, 'r--', x2, y2, 'bs', x3, y3, 'g^')就可以用不同的形式绘制三条曲线。画子图
用plt.subplot(xxx),第一个数字表示numrows,第二个表示numcols,第三个表示fignum。fignum的数量最高 也就是numrows乘以numcols。
如果是想产生多个图,每个图包含几个子图,那用figure()来控制图的数量。
画直方图
用函数
hist(x, bins=10, range=None, normed=False, cumulative=False,
bottom=None, histtype='bar', align='mid',
orientation='vertical', rwidth=None, log=False, **kwargs)具体用法参加这 里。画分布图
函数
scatter(x, y, s=20, c='b', marker='o', cmap=None, norm=None,
vmin=None, vmax=None, alpha=1.0, linewidths=None,
verts=None, **kwargs)具体参数看这 里,唯一一个不是很确定的是s的取值,我曾经估计是s值要和x和y的列表长度一样,也就是大概是点的个数?但具体画的时候发现不是这样,点的个数 取决于x和y的列表长度。有待研究。画Box Plot图
用matplot画Box Plot不知道有多方便,直接用函数
boxplot(x, notch=0, sym='+', vert=1, whis=1.5,
positions=None, widths=None)你直接把一组数用x送进去,出来就是Box图。如果你想一个图表示多个Box,也很简单,让xappend多个list,出来的就是这些list的 box图。一个例子如下 for attribute in iris[type].keys():
list = iris[type][attribute]
data.append(list)
subplot(2,2,count)
title("Boxplot of %s" % type, fontsize=18, color="red")
xticks(arange(5),("","Sepal len","Sepal wid","Petal len","Petal wid"))
ylabel("Value")
boxplot(data,0,'gd')详细的属性控制参见这 里。
画幂函数图
例子
from matplotlib.matlab import * x = linspace(-4, 4, 200)
f1 = power(10, x)
f2 = power(e, x)
f3 = power(2, x)
plot(x, f1, 'r', x, f2, 'b', x, f3, 'g', linewidth=2)
axis([-4, 4, -0.5, 8])
text(1, 7.5, r'$10^x$', fontsize=16)
text(2.2, 7.5, r'$e^x$', fontsize=16)
text(3.2, 7.5, r'$2^x$', fonsize=16)
title('A simple example', fontsize=16)
savefig('power.png', dpi=75)
show()
显示图形中的数学公式
Matplotlib 可以支持一部分 TeX 的排版指令,因此用户在绘制含有数学公式的图形时会感到很方便并且可以得到比较满意的显示效果,所需要的仅仅是一些 TeX 的排版知识。下面的这个例子显示了如何在图形的不同位置上, 如坐标轴标签,图形的标题以及图形中适当的位置处,显示数学公式。相应的 Python 程序如下:
from matplotlib.matlab import *
def f(x, c):
m1 = sin(2*pi*x)
m2 = exp(-c*x)
return multiply(m1, m2)
x = linspace(0, 4, 100)
sigma = 0.5
plot(x, f(x, sigma), 'r', linewidth=2)
xlabel(r'$\rm{time} \ t$', fontsize=16)
ylabel(r'$\rm{Amplitude} \ f(x)$', fontsize=16)
title(r'$f(x) \ \rm{is \ damping \ with} \ x$', fontsize=16)
text(2.0, 0.5, r'$f(x) = \rm{sin}(2 \pi x^2) e^{\sigma x}$', fontsize=20)
savefig('latex.png', dpi=75)
show()build gnuplot on Mac OS X
gnuplot on Mac OS X
./configure –with-readline=bsd –x-include=/usr/include/X11 –x-libraries=/usr/X11/lib
make && make install
./configure –with-readline=bsd –x-include=/usr/include/X11 –x-libraries=/usr/X11/lib
make && make install
Fink on Mac OS X
【FROM http://www.kunli.info/2009/12/11/mac-install-pink/】
苹果上自带的Unix其实是很少的,像gcc,make,gnuplot,unrar啊这种杀人越货必备武器都默认没有的。gcc这帮工具好说,安装xcode就行了,其他东西以前用Mac的时候都是用MacPort来搞,但是这次的新Mac在安装Unix工具的时候,上网搜了一下,发现Fink这个更好的工具。
Fink工程的目的和MacPort一样,通过修改 Unix 软件来port到Mac OS X 上,然后提供某种下载安装机制供大家使用。在Fink里面你可以像Ubuntu中那样用apt这套工具直接安装二进制包,也可以直接使用Fink来通过源代码编译安装。一般直接用Fink比较好,因为里面的东西比较新。
Fink 的所有文件几乎都安装在 /sw (或你选择安装的地方)。因此,如果你想删除 Fink,输入下面的命令:
sudo rm -rf /sw
升级fink自身
fink selfupdate
fink selfupdate-rsync
fink index -f
fink selfupdate
安装
fink install xxx
卸载
fink remove xxx
如果想把依赖包也一起卸载,加-r。如果想配置文件一并卸载,用
fink purge
类似与ubuntu里面的remove –purge
更新所有已安装包
fink update-all
查看可安装包
fink list xxx 或者 fink apropos xxx
也支持正泽表达式
fink list “xxx*”
查看相关包的描述
fink info
如果不小心删除了某个包的文件,想重新安装整个包
fink reinstall
显示某个包的依赖关系
fink show-deps xxx
苹果上自带的Unix其实是很少的,像gcc,make,gnuplot,unrar啊这种杀人越货必备武器都默认没有的。gcc这帮工具好说,安装xcode就行了,其他东西以前用Mac的时候都是用MacPort来搞,但是这次的新Mac在安装Unix工具的时候,上网搜了一下,发现Fink这个更好的工具。
Fink工程的目的和MacPort一样,通过修改 Unix 软件来port到Mac OS X 上,然后提供某种下载安装机制供大家使用。在Fink里面你可以像Ubuntu中那样用apt这套工具直接安装二进制包,也可以直接使用Fink来通过源代码编译安装。一般直接用Fink比较好,因为里面的东西比较新。
Fink 的所有文件几乎都安装在 /sw (或你选择安装的地方)。因此,如果你想删除 Fink,输入下面的命令:
sudo rm -rf /sw
升级fink自身
fink selfupdate
fink selfupdate-rsync
fink index -f
fink selfupdate
安装
fink install xxx
卸载
fink remove xxx
如果想把依赖包也一起卸载,加-r。如果想配置文件一并卸载,用
fink purge
类似与ubuntu里面的remove –purge
更新所有已安装包
fink update-all
查看可安装包
fink list xxx 或者 fink apropos xxx
也支持正泽表达式
fink list “xxx*”
查看相关包的描述
fink info
如果不小心删除了某个包的文件,想重新安装整个包
fink reinstall
显示某个包的依赖关系
fink show-deps xxx
Subscribe to:
Posts (Atom)