XOR Media

Coding, Operations, Etc.

String Truncate Middle With Ellipsis

There are times when you need to middle truncate a string. In many cases it's for UX/human purposes, though in some situations it's the best way to generate unique string for a length-limited field. This is the case I ran in to recently in trying to automate ...

(more)
In code, tagged: python, coding, examples, and strings.

Natural Sort Order with Zero Padding

Which of the following lists is sorted in the most "natural" fashion?

A:
    Elementary Season 1 Episode 1
    Elementary Season 1 Episode 10
    Elementary Season 1 Episode 11
    Elementary Season 1 Episode 12
    Elementary Season 1 Episode 13
    Elementary Season 1 Episode 2
    Elementary Season 1 Episode 3
    Elementary Season ...
(more)
In code, tagged: python, coding, examples, and sorting.

High Performance Web: Asynchronous HTTP

Async-What

The secret to building high performance sites which depend on external web services is asynchronous HTTP. The trick to asynchronous HTTP (or anything with the exception of UI) is to avoid callback hell. Enter futures/promise objects. When used correctly they make doing substantial asynchronous IO, relatively straightforward.

It ...

(more)

What Google gets right, and where it fails

In the past couple days there's been several articles about how Google's interview process has failed. The headlines are overblown, inaccurate really, but to be expected giving the goal of getting clicks. In reality Peter Norvig was talking about counterintuitive findings. They were surprised to find that some ...

(more)
In people, tagged: hiring, interviewing, and opinion.

High Performance Web: Reducing Database Round Trips

Background

There are two main sources of latency in the backend of web applications: rendering (HTML templating or data serialization) and IO (database or external service calls.) Today we'll look at the latter and more specifically focus getting rid of extraneous database round trips. The fastest query possible is ...

(more)
In code, tagged: db, examples, performance, and sql.