摘要:interfaceuses Classes, SysUtils;type TParallelProc = reference to procedure(i: Integer; ThreadID: Integer); TParallel = class(TThread) private FProc: TParallelProc; FThreadID: Integer; //current thread ID protected procedure Execute; override; function GetNextValue: Integer; public...
阅读全文
摘要:有如下循环体:hits:=0;for I:=0 to NumberOfIterations-1 dobegin {perform some calculations dependent on random number generation to determine a value x} if x>0 then hits:=hits+1;end;{For Loop}FailureProbability:=hits/NumberOfIterations;如果迭代次数非常大,如何用并行方法完成?答案如下:program loop;{$APPTYPE CONSOLE}const ...
阅读全文
摘要:1) 删除文件: C:\documents and settings\\.borland\registry.slm,如果在win8或在win7下,即C:\Users\HiWin8\.borland2)运行 c:\program files\borland\delphi7\bin\D7Reg.exe3) 一路单击下一步即可...4)打开 Delphi7
阅读全文
摘要:SetLength(glb_IndexConfig,0);FreeAndNil(glb_IndexConfig);
阅读全文
摘要:Delphi的table的RecNum属性,可以用来定位记录,如:self.Table1.RecNum:=23;即可以让数据库记录移动到23号记录上,但这种作用仅限于Paradox数据库,而不是dBASE数据库。如何解决这个问题,可以如下处理:unit DBTables;...procedure TBDEDataSet.SetRecNo(Value: Integer);begin CheckBrowseMode; if (FRecNoStatus = rnParadox) and (Value RecNo) then begin DoBeforeScroll; if Dbi...
阅读全文
摘要:OpenFileDialog OFD = new OpenFileDialog(); OFD.Title = "打开第一个文本文件"; OFD.FileName = "*.txt"; OFD.InitialDirectory = WorkSpacePath; if (OFD.ShowDialog() == DialogResult.OK) { FileInfo fi = new FileInfo(OFD.FileName); ...
阅读全文
摘要:采用文件流方式来处理,StreamReader,StreamWriter:StreamReader sr = new StreamReader("c:\\a.txt"); while(!sr.EndOfStream) //读到文件流结尾退出 { string temp = sr.ReadLine(); // 一行一行的读 } sr.Close(); StreamWriter sw = new StreamWriter("c:\\a...
阅读全文
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace WindowsApplication1{ public partial class Form1 : Form { public Form1() { InitializeComponent(); ...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Button2: TButton; procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure Button1Click...
阅读全文
摘要:哈希表是通过哈希值来访问的,通过一定的内存浪费获取检索速度,在检索项时是不需要逐一检索。在编程中有一定的好处。unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObject); procedur...
阅读全文
摘要:delphi 创建DBASE和FOXPRO两类DBF数据文件的差异,主要有几点:1、创建方法不同DBASE的创建方法:Self.Table1.Close; Self.Table1.Active :=False; Self.Table1.DisableControls; Self.Table1.DatabaseName:=Path; Self.Table1.TableName:=Fname; Self.Table1.TableType :=ttDBase;//与FoxPro的不同 Self.Table1.FieldDefs.Clear;...
阅读全文
摘要:unit Form_ToChangCSVforDBFU;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Menus, ComCtrls, DB, DBTables, Grids, DBGrids, ExtCtrls, StdCtrls;type TForm_ChangCSVToDBFF = class(TForm) PopupMenu1: TPopupMenu; DataSource1: TDataSource; DBGr...
阅读全文
摘要:Edit1.Text:=ChangeFileExt(ExtractFileName(Application.ExeName),'') ; //获取到应用程序名后,将后缀名清空就可以啦。
阅读全文
摘要:table2.Close; table2.Active:=false; table2.Exclusive:=true; table2.TableName:='h:\gzkd\sds'; table2.TableType:=ttFOXPRO; with table2.FieldDefs do begin clear; with addfielddef do begin name:='bh'; datatype:=FTSTRING; size:=6; end; with addfielddef do begin name:='xm'; ...
阅读全文
摘要:如下:Real time_begin , time_end1 , time_end2Integer i , jcall CPU_TIME(time_begin)write(*,*) time_begindo j = 1 , 30 Do i = 1 , 300000000End Do call CPU_TIME(time_end1) write(*,*) j , time_end1 , time_end1 - time_beginend docall CPU_TIME(time_end2)write(*,*) 't' , time_end2 , time_end2 - time_
阅读全文
摘要:OpenMP for Fortran OpenMP Directive Syntax of OpenMP compiler directive for Fortran: !$OMP DirectiveName Optional_CLAUSES... ... ... Program statements between the !$OMP lines ... are executed in parallel by all threads ... !$OMP END DirectiveName Program statements between the 2 re...
阅读全文
摘要:Beginning OpenMPOpenMP provides a straight-forward interface to write software that can use multiple cores of a computer. Using OpenMP you can write code that uses all of the cores in a multicore computer, and that will run faster as more cores become available.OpenMP is a well-established, standard
阅读全文
摘要:以下例子来自https://computing.llnl.gov/tutorials/openMP/exercise.html网站一、打印线程(Hello world)C******************************************************************************C FILE: omp_hello.fC DESCRIPTION:C OpenMP Example - Hello World - Fortran VersionC In this simple example, the master thread forks a ...
阅读全文
摘要:什么是OpenMP?“OpenMP (Open Multi-Processing) is an application programming interface (API) that supports multi-platform shared memory multiprocessing programming in C, C++ and Fortran on many architectures, including Unix and Microsoft Windows platforms. It consists of a set of compiler directives, lib
阅读全文
摘要:比如程序:program main implicit none write(*,*) "AAAAAAAAAAAAAAAAAAAAAAAA" stop end虽然可以看见DOS窗口显示AAAAAAAAAAAAAAAAAAAAAAAA,不过是一闪而过,请问怎样解决呢?解答:stop的上一行加pause。 比如程序:program main implicit none write(*,*) "AAAAAAAAAAAAAAAAAAAAAAAA" pausestop end
阅读全文
|