31 Oct 2011
17 Oct 2011
Matlab P文件——加快Matlab程序,保护你的算法
收藏到CSDN网摘

P文件是对应M文件的一种预解析版本(preparsed version)。因为当你第一次执行M文件时,Matlab需要将其解析(parse)一次(第一次执行后的已解析内容会放入内存作第二次执行时使用,即第二次执行时无需再解析),这无形中增加了执行时间。所以我们就预先作解释,那么以后再使用该M文件时,便会直接执行对应的已解析版本,即P文件。但又因为Matlab的解析速度非常快,一般不用自己作预解析。只有当一些程序要调用到非常多的M文件时,如GUI应用程序时,才会作预解析,以增加以后的调用速度。
P文件可以用来作保密代码之用,如果你给别人一个M文件,别人可以打开来看到你所有的代码和算法。如果你的代码不想被别人看到,那可以给他P文件。
pcode函数也可以应用在M函数文件。
Description
pcode fun obfuscates (i.e., shrouds) M-file fun.m for the purpose of protecting its proprietary source code. The encrypted M-code is written to P-file fun.pin the current directory. The original M-file can be anywhere on the search path.
If the input file resides within a package and/or class directory, then the same package and class directories are applied to the output file. See example 2, below.
pcode *.m creates P-files for all the M-files in the current directory.
pcode fun1 fun2 ... creates P-files for the listed functions.
pcode... -inplace creates P-files in the same directory as the M-files. An error occurs if the files cannot be created.
P文件是对应M文件的一种预解析版本(preparsed version)。因为当你第一次执行M文件时,Matlab需要将其解析(parse)一次(第一次执行后的已解析内容会放入内存作第二次执行时使用,即第二次执行时无需再解析),这无形中增加了执行时间。所以我们就预先作解释,那么以后再使用该M文件时,便会直接执行对应的已解析版本,即P文件。但又因为Matlab的解析速度非常快,一般不用自己作预解析。只有当一些程序要调用到非常多的M文件时,如GUI应用程序时,才会作预解析,以增加以后的调用速度。
P文件可以用来作保密代码之用,如果你给别人一个M文件,别人可以打开来看到你所有的代码和算法。如果你的代码不想被别人看到,那可以给他P文件。
pcode函数也可以应用在M函数文件。
Matlab命令:pcode
pcode fun
pcode *.m
pcode fun1 fun2 ...
pcode... -inplace Description
pcode fun obfuscates (i.e., shrouds) M-file fun.m for the purpose of protecting its proprietary source code. The encrypted M-code is written to P-file fun.pin the current directory. The original M-file can be anywhere on the search path.
If the input file resides within a package and/or class directory, then the same package and class directories are applied to the output file. See example 2, below.
pcode *.m creates P-files for all the M-files in the current directory.
pcode fun1 fun2 ... creates P-files for the listed functions.
pcode... -inplace creates P-files in the same directory as the M-files. An error occurs if the files cannot be created.
4 Oct 2011
Javascript:显示鼠标点击位置坐标
收藏到CSDN网摘

临时需要检测鼠标点击位置在图片中的坐标,javascript,firefox不响应offset函数,仅ie有效.

临时需要检测鼠标点击位置在图片中的坐标,javascript,firefox不响应offset函数,仅ie有效.
<script>
function getcoords()
{
document.getElementById("ids").value += event.offsetX+","+event.offsetY+"\n";
}
</script>
<img src= "a.jpg" width=1200 height=800 onclick= "getcoords();">
<textarea id="ids" rows=100 cols=100>
</textarea>
20 Sept 2011
Euler Project 12 欧拉工程12
收藏到CSDN网摘

The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be:
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...
Let us list the factors of the first seven triangle numbers:
1: 1
3: 1,3
6: 1,2,3,6
10: 1,2,5,10
15: 1,3,5,15
21: 1,3,7,21
28: 1,2,4,7,14,28
We can see that 28 is the first triangle number to have over five divisors.
What is the value of the first triangle number to have over five hundred divisors?
翻译:
三角数序列可通过连续自然数求和得到.第7个三角数是1 + 2 + 3 + 4 + 5 + 6 + 7 = 28.前10个三角数是:
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...
列出前7个三角数的因子:
1: 1
3: 1,3
6: 1,2,3,6
10: 1,2,5,10
15: 1,3,5,15
21: 1,3,7,21
28: 1,2,4,7,14,28
可以发现28是第一个有超过5个因子的三角数.
找到第一个有500个因子的三角数.
The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be:
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...
Let us list the factors of the first seven triangle numbers:
1: 1
3: 1,3
6: 1,2,3,6
10: 1,2,5,10
15: 1,3,5,15
21: 1,3,7,21
28: 1,2,4,7,14,28
We can see that 28 is the first triangle number to have over five divisors.
What is the value of the first triangle number to have over five hundred divisors?
翻译:
三角数序列可通过连续自然数求和得到.第7个三角数是1 + 2 + 3 + 4 + 5 + 6 + 7 = 28.前10个三角数是:
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...
列出前7个三角数的因子:
1: 1
3: 1,3
6: 1,2,3,6
10: 1,2,5,10
15: 1,3,5,15
21: 1,3,7,21
28: 1,2,4,7,14,28
可以发现28是第一个有超过5个因子的三角数.
找到第一个有500个因子的三角数.
29 Aug 2011
c++调用help provider提供帮助文档
收藏到CSDN网摘
c++调用help provider提供帮助文档
c++调用help provider提供帮助文档
private void mnuContentsHelp_Click(object sender, System.EventArgs e)
{
// Show the contents of the help file.
Help.ShowHelp(this, hpAdvancedCHM.HelpNamespace);
}
private void mnuIndexHelp_Click(object sender, System.EventArgs e)
{
// Show index of the help file.
Help.ShowHelpIndex(this, hpAdvancedCHM.HelpNamespace);
}
private void mnuSearchHelp_Click(object sender, System.EventArgs e)
{
// Show the search tab of the help file.
Help.ShowHelp(this, hpAdvancedCHM.HelpNamespace, HelpNavigator.Find, "");
}
15 Aug 2011
Python调用ie提交form
收藏到CSDN网摘

利用python提交网页
利用python提交网页
import win32com.client
import time
ie6=win32com.client.Dispatch("InternetExplorer.Application")
ie6.Navigate("http://localhost/skyenet/")
ie6.Visible=1
while ie6.Busy:
time.sleep(1)
document=ie6.Document
document.getElementById("username").value="alibaba"
document.getElementById("password").value="zhimakamen"
document.forms[0].submit()
Subscribe to:
Posts
(
Atom
)