tungwaiyip.info

home

about me

links

my software

Media

Yucatán Photos

St Lucia Photos

Photo Album

Videos

Blog

< May 2012
SuMoTuWeThFrSa
   1 2 3 4 5
6 7 8 9101112
13141516171819
20212223242526
2728293031  

past articles »

Click for San Francisco, California Forecast

San Francisco, USA

 

Forget About The Fog. Bring Sunglasses, Sunscreen When You Visit San Francisco

Dolores Park on Sunday is perfect. The beautiful sunshine, the gorgeous view to the downtown, the newly completed children playground swarming with running kids. Everyone is having a blast. What a lovely day it is!

Dolores Park

Dolores park (Jamison Wieser)

The only issue, ouch! Barely an hour under the sun is enough to get me sunburn. I know. I should have put on sunscreen. I have a tube with me but I just didn't expect such short exposure will do me any harm. This is a mistake I would have made many times.

But where is the San Francisco fog? The weather condition that the city is so well known for? A city shrouded in dense and cool fog. Foghorn blows the deep and the ghostly sight of cargo ship slowly emerge from the mist. The reputation of San Francisco fog spread so far that sometime visitors would ask for advice to plan around fog. How should they prepare themselves in the foggy weather. Bring umbrella? Trench coat? This is good for building up film noir atmosphere, but what you need in San Francisco is actually sunglasses and sunscreen.

As it turns out, San Francisco is one of the most sunny city in United States. It is not my wishful thinking. It is sunny according to meteorologists' statistics. 160 sunny days a year put it among the top most sunny cities. It even ranks favorably to the sunshine state of Florida, which is actually rather cloudy.

But what about the fog that engulf the city so often? It is of course no illusion. We residents experience it regularly. People who knows about San Francisco may point out to the effect of microclimate. Areas close to each other may experience dramatically different climate due to different geographic features like hills and valley. In general it means the coastal side is far more foggy than the bay side. To a visitor, it means Golden Gate Bridge and Golden Gate Park can be quite foggy, while Union Square, Embarcadero and the gorgeous Dolores Park are a lot less susceptible.

The microclimate explains some of the paradox. But what if I say the west side is also rather sunny? You may laugh at me really hard for saying this. That's pretty much people's response when the city of San Francisco announce plan to build a major solar power system on top of the Sunset Reservoir a few years ago. Everyone knows it is foggy in the Sunset district. To build a solar system there sounds so absurd that it is widely ridiculed. But wouldn't a professional solar developer have better idea then people who make judgment base on gut feeling? Indeed fog does not come all day to Sunset and it does get quite a bit of sun. According to the developer Recurrent Energy, the solar resource in Sunset is on average only 15% lower than the sunniest areas of the City and is consider quite good. With this solar power installation, it more than triple the energy San Francisco generate from the sun.

Sunset Reservoir Solar System

Sunset Reservoir Solar System (Recurrent Energy)

To make sense of the fog city so sunny paradox, it helps to understand a common bias known as base rate fallacy. Scientists find that people have a tendency, when making judgments of the probability with which an event will occur, to ignore the base rate and to concentrate on other specific information. Overall fog is a rather infrequent phenomenon. But the specific attribute of San Francisco's fogginess affect people's judgment more than the general base rate. To give another example, if city A hails 30 times a year, you will be right to consider it far more prone to hail than other cities. So how likely is it going to hail next Monday? Some people maybe tricked to think it is quite likely. They ignored the fact that hail is a rare phenomenon and even hail prone city A has 326 hail free days.

Let's not get distracted. Meteorologists say San Francisco is a sunny city. Bring sunglasses and sunscreen to enjoy your the visit. Don't get sunburnt like me.

2012.05.07 [] - comments

 

&D\anger'"+<b>@?!mb Against Code Injection

I have to build my web app against code injection. I find that the problem requires us to see input string used in several different context.

  • In HTML/XML as text.
  • In HTML/XML as an attribute inside the quote.
  • In URL as query parameter.
  • In JavaScript to dynamically create or edit DOM elements.

In each context, there are different rule in escaping them. Since the data can move from one context to another, they have to be properly escaped in all cases.

To help test for proper escaping, I have come up with a string that has lots of special characters below. Put it in your test database and paste it in your input fields. Observe if this causes problem anywhere. In properly escaped system, the string should be transfered and reconstructed verbatim.

  &D\anger'"+<b>@?!mb

A related issue is whether your code support unicode correctly. I find it helpful to insert a string below into the test data to test it out right from the beginning.

  \u4e09\u570b\u5fd7 or
  三國志

2012.05.01 [] - comments

 

The Last of Doyle Drive

The Last of Doyle Drive

The Doyle Drive demolition starts on Friday night. By Sunday morning the old viaduct is already reduced to toppled piles. The replacement Presidio parkway looks great by the way.

