Thursday, November 11, 2010

ASP Show Update Progress

Just to remind myself: To properly show an UpdateProgress, we need
1. asp:ScriptManager
2. asp:UpdateProgress + asp:UpdatePanel work together

Example like this.http://ajax.net-tutorials.com/controls/updateprogress-control/

Friday, November 5, 2010

SQL Server 2005 Frustration

Yes, MS SQL server takes character cases casually -- 'Everything' = 'eVERYthING'
Yes, MS SQL server are not friendly to empty string -- LEN('') = 1
But this is ridiculous: The following statements returns true.
  • LEN('TEST      ') = 4
  • 'TEST      ' = 'Test'

Tuesday, October 19, 2010

SQL Bulk Insert Environment setting

SET NUMERIC_ROUNDABORT OFF
GO
SET XACT_ABORT, ANSI_PADDING, ANSI_WARNINGS, CONCAT_NULL_YIELDS_NULL, ARITHABORT, QUOTED_IDENTIFIER, ANSI_NULLS, NOCOUNT ON
GO
SET DATEFORMAT YMD
GO

Monday, October 11, 2010

诺贝尔和平奖

上周末听说诺贝尔和平奖发给了刘晓波,开始以为是假新闻。经过一个周末的沉淀,才知道这是真的。去年给奥巴马发奖的时候,我也曾经以为是假新闻,还特地看了下日历是不是愚人节改期了。如此看来,诺贝尔越来越风趣,越来越出人意表了。
一时间国内的报纸鸦雀失声,海外的民运小报喧嚣尘上,山雨欲来风满楼。效果上来说,诺贝尔达到了目的。中国人一向把诺贝尔奖作为一项可望不可及的风向标——不过仅限于科技。但是如今这个和平奖一出,估计诺贝尔将要成为关键词了。
到底和平是什么,和平奖的获奖标准是什么?一百个人大概有一百零一个观点。作为一介升斗小民,我的观点不重要。不过据我揣测,诺贝尔和平奖委员会的标准就是美国政府对于和平和民主的标准。至于获奖者是谁不重要,是不是符合美国利益最重要。

Tuesday, September 21, 2010

How to search for blank cells in SQL

Suppose there are some blank cells  in column [text] of the [table]. How can you find them in SQL2005?
Let's see what are not working.
  • SELECT * FROM [table] WHERE [text] IS NULL
  • SELECT * FROM [table] WHERE [text] = ''
  • SELECT * FROM [table] WHERE LEN([text]) = 0
So what is working.
  • SELECT * FROM [table] WHERE LEN([text]) = 1
This essentially implies that LEN() counts the string null terminator as one character. What a broken definition of string length!

Monday, September 13, 2010

Bloglines is going

Checking out Bloglines every other minute was a major passtime during school. Today, I suddenly found out that the website is going to shut down next month. Another example of nothing last forever (on the internet).

It is very difficult to cultivate user loyalty for a small website. And it is even more difficult to keep up with the trend for a small website. Whatever reason it is, Bloglines will be gone from my life. And I have to migrate my feeds to google reader.

Thursday, September 9, 2010

数学严重退化了

我一时间居然没法完全理解这个证明。 这完全是个退化标志。
Imagine you are stranded on a desert island (without logarithm tables or computers) and--- probably due to an emotional shock---your only concern is to find out which one among numbers πeand eπ is bigger. The solution is: take h(x)=ln(x)/x, take the derivative twice to prove that x=e is a maximum, and that gives eπ is bigger.

Wednesday, September 8, 2010

Thoughts on AU government

Finally, there is an Australian government ("Like I care..."). Gillard becomes the first elected female PM. Labor didn't win the election, but win the peace.
Here are a few thoughts I have during the long-waiting 17 days of "anarchy".
  • Neither Gillard nor Abbott is liked by the majority. But Rudd is definitely disliked by the majority. So there should rather be an election be "non-PM vote", which there is no tie can occur.
  • When there is a tie, why not ask Queen?
  • If Rudd is the PM candidate for Labor, there would not be any problem for Labor to lose the election. Likewise, if Abbott is not the PM candidate for Coalition, there would not be any problem for the Coalition for Coalition to win the election. But the worst scenario just happened. 
  • Australian is still waiting for Obama to visit the land (since last year). If the independent MPs can solve it, that will be great.

Tuesday, September 7, 2010

Monty Hall problem


Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what's behind the doors, opens another door, say No. 3, which has a goat. He then says to you, "Do you want to pick door No. 2?" Is it to your advantage to switch your choice?
(additional assumptions that the car is initially equally likely to be behind each door and that the host must open a door showing a goat, must randomly choose which door to open if both hide goats, and must make the offer to switch.)
Simple Solution: "Switch" yields 2/3 probability of getting a car!

Door 1Door 2Door 3result if switchingresult if staying
CarGoatGoatGoatCar
GoatCarGoatCarGoat
GoatGoatCarCarGoat

Scrum

Scrum is an iterative, incremental framework for project management and agile software development. It becomes very popular recently. MS released a process template for VS 2010. It requires a team foundation server as the platform.The tool itself is pretty cool.
http://visualstudiogallery.msdn.microsoft.com/en-us/59ac03e3-df99-4776-be39-1917cbfc5d8e

Monday, September 6, 2010

Formatting SQL output string

Step 1: Putting a record into a sentence.
You can build a sentence off a row using SELECT. For example,

SELECT [Who] + ' is going to do ' + [Item] + 'on '+ CONVERT(VARCHAR, [due], 105) + '.'
        FROM [Actions]

Step 2: Format the sentence.
When you want to putting line break or even a tab in your output, you may need CHAR function in SQL.
Tabchar(9)
Line feedchar(10)
Carriage returnchar(13)

Details see http://msdn.microsoft.com/en-us/library/ms187323.aspx

Step 3: Form an essay with multiple records.
You may need to use CURSOR to iterate the rows from the result table.
 

Monday, August 30, 2010

You Don't Pay for the Office Gossip

This week, we got two girls from a big insurance company working in our office, sitting right behind our team. On their first day here, I found them annoying -- besides the time they went out for lunch, they were gossiping, giggling during 90% of the office hour. 


I won't buy insurance from this company; like one of the TV ads says "We don't pay for the office gossip".

Thursday, August 26, 2010

悼念在菲律宾遇害的香港同胞

在香港,菲律宾最有名的是——菲佣。现在,菲律宾的无能政府,白痴警察,还有凶残暴徒都有名了。坚决抵制菲律宾。

一个不太应景的顺口溜:
1,美国,想打谁就打谁;
2,英国,美国打谁我打谁;
3,俄罗斯,谁骂我我打谁;
4,日本,谁打我我让美国打谁;
5,朝鲜,谁让我不痛快我就打韩国;
6,韩国,谁打我我和美国一块军演吓唬谁;
7,中国,谁打我我就骂谁(也叫讲政策)

Tuesday, August 3, 2010

"Works for me"

