HNHacker News
TopNewBestAskShowJobs

philiplu

761 karma · joined May 1, 2014

Retired C++ compiler dev at Microsoft. Current Project Euler enthusiast. Contact via pml-hn@lucido.net
submissionscomments
philiplu··on Why do recipe writers lie about how long it takes to caramelize onions? (2012)
I mix up 2 kilograms at a time: 500 grams sweet rice flour, 400 grams brown rice flour & potato starch, 200 grams ivory teff & arrowroot starch, 100 grams white rice flour, potato flour, & tapioca starch. The original recipe had almond flour instead of white rice flour, but I decided to make this nut-free (had some friends with nut allergies).
philiplu··on Why do recipe writers lie about how long it takes to caramelize onions? (2012)
Hah, for once, a benefit of having celiac, no wheat for me apparently means no weevils for me. I mix up a lot of gluten-free flour mix to substitute for all-purpose flour. It's a mix of way too many flours and starches (white rice, brown rice, sweet rice, potato starch, potato flour, ivory teff, tapioca starch, arrowroot flour) that I got from a blog many years ago, and haven't tried to slim down because it works great for me. Never had any bug issues; maybe specialty flours have better quality control.
philiplu··on How to lose your work using Undo Copy in Windows
I know we shipped p-code for general usage, not just internal like Excel. But it might have been internal-only in the mid to late 80s. I found a link [1] talking about some p-code internals, from April 1992, by the guy who hired me at Microsoft about a year before that. The compiler team definitely viewed Excel as one of their most important customers, and were willing to do lots of work to satisfy them.

So p-code wasn't actually dead when I started, but instead shipped with the C/C++ 7.0 compiler, which predated Visual C++. I never worked on C7, since that was 16-bit, and p-code wasn't part of any 32-bit compiler, as I recall.

[1] https://techshelps.github.io/MSDN/BACKGRND/html/msdn_c7pcode...

philiplu··on How to lose your work using Undo Copy in Windows
That sounds reasonable. I'd forgotten about the p-code version. I think that was dead by the time I started. I was also fortunate enough to avoid working on the 16-bit compiler backend, and just worked on the 32-bit, referred to internally as the n386 backend, which was pretty much a complete rewrite. The p-code backend would have been a variant of the 16-bit version.
philiplu··on How to lose your work using Undo Copy in Windows
Own C compiler? IIRC, that's not quite true. I worked on the C/C++ compiler team at Microsoft from 1991 to 2007, and I don't remember us producing a drop of the compiler just for Excel. I do think there was a special compiler flag for them, though, that fixed the order in which global variables were laid out to duplicate the source order. It was either Excel or Word that saved state by taking the addresses of the first and last global variables of interest, then dumping all memory in that range to disk. The flag was something like -bzalign. The bz stood for Bozo, which hints at the compiler team's thoughts on the practice.
philiplu··on Why take a compiler course? (2010)
Thanks! It's gratifying that the reminiscences of a graybeard like me can still resonate with readers here.
philiplu··on Why take a compiler course? (2010)
I'm a self-taught programmer, starting in the mid-70s, and learned how to write compilers in a way that probably wouldn't work nowadays, but was great fun back then.

The first thing I'd usually do when starting on a new architecture was write a disassembler. In the late 70s, I was mostly programming in 6809 assembly, usually in Microware's OS-9 operating system. Microware released a Pascal compiler, so I ran my disassembler over that. Turns out the compiler was self-hosting, written in Pascal, and the compiler output was almost completely unoptimized. So I decompiled the compiler back to Pascal by hand, just to see how it worked. I obviously had waaaaay more free-time back then.

I eventually read the green Dragon book (Aho & Ullman, Principles of Compiler Design), and ended up at Microsoft on the C/C++ team in 1991. Over the years, I've written several domain-specific languages (DSLs), small languages for some limited purpose. That early exposure to lexing, parsing, and error detection was invaluable.

philiplu··on Gordon Moore has died
I searched on "Moore's law is not a law" and found [1], "Moore’s Law Is Not Really A Law But It Is Still Obeyed", from someone who was a semiconductor engineer at Intel 40 years ago. As he says, Moore's law was more a roadmap than a law. Companies strove to keep it going for fear their competitors would succeed while they failed; sort of a self-fulfilling prophecy.

[1] https://medium.datadriveninvestor.com/moores-law-is-not-real...

philiplu··on Demystifying bitwise operations, a gentle C tutorial
Like bluesnowmonkey says, the concept you're looking for is called popcount, for population count. It's also called the Hamming weight. Wikipedia has 5 different example implementations under that latter name. Many C/C++ compilers have it available as an intrinsic as well, like __builtin_popcount or __popcnt. It's also std::popcount in C++20.
philiplu··on Demystifying bitwise operations, a gentle C tutorial
I suppose the online list of hacks at the 1st reference in the OP [1] makes more sense, but I've got a fondness for the book "Hacker's Delight", which I've owned and browsed for many years now [2]. And checking on that, I see there was a 2nd edition issued 10 years ago. Hmm, might need to pick that up.

