Skip to content

Instantly share code, notes, and snippets.

@rehmoe
rehmoe / code.snippet3.pas
Created June 16, 2011 04:17
Kode untuk generate random string
function GeneratePWDSecutityString: string;
const
Codes64 = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/';
var
i, x: integer;
s1, s2: string;
begin
s1 := Codes64;
s2 := '';
for i := 0 to 15 do
@rehmoe
rehmoe / sql.snippet.ddl.sql
Created June 16, 2011 05:40
create table listmenu
CREATE TABLE `listmenu` (
`menu` VARCHAR(30) NOT NULL DEFAULT '',
`modul` VARCHAR(30) NULL DEFAULT NULL, PRIMARY KEY (`menu`)
);
@rehmoe
rehmoe / sql.snippet.group_concat.sql
Created June 16, 2011 05:44
Tips untuk retrieve info field yang nantinya bisa digunakan untuk kebutuhan Query
SELECT GROUP_CONCAT(column_name) AS info_field
FROM information_schema.COLUMNS
WHERE table_schema='joomla1510' AND table_name='mm_content';
@rehmoe
rehmoe / code.snippet.validasi.numerik.pas
Created June 16, 2011 05:53
Kode untuk validasi input numerik only
//Kode ini untuk validasi input... (yg diinput hanya angka saja)
procedure Tf_main.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
//selain angka (0..9)& backspace( #8 ), input dimatikan
if not(key in['0'..'9',#8]) then
key:=#0
end;
@rehmoe
rehmoe / code.snippet.ribuan.pas
Created June 16, 2011 05:55
Kode untuk format numerik --> rupiah/ribuan (dan sebaliknya)
//Kode ini untuk format angka ke rupiah atau sebaliknya
procedure Tf_main.Edit1KeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
var
sRupiah: string;
iRupiah: Currency;
begin
//ribuan --> currency ( menyesuaikan setting windows )
sRupiah := Edit1.Text;
sRupiah := StringReplace(sRupiah,',','',[rfReplaceAll,rfIgnoreCase]); // hilangkan char koma , pemisah //ribuan selain IDR
@rehmoe
rehmoe / code.snippet.disable.key.pas
Created June 16, 2011 06:01
Kode prosedur disable system key
//procedure disable/enable
procedure SystemKeys(Disable: Boolean);
var
OldVal : LongInt;
begin
SystemParametersInfo(SPI_SCREENSAVERRUNNING,Word(Disable), @OldVal, 0);
end;
//contoh pamanggilan (disable)
procedure TForm1.btn1Click(Sender: TObject);
@rehmoe
rehmoe / code.snippet.textprint.pas
Created June 16, 2011 06:12
Kode prosedur direct printing (textbased)
procedure TextPrint(lst:TStringList);
var
F: TextFile;
begin
AssignFile(F,'LPT1');
Rewrite(F);
Write(F,lst.Gettext);
CloseFile(F);
end;
@rehmoe
rehmoe / DisableWinKeys.pas
Created June 16, 2011 06:22
Kode untuk disable system keys (ctrl+alt+del) ..dsb..dsb
(************************************************************
this unit migrated from dll project(by Kambiz@delphiarea.com)
downloaded at:
http://forum.delphiarea.com/viewtopic.php?f=5&t=1744#p6504
Originally created by:
Andrea Belli@delphiarea.com
March 5th, 2010, 12:51 am
enhanced: CTRL+ESC,ALT+TAB,ALT+ESC
@rehmoe
rehmoe / code.snippet.disablewindowsui.pas
Created June 16, 2011 06:24
Contoh pemanggilan prosedur disabledwindowsUI
//disable
procedure TForm1.btn1Click(Sender: TObject);
begin
DisableWindowsUI
end;
//enable
procedure TForm1.btn2Click(Sender: TObject);
begin
EnableWindowsUI
@rehmoe
rehmoe / code.snippet.disable-ctrl-alt-del.pas
Created June 16, 2011 06:31
Kode presedur disable CTRL+ALT+DEL
procedure DisableCtrAltDel(Val: Boolean);
var
MyReg: TRegistry;
begin
Try
MyReg := TRegistry.Create;
with MyReg do
begin
RootKey := HKEY_CURRENT_USER;
OpenKey('\Software\Microsoft\Windows\CurrentVersion\Policies\System', True);