2009年1月24日 星期六

notepad

account aliasing
http://seeseeya.com/node/72
http://www.chunmin.com/archives/85
http://010.idv.tw/ubb/showflat.php?Cat=&Number=3337&Main=3335
http://www.it.com.cn/f/edu/0410/27/40483.htm
http://it.com.cn/f/edu/0411/2/42832.htm
http://tw.myblog.yahoo.com/class2u-com/article?mid=883&prev=931&next=558&l=f&fid=7&sc=1
http://www.josephjiang.com/presentation/Web2.0/slide.htm
http://www.josephjiang.com/presentation/NoPostBack/demo.html
http://bbs.ecstart.com/google_search.php?cx=partner-pub-6598876181620527%3A7jim3afruom&cof=FORID%3A10&ie=big5&q=%AA%ED%B3%E6+%A4%A3%B4%AB%AD%B6

2009年1月22日 星期四

PDA 無法連結至電腦

最近常常出現 連結PDA時,無法連線的問題,通常是在插入別隻PDA後再插入本身的PDA的時候會發生~

解決方法~

問題--又噴了

在ASL.project , 當PDA 按下待機紐時,或是按X 就有機會出現下圖



int bytesRead = handler.EndReceive(ar); 這行~
猜測應該是 在這行timeout了

2009年1月20日 星期二

