SQLite has many viewing modes it can output, and I have difficulty remembering them all and what to use when, so I’m posting this as a public memory for myself and anyone else finding themselves googling “sqlite all modes example” a lot. Column Good for eyeballing data interactively - aligns values into readable columns. .mode column id name email -- ----- ------------------- 1…
Most things humans produce have a recognisable demand ceiling - the world will only eat so much bread, regardless of how cheap it is, and we’ll only upgrade our phones so often, no matter how nice the new models are. If we get 10x times better at growing wheat, we don’t grow 10x more wheat, because we’re pretty close to that upper limit now - instead, we get 10x less wheat…
Oh no! Your boss, Harry, is leaving the company. He was a good guy and a good boss, who appreciated the simple things in life. One of those simple things was a little program called “who-the-boss” which, when run, printed out “Harry the boss!”. His replacement is called Larry. Larry is a short-tempered man with little patience for anything he considers wrong, which is…
In this post I’ll show you how to write a function in Nim and call it in Python . Nim To start with we’ll need a Nim function. Here’s a one that takes 2 integers, adds them and returns the result: called.nim nim proc nim_add (num1: int , num2: int ): int {.exportc.} = return num1 + num2 Most of this is pretty ordinary, except for the {.exportc.} in the function signature. This is…
The Fibonacci sequence is the integer sequence where each number is the sum of the previous two numbers, starting with zero and one: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34 Writing a function to calculate an arbitrary fibonacci number is a common problem in interviews and tests, that has an elegant if inefficient way of being solved via recursion . Here’s a simple solution in Python: python def fib…