The Next Financial Crisis

Background

The financial crisis of 2007-08 was largely a result of legislative changes to the Community Reinvestment Act, namely the Gramm–Leach–Bliley Act. These policy changes essentially made it easy for us to heavily leverage our some of our assets, namely housing. The result was a bubble in home values. What goes up must come down (usually), and the rest is history.

Prophets

After the 2008 market crash many folks pointed to various stock market cycle theories, demographic theories, various patterns, etc. They began making predictions. Online postcasting prophets appeared out of nowhere, foretelling of certain woes in the years to come.

At this point, it's safe to say that most of them were wrong, since tomorrow is the last market day in 2017 and most predictions I read fell into the range of 2014-2017.

Summary

We can all stop worrying, because none of these guys knows what they're talking about. When it comes to the future, only one thing is certain: the market crashes on 08/09/2019.

Cheers.

Where Did the Empathy Go?

The word "empathy" entered the English language sometime around the turn of the 19th century1, and has enjoyed steady growth in usage ever since. Since around the end of World War II, the frequency of "empathy" in literature has increased by an order of magnitude. It would be easy to dismiss the upward trend as incidental, since we're talking about a new term, which could have replaced less effective words and gained popularity as a result1. Except that usage of "empathy" is still growing rapidly, so far doubling in search usage during the past 6 years.

A quick search yields countless articles about empathy and how it helps business, etc. Empathy has entered public discourse in very strong fashion. This dynamic makes me think about empathy as a kind of benevolent virus that's cheap to proliferate, but which yields great returns. And the only kinds of commodities which are abundant2 and highly beneficial, but also in high demand, are those kinds of commodities which are artificially held down.

Held down by what?

Golden Rule, Enter Stage Left

The Golden Rule, the maxim of the human kind; Do unto others as you would have them do unto you3.

The Golden Rule is a virus that replaces our empathy with the self-centered drive to do that which we see as fit for others. I won't just suggest that Emanuel Kant, Karl Popper, et al potentially had similar opinions. Instead, I'll prove to you, a priori, that the Golden Rule is not very golden at all.

If A wishes to be treated with Y, A should treat B with Y

A wishes to be treated with Y

Therefore, A treats B with Y

Given the above example, was B treated how B wanted to be treated4?

The end.

    Footnotes:

    1. I'll leave a more detailed etymology, etc. to an expert.
    2. What I mean by "abundant" in the context of something like empathy, which is theoretically infinite, is the finite competitive advantage that can be gained by such a trait before that trait is so prolific that it becomes less of an advantage and more of a basic requirement.
    3. This abridged version was written on the whiteboard of my kindergarten classroom.
    4. Hint: There isn't enough information to answer the question.

    Django's New JSONField Is Awesome

    Perhaps you have a profiles table with 5-10 really specific columns (e.g., blog_url, pet_name, favorite_framework_1, favorite_framework_2, etc.) with empty values in half the rows? Or, maybe you're a purist like me and you've just left some features out to avoid bloating your tables.

    PostgreSQL 9.4 adds the jsonb data type[3, 4]. Now you've got one of the great features of Mongo, et al – the natively supported ability to store and efficiently query data in a valid JSON format – and you can attach it right to a table in an ACID compliant database.

    Fast-forward to Django 1.9

    Django 1.9 (alpha release is in roughly 1 week) adds support for Postgres's new jsonb data type via JSONField, and that's a bigger deal than you'd guess based on the quick mention it gets in the release notes.

    In fact, it's amazing:

    Profile.objects.create(
    name='Michael Angeletti',
    info={
    'languages': [
    {
    'name': 'English',
    'level': 'native'
    },
    {
    'name': 'French',
    'level': 'un peu'
    }
    ],
    'websites': [
    'http://orokusaki.posthaven.com',
    'http://stackoverflow.com/users/128463/orokusaki'
    ],
    'city': 'Jupiter'
    }
    )
    Before JSONField, the above example would require language and website tables and a Profile.city field to be as robust, and the city field would probably remain empty in most rows anyway. HStoreField was added in Django 1.8, but hstore only supports strings (e.g., a list of websites) and you can't nest values. In the above example, HStoreField covers the Profile.city case, but not the others.

    In my personal experience developing an ecommerce shopping cart app in the past, I would have used this JSONField to store payment transaction data (e.g., from Stripe), had it been available, but in the shopping cart I probably wouldn't have stored something like an address in this way, since an address is a predictable format. Other things a hosted ecommerce app could use this for are configuring settings for a merchant (e.g., site title, colors, etc.).

    Although Django's new jsonb support handles serialization, deserialization and validation for you, the real magic is in the ORM's query support for this new data type:
    >>> Profile.objects.filter(info__city='Jupiter')
    [<Profile: Michael Angeletti>]
    >>> Profile.objects.filter(info__websites__contains='http://orokusaki.posthaven.com')
    [<Profile: Michael Angeletti>]
    >>> Profile.objects.filter(info__languages__contains={'name': 'French', 'level': 'un peu'})
    [<Profile: Michael Angeletti>]
    >>> Profile.objects.filter(info__languages__contains={'name': 'French', 'level': 'expert'})
    []