Skip to content

Instantly share code, notes, and snippets.

@UweRaabe
UweRaabe / Project69.dpr
Created February 5, 2016 15:04
RegEx-Test
program Project69;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
System.RegularExpressions,
System.Classes;
@UweRaabe
UweRaabe / Unit77.pas
Last active April 7, 2016 17:26
Screenshot to Metafile
unit Unit77;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, System.Actions, Vcl.ActnList;
type
TForm77 = class(TForm)
function BytesToHex(const ASource: TBytes): string;
var
target: TBytes;
begin
SetLength(target, Length(ASource)*2);
BinToHex(ASource, 0, target, 0, Length(ASource));
result := TEncoding.ANSI.GetString(target);
end;
function StringToHex(const ASource: string; AEncoding: TEncoding): string;
procedure TdmScripting.PrepareScripter(AScripter: TIDEScripter);
begin
AScripter.DefineClassByRTTI(TTwinCATVar);
AScripter.DefineClassByRTTI(TTwinCATVarBOOL);
AScripter.DefineClassByRTTI(TTwinCATVarBYTE);
AScripter.DefineClassByRTTI(TTwinCATVarINT);
AScripter.DefineClassByRTTI(TTwinCATVarLONG);
AScripter.DefineClassByRTTI(TTwinCATVarSINGLE);
AScripter.DefineClassByRTTI(TTwinCATVarDOUBLE);
AScripter.DefineClassByRTTI(TTwinCATVarSTRING);
<?xml version="1.0" encoding="utf-8"?>
<codetemplate version="1.0.0" xmlns="http://schemas.borland.com/Delphi/2005/codetemplates">
<template name="array[" invoke="auto">
<description>
sized array declaration
</description>
<author>
Uwe Raabe
</author>
type
TVariantArr = record
private
{ implementation may differ }
Data: Variant;
Arr: TArray<Variant>;
function GetItems(Index: Integer): Variant;
procedure SetItems(Index: Integer; const Value: Variant);
public
class operator Implicit(A: TVariantArr): Variant; overload;
@UweRaabe
UweRaabe / uDesignNote.pas
Created August 16, 2017 15:38
Delphi component to show some text file at design time
unit uDesignNote;
interface
uses
System.SysUtils, System.Classes, Vcl.Forms, Vcl.StdCtrls;
type
TDesignNote = class(TComponent)
private
@UweRaabe
UweRaabe / uIsPermanentConnection.pas
Last active November 24, 2017 13:09
check if network connection is permanent
function IsPermanentConnection(const ALocalName: string): Boolean;
type
PNetResourceArray = ^TNetResourceArray;
TNetResourceArray = array [0 .. MaxInt div SizeOf(TNetResource) - 1] of TNetResource;
var
I, BufSize, NetResult: Integer;
Count, Size: LongWord;
NetHandle: THandle;
NetResources: PNetResourceArray;
begin
@UweRaabe
UweRaabe / uNetUse.pas
Created November 28, 2016 10:57
add and delete a network connection
function NetUseAdd(const RemoteName: string): string;
var
NetResource: TNetResource;
dwResult, dwBufSize, dwFlags: DWORD;
hRes: DWORD;
localName: array[0..1024] of Char;
begin
dwFlags := CONNECT_REDIRECT;
ZeroMemory(@NetResource, sizeof(TNetResource));
with NetResource do begin
@UweRaabe
UweRaabe / installation.rst
Created October 31, 2019 10:56 — forked from UnderGreen/installation.rst
Installation instruction for Kallithea

Setting up Kallithea on Ubuntu Server 12.04

Preparation

  1. Install Ubuntu Server.
  2. Update Ubuntu with the commands: