Saturday, January 30, 2010

Aussie slang

Have been in Australia for almost one year. To celebrate, let's catch some Aussie slang.

The first one I learned is "No worries". It is a pretty good one, positive, relaxing, and multi-functional. It can mean "Welcome", "That's fine", "Not at all", "Never mind", etc. Once when a student asked me about his exam result, I replied "No worries".

As for greeting, "G'day" is often used. Actually, it sounds quite funny when it comes with a strong Aussie accent.

Just like "Dude" in US, Aussie has "Mate". So, thank you mate; sorry mate; g'day mate; ... 


Just as I am writing this blog, I heard my neighbor said "At the end of the day, ..." It seems to be quite popular to use this phrase at the work place. But, I really don't like hearing it, 'cause it is really overused and sounds over-confident. We should use "eventually" more. 

At then end of the day, life is much easier with these slangs.

Friday, January 29, 2010

SQL source control

There’s a new product from Red Gate which is in the beta phase, which integrates SVN into Microsoft SQL Server Management Studio 2005/2008 and enables you to easily manage your stored procedures, table definitions, etc. with SVN.

http://www.red-gate.com/products/solutions_for_sql/database_version_control.htm

笑话

一名记者到某大学采访某系所有男生。
记者问第一个男生:“你晚上都干些什么?”答:“上 BBS,吸佳佳!”
记者又问第二个男生,男生答道:“上 BBS,吸佳佳!”
……
记者几 乎问遍所有的男生,得到的答案都是“上 BBS,吸佳佳”。
当要问最后一个男生时,记者抢先答道:“不用你说,你肯定每天都上 BBS,而且你就叫佳佳!”
男生怒道:“去你的,我才不会C++呢!”



富婆去夜总会找乐子,老板娘挑了几个帅小伙,富婆不满意;老板娘又挑了几个壮小伙,富婆还不满意。老板娘问那富婆到底想要什么样的,富婆说要体力好、精力旺、能加班、能熬夜,老板娘一听乐了,张口喊道:“那些搞网站的,都给我出来接客!!!”

Thursday, January 28, 2010

Display scroll bars for IE6

I got a headache today, because IE 6 doesn't like to display a scroll bar when the page is too wide. (To see the effect of IE 6 in IE 8, go to the Tools->Compatibility View Setting).

Fix #1: in your CSS Stylesheet or the in-page style property, declare overflow:auto
Unfortunately, this doesn't work in my case. Guess it is just a makeup change, not powerful enough.

Fix #2: enclose your control (e.g., gridview) into an asp_panel, which has embedded scrollbar option:
< asp:panel height="360px" id="RolesPanel" runat="server" scrollbars="Vertical" width="300px" >
 -- Some controls
< asp:panel >


The above fixes are all about server side. If those don't work ...
Fix #3: Install IE 8
or Forget about IE, use other browsers

New laptop with Win 7

Finally, I got a new laptop with infamous Win7 installed. Two surprises.
1, Dell's laptop is quite stylish, not to compare with my Thinkpad, but with HP's or even Sony's. Although I don't like its keyboard layout and the function key setting, I do appreciate to have less buttons around; it's neat.
2. Win7 doesn't let me down. However, now the OS is 64-bit; heaps of the old software expire. But I found that most of the useful ones stay free. And Win7 do have a bunch of useful gadgets (see tricks and tips below) that save the day.

Win7 tricks and tips:

