HNHacker News
TopNewBestAskShowJobs

dmlorenzetti

2,350 karma · joined May 18, 2009

I work on problems of air quality and energy conservation in buildings. Mostly I write simulation and optimization tools, using mainstream languages like C, Python, and F95.
submissionscomments
dmlorenzetti··on Examples from The LaTeX Companion book (3rd edition)
Regarding the idea to have some macros that expand to null when unwanted -- I have some "developer" macros that, in day-to-day use, do things like showing TODO items.

The most useful one typesets the labels of equations, sections, figures, and so forth, so I can copy-paste right from the document as I'm editing. That makes it so much easier to insert cross-references while writing, without breaking the flow to search out the definition.

Rather than commenting out packages, I have two top-level input files, which `\input{}` the actual content. Those files differ only where they read the developer-oriented definitions:

    \input{latex_input/defn/dev_defns_for_devs.tex}
versus

    \input{latex_input/defn/dev_defns_for_release.tex}
dmlorenzetti··on Robert Musil Forgotten Plays Inspired His Greatest Work of Fiction
I don't know anything about literature.

You know what you like -- which is enough, especially if you are reading for pleasure.

In my experience, discussing a work, or reading about its context or meaning, often deepens my enjoyment of it. So maybe one "trick" is to engage with others. But at some point you can't go throwing your precious spare time into something that doesn't fundamentally engage you.

I no longer let it bother me if I don't "get" something that many others enjoy. Conversely, I have a number of favorite books (and movies and music) that I rarely recommend to others, because I've learned that few people share my personal response to them.

dmlorenzetti··on Consistently Making Wrong Decisions Whilst Writing Recreational C
It seems like it would be a lot easier to just have students call, e.g., `ta_fork()` rather than `fork()`, and then provide an implementing file to be linked with their program. Then `ta_fork()` allows the TA to trigger errors, either probabilistically or deterministically (say, by setting environment variables).

This approach would also give students insight into testing strategies like mocking, plus it would work on more operating systems.

[Edit: Not to disparage this project. It seems like it would have lots of uses, and it was probably a lot of fun to develop.]

dmlorenzetti··on Mermaid: Diagramming and Charting Tool
This site compares a few text-based diagramming tools, including Mermaid: https://text-to-diagram.com
dmlorenzetti··on Ask HN: Why am I always stuck working on legacy software
being a janitor often pays really well

When I was a kid, maybe 5th or 6th grade, my family was driving out in the country and came upon a burning farmer's field.

We stopped to help, and my older brother and I were charged with keeping an eye on the smoking remains of a field that had already burned out. The adults, and my younger siblings, went to fight the actual fire.

By the time it was all over, my brother and I were both feeling slighted and sidelined. But as we got back to the car, my mother, may she rest in peace, told us how much responsibility we had been given, to be set such an important job, with no adult supervision, the farmer must have thought we were older than we really are.

Two points, I suppose. First, one doesn't always appreciate one's salient qualities. Second, 45+ years later, that episode still stands out in my memory for how rewarding it felt.

dmlorenzetti··on Alex Jones must pay $4M in damages for Sandy Hook hoax claims
Alex Jones reminds me of the Introduction to Kurt Vonnegut's "Mother Night" -- We are what we pretend to be, so we must be careful about what we pretend to be.
dmlorenzetti··on Embracing Modern C++ Safely, Book Review
Worth noting that InformIT currently has a sale running. Through end of 31-May EDT, use code SUNSHINE to get 50% off when you buy two books or ebooks.
dmlorenzetti··on Considered "18+"
Similarly, they would use blanked keyword blocking. So sex education resources would frequently get blocked.

I had a colleague whose surname, Sextro, was part of his email address. He occasionally had messages blocked by blanket filters like that.

dmlorenzetti··on Ask HN: Should I publish my research code?
You don't put science on your name if you're a real science

Having flashbacks to when a close friend was getting an MS in Political Science, and spent the first semester in a class devoted to whether or not political science is a science.

