Alex Raichev

So Many Hours Lost

When you try to choose a meaningful variable name.

Sourced from this Tweet by Real Python.

"There are two hard problems in computer science: cache invalidation, naming things, and off-by-1 errors." ~Leon Bambrick

Author: Alex Raichev
Date: 2018-12-13
Tags: programming
Permalink, Comment

The Practical Dev

I use these programming books everyday. A thousand thanks to The Practical Dev!

Author: Alex Raichev
Date: 2018-12-07
Tags: programming
Permalink, Comment

Tangleball is Dead

President's Report, 2018-06-26

Tangleball is dead, smothered in a hooded blanket of colourless sawdust, a virulent algae that sucks the breathable atmosphere from what was meant to be a diverse and healthy ecosystem. Perhaps that is merely the most obvious sympton to blame for the failure of a group of predominantly like-minded and coincidentally demographically identitical individuals to argue their way to a vision outside of their own individualistic needs. Questions and fundamental management, basic rights, commercialisation, use of electronic discussion were argued passionately and at length, yet always were fought by dominant voices representing various sides, set in the mindset of crafting the space in a manner of how it can best suit what they physically want to do. Eventually, the wrong arguments won out over the wrong arguments.

Tangleball is dead, and perhaps like the majestic phoenix, the idea of something better rising from the ashes is an absurd fiction. However, the people who remain present and involved in the space seem willing to clean up the chaotic mess and remove the largest obstacles, before trying to hand over the reigns to people who can create something that is more welcoming, than self-serving. Perhaps this can one day be a space where wide array of different people can feel comfortable in the center of the action and in full control of the direction, and not forced to exhaustingly fight for a small space on the margins just because they do not look and sound the type.

Tangleball is dead, and perhaps something better can be built in its place. Or with the ongoing, looming threat of the rent going up or the building being sold, perhaps it will soon just fade away. In any case, long live something else.

Author: Alex Raichev
Date: 2018-12-06
Tags: report
Permalink, Comment

In a Dark Time


A documentary about the American poet Theodore Roethke (1908--1963).

Video sourced from YouTube here.

Author: Alex Raichev
Date: 2018-09-11
Tags: video, poetry
Permalink, Comment

I Knew a Woman

I knew a woman, lovely in her bones,
When small birds sighed, she would sigh back at them;
Ah, when she moved, she moved more ways than one:
The shapes a bright container can contain!
Of her choice virtues only gods should speak,
Or English poets who grew up on Greek
(I’d have them sing in chorus, cheek to cheek).

How well her wishes went! She stroked my chin,
She taught me Turn, and Counter-turn, and Stand;
She taught me Touch, that undulant white skin;
I nibbled meekly from her proffered hand;
She was the sickle; I, poor I, the rake,
Coming behind her for her pretty sake
(But what prodigious mowing we did make).

Love likes a gander, and adores a goose:
Her full lips pursed, the errant note to seize;
She played it quick, she played it light and loose;
My eyes, they dazzled at her flowing knees;
Her several parts could keep a pure repose,
Or one hip quiver with a mobile nose
(She moved in circles, and those circles moved).

Let seed be grass, and grass turn into hay:
I’m martyr to a motion not my own;
What’s freedom for? To know eternity.
I swear she cast a shadow white as stone.
But who would count eternity in days?
These old bones live to learn her wanton ways:
(I measure time by how a body sways).

~ Theodore Roethke, 1954

What a sweet poem! Here's my musical setting for (part of) it.

Author: Alex Raichev
Date: 2018-09-10
Tags: poem, Roethke
Permalink, Comment

The Event

Sourced from Saturday Morning Breakfast Cereal.

Author: Alex Raichev
Date: 2018-08-19
Tags: comic
Permalink, Comment

Deploying a Flask Application on Webfaction

A few months ago i had to deploy for the first time a Flask application on a Webfaction server. After studying this Webfaciton Community thread on the topic, issuing a Webfaction support ticket for help ---Webfaction customer service is excellent--- and trying and failing several times, i figured it out. Here's what i did.

Suppose that your Flask project structure looks like this:

│   ├──
│   ...
│   └──
├── Pipfile
├── Pipfile.lock
└── README.rst

