Typewriters

I have to say that sometimes I am incredibly surprised with some things. The last one has been to transform an old typewriter into a valid USB keyboard.

typewriter US keyboard

This baffles me, because I am old enough to remember a word with typewriters.

Well, I’m not that old. I only used a typewriter very briefly, on my school years, but I was close enough to people using them, most in particular, my grandfather.

My grandfather was a journalist and writer, and for most of his life, he used a typewriter for quite a long time every single day. I remember vividly the sound. And all the inconveniences.

The most obvious one is the unforgiveness of each page. Any small correction or typo will make you redo a whole page. 80% of his time was just copying again the same text. As a way to avoid this, you could hire someone to do it, presenting an annotated draft, but that was expensive and didn’t avoid completely the risk of introducing new typos.

Paper is also a very bad way of preserving information. Keeping a good reference of unfinished work is difficult, especially for old drafts. There has been too many cases of lost work just because the original manuscript was lost or destroyed in any way, to the point of being a cliché in movies.

And all the physical inconveniences. A typewriter weights a lot, needs ink, sounds uncomfortably high, needs a supply of paper and it’s full of moving parts that can break.

I understand that some typewriters are gorgeous, and worth being displayed as an sculpture. But I don’t get that anyone wants to use them on a regular basis right now.

typewriter

Oh, my grandfather came to write on a computer. He was probably the least inclined person towards technology I’ve ever met, but he saw the potential and abandoned the typewriter. Though it took a while to adjust, he said that his couldn’t have written his latests books without it.

Compendium of Wondrous Links vol X

wondrous_links

More interesting reads worth checking out

topblueprint

Tech

Red Lion, Pennsylvania, USA --- 6/1/1946- Red Lion, PA: Soft coal miners return to work... miners stand in the elevator cage, ready to descend into the H.C. Frick coke company mine at Red Lion, PA., near Connellsville, June 1st, to work their first shift since settlement of the soft coal strike. Pennsylvania'a 75,000 hard coal miners are still on strike while contract negotiations continue. PH: Edwin J. Morgan. --- Image by © Bettmann/CORBIS

About development

  • I’ve still confused with this “learning code is cool”, as this article says. I’m not sure if this is a bad time to be a beginner.  Yes, it’s true that too many options is confusing, but the amount and quality of instructional material at the moment is absolutely incredible. Beginners right now are a thousand times more capable of doing stuff than 20 years ago, just by the increase of productivity and clarity.
  • Tools don’t solve the web problems. Related to the first about the constant new tools for working on a web development, and their problems.
  • This tweet chain describes quite good the constant roller coaster when developing code.
  • Be friends with failure. The master has failed more times than the beginner has even tried.

Leonardo numbers

I have my own set of numbers!
I have my own set of numbers!

Because Fibonacci numbers are quite abused in programming, a similar concept.


L0 = L1 = 1

Ln = Ln-2 + Ln-1 + 1

My first impulse is to describe them in recursive way:

def leonardo(n):
    if n in (0, 1):
        return 1
    return leonardo(n - 2) + leonardo(n - 1) + 1 

for i in range(NUMBER):
    print('leonardo[{}] = {}'.format(i, leonardo(i)))

But this is not very efficient to calculate them, as for each is calculating all the previous ones, recursively.

Here memoization works beautifully


cache = {}

def leonardo(n):
    if n in (0, 1):
        return 1

    if n not in cache:
        result = leonardo(n - 1) + leonardo(n - 2) + 1
        cache[n] = result

    return cache[n]

for i in range(NUMBER):
    print('leonardo[{}] = {}'.format(i, leonardo(i)))

Taking into account that it uses more memory, and that calculating the Nth element without calculating the previous ones is also costly.

I saw this on Programming Praxis, and I like a lot the solution proposed by Graham on the comments, using an iterator.

def leonardo_numbers():
    a, b = 1, 1
    while True:
        yield a
        a, b = b, a + b + 1

The code is really clean.