Halaman

Kamis, 17 Januari 2013

[YII] Quick Start, YII Tutorial in 2 minutes!

Yii as simple as 1..2..3 For this tutorial, i assume that you are working in windows environtment and already setup your local webserver (xampp, wamp, etc..)
  1. Download Yii anywhere you wanted, extract them to any folder you wanted.., for this example let's say after you download the zip file, you extract it to c:\yii
  2. Open up command prompt / terminal
  3. Change your dir to the directory where you put your php.exe, in my case it is in C:\xampp\php
  4. On that dir, execute the command:
    php "C:\yii\framework\yiic" webapp MyAppName
  5. Now move the folder MyAppName to your htdocs folder,
    in my case i move entire folder to C:\xampp\htdocs
  6. That is it.. now you have a fully working MVC Yii application
    Open your browser and then go to the address http://localhost/MyAppName

Rabu, 16 Januari 2013

[Delphi] MDI On a TPanel, RTTI power example

Ummh, since it's 3 AM, and just as a quick note on delphi power, MDI child on a TPanel and an introduction to a RTTI usage..
You will need Delphi XE and TMS Component
procedure TForm1.AdvOfficeMDITabSet1TabClose(Sender: TObject;
  TabIndex: Integer; var Allow: Boolean);
var
  form : TForm;
begin
  form := AdvOfficeMDITabSet1.GetChildForm(AdvOfficeMDITabSet1.AdvOfficeTabs[TabIndex]);
  form.Close;
  Allow := False;
end;

procedure TForm1.New1Click(Sender: TObject);
var
  c : TForm;
begin
  c := TForm2.Create(Self);
  c.Parent := Panel2;
  c.SetBounds(0, 0, Panel2.Width, Panel2.Height);
  c.Caption := 'Yohan ' + IntToStr(Panel2.ControlCount);
  (c as TForm2).EllipsLabel1.Caption := c.Caption;
  c.Show;

  //introducing the power of delphi RTTI!
  if(c.ClassType = TForm2) then
    AdvOfficeMDITabSet1.AddTab(c);
end;