that you are tracking it with Git, that you run it locally in a Python virtual environment, e.g. using Pipenv, and that it works. Now, let's deploy it to Webfaction.

  1. Log in to your Webfaction control panel and create a new mod_wsgi/Python application. Also create a corresponding domain and website for the app. I assume you know how to do that.

  2. Throughout the remainder of these notes, suppose that your Webfaction username is USERNAME and that your Flask application is called APPNAME

  3. SSH into your Webfaction server and run these commands:

    > mkdir home/USERNAME/webapps/APPNAME/APPNAME
    > rm -r home/USERNAME/webapps/APPNAME/htdocs
    > rm -r home/USERNAME/webapps/APPNAME/lib

    You don't need the lib directory in the last line, because you will be using a virtual environment.

  4. Set up Git, Git hooks, and push your local repository to Webfaction. See the Webfaction instructions here and here.

  5. Create your virtual environment ---let's call it VENVNAME here--- and install your app requirements. I think the easiest way to do this is to install Pip to install Pipenv to manage your virtual environments and packages.

  6. If your local repo has a .env environment file containing (Git-ignored) secrets, then create a corresponding .env file in your Webfaction repo.

  7. If you haven't done so already, create the file home/USERNAME/webapps/APPNAME/APPNAME/ containing the single line from main import server as application.

    This assumes that your Flask code lies in the module and that the Flask app you create in that module is call server. If that's not the case, then change the above snippet as needed.

  8. Edit the file home/USERNAME/webapps/APPNAME/apache2/conf/httpd.conf to the following, where PORT is the port number that Webfaction assigned to your application (which you can view in your Webfaction control panel for the app):

    ServerRoot "/home/USERNAME/webapps/APPNAME/apache2"
    LoadModule authz_core_module modules/
    LoadModule dir_module        modules/
    LoadModule env_module        modules/
    LoadModule log_config_module modules/
    LoadModule mime_module       modules/
    LoadModule rewrite_module    modules/
    LoadModule setenvif_module   modules/
    LoadModule wsgi_module       modules/
    LoadModule unixd_module      modules/
    LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    CustomLog /home/USERNAME/logs/user/access_APPNAME.log combined
    ErrorLog /home/USERNAME/logs/user/error_APPNAME.log
    Listen PORT
    KeepAlive Off
    SetEnvIf X-Forwarded-SSL on HTTPS=1
    ServerLimit 1
    StartServers 1
    MaxRequestWorkers 5
    MinSpareThreads 1
    MaxSpareThreads 3
    ThreadsPerChild 5
    WSGIPythonHome /home/USERNAME/.virtualenvs/VENVNAME
    WSGIDaemonProcess APPNAME processes=2 threads=12 python-path=/home/USERNAME/webapps/APPNAME/APPNAME:/home/USERNAME/webapps/APPNAME/APPNAME/APPNAME
    WSGIProcessGroup APPNAME
    WSGIRestrictEmbedded On
    WSGILazyInitialization On
  9. Restart your app via home/USERNAME/webapps/APPNAME/apache2/bin/restart.

These instructions will probably go obsolete in a few months, as all things web related do. Still, they'll help me while they last and maybe help you too.

Author: Alex Raichev
Date: 2018-05-17
Tags: instructions, tech
Permalink, Comment



Kūtere - (Māori, verb) to flow together, rush into one place. Made by my friend Kate.

Video sourced from YouTube here.

Author: Alex Raichev
Date: 2018-02-19
Tags: video, poi
Permalink, Comment

Take a Street and Build a Community


Video sourced from YouTube here.

Author: Alex Raichev
Date: 2018-01-04
Tags: video, resilience
Permalink, Comment

Poor Charlie's Almanack

I recently read Poor Charlie's Almanack, a collection of the wit and wisdom of investor Charles Munger. The book's content is summarized tolerably well in Munger's Wikipedia biography and the following free resources.

