วันศุกร์ที่ 26 สิงหาคม พ.ศ. 2554

cxGrid : How to create a Level/View programmatically at runtime

// Delphi code
var
  Grid: TcxGrid;
  Level: TcxGridLevel;
  View: TcxGridDBTableView;
...
  // Creates a Grid instance
  Grid := TcxGrid.Create(SomeOwner);
  Grid.Parent := SomeParent;
  // Creates a Level
  Level := Grid.Levels.Add;
  Level.Name := 'SomeLevelName';
  // Creates a View
  View := Grid.CreateView(TcxGridDBTableView) as TcxGridDBTableView;
  View.Name := 'SomeViewName';
  // ... and binds it to the Level
  Level.GridView := View;
  // Hooks up the View to the data
  View.DataController.DataSource := SomeDataSource;
  // ... and creates all columns
  View.DataController.CreateAllItems;
end;


Copy from :  http://www.devexpress.com/Support/Center/KB/p/A295.aspx

วันอาทิตย์ที่ 14 สิงหาคม พ.ศ. 2554

SQL Command Reference

SQL INNER JOIN
      The INNER JOIN keyword return rows when there is at least one match in both tables.

SQL INNER JOIN Syntax

      SELECT column_name(s)
      FROM table_name1
      INNER JOIN table_name2
      ON table_name1.column_name=table_name2.column_name

PS: INNER JOIN is the same as JOIN.

--------------------------------------------------------------------------------------------------------------
SQL LEFT JOIN Keyword

      The LEFT JOIN keyword returns all rows from the left table (table_name1), even if there are no matches in the right table (table_name2).

SQL LEFT JOIN Syntax
      SELECT column_name(s)
      FROM table_name1
      LEFT JOIN table_name2
      ON table_name1.column_name=table_name2.column_name

PS: In some databases LEFT JOIN is called LEFT OUTER JOIN.


--------------------------------------------------------------------------------------------------------------
SQL RIGHT JOIN Keyword

      The RIGHT JOIN keyword returns all the rows from the right table (table_name2), even if there are no matches in the left table (table_name1).

SQL RIGHT JOIN Syntax
      SELECT column_name(s)
      FROM table_name1
      RIGHT JOIN table_name2
      ON table_name1.column_name=table_name2.column_name

PS: In some databases RIGHT JOIN is called RIGHT OUTER JOIN.


--------------------------------------------------------------------------------------------------------------
SQL FULL JOIN Keyword

      The FULL JOIN keyword return rows when there is a match in one of the tables.

SQL FULL JOIN Syntax
      SELECT column_name(s)
      FROM table_name1
      FULL JOIN table_name2
      ON table_name1.column_name=table_name2.column_name


--------------------------------------------------------------------------------------------------------------

Source : http://www.w3schools.com/sql/default.asp

Delphi Trick

Hot Key
F12 : switch before Code and Design work space.
CTRL + F9 : Compile Source Code.

Variable
Char Type : use single Quote ' '
                  #number for get char from int or chr(number) function

Component
cxGrid : show Nevigator Tools Bar => OptionView->Navigator
cxGrid : Show Detail Tab Level => Properties -> RootLevelOptions -> DetailTabPosition
cxButton : Picture Button => Glyph

Programer Trick
Property : prop_name : type read func_name write proced_name;

วันอังคารที่ 2 สิงหาคม พ.ศ. 2554

FreeBSD Apache,PHP,MySQL UTF-8 support

httpd.conf:
=============
AddCharset UTF-8 .utf8
AddDefaultCharset UTF-8

php.ini
===============
default_charset = "utf-8"

my.cnf
================
character-set-server=utf8
default-collation=utf8_unicode_ci


ที่มา : http://www.thaibsd.com/webboard/show.php?Category=thaibsd&No=16348