Skip to content

Instantly share code, notes, and snippets.

Owl's perspective owlsperspective

View GitHub Profile
@owlsperspective
owlsperspective / HideQuickActionPanel.dpk
Last active Mar 20, 2019
RAD Studio IDEのクイックアクションパネルを非表示にする/Hide quick action panel on RAD Studio IDE
View HideQuickActionPanel.dpk
// Hide Quick Action Panel from Delphi 2010 or later
// Delphi 2010以降のクイックアクションパネルを非表示にする
// original by MartynA from https://stackoverflow.com/questions/41501400/delphi-xe4-ide-how-to-always-hide-the-bottom-panes-of-the-object-inspector
//
// How to use this package:
// Open HideQuickActionPanel.dpk and change project option/description page below, and select 'install' on project pane's context menu.
// 1.Set description 'Hide quick action panel' or something.
// 2.Set LIB suffix, for example '330'(compiler version) or '260'(Delphi version) or '200'(studio version) or 'Rio'(codename) or etc.
// 3.Set 'Design time only'.
//
@owlsperspective
owlsperspective / DumpExceptionStack.pas
Created Nov 10, 2017
JclDebugでスタックトレースを取得する/Get stack trace descriptions from JclDebug
View DumpExceptionStack.pas
unit DumpExceptionStack;
interface
uses
Winapi.Windows,
System.SysUtils,
JclBase, JclDebug;
function GetExceptionDescription(E: Exception): String;
@owlsperspective
owlsperspective / UCombSort.pas
Created Mar 22, 2017
ジェネリックスのリストをアルゴリズムを指定してソートする/Sort generic list by specifying algorithm
View UCombSort.pas
unit UCombSort;
interface
{$IF RTLVersion <= 20.00}
{$MESSAGE ERROR 'Need Delphi 2010 or later'}
{$IFEND}
uses
{$IF RTLVersion >= 23.00}
@owlsperspective
owlsperspective / Open PDF via DDE for Reader 10 or later.pas
Last active Mar 7, 2017
Adobe Reader(X以降)で指定したファイルの指定したページを開く
View Open PDF via DDE for Reader 10 or later.pas
unit Unit2;
interface
uses
{$IF RTLVersion >= 23.00}
Winapi.Windows, System.SysUtils, System.Win.Registry, System.AnsiStrings,
Vcl.DdeMan;
{$ELSE}
Windows, SysUtils, Registry, {$IFDEF UNICODE}AnsiStrings, {$ENDIF}DdeMan;
@owlsperspective
owlsperspective / Class helper unit.pas
Last active Jul 11, 2016
Delphi 10.1 Berlinでもclass helperでprivateなクラス変数/クラスメソッド/インスタンスメソッドにアクセスしたい
View Class helper unit.pas
unit Unit2;
interface
uses
Unit3;
type
TFooHelper = class helper for TFoo
public
@owlsperspective
owlsperspective / How to determine Windows is server SKU
Last active Feb 26, 2016
Windowsがサーバ版かどうかを調べる
View How to determine Windows is server SKU
function IsWindowsServer: Boolean;
var
OSVI: TOSVersionInfoEx;
ConditionMask: UInt64;
begin
FillChar(OSVI,SizeOf(TOSVersionInfoEX),0);
OSVI.dwOSVersionInfoSize := SizeOf(OSVI);
OSVI.wProductType := VER_NT_WORKSTATION;
@owlsperspective
owlsperspective / Population counting (hamming weight)
Last active Feb 5, 2016
整数の中で立っているビットの数を数える
View Population counting (hamming weight)
unit Unit2;
interface
function PopulationCount(Value: UInt8): Integer; overload;
function PopulationCount(Value: UInt16): Integer; overload;
function PopulationCount(Value: UInt32): Integer; overload;
function PopulationCount(Value: UInt64): Integer; overload;
@owlsperspective
owlsperspective / Implement set type based sub-range type over 256 ordinalities
Last active Dec 13, 2015
値範囲が0..255に収まらない部分範囲型の集合型
View Implement set type based sub-range type over 256 ordinalities
unit Unit3;
interface
uses
{$IF CompilerVersion >= 23.0}
System.SysUtils;
{$ELSE}
SysUtils;
{$IFEND}
@owlsperspective
owlsperspective / Implement set type based enumeration over 256 ordinalities
Last active Dec 13, 2015
要素数が256を超える列挙型の集合型
View Implement set type based enumeration over 256 ordinalities
unit Unit2;
interface
uses
{$IF CompilerVersion >= 23.0}
System.SysUtils;
{$ELSE}
SysUtils;
{$IFEND}
View Implement IfThen by generics and advanced record
type
&IF = record
class function &Then<T>(AValue: Boolean; AThen: T; AElse: T): T; static; inline;
end;
class function &IF.&Then<T>(AValue: Boolean; AThen: T; AElse: T): T;
begin
if AValue then
begin
Result := AThen;
You can’t perform that action at this time.