Delphi Implement a microsecond resolution Delay
Implement a microsecond resolution Delay?
Author: Lemy
Homepage: http://www.swissdelphicenter.com
// Wait 0.2ms
procedure PerformanceDelay;
Delphi function / procedure execution time before and after
.................................................. .........
Question/Problem/Abstract:
I am optimizing a function and want to know the difference in execution time before and after optimization in microseconds!!
Answer:
put this in the var section of your function or procedure
Ctr1, Ctr2, Freq,Overhead: int64;
R: extended;
and put this at the beginnig of the function or more generally speaking at the beginning of the code you want to optimize.
[DELPHI] QueryPerformanceFrequency(Freq);
QueryPerformanceCounter(Ctr1);
QueryPerformanceCounter(Ctr2);
Overhead := Ctr2 - Ctr1; // determine API overhead
QueryPerformanceCounter(Ctr1);
put this at the end of the code
QueryPerformanceCounter(Ctr2);
R := ((Ctr2 - Ctr1) - Overhead) / Freq;
showmessage( 'The function took ' + FloatToStr(R) + ' seconds'); [/DELPHI]
important note: remember that the execution time of any function under most operating systems is affected also by services and programs running in the backgroud. So it is adviced that you keep your desktop state constant while optimizing.
This way you will get execution time in microsecond precision.
This is translated to delphi from a vb article at MSDN.
//This is the end of the article.
.................................................. .........
http://www.swissdelphicenter.ch/en/showcode.php?id=498
Question/Problem/Abstract:
I am optimizing a function and want to know the difference in execution time before and after optimization in microseconds!!
Answer:
put this in the var section of your function or procedure
Ctr1, Ctr2, Freq,Overhead: int64;
R: extended;
and put this at the beginnig of the function or more generally speaking at the beginning of the code you want to optimize.
[DELPHI] QueryPerformanceFrequency(Freq);
QueryPerformanceCounter(Ctr1);
QueryPerformanceCounter(Ctr2);
Overhead := Ctr2 - Ctr1; // determine API overhead
QueryPerformanceCounter(Ctr1);
put this at the end of the code
QueryPerformanceCounter(Ctr2);
R := ((Ctr2 - Ctr1) - Overhead) / Freq;
showmessage( 'The function took ' + FloatToStr(R) + ' seconds'); [/DELPHI]
important note: remember that the execution time of any function under most operating systems is affected also by services and programs running in the backgroud. So it is adviced that you keep your desktop state constant while optimizing.
This way you will get execution time in microsecond precision.
This is translated to delphi from a vb article at MSDN.
//This is the end of the article.
.................................................. .........
http://www.swissdelphicenter.ch/en/showcode.php?id=498
Collection of Free or Open Source Software (Updated 06-Apr-2023)
Delphi7实现MD5
delphi7里带了标准的MD5算法,单元文件IdHashMessageDigest.pas
例子:
uses
IdHashMessageDigest;//MD5计算
function MD5(CheckStr:string):String; //CheckStr为待加密的文件路路径。
var
MyMD5: TIdHashMessageDigest5;
begin
MyMD5:=TIdHashMessageDigest5.Create;
Result:=MyMD5.AsHex(MyMD5.HashValue(TFileStream.Create(CheckStr,fmOpenRead or fmSharedenyNone)));
MyMD5.Free;
end;
How can I import my existing repository into newly installed VisualSVN Server?
Importing incompatible or remote repository
If your existing repository has incompatible format, it should be converted to the supported one. If your existing repository is located on another server, it should be moved to the computer where VisualSVN Server is installed. Both tasks can be performed by exporting ("dumping") the repository contents to a file of a special format ("dump file") on its native SVN server and then loading this dump into newly set up VisualSVN Server with the help of svnadmin utility. Svnadmin is the administrative tool for monitoring and repairing your Subversion repository and is distributed as a part of VisualSVN Server installation.
To import incompatible or remote repository, perform the following steps:
Create dump of a repository using your existing Subversion version
Copy dump file to the local computer, if required
Import dump into newly installed VisualSVN Server
Creating repository dump using existing Subversion version
To dump the contents of the repository, perform the following steps on the server where your existing repository is located:
Start command prompt interpreter.
Perform the following command:
PATH-TO-SVN\svnadmin dump PATH-TO-REPO > PATH-TO-DUMPwhere
PATH-TO-SVN - path to your old Subversion installation;
PATH-TO-REPO - path to the repository folder;
PATH-TO-DUMP - full path to the dump file.
For example:
c:\Program Files\Subversion\bin\svnadmin dump c:\repositories\Contoso > c:\repo.dump
Depending on the repository size, this operation can take considerable time. You can watch the status output of the operation in your terminal window.
ImportantRepository dump should be created using the svnadmin utility from the corresponding Subversion installation used to create this repository.
Copying repository dump to the local computer
If your existing repository is located on another server, copy the dump file to the computer with your newly installed VisualSVN Server. Dump file is written in a portable format, so it can be copied between different software platforms (for example, from Linux to Windows)
Importing repository dump into newly installed VisualSVN Server
To import a repository dump, perform the following steps in your new VisualSVN Server:
Create new empty repository. To do that:
Open VisualSVN Server Manager by selecting Start | All Programs | VisualSVN and clicking VisualSVN Server Manager;
Right-click the Repositories node and select Create New Repository;
Specify the name for the new repository;
Do not select the Create default structure (trunk, branches, tags) check box as repository should be empty;
Click OK.
Load a repository dump stream from the created dump file performing the following command:
"%VISUALSVN_SERVER%\bin\svnadmin" load PATH-TO-NEW-REPO < PATH-TO-DUMP
where
PATH-TO-NEW-REPO - path to the created repository folder;
PATH-TO-DUMP - full path to the dump file.