參考:
(原創) 使用preprocessor directive留住debug code (.NET) (C#)

Abstract
很多人以為debug mode和release mode的差異只是debug mode可以設Breakpoint而已,事實上,搭配preprocessor directive,debug mode另有妙用。

Introduction
preprocessor directive並不是什麼新東西,這在C語言就有的,如有些API在Windows 98和Windows XP不一樣,就得用preprocessor directive,讓不同的平台用不同的API。C#也可使用preprocessor directive,尤其用在debug時,非常方便。

我們常會有debug code,如try catch時,若有exception要顯示錯誤訊息,但真正發布產品時,則不希望顯示錯誤訊息,所以希望能留住debug code,以便日後debug,若用//或/* */的方式將debug code暫時當註解,常常遇到產品真正發布時,忘了將debug code拿掉的窘境,事實上,當使用debug mode時,C#自動定義了

2009年1月19日 星期一

實驗用資料-區域設定座標資料

-------------Console.WriteLine("結束抓資料庫"); ------------

//point in polygon test----仁愛醫院1
/*Point point1 = new Point(25.036922, 121.544865);
Point point2 = new Point(25.036961, 121.544613);
Point point3 = new Point(25.036966, 121.544403);
Point point4 = new Point(25.037306, 121.544452);
Point point5 = new Point(25.037277, 121.544661);*/
//point in polygon test----中原噴水池-活動中心區
/*Point point1 = new Point(24.959268, 121.240246);
Point point2 = new Point(24.959312, 121.241593);
Point point3 = new Point(24.957673, 121.241587);
Point point4 = new Point(24.957216, 121.241646);
Point point5 = new Point(24.956812, 121.241303);
Point point6 = new Point(24.957581, 121.239962);*/

//point in polygon test----仁愛醫院2
/*Point point1 = new Point(25.037647, 121.544462);
Point point2 = new Point(25.037715, 121.545128);
Point point3 = new Point(25.036879, 121.545128);
Point point4 = new Point(25.036888, 121.544398);
Point point5 = new Point(25.037379, 121.544420);*/

//point in polygon test----中原門口騎機車模式
/*Point point1 = new Point(24.957449, 121.240037);
Point point2 = new Point(24.957522, 121.240509);
Point point3 = new Point(24.956997, 121.240810);
Point point4 = new Point(24.956803, 121.240525);
Point point5 = new Point(24.956880, 121.240193);
Point point6 = new Point(24.957245, 121.239983);*/


//point in polygon test----測試範圍為整個板橋市
/*Point point1 = new Point(25.086843, 121.309662);
Point point2 = new Point(25.093061, 121.522522);
Point point3 = new Point(25.027128, 121.559601);
Point point4 = new Point(24.928785, 121.592560);
Point point5 = new Point(24.913840, 121.404419);
Point point6 = new Point(25.003484, 121.280823);*/


//point in polygon test----公車模式區域1-板橋新公車站
/*Point point1 = new Point(25.014538, 121.463020);
Point point2 = new Point(25.015423, 121.461582);
Point point3 = new Point(25.016823, 121.461647);
Point point4 = new Point(25.017348, 121.462955);
Point point5 = new Point(25.016425, 121.464361);
Point point6 = new Point(25.015200, 121.464318);

//point in polygon test----公車模式區域2-大漢橋
Point point7 = new Point(25.039649, 121.457119);
Point point8 = new Point(25.040777, 121.462784);
Point point9 = new Point(25.037705, 121.465230);
Point point10 = new Point(25.033311, 121.466818);
Point point11 = new Point(25.031639, 121.460509);
Point point12 = new Point(25.035955, 121.456518);

//point in polygon test----公車模式區域3-五權路口
Point point13 = new Point(25.069827, 121.449620);
Point point14 = new Point(25.069944, 121.451572);
Point point15 = new Point(25.068584, 121.452549);
Point point16 = new Point(25.068020, 121.453149);
Point point17 = new Point(25.067437, 121.451776);
Point point18 = new Point(25.068826, 121.449512);*/
//-------------------------------------------------
//我的中原
string getgps0 = querycontent.Split(';')[0];
string getgps1 = querycontent.Split(';')[1];
string getgps2 = querycontent.Split(';')[2];
string getgps3 = querycontent.Split(';')[3];
string getgps4 = querycontent.Split(';')[4];
string getgps5 = querycontent.Split(';')[5];
Point point1 = new Point(double.Parse(getgps0.Split(',')[0]), double.Parse(getgps0.Split(',')[1]));
Point point2 = new Point(double.Parse(getgps1.Split(',')[0]), double.Parse(getgps1.Split(',')[1]));
Point point3 = new Point(double.Parse(getgps2.Split(',')[0]), double.Parse(getgps2.Split(',')[1]));
Point point4 = new Point(double.Parse(getgps3.Split(',')[0]), double.Parse(getgps3.Split(',')[1]));
Point point5 = new Point(double.Parse(getgps4.Split(',')[0]), double.Parse(getgps4.Split(',')[1]));
Point point6 = new Point(double.Parse(getgps5.Split(',')[0]), double.Parse(getgps5.Split(',')[1]));

/*
Point point1 = new Point(double.Parse(querycontent.Split(';')[0].Split(',')[0]),double.Parse( querycontent.Split(';')[0].Split(',')[1]));
Point point2 = new Point(double.Parse(querycontent.Split(';')[1].Split(',')[0]), double.Parse(querycontent.Split(';')[1].Split(',')[1]));
Point point3 = new Point(double.Parse(querycontent.Split(';')[2].Split(',')[0]), double.Parse(querycontent.Split(';')[2].Split(',')[1]));
Point point4 = new Point(double.Parse(querycontent.Split(';')[3].Split(',')[0]), double.Parse(querycontent.Split(';')[3].Split(',')[1]));
Point point5 = new Point(double.Parse(querycontent.Split(';')[4].Split(',')[0]), double.Parse(querycontent.Split(';')[4].Split(',')[1]));
Point point6 = new Point(double.Parse(querycontent.Split(';')[5].Split(',')[0]), double.Parse(querycontent.Split(';')[5].Split(',')[1]));
*/


// double x1 = double.Parse(querycontent.Split(';')[0].Split(',')[0]);//test用
// double y1 =double.Parse( querycontent.Split(';')[0].Split(',')[1]);//test用

// Console.WriteLine(x1) ;//test 用




/*
//point in polygon test----火車模式區域1-板橋新火車站
Point point1 = new Point(25.015452, 121.462923);
Point point2 = new Point(25.015180, 121.464103);
Point point3 = new Point(25.014257, 121.464640);
Point point4 = new Point(25.013430, 121.463642);
Point point5 = new Point(25.013848, 121.462344);
Point point6 = new Point(25.014888, 121.461926);
*/
//point in polygon test----火車模式區域2-桃園火車站
Point point7 = new Point(24.989919, 121.312044);
Point point8 = new Point(24.990201, 121.314297);
Point point9 = new Point(24.988820, 121.315563);
Point point10 = new Point(24.987925, 121.314726);
Point point11 = new Point(24.988022, 121.313224);
Point point12 = new Point(24.988985, 121.311765);

//point in polygon test----火車模式區域3-中壢火車站
Point point13 = new Point(24.955227, 121.225784);
Point point14 = new Point(24.954507, 121.227951);
Point point15 = new Point(24.953009, 121.228530);
Point point16 = new Point(24.951842, 121.225805);
Point point17 = new Point(24.952737, 121.223853);
Point point18 = new Point(24.955032, 121.224003);

//-------------------------------------------
//區域1
Point[] endPoints = new Point[7];
endPoints[0] = point1;
endPoints[1] = point2;
endPoints[2] = point3;
endPoints[3] = point4;
endPoints[4] = point5;
endPoints[5] = point6;
endPoints[6] = point1;
Polygon myPloygon = new Polygon(endPoints);

//區域2
Point[] endPoints1 = new Point[7];
endPoints1[0] = point7;
endPoints1[1] = point8;
endPoints1[2] = point9;
endPoints1[3] = point10;
endPoints1[4] = point11;
endPoints1[5] = point12;
endPoints1[6] = point7;
Polygon myPloygon1 = new Polygon(endPoints1);

//區域3
Point[] endPoints2 = new Point[7];
endPoints2[0] = point13;
endPoints2[1] = point14;
endPoints2[2] = point15;
endPoints2[3] = point16;
endPoints2[4] = point17;
endPoints2[5] = point18;
endPoints2[6] = point13;
Polygon myPloygon2 = new Polygon(endPoints2);

2009年1月16日 星期五

ThreadPool..::.QueueUserWorkItem 方法 (WaitCallback, Object)

參考 MSDN  http://msdn.microsoft.com/zh-tw/library/4yd16hza.aspx

// This example shows how to create an object containing task

// information, and pass that object to a task queued for
// execution by the thread pool.
using System;
using System.Threading;

// TaskInfo holds state information for a task that will be
// executed by a ThreadPool thread.
public class TaskInfo {
// State information for the task. These members
// can be implemented as read-only properties, read/write
// properties with validation, and so on, as required.
public string Boilerplate;
public int Value;

// Public constructor provides an easy way to supply all
// the information needed for the task.
public TaskInfo(string text, int number) {
Boilerplate = text;
Value = number;
}
}

public class Example {
public static void Main() {
// Create an object containing the information needed
// for the task.
TaskInfo ti = new TaskInfo("This report displays the number {0}.", 42);

// Queue the task and data.
if (ThreadPool.QueueUserWorkItem(new WaitCallback(ThreadProc), ti)) {
Console.WriteLine("Main thread does some work, then sleeps.");

// If you comment out the Sleep, the main thread exits before
// the ThreadPool task has a chance to run. ThreadPool uses
// background threads, which do not keep the application
// running. (This is a simple example of a race condition.)
Thread.Sleep(1000);

Console.WriteLine("Main thread exits.");
}
else {
Console.WriteLine("Unable to queue ThreadPool request.");
}
}

// The thread procedure performs the independent task, in this case
// formatting and printing a very simple report.
//
static void ThreadProc(Object stateInfo) {
TaskInfo ti = (TaskInfo) stateInfo;
Console.WriteLine(ti.Boilerplate, ti.Value);
}
}
///////////////////////
當執行此敘述 if (ThreadPool.QueueUserWorkItem(new WaitCallback(ThreadProc), ti
ti會一起傳送到 ThreadProc(Object stateInfo) 裡面的
stateInfo
因此 在
ThreadProc(Object stateInfo)中 需要轉換 Object 為 TaskInfo 型態再轉存一次

2009年1月12日 星期一

淺談多執行緒

參考

C# 隨性筆記


淺談多執行緒(一) --多執行緒介紹:定義造物件,與啟動

淺談多執行緒(二) --多執行緒共用資料的碰撞問題與LOCK

淺談多執行緒(三) --多執行緒死結deadlock 與使用Monitor.TryEnter方法鎖定

補充:

1.參考MSDN
  • 建立和執行執行緒
  • 執行緒的同步化
  • 執行緒間的互動
  • 使用執行緒集區
  • 使用 Mutex 物件來保護共用的資源
http://msdn.microsoft.com/zh-tw/library/aa288472(VS.71).aspx

2.用於非同步的
ManualResetEvent
http://www.webjx.com/htmldata/2006-08-14/1155517019.html

幾個翻譯網站

zhua niao 抓鳥網(簡) -- web2.0
http://dict.zhuaniao.com/

蝙蝠英語(簡) -- 學習用的沒法英翻中
http://www.binvor.com/

蜂海詞(簡) -- 簡潔啊,還可以serch google, wiki, ...
http://tel.dict.cn/