2012.04.29 [] - comments

 

讀道德經

讀完老子《道德經》的全文。我的古文水平麻麻,為何突然要讀這部道家經典呢?事緣我無意發現陳鼓應《老莊新論》一書,書中他用西方哲學概念來分析道家哲學。我從前對中國哲學不是不明白就是沒有興趣,但是用他的角度來理解古人思想,令我恍然大悟,對道學另眼相看。《老莊新論》是討論老莊經典的書,我從未讀過老子,只從書中引述的章節間接接觸原著,有隔靴搔癢的感覺。《道德經》不過5000多字,於是決定一鼓作氣,不管自己文化根底有限,發力將原著連同評論一併讀完。讀後覺得甚有得著,所以在此把學到的紀錄一下。

未開始前我先得交代慚愧的事,《老莊新論》是我1996年買的。那時興致勃勃,一直想一有時間就會讀。這樣等著等著,書一直擱在書架上,轉眼竟然擱了15年!今日才終於開卷,算是未為晚也吧。

Laozi Word Cloud

道德經 Word Cloud
www.tagxedo.com

老子所說的「道德」和平常用語指的道德倫理有所不同,「道」是指老子以為的宇宙規律。陳鼓應對老子思想有很清晰的概論:

「老子哲學的特異處,就在於突破了(中國哲學)這一局限,把人類思考的範圍,由人生擴展到整個宇宙。他看人生種種問題,乃從宏觀出發,而又能微觀地作多面的審視。
老子的整個哲學系統的發展,可以說是由宇宙論伸展到人生論,再由人生論延伸到政治論。然而,如果我們了解老子思想形成的真正動機,我們當可知道他的形上學只是為了應合人生與政治的要求而建立的。」

老子哲學的最重要觀念為「自然無為」,「虛靜」和「柔弱」。我相信從古至今,他的思想都是反主流的,被評為是消極和逃避的。因為世人多用主流觀念來評價道學,而要真正理解它是必須超越平常思想的局限。《老莊新論》所做到的就是開放眼界,引導我們用新思維來理解道家學說。

老子認為任何事物都應順應它自身的情況去發展,不必以外界的意志去制約它。他從觀察山水萬物的發展得出這樣的結論,而我就從現代科學的認識來印證他的哲學。科學令我體會到自然是如何偉大,而人為意志的是如何渺小,這正是符合老子所提倡「自然無為」的概念。Complexity Science對我影響尤甚,用complex system的方法來分析各種事物,無論是氣候、生物、社會組織等均可見這些系統是如何奧妙,要用人力控制殊不容易。生命就是一個極奇妙的complex system,如何由基因發展成人,我們所知的還是很少,但每一項新的科學發現都令我們更欣賞自然的奧妙。一般人以為有病看醫生就是請醫生檢查,吃藥然後得以復原。然而醫學界對藥物之類的療法有個術語叫Medical Intervention,即是用醫藥科技來干擾人體。用干擾一詞是強調醫藥治療是不自然,可能會付出代價的。如果身體出了大問題不得已才用科技來干擾它,要是小事就寧可不去干擾了。小兒幾次傷風感冒看醫生,醫生檢查過認為無大礙,就叫回家休息行了,亦沒有下藥。這不是因為醫生不盡力,而是他明瞭自然的免疫系統才是療病的最大功臣。與其去干擾它,不如臥床養病,讓免疫系統自然地發揮功能為上。這就是老子「無為而無不為」的意思。

在日常生活當中有很多可以應用道學的地方,譬如我覺得做父母也應該「無為」一點。現代父母是太緊張孩子的發展了,為了孩子成功事事主動幫忙。但是孩子每次遇到困難有大人幫忙,不是害他失去學習機會,將來養成依賴的性格嗎?我有時嫌小孩做事太慢或者搞得太亂想幫手,想來也應該克制下。無為並不是不管教的意思,而是認識每個孩子都有潛在能力,父母應做的是消取障礙讓他們有嘗試的機會,過份干預反而會壓抑自然發展。最理想是做到「我無為,而民自化」,不用刻意教導而使孩子自己摸索出道理。

陳鼓應在篇末對老子作出一連串批評,譬如老子常用類比法(analogy)來建構論據,邏輯甚為脆弱。我覺得他的批評十分中肯,而這反而更能令我接納道家哲學。正是因為這些批評,解除了要以他作為古代聖賢,要全面擁戴的束縛。老子固然是開創了道學的偉人,但古人的思想用今日的科學邏輯標準來看自然是錯漏百出。讀書不能一字不漏照單全收,而是要批判地過濾不適用的部分以提取有用的精華。

