Most of us are familiar with IP addresses: they are strings typically of the form “ddd.ddd.ddd.ddd” where ddd is a decimal number of up to three digits in the range 0 to 255. For example, 127.0.0.1 or 192.168.0.2.
Each of the four number is a byte value, and the address is an IPv4 network…
There are fewer serial killers these days. Some suggests it is due to better forensic techniques: we catch the killers faster and more efficiently.
Between the beginnings of the Web (1996) and today, the household Internet connection bandwidth got over 5000 times faster. Thus what took nearly two…
How much is a degree from a prestigious university worth? The answer is a bit difficult to answer because there are many cofounding factors: people from the connected class (folks that ‘know people’) tend to attend the most prestigious universities, and they also tend to do well…
A hash function is a function that maps a value (such as a string) to an integer value. Typically, we want random-looking values.
A Bloom filter is a standard data structure in computer science to approximate a set. Basically, you start with a large array of bits, all initialized at zero. Each time…
The Go programming language makes it easy to call C code. Suppose you have the following C functions:
char* allocate() {
return (char*)malloc(100);
}
void free_allocated(char *c) {
free(c);
}
Then you can call them from Go as follows:
c := C.allocate()
C.free_allocated(c)
It works well.
You…
While most of our software relies on Unicode strings, we often still encounter legacy encodings such as Latin 1. JavaScript strings are often stored as either Latin 1, UTF-8 or UTF-16 internally. Before we convert Latin 1 strings to Unicode (e.g., UTF-8), we must compute the size of the UTF-8…
Modern processors can execute several instructions per cycle. Because processors cannot easily run faster (in terms of clock speed), vendors try to get their processors to do more work per cycle.
Apple processors are wide in the sense that they can retire many more instructions per cycle than…
Artificial intelligence (ChatGPT) can provide better answers to patients than physicians.
Eating chocolate might affect your brain and cognitive functions. It may not make you smarter, but it might brighten your mood.
Obesity may shorten your disease-free lifespan.
A supplement called Netrin-1…
Whenever you enter a URL into a system, it must be parsed and validated. It is a surprisingly challenging task: it may require hundreds of nanoseconds and possibly over a thousand cycles to parse a typical URL.
We can use URL parsing as a reasonable benchmark of a system performance. Of course, no…
Many modern programming languages like Java produce useful error messages when they fail. Some indicate where in the program (e.g., down to the line of source code) the failure occurred. Slowly, the C++ language is moving in this direction.
A particularly nasty problem in C and C++ are segmentation…
Ovaries age quickly in women. By the age of 40, most ovaries are poorly functional. However, there is an ongoing clinical trial to check whether the drug rapamycin might slow down this aging. It is one out of several initiatives to post-pospone and maybe reverse procreative aging in…
Developers often believe that software performance follows a Pareto distribution: 80% of the running time is spent in 20% of the code. Using this model, you can write most of your code without any care for performance and focus on the narrow pieces of code that are performance sensitive. Engineers…
A French graduate student reached out by email yesterday with the following problem. Consider a format such as TOML which has line comments: when a ‘#’ character is encountered, the rest of the line is omitted. Let us look at an example:
[build-system] # use this to indicate the name of the…
There are many theories regarding what biological aging. Animals can differ by up to six orders of magnitude (100000x) in longevity. Some animal species like the lobster or the naked model rate do not exhibit measurable biological aging (they have negligible senescence) whereas trees and other…
Bryan Caplan, an economist, raised an interesting question on Twitter: why aren’t people celebrating the fact that tools like GPT might soon allow us to produce many more research papers at the same cost, without sacrificing quality?
The American government is funding research at the tune of 138…
In a previous blog post, I showed how you could define ‘an interface’ in C++ using concepts. For example, I can specify that a type should have the methods has_next, next and reset:
template <typename T>
concept is_iterable = requires(T v) {
{ v.has_next() } ->…
In an earlier blog post, I showed that the Go programming language allows you to write generic functions once you have defined an interface. Java has a very similar concept under the same name (interface). I gave the following example:
type IntIterable interface {
HasNext() bool
Next()…
Some university professors include ‘trigger warnings’ in their course material, to warn students that potentially disturbing content may be encountered. According to Birdgland et al., the research on the effectiveness of trigger warnings suggests that not beneficial, the triggers themselves…
We are all familiar with the concept even if we are not aware of it: when you learn about arithmetic in school, you use the same mathematical symbols whether you are dealing with integers, fractions or real numbers. In software programming, this concept is called polymorphism. To be precise, in…
Suppose that you assigned everyone a 19-digit number. What is the probability that two human beings would have the same number? It is an instance of the Birthday’s paradox.
Assuming that there are 8 billion people, the probability that at least two of them end up with the same number is given by…