David Bau
davidbau.com · Personal blog · on HN since 2009
David Bau, a software engineer and researcher, writes on math, programming, teaching kids to code, and AI.
What HN saysHN commenters link his math visualizations, his pi approximation posts, and his stories about teaching a child to program.
28HN people shared it
11linked it in comments
19stories submitted
607story points
7 months agolast shared
2009people per year2026
Most-shared posts
- 1The Mystery of 355/113 (2010)4 people · 393 points · first shared 2012 · 106 comments on HN
- 2Conformal map visualizer3 people · 7 points · first shared 2015 · 1 comments on HN
- 3Random Seeds, Coded Hints, and Quintillions3 people · 1 points · first shared 2011 · discussion on HN
- 4Someday we will all program in Python2 people · 55 points · first shared 2009 · 77 comments on HN
- 5Two kinds of vibe coding1 people · 135 points · first shared 2025 · 100 comments on HN
- 6Global Catastrophizing (2021)1 people · 3 points · first shared 2024 · discussion on HN
- 7Dario's Weird Race to the Top1 people · 3 points · first shared 2026 · discussion on HN
- 8In Defense of Curiosity1 people · 2 points · first shared 2025 · discussion on HN
- 9Local Variable Debugging with see.js1 people · 2 points · first shared 2013 · discussion on HN
- 10Does Computer Science Still Exists?1 people · 2 points · first shared 2026 · discussion on HN
- 11Teaching children to program by JavaScript examples1 people · 1 points · first shared 2010 · 1 comments on HN
- 12Conformal Map Viewer1 people · 1 points · first shared 2017 · discussion on HN
- 13Creating a New State of Matter1 people · 1 points · first shared 2010 · discussion on HN
- 14Logo/Turtle-graphics-like programming book & site for kids1 people · 1 points · first shared 2013 · discussion on HN
- 1500 preface1 people · first shared 2010
What HN people wrote when they linked it
mkaic · 2024-08-13
If you want to mess around with these sorts of visualizations yourself, I recommend checking out David Bau's little web app for it: http://davidbau.com/conformal
PebblesRox · 2021-01-06
My kids aren't quite old enough, but I recently enjoyed the following stories:
"Haaarg, world!" (writing a vampire-themed number-guessing game with a six-year-old): http://davidbau.com/archives/2005/07/29/haaarg_world.html
Madlibs with a 13-Year-Old: https://nedbatchelder.com/text/madlibs.html
suprgeek · 2015-03-14
Seems like a good time to post 355/113
http://davidbau.com/archives/2010/03/14/the_mystery_of_355113.html
One of the best easy to remember approximations of Pi
gcheong · 2010-01-26
This is an excellent series of blog posts about a father trying to teach his 6 year old son to program a simple game. Maybe you can draw some inspiration from it.
http://davidbau.com/archives/2005/07/27/a_programming_question.html
chriswarbo · 2021-06-17
Here is pi, written as a number to infinite precision (from http://davidbau.com/archives/2010/03/14/python_pipy_spigot.html ):
def pi_decimal_digits():
q, r, t, j = 1, 180, 60, 2
while True:
u, y = 3*(3*j+1)*(3*j+2), (q*(27*j-12)+5*r)//(5*t)
yield y
q, r, t, j = 10*q*j*(2*j-1), 10*u*(q*(5*j-2)+r-y*t), t*u, j+1
If you mean that pi can't be written as a number to infinite precision using place-value notation (as opposed to a more useful notation like Python) then I agree that only a finite prefix can ever be observed.
netmare · 2021-03-18
This is very nicely done, but I still prefer the simplicity of <http://davidbau.com/colors/>. Despite being only 2-dimentional, I find that layout strangely more intuitive. I think the author manually tweaked the color positions, so that may be the reason.
bokchoi · 2014-03-03
I agree. This is something that XMLSchema got both right and wrong. The XMLSchema basic datatypes [0] are well defined and for the most part fit nicely in host languages. However, they really screwed up with the complex types making it difficult to map onto programming languages for multiple reasons (sequence/choice can't be easily modeled in most programming languages without intermediate types, extension versus restriction, derivation versus substitution groups.) For a good write up of the design philosophy behind XMLBeans, see:
http://davidbau.com/archives/2003/11/14/the_design_of_xmlbeans_part_1.…
[0] http://www.w3.org/TR/xmlschema-2/
cfuegos · 2012-08-12
David Bau's seedrandom.js is quite interesting:
[It] defines a method Math.seedrandom() that, when called, substitutes an explicitly seeded RC4-based algorithm for Math.random(). Also supports automatic seeding from local or network sources of entropy.
http://davidbau.com/encode/seedrandom.js
mikeryan · 2010-09-11
Countdown to HTML/JS reversi on 5 screens in 3... 2...
Update: its already done (works for me on Chrome, ipad and iphone at least).
http://davidbau.com/reversi/
magikarp · 2011-08-29
It is ridiculous that even in light of the COMODO HTTPS hack, the writer would go as far as to say that SSL/TLS is a better solution.
The writer also ignores that there are potential solutions to many of the problems pointed out:
In case of random number generation, check out seedrandom: http://davidbau.com/archives/2010/01/30/random_seeds_coded_hints_and_q…
And while it's true that the server may always send "poisoned" JavaScript code, projects that heavily depend on such code, such as Cryptocat, now ship browser plugins that perform integrity checks on the code for you: https://chrome.google.com/webstore/detail/dlafegoljmjdfmhgoeojifolidml…
Furthermore, and most importantly, by using SSL/TLS, the data being sent by the browser to the server is encrypted as it passes through the network, but however remains readable by the server when it reaches it. Whereas with client-side JS crypto, the server cannot read the sensitive data. If the writer does not trust the server to send correct JS code, how can he trust it with the sensitive data itself, in plaintext, which is what he is doing by using SSL/TLS? As I mentioned above, there exist browser plugins for a few projects to verify the integrity of the JS crypto they use.
quadhome · 2011-08-28
I'll wait for the cryptographers to weigh in; but, it's in Javascript.. already a language that's going to be hard to Do It Right in. (The first third of the code is a BigInteger implementation)
Then, I looked to see if the standard constant-time comparisons were in there to resist timing attacks. No dice there.
So... cool. He put a nice wrapper on JSAES[1], jsSHA2[2] by way of webtoolkit.info[3], RSA and ECC in Javascript by Tom Wu[4], and seedrandom.js by David Bau[5].
But then then says it's "New BSD license"[6] when it should be GPL[7].
I didn't start this comment sound negative. But, I think a few things are important:
* Credit authors.
* Respect their licenses.
* Put a big fucking notice on top of your slick webpage: "FOR DEMONSTRATION PURPOSES ONLY-- NOT REAL CRYPTO"
[1] http://point-at-infinity.org/jsaes/
[2] http://anmar.eu.org/projects/jssha2/
[3] http://www.webtoolkit.info/javascript-sha256.html
[4] http://www-cs-students.stanford.edu/~tjw/jsbn/
[5] http://davidbau.com/archives/2010/01/30/random_seeds_coded_hints_and_q…
[6] http://code.google.com/p/cryptico/
[7] http://code.google.com/p/cryptico/source/browse/trunk/aes.js