[1] https://graphics.stanford.edu/~seander/bithacks.html [2] https://en.wikipedia.org/wiki/Hacker's_Delight

philiplu··on Frost
Been following this blog since it was first posted to HN a few months back. It's from an IT contractor working in Antarctica for the first time. Today's post has some fascinating photos of unheated storage sheds at the South Pole station, and the frost they accumulate on all surfaces after decades of humans breathing there while working in the sheds.
philiplu··on Craft using an inertial mass reduction device
That was a fun read. Arthur C. Clarke's "Tales From the White Hart" meets Derek Lowe's "Things I Won't Work With", with Lowe showing up in the comments afterwards. Thanks for the link.
philiplu··on Could ultrasound replace the stethoscope?
Thanks for that. So what does ED refer to? Emergency Department? Synonym for ER?
philiplu··on Copyright Without Years
I was dev lead for the Microsoft C runtimes (msvcrt.dll and the like) back around the turn of the century. We shipped most of the source for the runtimes with Visual C++, and included a copyright message in each file. Those had the copyright year range in them when I started in the position, but (IIRC) we got the all-clear to dump the years from the text, over 20 years ago. Certainly cut down on source churn at the start of each year.
philiplu··on Discover Kentucky Archaeology
Huh, I never knew Quaker Steak & Lube had spread that far. I lived in Sharon, PA for most of the 80s, and worked a couple blocks from the original restaurant. Decent wings, if a bit too focused on heat level ("atomic wings"). Nice lunch joint - of course, the pickings were pretty thin in Sharon.
philiplu··on Gen Z never learned to read cursive
I write in cursive in one place only - physical checks. Had a subcontractor rip me off on a house remodel years ago, adding $1000 to a check I'd written with printing, not cursive. The bank reimbursed me, so no loss, but from then on I always write the check amount in cursive, careful not to leave any space to insert a change.

Of course, I now only write a handful of actual checks a year, and that just because I pay someone regularly who prefers checks to Venmo.

philiplu··on ACM Digital Library Archive is Open Access with 50 Years of Published Records
Nice - this means the May 1988 issue of CACM is freely available. That's notable because the cover article is Cliff Stoll's "Stalking the Wily Hacker" [1], with the material that later became his book "The Cuckoo's Egg". But I've still got the dead-tree version of that issue around somewhere in storage because of another article, by Andrew Appel and Guy Jacobson, "The World's Fastest Scrabble Algorithm" [2]. I coded that up back then, in Pascal IIRC, and had a blast doing so.

[1] https://dl.acm.org/doi/10.1145/42411.42412

[2] https://dl.acm.org/doi/10.1145/42411.42420

philiplu··on Project Euler
It's #202, at https://projecteuler.net/problem=202.
philiplu··on Project Euler
It probably didn't improve my programming - I started it as a fun way to learn Python, but I'm retired after 30 years in the business writing compilers and other programming tools/library code. Learning and programming data structures and algorithms is second nature by now.

But I'd say it did improve my thought process, specifically the ability to dwell deeply on something, and wait for inspiration to strike. For the really hard problems, I often will hit that "Eureka!" moment when everything is suddenly obvious, and I think I'm getting better at that. A part of that, too, is my Google-fu has improved. As I delve into deeper parts of math, I seem able to come up with the key search phrase more quickly. It helps that I did my BSc in Math, 40 years ago, so reading academic papers wasn't foreign to me.

philiplu··on Project Euler
For me, lots of candidates, but I'll go with #589, Poohsticks Marathon, because of my history solving it. I worked on it for a month after I'd solved about 200 problems, and got nowhere. Dropped it for 2 years, then decided after I'd solved 500 problems that I should give it another go for solution 501. I'd learned plenty of techniques in the interim, and finished it off in a couple days.

What's fascinating to me about this one, though, is its difficulty level, versus what the design team thought that level would be. Those levels are set automatically based on how quickly PE members manage to solve it, and this one took 32 weeks to hit 100 solvers, for a 95% difficulty. But problems are usually scheduled in batches of 6, one per week, with an expected difficulty cadence of Medium, Easy, Medium, Easy, Medium, Hard. And #589 was expected to be an _easy_ problem! I can actually see, having solved it, why the team thought it deserved its easy slot, but, wow, did things work out differently.

For a more general favorite, I really enjoy solving any of the impartial game problems. I'm not pointing out which those are - part of the fun is discovering that that's what you're looking at.

