tungwaiyip.info

home

about me

links

my software

Media

Yucatán Photos

St Lucia Photos

Photo Album

Videos

Blog

< April 2014
SuMoTuWeThFrSa
   1 2 3 4 5
6 7 8 9101112
13141516171819
20212223242526
27282930   

past articles »

Click for San Francisco, California Forecast

San Francisco, USA

 

Bliss - the picture of dreamy green hill on every Windows XP

This is the familiar picture of a rolling green hill. Most of us have seen it because it is the default background image on Windows XP. It is such a dreamy picture that I always assume it is a computer generated image.

Bliss

Turn out the scene is real. It is taken from the rolling hills not far from my home in Sonoma, California. Meet Charles O'Rear, the photographer who took this picture, and reminisce on the blissful scene that has graced many of our computer screens.

2014.04.17 comments

 

Ikea Showroom

hang hang in Ikea Showroom

This is how you really try things out in an Ikea showroom.

2014.04.15 comments

 

Walk To Work Day 2014

Today is the Walk to Work Day! Usually I go to work by bike, which takes about 15 minutes. But sure I could walk too. This is my 6 km journey to my work place in downtown. It is an 1 hour 24 minutes long walk, during which I spending plenty of time taking pictures. See my slide show here.

2014.04.11 [] - comments

 

Bill Gates was 30 years old

Here is a great interview with Bill Gates in 1986. He was 30 years old then. Microsoft was making software for personal computer, still a fairly small company and somewhat of a rebel compare to big corporate computer makers.

Bill Gates has talked at length about developing quality computer software and how a great team works. Many ideas are still relevant today. He was also very enthusiastic on the nascent CD ROM technology. Some of the cool application in his mind is like be able to look at a map of the United States, point somewhere, click, zoom in and say, “Hey, what hotels are around here?" He envision CD ROM will enable computer in competition with newspapers, books, and TV. "Every disk will have interactive games on it", the interactive nature of the device really excited him.

Windows 1.0 Windows 1.0

In the world of smartphone and tablet full capable of video and all kinds of applications, we have to step back to remind ourselves how the world was like in 1986. Windows 1.0 was a novelty then (Macintosh was released 2 years eariler). Personal computer was by and large just text based word processing and spreadsheet applications. Just seeing a picture on a computer will excite people. Computer video is probably not on anyone's horizon.

CD ROM did not turn out to take a prominent role in the history of computer development. Yet Bill Gates' vision of interactive, multimedia applications in the hand of everyone is realized and become part of our daily life today. It is really great to have a conversation back in time to see how far we have come.

2014.04.03 comments

 

In Support of Brendan Eich

I am disappointed about Eich's support of prop 8 in 2008 and I disagree with his view. But what is truly appalling is his critics is pushing for ousting him as Mozilla's CEO base on his view. Isn't people allowed to have different value? This is not even a fringe idea. Majority of votes has voted for prop 8. What is the moral to deny people the job base on their political believe? What sort of world is this when we do background check to bar 52% of voters who has supported prop 8 from employment? This is far more chilling than prop 8 itself.

Brendan Eich

People need to speak up and stop this insanity about ousting Eich. This include the LGBT community and their supporters. Yesterday their were fighting for inclusiveness and accepting people with different values. They need to walk the talk themselves, even if it means to tolerate people whose value they disagree with.

2014.03.29 comments

 

A "Kind" Country

Speaking of trafficking their poor Vietnamese girl to work illegally in Britian, an uncle says

Anywhere in Europe is good to go to. But Britain is very popular because it is a kind country, and the government there looks after people even if they have entered illegally. If they catch you and arrest you and deport you, they even give you money to help you find your feet again when you get back to Vietnam.

I think the same can be say about other societies I have lived. San Francisco and Hong Kong are both kind countries.

2014.03.27 [] - comments

 

Minimum Wage Raise and Gentrification

A poll has shown that there is a strong support for raising the minimum wage in San Francisco by 40% to $15 per hour. I feel mixed about this proposal. On the one hand I like to see most people making more money. They need it to survive in this expensive city. On the other hand, these kind of direct intervention of economic often causes unintended consequences like lower employment, or business exiting to lower cost locations. Strangely in this case I side with conservative Ron Unz's idea that higher minimum wage is a preferred alternative to the reliance on public assistance. Although it is remain to be seem how public assistance can be reduced.