dmlorenzetti··on The Fierce Legal Battle at the Heart of the Fight over Reclining Airline Seats
Another example of selling the same space twice is cities moving from fixed parking meters, to meters that print out a parking receipt.

With the meter stuck on a pole at the parking space, if I pay for an hour but leave after 20 minutes, the meter still shows time. Somebody else can come and park there for 40 minutes, free.

But if I buy a paper receipt and stick on my dashboard, and leave after 20 minutes, the next person still has to rent the same 40 minutes of time.

Nobody I mention this to is upset about it (neither am I, at heart, though I do notice it). That suggests to me that conflicts over tray space on airplanes is driven more by a sense of claustrophobia and powerlessness, than by any particular notion of fairness or ownership.

dmlorenzetti··on Patterns in Confusing Explanations
This [0] helpful resource distinguishes between tutorials, reference material, how-to guides, and explanations.

[0] https://documentation.divio.com

dmlorenzetti··on Writing a Programming Book in 2021
"Numerical Python" by Johansson was an exception for me.
dmlorenzetti··on Apache Arrow 4.0
It sounds like you're thinking about the mat-vec operation in terms of "Grab one row of the matrix, take the dot-product with the vector, and repeat for each row of the matrix."

But it's also possible to think of it as "Grab one element of the vector, use it to scale the corresponding col of the matrix, and repeat, summing results." Both are efficient means of finding the result, and both have block-level versions that play nicely with the machine cache.

Meanwhile, linear algebra also often involves finding vector norms, and scaling vectors, and so on, and the way we usually set up tables means that the vectors of interest are generally columns of the data tables.

dmlorenzetti··on YouTube Kids a “vapid wasteland” say US lawmakers
> Now I just curate interesting videos and the kids have to watch it with me.

I also curate content to watch with my daughter. It started long before she had access to a computer, because it made for a nice pocket of time to share fun moments in the evenings.

