Neuhaus Chocolate

July 30th, 2009 Phanix

Neuhaus was founded from 1857, and was an Accredited Supplier to the Belgian Crown from 2000. Very sweet and beautiful for the sweet chocolates, and dense flavors for the origines.

Although Neuhaus is not as famous as Godiva in Taiwan, in my opinion, Neuhaus tastes better than Godiva. (Probabaly because their sweet series is really “sweet”, I can not eat many at once)

[C#, .NET] Run a program in tray (minimized window and no-shown in taskbar) with right clicked pop-up menu

July 30th, 2009 Phanix

程式執行後以最小化的方式執行,即不會出現在工作列上,而會出現在tray裡頭。而在 tray icon 上可以點滑鼠右鍵來彈出功能表單(menu),進行各功能選擇(如結束等)。

Read the rest of this entry / 繼續閱讀 »

Meuse (Maas) river at Namur, Belgium

July 24th, 2009 Phanix

Meuse (Maas) river at Namur

BE in BE

July 19th, 2009 Phanix

Yap, I am in Belgium right now, having breakfast and planning the route today.

Read the rest of this entry / 繼續閱讀 »

OMG, the bad traffic

July 17th, 2009 Phanix

I think I am not patient in the traffic jam.

This afternoon, after finishing my proposal this morning, I have to go to Taipei for picking up some official document and attending some short meeting.

This is also my 1st time to take 內湖 line MRT, I think it is not as good as the old 木柵 line. More crowded and noisier. :(

But, that is not the worst thing. The really terrible is on my way back to Hsinchu. I think there is an accident near 南崁 interchange, because there are at least 3 ambulances passing-by. The bus takes almost 1 hour to move from 林口 interchange to 南崁 interchange. *OMG*

That’s longest trip time from Taipei to Hsinchu I have been.

.net 無視窗背景執行的程式

July 15th, 2009 Phanix

有時候為了要偷偷做一些事情, 所以會想要讓程式以無視窗在背景執行, 而要做出這樣的程式其實方法很簡單

  1. 在建立專案的時候選擇「主控台應用程式」(console application)
  2. 設定專案屬性(properties), 將輸出類型改為「windows 應用程式」

這樣就可以了, 當發現到這樣做就搞定的時候還有點訝異怎麼這麼容易…

The recent days after back to TW

July 5th, 2009 Phanix

Just wake up from noon break, I think I have to write down some day-to-day things.

Read the rest of this entry / 繼續閱讀 »

C# 建立ODBC DSN 連線到 SQL Server

July 1st, 2009 Phanix

那個\0很重要。

using System.Runtime.InteropServices;

public bool DoDBConnect(string strDSN,string strUID,string strPWD)
{
	try
	{
		strConn = "DSN=" + strDSN + ";UID=" + strUID + ";PWD=" + strPWD + ";";
		cn = new OdbcConnection(strConn);
		cmd = new OdbcCommand();
		adp = new OdbcDataAdapter();

		cmd.CommandType = CommandType.Text;
		cmd.Connection = cn;
	}
	catch
	{
		return false;
	}

	return true;
}

[
DllImport("ODBCCP32.dll")
]
private static extern bool SQLConfigDataSource(IntPtr hwndParent, int fRequest, string lpszDriver, string lpszAttributes);

public bool CreateODBCDSN(string strDSN, string strServer, string strDB, string strDescription)
{
	string strSQL = "SERVER=" + strServer + "\0";
	strSQL += "DESCRIPTION=" + strDescription + "\0";
	strSQL += "DSN=" + strDSN + "\0";
	strSQL += "DATABASE=" + strDB + "\0";
	strSQL += "trusted_connection=no\0";
	return SQLConfigDataSource((IntPtr)0, 4, "SQL Server", strSQL);
}