kafsemo.org

“it remains unacceptable to 57 percent of the Usage Panel.”

Hullo!

Name and labels

Monday, 19 September 2022 (#)

Firefox 56 included a new character encoding implementation (“written in Rust”!) that follows the WHATWG Encoding Standard. The spec includes names and labels for the character encodings. It’s exhaustive — “User agents must not support any other encodings or labels.” Here’s an interesting bit:

Name Labels
windows-1252
"iso-8859-1"
"us-ascii"
"windows-1252"

All three subtly different character encodings are now merged together into one, named for the one with the largest repertoire. This made me kind of nostalgic: getting these encodings mixed up was a classic interoperability problem, that required a certain amount of knowledge or tooling to identify and resolve. However, folding them together essentially solves that problem.

text/xml gotcha

Still, as long as your document’s published as text/xml, there’s another gotcha to be aware of: omitting charset doesn’t mean “autodetect,” it means US-ASCII. But!, in RFC 6657:

Each subtype of the "text" media type that uses the "charset" parameter can define its own default value for the "charset" parameter, including the absence of any default.

And then RFC 7303 says:

If an XML MIME entity is received where the charset parameter is omitted, no information is being provided about the character encoding by the MIME Content-Type header. XML-aware consumers MUST follow the requirements in section 4.3.3 of [XML] that directly address this case.

It’s easy to value knowing how to work around historic mistakes so much that you forget to push for fixing them. It’s good to see a couple of cases where that hasn’t been the case. It’s nice to be able to move on from edge cases.

(Music: Santigold, “L.E.S. Artistes”)

Because you watched...

Monday, 12 September 2016 (#)

Netflix suggests that slow television naturally leads to Star Trek.

Funny if curated; funnier if actually derived from data.

(Music: R.E.M., “Ignoreland”)

Fractional nines

Monday, 5 September 2016 (#)

Conversationally, you can describe system availability in terms of nines. A two nines (available 99% of the time) system would be built differently from a five nines system (99.999%).

Outside the realm of high availability, what could we call a system available only 80% of the time? It’s less than 90% (“one nine”), so it would strictly be zero nines. To be more specific, we’ll need to introduce fractional nines. Having done that, we could refer to it as 0.7 nines.

Let’s go through the math.

Natural nines

Start with the natural numbers. We have f:ℕ↦ℝ.

NinesAvailability (%)
190
299
399.9
499.99
599.999

Simplify by considering availability as a fraction (in [0,1]) rather than a percentage:

NinesAvailability
10.9
20.99
30.999
40.9999
50.99999

Note that this is exactly

availability ( n ) = 1 - 0.1 n

In addition to the natural numbers, this function is defined for all reals. To plot using R:

avail <- function(n) { return(data.frame(n, a = 1 - 0.1 ^ n))}

d_nat <- avail(1:7)
d_real <- avail(seq(0, 7, 0.1))

svg(file = 'output.svg', width = 7, height = 5)

ggplot() +
  geom_line(data = d_real, aes(x = n, y = a), color = 'red') +
  geom_point(data = d_nat, aes(x = n, y = a)) +
  coord_cartesian(ylim = c(0.75, 1), xlim = c(0, 6)) +
  xlab('Nines') + ylab('Availability') +
  scale_x_continuous(breaks=scales::pretty_breaks())

dev.off()

Nines to availability

Here are some examples not restricted to natural nines.

“Nines”Availability
00.0
0.10.2056718
0.50.6837722
10.9
1.50.9683772
3.50.9996838

Since the function is invertible, consider:

nines ( a ) = - log 10 ( 1 - a )
Availability“Nines”
0.00.0
0.090.04095861
0.50.30103
0.80.69897
0.91

So 80% availability is 0.69897, or approximately 0.7, “nines”. Likely nothing to boast about, but quantification is the first step.

(The 0.09 is included to foil attempts to consider a 9% available system as “one nine”: it’s 0.04 nines. However, extreme chutzpah may be appropriate in situations where a system is available less than ten percent of the time.)

(Music: Alkaline Trio, “We’ve Had Enough”)
Joseph Walton <joe@kafsemo.org>