How Scanf Works

Shows in detail how scanf works and its gotchas

Guowei Lv

3 minute read

scanf is essentially a “pattern matching” function that tries to match up groups of input characters with conversion specifications. An Example No blah blah blah, let’s see an example. int i, j; float x, y; scanf("%d%d%f%f", &i, &j, &x, &y); // input // <space><space>1-20.3-4.0e3<ret> Here is how scanf would process the new input: Skips the leading 2 spaces. Conversion specification: %d. The first nonblank input character is 1; since integers can begin with 1, scanf then reads the next character, -.

Making Sense of React's Render Props

React's render props is easy if you understand FP

Guowei

4 minute read

I came across render props when checking out Apollo GraphQL’s tutorial. Now I think I finally figured it out, I try my best to explain it as easy as possible here in my own words. The highlight is in the last part where I shed a FP light onto it. So stay tuned! First, stop trying to understand the name render props. Instead, look at the following example. I want to build a React Component which has 2 buttons cat and dog.

SICP Goodness - Stream (8)

Expoloring the stream paradigm

3 minute read

Do you think Computer Science equals building websites and mobile apps? Are you feeling that you are doing repetitive and not so intelligent work? Are you feeling a bit sick about reading manuals and copy-pasting code and keep poking around until it works all day long? Do you want to understand the soul of Computer Science? If yes, read SICP!!! One more example from the book and one related exercise.

Peopleware Book Review

A review of the book Peopleware

Guowei Lv

1 minute read

I got this book from a secondhand book store online. And it is the 1st edition published in 1987, the year I was born. I have only 2 things to say about this book. It teachs you how to tell a great manager from a not so great one. Almost always peopleware wins over software. I highly recommend this book to anyone who want to peek into the world of managers.

On Reading

Talks showing the importance of reading in chidren education

Guowei Lv

1 minute read

I found these wonderful talks about language learning / reading and how they will change your kid’s life. I mark them here for later reference. One by Jim Trelease: The other one by professor Stephen Krashen