譬如老子說人應該「柔弱不爭」,大家一定覺得這是很蠢的,是退縮和不長進的做法,在這強調競爭的社會根本是不可行的。那麼我們就靈活一點好了,不要單純地天天不爭,事事不爭。另一方面大家可曾細心留意過自己或者身邊的人常執著於無謂的爭執呢?有時是爭持不下,有時是勝了一仗,但雙方從此結怨,以後得不償失。這正是採納「不爭」思想的良機。不作無謂的鬥爭並不是消極被動,而是走出困局,開創新局面的靈機。

我是因為老子的批評而更接納它,這不是道學認為萬物皆有反面的例證嗎?

2012.04.25 [] - comments

 

OnTrak Journal

38 Geary

I have started a new blog as a journal to the work I'm doing in the OnTrak project to analysis public transit information. I'm making progress slowly but it is surely a fun project.

2012.04.20 [] - comments

 

Learning Journal - Presbyopia

Unfortunately I seems to start to suffer from this.

Presbyopia is a condition in which the lens of the eye loses its ability to focus, making it difficult to see objects up close.

2012.04.17 [] - comments

 

Learning Journal - Personal Fable

This is my new experiment. I'm taking short note on things I've learned. The first entry is personal fable.

Personal fable - a term coined by David Elkind (1967) that is used in psychology to describe a form of egocentrism normally exhibited during early adolescence, and it is characterized by an over-differentiating of one's experiences and feelings from others to the point of assuming those experiences are unique from those of others. A person might believe that they are the only one who can experience whatever feelings of joy, horror, misery, or confusion they might encounter.

2012.03.24 [] - comments

 

Census of Children Population in San Francisco (2nd trial)

I just realize the chart I have made for on the census data of San Francisco's children was done badly. Here is my second trial. I thing this should be more clear. The key take away is San Francisco lost a big percentage of children in the 0-5 group after 5 years, but not so much on the older age group.

census children population

census children population percentage

2012.03.09 [] - comments

 

Fanny and Alexander

This is a continuation of the my 7 great movie series that I thought I will do in a week. It really takes much longer. But as least the movies are good. And I think that's what really matters! [more...]

2012.03.08 [] - comments

 

Hang Hang and Mammy on TV

Hang Hang and mammy got on ABC news tonight. They show up at 1:21 in the video when the narrator says "mothers bundle up their babys". The shoot lasted for a grand total of, well, 2 seconds. Next time we will work on having some actual dialog :) [more...]

2012.01.17 [] - comments

 

Atonement

Atonement is one melancholy film that captivates me. It opens in the Tallis castle. Cecilla and Briony, the aristocrat sisters, both have a crush on the house keeper's son Robbie. When the disenchanted young girl Briony made a false statement against Robbie, she did not know her action will bring ruin to Robbie and cause him to be convicted of a crime that he did not commit. [more...]

2011.12.25 [] - comments

 

Home Power Usage

I have bought the Kill A Watt meter a while back. I went on to measure every gadget and applicances I can possibly measure. Here is some result to share. [more...]

2011.12.24 [] - comments

 

Rivers And Tides

River and Tides

Sinuous rivers, pods make of rock slabs, a circular hole, these are some of the recurring forms artists Andy Goldsworthy use in his sculptures. He create his arts inspired and situated in a natural setting. They are often ephemeral. A string of flower petals flowing down the stream, driftwood on the beach to be washed away by rising tides, ice that is going to vanish without a trace. They may seem impermanent. And yet it perfectly symbolize the flow of the nature. In this documentary you will see the creation of many works by Andy Goldsworthy. They are really very inspiring. [more...]

2011.12.23 [] - comments

 

Snow Park

Snow Park

We have much fun in the snow park in civic center this afternoon. There are sled ride for the kids. They can make snow man in a patch of artificial snow. Like a typical day of activity, kids are tireless, parents are tired. [more...]

2011.12.18 [] - comments

 

Book Reading Statistics

The Kindler e-reader I got one year ago has sparked a major book reading drive for me. At the end of 2011, I have completed 35 books in a span of 15 months. The full list of book is compiled in the entries of Apr, Aug, Nov, Dec. [more...]

2011.12.17 [] - comments

 

2011-12 Reading List

I have finished 5 more books in my last push in 2011. Many of them are short books however. [more...]

2011.12.15 [] - comments

 

CAHSR - Hard times are the right time

Public support for California's high-speed rail project is eroding. The main concern: How can we embark on construction of an infrastructure project of this magnitude in a time of economic difficulty? [more...]

2011.12.13 [] - comments

 

 

Solve Puzzle While You Are Sleeping

Monday my colleague reports severe a problem in our test system. It was my fault. I checked in an incomplete work into our system last Monday. What I don't understand is why no QA or customer report this for an entire week. Nevertheless I fixed it right away. [more...]

2011.11.29 [, ] - comments

 

I Love Holiday Weekend

The roads are clear. Parking is easy to find. I walk into restaurants without waiting in line. Crowds thin out as everybody left town. Those of us who stay enjoy a much quieter town. [more...]

