<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>.: ReFLeCtION AbOuT mYSeLF :. &#187; Delphi</title>
	<atom:link href="http://yayak.wordpress.com/category/delphi/feed/" rel="self" type="application/rss+xml" />
	<link>http://yayak.wordpress.com</link>
	<description>Pearl will never been found, if we never tried to dive onto the base of ocean for fear of cannot return and fear to face adversity. But fear, adversity, tired and worn-out will loose after that pearl is in front of face. And the final is existence of bliss...</description>
	<lastBuildDate>Sun, 17 May 2009 13:44:23 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='yayak.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/f2d1f78598ae5c4e42abf9521cc7a62a?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>.: ReFLeCtION AbOuT mYSeLF :. &#187; Delphi</title>
		<link>http://yayak.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://yayak.wordpress.com/osd.xml" title=".: ReFLeCtION AbOuT mYSeLF :." />
		<item>
		<title>Yahoo! Messenger Idle Status by Delphi</title>
		<link>http://yayak.wordpress.com/2007/05/27/yahoo-messenger-idle-status-by-delphi/</link>
		<comments>http://yayak.wordpress.com/2007/05/27/yahoo-messenger-idle-status-by-delphi/#comments</comments>
		<pubDate>Sun, 27 May 2007 09:42:04 +0000</pubDate>
		<dc:creator>yayak</dc:creator>
				<category><![CDATA[Delphi]]></category>
		<category><![CDATA[ASCII]]></category>
		<category><![CDATA[idle status]]></category>
		<category><![CDATA[messenger]]></category>
		<category><![CDATA[Registry]]></category>
		<category><![CDATA[Windows API]]></category>
		<category><![CDATA[yahoo]]></category>

		<guid isPermaLink="false">http://yayak.wordpress.com/2007/05/27/yahoo-messenger-idle-status-by-delphi/</guid>
		<description><![CDATA[Iseng-iseng buka arsip kumpulan project2 lama, aku nemui trik menarik yg perlu aku share disini. Dibuat pake Delphi sekitar setaon lalu, (peb&#8217; 06), trik sederhana ini bisa dicoba. Pertanyaan ato komentar dg senang hati diterima.
Didasari keinginan untuk sembunyi dari teman (dan ingin sembunyi dari orang2 yg mengganggu melalui Yahoo! Messenger), aku berpikir gimana caranya mengeset [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yayak.wordpress.com&blog=33121&post=42&subd=yayak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><blockquote><p>Iseng-iseng buka arsip kumpulan project2 lama, aku nemui trik menarik yg perlu aku share disini. Dibuat pake Delphi sekitar setaon lalu, (peb&#8217; 06), trik sederhana ini bisa dicoba. Pertanyaan ato komentar dg senang hati diterima.</p></blockquote>
<p>Didasari keinginan untuk sembunyi dari teman (dan ingin sembunyi dari orang2 yg mengganggu melalui Yahoo! Messenger), aku berpikir gimana caranya mengeset statusku agar keliatan idle. Ini maksudnya agar tetep keliatan online (dan ga&#8217; sok sibuk) tapi juga ga harus untuk langsung membalas dari setiap YM yg masuk. Males juga klo tiba2 lagi fokus belajar ato ngerjain sesuatu trus ada saja hal2 sepele yg mesti langsung aku jawab.<br />
<span id="more-42"></span><br />
<a href='http://yayak.wordpress.com/2007/05/27/yahoo-messenger-idle-status-by-delphi/yahoo-status-example/' rel='attachment wp-att-43' title='Yahoo! Status Example'><img src='/files/2007/04/ym_status.thumbnail.jpg' alt='Yahoo! Status Example' align="left" width="92" height="230" /></a><br />
Menggunakan Delphi, aku pengen membuat program yg bisa mengontrol status YM. Dari riset barulah aku ketahui klo ternyata setting-setting dari YM disimpan dalam registry. Misal ketika aku mengubah nilai2 di <em>HKEY_CURRENT_USER \Software\Yahoo\pager\profiles\[IDYahoo!]\Custom Msgs</em> ternyata itu mengubah juga list di custom messages ku. Tetapi untuk mengaktifkan custom message yg diubah melalui registry itu masih harus dipilih/ click dari menu di YM sendiri. Pengaktifan itu bisa diakali dengan memanfaatkan Windows API. Akhirnya, aku membuat aplikasi berikut ini.</p>
<p></p>
<pre class="brush: delphi;">
procedure TForm1.FormActivate(Sender: TObject);
begin
  Reg := TRegistry.Create;
  try
    Reg.RootKey := HKEY_CURRENT_USER;
    if Reg.OpenKey('\\Software\\Yahoo\\pager', False) then begin
      Edit1.Text := Reg.ReadString('Yahoo! User ID');
    end;
  finally
    Reg.CloseKey;
    Reg.Free;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Reg := TRegistry.Create;
  try
    Reg.RootKey := HKEY_CURRENT_USER;
    if Reg.OpenKey(
        '\\Software\\Yahoo\\pager\\profiles\\'+Edit1.Text+'\\Custom Msgs',
        False) then begin
       Reg.WriteString('5', Edit2.Text+chr($02)+chr($03));    // see *1
      Reg.WriteInteger('5_DND', 0);    // see *2
    end;
  finally
    Reg.CloseKey;
    Reg.Free;
  end;
  PostMessage(FindWindow('YahooBuddyMain', nil), WM_COMMAND, 392, 0);// see *3
end;
</pre>
<p><strong>Penjelasan</strong></p>
<ol>
<li>Tambahkan dengan ASCII 2 + ASCII 3 setelah string message untuk membuatnya tampak idle.</li>
<li>Beri nilai integer 1 jika menginginkan sekalian tampil icon busy, atau integer 0 jika tampil normal.</li>
<li>Nilai 392 sepenuhnya didapat dari eksperimen. Untuk nilai-nilai laen liat referensi dibawah.</li>
</ol>
<p><strong>WPARAM Value</strong><br />
Nilai <strong>WM_COMMAND</strong> untuk <em>YahooBuddyMain</em> untuk ganti status, value WParam-nya adalah sebagai berikut:</p>
<pre>
====================
376 : Available[N]
---
377 : Be Right Back[B]
378 : Busy[B]
379 : Not at Home[B] - Hidden
380 : Not at My Desk[B]
381 : Not in the Office[B] - Hidden
382 : On the Phone[B]
383 : On Vacation[B] - Hidden
384 : Out To Lunch[B] - Hidden
385 : Stepped Out[B]
---
388 : custom_mesg_1
389 : custom_mesg_2
390 : custom_mesg_3
391 : custom_mesg_4
392 : custom_mesg_5
</pre>
<pre class="brush: delphi;">
//penggunaan pada script-nya:
PostMessage(
    FindWindow('YahooBuddyMain', nil),
    WM_COMMAND,
    WParam(int), 0);
</pre>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/yayak.wordpress.com/42/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/yayak.wordpress.com/42/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/yayak.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/yayak.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/yayak.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/yayak.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/yayak.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/yayak.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/yayak.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/yayak.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/yayak.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/yayak.wordpress.com/42/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yayak.wordpress.com&blog=33121&post=42&subd=yayak&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://yayak.wordpress.com/2007/05/27/yahoo-messenger-idle-status-by-delphi/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f6f4df5aafc6552ad63b84cd85ce994c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yayak</media:title>
		</media:content>

		<media:content url="/files/2007/04/ym_status.thumbnail.jpg" medium="image">
			<media:title type="html">Yahoo! Status Example</media:title>
		</media:content>
	</item>
		<item>
		<title>Excel to Delphi to MySQL db</title>
		<link>http://yayak.wordpress.com/2007/04/17/excel-to-delphi-to-mysql-db/</link>
		<comments>http://yayak.wordpress.com/2007/04/17/excel-to-delphi-to-mysql-db/#comments</comments>
		<pubDate>Tue, 17 Apr 2007 11:15:59 +0000</pubDate>
		<dc:creator>yayak</dc:creator>
				<category><![CDATA[Delphi]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://yayak.wordpress.com/2007/04/17/excel-to-delphi-to-mysql-db/</guid>
		<description><![CDATA[It&#8217;s long time since I used Delphi, but recently I&#8217;ve got the chance to do that 
Began from the asking how the way Delphi accesses excel file, then eventually I tried to make it.

Not too bad, as starting from internet I got reference directly from microsoft site, but the example only shows how to automate [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yayak.wordpress.com&blog=33121&post=41&subd=yayak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>It&#8217;s long time since I used Delphi, but recently I&#8217;ve got the chance to do that <img src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/3.gif" width="18" height="18" border="0"><br />
Began from the asking how the way Delphi accesses excel file, then eventually I tried to make it.<br />
<span id="more-41"></span><br />
Not too bad, as starting from internet I got reference directly from microsoft site, but the example only shows <a href="http://support.microsoft.com/kb/231614/EN-US/">how to automate excel to create a new workbook</a>, whereas I need the inverse, which is slow to find the examples <img src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/2.gif" width="18" height="18" border="0"></p>
<p>Finally, from that example and knowledges I&#8217;ve had, and partially any similar examples from internet I collected, I started to type the inverse from that example.<br />
Below is the script I made as function form. That function will give back the result to <code>TStringGrid</code>, but ofcourse can be modified as needed. I used <em>Borland Delphi 6.0</em> and have <em>Microsoft Excel 2003</em> installed at my computer.</p>
<pre class="brush: delphi;">
function GiveRowHeader(x: Integer): String;
begin
  if(x &gt; 26) then Result := GiveRowHeader(x div 26) + GiveRowHeader(x mod 26)
  else Result := Chr( Ord( 'A' ) + x - 1 );
end;

procedure LoadFromXLFile(AFileName: String; ASheetNum: Integer;
        AStringGrid: TStringGrid; var OSheetName: String);
var
  ARow, ACol: Integer;
  i, j: Integer;
  XLApp, XLBook, XLSheet: Variant;
begin
  // Create OLE Object to Excel Application
  XLApp := CreateOleObject('Excel.Application');
  // Hide the Excel
  XLApp.Visible := False;
  // Open file
  XLApp.Workbooks.Open(AFileName,
                       EmptyParam, //UpdateLinks: OleVariant
                       EmptyParam, //ReadOnly: OleVariant
                       EmptyParam, //Format: OleVariant
                       EmptyParam, //Password: OleVariant
                       EmptyParam, //WriteResPassword: OleVariant
                       EmptyParam, //IgnoreReadOnlyRecommended: OleVariant
                       EmptyParam, //Orign: OleVariant
                       EmptyParam, //Delimiter: OleVariant
                       EmptyParam, //Editable: OleVariant
                       EmptyParam, //Notify: OleVariant
                       EmptyParam, //Converter: OleVariant
                       EmptyParam, //AddToMru: OleVariant
                       0
                       );
  XLBook := XLApp.ActiveWorkbook;
  XLSheet := XLBook.WorkSheets[ASheetNum];
  XLSheet.Activate;
  XLSheet.Cells.SpecialCells(xlCellTypeLastCell, EmptyParam).Activate;
  OSheetName := XLSheet.Name;
  // Get last row value
  ARow := XLApp.ActiveCell.Row;
  AStringGrid.RowCount := ARow + 1;
  // Get rightmost column value
  ACol := XLApp.ActiveCell.Column;
  AStringGrid.ColCount := ACol + 1;

  // Doing something with the content <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />
  for i := 1 to ARow do
  begin
    AStringGrid.Cells[0, i] := IntToStr(i);
    for j := 1 to ACol do
    begin
      AStringGrid.Cells[j, 0] := GiveRowHeader(j);
      AStringGrid.Cells[j, i] := XLSheet.Cells[i, j];
    end;
  end;

  // Then exit the Excel if done
  if not VarIsEmpty(XLApp) then
  begin
    XLApp.DisplayAlerts := False;  // disable any alert from the Excel
    XLApp.Quit;                    // now quit
    XLApp := Unassigned;           // then unassign all OLE Object has been created
    XLBook := Unassigned;
    XLSheet := Unassigned;
  end;
end;
</pre>
<p>Remember to add <code>Excel2000</code> in uses, since <code>xlCellTypeLastCell</code> is defined inside that unit.</p>
<pre class="brush: delphi;">
uses Excel2000;
</pre>
<p>Successfully wrote down that function, this is not enough if we don&#8217;t give export functionality to my new application I&#8217;ve just made. Neither to export just to plain text file, I decided to add it export to MySQL db functionality&#8230; <img src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/10.gif" width="18" height="18" border="0"></p>
<p>So, below I added for that purpose, which action is run when <code>Button3</code> is clicked. In addition I used <code>Memo1</code> for log progress status.</p>
<pre class="brush: delphi;">
procedure TForm1.Button3Click(Sender: TObject);
var StrSQL, TableName: String;
    RetVal, ARow, ACol: Integer;
begin
  Memo1.Clear;
  // Try to connect to MySQL Server
  mysql_connect(@mysqlrec, PChar('localhost'), PChar('username'), PChar('password'));
  if mysqlrec._net.last_errno = 0 then
  begin
    Memo1.Lines.Add('STATUS: Successfully connected to MySQL Server');
    Connected := 1;
  end
  else
    Memo1.Lines.Add('ERROR: ' + Trim(mysqlrec._net.last_error) +
            ' [Kode: '+IntToStr(mysqlrec._net.last_errno)+']');
  // Try to attach to the database, create if not exists
  mysql_query(@mysqlrec,
    PChar('CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test_nuedcsoft` ' +
            '/*!40100 DEFAULT CHARACTER SET latin1 */;'));
  Memo1.Lines.Add('QUERY: CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test_nuedcsoft` '+
            '/*!40100 DEFAULT CHARACTER SET latin1 */;');
  RetVal := mysql_select_db(@mysqlrec, PChar('test_nuedcsoft'));
  if RetVal &lt;&gt; 0 then
    Memo1.Lines.Add('ERROR: Error attaching to database `test_nuedcsoft` '+
            '[Kode: '+IntToStr(RetVal)+']' )
  else
    Memo1.Lines.Add('STATUS: Successfully attached to database `test_nuedcsoft`');

  TableName := StringReplace(LowerCase(Trim(Edit2.Text)), ' ', '_', [rfReplaceAll]);
  // First make sure to insert from the start, by delete the table
  mysql_query(@mysqlrec, PChar('DROP TABLE IF EXISTS `' + TableName + '`;'));
  Memo1.Lines.Add('QUERY: DROP TABLE IF EXISTS `' + TableName + '`;');
  // Then re-create the table
  StrSQL :=
    'CREATE TABLE `' + TableName + '` (' +
    '`Id` smallint(5) unsigned NOT NULL default ''0'',';
  for ACol := 1 to StringGrid1.ColCount - 1 do
    StrSQL := StrSQL + '`' + LowerCase(GiveRowHeader(ACol)) +
            '` varchar(200) default NULL,';
  StrSQL := StrSQL + 'PRIMARY KEY  (`Id`)' +
    ' ) ENGINE=MyISAM DEFAULT CHARSET=latin1;';
  mysql_query(@mysqlrec, PChar(StrSQL));
  Memo1.Lines.Add('QUERY: '+StrSQL);
  // Start to insert the data
  for ARow := 1 to StringGrid1.RowCount - 1 do
  begin
    StrSQL := 'INSERT INTO `' + TableName + '` (`Id`';
    for ACol := 1 to StringGrid1.ColCount - 1 do
      StrSQL := StrSQL + ',`' + LowerCase(GiveRowHeader(ACol)) + '`';
    StrSQL := StrSQL + ' ) VALUES (' + IntToStr(ARow);
    for ACol := 1 to StringGrid1.ColCount - 1 do
      StrSQL := StrSQL + ',''' + StringGrid1.Cells[ACol, ARow] + '''';
    StrSQL := StrSQL + ');';
    Memo1.Lines.Add('QUERY: '+StrSQL);
    mysql_query(@mysqlrec, PChar(StrSQL));
  end;
  // Disconnected from MySQL Server
  mysql_close(@mysqlrec);
  Memo1.Lines.Add('STATUS: Disconnected from MySQL Server');
  Connected := 0;
end;
</pre>
<p>Before, I defined global variables first for that needed above <code>implementation</code> declaration.</p>
<pre class="brush: delphi;">
var
  Form1: TForm1;
  mysqlrec: mysql; //Global mysql struct
  Connected: Integer = 0; //Global var to keep track of whether mysql is connected

implementation

{$R *.dfm}
</pre>
<p>I used <em>Simple MySQL Delphi Connection</em> library for that to be done, so I defined that unit in uses.</p>
<pre class="brush: delphi;">
uses _libmysq;
</pre>
<p>Done! Now my application has <strong>Import from Excel</strong> and <strong>Export to MySQL</strong> ability. <img src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/1.gif" width="18" height="18" border="0"></p>
<p>P.S.:<br />
If you need that project&#8217;s source code, I am willing to email you just for free.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/yayak.wordpress.com/41/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/yayak.wordpress.com/41/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/yayak.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/yayak.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/yayak.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/yayak.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/yayak.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/yayak.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/yayak.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/yayak.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/yayak.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/yayak.wordpress.com/41/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=yayak.wordpress.com&blog=33121&post=41&subd=yayak&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://yayak.wordpress.com/2007/04/17/excel-to-delphi-to-mysql-db/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f6f4df5aafc6552ad63b84cd85ce994c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yayak</media:title>
		</media:content>

		<media:content url="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/3.gif" medium="image" />

		<media:content url="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/2.gif" medium="image" />

		<media:content url="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/10.gif" medium="image" />

		<media:content url="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/1.gif" medium="image" />
	</item>
	</channel>
</rss>