I have some additional concern that a big raise in minimum wage will further intensify gentrification. It is not that the raise will help many people to become middle class, which will be a very good outcome. My concern is that it will heavily impact low end family business. The high cost structure means it will no longer make sense to serve the low end market. The only viable business is to move up market. These days Whole Foods becomes main stream. Philz coffee is bustling selling $4 coffee. On the other hand low end market diminish more and more, to the point that an unassuming dive like Tasty Restaurant actual caught my eyes. My concern is higher minimum wage will just be the final nail in the coffin for low end business.

2014.03.16 comments

 

Paul Graham on Cities and Ambition

I was rereading Paul Graham's article on Cities and Ambition. His idea is each city project a specific message to the people. The message attracts and motivates people to a specific kind of enterprise. New York is about making more money. Boston is about becoming smarter. Silicon Valley is about to become more powerful (by means of innovation). Paris was a about intellectual but today it is more about arts. This is fairly consistent with Richard Florida's thesis that location has great influence on what people do and what they could achieve.

One astute observation that Graham put forward is you don't have to live in a great city the whole life to benefit from it. Where you grew up and went to school is not so important. Instead, what matters is a critical period from the early and middle career. The example he gave is the Impressionists painters. They were born all over France and died all over France, but what defined them were the years they spent together in Paris.

I come to Silicon Valley at the age of 27, still in my early career. This has happened opportunistically. When I was younger, I have never imagined I would emigrate to a distance place. This location has indeed redefined myself. Now I am working in the forefront of technology in the cosmopolitan where innovation happens daily. Had I stay in Hong Kong past 30, the window will probably close. I would not have envisioned doing things I am doing today. Biologically I am the same person with the same capability. But I would not have the same ambition compare to the peers in the Silicon Valley.

2014.02.27 comments

 

Mathematical Intuitions

During my online course study, sometimes the instructor would say, intuitively, the reason go such as such. We spend a lot of time doing proofs that are the primary insight and knowledge. But the instructors also speak of developing an intuition on the subject. [more...]

2014.02.25 comments

 

Make Useful Charts

Having been with Bay Area Bike Share for a few month, I am glad with their green bikes available around downtown. I also appreciate Bay Area Bike Share's openness in sharing their system metrics. However the system chart on their web page do not provide much useful information. [more...]

2014.02.24 [] - comments

 

Why I Hate Whatsapp

Whatsapp's was sold for a jaw-dropping price, with more 0s than any normal people can count. I have no idea if this price is reasonable. As a user, I just want to talk about why I hate Whatsapp, as well as the entire class of mobile only proprietary messaging apps. [more...]

2014.02.21 comments

 

Honorary Retirement - Collins Dictionary Plus

I have removed the my Collins Concise Dictionary Plus from my top drawer to put it away to some other book shelves. My drawer has very little space. It is sort of prime real estate for my stuff. Since I have not really used the dictionary in the last 10 years, it does not make sense to for it take up valuable spaces. [more...]

2014.02.17 comments

 

Tech Buses Related to Violent Crime

There is a news story today about the S.F.'s 'clusters of affluence'. The headline says "Where divisive shuttles roam, affluence appears". The study come from a mapping of known tech shuttle stops overlay with map of restaurants and cafes. It shows that there is a pattern of overlapping between the two. And so here comes an Sunday article saying how tech bus form affluence clusters and fuel gentrification. [more...]

2014.02.09 comments

 

MOOC 2013 review

I have been a devotee of Coursera since it has launched in 2012. 2013 is the second year I am really engaged in online learning. I've completed 13 courses in one year alone. It is time to look back to the year. [more...]

2014.02.02 comments

 

Tokyo - City of Alleys

My impression of Tokyo, a metropolis of 13 million inhabitants, is a bustling city of glamor, high energy and endless activities. When I did a Google Street View tour, I am surprised to find Tokyo is predominately a city of low rises and narrow alleys. [more...]

2014.01.31 comments

 

Crazy Math Homework

I spent all night working on the Information Theory homework. This is getting crazy. [more...]

2014.01.30 comments

 

Python 3 is not better, I am moving back to Python 2

After Python 3.3 was released, I begin to embrace Python 3 in a big way last year. I use it in my personal projects whenever possible, when I do not have to worry about compatibility with existing code base. I use it as the default REPL everyday.

While I am not an early adopter, I am still ahead of many other Python programmers to actually make production use of it. Unfortunately, my experience so far is not favorable (note I have not used unicode string much). I ran into miscellaneous problems. At first I thought it is some learning curve I have to overcome. Slowly I come to realize some design decision are really problemetic.