We call them "Watch With XXX" (where XXX is my daughter's nickname). When I find something I think she'll like, I email it to myself with the subject "wwXXX". An email filter shuffles them off to a separate mailbox. She regularly asks if I have any new WWXXX's, or if we can watch an old favorite again.

dmlorenzetti··on Consider the Giraffe
For professional reasons, I have long been fond of the following fact about giraffes. Their heads are so high that their hearts have to produce higher blood pressures than any other animal [0]. When they lower their head, a set of valves in the neck restrict the blood flow [1], to prevent the high pressure from damaging its brain.

[0] http://news.bbc.co.uk/earth/hi/earth_news/newsid_8368000/836...

[1] https://www.novartis.com/stories/from-our-labs/giraffes-have...

dmlorenzetti··on Pandoc – A universal document converter
Pandoc is great at bridging the gap between science-oriented data control needs, and management-oriented reporting needs.

I was on a modeling project that used scripts to generate hundreds of input parameters, embed them in models, run the models, and produce reports. The inputs and outputs shifted a lot over the course of the project, as we came to understand the domain and implications of the work better. At every update, the changes had to be transferred to a Microsoft Word document that went to the project sponsors.

Pandoc made this easy -- we just added scripts to write out the model inputs as Markdown tables, then embed those tables in a larger writeup, also written in Markdown. Pandoc turned it all into a Word document. Thus, the same toolchain that did the actual work, also drove the final report. I really don't think we could have had confidence all the tabular data was right, had it not been automated through Pandoc.

dmlorenzetti··on Modern C
Not the OP, but for what it's worth, the overall flow of the book just didn't work for me.

"Modern C" takes a staged approach, going through

  + Level 0 Encounter
  + Level 1 Acquaintance
  + Level 2 Cognition
  + Level 3 Experience
This sounds like an interesting organizing principle, but in practice it is implemented quite rigidly, and produces, in my opinion, two serious weaknesses.

First of all, organizing by levels of detail, rather than treating individual topics in depth all at once, means that a fair amount of related information gets spread around the book.

This might be OK if the book had a comprehensive index, or consistently used forward-references to point the reader to a detailed discussion, but the book is generally weak in these sorts of cross-references.

For example, suppose you want to look up formatting strings for use with `printf()`. The index (I am looking at the Manning version) lists exactly one entry for `printf()`, which is on page 8 -- and the actual text there just mentions basically that `printf()` is a function that exists.

You could also look up "format", which gives one reference, to page 5, where the term is introduced but hardly even defined. The index does have more entries for `snprintf()` and `sprintf()`, if you happen to think to look for those. But after you play this game for a while, it becomes clear that the index takes a quite mechanical view of these functions, content to list locations where the function gets called out in the text, but without any great concern for where they are discussed as a cohesive collection of related functionality.

To me, this levels-of-experience approach makes sense for some things, like deferring discussion of threads, and setjmp-longjmp, till later chapters. That's why I say that the book errs by sticking to the game plan too rigidly.

The second major shortcoming of this rigid levels-of-experience approach is that the book delays discussing pointers for a long time. They aren't really taken up until chapter 11. Literally the book doesn't show a basic "swap" function until page 170. This means that a lot of code examples that come before chapter 11 do quite a dance to avoid using pointers.

When, finally, pointers are discussed, I felt that the text was somewhat lackluster. There is nothing wrong with it, but if this chapter was a blog post by some random C programmer, and got posted to HN, I doubt it would garner a lot of upvotes by enthusiasts saying it was the best description of pointers they had ever read.

Thus it had an anti-climactic effect for me -- I expected that deferring the discussion of pointers for so long would have some kind of pedagogical payoff, but there wasn't anything to it that, to me, justified putting it off for so long.

I had a few other problems with the book, but nothing that, by themselves, would keep me from recommending it.

I might recommend the book to somebody who already knows C, and wanted a deep dive on certain topics. However I would steer a beginner away from it.

Somebody else on this thread mentioned another new entry to this field, "Effective C" from No Starch Press. I am in the middle of this one, and so far like it a bit more (though I am not yet a full-throated enthusiast for it). I would note that "Effective C" introduces a swap function on page 16. That would be wildly premature to the author of "Modern C", but in the end I think it will serve the beginning reader somewhat better.

dmlorenzetti··on Challenge to scientists: does your ten-year-old code still run?
Hard-coded file paths for input data. File paths hard-coded to use somebody's Google Drive so that it only runs if you know their password. Passwords hard-coded to get around the above problem.

In-code selection statements like `if( True ) {...}`, where you have no idea what is being selected or why.

Code that only runs in the particular workspace image that contains some function that was hacked out to make things work during a debugging session 5 years ago.

Distributed projects where one person wrote the preprocessor, another wrote the simulation software, and a third wrote the analysis scripts, and they all share undocumented assumptions worked out between the three researchers over the course of two years.

Depending on implementation-defined behavior (like zeroing out of data structures).

Function and variable names, like `doit()` and `hold`, which make it hard to understand the intention.

Files that contain thousands of lines of imperative instructions with documentation like "Per researcher X" every 100 lines or so.

Code that runs fine for 6 hours, then stops because some command-line input had the wrong value.

I've seen all of these over the years. Even as a domain expert who has spoken directly with authors and project leads, this kind of stuff makes it very hard to tease out what the code actually does, and how the code corresponds to the papers written about the results.

dmlorenzetti··on Software reuse is more like an organ transplant than snapping Lego blocks (2011)
One thing I appreciate about John D. Cook's blog is that he doesn't feel the need to pad out what he wants to say.

Here, he had a thought, and he expressed it in two paragraphs. I'm sure he could have riffed on the core idea for another 10 paragraphs, developed a few tangential lines of thought, inserted pull quotes -- in short, turned it into a full-blown essay.

Given that his blog serves, at least in part, as an advertisement for his services, he even has some incentive to demonstrate how comprehensive and "smart" he can be.

His unpadded style means I'm never afraid to check out a link to one of his posts on HN. Whereas I will often forego clicking on links to Medium, or the Atlantic, or wherever, until I have looked at a few comments to see whether it will be worth my time.

dmlorenzetti··on “This resentment runs deep and is stunningly widespread”
acknowledgement of all the undeniably great things about the App Store from the perspective of users and developers

As a user, I shudder anytime I have to interact with the App Store. Even when it works flawlessly, there is nothing interesting or pleasing about it. And most of my interactions with it leave me with a mild feeling of having being bullied about.

I had much rather install software via Homebrew than the App Store.

dmlorenzetti··on Ask HN: The most impressive non-academic achievement?
Don't discount your volunteer work, especially if you have done it as a young adult (i.e., from personal conviction rather than due to home/school pressure). A lot of people will take that as a sign of emotional maturity, thoughtfulness, or conviction.

I heard through the grapevine, many years after the fact, that during salary discussions at an outfit that was planning to make me an offer, there was a small debate about how many years of experience to credit me. By the calendar, I had $y$ years of work since graduation, but in terms of job experience it was $y - 2$ years, due to time I spent in Peace Corps. The difference affected the salary range their internal guidelines indicated I could be offered.

Finally one of the PIs cajoled the "y-2" crowd, saying, effectively, Come on, he spent two years teaching math in a village with no electricity and no running water...

dmlorenzetti··on Conversations with a six-year-old on functional programming (2018)
\lambda x. 6 was also surprisingly difficult for him to guess... It simply hadn’t occurred to him that the machine might not care about the input.

One Christmas when my whole family got together, I made a "stink detector" which consisted of a USB cable stuck inside a ziplock bag. My nephews were invited to put anybody's sock in the bag, then enter some parameters (like sock color, how long since it was washed, and, crucially, the name of the sock's owner) in a GUI.

