jlm-blog
~jlm

24-Nov-2015

twitcode #2: decoding MIME

Filed under: programming — jlm @ 12:12

Messing around with some mail handling scripts, I was surprised I didn’t find any good ways to decode MIME as a stream filter. Ten minutes later, I have 13 lines of Perl which do it in 201 characters in my normal non-terse style. It’s great for normal use, but a tiny bit of golfing fits it in a tweet’s 140-character limit:

$ cat mime_decode.pl
#!/usr/bin/perl -w
use strict; use utf8; use MIME::WordDecoder; 
binmode(STDOUT, ":utf8");
while (<>) { print mime_to_perl_string($_); }
$ wc mime_decode.pl
  4  16 137 mime_decode.pl

Good thing there was already a method which does all the real work…

21-Nov-2015

If business hours are 9–5, noon should be 1 PM

Filed under: misc — jlm @ 08:36

Today the sun rose at 06:55. I rose at 07:15, being one of those morning persons who madden the folks who go to bed at 03:00, by which time I’ve been conked out fo[u]r hours. Yep, even being one of “those people”, I still missed the sunrise (and that’s normal for me).

Yet, today’s sunset… it’s at 16:53! The “day” closes before the banks do! Now, this crazy skewing of things isn’t because western California is geographically displaced from the reference meridian: high (“solar”) noon here is 11:54. If we’re only 6 minutes displaced from solar time, how come there’s so much more daylight in the morning than the evening? It’s because our standard “business hours” are shifted away from the center. Starting a working day at 09:00 and ending it at 17:00 has three hours before noon but five hours after it. If we shifted our clocks so that solar noon was ∼13:00 (which is what we do for the majority of the year which has DST in effect) then things would be more sensible: about four working hours before solar noon (09:00 – 13:00) and about four after it (13:00 – 17:00). The sun would have risen today at 07:55 and set at 17:53, and wouldn’t everyone be happier with that? Why don’t we just have “daylight savings time” in effect year-round? And then we’d also get the bonus of not having to move our clocks an hour twice a year. And of not having motorists on the roads with an hour less sleep than they’re used to on that one day in spring where DST starts and traffic accidents spike — which, come to think of it, is a far more important reason to quit doing a semiannual time change.

17-Sep-2015

New York Times: Climate change causes famine causes genocide

Filed under: science — jlm @ 12:04

Well, the New York Times published a provocative opinion article Saturday by Timothy Snyder, likening the Holocaust to climate change and Nazi Germany to the U.S.* “Today we think of the Nazi Final Solution as some dark apex of high technology.” — wait, what? Huh? What do you mean we, kemosabe? What way is this an apex of high tech in any manner, however dark? If there was a “dark apex of high technology” used in that terrible war, it would be the atom bomb. Two paragraphs later the author writes “The quest for German domination was premised on the denial of science.”, as if he didn’t know that science denialism and high technology go together like oil and water. Oddly, after this cheap swipe at high tech at the start, in the second half of the article Tim Snyder seems to encourage technological contributions to the fight against greenhouse gas emissions.

Moving on… Fighting wars over farmland goes back to well before history began. As that is not new, what is riling up Mr. Snyder? Hygiene and modern (ie, evidence-based [ie, scientific]) medicine has led to population growth so that the carrying capacity of the land becomes a factor of much greater concern — when disease and misadventure limit the population moreso than famines, there is no point to plowing marginal farmland. If you want an authentically greater danger to be concerning yourself with, consider that antibiotic resistance threatens to erase what is perhaps the greatest contribution to the fight against disease by medical technology.

So, if it’s not about averting hunger, why has there been so much violence performed with the goal of securing farmland? Historically, it really was about hunger! A localized crop failure (caused by any of dozens of reasons, let’s say drought) lowers the carrying capacity of the farmed land, so there’s a famine, resulting in efforts to gain more farmland, but once the drought passes, the typical capacity of the old plus the new farmland becomes the new normal, and so when the lemmings swarm and decimate the crops you get a famine again, meaning you need more farmland, in a cycle every historian is depressingly familiar with. The old-school way out of this trap was to actually treat the “new” farmland as a buffer for dealing with shocks to the food supply, not as a normal part of how you feed the populace, and go bank the excess crop in a granary. The newer way out is to sell the excess crop because nowadays we have enormous wide-area food markets, and during lean times you go buy food from these markets you earlier sold to. Note that neither of these will handle a long-term, wide-area reduction in farm capacity, such as that caused by the Little Ice Age, and the climate change phenomenon we’re currently in could possibly become a crisis at least as severe.

Getting back to the main point of the NYT article, the observation that populations are increasing faster than farmed land of course isn’t news; it has been well known since being popularized by Thomas Malthus. So far, global Malthusian crises haven’t occurred because we’ve been turning more and more natural habitats previously considered non-arable into farms (due to advances in irrigation, etc.), and per-hectare farm productivity has been growing (pun intended) and Malthus didn’t foresee the Green Revolution. Whether productivity can (or more precisely, at what point can it no longer) continue to grow is a contentious question. Monsanto et al. insist that genetically engineered crops will be the Green Revolution II. Personally, I favor reducing our trophic level by getting more of our protein from beans and eating less meat — meat is phenomenally inefficient on a nutrients per hectare-year basis.

