• A Glimpse of the Future

    One of the common memes to come from covid19 is to post a before-after photo of a famous city or landmark. The before covid19 photo is the city as we’ve become accustomed to it: brown air full of smog. The after covid19 at the same location, but with naturally blue skies and clear air.

    With everyone social distancing and automobile/truck traffic near zero we have been given a rare opportunity. We no longer have to imagine what our air and cities could be like if we didn’t drive pollution emitting vehicles everywhere, we can see, taste, and smell it with our own eyes.

    Air pollution from cars and trucks have been suffocating our cities slowly, like one boil’s a frog, so we acclimate and brown air becomes “normal” and the way things have always been. With the burner temporary malfunctioning we can see just what a precarious position we’ve put ourselves in.

    When this is all done and our lungs have acclimated to clean air we’ll have a choice: do we go back to the way things were and forget what we’ve experienced, or do we the courage to demand a change.

    https://twitter.com/sistercelluloid/status/1249027255797460993

  • UNIX: Making Computers Easier To Use

    Watching videos like this one about UNIX system from 1982 is a great reminder that no matter what you're building today, we all stand on the shoulders of giants. Highly worth 20 minutes of your time.

    https://youtu.be/XvDZLjaCJuw

  • Checkin to 泉の森

    in Japan

    Social distancing in the local forest. Such a great little place to let the little one run about and have a snack surrounded by trees.



  • Checkin to 弥生台駅前公園

    in Yokohama, Kanagawa, Japan

    Lovely park weather and the blossoms are starting to blossom.



  • Checkin to Tully's Coffee

    in Fujisawa, Kanagawa, Japan

    The best spot to drink a coffee and watch some trains in front of Enoshima station.



  • Checkin to Enoshima Beach (江ノ島ビーチ)

    in Fujisawa, Kanagawa, Japan

    海ラブ



  • Checkin to Starbucks

    in Kanagawa, Japan

    Sakura donuts and an ice coffee while Leo sleeps.

  • Checkin to 戸塚税務署

    in Yokohama, Kanagawa, Japan

    Tax office is a zoo.

  • Checkin to Lien SANDWICHES CAFE 横浜店

    in Yokohama, Kanagawa, Japan

    American style club sandwich!



  • Handling Unclosed HTML tags with BeautifulSoup4

    A side project of mine is to archive the air pollution data for the state of Texas from the Texas Commission on Environmental Quality (TCEQ). My archiver then tweets out via the @Kuukihouston when thresholds of certain compounds go above certain thresholds that have been deemed by the EPA to be a health risk.

    Recently I added support to automatically update the list of locations that it collects data from, rather than having a fixed list. Doing so is very straight forward: download the webpage, look for the <select> box that contains the sites, and scrape the value and text for each <option>.

    There was only only a single hiccup during development of this feature: the developers don’t close their option tags and instead rely on web browsers “to do the right thing”.

    That is their code looks like this:

            Oyster Creek [29]        Channelview [R]

    When it should look like this:

            Oyster Creek [29]        Channelview [R]

    Lucky web browsers excel in guessing and fixing incorrect html. But as I do not rely on a web browser to parse the html, I’m using BeautifulSoup. The BeaitfulSoup  html.parser closes the tags at the end of all of the options i.e. just before the </select> tag. What this does is when I try to get the text for the first option in the list, I get the text for the first option + every following option.

    The simple fix is to switch from the html.parser parser to the lxml parser, which will close the open <option> tags at the beginning of the next <option> tag, allowing me to get the text for each individual item.

    # Bad
    soup = BeautifulSoup(response.text, ‘html.parser')
    # Good
    soup = BeautifulSoup(response.text, 'lxml')

Previous 185 of 359 Next