~evn/blog/

tilde-ing about

Pumpnow: A Simple Web Page to Help Me Bake Pumpernickel

July 20, 2019 — ~evn

My partner, Julia, and I have been learning to make pumpernickel (a dense German style of rye bread). It doesn't require too much work, but the baking process takes about three days from start to finish. We've been using this recipe, which is excellent, but as inexperienced bakers we found the terminology sometimes confusing.

I wanted to re-write the recipe in terminology and units that were convenient for us. I also wanted to make a tool that would make scheduling the different parts of the process easier. Mostly I wanted to tinker. I thought a simple web page would be just what I needed; and since I'm not that familiar with the nuts and bolts of the web (HTML and JavaScript) I could learn a few things along the way.

I typed out the recipe in my own words, wrapped it in some basic HTML tags. I put placeholders into the HTML next to each of the recipe steps where I wanted the time and day of the week to go. I wrote some simple JavaScript to get the time that the web page was loaded, use that as the start time, and replace the time and day placeholders in the HTML with times offset from the page load time. This worked pretty well. It answered the question "If I start baking now when will I have to do the other steps in the recipe?" I found myself usually following that question with an other one: "What if I start baking tomorrow morning instead?" Also, the system was pretty fragile. I had to leave a browser tab open during the whole three-day process to not lose the timing of the steps. If I ever reloaded the page it would regenerate all the times and days based on the page load time. At this point Julia said I had just created a tool to talk myself out of baking pumpernickel. She was probably right. I needed to get fancier, but minimally fancier.

I decided to use URL arguments to specify the starting day of the week and time. If I were to start baking at 11am on a Saturday he URL would look like this: "pumpnow/?day=saturday&time=11:00". This way I could specify a start time, and then bookmark a page that would always load with the same times for the steps. Implementing this required a lot of futzing around with time and date string formatting and a little hating JavaScript. (How is there no function to pad a string with a given character in the standard library?). Once that was working I added pull-down menus to the top of the page so I didn't need to manually type days and times into the URL bar, and a button to go to the URL set up by the pull-down menus.

With that my little project was complete. I got a little more familiar with how the basics of web technologies work. I had some fun. Yes, this is my idea of fun. Making new things is almost always a good time. I didn't learn to love JavaScript, but because it's built in to browsers it's a quick and easy way to add some logic to simple things like recipes. Both bread baking and web page making can be simpler than you think. Give them a try if you think they might be fun. Julia and I still have some room for improvement in our pumpernickel baking, but we're getting better. We might bake you a loaf one day if you like.

The source code for the pumpnow page is stored here. For the time being the the pumpnow page itself is living on the tilde.team server here. Thanks to Ben for running tilde.team and giving me an easy place for internet tinkering.

I went down a bit of a rabbit hole looking into the legality of posting recipes copied from others. It seems like recipes (mostly) (I think) can't be copyrighted. Nonetheless I emailed the person who wrote the recipe and asked if she had any objections to me posting a version of it. I haven't heard from her yet.

tags: baking, web, javascript