Archive

sorting algorithms

Sorting for Humans : Natural Sort Order

The default sort functions in almost every programming language are poorly suited for human consumption. What do I mean by that? Well, consider the difference between sorting filenames in Windows explorer, and sorting those very same filenames via Array.Sort() code: Explorer shell sort Array.Sort() Quite a difference. I

By Jeff Atwood ·
Comments

security

Blacklists Don't Work

Jon Galloway and I got into a heated debate a few weeks ago about the efficacy of anti-virus software. My position is that anti-virus software sucks, and worst of all, it doesn't work anyway. That's what I've been saying all along, and it'

By Jeff Atwood ·
Comments

government

Are You a Doer or a Talker?

Today's lesson comes to you courtesy of your local Department of Transportation:   The Utah DOT is spending $6 million on a feasibility study for a bridge across a lake. Meanwhile, the DOT doesn't have enough money to put up traveler information video cameras at dangerous mountain

By Jeff Atwood ·
Comments

programming languages

Gifts for Geeks: 2007 Edition

In case you hadn't noticed, it's that time of year again: let the wholesale buying of crap begin! As a technology enthusiast with a bad impulse purchase habit, I get a lot of complaints that I am difficult to buy for. That's sort of

By Jeff Atwood ·
Comments

algorithms

The Danger of Naïveté

In my previous post on shuffling, I glossed over something very important. The very first thing that came to mind for a shuffle algorithm is this: for (int i = 0; i < cards.Length; i++) { int n = rand.Next(cards.Length); Swap(ref cards[i], ref cards[n]); } It'

By Jeff Atwood ·
Comments

data structures

Hashtables, Pigeonholes, and Birthdays

One of the most beloved of all data structures in computer science is the hash table [http://en.wikipedia.org/wiki/Hash_table]. > A hash table is a data structure that associates keys with values. The primary operation it supports efficiently is a lookup: given a key (e.g.

By Jeff Atwood ·
Comments

customer service

Sharing The Customer's Pain

In this interview with Werner Vogels, the CTO of Amazon, he outlines how Amazon's developers stay in touch with their users: Remember that most of our developers are in the loop with customers, so they have a rather good understanding about what our customers like, what they do

By Jeff Atwood ·
Comments

user experience

Please Don't Steal My Focus

Has this ever happened to you? You're merrily typing away in some application, minding your own business, when-- suddenly-- a dialog pops up and steals the focus from you. At best, your flow is interrupted. You'll have to switch back to the window that you were

By Jeff Atwood ·
Comments
Shuffling

arrays

Shuffling

Pop quiz, hotshot. How would you write code to shuffle a deck of cards? I was thinking about this after reading Mike's card-shuffling algorithm woes: Here's where the non-CS mind comes into play. My first thought was to generate an unshuffled deck as an array-like structure

By Jeff Atwood ·
Comments

user experience

Presentation: Be Vain

Frets on Fire [http://fretsonfire.sourceforge.net/] is an open source clone of Guitar Hero [http://en.wikipedia.org/wiki/Guitar_Hero]. It's a great idea. Think of all the user-created songs we could play! My excitement quickly faded after I downloaded it and tried it out. I&

By Jeff Atwood ·
Comments

programming languages

Mort, Elvis, Einstein, and You

Earlier this week I wrote about The Two Types of Programmers. Based on the huge number of comments, it seemed to strike a nerve. Or two. This surprised me, because it was never meant to be the inflammatory, provocative diatribe that many people interpreted it as. It got so out

By Jeff Atwood ·
Comments

browser

What If They Gave a Browser War and Microsoft Never Came?

Two weeks ago, Apple announced a new version of WebKit, the underlying rendering technology of their Safari web browser. The feature list is impressive: * Enhanced Rich Text Editing * Faster JavaScript and DOM (~ 2x) * Faster Page Loading * SVG support * XPath support * Improved JavaScript XML technology (XSLT, DOMParser, XMLSerializer, and enhanced XMLHttpRequest

By Jeff Atwood ·
Comments