Recently there are more discussions around the problems related to porting to Python 3, notably from Armin Ronacher of Flask. I want to add my experience to the discussion. Many have been written about the core issue of unicode string handling or the death of binary string. My grievance is from a different area, the systematic replacement of list result by iterators.

Iterator Blues

Iterator and generator are some of the best feature of Python. In many cases, a list is interchangeable with its corresponding iterator. When the result is large, iterator is certainly more memory efficient. If you want to loop 100 millions times, you probably don't want to build a list of 100 millions items using range, but rather use the iterator version of xrange.

Since iterators are so great, they argue, from now on Python 3 should only provide iterator result.

This turn out to be a huge annoyance for me.

For the start, when I run a function in the interactive console, I don't see the result anymore. I get an iterator object. No big deal, the Python 3 people say, you can render the result by wrapping it in the list function. Fine, it is an inconvenience, a minor inconvenience you may argue. But you just cannot spin it as a positive change. When I first starting using Python when coming from a Java background, I was delighted to find how easy thing is in Python. Why bother to build a chain of stream handler to read a file in Java? The Pythonic way is to build the entire input in memory. 95% of time the data is so small it does not matter. This was the Python magic and this is beginning to lose.

Using the list will be a tolerable workaround if it is exceptional, if it is only needed in a small number of cases. But I have bumped into the wall so many times I begin to think the reverse is more true.

Other than want to see the result in REPL, there are actually a long list of use cases of a list that cannot be conveniently expressed with iterator, like

  • building nested data structure
  • processes that need the length of the collection
  • take just one element, say the first, from the collection
  • many libraries anticipate a list rather than iterator (like numpy)

For example, I want to parse a CSV like input into a nested data structure.

In [22]: INPUT = """\
   ....: 1,2
   ....: 3,4
   ....: """.splitlines()

In [24]: [map(int, line.split(',')) for line in INPUT]
Out[24]: [<builtins.map at 0x321f270>, <builtins.map at 0x321f090>]

Ouch, I got a list of iterators instead. It used to be easy in Python 2 like this.

In [2]: [map(int, line.split(',')) for line in INPUT]
Out[2]: [[1, 2], [3, 4]]

The problem is you almost never want a nested data structure with iterators inside. When I accidentally did that, it usually causes a bug a few lines down. I have to dig hard into the data structure to find out what has done wrong.

Trying to pull a value from a dictionary gives me further insult. Sometimes I want inspect a value in a dictionary. Which one does not matter, I just need one. With Python 2, it is d.items()[0]. It will be dumb to write a for loop in Python 3 to do this. As an experienced programmer, I know I can use next(). But this gives me an exception?! How about d.items().next()? Fail. How about d.items().__next__(). It fails too. I spent hours before I found out in Python 3, d.keys() correspond not to iterkeys() but an unfamiliar viewkeys() of Python 2. To get any values, I have to first turn it into an iterator, only then can I apply next. When you apply an extra function like list once, it is an inconvenience. When you have to do it twice or more, it becomes a big clutter and big annoyance.

Python 3 renders the map function nearly useless because of the extra list needed. In Python 2, we often have two alternative to express a similar construct, with the map function or list comprehension. Usually I choose map when there is a function readily available, like int in my example above. But because of the extra clutter of list needed with map, the balance has tipped toward list comprehension decisively in Python 3. I should be thankful because they could have remove the list comprehension too and force me to use generator expressions and list.

The bottom line is this change is strictly feature removal. With Unicode, it is a necessary pain to go through and we gain a predictable unicode handling as a bargain. With iterator, there is no new feature to be gain. Existing code are broken for nothing. All the Python 3 people tell you is just to wrap you function with a list, no big deal.

Enough to say I am not convinced. To me this is torture.

Feature Removal Pain

Just a few days ago I was bitten by another feature removal issue. The sort method used to have a cmp feature that's removed in Python. Oh, it is dumb to use cmp anyway because the implementation using key is faster. Except in my case, I was working on a bioinformatics problem that required sorting all suffix substring of a long string. With a string that's millions of characters long, generating millions of substrings quickly exhaust all memory. This trick is to use cmp to generate and compare the substrings on demand. This may be slower, but it works. Removing cmp not only cause inconvenience, the algorithm breaks with no easy workaround.