Last Friday, we had a farewell party for one of our officemates. That guy has been working here for many years. Apart from his consulting major, he was also in charge of various IT administration tasks. One of our directors had a farewell speech on the party, saying that
"Whenever I had some IT difficulties and asked him, I got the reply from him: 'it works for me'. Loosely translated, it means 'Screw you'!"

iisapp.vbs

In the Task Manager, you can only find w3wp.exe running per ASP.NET website instance. To find out which process is which website, use a vbscript called iisapp.vbs in command line for IIS 6.0.
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/b8721f32-696b-4439-9140-7061933afa4b.mspx?mfr=true

Thursday, July 29, 2010

Dvorak

I am interested in giving it a go, the programmer’s Dvorak. The best things about it: 1) I can practise my lazy brain; 2) it can serve as a cypher mapping; 3) it sounds geeky and cool. The only bad thing about it: the shortcut keys are not very handy any more.

Instructions on installing and using here:
http://www.kaufmann.no/roland/dvorak/
And a tutorial introducing the layout:
http://gigliwood.com/abcd/

Come, lose and then regain and surpass your productivity with me.

Monday, July 26, 2010

十个著名的思想实验

10.电车难题(The Trolley Problem



“电车难题”要数伦理学领域最为知名的思想实验之一,其内容大致是:一个疯子把五个无辜的人绑在电车轨道上。一辆失控的电车朝他们驶来,并且片刻后就要碾压到他们。幸运的是,你可以拉一个拉杆,让电车开到另一条轨道上。但是还有一个问题,那个疯子在那另一条轨道上也绑了一个人。考虑以上状况,你应该拉拉杆吗?



解读:



电车难题最早是由哲学家Philippa Foot提出的,用来批判伦理哲学中的主要理论,特别是功利主义。功利主义提出的观点是,大部分道德决策都是根据“为最多的人提供最大的利益”的原则做出的。从一个功利主义者的观点来看,明显的选择应该是拉拉杆,拯救五个人只杀死一个人。但是功利主义的批判者认为,一旦拉了拉杆,你就成为一个不道德行为的同谋——你要为另一条轨道上单独的一个人的死负部分责任。然而,其他人认为,你身处这种状况下就要求你要有所作为,你的不作为将会是同等的不道德。总之,不存在完全的道德行为,这就是重点所在。许多哲学家都用电车难题作为例子来表示现实生活中的状况经常强迫一个人违背他自己的道德准则,并且还存在着没有完全道德做法的情况。



9.空地上的奶牛(The Cow in the field



认知论领域的一个最重要的思想实验就是“空地上的奶牛”。它描述的是,一个农民担心自己的获奖的奶牛走丢了。这时送奶工到了农场,他告诉农民不要担心,因为他看到那头奶牛在附件的一块空地上。虽然农民很相信送奶工,但他还是亲自看了看,他看到了熟悉的黑白相间的形状并感到很满意。过了一会,送奶工到那块空地上再次确认。那头奶牛确实在那,但它躲在树林里,而且空地上还有一大张黑白相间的纸缠在树上,很明显,农民把这张纸错当成自己的奶牛了。问题是出现了,虽然奶牛一直都在空地上,但农民说自己知道奶牛在空地上时是否正确?



解读:



空地上的奶牛最初是被Edmund Gettier用来批判主流上作为知识的定义的JTBjustified true belief)理论,即当人们相信一件事时,它就成为了知识;这件事在事实上是真的,并且人们有可以验证的理由相信它。在这个实验中,农民相信奶牛在空地上,且被送奶工的证词和他自己对于空地上的黑白相间物的观察所证实。而且经过送奶工后来的证实,这件事也是真实的。尽管如此,农民并没有真正的知道奶牛在那儿,因为他认为奶牛在那儿的推导是建立在错误的前提上的。Gettier利用这个实验和其他一些例子,解释了将知识定义为JTB的理论需要修正。



8.定时炸弹(The Ticking Time Bomb



如果你关注近几年的政治时事,或者看过动作电影,那么你对于“定时炸弹”思想实验肯定很熟悉。它要求你想象一个炸弹或其他大规模杀伤性武器藏在你的城市中,并且爆炸的倒计时马上就到零了。在羁押中有一个知情者,他知道炸弹的埋藏点。你是否会使用酷刑来获取情报?



解读:



与电车难题类似,定时炸弹情景也是强迫一个人从两个不道德行径中选择的伦理问题。它一般被用作对那些说在任何情况下都不能使用酷刑的反驳。它也被用作在极端形势下法律——就像美国的严禁虐囚的法律——可以被放在第二位的例子。归功于像《24小时》的电视节目和各种政治辩论,定时炸弹情景已成为最常引用的思想实验之一。今年早些时候,一份英国报纸提出了更为极端的看法。这份报纸提议说,如果那个恐怖分子对酷刑毫无反应,那么当局者是否愿意拷打他的妻子儿女来获取情报。



7.爱因斯坦的光线(Einstein’s Light Beam



爱因斯坦著名的狭义相对论是受启于他16岁做的思想实验。在他的自传中,爱因斯坦回忆道他当时幻想在宇宙中追寻一道光线。他推理说,如果他能够以光速在光线旁边运动,那么他应该能够看到光线成为“在空间上不断振荡但停滞不前的电磁场”。对于爱因斯坦,这个思想实验证明了对于这个虚拟的观察者,所有的物理定律应该和一个相对于地球静止的观察者观察到的一样。



解读:



事实上,没人确切知道这意味着什么。科学家一直都在争论一个如此简单的思想实验是如此帮助爱因斯坦完成到狭义相对论这如此巨大的飞跃的。在当时,这个实验中的想法与现在已被抛弃的“以太”理论相违背。但他经过了好多年才证明了自己是正确的。



6.特修斯之船(The Ship of Theseus



最为古老的思想实验之一。最早出自普鲁塔克的记载。它描述的是一艘可以在海上航行几百年的船,归功于不间断的维修和替换部件。只要一块木板腐烂了,它就会被替换掉,以此类推,直到所有的功能部件都不是最开始的那些了。问题是,最终产生的这艘船是否还是原来的那艘特修斯之船,还是一艘完全不同的船?如果不是原来的船,那么在什么时候它不再是原来的船了?哲学家Thomas Hobbes后来对此进来了延伸,如果用特修斯之船上取下来的老部件来重新建造一艘新的船,那么两艘船中哪艘才是真正的特修斯之船?



解读:



对于哲学家,特修斯之船被用来研究身份的本质。特别是讨论一个物体是否仅仅等于其组成部件之和。一个更现代的例子就是一个不断发展的乐队,直到某一阶段乐队成员中没有任何一个原始成员。这个问题可以应用于各个领域。对于企业,在不断并购和更换东家后仍然保持原来的名字。对于人体,人体不间断的进行着新陈代谢和自我修复。这个实验的核心思想在于强迫人们去反思身份仅仅局限在实际物体和现象中这一常识。



5.伽利略的重力实验(Galileo’s Gravity Experiment



为了反驳亚里士多德的自由落体速度取决于物体的质量的理论,伽利略构造了一个简单的思想实验。根据亚里士多德的说法,如果一个轻的物体和一个重的物体绑在一起然后从塔上丢下来,那么重的物体下落的速度快,两个物体之间的绳子会被拉直。这时轻的物体对重物会产生一个阻力,使得下落速度变慢。但是,从另一方面来看,两个物体绑在一起以后的质量应该比任意一个单独的物体都大,那么整个系统下落的速度应该最快。这个矛盾证明了亚里士多德的理论是错误的。



解读:



这个思想实验帮助证明了一个很重要的理论:无论物体的质量,不考虑阻力的情况下,所有物体自由落体的速率都是一样的。



4.猴子和打字机(Monkeys and Typewriters



另一个在流行文化中占了很大分量的思想实验是“无限猴子定理”,也叫做“猴子和打字机”实验。定理的内容是,如果无数多的猴子在无数多的打字机上随机的打字,并持续无限久的时间,那么在某个时候,它们必然会打出莎士比亚的全部著作。猴子和打字机的设想在20世纪初被法国数学家Emile Borel推广,但其基本思想——无数多的人员和无数多的时间能产生任何/所有东西——可以追溯至亚里士多德。



解读:



简单来说,“猴子和打字机”定理是用来描述无限的本质的最好方法之一。人的大脑很难想象无限的空间和无限的时间,无限猴子定理可以帮助理解这些概念可以达到的宽度。猴子能碰巧写出《哈姆雷特》这看上去似乎是违反直觉,但实际上在数学上是可以证明的。这个定理本身在现实生活中是不可能重现的,但这并没有阻止某些人的尝试:2003年,一家英国动物园的科学家们“试验”了无限猴子定理,他们把一台电脑和一个键盘放进灵长类园区。可惜的是,猴子们并没有打出什么十四行诗。根据研究者,它们只打出了5页几乎完全是字母“s”的纸。



3.中文房间(The Chinese Room



“中文房间”最早由美国哲学家John Searle20世纪80年代初提出。这个实验要求你想象一位只说英语的人身处一个房间之中,这间房间除了门上有一个小窗口以外,全部都是封闭的。他随身带着一本写有中文翻译程序的书。房间里还有足够的稿纸、铅笔和橱柜。写着中文的纸片通过小窗口被送入房间中。根据Searle,房间中的人可以使用他的书来翻译这些文字并用中文回复。虽然他完全不会中文,Searle认为通过这个过程,房间里的人可以让任何房间外的人以为他会说流利的中文。



解读:



Searle创造了“中文房间”思想实验来反驳电脑和其他人工智能能够真正思考的观点。房间里的人不会说中文;他不能够用中文思考。但因为他拥有某些特定的工具,他甚至可以让以中文为母语的人以为他能流利的说中文。根据Searle,电脑就是这样工作的。它们无法真正的理解接收到的信息,但它们可以运行一个程序,处理信息,然后给出一个智能的印象。



2.薛定锷的猫(Schrodinger’s Cat



薛定锷的猫最早由物理学家薛定锷提出,是量子力学领域中的一个悖论。其内容是:一只猫、一些放射性元素和一瓶毒气一起被封闭在一个盒子里一个小时。在一个小时内,放射性元素衰变的几率为50%。如果衰变,那么一个连接在盖革计数器上的锤子就会被触发,并打碎瓶子,释放毒气,杀死猫。因为这件事会否发生的概率相等,薛定锷认为在盒子被打开前,盒子中的猫被认为是既死又活的。



解读:



简而言之,这个实验的核心思想是因为事件发生时不存在观察者,盒子里的猫同时存在在其所有可能的状态中(既死又活)。薛定锷最早提出这个实验是在回复一篇讨论量子态叠加的文章时。薛定锷的猫同时也说明了量子力学的理论是多么令人无法理解。这个思想实验因其复杂性而臭名昭著,同时也启发了各种各样的解释。其中最奇异的就属“多重世界”假说,这个假说表示有一只死猫和一只活猫,两只猫存在在不同的宇宙之中,并且永远不会有交集。



1. 缸中的大脑(Brain in a Vat



没有比所谓的“缸中的大脑”假说更有影响力的思想实验了。这个思想实验涵盖了从认知学到哲学到流行文化等各个领域。这个实验的内容是:想象有一个疯狂科学家把你的大脑从你的体内取出,放在某种生命维持液体中。大脑上插着电极,电极连到一台能产生图像和感官信号的电脑上。因为你获取的所有关于这个世界的信息都是通过你的大脑来处理的,这台电脑就有能力模拟你的日常体验。如果这确实可能的话,你要如何来证明你周围的世界是真实的,而不是由一台电脑产生的某种模拟环境?



解读:



如果你觉得这听起来很像《黑客帝国》,那么你说对了。这部电影以及其他一些科幻作品,都是在这个思想实验的影响下创作出来的。这个实验的核心思想是让人们质疑自身经历的本质,并思考作为一个人的真正意义是什么。这个实验的最初原型可以一直追溯至笛卡尔。在他的《Meditations on the First Philosophy》一书中,笛卡尔提出了能否证明他所有的感官体验都是他自己的,而不是由某个“邪恶的魔鬼”产生的这样的疑问。笛卡尔用他的经典名言“我思故我在”来回答这个问题。不幸的是,“缸中的大脑”实验更为复杂,因为连接着电极的大脑仍然可以思考。这个实验被广泛的讨论着,有许多对于此实验前提的反驳,但仍没有人能有力的回应其核心问题:你究竟如何才能知道什么是真实?

Thursday, July 22, 2010

Paste Special in Excel.

Controlling Column Widths in Excel
Ever notice that when you copy data from one worksheet to another, the column widths don't copy correctly? Try this method.
  • Copy the data and paste it into another spreadsheet. Leave the data highlighted. Go to Edit/Paste Special and put a tick mark in the radio button that says Column Widths.
Excel Auto CalculationsTo setup your spreadsheet for more examples, add the numbers 10 through 100 in cells A1:A10 in increments of 10. Shortcut:Note that you can type 10 in cell A1 and 20 in cell A2. Select both cells and use the Fill Handle to drag down to cell A10. Since Excel recognized the series of 10, 20, etc., you should now have 10 through 100 in cells A1 through A10. Remember that you only need to enter enough numbrs for Excel to see the pattern, then select them all and drag with the Fill Handle and Excel will continue the series, ad infinitum.
  • In cell B1, type 100 and hit enter. Now return to cell B1 and copy it. Then highlight cells A1:A10 and go to the Edit menu and choose Paste Special.
  • In the center section of the Paste Special box where it says Operation, put a tick mark in the radio button besideMultiply and click OK.
Excel will multiply all the numbers in A1:A10 by 100 (which you copied from cell B1). Try doing the same thing, but choosing Add, Subtract, or Divide. You will see that this is a very quick way to perform the same, simple mathematics on multiple cells.

Removing an Excel FormulaHere's one to use when you want to keep a value in a cell but remove the formula that produced this value.
  • Add this formula to cell C1: =A1+B1. 
  • Copy it and leave it selected. Go to the Edit menu and choose Paste Special. 
  • This time, put a tick mark in the radio button in the Paste section that says Values and click OK. 
Changing the Data Layout in ExcelThis one is handy to know when you inherit a spreadsheet that someone else made and you want to change the layout of the data quickly.
  • Highlight cells A1:A10 again and copy them. 
  • Now click into cell D1 and go to the Edit menu and choose Paste Special. 
  • This time, put a check in the box at the bottom that says Transpose and click OK.
You'll see that Excel will pasted your values across the columns, instead of down the rows. 
Skip Blanks in an Excel Data SeriesThis is a great one to use when you want to copy new data over old, but don't want to replace existing data in a cells where there is no new data.
  • In cells C5:C9, enter the numbers 10, 20, , 40, ( meaning do not put anything in cells C7 and C9). 
  • Now, in cells D5:D9, enter 50, 60, 70, 80, and 90. 
  • Highlight cells C5:C9 and copy them. Click in cell D5 and go to the Edit menu and choose Paste Special. This time, put a check in the box that says Skip blanks and click OK.
You will see that cells D5:D9 now show 10, 20, 70, 40, 90, because Excel did not paste blank values over existing data. 
Linking Data in Excel
  • Add another simple formula to your spreadsheet (again, two simple numbers and a sum to add them up will do). 
  • Now copy the cell with the formula in it and go to another sheet in the workbook. Click on any blank cell. Go to Edit/Paste Special and click at the button where it says Paste Link.
You will see your number is in the cell and the formula bar shows that it relates to another sheet. 
  • Go back to that sheet and change the SUM formula to an AVERAGE formula. 
  • Return to the sheet where you pasted it and you will see it is updated there also.
Pasting a link means the destination cell will always be updated when you change the original cell. You can also do this between workbooks.

Pasting Web Pages into WordFirst, copy some text from a Web Page and paste it into Word and see if you have problems. If you go to a website, you will see my text is white on a dark background. If you copy white text and paste it into Word, you won't see anything! So, let's look at that Paste Special box:
  • You see that by default, Word wants to copy this text in HTML Format, which would include the white font formatting.
  • Try Paste Special/Unformatted Text. You will get just the text, in whatever default font you have set in Word.
  • Also, sometimes when you copy text from an Email into Word, all of the margins are messed up. Try Paste Special/Unformatted Text for that one too.
Now try copying a picture from a Web Page or from an Email (right click on the graphic and choose Copy). Because graphics come in many formats, you may want to convert yours into a format that is smaller in file size or more compatible with your computer. Often graphics embedded in Emails only allow you to save them as bmp (bitmap) files, which are HUGE. People think they have to go into a graphics program to convert this file to something more manageable. Not true. Try Word's Paste Special:
  • Note that you have various choices for different graphic formats, such as gif, jpeg, and png, which are all smaller and more manageable than bmp files.
  • Try pasting your graphic in different formats and see the different choices you then have for making changes to your graphic. Also, notice the drastic difference in your file size when you make different choices.
Also, notice that Word's Paste Special box has the same Paste Link feature mentioned in the Excel section above. Though it's not always available (depends on what you are pasting and where you are pasting it from), when it's not grayed out you can use it to automatically update whatever you pasted when the original is changed.

Thursday, July 15, 2010

Monitors

When you are used to two monitors, one monitor is certainly not enough. When you are used to three monitors, two monitors seem weird. People are always greedy.
Today I got my two monitors working in the office, after my secondary monitor having sit there for half an year. I can't explain why Dell has a monitor that does not have HDMI port.
After having two monitors, I feel like my production rate climbs to 1.414 times than before.

Monday, July 12, 2010

7/12

90分钟可以解决的战斗,非要拖到120分钟。这个导演有问题。
结束了都结束了。荷兰的拦截再凶狠、罗本再快、斯奈德再冲,都避免不了结束的一刻。既生荷兰何生西班牙。
以貌取人,是不是只有光头的裁判才是好裁判啊。

Sunday, July 11, 2010

7/11

如果没有今晚的决赛,那乌拉圭对德国将是本届世界杯最好看最刺激的比赛。进球最多的德国队和最给人意外的乌拉圭踢了一场真正受人尊敬的比赛。
卡卡梅西C罗鲁尼去汗颜吧,弗兰才是真正的球星。弗格森当年没看走眼,只是缺了点耐心。弗兰有的是球星才有最后一秒扳平球中门楣的悲情一刻。这一刻他和齐达内巴乔一样伟大。
如果德国有这样的意志和激情,或许他们会在决赛中出现。经过一届世界杯,德国新一代的球员和他们的圣保罗一样出名了。

Thursday, July 8, 2010

7/8

别人是三剑客、四重奏,西班牙一上场就是巴萨七小福。
德国人的计划是防守反击。不过打不起闪电战,反击很难。
德国输给了自己的年轻、不自信和马拉多纳魔咒。
西班牙赢在控制、耐心和章鱼保罗的保佑。

Wednesday, July 7, 2010

7/7

没有争议就没有世界杯。争议太多就成了变味的世界杯。
成功的球队踢得是集体防守,有且仅有一个进攻核心。比如荷兰/斯奈德。 夺冠的球队靠得必然是坚固的整体防守,且球队核心必须是超级球星。荷兰符合了后一半。
在FIFA的秩序册上,乌拉圭是一个不错的绿叶;给他们个第四足矣。在赌球集团的生死簿上,乌拉圭的黑马作用大概也就到此为止了。但相比前世界杯得主,从未夺冠的荷兰才应该是黑马啊。

Sunday, July 4, 2010

7/4

才华。没有什么球队比阿根廷更有进攻才华,可今天马拉多纳才场边怀念的是扎内蒂、萨穆埃尔和坎比亚索这样的防守球员。
梅西。在世界杯上他还是没戏。
Klose。离世界杯传奇的总进球纪录已经很close了。
在南非,默克尔比曼德拉、卡梅隆、比尔克林顿要幸福很多。

西班牙在最需要人品的时候,扑出了点球,制造了点球,点球不算,再点球被扑出。人品守恒了。
世界杯四强里,西班牙是新兵。很明显,他们还在找感觉。
某个评论说,西班牙的进球很像Play station游戏里的进球。深感赞同。

P.S.球星拍广告须谨慎。

耐克公司在世界杯期间有一档重金打造的球星广告“Write the Future”,而参与广告录制的球星不是没有来到南非就是提前出局回国。这则广告还诡异地“预测”了这些球星被淘汰的先后顺序,最先出场的小罗压根就没来到南非,接下来相继亮相的分别是卡纳瓦罗、德罗巴和鲁尼,最后一位超级巨星则是被西班牙送回老家的C罗。最近的广告中,播放的是巴西球星罗比尼奥的主题,可是罗比尼奥的巴西又被荷兰淘汰。
此外,百事球星魔咒也应验了,参加百事可乐广告的卡卡、梅西、德罗巴、亨利、兰帕德等球星,也已全部回家。

Saturday, July 3, 2010

7/3

五星巴西踢得有点气急败坏,从第一分钟开始就有点心理失衡。难道是压力?心理障碍?不自信?场外因素?
比起C罗、卡卡、鲁尼、罗比尼奥等一众(耐克)球星,斯奈德更有气定神闲的领袖气质,和扭转乾坤的超群能力。或许2010是斯奈德年。
罗比尼奥和卡卡,1+1没有赢过梅洛的一个助攻一个乌龙和一张红牌。

又见禁区手球,不过这次手球价值连城。
进了淘汰赛而不练点球是不对的。加纳真是经验不足啊。
天时地利人和,没有敌过乌拉圭队狗屎运。

Thursday, July 1, 2010

6/30

Par - Jpn
本届世界杯第一场点球。通常被淘汰的那队比较容易得到同情,但没人想成为那一队。
日本人还是欺软怕硬的。 但对巴拉圭就玩起了防守反击,是不是太妄自菲薄了。

Esp - Por
很明显,西班牙比葡萄牙强。强在教练(豪门冠军教练vs豪门助理教练),强在球星(一群球星vs一个球星),强在战术(巴萨式进攻vsC罗一个人傻冲)。
葡萄牙没了德科组织,就好象西班牙没了……西班牙没了谁都行。
托雷斯啊,被利物浦拖累死了。

小组第一还是现实的。八个小组第一,7个进八强。唯一那个没进的是美国——从英格兰那里抢来的第一。

Tuesday, June 29, 2010

6/29

Ned - Svk
这是一场没有悬念的比赛。裁判是不会让奇迹发生的。

Bra - Chi
这是一场更加没有悬念的比赛。FIFA是不会让票房倒灶的。

所以这两场比赛我都没看。

Monday, June 28, 2010

6/28

英德大战,光名字听起来就让人兴奋。不过看着英格兰人攻得粗糙、守得无效;德国人的青春风暴完全占据了一边倒。
德国进4球,英格兰进一球。从世界杯的第一场比赛开始,这场比赛的比分已经被预言了。
英格兰人或许会说,如果裁判眼神好一点……但其实这个假设应该是,如果他们拿到了小组第一……或者具体一点,如果格林的手套上没有涂油。
英格兰的伪球星们,大块吃肉,大口喝酒,大方泡妞,大脚踢飞。

世界杯上没有Fair Play,因为总有一方多了一个队员叫裁判。
裁判也是人,裁判也会喜欢梅西,不喜欢墨西哥。

Sunday, June 27, 2010

6/27

乌拉圭差点为小富即安的保守付出代价,幸好那个圆月弯刀似的射门来的及时。
韩国似乎看到过胜利的曙光,却在一场倾盆大雨中悄然消逝。
本届世界杯,高卢雄鸡,非洲雄鹰,非洲雄狮都出局了。太极虎出局,至少说明他们不是雌老虎。

打到了加时,胜利和失败就只在一线之间了。
所谓美国精神,就是最后一分钟胜利了是英雄,加时失利了还是英雄。
背负着非洲的大纛,加纳已经不是11个人在战斗。

Saturday, June 26, 2010

6/26

Prk - Civ
3:0的比分,是实力也是命运。

Por - Bra
为了表现出这场不是默契球,大家都很卖力的高抬腿、出手肘。最后结果还是很默契。

Chi - Esp
智利只踢了10分钟好球就歇了,真不思进取啊。西班牙控制了全场,也就慌乱了10分钟。

Sui - Hon
有心杀贼,无力回天。一起被淘汰,到此一游。

Friday, June 25, 2010

6/25

Group E
新西兰出局叫可惜,意大利出局叫活该。
上届世界杯的冠亚军都小组垫底,真有默契。
意大利的锋线还是从前那样的锋线;意大利的方式防守,没有布冯,只有曾经神话现在笑话的卡纳瓦罗。

新西兰一共才只有25名职业足球运动员,本届世界杯还有4名业余球员参加。3战不败,且收获了2个进球。力压意大利排名小组第三。如果我是新西兰人,我会自豪。
知耻而后勇,说得是本场比赛的斯洛伐克,和最后十分钟的意大利。

Group F
日本人用实例生动地告诉我们,排人墙不一定有用。
国米式的防守反击,日本做到了。 丹麦人踢了一个多小时才找到点破绽。
同样是热身赛表现极差,日本调整能力和荣誉感比法国强很多很多。
荷兰,本届世界杯第2个欧籍(非美洲籍)的小组第一。
以喀麦隆为首的非洲球队如流星般的坠落。以日韩为首的亚洲球队皆有进步。

Thursday, June 24, 2010

6/24

Group C
Usa - Alg
美国人从第一分钟到最后一分钟的努力,差点被裁判打败。
补时进球,这样一来美国人又有了好莱坞英雄的素材。

Svn - Eng
英格兰和斯洛文纳尼亚心照不宣地浪费时间。斯洛文尼亚受到了惩罚,英格兰出来混也会还的。
卡佩罗终于想通了,赫斯基这厮不坐板凳,英格兰是赢不了的。

Group D
Ger - Gha
年轻的碰撞,兄弟的对决。攻防转换非常快。双方都有机会,抓住机会的德国胜。
巴拉克肯定很想上场。

Aus - Srb
塞维利亚澳大利亚鹬蚌相争,隔壁的两强出线。
澳大利亚悲壮出局,主教练还没下课,陆克文先下台了。
塞维利亚悲壮出局,免不了怨天怨地怨裁判。

Wednesday, June 23, 2010

6/23

Group A
Fra - Rsa
猜到了法国堕落,却没猜到如此堕落。鄙视。
98冠军,02届小组0分0球淘汰,06亚军。按照这个趋势,法国应该下届季军。
荣誉之战,荣誉尽归南非。

Mex - Uru
乌拉圭打平就能第一,结果力克之。敬佩。

Group B
Arg - Gre
阿根廷很稳定。希腊爆发小宇宙也没办法。
梅西队长, 影响力还不如C罗队长。老马有点拔苗助长了。

Kor - Nga
本届世界杯首个任意球直接破门,韩国制造。虽然他们制造的罗老号……
看看韩国的防守,跟朝鲜真是同胞手足,一脉相承。让人看得心惊肉跳。
尼日利亚人真黑仔,狂轰滥炸,雷声大雨点小,射门不用正脚背。就在眼前的出线机会,挥霍啊挥霍。
打平就能出线,韩国人做到了。

Tuesday, June 22, 2010

6/22

Por - Prk
这场比赛中,伟大领袖金正日没有显灵。
葡萄牙用一场屠城,确定了基本被保送进16强。但是这样欺负足球弱国,实在是不厚道啊。
朝鲜不丢脸,毕竟世界排名相差几十倍。再说了,6700万美元也赚到了啊。

Chi - Sui
怎么又是10打11。怀念当年裁判头光光的年代啊。
在南非,南美球队感受到了主场的气氛。

Esp - Hon
西班牙终于打出了强队的风范——在浪费机会这一项上很强。
居然猜中了比利亚进球。但是没猜中他进两球而且浪费点球。
洪都拉斯好好踢,中超的财神爷在招手。

Monday, June 21, 2010

6/21

Svk - Par
斯洛伐克只有三板斧,巴拉圭踢得很狡猾。
在这一组里,无论结果还是场面,巴拉圭比较像意大利,意大 利很像巴拉圭。

Ita - Nzl
本场比赛证明,Kiwi逼平斯洛伐克不是侥幸。意大利被巴拉圭逼平 不是意外。
评选本届世界杯最让人失望的足球豪强。上届王者意大利目前稳居前三名。
28年前,中国因为一场没有取胜新西兰而被 挡在世界杯门外的比赛,深以为耻。如今, 新西兰的目标已经不是进世界杯了(当中国的目标还是),而是进16强。

Bra - Civ

有人说,巴西露出了冠军相,问题是,巴西那年没露出冠军相?
德罗巴,个人认为是目前世界 上最强的前锋。看来法比亚诺的进球,终于明白为什么日本人在热身赛的时候,未雨绸缪地把魔兽的手给踢断了。

Sunday, June 20, 2010

6/20

Ned - Jpn
日本眼看就要取分成功,结果被斯奈德特攻。
日本应该多上几个大家喜闻乐见的球员。比如Honda, Toyota, Sony, Toshiba……
荷兰目前表现良好,罗本坐在替补席上很惬意。

Gha - Aus
自从被黄健翔“附体”了之后,袋鼠们就一直不怎么走运。(男足失意,女足得意)。让人欣慰的是,他们还很乐观。
加纳的防守稍微有些豆腐渣。
在世界杯上能拿到争议红牌的都是英雄,比如小贝、齐达内、托蒂、科威尔……

Cmr - Den
喀麦隆堕落的有点迅速。或许等埃托奥们退休了,非洲雄狮就进入二流了。
敬告温格,本特纳踢前场组织者,比踢前锋更有威胁。

Saturday, June 19, 2010

6/19

Ger - Srb
冷门的产生需要:一个强队,一个弱队,和一个疑似赌球的裁判。
波多尔斯基的射门,势大力沉,角度刁钻,出脚突然,就是不进,包括点球。
德国人可以怪运气,但不能怪那个“普天同庆”的专用球了。

Svn - Usa
世界杯进行到现在最惊心动魄的比赛。比那些强队踢出的内容丰富。不愧是英格兰所在小组前两名之间的对决。
又是裁判抢了镜头,那微笑,那手势,那果断,很有中国金哨的风范——进去的球吹出来。

Eng - Alg
果然换了门将,詹姆斯爷爷上场。
可怜那些买了机票,订了球票,兴致勃勃跑到南非去碰英格兰场的球迷。两场比赛,只看到两个进球(门将进了一个),球队拿了两分。
英格兰很自豪的宣称,他们比西班牙、法国都强,比意大利也毫不逊色,只是稍逊德国。

Friday, June 18, 2010

6/18

Kor - Arg。
棒子民族真是不走运。北方的碰上了巴西,南方的遇到了阿根廷。都是不好惹的主儿。
比赛中精彩的场面都不进球。进球的都是靠失误靠走运靠越位。
梅西还在沉默。马拉多纳还在装酷。
阿根廷赢得其所,看那些传切带的功夫就能比出高下,韩国一打配合就掉链子,基本功不扎实啊。
很负责的说,阿根廷基本没有防守功能。可怜了国米的两个阿根廷看客啊。
据热心中国网友调查,韩国进球的都是中国人。

Fra - Mex
赛前就预测墨西哥胜。但没想到法国这么不争气。完败。果然打出了中国队在世界杯上的风范。
回家吧法国人。回去卖香水和包包吧。
A组的两大出线热门就同时被斩于马下。

Gre - Nga
以为尼日利亚还很牛,至少人家还是非洲主场。
但希腊还是很犀利的。世界杯上零的突破啊

Thursday, June 17, 2010

6/17

Esp - Sui
超级大冷门。
据说世界杯首场败仗的球队从来没有得到过世界杯。西班牙可以准备打包了。
大家买瑞士夺冠吧,赔率老高了。

Hon - Chi
智利踢得很猛,但是效果不好。不过好歹赢了。

RSA - URU
东道主踢得这么失败,真是少见。真是冷门之夜啊。
不学韩国日本,至少也不要惹裁判啊。这么容易就出红牌,肯定是场外没做好功夫。
弗兰不愧是欧洲最佳射手之一。鹤立鸡群。
没了东道主,希望那个呜呜贼拉可以就此消失了吧,阿门。

Wednesday, June 16, 2010

6/16

Nzl - Svk
连Kiwi都进球了,连Kiwi都拿分了。一向自视很强的Socceroo只有自嘲了。
说实话,新西兰踢得很有气势。值得敬佩。

Civ - Por
无奈的平局。不算坏的结局。至少没让对手领先。
C罗的脾气越来越大了。其实不觉得他比德罗巴强很多。
而葡萄牙比起科特迪瓦,能逼平对方,算是good effort了。

Bra - Prk
举世都在为朝鲜叫好。应了一句话,无知者无畏。
在世界杯上泪奔,这行为艺术一炮而红。
中国人羡慕了。为啥人家的马儿又跑又不吃草呢?
巴西很丑陋。坚决不支持巴西进16强。

Tuesday, June 15, 2010

6/15

Ned - Den
著名的空门帝对阵范佩西。阿森纳帅哥对决。
丹麦场上没有大脑,一群人瞎跑。荷兰场上大脑太多,思路不清晰。
世界杯首个乌龙出现。如果不算英格兰门将的那个。。。

Jap - Cmr
喀麦隆一手的好牌都没法开胡。主教练难辞其咎。
日本踢得绝对不是亚洲足球。喀麦隆还是在踢非洲足球。

Ita - Par
意大利是来走秀的。耍帅无用。
球到了前场,没有像托蒂一样的前腰组织,没有像因扎吉这样的前锋骗点球。想赢球是不可能的。

Monday, June 14, 2010

6/14

Alg - Svn
今年世界杯很无聊,什么阿猫阿狗都来了。几个强队,比如俄罗斯、埃及都没进。早点踢淘汰赛吧,谢谢。

Srb - Gha
还记得曾经有个强队,叫南斯拉夫。可见一个统一的强大的祖国是多么的重要啊。(例外,中国,韩国&朝鲜) 。

Ger - Aus
有个很恶的广告。巴拉克伤了,澳洲人幸灾乐祸开香槟庆祝。比赛前,报纸电视还连篇累牍猜测卡希尔能不能上场。唉,没巴拉克又怎么样,上了卡希尔又怎么样。还不是被像青草一样的割掉,还不是被红牌罚下去。
德国踢得很青春很灿烂啊。
据说本届世界杯的专用球是德国人造的。

Sunday, June 13, 2010

6/13

Kor - Gre
战胜了前欧洲冠军希腊之后,韩国人说,我们是世界强队了。有这样乐观向上的心态是好的。

Arg - Nga
原来以为会是一场精彩的对决。
只有两个字形容,无聊。或者三个字,很没劲。或者四个字,浪费表情。

Usa - Eng
这个世界上先有英格兰还是先有美国,这个已经没什么悬念了。同样没有悬念的是,这个世界上是美国门将强还是英格兰门将强。
这个诡异的守门员脱手,会被后人津津乐道很久很久……and很久。
英格兰那个叫赫斯基的前锋啊。真不理解为啥他这么差,还一直进国家队。

Saturday, June 12, 2010

6/12

Rsa - Mex
东道主以为自己是主场,能赢,结果没这个实力。

Uru - Fra
法国以为自己是强队,能赢,结果没带前锋。

Friday, June 11, 2010

某年的世界杯

最近经常被问到中国队有没有进世界杯(更有甚者,还问我香港队有没有进世界杯)。我说进过一次,2002年。那年中国队被分进了“死亡之组”,小组前两名分别是当届的世界杯冠军和季军。而且,中国最后积分和进球数和当时的卫冕冠军法国队一样——都是完美的Zero。
当然现在中国和法国队的高下已分——前不久,中国的替补阵容客场1:0小胜以全部主力出战的法国队。 中国没有进世界杯决赛圈,跟法国队的唯一区别是,中国没有用手球进球。

Thursday, June 10, 2010

Three ways to make something invisible on the WebForm

Suppose having a web control called "myContrl". In the code behind, how to make it invisible at run time?
1. myContrl.Visible = false;
2. myContrl.Attributes["style"] = "display:none";
3. myContrl.Height = Unit.Pixel(0);

Monday, June 7, 2010

SQL search

Always wondering if there is an in-depth searching tool within SQL management studio. Today, I heard about this powerful one. Great!
http://www.red-gate.com/products/sql_search/index.htm

Wednesday, June 2, 2010

How to append multiple files into one

Some suggests using the syntax:
for <variablename> in (<directorylisting>) do <command> <variablename>
I use
copy  *.txt  Aggregate.File

Thursday, May 27, 2010

Do not Take Driving Test at Marrickville RTA

Do not take driving test at Marrickville RTA, NSW.
I booked for a test a while ago. Then I check online for test route information. Unfortunately, I found that this RTA has a very bad reputation on some discussion forums. Generally, people who can have an easy pass will fail there, and some one even failed 5 time there before got a pass at another RTA. But I have booked there; so I have to wish myself good luck.
I didn't have a good luck yesterday. Failed because of two minor problems. 1. Didn't have enough observation at cross road. I understand that is my problem for long. I just don't want to shake my head like some drug addicted. When I passed the driving test and got license in Hong Kong (that was a one-shot success, and my driving skill was much much worse), the test officer told me I should improve on that. 2.Speeding. This is really ridiculous. I was constantly driving under 40km/s on a road with limit 60km/s. Yet I was called speeding. And his point is I didn't keep 3-sec distance to the car ahead. Come on, other cars kept on sneaking in my lane as I was slow. If I am driving under 30km/s, I am a hazard on the road and that's the concern.
After this experience, I believe that RTA is a money-making machine. They have been taking millions and millions of fine money from innocent people; and they are charging excessive test fees by just simply fail testers again and again. Better yet, the road is never a safe and convenient place for us.

Tuesday, May 25, 2010

Listening face

Watching Master Chef recently, and found one of the commercials is really hilarious.
Here is the link to the Ad on Youtube.
Here is the subscipt:
I love to multi-task, and I love to listen. And if I have no woman to listen to, I practise my listening face: "I love to listen with power. I love to hear of the problems of your friends. Tell me more…"

Is listening (or listening face) really an essential attribute of a perfect man?

Monday, May 24, 2010

SQL updatet with inner join

SQL update statement doesn't like to include an inner join clause -- although it is doable with a little modification. (Goo it with the keywords.) -- it definitely doesn't like to include an inner join and an aggregate clause at the same time. For example, the following does NOT work.
Update tableA
Set Flag = 1
From tableA
Inner Join tableB on tableA.ID = tableB.ID
Where ...
Group By tableB.ID

In this case, the option left is to use nested select statement.

Friday, May 21, 2010

Finally my Discrete Math class pay off

I am writing a long and complicated stored procedure. Basically it is like
"if A is true, then
  SELECT blabla FROM bla WHERE (B = true)
otherwise,
  SELECT blabla FROM bla WHERE (B = false)"

I don't want to write CASE WHEN; and I don't want to repeat the common SELECT stuff. So this is what I do:
"SELECT blabla FROM bla WHERE (A = false OR B = true)"
 This is because "if X then Y" is logically equivalent to "not X or Y"

刮骨疗毒

话说,关羽手臂被毒箭射~~~中。华佗为其刮骨疗毒。关羽问华佗:“大~~~夫,这次手术的成功性有多大?”华佗说:“我已经做过99次同样的手术了。”关羽道:“那我就放心了。相信你会成功。”华佗道:“谢谢谢谢!我想我也该成功一次了啊!

话说,关羽手臂被毒箭射~~~中。华佗为其刮骨疗毒。关羽突然跑了。刘备见状,问关羽:“你跑什么啊?”关羽道:“刚才华佗的徒弟说‘勇敢点!别害怕!这个手术很容易!’”刘备:“容易你怕什么?”关羽道:“但是这句话是华佗的徒弟说给华佗听的啊,大哥!”

话说,关羽手臂被毒箭射~~~中。华佗为其刮骨疗毒。华佗安慰关羽说:“别怕,一点都不痛的,一会就好……”关羽打断道:“呵呵!别说了,我以前也做过两年郎中的!

话说,关羽手臂被毒箭射~~~中。华佗为其刮骨疗毒。当华佗拿出刀子,关羽害怕了,不让华佗动手。于是,华佗叫人倒了一杯酒给关羽,喝后,问关羽:“有勇气了吗?现在还怕吗?”关羽道:“还有一点怕。”于是,又给关羽喝了一杯。关羽还是害怕。就这样不停的喝了几十杯。华佗又问:“现在是不是勇气十足?”只见关羽昂首挺胸,跳到了桌子上,大声叫道:“我倒要看看,谁xxxx敢动我的手臂!!”

Thursday, May 20, 2010

A test on scheduled SSIS job

I have create an SSIS package that monitors an FTP and imports incoming data sets as flat files to the SQL server. (BTW, importing directly to an SQL destination is much faster than importing through ADO connection.Guess why?) It is deployed as a scheduled job on the server. The problem is: what should be schedule interval -- given that the job should be run as often as possible while the timespan to run an importing is indefinite.

I was afraid that the scheduled job would be pre-empted when a new schedule starts. That would cause a disaster -- 'cause no one knows what will happen when importing is stopped in the middle. So I conduct a test: I create a 2-min importing job, but schedule it as run every 1 minute. The result is: the next schedule will start only when the current one finishes. Mercy.

Wednesday, May 12, 2010

Wednesday, May 5, 2010

Different Options for Importing Data into SQL Server

ProblemMoving data into SQL Server is something that most DBAs or Developers are faced with probably on a daily basis.  One simple way of doing this is by using the Import / Export wizard, but along with this option there are several other ways of loading data into SQL Server tables. Another common technique would be to use either DTS (SQL 2000) or SSIS (SQL 2005).  In this tip we take a look at some of these other options for importing data into SQL Server.
SolutionIn addition to using the Import / Export wizards and/or DTS or SSIS to move data into SQL Server there are also a few other options for doing this that are built into SQL Server.  Some these other options include bcp, BULK INSERT, OPENROWSET as well as others.  The following examples show you some of these different options for importing data and how you can use some of these inline with your T-SQL code as well as others that can be run from the command line.

BCP
This is one of the options that is mostly widely used.  One reason for this is that it has been around for awhile, so DBAs have come quite familiar with this command.  This command allows you to both import and export data, but is primarily used for text data formats.  In addition, this command is generally run from a Windows command prompt, but could also be called from a stored procedure by using xp_cmdshell or called from a DTS or SSIS package.
Here is a simple command for importing data from file C:\ImportData.txt into table dbo.ImportTest.
bcp dbo.ImportTest in 'C:\ImportData.txt' -T -SserverName\instanceName
For more information about bcp click here.

BULK INSERT
This command is a T-SQL command that allows you to import data directly from within SQL Server by using T-SQL.  This command imports data from file C:\ImportData.txt into table dbo.ImportTest.
BULK INSERT dbo.ImportTest 
FROM 'C:\ImportData.txt' 
WITH ( FIELDTERMINATOR =',', FIRSTROW = 2 )
For more information about BULK INSERT click here.

OPENROWSET
This command is a T-SQL command that allows you to query data from other data sources directly from within SQL Server.  By using this command along with an INSERT INTO command we can load data from the specified data source into a SQL Server table.
This command will pull in all data from worksheet [Sheet1$]. By using the INSERT INTO command you can insert the query results into table dbo.ImportTest.
INSERT INTO dbo.ImportTest 
SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 
'Excel 8.0;Database=C:\ImportData.xls', [Sheet1$])
Here is another example where data is pulled from worksheet [Sheet1$] by using a SELECT * FROM command. Again, by using the INSERT INTO command you can insert the query results into table dbo.ImportTest.   The query can be any valid SQL query, so you can filter the columns and rows by using this option.
INSERT INTO dbo.ImportTest 
SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 
'Excel 8.0;Database=C:\ImportData.xls', 'SELECT * FROM [Sheet1$]')
For more information about OPENROWSET click here.

OPENDATASOURCE
This command is a T-SQL command that allows you to query data from other data sources directly from within SQL Server. This is similar to the OPENROWSET command.
INSERT INTO dbo.ImportTest 
SELECT * FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0', 
'Data Source=C:\ImportData.xls;Extended Properties=Excel 8.0')...[Sheet1$]
For more information about OPENDATASOURCE click here.

OPENQUERY
Another option is OPENQUERY.  This is another command that allows you to issue a T-SQL command to select data and again with the INSERT INTO option we can load data into our table.  There are two steps with this process, first a linked server is setup and then second the query is issued using the OPENQUERY command.  This option allow you to filter the columns and rows by the query that is issued against your linked data source.
EXEC sp_addlinkedserver 'ImportData', 
   'Jet 4.0', 'Microsoft.Jet.OLEDB.4.0', 
   'C:\ImportData.xls', 
   NULL, 
   'Excel 8.0' 
GO
INSERT INTO dbo.ImportTest 
SELECT * 
FROM OPENQUERY(ImportData, 'SELECT * FROM [Sheet1$]')
For more information about OPENQUERY click here.

Linked Servers
Here is yet another option with setting up a linked server and then issuing a straight SQL statement against the linked server.  This again has two steps, first the linked server is setup and secondly a SQL command is issued against the linked data source.
EXEC sp_addlinkedserver 'ImportData', 
   'Jet 4.0', 'Microsoft.Jet.OLEDB.4.0', 
   'C:\ImportData.xls', 
   NULL, 
   'Excel 8.0' 
GO
INSERT INTO dbo.ImportTest 
SELECT * FROM ImportData...Sheet1$
For more information about Linked Servers click here.
As you can see right out of the box SQL Server offers many ways of importing data into SQL Server.  Take a look at these different options to see what satisfies your database requirements.

Monday, May 3, 2010

希腊债务问题

世界金融两大市场上,美国在批斗高盛,欧洲在为希腊头疼。其中可能有些联系——高盛可能在希腊的债务危机中扮演了可以的角色。不过话说回来,别人再如何推波助澜也只是因为希腊自己挖了个坑跳进去了而已。
这个坑叫做奥运会。
在2004奥运会财政报告会上,希腊的财长曾很明确表示“The cost of the Athens 2004 Olympic Games substantially overshot the budget”,虽然可以辩称,奥运会是项长远的投资,对将来都是很有益的。但是这确确实实是个大坑。
算笔账。希腊的年收入大约100B,正常的财政支出大概能打个平手。奥运会一来,政府要拿出10B来做建设。这是表面的支出。为了社会的稳定和奥运期间的礼仪安全,需要安定民心。于是就大手一挥,给大家加工资加福利。老百姓一开心,当然就努力工作、安居乐业了。这样一来,政府的支出大了,即使有些赞助,那也还得借债。顺便提一句,希腊的家当也就和台湾一个水平。比台湾还不如的是,希腊主要靠农产品和旅游赚钱,工业和金融比较落后。
一晃几年过去了。这几年恰恰是多灾多难的几年。 债务涨了,投资亏了,出口收入低了,老百姓的福利还没法往下压。希腊终于挺不住了。

Saturday, May 1, 2010

追星族

上个星期从电视上认识了一个人,叫做Justin Bieber (简称JB)。据说是个加拿大的小男生。他唱歌的片段被他妈妈放上youtube,被星探发现,然后就火了。他来澳洲巡回,那些无知无畏的小女生,日夜兼程,昼夜等待就为了见他一面。有几个小姑娘还受伤了。最后警方看不下去了,鉴于纽约发生过类似问题,就决定以安全为由,取消了见面会。让JB去电视台录音棚里露脸了。小女生们一路的抗议啊。
开始还以为我的审美有问题,问了下太太,她觉得JB同学实在长得很普通,没有传说中的那么酷、那么Cute。唱歌么,也就一般,小男孩变声都没完全,怎么可能好听。他的歌也就口水而已,就听到反反复复的“baby baby”,其他好像就没有了。当然,他能红肯定也是有道理的,但凭实力,我觉得比中国的偶像李宇春差着好多截。
JB能这么红,跟小女孩们的心理空虚和头脑简单是分不开的。看看这些年的欧美乐坛,好久都没有一个让少女痴迷的男性偶像歌手出现了。90后乃至00后在追星方面嗷嗷待哺了很久了。所以JB一出现就可以让一张毫无内涵的专辑可以在iTune上卖这么贵。
话分两头,那些无知少女的父母也实在是有问题,自己的女儿品味这么低也就算了。让她们为了追星可以露宿街头真的是过分了。想当年虽然所有的女生都痴迷小虎队,但是大多都非常理智的。果然时代不同观念不同了。