Under the hood of the GUI was a grep engine that checked for a whitelist of names and titles ("uncle" among them to be sure), and assigned those names the lowest possible stink number. Whereas my nephews of course were guaranteed to get a high value. That result was fed through a random number generator, to produce a fuzzed-up normal distribution for display on the screen.

They spent a long time varying the parameters, trying to figure out how they affected the "analysis" before figuring out it was all driven by the name.

dmlorenzetti··on Rediscovering the lost power of reading aloud
A lot of comments here concern reading to and with kids.

For those interested in practical aspects of reading out loud to children, check out Jim Trelease's "Read-Aloud Handbook". It has advice, advocacy, and specific age-appropriate book suggestions.

http://trelease-on-reading.com/rah-contents.html

dmlorenzetti··on Show HN: I built a site to compare fees and rates for sending money abroad
A few minor UI comments.

+ Failing to select an amount to send should raise a flag.

+ Entering a negative amount to send should raise a flag.

+ After viewing a result, if I hit `back` on my browser (say, to compare results for a different transfer amount), it resets the currencies to their defaults (for me, U.S. and Argentina). It would be nicer to remember my selections.

dmlorenzetti··on How do we cut down on emissions from steel, cement, and plastic?
He doesn't say it's the most important issue.

He says it's "an important subject that deserves a lot more attention".

dmlorenzetti··on Climate change: Marine heatwaves kill coral instantly
Since these ... ecosystems have persisted and evolved through enormous planet-wide changes ... I'm not worried

If the time scale of climate change matched the time scale of coral evolution, then your comforting thought might hold water. Unfortunately, our climate is changing faster than many evolutionary processes can keep up with.

Rates of change can matter. Just because you can safely walk down 30 flights of steps, doesn't mean you can safely jump off the roof of a 30-story building.

dmlorenzetti··on Ask HN: How to deal with constantly getting cut off in work discussions?
"One of the most striking aspects of high involvement style that I found and analyzed in detail was the use of what I called 'cooperative overlap': a listener talking along with a speaker not in order to interrupt but to show enthusiastic listenership and participation. The concept of overlap versus interruption became one of the cornerstones of my argument that the stereotype of New York Jews as pushy and aggressive is an unfortunate reflection of the effect of high involvement style in conversation with speakers who use a different style. (In my study I called the other style 'high considerateness')."

