Skip to main content

Posts

Showing posts from April, 2008

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...