http://jiunway.spaces.live.com/Blog/cns!2C2EF66DB941A005!656.entry?wa=wsignin1.0&sa=853565730
http://www.west263.com/www/info/67860-1.htm
SNK - http://zh.wikipedia.org/wiki/SNK_Playmore 玩 iPhone 又寫 Windows .NET Program 的人 平時最愛打機同做無聊野
Friday, December 31, 2010
Sunday, December 26, 2010
Friday, December 24, 2010
九個成語解釋的糾正
九個成語解釋的糾正
一.知書達禮:僅知道書本知識是不夠的,還要學會送禮。
二.度日如年:特指當公務員的日子,非常好過,每天都像過年一樣。
三.杯水車薪:形容公務員的工作,每天辦公室喝杯茶,月底可以拿到可以買一輛車的工資。
四.知足常樂:知道有人請自己洗腳,心裡就感到快樂。
五.見異思遷:看見漂亮的異性就想搬到她那裡去住。
六.語重心長:別人話講的重了,心裡懷恨很長時間。
七.有機可乘:出門考察有飛機可以乘坐。
八.不學無術:不要白費工夫學那些不實用的東西。
九.夫唱婦隨:丈夫進了歌廳唱歌,妻子跟著尾隨。
仲有「父慈子孝」
好多人以為「子」就一定要孝
但其實後面仲有講假如「父不慈」, 「子」係不需要「孝」
一.知書達禮:僅知道書本知識是不夠的,還要學會送禮。
二.度日如年:特指當公務員的日子,非常好過,每天都像過年一樣。
三.杯水車薪:形容公務員的工作,每天辦公室喝杯茶,月底可以拿到可以買一輛車的工資。
四.知足常樂:知道有人請自己洗腳,心裡就感到快樂。
五.見異思遷:看見漂亮的異性就想搬到她那裡去住。
六.語重心長:別人話講的重了,心裡懷恨很長時間。
七.有機可乘:出門考察有飛機可以乘坐。
八.不學無術:不要白費工夫學那些不實用的東西。
九.夫唱婦隨:丈夫進了歌廳唱歌,妻子跟著尾隨。
仲有「父慈子孝」
好多人以為「子」就一定要孝
但其實後面仲有講假如「父不慈」, 「子」係不需要「孝」
被中國人誤傳了數千年的七句話
在中國,很多幾千年流傳下來的名言,被人刻意或無知地曲解,背離了原來的意旨。
一:以德報怨
以德報怨,是我們經常聽到的一句話。我們理解為:孔夫子教我們,受別人欺負,要忍,要對他更好,要用愛心去感化他。這情操令人肅然起敬。
但事實上,這是曲解了孔子的原意,原句出於《論語.憲問》:「或曰:『以德報怨,何如?』子曰:『何以報德?以直報怨,以德報德。』」當時的情況 是孔子的一個弟子問他說:「別人打我了,我反而要對他好,用我的德行來感化他,好不好?」孔子說:「你對對你不起的人,報以優厚的待遇;對你有恩的人,你 可以拿什麼來報答呢?別人以德來待你的時候,你才需要以德來回報別人。可是現在別人對你不好,你就應該以直報怨!」「直」是指公平、正確的態度。別人打了 你,你應該避開或報警。
二:民可使由之,不可使知之
「民可使由之,不可使知之。」被後世的統治者解讀為:指使人民去做事就行了,不要讓他們明白他們在做什麼。這是曲解了孔子的原意,原句出於《論語.秦伯》:「子曰:興於詩,立於禮,成於樂。民可,使由之;不可,使知之。」
把句子讀成「民可使由之,不可使知之。」是後人別有用心地斷章取義。從前文來看,孔子是在討論詩禮樂這三種東西的教育問題。結合上下文的語境,孔 子的本意是:詩、禮、樂這三樣東西是教育的基礎,如果人民掌握了詩禮樂,好,讓他們自由發揮,如果人民不理解詩禮樂,就要去教化他們,讓他們知道和明白這 些東西。
三:無毒不丈夫
民間諺語「無毒不丈夫」,好像是說大丈夫必然是惡毒陰損的人。其實這是以訛傳訛,原話是「量小非君子,無度不丈夫。」比如有人頂撞了我,朋友用原 版的好話相勸:「老話說,量小非君子,無度不丈夫,你是大丈夫,就別跟他計較了。」我於是不去計較這種小事;但如果這個朋友說:「這老話怎麼說的?無毒不 丈夫!你是男人,不能退啊!給你刀,去做了他!」效果便大大不同了。
四:唯女子與小人難養也
這段說話被後人誤會孔子歧視婦女。為什麼孔子要說出這樣的話?這話又是對誰說的?在《史記.孔子世家》裡,提到孔子「居衛月餘,靈公與夫人同車, 宦者雍渠參乘出,使孔子為次乘,招搖市過之。孔子曰:『吾未見好德如好色者也。』於是醜之,去衛。」這段話是說,孔子受衛國國君的邀請,來到了衛國,但孔 子其後發現衛靈公和衛夫人是拿他的身份來炫耀自己,並不是真正支持他來教化衛國民眾的。孔夫子感嘆,衛靈公到底是喜歡德才多些,還是喜歡女色多些?孔子就 離開了衛國,離開之後,想起衛夫人和拍馬小人那種仗著得寵,驕橫跋扈的樣子,就感慨:「唯女子與小人難養也!近之則不遜,遠之則怨。」《論語.陽貨》
孔子罵的是那些「被養」的女人和小人,不是泛指一般婦女。就是說一個君主,對那些後宮的女人和沒什麼本事的拍馬小人太親近了,她們就會得意忘形,忘了自己的身份,開始用君主的權力來胡作非為,而疏遠她們吧,她們又會埋怨。
五:吾生也有涯,而知也無涯
這是莊子說的,現代人理解為,這是學習勵志類的明言警句,鼓勵人要以有限的生命,去追求無限的知識。
原句出於《莊子.養生主》:「吾生也有涯,而知也無涯,以有涯隨無涯,殆已。」莊子的原意是:「生命是有限的,而知識是無限的,要以有限的生命,去追求那無限的知識,不是養生之道。」和現代人的理解正好相反。
六:相濡以沫
《莊子.大宗師》講了一個小故事:「泉涸,魚相與處於陸,相呴以濕,相濡以沫,不如相忘於江湖。」他說有一天,泉水乾了,兩條小魚被困在一個小水 窪,為了生存下去,牠們彼此從嘴中吐出泡泡,用自己的濕氣來濕潤對方的身體,互相扶持,互相依賴。現代人通常用「相濡以沫」來表揚那些在困苦中互相扶持的 朋友和夫妻,但忽略了最後一句「不如相忘於江湖。」莊子的原意是:「與其需要相濡以沫才能支撐,為什麼不干脆灑脫地放手,找一條水路,大家開開心心地回到 廣闊的江河湖海,彼此相忘。」套用在性格各異的夫妻身上,就是應把對方放開去,尋找各自的幸福。
七:天地不仁,以萬物為芻狗
《老子.道德經》說:「天地不仁,以萬物為芻狗,聖人不仁,以百姓為芻狗。」憤青說這話的意思是:「天地殘暴不仁,把萬物都當成低賤的豬狗來看 待,而那些高高在上的所謂聖人也是一樣,把老百姓當成豬狗不如的東西!」其實這句話的真正意思是說:「天地不情感用事,對萬物一視同仁,聖人不情感用事, 對百姓一視同仁。」它說的是一個公平的道理,我們所有的人,所有的眾生在天地的眼中,都是平等的。
人不为己,天诛地灭”的哲学内涵就是:万事万物(包括人)都是以“自我”为价值中心,它是一切社会秩序得以形成和发展的前提与基础;相反,如果万事万物不 坚持以“自我”为价值中心,那么一切社会秩序将不复存在。我们应该辩证地理解这个形式简单而内涵深刻的哲学命题,探索其内在的价值机理,而不能简单地、机 械地用“是”或“非”来进行判断。
“人不为己,天诛地灭” 的哲学内涵是说万事万物(包括人)坚持自我是一切秩序的基础。杨子以反命题的形式进行阐释,即如果万事万物不坚持自我,一切秩序将不复存在。这里的秩序包 括自然秩序和社会秩序。我们之所以看到天地有别,多彩绚丽的自然景观、自然秩序,是万事万物“为我”即坚持自己的结果:石头在拚命地“为我”而做石头,大 山在拚命地“为我”而做大山,树木在拚命地“为我”而做树木,小鸟在拚命地“为我”而做小鸟,大像在拚命地“为我”而做大象,泥土在拚命地“为我”而做泥 土,白云在拚命地“为我”而做白云。
句錯既版本聽聞係毛澤東開始講起既
一:以德報怨
以德報怨,是我們經常聽到的一句話。我們理解為:孔夫子教我們,受別人欺負,要忍,要對他更好,要用愛心去感化他。這情操令人肅然起敬。
但事實上,這是曲解了孔子的原意,原句出於《論語.憲問》:「或曰:『以德報怨,何如?』子曰:『何以報德?以直報怨,以德報德。』」當時的情況 是孔子的一個弟子問他說:「別人打我了,我反而要對他好,用我的德行來感化他,好不好?」孔子說:「你對對你不起的人,報以優厚的待遇;對你有恩的人,你 可以拿什麼來報答呢?別人以德來待你的時候,你才需要以德來回報別人。可是現在別人對你不好,你就應該以直報怨!」「直」是指公平、正確的態度。別人打了 你,你應該避開或報警。
二:民可使由之,不可使知之
「民可使由之,不可使知之。」被後世的統治者解讀為:指使人民去做事就行了,不要讓他們明白他們在做什麼。這是曲解了孔子的原意,原句出於《論語.秦伯》:「子曰:興於詩,立於禮,成於樂。民可,使由之;不可,使知之。」
把句子讀成「民可使由之,不可使知之。」是後人別有用心地斷章取義。從前文來看,孔子是在討論詩禮樂這三種東西的教育問題。結合上下文的語境,孔 子的本意是:詩、禮、樂這三樣東西是教育的基礎,如果人民掌握了詩禮樂,好,讓他們自由發揮,如果人民不理解詩禮樂,就要去教化他們,讓他們知道和明白這 些東西。
三:無毒不丈夫
民間諺語「無毒不丈夫」,好像是說大丈夫必然是惡毒陰損的人。其實這是以訛傳訛,原話是「量小非君子,無度不丈夫。」比如有人頂撞了我,朋友用原 版的好話相勸:「老話說,量小非君子,無度不丈夫,你是大丈夫,就別跟他計較了。」我於是不去計較這種小事;但如果這個朋友說:「這老話怎麼說的?無毒不 丈夫!你是男人,不能退啊!給你刀,去做了他!」效果便大大不同了。
四:唯女子與小人難養也
這段說話被後人誤會孔子歧視婦女。為什麼孔子要說出這樣的話?這話又是對誰說的?在《史記.孔子世家》裡,提到孔子「居衛月餘,靈公與夫人同車, 宦者雍渠參乘出,使孔子為次乘,招搖市過之。孔子曰:『吾未見好德如好色者也。』於是醜之,去衛。」這段話是說,孔子受衛國國君的邀請,來到了衛國,但孔 子其後發現衛靈公和衛夫人是拿他的身份來炫耀自己,並不是真正支持他來教化衛國民眾的。孔夫子感嘆,衛靈公到底是喜歡德才多些,還是喜歡女色多些?孔子就 離開了衛國,離開之後,想起衛夫人和拍馬小人那種仗著得寵,驕橫跋扈的樣子,就感慨:「唯女子與小人難養也!近之則不遜,遠之則怨。」《論語.陽貨》
孔子罵的是那些「被養」的女人和小人,不是泛指一般婦女。就是說一個君主,對那些後宮的女人和沒什麼本事的拍馬小人太親近了,她們就會得意忘形,忘了自己的身份,開始用君主的權力來胡作非為,而疏遠她們吧,她們又會埋怨。
五:吾生也有涯,而知也無涯
這是莊子說的,現代人理解為,這是學習勵志類的明言警句,鼓勵人要以有限的生命,去追求無限的知識。
原句出於《莊子.養生主》:「吾生也有涯,而知也無涯,以有涯隨無涯,殆已。」莊子的原意是:「生命是有限的,而知識是無限的,要以有限的生命,去追求那無限的知識,不是養生之道。」和現代人的理解正好相反。
六:相濡以沫
《莊子.大宗師》講了一個小故事:「泉涸,魚相與處於陸,相呴以濕,相濡以沫,不如相忘於江湖。」他說有一天,泉水乾了,兩條小魚被困在一個小水 窪,為了生存下去,牠們彼此從嘴中吐出泡泡,用自己的濕氣來濕潤對方的身體,互相扶持,互相依賴。現代人通常用「相濡以沫」來表揚那些在困苦中互相扶持的 朋友和夫妻,但忽略了最後一句「不如相忘於江湖。」莊子的原意是:「與其需要相濡以沫才能支撐,為什麼不干脆灑脫地放手,找一條水路,大家開開心心地回到 廣闊的江河湖海,彼此相忘。」套用在性格各異的夫妻身上,就是應把對方放開去,尋找各自的幸福。
七:天地不仁,以萬物為芻狗
《老子.道德經》說:「天地不仁,以萬物為芻狗,聖人不仁,以百姓為芻狗。」憤青說這話的意思是:「天地殘暴不仁,把萬物都當成低賤的豬狗來看 待,而那些高高在上的所謂聖人也是一樣,把老百姓當成豬狗不如的東西!」其實這句話的真正意思是說:「天地不情感用事,對萬物一視同仁,聖人不情感用事, 對百姓一視同仁。」它說的是一個公平的道理,我們所有的人,所有的眾生在天地的眼中,都是平等的。
人不为己,天诛地灭”的哲学内涵就是:万事万物(包括人)都是以“自我”为价值中心,它是一切社会秩序得以形成和发展的前提与基础;相反,如果万事万物不 坚持以“自我”为价值中心,那么一切社会秩序将不复存在。我们应该辩证地理解这个形式简单而内涵深刻的哲学命题,探索其内在的价值机理,而不能简单地、机 械地用“是”或“非”来进行判断。
“人不为己,天诛地灭” 的哲学内涵是说万事万物(包括人)坚持自我是一切秩序的基础。杨子以反命题的形式进行阐释,即如果万事万物不坚持自我,一切秩序将不复存在。这里的秩序包 括自然秩序和社会秩序。我们之所以看到天地有别,多彩绚丽的自然景观、自然秩序,是万事万物“为我”即坚持自己的结果:石头在拚命地“为我”而做石头,大 山在拚命地“为我”而做大山,树木在拚命地“为我”而做树木,小鸟在拚命地“为我”而做小鸟,大像在拚命地“为我”而做大象,泥土在拚命地“为我”而做泥 土,白云在拚命地“为我”而做白云。
十、知己知彼,百戰百勝
原句為「知己知彼,百戰不殆」
知道彼此的強弱點,只能令戰鬥時不會處於危險,但不代表可以勝利。
句錯既版本聽聞係毛澤東開始講起既
Sunday, December 19, 2010
.Net Datagridview datasource = datable multi-threading update problem
GUI's Component:
1. datagridview
Controller's Component:
1. Datatable
When GUI's datagridview.datasource = datatable, if you are using another thread to add data into datatable (e.g. dt.rows.Add(datarow), the gui will still try to re-drawn the datagridview even you are not interacting with it.
So, a correct way to insert data into datatable is to make use of delegate and invoke.
1. Declare a delegate first
Private Delegate Sub DatagridViewNewRowDelegate(ByVal sender As Object, ByVal al As String)
2. Check if datagridview needs invoke or not.
If datagridview.InvokeRequired then
Dim DeleDatagridRefresh As DatagridViewNewRowDelegate = New DatagridViewNewRowDelegate(AddressOf your function)
dg.Invoke(DeleDatagridRefresh, sender, "parameter to send")
end if
So, the invoke method will be called in the UI thread that creates the control and the UI won't hang.
This is not the problem of .Net, it is the problem of Win32 API since .Net is just the wrapper of win32 API.
1. datagridview
Controller's Component:
1. Datatable
When GUI's datagridview.datasource = datatable, if you are using another thread to add data into datatable (e.g. dt.rows.Add(datarow), the gui will still try to re-drawn the datagridview even you are not interacting with it.
So, a correct way to insert data into datatable is to make use of delegate and invoke.
1. Declare a delegate first
Private Delegate Sub DatagridViewNewRowDelegate(ByVal sender As Object, ByVal al As String)
2. Check if datagridview needs invoke or not.
If datagridview.InvokeRequired then
Dim DeleDatagridRefresh As DatagridViewNewRowDelegate = New DatagridViewNewRowDelegate(AddressOf your function)
dg.Invoke(DeleDatagridRefresh, sender, "parameter to send")
end if
So, the invoke method will be called in the UI thread that creates the control and the UI won't hang.
This is not the problem of .Net, it is the problem of Win32 API since .Net is just the wrapper of win32 API.
Wednesday, December 08, 2010
Saturday, December 04, 2010
Monday, November 29, 2010
Sunday, October 10, 2010
Jailbreak iPhone 4 iOS 4.1 必裝Apps
Autolock SBSettings (配合 SBSettings 可使iPhone永久長開, 導航時用)
20 Second Lock Screen(將lockscreen光亮延長20秒)
3G Unrestrictor (以3G模擬Wifi連線, 能打Skype電話, 看高清youtube, etc)
5-Row QWERTY (5行的keyboard, 快捷方便, 有多個快捷鍵 )
Appsync 3.X (iTunes安裝破解 ipa)
AttachmentSaver (for Mail)
Backgrounder(exit app後依然可以背景運行, 例如聽收音機)
BiteSMS(可以Forward SMS 及單獨刪除SMS)
Categories(將app 擺入folder減少桌面icon)
Cycorder(iPhone 3G 專用, 拍片)
CyDelete(Springboard直接長按可以Del Package )
Cyntact (Contact list 顯示人像圖片)
Emoji(開啟繪圖文字)
Extended Preferences(增加setting的設定 )
Five/Six icon dock(將dock增至五個或六個)
Flashlight(可以當電筒用 )
FontSwap(轉換字型)
HK Carrier Firmware (顯示台logo)
iacces (中文輸入法包括速成, 倉頡, 筆劃等)
iBlacklist(可以阻擋某些人的sms, phone)
iBlank (可以製造隱形icon, 其實sbsettings已經可以)
iBluetooth (可以透過bluetooh 傳送相, mp3等到其他手機)
iFile (檔案總管, 約選擇 sinfuliphone那個crack版email輸入 ifile@ifile.com 可以破解)
iHome (類似快捷鍵, 可以少用home button )
iMobileCinema(可以在safari看flash影片)
Installous (可以不經iTunes直接下載並安裝 ipa)
iSteamy (18禁... 不要問)
jPhone(能個別刪除電話紀錄分組功能)
Live Time (令時鐘圖案的時針同秒針轉動)
Lock down(裝app上鎖)
Logome(將 boot logo 轉做自己喜歡的圖案)
MemTool( 釋放內存, 讓iphone運行快一點)
MPlayer (可直接播放RMVB/H264/MPEG4/WMV player)
MySMS(可以FW SMS 及單獨刪除SMS)
Offline Map(離線地圖)
Openssh (用winscp必要的程式)
Orbit (1頁過顯示9頁Springboard, 再直接跳到某頁)
Quick Unlock(快速進入homescreen)
Rename(更改apps的名稱)
Rotation Inhibitor(強行設定safari橫屏或直屏)
Safari Download Manager (Safari專用, 配合 iFile 使你完全掌握控制 iPhone 檔案)
SBsettings (必裝, 多個快捷鍵(快速開啟wifi, 3g 等), 隱藏icon)
Sources (加source可以有更多軟件可以下載)
SpringsJumps (跳至springb
20 Second Lock Screen(將lockscreen光亮延長20秒)
3G Unrestrictor (以3G模擬Wifi連線, 能打Skype電話, 看高清youtube, etc)
5-Row QWERTY (5行的keyboard, 快捷方便, 有多個快捷鍵 )
Appsync 3.X (iTunes安裝破解 ipa)
AttachmentSaver (for Mail)
Backgrounder(exit app後依然可以背景運行, 例如聽收音機)
BiteSMS(可以Forward SMS 及單獨刪除SMS)
Categories(將app 擺入folder減少桌面icon)
Cycorder(iPhone 3G 專用, 拍片)
CyDelete(Springboard直接長按可以Del Package )
Cyntact (Contact list 顯示人像圖片)
Emoji(開啟繪圖文字)
Extended Preferences(增加setting的設定 )
Five/Six icon dock(將dock增至五個或六個)
Flashlight(可以當電筒用 )
FontSwap(轉換字型)
HK Carrier Firmware (顯示台logo)
iacces (中文輸入法包括速成, 倉頡, 筆劃等)
iBlacklist(可以阻擋某些人的sms, phone)
iBlank (可以製造隱形icon, 其實sbsettings已經可以)
iBluetooth (可以透過bluetooh 傳送相, mp3等到其他手機)
iFile (檔案總管, 約選擇 sinfuliphone那個crack版email輸入 ifile@ifile.com 可以破解)
iHome (類似快捷鍵, 可以少用home button )
iMobileCinema(可以在safari看flash影片)
Installous (可以不經iTunes直接下載並安裝 ipa)
iSteamy (18禁... 不要問)
jPhone(能個別刪除電話紀錄分組功能)
Live Time (令時鐘圖案的時針同秒針轉動)
Lock down(裝app上鎖)
Logome(將 boot logo 轉做自己喜歡的圖案)
MemTool( 釋放內存, 讓iphone運行快一點)
MPlayer (可直接播放RMVB/H264/MPEG4/WMV player)
MySMS(可以FW SMS 及單獨刪除SMS)
Offline Map(離線地圖)
Openssh (用winscp必要的程式)
Orbit (1頁過顯示9頁Springboard, 再直接跳到某頁)
Quick Unlock(快速進入homescreen)
Rename(更改apps的名稱)
Rotation Inhibitor(強行設定safari橫屏或直屏)
Safari Download Manager (Safari專用, 配合 iFile 使你完全掌握控制 iPhone 檔案)
SBsettings (必裝, 多個快捷鍵(快速開啟wifi, 3g 等), 隱藏icon)
Sources (加source可以有更多軟件可以下載)
SpringsJumps (跳至springb
Thursday, August 26, 2010
用C#在 WinCE 5.0 上新增、修改、刪除、搜尋MySQL上的資料
mySQL Connector for .NET Compact Framework has many bugs. But I found that the following combination can work on WinCE 5.0 with .NET Framework 2.0.
Requirement
1. mySQL Server: 5.1.41
2. mySQL .NET Connector 6.0.6.0 - mysql.data.cf.dll
3. .NET Compact Framework 2.0
4. WinCE 5.0
public class mySQLConnectClass
{
#region Member
private string _pw = "";
private string _user = "user";
private string _database = "";
private string _host = "remotehost";
private string _provider = "";
private MySql.Data.MySqlClient.MySqlConnection myConn = null;
#endregion
#region Properties
public string Password
{
get { return _pw; }
set { _pw = value; }
}
public string User
{
get { return _user; }
set { _user = value; }
}
public string Database
{
get { return _database; }
set { _database = value; }
}
public string Host
{
get { return _host; }
set { _host = value; }
}
public string Provider
{
get { return _provider; }
set { _provider = value; }
}
#endregion
#region Public
public mySQLConnectClass()
{
}
public void Connect()
{
_provider = "Data Source=" + _host + ";Database=" + _database + ";User ID=" + _user + ";Password=" + _pw;
myConn = new MySqlConnection(_provider);
try
{
myConn.Open();
}
catch (Exception ex)
{
throw new Exception(ex.Message.ToString());
}
}
public void Disconnect()
{
string sql = "SELECT name, age FROM table1";
MySqlCommand cmd = new MySqlCommand(sql, myConn);
MySqlDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
Debug.WriteLine(rdr[0] + " -- " + rdr[1]);
}
rdr.Close();
Debug.WriteLine("Close Reader.");
myConn.Close();
myConn.Dispose();
Debug.WriteLine("Close DB.");
//myConn.Close();
}
public bool Ping()
{
return myConn.Ping();
}
#endregion
#region Private
#endregion
#region Event
#endregion
}
Requirement
1. mySQL Server: 5.1.41
2. mySQL .NET Connector 6.0.6.0 - mysql.data.cf.dll
3. .NET Compact Framework 2.0
4. WinCE 5.0
public class mySQLConnectClass
{
#region Member
private string _pw = "";
private string _user = "user";
private string _database = "";
private string _host = "remotehost";
private string _provider = "";
private MySql.Data.MySqlClient.MySqlConnection myConn = null;
#endregion
#region Properties
public string Password
{
get { return _pw; }
set { _pw = value; }
}
public string User
{
get { return _user; }
set { _user = value; }
}
public string Database
{
get { return _database; }
set { _database = value; }
}
public string Host
{
get { return _host; }
set { _host = value; }
}
public string Provider
{
get { return _provider; }
set { _provider = value; }
}
#endregion
#region Public
public mySQLConnectClass()
{
}
public void Connect()
{
_provider = "Data Source=" + _host + ";Database=" + _database + ";User ID=" + _user + ";Password=" + _pw;
myConn = new MySqlConnection(_provider);
try
{
myConn.Open();
}
catch (Exception ex)
{
throw new Exception(ex.Message.ToString());
}
}
public void Disconnect()
{
string sql = "SELECT name, age FROM table1";
MySqlCommand cmd = new MySqlCommand(sql, myConn);
MySqlDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
Debug.WriteLine(rdr[0] + " -- " + rdr[1]);
}
rdr.Close();
Debug.WriteLine("Close Reader.");
myConn.Close();
myConn.Dispose();
Debug.WriteLine("Close DB.");
//myConn.Close();
}
public bool Ping()
{
return myConn.Ping();
}
#endregion
#region Private
#endregion
#region Event
#endregion
}
Saturday, August 21, 2010
人民幣兌港元網站 rmb vs hkd
人民幣兌港元網站 rmb vs hkd / CNY vs HKD
1 HKD = 0.8759 CNY 轉了900 元-----> Rate@0.8711,
http://hkd.cer24.com/cny/chart/?q=30
1 HKD = 0.8759 CNY 轉了900 元-----> Rate@0.8711,
http://hkd.cer24.com/cny/chart/?q=30
Friday, July 30, 2010
Wednesday, July 07, 2010
氣質女當眾更衣變辣妹
內地論壇近日出現一名大膽的「黑絲女」,她在營業中的書店當眾更衣,迅速從身着白長裙的純情氣質女變身黑絲襪、短裙辣妹(圖),速度之快令人咋舌。短片在 網上迅速傳播,有人認為該女子是「校雞」,這是「變裝接客」。
短片開始時拍到書店環境,之後畫面定格在一長髮女子身上,她身穿純白長裙及米色無袖 上衣,低頭專心看書,看起來相當有氣質。不過,書看到一半,她接了一通電話後,把書放回書架上,下一秒,她竟然在書店中換起衣服來。只見她先是將一黑色連 身洋裝穿到白色長裙內,後來脫掉上衣,將洋裝的上半身穿上,露出美背,接着穿上長及大腿的絲襪,換上黑色高跟鞋,背上手袋離開。
鳳凰網
http://hk.apple.nextmedia.com/template/apple/art_main.php?iss_id=20100707&sec_id=15335&art_id=14212671&av_id=14213379
短片開始時拍到書店環境,之後畫面定格在一長髮女子身上,她身穿純白長裙及米色無袖 上衣,低頭專心看書,看起來相當有氣質。不過,書看到一半,她接了一通電話後,把書放回書架上,下一秒,她竟然在書店中換起衣服來。只見她先是將一黑色連 身洋裝穿到白色長裙內,後來脫掉上衣,將洋裝的上半身穿上,露出美背,接着穿上長及大腿的絲襪,換上黑色高跟鞋,背上手袋離開。
鳳凰網
http://hk.apple.nextmedia.com/template/apple/art_main.php?iss_id=20100707&sec_id=15335&art_id=14212671&av_id=14213379
Microsoft Word 2007 Equation/PDF Bug
Bug Description:
If Word 2007 installed with Office 2007 Service Pack 2(SP2) and when you insert equation into word document and save the file as PDF, then you will receive unhandled exception occurred message.
Solution:
1. Save the file to Word 2003 file format
2. Convert the equation to image
If Word 2007 installed with Office 2007 Service Pack 2(SP2) and when you insert equation into word document and save the file as PDF, then you will receive unhandled exception occurred message.
Solution:
1. Save the file to Word 2003 file format
2. Convert the equation to image
Monday, May 03, 2010
Tuesday, April 27, 2010
How to write callbacks (delegate) in C# and .NET
Copy from:
http://www.myelin.co.nz/notes/callbacks/cs-delegates.html
http://msdn.microsoft.com/en-us/library/Bb985784
http://msdn.microsoft.com/en-us/magazine/cc301810.aspx
If you're used to function pointers in C, a delegate is basically a pair of pointers rolled into one:
You define them like this in C#:
http://www.myelin.co.nz/notes/callbacks/cs-delegates.html
http://msdn.microsoft.com/en-us/library/Bb985784
http://msdn.microsoft.com/en-us/magazine/cc301810.aspx
If you're used to function pointers in C, a delegate is basically a pair of pointers rolled into one:
- A pointer to an object (optional)
- A pointer to a method of that object
You define them like this in C#:
public delegate void FooCallbackType( int a, int b, int c );When you want to use them, you make delegate out of the function you want to call:
class CMyClass
{
public void FunctionToCall( int a, int b, int c )
{
// This is the callback
}
public static void Foo()
{
FooCallbackType myDelegate = new FooCallbackType(
this.FunctionToCall );
// Now you can pass that to the function
// that needs to call you back.
}
}If you want to make a delegate to point to a static method, it just looks the same:class CMyClassWithStaticCallback
{
public static void StaticFunctionToCall( int a, int b, int c )
{
// This is the callback
}
public static void Foo()
{
FooCallbackType myDelegate = new FooCallbackType(
CMyClass.StaticFunctionToCall );
}
}All in all, they do the same thing as interface-based callbacks in C++, but cause a bit less trouble because you don't need to worry about naming your functions or making helper objects, and you can make delegates out of any method. They're more flexible.
Monday, April 26, 2010
Solution for WinCE Emulator 5.0 Save State Bug
Solution for WinCE Emulator 5.0 Save State Bug
WinCE 5.0 has a bug that it can't load the saved state.
Solution from http://wincetips.blogspot.com/ :
From: Lewis Williams
Email (Optional): lewisw#tesco.net
Added: 3/10/2007 5:32:12 AM
Message: Connecting the CE 5.0 Emulator to VS2005
1. This uses the network method and saves the emulator state. It does not use activesync, communications ports or a null modem cable.
Start the emulator using a shortcut command that is something like this:
"C:\Program Files\Windows CE 5.0 Emulator\Emulator_500.exe" nk.cem
/video 640x480x16
/Ethernet virtualswitch
/sharedfolder "C:\CE5SharedFolder"
The shared folder appears on the emulator as \My Device\Storage Card. Using the shared folder, copy the following files to the \My Device\Windows\ folder on the emulator. These files are located on the host at \Program Files\Common Files\Microsoft Shared\CoreCon\1.0\Target\wce400\x86, or similar
Clientshutdown.exe
ConmanClient2.exe
CMaccept.exe
eDbgTL.dll
TcpConnectionA.dll
2. Select Emulator -> Start Menu -> run -> \Windows\conmanclient2.exe.
3. Get the IP address of the emulator by double-clicking on the T networking symbol bottom left. If it has no ip address try installing Microsoft Loopback Adapter on the host, check for Virtual Machine Network Services, or other host networking hacks. (This is the difficult bit).
4. To check that the emulator is responding, on the host type Ping at a DOS prompt.
5. To get "Save State" working on the emulator, shut down the emulator using the "Save State" option. Then navigate to Host -> My Documents -> My Virtual Machines
6. The saved state is in the folder that is named with a curly brackets string similar to {06A8A448-EB8B-4E0B-8A88-451412A10C66} say, and known as a GUID. Attempt to rename this folder so that you can highlight and copy the GUID string itself (not the folder).
7. Then add an option, which is similar to /vmid {06A8A448-EB8B-4E0B-8A88-451412A10C66}, to the emulator shortcut command above.
8. The shortcut should now start the emulator from its saved state. It is a good idea to back up the saved state folder.
9. On the host select Visual Studio 2005 -> Tools -> Options -> Device Tools -> Devices
10. Then select Windows CE 5.0 Device -> Properties -> Configure
11. In the "Configure TCP/IP Transport" dialog box, select "Use specific IP address", and then type the emulator IP address you found above.
12. Close the dialog boxes.
13. Select Emulator -> Start -> run -> \Windows\cMaccept.exe and connect to the emulator from VS2005 within three minutes.
14. Run your application from Start Debugging in VS2005 and VS2005 should deploy the two cab files nectcfv2.wce5.x86.cab and system_SR_enu.cab first (this may take some time), and then your application.
15. Close your application in the emulator (I've had trouble using the Stop button on the host).
16. Shut down the emulator using the "Save State" option.
17. You may need to re-run cMaccept each time you restart the emulator or VS2005, but the cab files should not need to deploy again, and the emulator ip address should remain the same.
18. To avoid cMaccept navigate host -> programs -> Microsoft Visual Studio 2005 -> Visual Studio Remote Tools -> Remote Registry Editor
19. In the "Select a Windows Device" dialog box that appears highlight the "Windows CE 5.0 Device" option
20. In the emulator run cMaccept and then immediately click OK in the Remote Registry Editor
21. Highlight Windows CE 5.0 -> HKLM -> System
22. Right click in the right hand pane and select New DWORD value.
23. In the name field type (exactly and without the quotes) "CoreConOverrideSecurity" and set its value to 1
24. Close the editor. Shut down the emulator with Save State.
WinCE 5.0 has a bug that it can't load the saved state.
Solution from http://wincetips.blogspot.com/ :
Connecting the CE 5.0 emulator to VS2005
Title: Connecting the CE 5.0 emulator to VS2005From: Lewis Williams
Email (Optional): lewisw#tesco.net
Added: 3/10/2007 5:32:12 AM
Message: Connecting the CE 5.0 Emulator to VS2005
1. This uses the network method and saves the emulator state. It does not use activesync, communications ports or a null modem cable.
Start the emulator using a shortcut command that is something like this:
"C:\Program Files\Windows CE 5.0 Emulator\Emulator_500.exe" nk.cem
/video 640x480x16
/Ethernet virtualswitch
/sharedfolder "C:\CE5SharedFolder"
The shared folder appears on the emulator as \My Device\Storage Card. Using the shared folder, copy the following files to the \My Device\Windows\ folder on the emulator. These files are located on the host at \Program Files\Common Files\Microsoft Shared\CoreCon\1.0\Target\wce400\x86, or similar
Clientshutdown.exe
ConmanClient2.exe
CMaccept.exe
eDbgTL.dll
TcpConnectionA.dll
2. Select Emulator -> Start Menu -> run -> \Windows\conmanclient2.exe.
3. Get the IP address of the emulator by double-clicking on the T networking symbol bottom left. If it has no ip address try installing Microsoft Loopback Adapter on the host, check for Virtual Machine Network Services, or other host networking hacks. (This is the difficult bit).
4. To check that the emulator is responding, on the host type Ping at a DOS prompt.
5. To get "Save State" working on the emulator, shut down the emulator using the "Save State" option. Then navigate to Host -> My Documents -> My Virtual Machines
6. The saved state is in the folder that is named with a curly brackets string similar to {06A8A448-EB8B-4E0B-8A88-451412A10C66} say, and known as a GUID. Attempt to rename this folder so that you can highlight and copy the GUID string itself (not the folder).
7. Then add an option, which is similar to /vmid {06A8A448-EB8B-4E0B-8A88-451412A10C66}, to the emulator shortcut command above.
8. The shortcut should now start the emulator from its saved state. It is a good idea to back up the saved state folder.
9. On the host select Visual Studio 2005 -> Tools -> Options -> Device Tools -> Devices
10. Then select Windows CE 5.0 Device -> Properties -> Configure
11. In the "Configure TCP/IP Transport" dialog box, select "Use specific IP address", and then type the emulator IP address you found above.
12. Close the dialog boxes.
13. Select Emulator -> Start -> run -> \Windows\cMaccept.exe and connect to the emulator from VS2005 within three minutes.
14. Run your application from Start Debugging in VS2005 and VS2005 should deploy the two cab files nectcfv2.wce5.x86.cab and system_SR_enu.cab first (this may take some time), and then your application.
15. Close your application in the emulator (I've had trouble using the Stop button on the host).
16. Shut down the emulator using the "Save State" option.
17. You may need to re-run cMaccept each time you restart the emulator or VS2005, but the cab files should not need to deploy again, and the emulator ip address should remain the same.
18. To avoid cMaccept navigate host -> programs -> Microsoft Visual Studio 2005 -> Visual Studio Remote Tools -> Remote Registry Editor
19. In the "Select a Windows Device" dialog box that appears highlight the "Windows CE 5.0 Device" option
20. In the emulator run cMaccept and then immediately click OK in the Remote Registry Editor
21. Highlight Windows CE 5.0 -> HKLM -> System
22. Right click in the right hand pane and select New DWORD value.
23. In the name field type (exactly and without the quotes) "CoreConOverrideSecurity" and set its value to 1
24. Close the editor. Shut down the emulator with Save State.
Monday, April 12, 2010
Microsoft NumericUpDown Control Bug - It does not validate max/min/decimal value
Detail:
If you define:
1. max = 10000
2. min = 0
3. decimalplaces=4
If user input 99.00004 and leave focus, the GUI will update the displayed value to 99.0000.
However, if you use numericUpDown.Value property to get the user typed value, you will get 99.00004 instead of 99.0000.
If your program prompts the message saying that user input was wrong, then the user will be confused as the GUI value was correct!!!
The bug was recorded by MS in 2007:
http://support.microsoft.com/?scid=kb%3Ben-us%3B814347&x=7&y=2
The bug was still not fixed in .NET Framework 3.5 (2009):
http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/f45c16a5-8ddd-41e5-a0b8-5bec938ba8d7/
If you define:
1. max = 10000
2. min = 0
3. decimalplaces=4
If user input 99.00004 and leave focus, the GUI will update the displayed value to 99.0000.
However, if you use numericUpDown.Value property to get the user typed value, you will get 99.00004 instead of 99.0000.
If your program prompts the message saying that user input was wrong, then the user will be confused as the GUI value was correct!!!
The bug was recorded by MS in 2007:
http://support.microsoft.com/?scid=kb%3Ben-us%3B814347&x=7&y=2
The bug was still not fixed in .NET Framework 3.5 (2009):
http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/f45c16a5-8ddd-41e5-a0b8-5bec938ba8d7/
Monday, April 05, 2010
微軟的免費午餐 - Microsoft Chart Control for .NET framework 3.5
Sample and Tutorials
http://terudio.blogspot.com/2009/02/microsoft-chart-control-for-not-net.html
http://www.dotblogs.com.tw/chou/archive/2009/10/03/10902.aspx
http://www.dotblogs.com.tw/jeff-yeh/archive/2009/09/24/10760.aspx
Download:
Microsoft Chart Controls Add-on for Microsoft Visual Studio 2008
http://www.microsoft.com/downloads/details.aspx?FamilyId=1D69CE13-E1E5-4315-825C-F14D33A303E9&displaylang=en
Microsoft Chart Controls for Microsoft .NET Framework 3.5
http://www.microsoft.com/downloads/details.aspx?displaylang=zh-tw&FamilyID=130f7986-bf49-4fe5-9ca8-910ae6ea442c
Microsoft Chart Controls for Microsoft .NET Framework 3.5 語言套件
http://www.microsoft.com/downloads/details.aspx?displaylang=zh-tw&FamilyID=581ff4e3-749f-4454-a5e3-de4c463143bd
*Note: Microsoft Chart Controls will be included in .NET Framework 4.0 and Visual Studio 2010
http://terudio.blogspot.com/2009/02/microsoft-chart-control-for-not-net.html
http://www.dotblogs.com.tw/chou/archive/2009/10/03/10902.aspx
http://www.dotblogs.com.tw/jeff-yeh/archive/2009/09/24/10760.aspx
Download:
Microsoft Chart Controls Add-on for Microsoft Visual Studio 2008
http://www.microsoft.com/downloads/details.aspx?FamilyId=1D69CE13-E1E5-4315-825C-F14D33A303E9&displaylang=en
Microsoft Chart Controls for Microsoft .NET Framework 3.5
http://www.microsoft.com/downloads/details.aspx?displaylang=zh-tw&FamilyID=130f7986-bf49-4fe5-9ca8-910ae6ea442c
Microsoft Chart Controls for Microsoft .NET Framework 3.5 語言套件
http://www.microsoft.com/downloads/details.aspx?displaylang=zh-tw&FamilyID=581ff4e3-749f-4454-a5e3-de4c463143bd
*Note: Microsoft Chart Controls will be included in .NET Framework 4.0 and Visual Studio 2010
Monday, March 29, 2010
Visual Studio .NET 2008 Copy file to Windows CE / Windows Mobile 5.0
1. Use Remote File Viewer
2. Use Share Foler
http://www.dotblogs.com.tw/chou/archive/2009/10/26/11286.aspx
3. How to write program for Windows CE under VS.Net 2008:
3.1 Must install Windows CE 5.0/6.0 emulator
2. Use Share Foler
http://www.dotblogs.com.tw/chou/archive/2009/10/26/11286.aspx
3. How to write program for Windows CE under VS.Net 2008:
3.1 Must install Windows CE 5.0/6.0 emulator
Subscribe to:
Posts (Atom)