In theory, you can step off the treadmill of growing population requiring increasing food production by stabilizing your population and reaching a level of food production which can comfortably feed that population with an acceptable amount of farmed land at sustainable farm productivity levels. Then you get to sit back and say “problem solved!” without having to get more land to till or handing control of your agriculture to Monsanto Inc. — at least until climate change goes and torpedoes your farms’ productivity.

So yeah, let’s get on fixing that greenhouse gas emission thing, like right now. But it’ll happen much better if we make use of technology instead of trying to fight the advance of tech. When you have the options of “using tech” and “fighting tech”, the former has always worked out better than the latter. That will still hold true when it comes to the matter of climate change’s impact on global agriculture.

 

* Quoting verbatim: “Hitler spread ecological panic by claiming that only land would bring Germany security and by denying the science that promised alternatives to war. By polluting the atmosphere with greenhouse gases, the United States has done more than any other nation to bring about the next ecological panic…” There’s more in the article.

22-Dec-2014

The local “king tide” floods

Filed under: sfba — jlm @ 19:36

Some really large tides occurred today and at the shore I saw the ocean coming to re-take some small slices of the real estate we had taken from it:
King tide img. 1
(more…)

25-Oct-2014

Insects, emerge!

Filed under: animals — jlm @ 14:52

Today the nests of some kind of insect decided to emerge from under the ground of my yard and fly off.
[Pics! Vids!]

There were three nests doing this that I saw. About 40 seconds into the filming of the earliest two nests (one of which was already mostly done), Android’s camera app wedged and prevented taking photos or a new video (and even left the first 40s of that first video unviewable), and by the time my phone rebooted, there were only a few stragglers to photo. Later nest #3 emerged, and I got a couple decent vids of it.

21-Oct-2014

Why was algebra so difficult to discover?

Filed under: math — jlm @ 18:48

(tl;dr: Asking a bunch of questions, and not making any guesses.)
Consider integer arithmetic prior to the discovery of algebra. How do you go about a really foundational task such as defining division? You give everything involved names, like so: A number called the dividend divided by another number called the divisor is a number called the quotient with a non-negative number called the remainder if the divisor times the quotient plus the remainder is the dividend and the remainder is smaller than the divisor. How do you get anything done with that kind of word salad? No, when you want to actually do some number theory, you go with: n÷d = q R r is equivalent to n = q∙d + r ∧ 0 ≤ r < d. This terminology is taught because you teach division well before you teach algebra, but it’s so useless afterwards that I very well might have never used this sense of the word “dividend” all these years since I learned algebra. Anyone skeptical that basic grade school arithmetic isn’t far harder to grasp without algebra is invited to explain how come long division gets the right answer without using it.

So fine, algebra is incredibly useful, but utility has no relevance to ease of understanding. I remember having some confusion when I was introduced to it. It was along the lines of: “What number is x?” “That can be any number.” “*boggle*”. Yet, those named terms above, they’re just placeholders too: “What number is the dividend?” “That can be any number.” “Oh, okay.” — How come that’s different?

The Greeks were using letters to represent arbitrary points in geometry centuries earlier than the Arabs did that for arbitrary numbers. In teaching geometry we don’t get the problem “What point is A?” “That can be any point.” “*boggle*” — What makes “x can be any number” so much harder than “A can be any point”?

8-Oct-2014

Colloidal suspension of disbelief

Filed under: humor — jlm @ 20:01

Numi makes decent enough herb teas, but their “100% real ingredients” teabag tag always strikes me as weird.

Real ingredients.  100%.  Nothing else.

What’s the alternative? Fictional ingredients?

Ingredients: cinnamon, orange peel, cloves, hibiscus, allspice, ginger, Melange, phoenix down, ice nine, caloric, kryptonite, phlebotinum, vibranium powder, dragon scales, dried minotaur blood, mithril, nebulium, phlogiston, dilithium crystals, pigeon teeth, elan vital, roc talon, unicorn horn (not narwhal — we have some class!), luminiferous ether, dehydrated Atlantis spring water

15-Sep-2014

Oakland bonsai garden

Filed under: sfba — jlm @ 14:47

I recently took a walk around the gardens in Oakland’s Lake Merrit Park, and found the bonsai garden there to be especially nice.

Which means you get to enjoy some photos!

bonsai photo 1bonsai photo 2bonsai photo 3bonsai photo 4bonsai photo 5bonsai photo 6bonsai photo 7bonsai photo 8bonsai photo 9

4-Aug-2014

Faces are hard

Filed under: web — jlm @ 22:10

So, there’s this webcomic Prequel Adventure set in the Elder Scrolls: Oblivion universe. It’s an excellent comic, with a compelling plot and great humor. (It also is paced extremely slow, with a real-time:in-universe-time ratio that handily exceeds even that of Freefall.) The panels are drawn simply, supporting the story’s elements and the comic’s jokes, and clearly indicating that the focus is on telling a good story in a funny manner, and not on having beautiful art (another similarity with Freefall). But despite the comic’s simple drawing style, there’s one bit which Kazerad absolutely nails: Facial expressions. I mean, look at the final panel from this page.
(more…)

24-May-2014

Do not use for lunch

Filed under: humor — jlm @ 10:27

Safeway advertisement

Powered by WordPress