Skip to main content

Posts

Daniel Day-Lewis, the top performance of 2007

Top 100+ performance on big screen in 2007 is Daniel Day-Lewis in " There Will Be Blood (2007/08) " Casey Affleck in " The Assassination of Jesse James by the Coward Robert Ford (2007) " Marion Cotillard in " La Vie en Rose (2007) " Carice van Houten in " Black Book (2006/07) " Anamaria Marinca in " 4 Months, 3 Weeks, 2 Days (2007) " Brad Pitt in " The Assassination of Jesse James by the Coward Robert Ford (2007) " Javier Bardem in " No Country for Old Men (2007) " Ulrich Mühe in " The Lives of Others (2006/07) " Tang Wei in " Lust, Caution (2007) " Amy Ryan in " Gone Baby Gone (2007) " Complete list...

4-states state machine for CSV parsing

Parsing CSV file is easy, it's nothing but splitting string with comma delimiter, which can be easily done in Java... The first thing came to my mind when I'm about to parse CSV file in Java is just like that. Now, reality is that following examples are all possible valid lines in a CSV file 1,Bender 2,"Bender" 3,"Bender, Bending" 4,"Ben""d""er" 5, Ben"der 6, Ben""der Line 7 might be arguable but anyway, two basic rules are If there's comma in field, use double quot to wrap field, otherwise double quot wrapper isn't required. Inside double quot, double quot is used to escape double quot. Suddenly the problem is complicated to something more than string splitting, however it can be simplified into a finite state machine with 4 states. States: 1. Ready for new field (initial state) 2. Field without double quot 3. Field with double quot 4. Escaping or end of double quot Transitions *Direction*|*Condition*|*Ac...

Guess a number (Find the floor in building that breaks egg)

Question I have a integer number M in my mind, a number between 1 and N where N is a big number. Chances for M to be any integer between 1 and N are the same. A friend tries to guess this number by asking me to compare M with another number, and I'll answer "your number is bigger", "smaller" or "correct". Another constraint is, his number can be bigger than or equal to M for up to 2 times. What is the strategy to figure out M with least questions? A variation of this question is, in a N stories building, with 2 eggs, find the lowest floor from where egg breaks when it drops to ground. Example answers With only one egg, I can try the 1st floor, the 2nd, 3rd ... until the egg break. This strategy works but it's the worst. Improved answer is, try 2, 4, 6, 8...until one egg breaks. Then use the other egg figure out answer. Or, try 10, 20, 30, 40.... If egg breaks on 60, try 51, 52, 53... This is slightly better than previous answer, but might not be th...

Rattlesnake Lake

Enjoying the beauty of Rattlesnake Lake doesn't require strenuous hiking at all, the lake is right beside the parking lot. With extra 4-mile easy hiking, people can also find stunning mountain view from the summit of Rattlesnake Ridge.

Cenqua Acquired by Atlassian

Received a mail from cenqua recently: 1 August, 2007 : Today we’re announcing the acquisition of Cenqua! There is a lot of synergy and similarities between Cenqua and Atlassian, from our business models to the philosophy behind our development, so the merging of the two companies makes a lot of sense. While plugins already exist to connect JIRA and FishEye and Bamboo and Clover , we will be building tighter integrations between all the products. ... Details

23 prisoners problem, brutal solution and analysis

Problem abstract 23 prisoners are going to be sent to isolated 23 cells and in each day, the guard will randomly pick one of them and have him change the status(either on or off) of one of two switches(switch A and B). The guard promises that if one day the prisoner he picks looks at the two switch, confidently tells that all 23 prisoners have been picked in past and it's truth, then all prisoners are set free. If the prisoner is wrong, game is over and they stay in prison for ever. Before the game begins, 23 prisoners have one chance to sit together and figure out a strategy to go free. ( Detailed version ) Quick analysis Since each prison HAS TO change one of the switch, his decision is not "which combination to change to", but "which switch to turn". Therefore his decision is only one out of two: changing switch A vs. changing switch B. The information that two switches can contribute is 2 bit a time. At any given moment, for a prisoner to tell if everyone ha...

Upgrade to Ubuntu 7.04, Feisty Fawn

Ubuntu 7.04, "Feisty Fawn" is the latest stable release of Ubutun Linux distro. Although the Ubuntu community doesn't support direct upgrade from 6.06 (Breezy) to 7.04, re-installation isn't that scary if your personal data is stored in separated partition. Only a few fundamental mount points like root, /usr, /var and /boot, need to be formatted during re-installation. Feature list User review