10/28/2015
Read the blog,
http://fisherlei.blogspot.ca/2015/10/leetcode-different-ways-to-add.html
http://blog.csdn.net/guanzhongshan/article/details/48086695
and write C# code, compile it, build it, pass online judge, check in Github, and then, write a new code using memorization.
1. First step, write down C# code, compile ok.
https://github.com/jianminchen/Leetcode_C-/blob/master/241DifferentWaysToAddParentheses.cs
2. Read the most popular blog about this leetcode question through Google,
http://blog.csdn.net/sbitswc/article/details/48546421
and then, take Java code as a sample, write C# version of implementation.
https://github.com/jianminchen/Leetcode_C-/blob/master/241DifferentWaysToAddParentheses_B.cs
read the leetcode string algorithms blog (A plus):
http://blog.csdn.net/sbitswc/article/details/20429853
The leetcode question 241 is just a medium question in difficulties.
Dec. 17, 2015
Review the solution, and then, need to write down the solution - a script to help solve the problem:
1. 1+2*3
-> read a substring from leftmost to convert it to number, for the example, read '1', integer 1, and then, visit '+' stop,
-> now, let us use recursive function call to get the first part of substring before '+', and get second part of substring after '+', and then, two lists, each one of list1 will operate '+' with each one of list2, add into return list.
Not convincing, try again:
use binary tree to model this problem:
http://juliachencoding.blogspot.ca/2015/12/oo-principle-solid-open-close-principle.html
So, get the root node - operator, and then, deal with left child, right child, and root node does the evaluate function.
From January 2015, she started to practice leetcode questions; she trains herself to stay focus, develops "muscle" memory when she practices those questions one by one. 2015年初, Julia开始参与做Leetcode, 开通自己第一个博客. 刷Leet code的题目, 她看了很多的代码, 每个人那学一点, 也开通Github, 发表自己的代码, 尝试写自己的一些体会. She learns from her favorite sports – tennis, 10,000 serves practice builds up good memory for a great serve. Just keep going. Hard work beats talent when talent fails to work hard.
Wednesday, October 28, 2015
Monday, October 26, 2015
Back to leetcode code algorithms
10/26/2015
Spent 2 weeks vacation in China from Oct. 2 - Oct. 16.
Enjoyed the tennis practice in the city of yichun, jiangxi province, and also the Rolex tennis Master, 2015 in Shanghai.
Start to read blogs about leetcode algorithms in the evening, back to training and practice. My favorite blogs to read tonight.
http://fisherlei.blogspot.ca/2015/10/leetcode-product-of-array-except-self.html
http://fisherlei.blogspot.ca/2015/10/leetcode-different-ways-to-add.html
http://fisherlei.blogspot.ca/2015/10/leetcode-valid-anagram-solution.html
Read 6 more blogs from the above blog.
Spent 2 weeks vacation in China from Oct. 2 - Oct. 16.
Enjoyed the tennis practice in the city of yichun, jiangxi province, and also the Rolex tennis Master, 2015 in Shanghai.
Start to read blogs about leetcode algorithms in the evening, back to training and practice. My favorite blogs to read tonight.
http://fisherlei.blogspot.ca/2015/10/leetcode-product-of-array-except-self.html
http://fisherlei.blogspot.ca/2015/10/leetcode-different-ways-to-add.html
http://fisherlei.blogspot.ca/2015/10/leetcode-valid-anagram-solution.html
Read 6 more blogs from the above blog.
Sunday, October 25, 2015
reading time on Sunday - housing issue, health issue, problem solving
10/25/2015
Spent time to watch the video on this Sunday.
Learn how billionaire educate their kids, what philosophy they hold, I do not
have money but I definitely like the wisdom. Enjoy the perfect English and
forget my concerns about money, Vancouver and all other things.
Enjoy reading, and also
find interesting things to read.
10/28/2015
Melinda Gates - talk about puzzle, nonprofit, problem solving in general
Personal story to help parents to do rental business - so encouraging me to work hard as well - start from small business.
Personal story to help parents to do rental business - so encouraging me to work hard as well - start from small business.
Melinda French Gates: What nonprofits can learn from Coca-Cola
https://www.youtube.com/watch?v=GlUS6KE67Vs
10/31/2015
https://engineering.pinterest.com/blog/discover-pinterest-search-and-discovery
read linkedin profile about site reliability engineer work experience
https://www.linkedin.com/profile/view?id=AAEAAAAxOf0BLtv8Mfz6NXAfym0v5adk35-sCV4&authType=name&authToken=EWTR&trk=prof-sb-browse_map-name
Building Pinterest's Mobile Apps ()
http://www.infoq.com/presentations/pinterest-app
https://engineering.pinterest.com/tech-talks
How we've scaled dropbox
https://www.youtube.com/watch?v=PE4gwstWhmc
Discover Pinterest: Mobile Engineering and Design
https://www.youtube.com/watch?v=wzRyTmBxs7Y#t=63m24s
1:10/1:35
Nags - Nag placement, Home view placement, Pin Tutorial Card
Further reading Nov. 3, 2015
Responsive Web Design: Relying Too Much on Screen Size
http://www.lukew.com/ff/entry.asp?1816http://www.lukew.com/presos/
Nov. 6, 2015
Discover Pinterest: Search and Discovery
https://www.youtube.com/watch?v=f_JeAEBxpUs
Read the article
Venture Beat article.
http://venturebeat.com/2015/05/28/pinterest-improves-related-pins-with-deep-learning-plans-product-recommendations-using-object-recognition/
Nov. 7, 2015
Google I/O 2012 - SQL vs NoSQL: Battle of the Backends
https://www.youtube.com/watch?v=rRoy6I4gKWU
Julia spent time to learn NoSQL, and got some basic ideas using NoSQL.
12:46pm
Google I/O 2012 - Building Mobile App Engine Backends for Android, IOS and the Web
https://www.youtube.com/watch?v=NU_wNR_UUn4
Google I/O 2011: HTML5 versus Android: Apps or Web for Mobile Development?
https://www.youtube.com/watch?v=4f2Zky_YyyQO'Reilly Webcast: Building Mobile HTML5 Apps in Hours, Not Days
https://www.youtube.com/watch?v=G0UC-C2Y7MEStudy notes - "The clean code talks - 'Global State and Singletons' "
10/25/2015
Google talks:
The clean code talks - "Global State and Singletons"
https://www.youtube.com/watch?v=-FRm3VPhseI
Global state:
Julia tries to understand global state in this talk:
Run same thing a multiple time, will get different test results;
5:40/54:08
A. Multiple Executions can product different results
1. Flakiness
2. Order of tests matters
3. Can not run test in parallel
B. Unbounded location of state
C. Hidden Global State in JVM
1. System.currentTime()
2. new Date()
3. Math.random()
D. Testing above code is hard
1. Therefore inject in doubles
8:49/54:08
Singleton: Good vs Bad
1. Application Global vs. JVM Global
2. Usually we have one application per JVM
A. Hence we incorreclty assume that:
Application Global state = JVM Global
3. Each test is a different configuration of a portion of our application
19:01/54:08
Deceptive API
1. API that lies about what it needs
2. Spooky action at a distance
Julia's comment, the talk is interesting and worth time to watch again later.
Google talks:
The clean code talks - "Global State and Singletons"
https://www.youtube.com/watch?v=-FRm3VPhseI
Global state:
Julia tries to understand global state in this talk:
Run same thing a multiple time, will get different test results;
5:40/54:08
A. Multiple Executions can product different results
1. Flakiness
2. Order of tests matters
3. Can not run test in parallel
B. Unbounded location of state
C. Hidden Global State in JVM
1. System.currentTime()
2. new Date()
3. Math.random()
D. Testing above code is hard
1. Therefore inject in doubles
8:49/54:08
Singleton: Good vs Bad
1. Application Global vs. JVM Global
2. Usually we have one application per JVM
A. Hence we incorreclty assume that:
Application Global state = JVM Global
3. Each test is a different configuration of a portion of our application
19:01/54:08
Deceptive API
1. API that lies about what it needs
2. Spooky action at a distance
Julia's comment, the talk is interesting and worth time to watch again later.
The clean code talks - unit testing
10/25/2015
Watch the google talk "The clean code talks - unit testing", write down notes and then learn better for next time.
video link:
https://www.youtube.com/watch?v=wEhu57pih5w
Video time:
02:02 / 32:07
Hard to test code
Most People say:
Make things private
Using final keyword
Long methods
Real issues: (interview questions)
Mixing new with logic
Work in constructor
Global state
Singleton
Static Methods (procedure programming) (leaf method vs way-up method)
Deep inheritance (Divorce myself from inheritance at run time. )
Too many conditionals ()
Procedure code - Seam - Polymorphism - Julia's comment: look into it, read more about it. 10/25/2015
Video time:
14:35/32:07
Progression of Testing:
1. Scenario / Large Tests
Test whole applicatio by prentending to be a user
slow / Flaky / Mostly happy paths
2. Functional / Medium Tests
External dependencies simulated
Test class interaction
3. Unit / Small Tests
Focus on application logic
Very Fast / No I/O / No Need for a debugger
4. Think of it more as a continuum than discrete
5. All tests levels important
Not all levels have the same probability of a bug
Because smaller tests cover less need more of them
6. Testability more important as you get more focused
Video time:
17:05 /32:07
Different kinds of Tests
Execution time :
unit test -> Functional Tests -> Scenario
Test individual ->
Test collections of classes as subsytems ->
Test the whole system pretending to be a user
Video time:
27:06/32:07
How do you write hard to test code?
You mix object creation code with business logic
This will assure that a test case never can construct a graph of objects different from production. Hence nothing can be tested in isolation.
Unit test class -
Seam - friendly - try to understand the dependency injection
class depends on a lot of other classes, mocking, seam, learned through hacking,
class:
object graph
construction & lookup
business logic
27:36/32:07
Take Away
Unit tests are a preferred way of testing
Unit tests require seperation of instantiation of object graph from business logic under test
Questions:
1. Global variable - make test unpredictable, the order of test matters and so on and so forth.
Do not clean up after yourself, another test will fail;
Counter argument: framework than DI framework.
Monkey-patching - evil on the global state - dependency injection
C++ / Java / frameworks - dependency injection difference
And read the slideshow using the following link:
http://www.slideshare.net/avalanche123/clean-code-5609451
http://misko.hevery.com/code-reviewers-guide/
http://misko.hevery.com/presentations/
http://misko.hevery.com/2008/10/21/dependency-injection-myth-reference-passing/
Watch the google talk "The clean code talks - unit testing", write down notes and then learn better for next time.
video link:
https://www.youtube.com/watch?v=wEhu57pih5w
Video time:
02:02 / 32:07
Hard to test code
Most People say:
Make things private
Using final keyword
Long methods
Real issues: (interview questions)
Mixing new with logic
Work in constructor
Global state
Singleton
Static Methods (procedure programming) (leaf method vs way-up method)
Deep inheritance (Divorce myself from inheritance at run time. )
Too many conditionals ()
Procedure code - Seam - Polymorphism - Julia's comment: look into it, read more about it. 10/25/2015
Video time:
14:35/32:07
Progression of Testing:
1. Scenario / Large Tests
Test whole applicatio by prentending to be a user
slow / Flaky / Mostly happy paths
2. Functional / Medium Tests
External dependencies simulated
Test class interaction
3. Unit / Small Tests
Focus on application logic
Very Fast / No I/O / No Need for a debugger
4. Think of it more as a continuum than discrete
5. All tests levels important
Not all levels have the same probability of a bug
Because smaller tests cover less need more of them
6. Testability more important as you get more focused
Video time:
17:05 /32:07
Different kinds of Tests
Execution time :
unit test -> Functional Tests -> Scenario
Test individual ->
Test collections of classes as subsytems ->
Test the whole system pretending to be a user
Video time:
27:06/32:07
How do you write hard to test code?
You mix object creation code with business logic
This will assure that a test case never can construct a graph of objects different from production. Hence nothing can be tested in isolation.
Unit test class -
Seam - friendly - try to understand the dependency injection
class depends on a lot of other classes, mocking, seam, learned through hacking,
class:
object graph
construction & lookup
business logic
27:36/32:07
Take Away
Unit tests are a preferred way of testing
Unit tests require seperation of instantiation of object graph from business logic under test
Questions:
1. Global variable - make test unpredictable, the order of test matters and so on and so forth.
Do not clean up after yourself, another test will fail;
Counter argument: framework than DI framework.
Monkey-patching - evil on the global state - dependency injection
C++ / Java / frameworks - dependency injection difference
And read the slideshow using the following link:
http://www.slideshare.net/avalanche123/clean-code-5609451
http://misko.hevery.com/code-reviewers-guide/
http://misko.hevery.com/presentations/
http://misko.hevery.com/2008/10/21/dependency-injection-myth-reference-passing/
Thursday, October 22, 2015
Good API video watching and notes taken
Oct. 22, 2015
Spent time to look into
the note through the video, and then study more later:
How To Design A Good API and Why it Matters
(Julia's rating: A+)
https://www.youtube.com/watch?v=aAb7hSCtvGw
1. Watched again on 10/21/2015, notes taken to share:
54:40/1:00:18
Use Appropriate Parameter and Return Types
. Favor interface types over classes for input
- provides flexibility, performance
. Use most specific possible input parameter type
- Moves error from runtime to compile time (Julia's comment: Great tip, reduce time on debugging, fix things in compiling time!)
. Don't use string if a better type exists
- Strings are cumbersome, error-prone, and slow
. Don't use floating point for monetary values
- Binary floating point causes inexact results!
- Use double (64 bits) rather than float (32bits)
-Precision loss is real, performance loss negligible
2. watched again on 10/21/2015, notes taken to share:
49:19/1:00:18
Don't violate the Principle of Least Astonishment
Read more on this article:
http://programmers.stackexchange.com/questions/187457/what-is-the-principle-of-least-astonishment
3. watched again on 10/21/2015, notes taken to share:
https://www.youtube.com/watch?v=aAb7hSCtvGw
1. Watched again on 10/21/2015, notes taken to share:
54:40/1:00:18
Use Appropriate Parameter and Return Types
. Favor interface types over classes for input
- provides flexibility, performance
. Use most specific possible input parameter type
- Moves error from runtime to compile time (Julia's comment: Great tip, reduce time on debugging, fix things in compiling time!)
. Don't use string if a better type exists
- Strings are cumbersome, error-prone, and slow
. Don't use floating point for monetary values
- Binary floating point causes inexact results!
- Use double (64 bits) rather than float (32bits)
-Precision loss is real, performance loss negligible
2. watched again on 10/21/2015, notes taken to share:
49:19/1:00:18
Don't violate the Principle of Least Astonishment
Read more on this article:
http://programmers.stackexchange.com/questions/187457/what-is-the-principle-of-least-astonishment
3. watched again on 10/21/2015, notes taken to share:
42:31/1:00:18
Subclass only where it Makes Sense
. Subclassing implies substitutability (Liskov)
-- Subclass only when is-a relationship exists
-- Otherwise, use composition
. Public classes should not subclass other public
classes for ease of implementation
Bad: Properties extends Hashtable
Stack
extends Vector
Good: Set extends Collection
Subscribe to:
Posts (Atom)