Why is writing a closed TCP socket worse than reading one?

+1 To Greg Hewgill for leading my thought process in the correct direction to find the answer. The real reason for SIGPIPE in both sockets and pipes is the filter idiom / pattern which applies to typical I/O in Unix systems. Starting with pipes. Filter programs like grep typically write to STDOUT and read from … Read more

Followup: Finding an accurate “distance” between colors

Convert to La*b* (aka just plain “Lab”, and you’ll also see reference to “CIELAB”). A good quick measaure of color difference is (L1-L2)^2 + (a1-a2)^2 + (b1-b2)^2 Color scientists have other more refined measures, which may not be worth the bother, depending on accuracy needed for what you’re doing. The a and b values represent … Read more

What is eager loading?

There are three levels: Eager loading: you do everything when asked. Classic example is when you multiply two matrices. You do all the calculations. That’s eager loading; Lazy loading: you only do a calculation when required. In the previous example, you don’t do any calculations until you access an element of the result matrix; and … Read more