Munger's investment checklist

  1. Measure risk. All investment evaluations should begin by measuring risk, especially reputational.

    • Incorporate an appropriate margin of safety
    • Avoid dealing with people of questionable character
    • Insist upon proper compensation for risk assumed
    • Always beware of inflation and interest rate exposures
    • Avoid big mistakes and shun permanent capital loss
  2. Be independent. Only in fairy tales are emperors told they're naked.

    • Objectivity and rationality require independence of thought
    • Remember that just because other people agree or disagree with you doesn't make you right or wrong. The only thing that matters is the correctness of your analysis and judgment.
    • Mimicking the herd invites regression to the mean (merely average performance)
  3. Prepare ahead. The only way to win is to work, work, work, and hope to have a few insights.

    • Develop into a lifelong self-learner through voracious reading. Cultivate curiosity and strive to become a little wiser every day.
    • More important than the will to win is the will to prepare
    • Develop fluency in mental models from the major academic disciplines
    • If you want to get smart, the question you have to keep asking is "Why, why, why?"
  4. Have intellectual humility. Acknowledging what you don't know is the dawning of wisdom.

    • Stay within a well-defined circle of competence
    • Identify and reconcile disconfirming evidence
    • Resist the craving for false precision, false certainties, etc.
    • Above all, never fool yourself, and remember that you are the easiest person to fool
  5. Analyze rigorously. Use effective checklists to minimize errors and omissions.

    • Determine value apart from price, progress apart from activity, and wealth apart from size
    • It is better to remember the obvious than to grasp the esoteric
    • Be a business analyst, not a market, macroeconomic, or security analyst
    • Consider totality of risk and effect. Look always at potential second order and higher level impacts.
    • Think forwards and backwards. Invert, always invert.
  6. Allocate assets wisely. Proper allocation of capital is an investor's number one job.

    • Remember that highest and best use is always measured by the next best use (opportunity cost)
    • Good ideas are rare. When the odds are greatly in your favor, bet (allocate) heavily
    • Don't fall in love with an investment. Be situation-dependent and opportunity-driven.
  7. Have patience. Resist the natural human bias to act.

    • "Compound interest is the eighth wonder of the world" (Einstein). Never interrupt it unnecessarily.
    • Avoid unnecessary transactional taxes and frictional costs. Never take action for its own sake.
    • Be alert for the arrival of luck
    • Enjoy the process along with the proceeds, because the process is where you live
  8. Be decisive. When proper circumstances present themselves, act with decisiveness and conviction.

    • Be fearful when others are greedy, and greedy when others are fearful
    • Opportunity doesn't come often, so seize it when it comes
    • Opportunity meeting the prepared mind. That's the game
  9. Be ready for change. Live with change and accept unremovable complexity.

    • Recognize and adapt to the true nature of the world around you. Don't expect it to adapt to you
    • Continually challenge and willingly amend your best-loved ideas
    • Recognize reality even when you don't like it, especially when you don't like it
  10. Stay focused. Keep it simple and remember what you set out to do.

    • Remember that reputation and integrity are your most valuable assets and can be lost in a heartbeat
    • Guard against the effects of hubris and boredom
    • Don't overlook the obvious by drowning in minutiae
    • Be careful to exclude unneeded information or slop. "A small leak can sink a great ship" (Benjamin Franklin)
    • Face your big troubles. Don't sweep them under the rug.

Munger talk: A lesson on elementary, worldly wisdom as it relates to investment management and business

Transcript here.

In this talk Munger introduces his latticework of mental models for worldly wisdom and recommends that you build your own. He describes several of his models, including compound interest and the basics of algebra, combinatorics, probability, statistics, accounting, microeconomics, and psychology. He doesn't enumerate all his models in this talk or in the rest of the almanack or on the internet, as far as i know. But you can get more ideas from Farnam Street's list of mental models, which is inspired by Munger.

Update 2018-01-26: Here is another collection of mental models assembled by Slava Akhmechet.

Munger talk: Academic economics: strengths and faults after considering interdisciplinary needs

Transcript here.

Munger talk: The psychology of human misjudgment

Transcript here.

In this talk Munger lists 25 human psychological tendencies (cognitive biases), some of their problems, and some of their antidotes. Hint: Add these tendencies to your latticework of mental models and use them in checklist mode to avoid disasters in judgement.

Below is an audio recording from an earlier version of the talk (circa 1995), in case you want to hear Munger's voice.


Audio sourced from YouTube here.

Author: Alex Raichev
Date: 2017-12-28
Tags: book, advice
Permalink, Comment

Why no comments? I used to do public comments but found that moderating and maintaining them took too much time in front of the computer, time better spent playing outdoors. So these days I only do private comments, that is, you can email me comments regarding a post by clicking the 'Comment' link at the bottom of the post.