background preloader

Delphi

Facebook Twitter

Components

Integração. Accurate Difference Between Two TDateTime Values - Or How Old/Young Are You In Milliseconds! Article submitted by Carlos Barreto Feitoza Filho.

Accurate Difference Between Two TDateTime Values - Or How Old/Young Are You In Milliseconds!

In my wanderings through the web, I discovered that the DateUtils unit contains several rounding problems and its accuracy is very poor. There is a proposal on the Quality Central for changes in this unit so that it is as accurate as one millisecond: Report # 56957 - The Fix is DateUtils Date-Time Compare Functions. Two TDateTime Values - Difference in Milliseconds! Here I intend to code the shortest path to creating a function that obtains precisely (1 millisecond) the difference between two dates passed as parameter. The result is a record in years, weeks, days, hours, minutes, seconds and milliseconds which is the difference of full dates! It is noteworthy that the existing algorithms try to return the amount of months between dates, but be warned, the exact number of months between two dates can not be achieved directly, using more than one loop attached, which would function slower. First we must declare the result type. That's it! Contact Sales or Find Partner.

Turbo Delphi Explorer - Instalar Componentes de Terceiros. A IDE do Turbo Delphi Explorer é uma versão free, com a limitação de não permitir a instalação de componentes de terceiros, além de não possuir um componente para gerar relatórios.

Turbo Delphi Explorer - Instalar Componentes de Terceiros

Então como gerar relatórios com a ferramenta Turbo Delphi Explorer na versão free se esta não permite instalação de componentes de terceiros ? Como acessar uma Base de Dados através do ZeosDBO ? Respondo, vamos fazer em tempo de execução. Irei partir do pressuposto que se tenho um componente com os códigos fontes e fazendo uso dos mesmos em tempo de execução , não haverá problemas com a licença do Turbo Delphi Explorer. Será ??? Vou utilizar dois componentes de terceiros COM código fonte:ZeosDBO versão 6.6.2 (compatível com Delphi 7) – para acessar dados no FirebirdFreeReport versão 2.32 (compatível com Delphi 7) – para gerar nosso relatório Vou partir do presuposto que você já tem instalado o Turbo Delphi Explorer. Vamos trabalhar com 02 Forms e 01 DataModule: Delphi 5 Developer's Guide: Contents. Speed Up Your FieldByName Expressions in Delphi Database Applications. Code submitted by Jens Borrisholt How Fast is FieldByName?

Speed Up Your FieldByName Expressions in Delphi Database Applications

In Delphi database application where you need to set or read a value from a field in a dataset, you would (at least once) have a line of code where you would be using the FieldByName method. FieldByName(FieldName) retrieves field information for a field given its name. FieldName is the name of an existing field.

FieldByName returns the TField component that represents the specified field. You would use FieldByName when you do not have access to the underlying table and therefore cannot use persistent field components. Internally, the FieldByName method searches for the field given its name. There were some blog posts discussing this "problem" lately: "FieldByName, FindField: too convenient to be honest" and "FieldByName, or why a Profiler is your friend" A Way To Speed Up Your FieldBaName Calls...

Here are the four ways how you can work with FieldByName to have a faster (more readable) code... Dicas de Delphi - Outros. Mac Address do adaptador de rede A função abaixo retorna o Mac Address do adaptador de rede: function MacAddress: string; var Lib: Cardinal; Func: function(GUID: PGUID): Longint; stdcall; GUID1, GUID2: TGUID; begin Result := ''; Lib := LoadLibrary('rpcrt4.dll'); if Lib <> 0 then begin @Func := GetProcAddress(Lib, 'UuidCreateSequential'); if Assigned(Func) then begin if (Func(@GUID1) = 0) and (Func(@GUID2) = 0) and (GUID1.D4[2] = GUID2.D4[2]) and (GUID1.D4[3] = GUID2.D4[3]) and (GUID1.D4[4] = GUID2.D4[4]) and (GUID1.D4[5] = GUID2.D4[5]) and (GUID1.D4[6] = GUID2.D4[6]) and (GUID1.D4[7] = GUID2.D4[7]) then begin Result := IntToHex(GUID1.D4[2], 2) + '-' + IntToHex(GUID1.D4[3], 2) + '-' + IntToHex(GUID1.D4[4], 2) + '-' + IntToHex(GUID1.D4[5], 2) + '-' + IntToHex(GUID1.D4[6], 2) + '-' + IntToHex(GUID1.D4[7], 2); end; end; end; end; Início Escrever no Bloco de Notas Problema: Solução: Sim, isto é possível.

Dicas de Delphi - Outros

Observações: Autor: Daniel P. Captions no DBNavigator Arredondamento financeiro DBGrid zebrado. Blog do Walter.