Author: David Faden

  • Comparing nodes

    I thought I wanted to compare the DOM trees for a couple of nodes. I ended up putting this together: How would you have done it? (I’d be unsurprised if this has some bugs.) After writing this though, I realized that comparing the HTML from n1.getHTML() vs n2.getHTML() was better for my purposes. (I don’t…

  • Los Altos council candidates on native plants in city plantings

    I e-mailed the five candidates for Los Altos city council the following question on September 8, 2024: Per Doug Tallamy’s work, using locally native plants in landscaping is important in restoring ecosystem health, rebuilding the food chain. Using natives also reduces the risk of introducing new invasives and diseases into surrounding wild areas. They require less water and…

  • white-space: pre-line converts lines into spaces in Safari when pasting into a textarea

    In a site I’m helping with, we encountered this weird behavior: users pasting multiline text into a textarea in Safari (but *not* in Chrome) found their newlines replaced with spaces. This was a problem because lines are used to separate items to be processed. Dropping the lines garbled the meaning of the input. My first…

  • Got a bike

    Today I carried out one small adventure I’ve been thinking about for months: walking to Walmart, buying a bike, and riding it home. I had already walked nearby to Trader Joe’s, hoping to buy a couple mini tote bags for a loved one. The cashier told me they ran out yesterday though and wouldn’t be…

  • A couple old Phyla nodiflora specimens

    Phyla nodiflora is one of the most aggressive plants I’ve encountered, I think quintupling in size in the few months we’ve had it. Jepson raises some questions about whether it’s actually native to California: “Note: Questionably native; variation in leaf margin, leaf hairiness may reflect multiple introductions from elsewhere, including South America.” The presenter in…

  • Four flowers visited by a hummingbird

    While I was sitting in our yard just a little while ago, a green hummingbird visited four plants in bloom in our yard. Earlier I had seen a hummingbird — the same bird? — making loops, flying nearly straight up into the air, higher than a nearby three story building, then diving down, making a…

  • Regex in C++

    I’ve missed out on a few things. It was fun to learn (or be reminded?) today that regular expressions have been part of the C++ std library for a while: https://en.cppreference.com/w/cpp/regex

  • Wayback Machine rescues pytest posts

    I’ve been curious about how pytest‘s assertion rewriting works. (As someone used to Abseil’s testing framework, the usage of bare asserts was a shock.) I was happy to come across a Reddit post: “How does pytest work?”. Unfortunately, the site it points to, pythoninsight.com, seems to be mostly dead. Luckily, the wonderful Wayback Machine has…

  • Playing with iNaturalist taxonomy data in MariaDB

    You can download the iNaturalist taxonomy data (updated monthly) from https://www.inaturalist.org/pages/developers under “iNaturalist Taxonomy DarwinCore Archive” (https://www.inaturalist.org/taxa/inaturalist-taxonomy.dwca.zip). After unzipping, you’ll find “taxa.csv”. Here’s one way of importing this into MariaDB (and I guess MySQL too). I know that the schema for my table isn’t optimal. (I would love to hear suggestions on how to improve…

  • Snooping on Internet Archive’s Wayback Machine bot

    I’m reading Jon Duckett’s “PHP & MYSQL” and got up to a section where he discusses $_SERVER, which contains info on HTTP headers, etc. I thought it might be fun to see what Internet Archive’s Wayback Machine bot looks like in terms of this. So, here’s my take on dumping parts of $_SERVER: https://github.com/fadend/server-vars-php/blob/main/server_vars.php. Hopefully…