Deborah Tannen, Gender and Discourse. Oxford University Press, 1994

https://www.thoughtco.com/cooperative-overlap-conversation-1...

dmlorenzetti··on Ask HN: How to deal with constantly getting cut off in work discussions?
I used to have a big problem with this. My family culture values slow, serial communication, so "cooperative overlapping" of the sort practiced at my workplace came across to me as rudeness. That meant my frustration at not being heard was amplified by negative connotations about why I was getting steamrollered during meetings.

One thing that helped me was to understand the motivations of those involved. It's easy to think somebody is rude, or showing off, but fortunately I started from a place of deep respect for the capabilities of everyone in my group, and eventually a great affection for them. I saw that we had a few individuals who, if they weren't interrupting, it meant they weren't interested. After I realized this, I started to prize the guy practically jumping out of his chair to take over what I was saying, because it meant he was engaged and excited by it.

Nevertheless, I did often think about the effect on people who might be less self-confident than me, or quieter (we had a lot of students passing through in those days). In the end, if I needed to be heard, I could raise my own voice just as effectively as anybody else in the group -- but not everybody can do that.

It came to a head one group meeting, when a foreign researcher came to present some results. His presentation effectively ended after a few slides, because it got derailed by the back-and-forth of the "audience". I was really steaming and embarrassed.

He agreed to come back the following week, so I sent round an e-mail saying we had all better be on good behavior. I told the group I would bring three notebooks -- one green, one yellow, and one red. The meeting would start with the green one on top of the stack, and if I got annoyed, I would move the yellow one to the top. If the red one came to the top, I would -- well, I don't remember what I threatened, but it couldn't have been very scary, since I had no power.

In the event, the green notebook stayed on top. Not only was the group on strictly respectful behavior for the presenter, but I think it got better generally for a long time afterwards. I think seeing how that behavior affected an outsider gave everybody a little pause, and made us see ourselves better. But again, I think the details of this anecdote show what a great group of people these were. As a junior team member, I felt able to express and act on my disappointment, and everybody listened and tried to accommodate me.

dmlorenzetti··on African Vernacular Architecture Database (2015)
I lived in Botswana for almost two years, in the late 1980s. In my village there was a noticeable shift in housing style over time, as manufactured materials (cinder block, sheet metal roofs, chain link fence) replaced their traditional counterparts (mud/dung walls, thatch roof, piled-up bushes).

This shift in building style also brought about a shift in usage.

At the most visible level, round, amorphous shapes gave way to rectilinear layouts.

The organization of family compounds also changed. Traditionally, one would see 2-4 rondavels (round, single-room structures), all linked by a low wall (lolwapa) into an inward-oriented cluster. That got replaced by a single, larger house, presumably with multiple rooms inside.

In terms of usage, you could see the difference best in the middle of the day. This is a desert country, and the modern materials and constructions are a thermal disaster. Thick walls with a lot of thermal mass got replaced by low-mass walls. Uninsulated tin roofs collect solar gains (and radiate heat, becoming uncomfortably cold at night). Thatch roofs also tend to have wide overhangs, providing shade at the side of houses.

As a result, people living in new houses tended to be outside, squeezed under the shade of whatever scraggly trees there were. Those with traditional houses tended to be inside, or sitting in the shade on the kind of built-up seat that runs around many rondavels.

I never priced things out, but the only way to understand this shift had to be as a function of cost. Thatch had to be imported, and I think doesn't last beyond a decade at most. And the traditional walls required a lot more seasonal maintenance.

dmlorenzetti··on Small guide to making nice tables [pdf]
As shown, the minus sign is rendered as a hyphen. This looks glaring when you're used to math mode's thinner, longer minus sign.

To see the difference, typeset this with LaTeX:

    \documentclass{standalone}
    \begin{document}
    -50 vs $-50$
    \end{document}
Page 1 of 14Next →