Software (free):
  • Security: AVG Anti-Virus personal
  • PDF: Foxit Reader (I don't like Acrobat), CutePDF writer
  • Entertainment: iTune (for iphone and ipod), KMPlayer, PPlive
  • Browser: Chrome 4 (with extensions!)
  • Utilities: WinRAR, GlaryUtilities, Smart Defrag, Notepad++, Google Pinyin
Software (licensed): MS Office 2007, Visual Studio Pro 2008.

Wednesday, January 27, 2010

GoGo Chinese Girls @Aus Open

中国金花李娜在落后一盘,并且第二盘第10局一度面临对手发球胜赛局的逆境下,奋力拼搏后以总比分2-6/7-6(4)/7-5 逆转6号种子大威廉姆斯,个人职业生涯首进澳网女单四强

郑洁以6∶1、6∶3横扫基里连科进澳网四强不惧输海宁

Monday, January 25, 2010

SQL server Date/Time Convertion Table


DATE FORMATS
Format #Query (current date: 12/30/2006)Sample
1select convert(varchar, getdate(), 1)12/30/06
2select convert(varchar, getdate(), 2)06.12.30
3select convert(varchar, getdate(), 3)30/12/06
4select convert(varchar, getdate(), 4)30.12.06
5select convert(varchar, getdate(), 5)30-12-06
6select convert(varchar, getdate(), 6)30 Dec 06
7select convert(varchar, getdate(), 7)Dec 30, 06
10select convert(varchar, getdate(), 10)12-30-06
11select convert(varchar, getdate(), 11)06/12/30
101select convert(varchar, getdate(), 101)12/30/2006
102select convert(varchar, getdate(), 102)2006.12.30
103select convert(varchar, getdate(), 103)30/12/2006
104select convert(varchar, getdate(), 104)30.12.2006
105select convert(varchar, getdate(), 105)30-12-2006
106select convert(varchar, getdate(), 106)30 Dec 2006
107select convert(varchar, getdate(), 107)Dec 30, 2006
110select convert(varchar, getdate(), 110)12-30-2006
111select convert(varchar, getdate(), 111)2006/12/30
TIME FORMATS
8 or 108select convert(varchar, getdate(), 8)00:38:54
9 or 109select convert(varchar, getdate(), 9)Dec 30 2006 12:38:54:840AM
14 or 114select convert(varchar, getdate(), 14)00:38:54:840
You can also format the date or time without dividing characters, as well as concatenate the date and time string:
Sample statementOutput
select replace(convert(varchar, getdate(),101),'/','')12302006
select replace(convert(varchar, getdate(),101),'/','') + replace(convert(varchar, getdate(),108),':','')12302006004426

Tuesday, January 19, 2010

《阿凡达》—— 耗时两个半小时的魔兽争霸 WarCraft(zz)

      由于转播信号的问题,转播开始时比赛已经进行了一段时间,
此时HUM的人口为70,而暗夜人口为30,双方英雄:人族山丘(将军)已达到8级,血法(公司老总)只有5级,二英雄加茫茫多的坦克和直升飞机,由于双方出生在远点,所以人族一开始并未TR,暗夜方面,首发的黑暗游侠(奈蒂莉)7级和6级恶魔猎手(苏泰)

双方的战术思想也大相径庭,HUM此时急需扩张来继续扩大优势,但无奈前期侦查太烂
,到这时才派出了小绵羊(杰克)侦查。而暗夜方面并未意识到危险降临,仍然靠打野怪
升级。

就在小绵羊进入暗夜领地的时候,突然被路过的黑暗游侠发现,黑暗游侠正欲射杀小
绵羊,突然暗夜圣母显灵,小绵羊得以保全性命。。。

根据小绵羊**的情报,HUM终于锁定了暗夜的位置,此时小绵羊非常纠结,一方面他
是被女巫变成小绵羊侦查的,马上就要变回真身,另一方面他不知道自己究竟是那边的,
正在这时,黑暗游侠放出6级大招将小绵羊杰克招至麾下,众人表示不解,恶魔猎手甚至几
欲挥刀相向,但是黑暗游侠却一再坚称是圣母旨意,众人只好作罢。

接下来的日子黑暗游侠带着一级的杰克打野,一路上幸运的吃到N本经验书,使其等级
迅速飙升,单挑甚至不弱于恶魔猎手,而此时黑暗游侠的等级也提升到了8级(暂且认为5
级以后打野怪也加经验- -).

就在此时,HUM部队冲向暗夜主矿靠坦克对建筑的高输出直取暗夜生命之树!无奈兵力
差距太大,在损失了20多人口的兵力后只得退守2点方向的分基地。。。此战HUM大获全胜
,山丘之王也飙升至10级!!!!局面对暗夜十分不利。。。

HUM在回家后进行了简单的补给,欲乘胜追击,攻下对手分矿,结束比赛。就在此时,
小绵羊挺身而出!在制服中央泉水处的红龙后,等级达到9级!!他果断回城到达暗夜分矿
,招兵买马爆人口,缩小了双方兵力差距,而恶魔猎手屈从于红龙淫威,不敢造次,只得
听从小绵羊指挥。。。

大战终于到来,双方在暗夜分矿处展开了世纪大战!由于血法被山丘软禁,使得HUM部
队实力略有下降,但是HUM却靠着兵力优势击杀了对方已到7级的DEMON HUNTER!!!但是由于
火力过于集中,使得自己的部队损失过于严重。

但是瘦死的骆驼比马大,HUM小分队在4点钟方向围住了暗夜的黑暗游侠!正当HUM以为
比赛将就此结束时,暗夜派出了她们一直隐藏的第3英雄——兽王!没有人知道兽王什么时
候到达了6级,只见他二话不说放出了6级大招——万兽奔腾!团灭了HUM小分队,也保住了
黑暗游侠的生命。

坐在飞艇上督战的MK,见双方兵力对拼已尽,在飞艇爆炸前立即降落并使用了天神下
凡!而小绵羊由于击杀对方许多兵力,也早已到达10级!双方在分矿处展开了1V2!MK很轻
松地将黑暗游侠杀成了贫血,黑暗游侠为了保命早早退出战场,此时MK与小绵羊的对决成
为了本场比赛的最后决战,MK由于MP不够,一直处于劣势,但他转念一想,把攻击目标转
向了暗夜的最后一个建筑!!这样建筑一旦被打爆,比赛也将结束!!!此时贫血的黑暗
游侠不得不回救!放出了2记黑暗之箭结束了山丘的性命,比赛以暗夜的胜利而告终。。。

Thursday, January 14, 2010

Google Insights for Search

Google Insights for Search is a powerful tool for studying trends in anywhere, for anything,during any time frames.

http://www.google.com/insights/search/#

谷歌离开中国

第一看到这个标题,以为是愚人节提前来了。接着是漫天遍野的新闻,才知道是狼来了。
谷歌说,因为不满中国政府的监察,要撤离中国。好一个一言不合一拍两散。如果不满意,早点为啥不反抗?配合美国政府的声明,把商业的行为上升到政治的高度来。 很有作秀的嫌疑。
谷歌对中国还是很有幻想的。结果仅仅是捧红了李开复,外加注册了个文雅的中文名。业务上,一直被百度压了一头,完全不像网络界的老大。这点跟背后的美国政府的处境倒是有点相像。
如果说微软是一贯的商人,为了利益和市场,就算盗版横行,也愿意委屈求全;那谷歌颇有几分学生气,一贯的理想主义愤世嫉俗。
刚毕业时,觉得谷歌是个好去处。为此还结交了几个谷歌人。现在看来,yajun当年弃谷歌offer,而去msra真是明智之举。

Monday, January 11, 2010

Pivot is really useful in SQL 2005

Suppose I have a table [tblBud] like below and want to get a [budAmount] summary table where rows are [budAcode] and columns are [budMnth]. (Sorry for the bad identifiers, not under my control)

[budID]    [budMnth]    [budAcode]    [budAmount]
1893    2008-09-01 00:00:00.000    A532    2083.33
1894    2008-10-01 00:00:00.000    A532    2083.33
1895    2008-11-01 00:00:00.000    A532    2083.33
1896    2008-12-01 00:00:00.000    A532    2083.33
1897    2008-01-01 00:00:00.000    A533    12500.00
1898    2008-02-01 00:00:00.000    A533    12500.00
1899    2008-03-01 00:00:00.000    A533    12500.00
1900    2008-04-01 00:00:00.000    A533    12500.00
1901    2008-05-01 00:00:00.000    A533    12500.00
1937    2008-05-01 00:00:00.000    A536    15000.00
.......


The solution is to use pivot. (Today I tried it for the first time.)

Essentially there are four steps

-- 1, Set @Year as parameter
DECLARE @Year VARCHAR(5)
SET @Year = '2009'  -- This can be input from outside

DECLARE @range VARCHAR(MAX)
SET @range = ''
DECLARE @query VARCHAR(MAX)
SET @query = ''

-- 2, @range will be used in pivot clause
SELECT @range=@range+'['+ CONVERT(VARCHAR, YEAR(budmnth)*100 + MONTH(budmnth)) +'],' FROM tblbud
WHERE YEAR(budmnth) = @Year
GROUP BY YEAR(budmnth)*100 + MONTH(budmnth)

-- remove the last comma
SET @range =LEFT(@range, LEN(@range)-1)

PRINT @range

--3, Set up @query to be executed
SET @query = '
SELECT *
FROM (
    SELECT BudACode,
    YEAR(BudMnth)*100 + Month(BudMnth) as BudMnth,
    CONVERT(Float,COALESCE(BudAmount,0)) as BudAmount
    FROM tblbud
    ) as row
PIVOT (SUM(budAmount) FOR budMnth IN (' + @range + ')) as col'

PRINT @query

-- 4, Run
EXECUTE (@query)

Saturday, January 9, 2010

Avatar

美国人看到了美国和中东的战争
西班牙人看到了当年殖民军队和墨西哥阿兹特克帝国的故事
环保人士看到了人类破坏环境的后果
中国人看到了钉子户和拆迁队的斗争
魔兽玩家看到了人族和精灵族的武器装备
时尚人士看到了未来潮流的趋势:人体彩绘、情趣内衣。

Monday, January 4, 2010

Copy Data from Excel to SQL Server

Step 1: Create the table (say "tmp") in SQL server
Step 2: Select and copy the field in Excel
Step 3: Open the data table tmp in SQL management studio
Step 4: Click on the top left corner of the tab, (left to the names of the columns), hit Ctrl-V to paste the records or just right click on that tab and select paste.
Done: you can just exit out and it will save the data into the table:

This works if the data amount is not that big. Otherwise try bulk insert which is more convienent.