I solved the problem by going back to Python 2.

Python 3 is the dead end

The official story line is Python 2 is a dead end. Python 3 is the future. I begin to see it differently. Python 2 is actually alive and well. The development of the language and the interpreter has stalled. But innovation continues in third party library and tools. For example, Pandas is a big progress for Python in the data analysis space.

It is Python 3 we should worry about. I fear it would become a facto dead end because of lack of adoption. Outside of my personal use, there are absolutely no proposal from my workplace about moving to Python 3. Two companies and hundred of programmers I have worked with recently are cranking out Python 2 code everyday, not Python 3. At various time I was considering to championing Python 3 at work. I am not considering this anymore in the near future.

Sorry for the critical opinion. I just wish to open up some honest discussion about the merit of Python 3.

2014.01.23 [] - comments

 

Family Snapshot (infrared)

Snapshot of us in infrared. Taken from Exploratorim. [more...]

2014.01.13 comments

 

Homeless in San Francisco

The Chronicle run another story on homeless congregate around the city hall, a familiar story that has perhaps intensified, dashing the hope that the recent economic boom could perhaps alleviate the situation. [more...]

2014.01.12 comments

 

Webkit based Opera

Earlier this year Opera has announced they will abandon their render engine and move to Webkit. As a long time Opera fans, I am very ambivalent about this. [more...]

2013.12.26 comments

 

past articles »

 

BBC News

 

'Two months' for Korea ferry salvage (19 Apr 2014)

 

Ukraine calls Easter truce in east (19 Apr 2014)

 

Plane search at 'critical juncture' (19 Apr 2014)

 

Syria-held French journalists freed (19 Apr 2014)

 

Obama signs UN envoy visa ban law (18 Apr 2014)

 

Al-Qaeda suspects killed in Yemen (19 Apr 2014)

 

Pope leads Good Friday services (18 Apr 2014)

 

Three missing in Everest avalanche (19 Apr 2014)

 

UN outrage at South Sudan attack (19 Apr 2014)

 

Mexico shaken by powerful earthquake (19 Apr 2014)

more »

 

Slashdot News for nerds, stuff that matters

 

Declassified Papers Hint US Uranium May Have Ended Up In Israeli Arms (2014-04-19T13:35:00Z)

 

For , Build a VR Headset For Your Smartphone (2014-04-19T12:31:00Z)

 

Microsoft Plans Billion Server Farm In Iowa (2014-04-19T09:43:00Z)

 

DARPA Developing the Ultimate Auto-Pilot Software (2014-04-19T06:51:00Z)

 

SpaceX Launches Load to ISS, Successfully Tests Falcon 9 Over Water (2014-04-19T04:00:00Z)

 

SpaceX Lands Launches Load to ISS, Successfully Tests Falcon 9 Over Water (2014-04-19T04:00:00Z)

 

Bookies Predict the Future of Tech (2014-04-19T00:52:00Z)

 

Minerva CEO Details His High-Tech Plan To Disrupt Universities (2014-04-18T23:32:00Z)

more »

 

TechPsychic Tech Rumors and Invented News

more »

 

SF Gate

 

Bay Area News (7 Jan 2012)

 

City Insider (11 Feb 2012)

 

Crime Scene (13 Feb 2012)

 

C.W Newius Column (10 Jan 2012)

 

C.W. Nevius Blog (11 Feb 2012)

 

Education News (10 Jan 2012)

 

KALW (11 Feb 2012)

 

Matier and Ross Blog (11 Feb 2012)

 

Startups get most venture funding since 2001 (19 Apr 2014)

 

Ship traffic for April 19 (19 Apr 2014)

 

Bloomberg briefing (19 Apr 2014)

 

Why you'll share this article (or not) (19 Apr 2014)

 

Find Facebook friends who are nearby with new feature (19 Apr 2014)

 

UberX passengers to pay 'safe rides fee' (19 Apr 2014)

more »

 

Asia Times Online

 

Asia bucks military spending decline (15 Apr 2014)

 

Breaking bad in southern NATOstan (15 Apr 2014)

 

US veterans promote 'right to heal' (15 Apr 2014)

 

New China-India era no shoo-in under Modi (15 Apr 2014)

 

Doubts cloud China's urbanization drive (15 Apr 2014)

 

CREDIT BUBBLE BULLETIN Financial stability (15 Apr 2014)

more »

 


Site feed Updated: 2014-Apr-19 07:00