2011.11.27 [] - comments

 

past articles »

 

Kontagent

Kontagent is hiring software engineers

BBC News

 

Facebook shares spike on debut (18 May 2012)

 

Merkel 'suggests Greek euro vote' (18 May 2012)

 

Inside world's ‘priciest house’ (18 May 2012)

 

World royals mark Diamond Jubilee (18 May 2012)

 

Syria protests 'grip Aleppo city' (18 May 2012)

 

UN nuclear chief to visit Iran (18 May 2012)

 

Protesters angered by Gulf union (18 May 2012)

 

Market jitters over eurozone woes (18 May 2012)

 

Malawi 'to overturn ban on gays' (18 May 2012)

 

ANC to sue over painting of Zuma (18 May 2012)

more »

 

Slashdot News for nerds, stuff that matters

 

Wozniak's Original System Description of the Apple ][ (2012-05-18T20:52:00+00:00)

 

Book Review: Elementary Information Security (2012-05-18T20:31:00+00:00)

 

How NASA and SpaceX Get Along Together (2012-05-18T19:50:00+00:00)

 

The Nearest Supernova Candidate To Earth: IK Pegasi (2012-05-18T19:07:00+00:00)

 

Curt Shilling's 38 Studios Struggling Financially (2012-05-18T18:46:00+00:00)

 

Facebook IPO Stumbles Out of the Gate (2012-05-18T18:25:00+00:00)

 

Cops' Warrantless Cell Phone Tracking Now Better Than GPS (2012-05-18T17:42:00+00:00)

 

Diesel-Like Engine Could Boost Fuel Economy By 50% (2012-05-18T17:01:00+00:00)

more »

 

TechPsychic Tech Rumors and Invented News

 

TechPsychic: AT&T: more money, says it's disruptive in funding from. (08 May 2010)

 

TechPsychic: I know that Apple is close to Apple Dominates, Hires ex-Googler - Yes, Android phones. (08 May 2010)

 

TechPsychic: AT&T says: Facebook Connect. (08 May 2010)

 

TechPsychic: Google's Nexus One of Google Chrome Release Adds Support subscriptions accounted for Amazon: Apple. (08 May 2010)

 

TechPsychic: Another stat: Twitter's Design of this is giving rise of BlackBerry Foursquare Map App store end. (07 May 2010)

 

TechPsychic: Like educational sales Up around Apple iPad makes money Plan costs half an Apple. (07 May 2010)

 

TechPsychic: Instead added extensions, social Networks than double, everyone jumps in Silicon Valley? (07 May 2010)

 

TechPsychic: So why iTunes App lets Social Networks Verizon Wireless Internet. (07 May 2010)

more »

 

SF Gate

 

Lawyer arrested in Dublin bicyclist's hit-run death (2012-05-18T18:38:57PDT)

 

Small state police force loads up on overtime (2012-05-18T18:38:57PDT)

 

Presented By: (18 May 2012)

 

Sunday's partial solar eclipse is only the start (2012-05-18T18:38:57PDT)

 

Woman killed, 2 others hurt in Berkeley wreck (2012-05-18T18:38:57PDT)

 

Renovated Victorian in Eureka Valley with views (2012-05-18T18:38:57PDT)

 

9/11 families upset over ground zero museum delays (2012-05-18T18:38:57PDT)

 

Largest protests yet in Syrian city of Aleppo (2012-05-18T18:38:57PDT)

 

Hewlett-Packard considers cutting 25,000 jobs (2012-05-18T18:42:24PDT)

 

Minute Maid wins 'Pomegranate Blueberry' case (2012-05-18T18:42:24PDT)

 

Romney, GOP guvs have differing takes on economy (2012-05-18T18:42:24PDT)

 

Sales for US print, electronic books up overseas (2012-05-18T18:42:24PDT)

 

Presented By: (18 May 2012)

 

Weekly US oil, gas rig count up by 12 to 1,986 (2012-05-18T18:42:24PDT)

more »

 

Asia Times Online

 

Riddle of the Scarborough Shoals (18 May 2012)

 

THE ROVING EYE : NATO occupies sweet home Chicago (18 May 2012)

 

US Iran hawks in some disarray (18 May 2012)

 

Tehran: To talk or not to talk (18 May 2012)

 

The 'illogic' of China's North Korea policy (18 May 2012)

 

BOOK REVIEW : Cherry-picking from China's success (18 May 2012)

 

SPEAKING FREELY : Nepal's constitution: Respect the dissenters (18 May 2012)

 

China's start-ups hold global potential (18 May 2012)

 

US gives green light to investment in Myanmar (18 May 2012)

 

IT WORLD : Facebook floats (18 May 2012)

more »

 


Site feed Updated: 2012-May-18 14:00