philiplu··on Project Euler
Whew, probably 5 to 10 thousand, at a wild guess? I ran through the first 106 problems (plus #243) in 23 days in April/May 2016, then dropped it for a year. Since then, I've plugged away pretty steadily, about 150 problems a year. That's tailed off as I'm getting close to the end. New problems show up once a week (except in summer), and I mostly keep up with those, but my success on the backlog is slowing down as what's remaining gets increasingly difficult. I'll probably solve around 80 this year, and it's that high just because of the new problems. Each old problem typically takes a week to a month, if I manage to get it at all. Some I let rest for a while, hoping inspiration will strike months later.

I've stuck with it mostly because I really enjoy learning math. I had plans to pursue a PhD in math back in college, 40+ years ago. But that's when I discovered computer programming, which was way easier, and paid much better. Now that I'm retired, I've got time to devote to Project Euler, which is satisfying that itch to keep learning.

philiplu··on Project Euler
Heh, thanks for the nerd-sniping. I’m down to 25 unsolved problems (currently working on #522, for way more than 30 hours), but #453 is one I haven’t done anything with yet. So of course I took a look, had some thoughts, and will probably have to force myself to look away in an hour or two. But, ooh, maybe that one’s next.

I’m retired, and PE is my main intellectual stimulation for the past 5 years. I thought I might be done by now, but everything left is at least 80% difficulty, and I’ve given up estimating how long those will take, if ever.

I started PE to practice Python for fun, but it’s turned into so much more than that.

philiplu··on Project Euler
Most PE problems are more math than data-structure based. There are plenty of number theory problems, but lots of other areas as well, especially combinatorics and probability. I’ve learned about many more niche areas, like impartial games and chromatic polynomials, via PE.

But there are definitely more CS-oriented problems. I can recall problems solved by using segment trees, Aho-Corasick, simple parsing, etc. And lots and lots of dynamic programming.

Also, working your way through the first 100 problems will require writing code to evaluate poker hands and solve Sudoku boards.

philiplu··on How far could a spaceship go if we never ran out of thrust? (2020)
For a hard science fictional version of this, check out Poul Anderson’s “Tau Zero”, from 1970, according to Wikipedia. I read it a few years after that, and it’s stuck with me since. A ship with a Bussard ramjet runs into troubles and has to keep accelerating, into the far future.
philiplu··on The mermaid is taking over Google search in Norway
Not just you. Something changed two or three months ago. Never really saw spam for years before that; now 3 or 4 mails a day.
philiplu··on Columbo: an origin story (2018)
Came here to see if anyone mentioned "The In-Laws". Just a perfect, farcical gem. I still crack myself up yelling "serpentine, serpentine" when running with my kids, who have no idea what's funny. Probably about time I watched it with them.
philiplu··on Math Problems for children from 5 to 15 (2004) [pdf]
Suppose you’ve got a 16 foot strand of lights and an 8 foot column. If you unwrap the column in your mind, you can see you’ve got a right triangle with a hypotenuse of 16 and vertical leg of 8. What’s the angle that the hypotenuse makes with the floor? It’s the angle whose sine is opposite/hypotenuse = 8/16 = 1/2. That’s 30 degrees. So wrap the lights around the column at a 30 degree angle and it’ll be close (with a bit of slop thanks to rounding corners on the column).
philiplu··on The Textbook That Unleashed Ramanujan's Genius
If you think you'd like TAOCP, but with just the math, not the programming (hah), take a look at Concrete Mathematics by Graham, Knuth, and Patashnik. I haven't read anything else by Graham or Patashnik, so I don't know how much their voice comes through, but Knuth's playfulness and joy in the material comes through strongly. It's a blast just to read for fun.
philiplu··on Science Fiction Stories with Good Astronomy and Physics: A Topical Index
I was expecting to see Arthur C. Clarke's "Fountains of Paradise" (where I first heard about space elevators), but it looks like this isn't aimed at technological ideas, more straight science. Though "telescopes" is one of the categories.

Glad to see Poul Anderson's "Tau Zero" on the list - that made a big impression on me when I read it back in the 70s.

Fun that Ted Chiang's "Exhalation" shows up in 3 different categories. Stunning story. I would have included his "Tower of Babylon" story as well - in cosmology <g>.

philiplu··on Desolate English path has killed more than 100 people (2017)
I assume you’re referring to the night they left the plug out? Or did something else happen during the Inaugaral Day windstorm in 1993?

For non-locals: Seattle is separated from the Eastside, the suburbs to the East, by Lake Washington. That lake is deep enough that the two bridges crossing it float on giant pontoons. In the early 90s, they were replacing the old Interstate 90 bridge, and doing some work on the old span in preparation. Someone decided that waste water from the process could be safely stored in those pontoons, so they removed the watertight caps. There was a big storm in late November 1990 which flooded the pontoons and sank the bridge. IIRC, that also damaged the cable supports for the replacement bridge, closing it down for a while.

https://en.wikipedia.org/wiki/Lacey_V._Murrow_Memorial_Bridg...

← PreviousPage 3 of 4Next →