知识点大杂烩

在工作过程中总会学到一些新的知识,个人习惯将它们一一记录下来,不过没有考虑太多,所以知识点有点分散,最终决定全部转移到个人Blog上,一来统一管理,二来如果能给其他人提供一点点指导也是非常好的。

1. 通过代码打开程序
引用单元:ShellAPI
执行函数(范例:打开Excel文件):ShellExecute(HWND(self), 'open', 'excel', PChar(sExcelFile), nil, SW_SHOWNORMAL); 

2. 去除字符串中的“回车换行符”
方法一:Trim(AValue),但是它只能去除Avalue末尾的“回车换行符”,中间的都未去除;
方法二:StringReplace(AValue, #13#10, EmptyStr, [rfReplaceAll]);

3. delphi中Application.ProcessMessages和handlemessage作用
【Application.HandleMessage】检查消息队列,如果没有消息就停在那里
【Application.ProcessMessages】检查消息队列,如果没有消息立刻返回,所以你的cpu一直在跑

4. TStringList中StrictDelimiter作用
【背景】假设Avalue='a(回车符)b, c';(在ab中间有个看不见的回车符)
想以“逗号”隔开取两个字符“ab”和“c”。
【区别】
1. 若不指定TStringList.StrictDelimiter := True;那么它会将“回车符”也当作分隔,这样会分成3个字符:a、b、c;
2. 若指定TStringList.StrictDelimiter := True;那么它只认给它的分隔符,这样会分成2个字符:ab、c,参考代码如下:
FValueList := TStringList.Create;
  FValueList.StrictDelimiter := True;
  FValueList.Delimiter := ',';
  FValueList.DelimitedText := AValues;

5. 比较2个浮点数是否相等的注意
不能直接通过“d1 = d2”,因为浮点数不会完全相等,都会带上小数,应该使用Math单元中的SameValue函数

6. FinalBuilder命令行参数
/n 不显示初始窗口, /r 自动执行后面所跟脚本, /e 执行完毕自动退出, /f 忽略错误。
取自FinalBuilder4安装目录下的帮助文档“FinalBuilder4.chm”,如下:
-n or /n - Hide the splash screen when starting up 
-r or /r - auto build the project file passed in on the command line
-e or /e - exit when done building , only valid when autobuild switch is included
-f or /f - don't exit if error occurs , only valid when autobuild switch is included
-v or /v - set variables - for multiple variables, separate the name/value pairs with semi-colons.
-a or /a - allow interactive actions (eg. Prompt For Variable, Ask Question, etc.) 
eg. : 
       /vOutputDIR=d:\temp\buildfiles;DCUDIR=d:\temp\dcu
Note that if the variable value has spaces in it then enclose the value in double quotes, 
eg. : 
       /vOutputDIR="d:\temp\build files" .

7. 获取进程占用内存

function GetProcessMemorySize(_sProcessName: string; var _nMemSize: Cardinal): Boolean;
var
  l_nWndHandle, l_nProcID, l_nTmpHandle: HWND;
  l_pPMC: PPROCESS_MEMORY_COUNTERS;
  l_pPMCSize: Cardinal;
begin
  l_nWndHandle := FindWindow(nil, PChar(_sProcessName));

  if l_nWndHandle = 0 then 
  begin
    Result := False;
    Exit;
  end;

  l_pPMCSize := SizeOf(PROCESS_MEMORY_COUNTERS);

  GetMem(l_pPMC, l_pPMCSize);
  l_pPMC^.cb := l_pPMCSize;

  GetWindowThreadProcessId(l_nWndHandle, @l_nProcID);
  l_nTmpHandle := OpenProcess(PROCESS_ALL_ACCESS, False, l_nProcID);

  if (GetProcessMemoryInfo(l_nTmpHandle, l_pPMC, l_pPMCSize)) then
    _nMemSize := l_pPMC^.WorkingSetSize
  else
    _nMemSize := 0;

  FreeMem(l_pPMC);

  Result := True;
end;

8. 将Excel中单元格设置空的建议方法
在XLS中,当单元格内容为空的时候,建议用Sheet.AsBlank[Col, Row]=True,而不是用AsString[]='';
后者会使该单元格为文本类型,在Excel中用公式如“A1+A2”时,会因为数据类型不匹配,而出“#Value”的错误;

9. ResourceString
const定义的字符串和ResourceString定义的字符串使用的时候和const定义的是一样的,区别仅仅在于ResourceString是作为资源保存在EXE(DLL)中间,不需要重新编译程序就可以修改它们。

10. AQTime使用
a. 新建工程(Project):选择需要调试的.dpr文件;
b. AddArea:选择需要跟踪的单元,然后右键选择“AddSelectedToArea”;
可以采用此方法来优化效率:用AQTime来确定效率点分布;然后用Log日志方法来跟踪效率优化结果

11. 一些小工具
a. HttpAnalyze:可以获取服务器响应的时间;
b. Upx:对程序进行压缩;
Upx命令行运行:
1) 格式:Upx -9 -k 文件名;
其中,-k 表示备份被压缩的文件,其它选项可参考帮助,在cmd中运行“upx --help”;
2) 也可以在批处理文件中写如下代码:
“D:\Upx\Upx.exe” -9 -k “D:\Core.dll”;
(注意:“双引号”不能少)
3) 在cmd窗口中,想跳转到指定目录,可用命令“cd”
举例:cd D:\Programe files;

