Wednesday, January 8, 2014

TUGAS PENGGANTI FINAL PTIK06 - PTIK01

Buatlah program(bebas) menggunakan pascal/turbo pascal/free pascal atau delphi, dengan topik "program matematika dengan menggunakan array"
Catatan :
- Tugas Perorangan
- Dikumpul Pada Saat Ujian
- Laporan Dalam Bentuk DOC atau PDF
- Source Code , EXE File Disertakan
- Laporan, Source Code, Exe File Dikumpulkan dalam Bentuk CD / DVD
- Pada CD / DVD, Harus Ditempel NIM, Nama Lengkap
  (Yang Tidak Menempelkan NIM Dan NAMA... TIDAK AKAN DIPERIKSA !)

Saturday, June 29, 2013

KISI - KISI UAS - JARKOMDAS PTIK05

1. Definisi & Esensi Jaringan Komputer

2. Syarat-syarat / komponen dasar jaringan

3. Media Transmisi
   A. GUIDED
   B. UN-GUIDED

4. LOCAL AREA NETWORK (LAN) & TOPOLOGI JARINGAN

5. Terapan perancangan infrastruktur Jaringan 2 gedung dalam jarak <200m

Wednesday, June 19, 2013

Kisi - Kisi - RPL - PTIK01

  1. Tahap - tahap  proses pengembangan perangkat lunak
  2. Prinsip Pengujian Perangkat Lunak
  3. Black-box testing & white testing
  4. Konsep Pemeliharaan Perangkat Lunak
  5. Kasus terapan: tahapan 'Analisa'

Thursday, January 10, 2013

Enkripsi & Dekripsi



unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;


type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

  function Decrypt(const S: AnsiString; Key: Word): AnsiString;
  function Encrypt(const S: AnsiString; Key: Word): AnsiString;

var
  Form1: TForm1;



implementation

const
  C1 = 52845;
  C2 = 22719;

{$R *.dfm}


function Decode(const S: AnsiString): AnsiString;
const
  Map: array[Char] of Byte = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 63, 52, 53,
    54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2,
    3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
    20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 0, 0, 26, 27, 28, 29, 30,
    31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
    46, 47, 48, 49, 50, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0);
var
  I: LongInt;
begin
  case Length(S) of
    2:
      begin
        I := Map[S[1]] + (Map[S[2]] shl 6);
        SetLength(Result, 1);
        Move(I, Result[1], Length(Result))
      end;
    3:
      begin
        I := Map[S[1]] + (Map[S[2]] shl 6) + (Map[S[3]] shl 12);
        SetLength(Result, 2);
        Move(I, Result[1], Length(Result))
      end;
    4:
      begin
        I := Map[S[1]] + (Map[S[2]] shl 6) + (Map[S[3]] shl 12) +
          (Map[S[4]] shl 18);
        SetLength(Result, 3);
        Move(I, Result[1], Length(Result))
      end
  end
end;

function PreProcess(const S: AnsiString): AnsiString;
var
  SS: AnsiString;
begin
  SS := S;
  Result := '';
  while SS <> '' do
  begin
    Result := Result + Decode(Copy(SS, 1, 4));
    Delete(SS, 1, 4)
  end
end;

function InternalDecrypt(const S: AnsiString; Key: Word): AnsiString;
var
  I: Word;
  Seed: Word;
begin
  Result := S;
  Seed := Key;
  for I := 1 to Length(Result) do
  begin
    Result[I] := Char(Byte(Result[I]) xor (Seed shr 8));
    Seed := (Byte(S[I]) + Seed) * Word(C1) + Word(C2)
  end
end;

function Decrypt(const S: AnsiString; Key: Word): AnsiString;
begin
  Result := InternalDecrypt(PreProcess(S), Key)
end;

function Encode(const S: AnsiString): AnsiString;
const
  Map: array[0..63] of Char = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' +
    'abcdefghijklmnopqrstuvwxyz0123456789+/';
