http://www.foodincmovie.com/about-the-issues.php
SELECT * FROM Joseph.Thoughts WHERE Topics LIKE 'Pseudo' AND PostDateTime LIKE 'Random' DESC
Wednesday, December 30, 2009
Eat, Dare or Dare Not
http://www.foodincmovie.com/about-the-issues.php
Tuesday, December 29, 2009
C# Tutorial in the nutshell
Tmac: Say Bye to Rocket
麦蒂的故事再次告诉我们,出来混迟早要还的。
Wednesday, December 23, 2009
Copenhagen fairytale
Long long time ago, there was a big ship, on which there were 194 passengers. Unfortunately, no one was the ship captain although some always wanted to be. More unfortunately, the ship was leaking, therefore sinking slowly -- Well, if it was sinking quickly, even the most selfish or the most stupid person would take action. But most unfortunately, the ship was going down so slowly that some passengers chose to ignore that fact and started their bargain.
For some the passengers, for example a passenger called Maldives, it was a life-death issue because his cabinet was about to be taken by the sea. But a significant number of the passengers did not care. They were enjoying the sea view and growing their wealth as long as their cabinets were hardly affected. Among them, two major groups were formed. One group, headed by a passenger called America, owns almost all the luggage on the ship. Let's name them the rich. The other group, the brotherhood of the poor, were leaded by four big and strong guys -- China, India, Brazil, and Southafrica.
The first bargain took place in a cabinet called Japan. The theme was "How to slow down the ship-sinking process". In this bargain, everyone agrees that to prevent the ship from sinking we must throw away some of the luggage. And this was where the fighting began.
The poor pointed out that the rich had a lot to throw, "you have to throw another 40%".
The rich argues that what the poor owns were basically rubbish -- heavy and worthless; "you should throw all your belongings".
The poor replied, "That's OK if you compensate us for that". They asked the rich to contribute 0.5%-1% of their annual earnings, about $3,000 for compensation. What's more, they required the rich to teach the poor a few tips of getting richer.
The rich was angry on seeing such a request. "You must be daydreaming! We have already given you $100 a year. Don’t think of one more cent".
So that basically formed the arguments of the "Kyoto Protocol", which urges the rich to throw away their belongings. It targeted at America in particular, who owns 1/5 of the luggage. America was very unhappy about it, thus declined signing the paper. America came out and shouted, "It is true that I own 1/5 of the luggage, but they are as valuable as 1/4 of the all. Look at that China, she owns 1/5 of the luggage as well, but only values 3% of the total. Her luggage is also growing the fastest!"
China couldn't hide behind the crowd any more. She stood out and talked to her poor cousins, "Brothers and sisters, I have been and will continue fighting on behave of you to seek for more benefit. Don't be afraid of the rich. They will suffer more and lose more from the sinking. Let's unite and fight."
The brotherhood of the poor regained their high momentum. They accused the rich to have broken the ship since 200 years ago. "We've only gotten on the ship for a few days ago while you have sit on it for years. It is you who have worn out the ship. So it’s reasonable for you to spend more to fix it." They were delighted to come up with such a unbeatable argument.
The rich was not going to give in. "We had no idea that the ship would sink one day; and we have carried out repairs everyday. You are still caring about getting rich all the time. If not us, you wouldn't know how to repair it or even noticing it is sinking! You owes us great debt."
In order to end this everlasting, all sat down in the cabinet of Denmark. However, the hope worn out quickly since neither side would like to sacrafice their own wishes. The only outcome was so-called the "Copenhagen Consensus", in which it states "We discovered and admit that, the ship is leaking, and will sink."
So, the passengers were satisfied to see the consensus was reached, which reflected a great effort by all. And, the voyage carries on happily ever after.
Merry Christmas!
Tuesday, December 22, 2009
Workrave
Excellent free occupational-health gadget, a must-install for office workers.
More detail @
http://www.workrave.org/welcome/
Software to be downloaded @
http://prdownloads.sourceforge.net/workrave/workrave-win32-1.9.1-installer.exe?download
Sunday, December 20, 2009
Copenhagen 2009
To look at the bright side, fortunately now the general public know how to pronounce "Copenhagen" and know who shitty politics is.
Actually, I am more looking forward to the South Africa 2010.
Thursday, December 17, 2009
人物总结
冰清玉洁武藤兰,三贞九烈小泽圆。 不近女色陈冠希,天生丽质金喜善。 坚持原创郭小四,低调沉稳数韩寒。 清心寡欲小日本,万恶帝国美利坚。 与邻为善以色列,安宁祥和阿富汗。 国强民富看朝鲜,宇宙起源在南韩。 民主典范金正日,和平斗士本拉丹。 从不掉线天涯网,从不删贴管理员。 优秀记者冬日娜,尖嘴猴腮毕福剑。 只讲真话西西踢维,人民喉舌焦点访谈。 天籁之音曾轶可,大家闺秀李宇春。 守口如瓶宋祖德,字正腔圆周杰伦。 洁身自好赵忠祥,铁汉无泪冷朱军。 水准专业孙正平,从不口误韩乔生。 貌若天仙芙蓉姐,百毒不侵满文军。 诚信经营陈天桥,永不模仿马化腾。 重庆好人谢才萍,无家可归贾君鹏。 低速行车杭州市,交通顺畅北京城。 舍己为人范跑跑,眉清目秀冯小刚。 用色淡雅张艺谋,代言保真唐国强。 物美价廉奥菲斯,低调奢华阿迪王。 学识渊博余秋雨,淡泊名利查良镛。 勤俭持家章小蕙,从不炒作张纪中。 白面书生奥巴马,没有炸弹巴格达。 和风细雨马景涛,苗条骨感沈殿霞。 高大威猛属梅西,从不假摔是C罗。 料事如神贝球王,只争第一是国安。 足坛巨擘李大帝,世界强队国足男。 文明执法闵行区,国虎出没镇坪县。 干净公平全运会,春风拂面好 。 无毒无害三鹿奶,营养健康方便面。 强身健体俯卧撑,安全游戏躲猫猫。 爱管闲事酱油党,不明真相老百姓。 水深火热蛮夷众,欢欣鼓舞天朝民 |
Should I use a #temp table or a @table variable?
http://databases.aspfaq.com/database/should-i-use-a-temp-table-or-a-table-variable.html
In a stored procedure, you often have a need for storing a set of data within the procedure, without necessarily needing that data to persist beyond the scope of the procedure. If you actually need a table structure, there are basically four ways you can "store" this data: local temporary tables (#table_name), global temporary tables (##table_name), permanent tables (table_name), and table variables (@table_name).
There is a partial list of questions and answers about table variables, including some differences between table variables and #temp tables, in KB #305977 - INF: Frequently Asked Questions - SQL Server 2000 - Table Variables.
Local Temporary Tables
CREATE TABLE #people ( id INT, name VARCHAR(32) ) |
A temporary table is created and populated on disk, in the system database tempdb — with a session-specific identifier packed onto the name, to differentiate between similarly-named #temp tables created from other sessions. The data in this #temp table (in fact, the table itself) is visible only to the current scope (usually a stored procedure, or a set of nested stored procedures). The table gets cleared up automatically when the current procedure goes out of scope, but you should manually clean up the data when you're done with it:
DROP TABLE #people |
This will be better on resources ("release early") than if you let the system clean up *after* the current session finishes the rest of its work and goes out of scope.
A common use of #temp tables is to summarize/compact/reorganize data coming from another stored procedure. So, take this example, which pares down the results of the system procedure sp_who2 into only the SPID, Status, and HostName of *active* processes that are *not* part of the regular operation of the system:
CREATE TABLE #sp_who3 ( SPID INT, Status VARCHAR(32) NULL, Login SYSNAME NULL, HostName SYSNAME NULL, BlkBy SYSNAME NULL, DBName SYSNAME NULL, Command VARCHAR(32) NULL, CPUTime INT NULL, DiskIO INT NULL, LastBatch VARCHAR(14) NULL, ProgramName VARCHAR(32) NULL, SPID2 INT ) INSERT #sp_who3 EXEC sp_who2 'active' SELECT SPID, Status, HostName FROM #sp_who3 WHERE spid > 15 DROP TABLE #sp_who3 |
One of the main benefits of using a #temp table, as opposed to a permanent table, is the reduction in the amount of locking required (since the current user is the only user accessing the table), and also there is much less logging involved. (You could also increase this performance by placing tempdb on a separate drive... but that's another story.)
One minor problem with #temp tables is that, because of the session-specific identifier that is tacked onto the name, the name you give it is limited to 116 characters, including the # sign (while other table types are limited to 128). If you try, you will see this:
Server: Msg 193, Level 15, State 1, Line 1 The object or column name starting with '# |
Hopefully this won't be a limitation in your environment, because I can't imagine a table name that long being useful or manageable.
Another potential problem with #temp tables is that, if you enter a transaction and use a #temp table, and then cancel without ever issuing a ROLLBACK or COMMIT, you could be causing unnecessary locks in tempdb (for more information, see KB #159747).
Global Temporary Tables
CREATE TABLE ##people ( id INT, name VARCHAR(32) ) |
Global temporary tables operate much like local temporary tables; they are created in tempdb and cause less locking and logging than permanent tables. However, they are visible to all sessions, until the creating session goes out of scope (and the global ##temp table is no longer being referenced by other sessions). If two different sessions try the above code, if the first is still active, the second will receive the following:
Server: Msg 2714, Level 16, State 6, Line 1 There is already an object named '##people' in the database. |
I have yet to see a valid justification for the use of a global ##temp table. If the data needs to persist to multiple users, then it makes much more sense, at least to me, to use a permanent table. You can make a global ##temp table slightly more permanent by creating it in an autostart procedure, but I still fail to see how this is advantageous over a permanent table. With a permanent table, you can deny permissions; you cannot deny users from a global ##temp table.
Permanent Tables
CREATE TABLE people ( id INT, name VARCHAR(32) ) |
A permanent table is created in the local database, however you can (unlike #temp tables) choose to create a table in another database, or even on another server, for which you have access. Like global ##temp tables, a permanent table will persist the session in which it is created, unless you also explicitly drop the table. (For contention and concurrency reasons, creating a "temporary" permanent table in this manner doesn't really make a lot of sense.) If you are planning to create a permanent table when the procedure runs, you should check to see if it exists, in order to avoid errors like the one mentioned above. For more information about checking for the existence of both local #temp tables and permanent tables, see Article #2458.
Like global ##temp tables, there seems to be little reason to use a permanent table unless the data is going to persist... and if that is the case, why not create the permanent table before the stored procedure is ever run, thereby eliminating all the CREATE / DROP logic?
Table Variables
DECLARE @people TABLE ( id INT, name VARCHAR(32) ) |
A table variable is created in memory, and so performs slightly better than #temp tables (also because there is even less locking and logging in a table variable). A table variable might still perform I/O to tempdb (which is where the performance issues of #temp tables make themselves apparent), though the documentation is not very explicit about this.
Table variables are automatically cleared when the procedure or function goes out of scope, so you don't have to remember to drop or clear the data (which can be a good thing or a bad thing; remember "release early"?). The tempdb transaction log is less impacted than with #temp tables; table variable log activity is truncated immediately, while #temp table log activity persists until the log hits a checkpoint, is manually truncated, or when the server restarts.
Table variables are the only way you can use DML statements (INSERT, UPDATE, DELETE) on temporary data within a user-defined function. You can create a table variable within a UDF, and modify the data using one of the above statements. For example, you could do this:
CREATE FUNCTION dbo.example1 ( ) RETURNS INT AS BEGIN DECLARE @t1 TABLE (i INT) INSERT @t1 VALUES(1) INSERT @t1 VALUES(2) UPDATE @t1 SET i = i + 5 DELETE @t1 WHERE i < style="font-family: 'franklin gothic book',tahoma,verdana; font-size: 13px;"> DECLARE @max INT SELECT @max = MAX(i) FROM @t1 RETURN @max END GO |
However, try that with a #temp table:
CREATE FUNCTION dbo.example2 ( ) RETURNS INT AS BEGIN CREATE TABLE #t1 (i INT) INSERT #t1 VALUES(1) INSERT #t1 VALUES(2) UPDATE #t1 SET i = i + 5 DELETE #t1 WHERE i < style="font-family: 'franklin gothic book',tahoma,verdana; font-size: 13px;"> DECLARE @max INT SELECT @max = MAX(i) FROM #t1 RETURN @max END GO |
Results:
Server: Msg 2772, Level 16, State 1, Procedure example2, Line 7 Cannot access temporary tables from within a function. |
Or try accessing a permanent table:
CREATE TABLE table1 ( id INT IDENTITY, name VARCHAR(32) ) GO CREATE FUNCTION dbo.example3 ( ) RETURNS INT AS BEGIN INSERT table1(name) VALUES('aaron') RETURN SCOPE_IDENTITY() END GO |
Results:
Server: Msg 443, Level 16, State 2, Procedure example3, Line 8 Invalid use of 'INSERT' within a function. |
Table variables can lead to fewer stored procedure recompilations than temporary tables (see KB #243586 and KB #305977), and — since they cannot be rolled back — do not bother with the transaction log.
So, why not use table variables all the time? Well, when something sounds too good to be true, it probably is. Let's visit some of the limitations of table variables (part of this list was derived from KB #305977):
- Table variables are only allowed in SQL Server 2000+, with compatibility level set to 80 or higher.
- You cannot use a table variable in either of the following situations:
INSERT @table EXEC sp_someProcedure
SELECT * INTO @table FROM someTable - You cannot truncate a table variable.
- Table variables cannot be altered after they have been declared.
- You cannot explicitly add an index to a table variable, however you can create a system index through a PRIMARY KEY CONSTRAINT, and you can add as many indexes via UNIQUE CONSTRAINTs as you like. What the optimizer does with them is another story.
One thing to note is that you cannot explicitly name your constraints, e.g.: DECLARE @myTable TABLE
(
CPK1 int,
CPK2 int,
CONSTRAINT myPK PRIMARY KEY (CPK1, CPK2)
)
-- yields:
Server: Msg 156, Level 15, State 1, Line 6
Incorrect syntax near the keyword 'CONSTRAINT'.
-- yet the following works:
DECLARE @myTable TABLE
(
CPK1 int,
CPK2 int,
PRIMARY KEY (CPK1, CPK2)
) - You cannot use a user-defined function (UDF) in a CHECK CONSTRAINT, computed column, or DEFAULT CONSTRAINT.
- You cannot use a user-defined type (UDT) in a column definition.
- Unlike a #temp table, you cannot drop a table variable when it is no longer necessary—you just need to let it go out of scope.
- You cannot generate a table variable's column list dynamically, e.g. you can't do this:
SELECT * INTO @tableVariable
-- yields:
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '@tableVariable'.
You also can't build the table variable inside dynamic SQL, and expect to use it outside that scope, e.g.:DECLARE @colList VARCHAR(8000), @sql VARCHAR(8000)
SET @colList = 'a INT,b INT,c INT'
SET @sql = 'DECLARE @foo TABLE('+@colList+')'
EXEC(@sql)
INSERT @foo SELECT 1,2,3
-- this last line fails:
Server: Msg 137, Level 15, State 2, Line 5
Must declare the variable '@foo'.
This is because the rest of the script knows nothing about the temporary objects created within the dynamic SQL. Like other local variables, table variables declared inside of a dynamic SQL block (EXEC or sp_executeSQL) cannot be referenced from outside, and vice-versa. So you would have to write the whole set of statements to create and operate on the table variable, and perform it with a single call to EXEC or sp_executeSQL. - The system will not generate automatic statistics on table variables. Likewise, you cannot manually create statistics (statistics are used to help the optimizer pick the best possible query plan).
- An INSERT into a table variable will not take advantage of parallelism.
- A table variable will always have a cardinality of 1, because the table doesn't exist at compile time.
- Table variables must be referenced by an alias, except in the FROM clause. Consider the following two scripts:
CREATE TABLE #foo(id INT)
DECLARE @foo TABLE(id INT)
INSERT #foo VALUES(1)
INSERT #foo VALUES(2)
INSERT #foo VALUES(3)
INSERT @foo SELECT * FROM #foo
SELECT id
FROM @foo
INNER JOIN #foo
ON @foo.id = #foo.id
DROP TABLE #foo
The above fails with the following error:Server: Msg 137, Level 15, State 2, Line 11
Must declare the variable '@foo'.
This query, on the other hand, works fine:SELECT id
FROM @foo f
INNER JOIN #foo
ON f.id = #foo.id - Table variables are not visible to the calling procedure in the case of nested procs. The following is legal with #temp tables:
CREATE PROCEDURE faq_outer
AS
BEGIN
CREATE TABLE #outer
(
letter CHAR(1)
)
EXEC faq_inner
SELECT letter FROM #outer
DROP TABLE #outer
END
GO
CREATE PROCEDURE faq_inner
AS
BEGIN
INSERT #outer VALUES('a')
END
GO
EXEC faq_outer
Results:letter
------
a
(1 row(s) affected)
However, you cannot do this with table variables. The parser will find the error before you can even create it:CREATE PROCEDURE faq_outer
AS
BEGIN
DECLARE @outer TABLE
(
letter CHAR(1)
)
EXEC faq_inner
SELECT letter FROM @outer
END
GO
CREATE PROCEDURE faq_inner
AS
BEGIN
INSERT @outer VALUES('a')
END
GO
Results:Server: Msg 137, Level 15, State 2, Procedure faq_inner, Line 4
Must declare the variable '@outer'.
For more information about sharing data between stored procedures, please see this article by Erland Sommarskog.
Conclusion
Like many other areas of technology, there is no "right" answer here. For data that is not meant to persist beyond the scope of the procedure, you are typically choosing between #temp tables and table variables. Your ultimate decision should depend on performance and reasonable load testing. As your data size gets larger, and/or the repeated use of the temporary data increases, you will find that the use of #temp tables makes more sense. Depending on your environment, that threshold could be anywhere — however you will obviously need to use #temp tables if any of the above limitations represents a significant roadblock.
Monday, December 14, 2009
2009球界红人
在我很不熟悉的高尔夫球界,最红的当属Tiger Woods。一个老婆一个坑,马上就有18坑。
Tiger,即老虎。
Lionel,即狮子。
所以2009是属于大型哺乳猫科动物的。
特别提名,香港男足。完成了连中国男足都无法完成的任务:日前在东亚运男足决赛中,击败日本,取得冠军。中国男足上回取得国际赛事冠军是在……上世纪。
Sunday, December 13, 2009
中文名
Friday, December 4, 2009
Switch Statement in C++ and C#
char keystroke = getch();
switch( keystroke ) {
case 'a':
case 'b':
case 'c':
case 'd':
KeyABCDPressed();
break;
case 'e':
KeyEPressed();
break;
default:
UnknownKeyPressed();
break;
}
But in C#, this is not OK. "C# does not support an implicit fall through from one case label to another. The one exception is if a case statement has no code." Therefore, C# does not support implicit "goto" with "switch". But why?
Thursday, December 3, 2009
Excel & VBA Auto-formatting report
Sub FormatReport()
'Add total footer
Dim lastRow As Integer
Dim lastCol As Integer
lastRow = [A65536].End(xlUp).Row + 1
lastCol = [VV1].End(xlToLeft).Column
Range(Cells(lastRow, 1), Cells(lastRow, 1)).Value = "TOTAL"
Dim col As Integer
col = 2
Do Until col = lastCol
Range(Cells(lastRow, col), Cells(lastRow, col)).Select
R = ActiveCell.Row
C = ActiveCell.Column
If IsNumeric(Cells(2, C)) And Not IsEmpty(Cells(2, c)) Then
ActiveCell.Value = Application.sum(Range(Cells(2, C), Cells(R, C)))
End If
col = col + 1
Loop
'Format cells
col = 2
Do Until col = lastCol
'Range("B2", Cells(lastRow, lastCol)).Select
Range(Cells(2, col), Cells(lastRow, col)).Select
If IsNumeric(Cells(2, col)) Then
Selection.NumberFormat = "$#,##0"
End If
If IsDate(Cells(2, col)) Then
Selection.NumberFormat = "m/d/yyyy"
End If
Cells.EntireColumn.AutoFit
col = col + 1
Loop
'Format footer
Range(Cells(lastRow, 1), Cells(lastRow, lastCol)).Select
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
Selection.Font.ColorIndex = 2
Selection.Font.Bold = True
'Format header
Range(Cells(1, 1), Cells(1, lastCol)).Select
Selection.Font.Bold = True
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
Selection.Font.ColorIndex = 2
Range(Cells(1, 2), Cells(1, lastCol)).Select
With Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
'Insert new row
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Range(Cells(1, 1), Cells(1, lastCol)).Select
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
Selection.Font.ColorIndex = 2
Selection.Font.Bold = True
Range(Cells(1, 1), Cells(1, lastCol)).Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
'Add header to new row
Dim month As String
month = Application.InputBox("Enter Month and Year for the report header", "Enter Date", "January 2009")
Range(Cells(1, 1), Cells(1, lastCol)).Select
ActiveCell.FormulaR1C1 = "REPORT FOR " + month
Range(Cells(1, 1), Cells(1, lastCol)).Select
With Selection.Font
.Name = "Arial"
.Size = 14
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
End With
End Sub
Excel & VBa: find last row, column, cell in an Excel (work)sheet
http://www.ozgrid.com/VBA/ExcelRanges.htm
The following page contains some usefull (general) vba code that can be used to find the last row, columnand/or cell in an Excel (work)sheet.
Find the last used cell, before a blank in a Column:
Sub LastCellBeforeBlankInColumn()
Range("A1").End(xldown).Select
End Sub
Find the very last used cell in a Column:
Sub LastCellInColumn()
Range("A65536").End(xlup).Select
End Sub
Find the very last used cell in a Column:
Sub LastCellInColumn()
Range("A65536").End(xlup).Select
End Sub
Find the last cell, before a blank in a Row:
Sub LastCellBeforeBlankInRow()
Range("A1").End(xlToRight).Select
End Sub
Find the very last used cell in a Row:
Sub LastCellInRow()
Range("IV1").End(xlToLeft).Select
End Sub
Find the very last used cell on a Worksheet:
Sub Demo()
Cells.Find(What:="*", After:=[A1], SearchDirection:=xlPrevious).Select
End Sub
Find the last used Row on a Worksheet:
Sub FindLastRow()
Dim LastRow As Long
If WorksheetFunction.CountA(Cells) > 0 Then
'Search for any entry, by searching backwards by Rows.
LastRow = Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
MsgBox LastRow
End If
End Sub
Find the last used Column on a Worksheet:
Sub FindLastColumn()
Dim LastColumn As Integer
If WorksheetFunction.CountA(Cells) > 0 Then
'Search for any entry, by searching backwards by Columns.
LastColumn = Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious).Column
MsgBox LastColumn
End If
End Sub
==============================================
Wednesday, December 2, 2009
Cities for living
In HongKong, I often asked myself, "How long I will be here".
In some cities like Goteborg, I was told, "Welcome here".
In Sydney, I am here but people (e.g., DIAC) question "Why you are here".
Tuesday, December 1, 2009
25 Movie quotes
famous quote by Michael Conner Humphreys (young Forrest) of Forrest Gump
"Bond, James Bond"
quote from numerous James Bond movies
"Frankly my dear, I don't give a damn"
quote from Clark Gable (Rhett Butler) in Gone with the Wind
"What we have here is a failure to communicate"
quote from Cool Hand Luke
"You're gonna need a bigger boat"
quote from Roy Schneider (Police Chief Martin Brody) in Jaws
"Say hello to my Little Friend"
quote by Al Pacino (Tony Montana) - Scarface
"I feel the need - the need for speed"
Quote from Tom Cruise (Maverick) in Top Gun
"You know you drive almost slow enough to drive Miss Daisy"
quote by Will Smith in Bad Boys
"I'm the king of the world"
quote by Leonardo DiCaprio (Jack Dawson) in Titanic
"Ditto"
quote from Patrick Swayze (Sam) in Ghost
"You can't handle the truth"
quote from Jack Nicholson (Colonel Jessup) in A Few Good Men
"Show me the money"
quote from Cuba Gooding Jr. (Ron Tidwell) in Jerry McGuire
"Houston, we have a problem"
quote from Tom Hanks (Jim Lowell) in Apollo 13
"Here's looking at you kid"
quote from Humphrey Bogart (Rick Blaine) in Casablanca
"There's no crying in baseball"
quote from Tom Hanks (Jimmy Dugan) in A League of Their Own
"I'll Be Back"
quote from Arnold Schwarzenegger from Terminator
"I'll get you my pretty"
quote from Wicked Witch of the West, Wizards of Oz
"Go ahead make my day"
quote by Clint Eastwood (Harry Callahan) in Sudden Impact
"Well, nobody's perfect"
quote from Joe E. Brown (Osgood Fielding III) in Some Like it Hot
"Keep your friends close, but your enemies closer"
quote from Al Pacino (Michael Corleone) in Godfather Part II
"Snap out of it"
quote from Cher (Loretta Castorini) in Moonstruck
"You had me at hello"
quote by Rene Zellweger (Dorothy Boyd) in Jerry McGuire
"You talkin' to me?"
famous quote by Robert De Niro (Travis Bickle) in Taxi Driver
"After all, tomorrow is another day"
quote from Vivien Leigh (Scarlett O'Hare) in Gone with the Wind
"There's no place like home"
quote from Judy Garland (Dorothy Gale) in Wizards of Oz
Thursday, November 26, 2009
Public toilet capacity analysis
The model looks like the following. Let's assume there are two urinal pots and two loos in the male toilet; 3 loos in the female one. To execute a urine/poop job, male need 1.5 minutes and 5 minutes respectively; female need 2.5 minutes and 5 minutes respectively. Finally, let's assume that the incoming rate of jobs are on average 4 urinal and 1 poop per time frame for both. This is summarized in the table below.
For male server, it is 5 minutes of execution in both the worst and the best case. For female server, the optimal scheduling yields 5 minutes of execution time (with probability 3x4!/5! = 60%), and the worst case could be 7.5 minutes (with probability 40%). Therefore, on average, the execution time for female is 6 minutes.
How the situation is improved if there is one more loo in the female toilet? The average execution time will be 5.5 minutes. The disparity will be total closed if there are 5 loos in the female toilet.
Further discussion. In reality, there are other causes for female to go to public rest room, for example, fixing makeup, changing sanitary, gossip, etc. They are not taken into consideration here. But those factors are definitely going to affect the capacity of the servers.
Server | M | F |
Resource | 2U + 2L | 3L |
Execution time | (1.5M, 5M) | (2.5M, 5M) |
Incoming rate | 4U + 1L | 4U + 1L |
Thursday, November 19, 2009
Chinese is Object-Oriented Language
There are a lot of articles comparing Chinese and English to some extent. From the computer language design point of view, we shall see that Chinese is an object-oriented high-level language; while English or the like is index-based language.
Let us first look at what is Object-Oriented language. In the computer science, any concrete or abstract thing can be viewed as Object. Objects have their attributes and methods. Take “dog” as an example, color, weight and so on are its attributes; while eating, coquetry, barking etc are its methods.
Similarly, a Chinese character or an English word can also be viewd as an object. Once again, take “狗" (dog) as an example, the pronunciation and spelling are attributes of the word, and its meaning in usage is its method.
The most important concepts of Object-Oriented languages are: encapsulation, inheritance, and polymorphism.
1. Encapsulation
In software engineering, encapsulation means concealing the functional details of an object from its interface. This provides not only certain levels of protection of the data structure, but also excellent foundation for modularity.
The two features of encapsulation are: separation of interface and implementation and the protection of the internal implementation. By the same token, we can define the following four criteria to examine whether a natural language ensures encapsulation.
1. Shape interface: whether all words have consistent shape.
2. Semantics interface: whether there is unique definition of certain words.
3. Pronunciation interface: whether the pronunciation of certain words is unique.
4. Spelling interface: whether the spelling changes according to the different scenario.
Chinese. 1) Chinese characters have squared shape. 2) Most Chinese characters have multiple meanings. 3) Most Chinese characters have only one pronunciation; only a few (more than one hundred) have two or more ways of pronunciation. 4) Chinese characters’ spelling is fixed, despite that there are simplified and traditional spelling.
English. 1) English words can be arbitrary in length. For example, “I” has only one letter; and "pneumonoultramicroscopicsilicovolcanoconiosis" has a total of 45 letters. 2) Most English words have multiple meanings. For example, “book” in noun means differently from it in verb. 3) Most English words have unique pronunciation. 4) Spelling of English words is not fixed. The letters are case-sensitive; nouns have plural form; verbs have tense changes. And the pronunciation will change as well.
To compare them, “do” can appear to be “do”, “did”, “doing”, “done” in English, while in Chinese there is only a need for some commonly used adverb.
Conclusion: Chinese is a better encapsulated language of encapsulation
2. Inheritance
In object-oriented programming, inheritance is a way to form new classes (instances of which are called objects) using classes that have already been defined. Inheritance is intended to help reuse existing code with little or no modification.
For human language, there may not be hierarchies that rise from the inheritance relationship. Still, there are obviously compounds of roots (or 部首) for words and compounds of words for phrase, which make reusing word components possible. We will find that by using inheritance, language is much simpler for learners.
Single inheritance: Chinese characters are mostly made of parts (部首). Some parts are for the semantics (意); some parts are for the pronunciation (音). Therefore, one can guess the meaning of certain words without knowing how to pronounce it, or visa versa. For example, 围、圆、园、圈. These four words all have been circled with “口”; this is for the semantics meaning that they are something to do with circles. The inner parts 韦、员、元、卷 tells how to pronounce them. On the other hand, English has Latin roots that can be used to make words. This can be viewed as an example of single inheritance.
Multiple inheritance: which means to inherit from more than one classes. Chinese language does this in making phrases. For example,
飞机(plane) = 会飞行(flight)的机器(machine)
工人(worker) = 在工厂(factory)工作的人(man)
解放(liberate) = 解开(unlatch)后释放(release)
计算机(computer) = 能计算(calculate)的机器(machine)
English has such inheritance in the compounded words, such as: football, handwriting, and breakwater. However, there are also very bad examples that no inheritance can be found. For example:
猪 pig 公猪 boar 母猪 sow 小猪 piglet 猪肉 pork
牛 cattle 公牛 bull 母牛 cow 小牛 calf 牛肉 beef
羊 sheep 公羊 ram 母羊 ewe 小羊 lamb 羊肉 mutton
One shall see that there are only seven Chinese characters involved in representing these words: 猪、牛、羊、公、母、小、肉 whilst 15 words for English.
The last example, the months:
一月 January
二月 February
三月 March
四月 April
五月 May
六月 June
七月 July
八月 August
九月 September
十月 October
十一月 November
十二月 December
In Chinese, they are just numbers plus “月” for month. In English, they are twelve irrelevant words.
Conclusion: Chinese language is perfectly inheritance language, (given that five thousand years of Chinese history).
3. Polymorphism
Polymorphism (poly = multiple, morph = shape) is the ability of one type, A, to appear as and be used like another type, B. It provides the runtime flexibility for the language. Actually, polymorphism is a consequence of inheritance. By properly inherited from one interface (a.k.a. abstract base class), values of different data types can be handled using a uniform interface.
To exam whether a human language has polymorphism, we shall see 1) whether there exist words representing interfaces; 2) whether a word in a single interface can have different semantics in its context.
Starting comparison with an example, “我要坐车去” (I will go there by car). In English, it is quite definite that the transportation is “car”. In Chinese, however, “车” is an abstract word; it can refer to汽车 (car), 出租车 (taxi), 公共汽车 (bus), 火车 (train), etc. To be competent in English, one would have to say “I will go there by vehicle” – which sounds odd. Words like “车” that serves as an interface are quite common in Chinese, partly because a lot of compounded words are inherited from some single character.
Another type of polymorphism in Chinese is Pinyin. There are four tones for Pinyin. The tones sometimes are decided within its context, so called “多音字” (multi-tones character). Even the tones are provided, the meaning of the words have to be determined within the context in some cases. For example, “lì hài” can be “厉害” (Formidable) or “利害” (gains and losses, advantages and disadvantages).
Actually in English, the use of the tense is considered anti-polymorphism because the objects (words) changed their interface when its properties are changing; potentially increase the number of objects.
From the above examples, it is quite obvious that polymorphism provides certain degrees of flexibility in communication at the cost of preciseness. This probably is a feature of “information hiding” that makes languages more literally colorful.
To conclude this article, Chinese is, if not the only one, an Object-Oriented Natural Language; and English is definitely not.
Saturday, November 14, 2009
Home-moving is so tiresome
- Home loan
- Lawyer and broker charge
- Strata
- Council fee
- Insurance
- Hiring a house-moving truck
- House cleaning
Things to setup
- Electricity
- Gas
- Telephony
- Broadband
- Blinds and curtains
- Lock
- Security alarm
Furniture to buy
- Dining table set
- TV table
- Coffee table
- Bed x 2
- Bed side tables
- Lounge
- Matts
- (Kitchen is set)
- (Closet is provided)
- (Laundry and toilet are set)
Electrical appliance
- TV
- HiFi
- Fridge
- Microwave oven
- Fan
- Aircondition
- Vacuum machine
- Washing machine
- Lamps
- (Dishwasher and Oven are provided)
- (Drier is provided)
Miscellaneous
- Decoration
- Power adapters
- Cleaning tools
- Gadgets
- ..... too many
Monday, November 9, 2009
How to know how bad a program is written?
Every programmer should know how to make it easier for debugging before coding.
Sunday, November 8, 2009
A home fiance example for real
He bought a piece of land and built his own home. Despite the horrible Fenshui, it is 25Km distance to the downtown and no public transportation around. He moved in the new house 1 month after it is established -- which means he paid one more month of rent, simply because the fence hadn't been setup. During that one month, his home was broken in and some kitchen stuff were stolen. Anyway, he still owes about 220K home loan to the bank.
He had a new 1.6L car 2 years ago. He then bought a new 2L car this year for family use. (BTW, a family of two). The second car is financed. He is paying 7% interest rate -- compared to 5%+ home loan rate. (Bank is so happy)
Friday, November 6, 2009
Thursday, November 5, 2009
Linux News (Cited)
10月19日至20日,《Linux内核开发峰会》在日本东京召开,其间谷歌高层人员Mike Waychison到会披露:实际上,谷歌使用Linux是很无奈的(by perforce),由于任务紧急的需要,不得已而为之。谷歌从Linux 2.4.18入手,建立了自己的核心代码树,30来个人维护。根据谷歌计算实践的需要,补充了2,000多个文件,加入492,000行源代码。经过一年半左右,重新跟上主流版本,即Linux 2.6.18,......Linux 2.6.26,又打了1,208补丁和30万多行源代码。谷歌实际使用Linux内核的水平,远远落后国际主流社区,以至于对外交流都存在一定的困难(技术语言障碍)。
Linux内核开发的领头人,Linus Torvalds先生当时就在现场,问他,你们为何不把修改代码提交出来?是因为是商业机密?还是什么内部原因?谷歌的Waychison先生很坦诚地说,不是因为商业机密,而是因为代码编写得很丑陋(ugly),不好意思拿出来。Waychison先生表示,谷歌目前正在力图改变这种状态,跟上国际主流社区。
10月21日至23日,日本第一届Linux学术年会在东京召开,Linus Torvalds和《Linux基金会》主席Jim Zemlin有一次公开对话,题为“The impact of Linux”(约37分钟),Zemlin说道,在过去一年里面,Linux内核增加了2,700,000行源代码,平均每天增加10,923行源代码,同时,每天删除5,547行源代码。由此可见,Linux内核开发速度之快。实际上,Linux 2.6.31内核的最新版本,其总代码量已经超过1千万行源代码。Ubuntu 9.10版本就是基于Linux的最新内核开发的。很显然的事实是,谷歌的Chrome OS要想超越Ubuntu是不容易办到的。与其说,谷歌推出自己的操作系统Chrome OS是来对付微软,不如说,谷歌的Chrome OS主要是为解决自己的内部需要。
Convert tab-delimited section into a table in MS Word
For example,
A501 | MARKETING COMMUNICATIONS | Communications | NULL |
A502 | WAREHOUSE/DISTRIBUTION | Communications | NULL |
A503 | PHOTOGRAPHY | Branding | NULL |
A504 | CONFERENCE/ROADSHOW | Branding | NULL |
A505 | INTERNAL COMMUNICATIONS | Branding | NULL |
Wednesday, November 4, 2009
互联网的青春期
Tuesday, November 3, 2009
Melbourne Cup
Thursday, October 29, 2009
Tuesday, October 27, 2009
When Death Becomes a Career Move
Friday, October 23, 2009
海归博士自杀 浙大发布奇文讣告
仪式的有学院领导、学校相关部门、部分师生及涂老师亲属与同学,共100余人。
涂序新老师于2009年9月17日凌晨2点因病不幸坠楼去世,终年32岁。(sick suicide?!)
涂序新老师1977年8月生于浙江金华,1995年9月——2001年6月就读于清华大学,2000年6月获水利水电工程专业学士学位,2001年6月获法学学士学位。2001年9月——2007年6月就读于美国西北大学,分别于2004年和2007年获得岩土工程硕士和博士学位。其后在美国西北大学从事博士后研究工作,2009年6月中旬回国到学院工作。
涂序新老师为人真诚善良,对待同事细心周到,受到大家的尊重;对待学生,耐心解答疑问,多次深入新生宿舍与学生交流,受到学生的爱戴。涂序新老师学识渊博、事业心强、治学严谨,对研究工作认真执着,精益求精。
借此机会,感谢学校各部门及学院师生的关心! (What the hell is this "thank-you"?)
附涂序新博士来学院的主要经历
2009年1月,涂博士通过电子邮件与学院岩土所联系,申请教师岗位;
3月24日,由学院提供往返国际机票和住宿条件,涂博士来学院面试;(The school paid for the interview! how generous.)
4月21日,学院将《新进人员聘任通知书》发给涂博士,涂博士于次日通过电子邮件表示“本人愿意接受你们所提供的岗位和待遇”; (Acceptance by Dr.Tu means "not the school's problem")
6月12日,涂博士与浙大签署聘用合同;
7月28日,涂博士租住由浙大提供的位于玉泉校区求是村的教师公寓。公寓建筑面积57平方米(内含独立厨房、卫生间以及电视、冰箱、空调、微波炉、电磁炉、床铺、桌椅等家具和电器设施)。此后,他相继参加了学院组织的留学归国人员座谈会、环境岩土工程国际学术研讨会筹备及会务工作,并担任了 2009级本科新生班主任; (Perfect living place -- is that an ad? The school is so "generous"!)
9月1日到8日期间,涂博士参加了学校在之江校区举行的新教师岗位集中培训;
9月8日,学校启动了下半年专业技术职务评审工作。9月11日,涂博士在学校“专业技术职务聘任系统”中填写了申报副教授的相关信息;(The cause is just too simple to ignore)
9月17日,涂博士于凌晨2点因病不幸坠楼去世。
Thursday, October 22, 2009
Wednesday, October 14, 2009
Peer review
Back in my life in academia, I understood a term called “peer-review”. Essentially, it means that your works will be judged by your peers after you submitting them. It sounds quite strange at first. Most of us tend to believe in “authorities” or “professionals”, but “peer” is just lack of emm… scientific ground as well as power. Later on, I got used to it and comprehend the true meaning behind. In academia, all men are equal (as almost everyone is a Ph.D) and no one could be the real authority or professional. Besides, the true spirit of research is not to believe what you have been told but to approach the axiom in your mortal life. Therefore, although there are still hierarchies in the academic world (such as big names, professors, associate professor, assistant professor, senior researcher, fresh graduate students, etc), the term “peer” sounds much elegant here.
The next question is how to get your work (say, a paper) pass a peer-review. From my understanding, there are three options:
1, your work is really good – which is possible but still how could you define good?
2, you are very famous – because famous is an alias of good.
3, you know the peers who review your work – either you know the person or you know what the person likes (to see from your work).
It sounds not tricky, isn’t it?
Now let’s turn to the beginning and look at the question – what have Obama done to be awarded the Nobel peace prize, (unless you really think he deserves the prize despite that even the US government think otherwise). Not tricky, the key is the “peers”. The award selection committee is composed of five Norwegians appointed by the Norwegian parliament. Their representativeness is like five politician from a mid-sized county in a mid-sized province in China. Without any disrespect, Mr. Obama is a very peaceful say-much-do-nothing person. In this case, I guess it falls into the 2nd "very famous" category for his Norwegian fans.
For more informaiton about the fellowship of the Obama's peers:
The chairperson is a guy named Jagland who had featured in a televised breast-grabbing incident 11 years ago. The other four include a left-inclined ex-prime minister, a current member of the Labor Party, an environmentally-concerned socialist, a former conservative parliamentarian turned serial board member and a member of an anti-immigration party. This isn't an exciting bunch of peers, I'd say. I have to be wondering what kind of peace they have in their mind. Anyway, the result has been announced, and memorized.
Wednesday, October 7, 2009
“再不回中国就来不及了”
中国,房价不会跌,工资不会涨,马路上人不会少,关系不会简单,物价不会降,服务不会升级,政府不会给笑脸……
想来想去,这句广告词的言下之意是:人民币要涨了。
Tuesday, October 6, 2009
Evolution of the Cell Phone
Sunday, October 04, 2009 05:00 PM PDT
http://www.pcworld.com/printable/article/id,173033/printable.html
From enormous, 80-pound, car-mounted beasts to tiny terminals in our back pockets, mobile phones have come a long way. What once cost thousands, weighed 2 pounds, and packed 60 minutes of battery life now costs $99, weighs 4 ounces, and packs 5 to 10 hours of battery life--and also includes a full-fledged computer, a video camera, audio/video playback, and high-speed Internet access.
How did we get from there to here? Let's take a brief tour through the history of the cell phone. The following phones don't necessarily reflect the first or best of each type, but instead represent certain phases in mobile phone evolution over the last 50 years.
SRA/Ericsson MTA (Mobile Telephone System A)
Year: 1956
In the days before cellular phone networks, the world's mobile phones lacked a unifying standard. Instead, they used varying communication methods defined on a company-by-company basis.
The 88-pound MTA phone, shown here, is typical in size and weight of early mobile phone systems from the pre-integrated-circuit era. Most were so heavy and power-hungry that they required permanent installation in a car or other vehicle. Very few people owned, used, or even encountered such devices; for example, the service for the model shown here existed in only two Swedish cities and served a mere 125 subscribers from 1956 to 1967.
Notable qualities: The first automatic mobile telephone system (it didn't require a human operator to manually connect the user to an outside phone line)
Photo: Ericsson
Motorola DynaTAC 8000X
Year: 1983
Though Motorola announced the world's first handheld mobile phone--a prototype of the DynaTAC 8000X you see above--in 1973, it took ten years for the DynaTAC to reach the market. In those ten years, engineers squeezed more capability into less space, and Motorola built much-needed infrastructure--the towers necessary for cell phone service.
Upon its release in 1983, the DynaTAC 8000X became an instant cultural icon, both as a status symbol for the rich (thanks to the $3995 retail price--$8657 in 2009 dollars) and as an almost miraculous wonder-phone that a person could use anywhere. With the DynaTAC, the cell phone revolution had finally begun.
Notable qualities: Small size, light weight; the first handheld mobile phone
Photo: Motorola
Nokia Mobira Talkman
Year: 1984
Motorola's handheld DynaTAC was an amazing breakthrough, but in reality its size proved limiting due to the battery technology of the era. The DynaTAC could manage only 60 minutes of talk time in ideal conditions, while larger "luggable" phones equipped with capacious batteries--such as the Mobira Talkman, shown here--could provide many hours of continuous operation.
Notable qualities: Early luggable mobile phone; relatively long talk time
Photo: Nokia
Motorola MicroTAC
Year: 1989
After the success of the DynaTAC, Motorola followed up with the much smaller and lighter MicroTAC phone in 1989. The MicroTAC included a novel space-saving idea: Motorola engineers placed part of the phone's hardware in a hinged section that could fold inward or outward as needed, thus reducing the phone's size when it wasn't in use. The flip concept lives on in many cell phones today.
Notable qualities: First flip phone, first pocket phone; smallest and lightest cellular phone at the time of its debut
Photo: Motorola
Motorola 2900 Bag Phone
Year: 1994
When many people think of the "car phones" of the 1980s and 1990s, they picture bag phones like the Motorola 2900, shown here. The bag contained a transceiver and battery, and the user operated a much lighter corded handset. Owners could carry the bag on their shoulder, but a bag phone's general bulk mostly limited its usage to cars.
Despite the availability of smaller phones on the market, bag phones remained popular well into the late 1990s due to their long talk times and their superior range. Thanks to heftier batteries, bag phones could afford to transmit a cell signal with greater power, allowing the phone to be used farther away from a receiving tower. This was especially important in the days when cellular coverage wasn't nearly as widespread as it is now.
Notable qualities: Long talk times, plus greater battery life and signal range
Photo: Motorola
Motorola StarTAC
Year: 1996
In 1996, Motorola further shrank its line of pocket cell phones, producing the 3.1-ounce StarTAC--which immediately proved popular and influential. The StarTAC expanded on the partially collapsible design of its precursor, the MicroTAC, by allowing users to fold the phone in half when they weren't talking on it. We now call this design "clamshell," for its resemblance to the way a clam opens and closes. The StarTAC's general design was widely imitated, and a large percentage of mobile phones still use it today.
Notable qualities: First fully "clamshell" mobile phone design; smallest and lightest mobile phone at its release
Photo: Motorola
Nokia 9000i Communicator
Year: 1997
Though the Nokia 9000i wasn't the first-ever smartphone (many people give that honor to the IBM Simon), it marked the real beginning of our modern smartphone era. The 9000i truly was a pocket computer and a cell phone rolled into one, with an Intel 386-derivative CPU and 8MB of RAM. The phone's physical configuration was novel at the time: Users could open the 9000i in a horizontal clamshell fashion to reveal a wide LCD screen and a full QWERTY keyboard. When folded, it resembled an ordinary cell phone.
The 9000i could send and receive faxes, text messages, and e-mail, and it also had (extremely) limited Web access through 160-character SMS messages. And like any self-respecting smartphone, it shipped with a full complement of PDA-like organizer capabilities.
Notable qualities: First Nokia smartphone; first modern PDA/cell phone combo; mobile Internet connectivity
Photo: Nokia
Nokia 8810
Year: 1998
In the earlier years, all cellular phones shipped with external antennas that stuck out in aesthetically unpleasing ways. Nokia engineers found a way around that problem by designing a flat, plate-like antenna that could hide inside the body of a cell phone. The result was the Nokia 8810, the first true "candy bar" phone in the modern sense. This small, compact, non-clamshell design soon became standard for many Nokia handsets; you rarely see an external cell phone antenna these days.
Notable qualities: First cell phone without an external whip or stub antenna; first "candy bar" phone
Photo: Nokia
Nokia 7110
Year: 1999
Not too long ago, WAP (Wireless Application Protocol) was a huge deal. The mobile phone industry designed WAP to allow Web access on simple devices with limited processing power and displays, like cell phones circa 1999 to 2002. Instead of a rich graphical experience, users would see a stripped-down, typically text-only subset of the Web. Nokia was the first company to bring WAP browsing to a mobile phone with the 7110, released in 1999.
In our present age of smartphones with full-featured browsers, large screens, and beefy CPUs, WAP has quickly become a relic of the past. Web browsing has most assuredly not.
Notable qualities: World's first WAP-capable mobile phone; nifty sliding keypad cover
Photo: Nokia
RIM BlackBerry 5810
Year: 2002
The BlackBerry brand began in 1999 as a simple two-way pager, but it morphed into a line of full-fledged smartphones in 2002 with the BlackBerry 5810, the first of the series to include integrated cell phone support. Thanks to top-of-the-line mobile e-mail and text messaging (the QWERTY keyboard didn't hurt either), BlackBerry phones soon became indispensable tools for businesspeople and other professionals.
Notable qualities: First BlackBerry with an integrated voice cell phone; push e-mail support
Photo: Research in Motion
Sanyo SCP-5300
Year: 2002
Who would want a camera in their cell phone? When news of such combination devices trickled over from Japan in the early part of the decade, the idea seemed silly and excessive to some people. In 2002, Sprint and Sanyo released the first American cell phone with a built-in camera, the SCP-5300--and the public went crazy for it.
The camera phone became a bona fide cultural phenomenon, allowing the average Joe to quickly and personally share both mundane and earthshaking events with the rest of the world. Today, camera phones are so common that we don't call them "camera phones" anymore.
Notable qualities: First U.S. mobile phone with an integrated camera; color screen, clamshell camera phone design
Photo: Sanyo
T-Mobile Sidekick/Danger Hiptop
Year: 2002
At the time of its release in the United States, the T-Mobile Sidekick (also known as the Danger Hiptop) quickly became the text-messaging addict's dream machine. This innovative smartphone incorporated a novel design with a large LCD screen that rotated and flipped to reveal a generous QWERTY keyboard. The Sidekick line, with its distinctive full-reveal keyboard, persists today, having influenced many similar hide-and-reveal keyboard designs since its emergence in 2002. These clever and attractive designs helped fuel text messaging's popularity beyond the tie-and-Frappuccino BlackBerry set, extending it to the youth of the world.
Notable qualities: Large, flippable screen; relatively uncramped and full-featured QWERTY keyboard
Photo: T-Mobile
Motorola Razr V3
Year: 2004
At a time when most cell phones were starting to look the same, Motorola decided to break the status quo with the Razr V3, a slim, slab-like clamshell phone with a large screen, a stylish and flat keyboard, a built-in camera, and multimedia capabilities. Impressive technical features aside, you have to admit that the Razr simply looks cool (especially by 2004 standards), a fact that contributed significantly to its wide popularity.
Notable qualities: Stylish design, slim form, and a full set of features
Photo: Motorola
Apple iPhone
Year: 2007
Apple's ability to rock our world through nifty gadgets should not be underestimated. Between the Apple II, the Macintosh, and the iPod, Apple is responsible for more trend-setting consumer technology than most companies. In the same vein, the iPhone goes far beyond being just a mobile telephone: It's a powerful pocket computer, a game machine, and a multimedia-playback device. Better yet, it gives you instant, high-speed access to the Web, e-mail, Facebook, Twitter, and YouTube, wherever you can find mobile phone coverage. In short, it's a revolutionary device, and other companies are already coming up with imitators.
Notable qualities: Everything--but particularly the excellent software, the large and sharp screen, the multitouch interface, visual voicemail, the App Store... (Need I say more?)
Photo: Apple