c. AsProtect、VMProtect:对程序进行加密保护;
简述AsProtect加密原理:在程序中需要保护的函数增加inc的开关指令,然后用AsProtect软件对程序进行加密;
主要设置“File To Protect”和“Output To FileName”2个参数,分别表示需要加壳的文件,以及加壳后保存到哪里;

d. Everything:快速搜索电脑中的文件或目录(第1次会比较慢,以后就快了);
e. TotalCmd:文件浏览器;
f. DebugView:调试窗口;

12. 中文在传输后变成“%”了,可用2种方法
a. 用DecodURL方法来解码;
b. 发送消息时用Base64Encode编码,在收到消息后后Base64DeCode来解码;

13. WebModule Action的属性
1. MethodType:设置服务器响应的类型,可以为mtAny、mtGet、mtHead、mtPost、mtPut;
2. PathInfo:“/*”表示当前服务的DLL的根目录下的所有地址访问都会响应;

 

14. 在cmd中查看某个命令的帮助说明

通过“--help”来获取帮助信息,以hg命令为例,可以输入:hg --help

结果部分如下

C:\Users\Jeremy.Zhang>hg --help
Mercurial Distributed SCM

list of commands:

 add           add the specified files on the next commit
 addremove     add all new files, delete all missing files
 annotate      show changeset information by line for each file
 archive       create an unversioned archive of a repository revision
 backout       reverse effect of earlier changeset
 bisect        subdivision search of changesets
 bookmarks     track a line of development with movable markers
 branch        set or show the current branch name
 branches      list repository named branches
 bundle        create a changegroup file
 cat           output the current or given revision of files
 clone         make a copy of an existing repository
 commit        commit the specified files or all outstanding changes
 copy          mark files as copied for the next commit
 diff          diff repository (or selected files)
 export        dump the header and diffs for one or more changesets
 forget        forget the specified files on the next commit
 graft         copy changes from other branches onto the current branch
 grep          search for a pattern in specified files and revisions
 heads         show current repository heads or show branch heads
 help          show help for a given topic or a help overview
 identify      identify the working copy or specified revision
 import        import an ordered set of patches
 incoming      show new changesets found in source
 init          create a new repository in the given directory
 locate        locate files matching specific patterns
 log           show revision history of entire repository or files
 manifest      output the current or given revision of the project manifest
 merge         merge working directory with another revision
 outgoing      show changesets not found in the destination
 parents       show the parents of the working directory or revision
 paths         show aliases for remote repositories
 phase         set or show the current phase name
 pull          pull changes from the specified source
 push          push changes to the specified destination
 recover       roll back an interrupted transaction
 remove        remove the specified files on the next commit
 rename        rename files; equivalent of copy + remove
 resolve       redo merges or set/view the merge status of files
 revert        restore files to their checkout state
 rollback      roll back the last transaction (dangerous)
 root          print the root (top) of the current working directory
 serve         start stand-alone webserver
 showconfig    show combined config settings from all hgrc files
 status        show changed files in the working directory
 summary       summarize working directory state
 tag           add one or more tags for the current or given revision
 tags          list repository tags
 tip           show the tip revision
 unbundle      apply one or more changegroup files
 update        update working directory (or switch revisions)
 verify        verify the integrity of the repository
 version       output version and copyright information


若想进一步查看hg中的pull命令,则类似可以输入:hg pull --help

C:\Users\Jeremy.Zhang>hg pull --help
hg pull [-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]

pull changes from the specified source

    Pull changes from a remote repository to a local one.

    This finds all changes from the repository at the specified path or URL
    and adds them to a local repository (the current one unless -R is
    specified). By default, this does not update the copy of the project in
    the working directory.

    Use "hg incoming" if you want to see what would have been added by a pull
    at the time you issued this command. If you then decide to add those
    changes to the repository, you should use "hg pull -r X" where "X" is the
    last changeset listed by "hg incoming".

    If SOURCE is omitted, the 'default' path will be used. See "hg help urls"
    for more information.

    Returns 0 on success, 1 if an update had unresolved files.

options:

 -u --update                update to new branch head if changesets were
                            pulled
 -f --force                 run even when remote repository is unrelated
 -r --rev REV [+]           a remote changeset intended to be added
 -B --bookmark BOOKMARK [+] bookmark to pull
 -b --branch BRANCH [+]     a specific branch you would like to pull
 -e --ssh CMD               specify ssh command to use
    --remotecmd CMD         specify hg command to run on the remote side
    --insecure              do not verify server certificate (ignoring
                            web.cacerts config)
    --mq                    operate on patch repository

[+] marked option can be specified multiple times

use "hg -v help pull" to show more info



 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
FinalBuilder Server 7.0.0.317 找了一大天,没有找到一个可以用的,而且基本上没有 final builder server的破解, 该内容包含了3个服务,一个web ui管理界面,内部使用了管道通讯和remoting通讯,也有WCF通讯。 完美破解 自动化持续集成,自动化部署,自动化单元测试,自动获取源代码 官方下载FinalBuilder Server 7.0.0.317 安装,然后用我的文件夹进行覆盖安装的FinalBuilder Server 7目录,然后找到网站,把所有网站用到的dll用FinalBuilder Server 7目录的dll覆盖,就完成了 。 该项目最高支持 FinalBuilder 7.0.0.1682的项目文件导入,如果项目文件后续有更改不能保证导入。 finalbuilder对比teamcity,CruiseControl.NET等东西,他们简直是菜鸟。。。 1)支持自动获取源代码,根据work item获取源代码,TFS集成 2)支持多种语言,C,C++,JAVA,C#等语言,TFS,VSS,SVN等源代码管理环境 3)支持插件,提供API 4)支持计划任务,支持依赖检查,支持打包,支持FTP等,支持IIS6,7自动创建网站,应用程序池,回收应用程序池,支持虚拟盘 5)流程控制,像工作流一样控制编译和部署流程,支持脚本和调式流程 6)支持虚拟机管理 7)支持操作系统操作shell,支持环境变量,注册表等 8)支持nunit,dunit,vs unittest,xunit,mbunit 总结下来,你能想到的,基本他都支持,他不支持的,可以用插件迅速集成扩展 还在等什么,赶紧建一个自动化编译部署环境,把Dev-QA-STAGING-PROD,管理器里 注意点:覆盖文件的时候,请停止服务 By Fating.Zhang
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值