Can complexity emerge from lower levels of simplicity?

‘Is there really a Universe that is not designed from the top downwards but from the bottom upwards? Can complexity emerge from lower levels of simplicity?’ It has always struck me as being bizarre that the idea of God as a creator was considered sufficient explanation for the complexity we see around us, because it simply doesn’t explain where he came from. If we imagine a designer, that implies a design and that therefore each thing he designs or causes to be designed is a level simpler than him or her, then you have to ask ‘What is the level above the designer?’ There is one peculiar model of the Universe that has turtles all the way down, but here we have gods all the way up. It really isn’t a very good answer, but a bottom-up solution, on the other hand, which rests on the incredibly powerful tautology of anything that happens, happens, clearly gives you a very simple and powerful answer that needs no other explanation whatsoever.

Douglas AdamsSpeech at Digital Biota 2

Basic Authentication it’s often used as a simple security measure or as a temporary authentication method while developing with certain APIs.

While the WordPress HTTP API doesn’t have explicit support for basic authentication, it’s still possible to use it as a header:

$request = wp_remote_post(
  $remote_api_endpoint,
  array(
    'body'    => array( 'foo' => 'bar' ),
    'headers' => array(
      'Authorization' => 'Basic '. base64_encode( $username .':'. $password )
    )
  )
);

Remember that if you’re sending an unencrypted request, all the headers will be sent in plain text, so you should only use it over HTTPS.

Many people (by which I mean many Windows users”) don’t realize the huge difference between “the Windows way of doing things” and, basically, everyone elses’ way, i.e: the POSIX world which comprises all of the Unices, Linux, BSD and even OS X.

Hugo Landau writes:

From the perspective of POSIX, Windows is “alien technology” […] Windows and POSIX are fundamentally different in many ways, and lead to further “cultural” differences in how software is developed on these platforms. Windows and POSIX, then, are two “cultures”, the technical differences of the core technology itself being only a small part of that.

Read the entire piece at: The Cultural Defeat of Microsoft

You’re never grown up.

Life is a funny thing, you know. But I’ve always thought thirty was about it. Beyond that would be horrible to be alive. Until I got to be thirty-one. Then, “why, I ain’t so shabby”, you know. “I’ll hang in a while”. As you go along, you realize this whole concept of growing up is… you’re not grown up until the day they put you six feet under. You’re never grown up.

Keith Richards – Under the influence

I was recently debugging the front page of a WordPress site and found a lot of queries to the terms and term relationships database tables.

Digging a little deeper, I found that the culprit were a set of functions that were calling wp_get_object_terms() to get the terms from a set of looped posts… and then I thought… “wait a minute, doesn’t WordPress should be using the object cache for this?”

Well, it turns out that wp_get_object_terms() always queries the database.

If you’re looping over WP_Query results, you should prefer get_the_terms() instead. It’s pretty much the same for most use cases, but it uses the object cache, which by default gets populated with the terms for the posts matching your query — unless you specifically set update_post_term_cache as false when instantiating WP_Query.

The are several differences, though: wp_get_object_terms() can take arrays as the first and second argument, while get_the_terms() can only take the post ID (or object) as first argument (so you can’t get the terms for a bunch of posts on one function call) and a string for taxonomy (so you can’t get the terms for several taxonomies); and you can use a third argument on the former, which the latter doesn’t have.

You could still emulate some of this, and still benefit from using the object cache; for instance, let’s see how you would get the names of the my_custom_tax terms for the current post, ordered by use on a descending way.

// using wp_get_object_terms()
$popular_terms = wp_get_object_terms( $post->ID, 'my_custom_tax', array( 
    'orderby' => 'count',
    'order'   => 'DESC',
    'fields'  => 'names'
) );

// using get_the_terms()
$popular_terms = get_the_terms( $post->ID, 'my_custom_tax' );
// $popular_terms will be ordered alphabetically, so let's order by count
$popular_terms = usort( $popular_terms, function( $a, $b ){
    if ( $a->count < $b->count ) {
        return 1;
    }
    if ( $a->count > $b->count ) {
        return -1;
    }
    return 0;
} );  
// we only need slugs, so...
$popular_terms = wp_list_pluck( $popular_terms, 'name' );

Even if it’s somewhat troublesome, it’s probably worth the effort if you’re trying to maximize for performance.

Sigmund Freud’s couch

99% invisible tells the story of how Sigmund Freud’s couch came to be the symbol of psychoanalysis… even if it ceased to be as widely used as one might think based on movies and cartoons.

It’s time to dispel the myths about nuclear power

It’s time to dispel the myths about nuclear power lists some of the actual facts on the incidents on Chernobyl and Fukushima nuclear plants. Something to really consider if you’re really interested in diminishing the participation of fossil fuels on electric energy production.

What happens when shit happens

There’s a very entertaining and educational thread going on Hacker News about data loss and disaster recovery that came about an actual, ongoing, massive system outage at Gliffy… I’m sure everyone has a similar story to share.

How Mickey Mouse Evades the Public Domain

How Mickey Mouse Evades the Public Domain tells the story of how every time the cartoon it’s about to enter the public domain, corporate lobbying it’s able to bend existing legislation to protect private interests.