Jeffrey Friedl, author of Mastering Regular Expressions, writes about regexes, photography, Exif data, and cycling in Japan.
HN commenters recommend his regular expressions book and link his site for tracing the origin of the "now you have two problems" quote.
A tricky thing w/r/t browsers is that they are often really crappy at figuring out what color space a PNG image is supposed to be in. I think they often intentionally strip out the color space info from PNG images for the sake of helping PNG images blend smoothly into CSS / Flash / etc., for which they also don’t do correct color management. [The CSS spec says that colors should be interpreted as sRGB, but browsers don’t actually follow the spec.]
As a result of this problem, it’s difficult to judge whether image resizing specifically is being done incorrectly, or whether the image is just being interpreted incorrectly at any size.
You’ll notice if you open your first test image (http://www.4p8.com/eric.brasseur/gamma-1.0-or-2.2.png) in Apple’s Preview app, you get the correct behavior, but this is different from the behavior in Safari, for example, which shows something incorrect at every size. Stranger still, the behavior in Safari is roughly “correct” while resizing a browser window, but as soon as you let go of the mouse, it reverts to being incorrect.
There are multiple possible ways to embed color space info into PNG images, and the PNG spec is actually really terrible and confusing on this subject which results in lots of inconsistencies from one implementation to another. If I remember correctly some of them are treated better by browsers than others, but I’m not sure if there’s a way to encode images such that it will be handled properly everywhere (I mean,…
Yeah I didn't mention Friedl because I've dumped on him in the past, and didn't want to belabor it. But Friedl definitely didn't start this. According to him, he was just using what was common vernacular even back then: http://regex.info/blog/2006-09-15/248 (Note that blog is from 2006, but he's actually quoting himself from ~10 years prior to that in 1997.)
But... he is the one who ultimately installed this ambiguity into a classic book that is still read to this day. So I think he can at least be blamed for popularizing the confusion. And especially since the entire book is framed around "NFA" and "DFA" regex engines. It's not like it was just some one-off mention. The mix-up is baked into the conceptual fabric of the book. The landscape also looked different back then. It predated RE2 for example, and RE2 is, I think, principally responsible for bringing "backtracking semantics" to finite automata oriented engines. So Friedl's book is forever stuck in a false dichotomy that only happened to exist back when he wrote it.
I've built a couple of Chrome extensions and is something I really recommend. It's easy, useful and satisfying (if you have a userbase).
An example. I love checking the EXIF data of the pictures on the internet to know more about how they were shot. I use Jeffry Friedl's Exif Viewer (http://regex.info/exif.cgi). The process was: right click on the image, open in new tab, click a bookmarklet, new tab opens with the exif. Then, I decided to create a super simple Chrome extension that adds an option to the context menu of all images that opens the image in the exif viewer.
You can check the (minimal) code here https://github.com/JoseTomasTocino/send-to-exif-viewer, as well as the link to the chrome web store https://chrome.google.com/webstore/detail/send-to-jeffreys-exif-vie/gogiienhpamfmodmlnhdljokkjiapfck
Great pun on Jamie Zawinski's comment about regular expressions from the discussion about embedding Perl in Emacs:
Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
The article quotes it, but doesn't mention the source. Jamie says he was repurposing an older "sed" quote. Safe testicle-free link:
http://regex.info/blog/2006-09-15/247#comment-3085
I bet I've written more and harrier PostScript code than he has, though! And as a monster raving loony, I'll defend PostScript as being “readable” any day! ;)
https://www.donhopkins.com/home/pub/NeWS/litecyber/cyber.ps
Your comment reminded me of Jamie Zawinski's tongue-in-cheek quotation "Some people, when confronted with a problem, think
'I know, I'll use regular expressions.' Now they have two problems." (http://regex.info/blog/2006-09-15/247)
Jestful, off-the-wall comments aside, I love regex. It takes away a great deal of the drudgery associated with processing volumes and volumes of text. I can't imagine not having it.
(Aside: Now that you mention it, I can think of a couple people who aren't programmers who use regex pretty frequently because it makes their life a little easier even if it isn't highly advanced, super-dense regex.)
A fantastic resource for understanding this weird market is the "Buying a House in Japan" playlist on this youtube channel [1]
He goes through lots of this weirdness in the Japanese market as he looks to buy and restore an older home.
I suspect there's a "let's boost GDP with more construction" problem in Japan. It's resulted in lots of fantastic infrastructure, but also bizarre half-formed highways, unfinished bridges, paved over rivers and other things built way out in the countryside. [2]
1 - https://www.youtube.com/playlist?list=PLE0D149A2A50898A3
2 - http://regex.info/blog/2007-03-25/403