var
  I: LongInt;
begin
  I := 0;
  Move(S[1], I, Length(S));
  case Length(S) of
    1:
      Result := Map[I mod 64] + Map[(I shr 6) mod 64];
    2:
      Result := Map[I mod 64] + Map[(I shr 6) mod 64] +
        Map[(I shr 12) mod 64];
    3:
      Result := Map[I mod 64] + Map[(I shr 6) mod 64] +
        Map[(I shr 12) mod 64] + Map[(I shr 18) mod 64]
  end
end;

function PostProcess(const S: AnsiString): AnsiString;
var
  SS: AnsiString;
begin
  SS := S;
  Result := '';
  while SS <> '' do
  begin
    Result := Result + Encode(Copy(SS, 1, 3));
    Delete(SS, 1, 3)
  end
end;

function InternalEncrypt(const S: AnsiString; Key: Word): AnsiString;
var
  I: Word;
  Seed: Word;
begin
  Result := S;
  Seed := Key;
  for I := 1 to Length(Result) do
  begin
    Result[I] := Char(Byte(Result[I]) xor (Seed shr 8));
    Seed := (Byte(Result[I]) + Seed) * Word(C1) + Word(C2)
  end
end;

function Encrypt(const S: AnsiString; Key: Word): AnsiString;
begin
  Result := PostProcess(InternalEncrypt(S, Key))
end;


procedure TForm1.Button1Click(Sender: TObject);
const
 my_key = 33189;
var
  sEncrypted, sDecrypted :AnsiString;
begin
  sEncrypted := Encrypt('contoh kalimat yang mau di enkripsi',my_key);

  ShowMessage(sEncrypted);

  sDecrypted := Decrypt(sEncrypted,my_key);

  ShowMessage(sDecrypted);
end;
end.

Monday, December 3, 2012

Mengecek Apakah sebuah File Sedang Digunakan Atau Tidak


function ApakahFileSdgDigunakan(FileName: TFileName): Boolean;
var
  HFileRes: HFILE;
begin
  Result := False;
  if not FileExists(FileName) then Exit;
  HFileRes := CreateFile(PChar(FileName),
                         GENERIC_READ or GENERIC_WRITE,
                         0,
                         nil,
                         OPEN_EXISTING,
                         FILE_ATTRIBUTE_NORMAL,
                         0);
  Result := (HFileRes = INVALID_HANDLE_VALUE);
  if not Result then
    CloseHandle(HFileRes);
end;

// Example

procedure TForm1.Button1Click(Sender: TObject);
begin
if ApakahFileSdgDigunakan('C:\Program Files\Borlandx\Delphi 3\BIN\delphi32.exe') then
    ShowMessage('File sedang digunakan')
  else
    ShowMessage('File Tidak Sedang Digunakan');

end;

Cara Mengubah Resolusi Layar

Terkadang aplikasi yang kita bangun membutuhkan ukuran layar yang sesuai dengan kebutuhan kita, ada cara mudah merubah resolusi layar sbb:


.
.
.

procedure RubahResolusi(XRes, YRes: DWord);
var
   lpDevMode : TDeviceMode;
begin
     EnumDisplaySettings(nil, 0, lpDevMode);

     lpDevMode.dmFields := DM_PELSWIDTH or DM_PELSHEIGHT;
     lpDevMode.dmPelsWidth := XRes;
     lpDevMode.dmPelsHeight := YRes;
     ChangeDisplaySettings(lpDevMode, 0);
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
      RubahResolusi(800,600);
end;


Membangun Password Secara Random


.
.
.
function RandomPassword(PLen: Integer): string;
var
  str: string;
begin
  Randomize;
  str    := 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  Result := '';
  repeat
    Result := Result + str[Random(Length(str)) + 1];
  until (Length(Result) = PLen)
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  //generate sebuah password dengan 10 chars
  label1.Caption := RandomPassword(10);
end;