Notes
To be sure that the correct Subversion version (the one provided with VisualSVN Server) is used to load the dump, use the %VISUALSVN_SERVER% environment variable to locate the svnadmin executable file. Alternatively, to locate the correct version of svnadmin executable, you can use the Start a new instance of command interpreter command on the VisualSVN Server Manager toolbar to launch the terminal window.
The Subversion repository dump format describes versioned repository changes only. It will not carry any information about uncommitted transactions, user locks on file system paths, repository or server configuration customizations (including hook scripts), and so on.
After performing this command, all the data from the existing repository will be moved to the new one and the new repository will be available for use with VisualSVN Server.
http://www.visualsvn.com/support/topic/00010/
PATH-TO-NEW-REPO - path to the created repository folder;
PATH-TO-DUMP - full path to the dump file.
Notes
To be sure that the correct Subversion version (the one provided with VisualSVN Server) is used to load the dump, use the %VISUALSVN_SERVER% environment variable to locate the svnadmin executable file. Alternatively, to locate the correct version of svnadmin executable, you can use the Start a new instance of command interpreter command on the VisualSVN Server Manager toolbar to launch the terminal window.
The Subversion repository dump format describes versioned repository changes only. It will not carry any information about uncommitted transactions, user locks on file system paths, repository or server configuration customizations (including hook scripts), and so on.
After performing this command, all the data from the existing repository will be moved to the new one and the new repository will be available for use with VisualSVN Server.
http://www.visualsvn.com/support/topic/00010/
Use JqueryMobile in PhoneGap Must Do!
So in PhoneGap apps that must "phone home" by loading assets off a remote server, both the $.support.cors AND $.mobile.allowCrossDomainPages must be set to true. The $.mobile.allowCrossDomainPages option must be set before any cross-domain request is made so we recommend wrapping this in a mobileinit handler:
<script>
$( document ).bind( "mobileinit", function() {
// Make your jQuery Mobile framework configuration changes here!
$.support.cors = true;
$.mobile.allowCrossDomainPages = true;
});
</script>
100 幸福 List
100 幸福 List
(摘自:http://gloria10074.pixnet.net/blog/post/27165290)
01.與白馬王子命運的邂逅
02.不可抗力之下的親密接觸
03.彼此見過雙方家長
04.不小心被看見穿睡衣的樣子
05.一起逛街經過婚紗店
06.在街頭牽手逃命
07.最後一秒擠進捷運車廂
08.一起騎車兜風
09.在騎樓下聊天
10.在馬路上大喊"我們在一起吧!"
11.情侶鞋逛五分埔
12.動物園大冒險
13.漁人碼頭看夕陽
14.在士林夜市買豪大大雞排
15.幫男友織圍巾
16.濱江飛機巷看飛機
17..美麗華摩天輪之旅
18.衝浪
19.公園騎腳踏車
20.打電動
21.六福村大怒神
22.在街上吵架然後和好
23.在八仙樂園玩水
24.在游泳池抽筋被男友按摩
25.陽明山浪漫夜景
26.去三峽看螢火蟲
27.到少年監獄當義工
28.燙爆炸頭參加地下樂園
29.在醫院頂樓烤肉
30.做菜給男友吃
31.幫男友設計新髮型
32.交往100天要送我花
33.一起去捐血
34.在碧潭踩船
35.從百視達租DVD一起看
36.在男友懷中睡著
37.參加阿根廷探戈舞會
38.男友為我和流氓打架
39.躺在國小操場看星星
40.逛寵物店
41.和腿短的狗一同照相
42.一起看江蕙演唱會
43.偷溜進後台要簽名
44.參加同志大遊行
45.打漆彈
46.在貓空纜車上跳舞
47.攀岩場大挑戰
48.士林官邸賞花
49.淡水坐渡輪
50.挑戰高空彈跳
51.看電影時把外套蓋在我身上
52.交換生日卡片
53.在大樹下埋時光蛋
54.逛美術館冒充解說員
55.坐在公園餵麻雀
56.坐公車繞總站一圈
57.整裝打扮去國家劇院看戲
58.參觀中國國民黨總部
59.在蔣公銅像前行禮
60.搭台糖五分車假裝是甘蔗
61.路見不平拔刀相助
62.混進別人婚禮吃霸王餐
63.到警察局保男友出來
64.在河堤畫超大塗鴉
65.親手做巧克力送男友
66.手勾手逛誠品
67.跟男友互換衣服出門
68.在KTV連唱12個小時
69.在溪邊捉蝦子
70.男友幫我打小強
71.中秋節在陽台戴柚皮帽
72.去蘇澳泡冷泉
73.在地圖射飛鏢決定去哪裡玩
74.玩"默契大考驗"全對
75.在雨中撐傘散步
76.在雨中不撐傘散步
77.小巨蛋溜冰
78.大湖採草莓
79.獵山豬
80.參加阿美族豐年祭
81.回鄉下奶奶家挖(??)
82.偷看男友簡訊
83.男友幫我塗指甲油
84.鐵路平溪之旅
85.淡水咖啡店吃冰淇淋
86.穿情侶裝打壁球
87.北投泡溫泉
88.穿浴衣給男友看
89.在病房玩枕頭仗
90.竹子湖採海芋
91.互畫對方的素描
92.情人節的家庭聚餐
93.幫男友洗衣服
94.家人反對在一起
95.在雨中哭著奔跑
96.男友大喊"我養你阿...擁抱"
97.坐高鐵假裝私奔一日遊
98.把饒河街夜市的遊戲攤玩到破產
99.在夜晚的巷子散步
100.火辣辣的真愛之吻
(摘自:http://gloria10074.pixnet.net/blog/post/27165290)
01.與白馬王子命運的邂逅
02.不可抗力之下的親密接觸
03.彼此見過雙方家長
04.不小心被看見穿睡衣的樣子
05.一起逛街經過婚紗店
06.在街頭牽手逃命
07.最後一秒擠進捷運車廂
08.一起騎車兜風
09.在騎樓下聊天
10.在馬路上大喊"我們在一起吧!"
11.情侶鞋逛五分埔
12.動物園大冒險
13.漁人碼頭看夕陽
14.在士林夜市買豪大大雞排
15.幫男友織圍巾
16.濱江飛機巷看飛機
17..美麗華摩天輪之旅
18.衝浪
19.公園騎腳踏車
20.打電動
21.六福村大怒神
22.在街上吵架然後和好
23.在八仙樂園玩水
24.在游泳池抽筋被男友按摩
25.陽明山浪漫夜景
26.去三峽看螢火蟲
27.到少年監獄當義工
28.燙爆炸頭參加地下樂園
29.在醫院頂樓烤肉
30.做菜給男友吃
31.幫男友設計新髮型
32.交往100天要送我花
33.一起去捐血
34.在碧潭踩船
35.從百視達租DVD一起看
36.在男友懷中睡著
37.參加阿根廷探戈舞會
38.男友為我和流氓打架
39.躺在國小操場看星星
40.逛寵物店
41.和腿短的狗一同照相
42.一起看江蕙演唱會
43.偷溜進後台要簽名
44.參加同志大遊行
45.打漆彈
46.在貓空纜車上跳舞
47.攀岩場大挑戰
48.士林官邸賞花
49.淡水坐渡輪
50.挑戰高空彈跳
51.看電影時把外套蓋在我身上
52.交換生日卡片
53.在大樹下埋時光蛋
54.逛美術館冒充解說員
55.坐在公園餵麻雀
56.坐公車繞總站一圈
57.整裝打扮去國家劇院看戲
58.參觀中國國民黨總部
59.在蔣公銅像前行禮
60.搭台糖五分車假裝是甘蔗
61.路見不平拔刀相助
62.混進別人婚禮吃霸王餐
63.到警察局保男友出來
64.在河堤畫超大塗鴉
65.親手做巧克力送男友
66.手勾手逛誠品
67.跟男友互換衣服出門
68.在KTV連唱12個小時
69.在溪邊捉蝦子
70.男友幫我打小強
71.中秋節在陽台戴柚皮帽
72.去蘇澳泡冷泉
73.在地圖射飛鏢決定去哪裡玩
74.玩"默契大考驗"全對
75.在雨中撐傘散步
76.在雨中不撐傘散步
77.小巨蛋溜冰
78.大湖採草莓
79.獵山豬
80.參加阿美族豐年祭
81.回鄉下奶奶家挖(??)
82.偷看男友簡訊
83.男友幫我塗指甲油
84.鐵路平溪之旅
85.淡水咖啡店吃冰淇淋
86.穿情侶裝打壁球
87.北投泡溫泉
88.穿浴衣給男友看
89.在病房玩枕頭仗
90.竹子湖採海芋
91.互畫對方的素描
92.情人節的家庭聚餐
93.幫男友洗衣服
94.家人反對在一起
95.在雨中哭著奔跑
96.男友大喊"我養你阿...擁抱"
97.坐高鐵假裝私奔一日遊
98.把饒河街夜市的遊戲攤玩到破產
99.在夜晚的巷子散步
100.火辣辣的真愛之吻
Subscribe to:
Posts (Atom)