Skip to content

Instantly share code, notes, and snippets.

View JTheiller's full-sized avatar

Joathan Theiller JTheiller

  • Conceito Tecnologia LTDA
  • Barreiras - BA
View GitHub Profile
function FileInUse(AFileName: String): Boolean;
var
HFileRes : HFILE;
begin
Result := false;
if not FileExists(fName) then
Exit;
HFileRes := CreateFile(PChar(AFileName), GENERIC_READ or GENERIC_WRITE,0, nil, OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL, 0);
Result := (HFileRes = INVALID_HANDLE_VALUE);
if not Result then
@JTheiller
JTheiller / Delphi.project.no.location.frames.dproj
Last active July 10, 2022 14:19
Fix TFrame error No frames are available to insert
//Faulty current state example: No Tag "DesignClass"
<DCCReference Include="U_NewFrame\U_NewFrame.pas">
<Form>NewFrame</Form>
</DCCReference>
//Example with add tag correction
<DCCReference Include="U_NewFrame\U_NewFrame.pas">
<Form>NewFrame</Form>
<FormType>dfm</FormType>
<DesignClass>TFrame</DesignClass>
@JTheiller
JTheiller / Sefaz.Email.txt
Last active February 18, 2022 01:51
Sefaz.Email.txt
Acre efd@ac.gov.br
Alagoas sped-efd@sefaz.al.gov.br
Amapá sped@sefaz.ap.gov.br
Amazonas efd@sefaz.am.gov.br
Bahia faleconosco@sefaz.ba.gov.br
Ceará sped@sefaz.ce.gov.br
Espírito Santo spedfiscal@sefaz.es.gov.br
Goiás sped-fiscal@sefaz.go.gov.br
Mato Grosso efd@sefaz.mt.gov.br
Mato Grosso do Sul efd@fazenda.ms.gov.br
boss version
boss upgrade
boss init
boss init --q
(Admin required)
boss login
Host:
User:
@JTheiller
JTheiller / FastReport - GetDataSet.pas
Last active April 29, 2021 19:55
FastReport - GetDataSet
//With Band
procedure Page1OnBeforePrint(Sender: TfrxComponent);
begin
DBXQuery1.Master := MasterData1.DataSet;
end;
//Direct DataSet
procedure Page1OnBeforePrint(Sender: TfrxComponent);
begin
DBXQuery1.Master := Report.GetDataSet('Customers');
@JTheiller
JTheiller / VarIsEmptyOrNull.pas
Last active April 29, 2021 20:24
check if its value is not defined
function VarIsEmptyOrNull(const Value: Variant): Boolean;
begin
Result := VarIsClear(Value)
or VarIsEmpty(Value)
or VarIsNull(Value)
or (VarCompareValue(Value, Unassigned) = vrEqual);
if (not Result) and VarIsStr(Value) then
Result := Value = EmptyStr;
end;
@JTheiller
JTheiller / VarTypeToStr.pas
Last active December 29, 2020 19:02
Return the variante type in string
// uses Variants
function VarTypeToStr(Value: Variant): String;
begin
Result := VarTypeAsText(VarType(Value));
end;
//or
function VarTypeToStr(Value: Variant): String;
var