Havoc's Blog

this blog contains blog posts

Keep the JVM, dump the rest (Scala+Play+MongoDB)

I decided to try three new things at once and get back into some server-side development.

  • Scala uses the JVM for the hard work, but feels more like Ruby or Python. It’s statically-typed, but for the most part infers types rather than making you type them in.
  • Play ignores the Tomcat/J2EE legacy in favor of a more modern approach — “just press reload” to see changes.
  • MongoDB dodges the ORM problem by storing objects in the first place. People like JSON, so the database should store JSON. Done!

I was curious whether I could lose all traces of Enterprise Readiness and use the JVM with a nice language, a nice web framework, and no annoying SQL/ORM gunge.

TL;DR Answer: Promising, but lots of rough edges.

Some disjointed thoughts follow.

Books

Before starting, I read Programming in Scala and MongoDB: The Definitive Guide. Also the free Programming Scala but I would recommend the Odersky book instead.

I like Scala a lot.

If you aren’t familiar with it, Scala is a pragmatic language design.

  • it compiles to Java bytecode and runs on the JVM. Thus, no headaches for operations team, no need to port it to new architectures, quality JIT and GC, etc. A Scala app looks like a regular Java jar/war/ear/*ar.
  • you can use any existing Java library from Scala with no special effort, just import it.
  • it’s statically typed, but sophisticated generics and type inference keep the code looking clean and concise.
  • it supports both functional and OO styles, sanely mixing the two.
  • it has multiple inheritance (mixin traits) that works properly, thanks to linearization.
  • it has a basket of features that save typing, such as pattern matching and automatically creating accessors for fields.
  • language features give you ways to avoid Java’s preprocessor/reflection/codegen hacks (think aspect-oriented programming, dependency injection, Kilim, and other extralinguistic hacks)

While C# fixes Java by adding a bunch of features but keeping a pretty similar language design, Scala fixes Java by trying to bring the conciseness and fun people find in Ruby, Python, Haskell, or whatever onto the JVM.

There’s a popular controversy about whether Scala is too complex, and just reading about it I had the same fear.

  • I found I could get a web app working without hitting any complexity hiccups. You don’t have to design a DSL or understand variance annotations to write a web app.
  • I didn’t get any mystery error messages of the kind I used to get all the time in the early days of C++.
  • I’m not sure it’s more complex than Java if you include the usual stack of extralinguistic hacks in Java, and I doubt Scala is a larger language than C#.

Scala’s Option type wasn’t very helpful.

Scala has thing called Option, which I believe Haskell calls a Maybe type. It’s a container that contains a single value or else nothing. While Scala has null (for Java compatibility), Scala encourages the use of Option instead to clearly indicate in the type system whether a value can be missing.

In a web app, this was often used to check whether data store lookups returned anything. And in most cases I wanted to show an error page if not, accomplished in Play by returning a special object from the controller method.

While I’ve read posts such as this one, I couldn’t find a great pattern for using Option in this context. It was leaking up the call stack like a checked exception (code using an Option value had to return another Option value and all the way up). I found myself wanting to do:

val foo = maybeFoo.getOrThrow(WebErrorPageException(“whatever”))

then I wanted the framework to globally catch that (unchecked) exception and show an error page. For all I know Play has such an exception. You can unconditionally Option.get, but that will turn up as an internal server error, which isn’t nice.

Without using exceptions, Option tended to produce nested if() (or pattern match) goo just like null, or creep up into calling functions like a checked exception.

Play itself is very polished, but Play with Scala is not.

Play’s big win, which you get with Scala too, is to bring “just press reload” development to the JVM. You change either code or templates, then go to your browser and test. There’s no pressing build or even waiting for Eclipse to build, and there’s no creating a war file and deploying it.

Play brings other niceties, using convention rather than configuration (in the Rails style). Its template engine is much nicer than JSP/JSF/etc. ugliness, and you get quick and easy mapping from URLs to controller methods. If you’ve used Rails or Django or whatever Play will feel pretty normal. But this normal is a prettier picture than the traditional Tomcat/JSP/blah setup.

Originally, Play was for Java only. The Scala support is marked experimental, and I hit some issues such as:

  • The docs are spotty and sort of outdated.
  • The docs talk about using JPA (Hibernate) with Scala, but Googling around I learned it’s broken and not recommended. Some of Play’s magic convenience is lost if you aren’t using Play’s database and ORM. I started out trying to use JPA with SQL, but when I learned I’d be manually doing DB stuff anyhow, I switched to MongoDB.
  • Some bug in the MongoDB driver makes it break if you also use Joda Time.
  • The template engine sometimes couldn’t find object fields from superclasses (my guess, I haven’t tested yet, is that adding @BeanProperty would work around this).
  • File upload support only works via a temporary file (a File object) and not streaming.
  • Some hacky-feeling conversion from Scala to Java collections/iterators was sometimes needed for the benefit of the template engine.

Little bugs aside, I did get a simple app working and I enjoyed it a lot more than writing in Java.

The stack isn’t nonblocking by default as node.js is.

Play supports suspending an HTTP request and returning to it later, without tying up a thread. Scala, especially in combination with Akka, offers some nice primitives for concurrency while avoiding shared state.

node.js gets huge mileage because the core platform defines what the “main loop” looks like and has primitives for a nonblocking file descriptor watch, nonblocking timeout, and so on. All libraries and modules then work within this framework.

In theory, Play and Akka would let you do the same thing, but since it isn’t the default, you’re going to suffer. You would have to manually write little stub controller methods that always suspended the request and forwarded it to an actor. And your persistence layer probably has a blocking API (such as MongoDB’s blocking API) that would need another bunch of glue code and a thread or actor pool to encapsulate. It’s even an issue, though a simple one, that Akka doesn’t come with Play or Scala, and the Play module for it seems to be well behind the latest Akka version.

I suspect that in a real-world project, you’d start finding blocking IO all over the place, hidden in every third-party jar you tried to use.

It would be great if I could write an actor, annotate it as a controller, and it would receive web request messages and send back web reply messages. Similarly, it would be great if there were a MongoDB-via-actors kind of nonblocking API.

Play’s philosophy is that most controller methods should block because they should be fast; this is likely true, but it’d be nice if the framework overengineered it for me. BTW, here’s a comparison of Play and Node.js.

(I can’t decide whether I like the idea of this Play/Scala/JVM stack or node.js more. I think I like both. The simplicity of node.js, the nonblockingness, and the same language from client to server, make it appealing. But sometimes I like the idea of JVM solidity, the full-featured statically-typed loveliness of Scala, and the giant ecosystem of Java tools and libraries.)

Eclipse support isn’t great yet.

I’ve heard the Scala plugin for Eclipse was recently improved, and honestly I’m not sure whether I have the important improvements in the version I’m using. But it was not great.

  • I had an error “class scala.annotation.implicitNotFound not found” that just wouldn’t go away, though it seemed harmless. Suspect that it’s some version mismatch.
  • Perhaps because Scala is less verbose and redundant than Java, it’s much easier to get the editor confused about your code.
  • Autocomplete/intellisense/whatever-you-call-it rarely worked, the IDE didn’t seem to know what methods my variables had most of the time.
  • Refactorings and code generation shortcuts you’d be used to from Java weren’t there (though they were also far less necessary).

All this said, with Play and Scala you’d be fine with an editor instead of an IDE. Working autocomplete would be nice, though.

MongoDB is the Right Thing.

I love MongoDB (disclaimer: I haven’t deployed it, only coded to it). From a development perspective, it’s exactly what I want.

If everyone wants objects anyway, and in particular they want objects with JavaScript’s type system since they’re eventually going to display in a browser (or use node.js), then the data store should freaking store objects! Figure it out for me.

If the data store’s native representation matches the form I really want my data in, then it should (at least eventually) be able to store and query that data intelligently. JPA/Hibernate is a very, very leaky abstraction. I don’t need part of the storage engine inside my app, trying to convert what I really want into SQL. Then the SQL engine has to optimize without high-level information.

As far as I know, MongoDB is the “NoSQL” thing that adapts to how my app works, instead of vice versa. Nice.

Overall

There’s a lot of promise here, but if I were building a real app on this stack, I’d be tempted to hack on the stack itself a fair bit (always dangerous!). Play defaults to Java+SQL, and Scala+MongoDB isn’t the well-traveled path.

Disclaimer: I’ve done a lot of Java in the old school Tomcat/JSP/Hibernate style, but Scala, Play, and MongoDB are new to me. Your corrections and elaborations in the comments are very welcome.

Why I hope my kid won’t like The Phantom Menace…

… because it’s a terrible movie, but I have one other reason.

We have a young child and I read parenting books. More than one talks about agency and effort. If you emphasize innate attributes rather than choices and habits, people get messed up.  They value themselves in terms of something they have no control over.

In real life, effort gets more reward than inborn attributes. (There are studies on it, aside from common sense.) Believing that what you do matters more than who you are is a freeing idea. It creates optimism that it’s worth trying and learning, rather than pessimism that you and the world are what they are.

Who knows if parents can affect how children think about these things, but one can hope.

Like a lot of nerds, I enjoy science fiction and fantasy. These books and movies tend to involve heroes, frequently young, who save the world or some such.

Consider some classics everyone knows. In The Lord of the Rings, the hero’s virtue is perseverance. The book hammers you with just how long it took to walk across Middle Earth. (A good movie version had to be 3 movies.) Frodo doesn’t have any special talents, other than finishing the journey. Even then, he fails at the end and has to be rescued by luck.

In the original Star Wars trilogy, sure the force is strong with Luke, but he has to do a bunch of training, and when he leaves Yoda without enough practice he gets his hand chopped off.

Not exactly fantasy, but take Seven Samurai. A bunch of old pros illustrating character and experience as they save a village, with one young samurai bumbling along for the ride. Some of them get killed.

Now consider some less-classics. In the Phantom Menace, an annoying kid saves the day more than once, using his inborn scientology midi-chlorians.  Even though he’s a little punk, everyone praises his midi-chlorian count. No wonder he turned out to be evil.

I recently finished and didn’t enjoy The Name of the Wind in which some kid is the best at everything without doing any work at all, and while having no character at all. (I could go on about other problems with this book, let’s just say this sort of praise seems baffling. Forgive me, I know this book has a lot of fans.)

Aside from a bad message, there’s no interesting story in these. Someone is born special and then they do special things and … whatever. Where’s the meaning? To me that isn’t a good story. Jar Jar is an extra insult – the real problem is bad story and characters.

I’m still debating how Harry Potter fits in to my argument.

NY Times Digital Pricing: It’s Strange

As the Times rolls out its paywall, their message is that quality content should cost money. Their price segmentation undermines the message.

In theory, price segmentation can be arbitrary. In practice, consumers want it to be logical and feel that it’s fair.

  • content + phone app = 15
  • content + tablet app = 20
  • content + both apps = 35
  • content + dead trees = 30-ish

At $15 for phone and web, $20 for tablet and web, or $35 for all three, the Times has several problems.

The algebra doesn’t solve

The price structure can’t be rationalized. If the algebra doesn’t work, then it should be because of a “bulk discount” where buying more gets you a better deal.

Instead, buying more appears to charge you twice for the content. The most loyal customers are punished.

The prices imply that apps are worth more than content

If the Times wants to ask people to pay for quality content, charging $20/mo to add a second device but only $15/mo for all the content is nuts. Talk about undermining your own argument.

It doesn’t relate to costs at all

People resent paying to evade a restriction that’s unrelated to true cost structure. Failure to match costs with revenues can be a mess from a business perspective as well. Does the tablet and phone app division get credit for all the pricier subscribers? Can a competitor get an edge by pricing more sanely?

Limiting which devices can be used to read the paper is a daily annoyance for customers, but not one worth $180/year to solve.
It’s an opening for the competition.

The Times pricing may also evolve poorly as technology evolves. Tablets barely existed just a year ago!

Better approaches

Most of these ideas would be better:

  • have a single price — KISS
  • charge more for access to more sections
  • charge one-time prices for apps in app stores
  • don’t split tablets and phones; a single monthly charge for all non-web access, on top of the basic web subscription
  • have an ad-free tier that costs more
  • have a tier that ups your limit from 20 views but is not unlimited
  • have a tier that bundles some kind of third-party content or other valuable offer
  • put some content on a time lag unless you pay more

What the Times did instead is just… strange. It seems like one of the worst options to me.

Boolean parameters are wrong

Today’s simple way to improve your code.

Say you’re reading a program and you see some lines like this:

new ArrayBlockingQueue(10, false);
box.pack_start(child, false, true);

You don’t know what the booleans mean. Say you’re reading it and you see this:

new ArrayBlockingQueue(10, Policy.FAIR);
box.pack_start(child, Packing.FILL);

Which is better?

There’s only one time that a boolean is OK, and that’s when the name of the method (or keyword, in a language that has keyword args) already describes it:

queue.setFair(false);
box.set_expand(child, false);

Otherwise, no booleans. I know you’re too lazy to create an enum or flags type, but do it anyway.

Numeric types, for APIs where the number is expected to be a literal rather than a variable name, often have the same problem. But it’s a bit harder to solve in that case. The best solution may be for API users to use named constants.

Mystery-booleans are easy to avoid, though, so just do it.

Nice photo

golden

Asheville, morning 2011-01-11 by skippy haha on Flickr

Asheville, Off the Tech Hub Grid

Software developers often find themselves considering a short list of west coast “tech hub” cities when they think about where to live. As Richard Florida points out, “the world is flat” theories are at least partially wrong; industries tend to concentrate in certain cities, where people can find each other, hire talent, network, and launch companies. This could not be more true in the software world.

Last summer I posted about moving to Asheville, NC.  There’s not much tech industry here, and that sucks. In fact, there aren’t a lot of jobs at all, in any field.

In every other way, though, it’s wonderful, and ought to be on your list of places to visit (or even consider living). If you’d like to stay on the Eastern side of the US, restricting yourself to only tech hub cities leaves few options. If you can figure out how to work outside an industry hub, your choices expand.

West coast and Northeastern US residents often haven’t heard of Asheville. Let me tell you why you should have a look. (Hey, if I convince enough people, we can get a tech industry going!)

View of Cataloochee area in Great Smoky Mountains

Less than an hour west, Great Smoky Mountains National Park

Disclaimer

I’m not trying to argue which is the “best” city. Obviously: your happiness has more to do with friends and family, fulfilling work, and attitude than with location. And the best location has to do with what you like and best fit for you. There’s no beach near Asheville, if you’re a beach person, for example. Anyway don’t get defensive!

I thought I’d write something up because: Asheville isn’t as widely-known as it ought to be, it’s amazingly hard to find useful discussion of places to live, plus you might want to check the city out as a vacation spot.

The Quick Bullet List

Pros:

  • Located in a mountain valley at 2400ft, surrounded by national forest and parkland. Natural beauty visible from downtown. Outdoor recreation everywhere.
  • Economy powered by tourism attracts a vibrant artistic/creative class, leading to food, shopping, cultural events, and other city amenities you’d expect from a much larger city.
  • Typical commute into center of downtown during “rush hour” takes 5-10 minutes.
  • Milder summers than lower-elevation southern cities, milder winters than northeastern cities. Has four distinct seasons, with nice leaves in fall, a few good snowfalls in winter, typically 75-80 degrees in summer.
  • Much cheaper than big cities.
  • There isn’t the same “cramped condo near city stuff or big house out in boring suburbs” tradeoff you’d find in most big cities. You can live near downtown, and also near outdoor recreation, and have a spacious house, all for a reasonable price. In a big city you need a lot of cash to have space and be close to city amenities.
  • Airport is large enough to have regular flights to the hubs, but small enough that you can go from car to gate in under 10 minutes. Quick parking and total lack of lines more than compensates for lack of nonstops. (I rarely got a nonstop from say Boston Logan, anyhow.)
  • On the East coast. This may be a pro or a con for you. It’s a pro for us since we’re closer to family, and I like my mountains on a smaller scale, Appalachian-style.

Cons:

  • No tech industry. The economy is tourism-based. (It is entrepreneurial, but the entrepreneurs are creating food, hotels, art, etc. rather than high tech products. Starting a business may be your best bet for work, in fact.)
  • Public transportation isn’t good. The condo-in-city-with-no-car lifestyle doesn’t work well here. Though you don’t have to drive far or deal with much traffic, you have to drive at least sometimes.
  • There’s a school of thought on message boards comparing Asheville to non-cities; common points made include: there are lots of people with “hippie” clothes and tattoos, lots of traffic, crime, and stuff is too expensive. If you are comparing to any large city, I doubt you’ll take these criticisms seriously. However, yes, Asheville is a (small) city and has city things (on a small scale).
  • If progressive bumper stickers, everything-organic vegans, art installations, and things along those lines annoy you, you’ll be annoyed.
  • It’s small enough that some may find it claustrophobic.

Mountain State Fair

Comparable Cities

Here are some of the more-similar places you might compare Asheville to, to give a sense of how they differ. I won’t try to make a comprehensive list; just trying to locate Asheville among its peers.

  • Chapel Hill / Carrboro, NC, another small east-coast place with good amenities and low costs. Chapel Hill proper is much smaller than Asheville, but it has easy access to the larger Raleigh-Durham. Unlike Asheville, there’s a tech industry here. You’ll do more driving and see more sprawl in the Triangle than in Asheville, and you won’t have the 15-minute access to parks and forests. You’ll be hotter in the summer, too. In short, no mountains, but a lot more local economic opportunity. I’ll lump Raleigh-Durham itself into this bullet point.
  • Northampton, MA is a little college town in the mountains that has a similar “feel” to Asheville in some ways. It is a tenth the size, though.
  • Athens, GA is a larger southern college town, still smaller than Asheville. Unlike Chapel Hill, Northampton, and Athens, Asheville is not a college town; it’s a tourist town. But Asheville has some of the same creative-class feel you’d find in a college town.
  • Boulder, CO is half the size of Asheville. It’s far colder (the Rockies are much higher mountains!) and far more expensive. But it has a thriving tech community, great amenities, and better skiing.
  • Portland, OR is about four times the size of Asheville, with great public transportation, food, beer, and a lot more tech stuff going on.
  • Austin, TX is about eight times the size, but it’s a pretty inexpensive place to live with lots of great amenities and of course a tech community. It feels like a big city, though it’s smaller than the Northeastern cities.
  • Nashville, TN and Knoxville, TN are west of Asheville on the other side of the mountains. I haven’t spent much time in these cities but people say good things.
  • Charleston, SC might be the beach equivalent of Asheville, similar in scale, also a tourist town, about 4.5 hours southeast.
  • Greenville, SC is an hour south of Asheville, just below the mountains, and worth a visit. It has a nice downtown with a lot of effort behind it, including a lovely park around a natural waterfall.

Asheville deserves its spot in this book, it’s a yuppie/progressive/etc. kind of city. If you can’t handle it when people talk about sustainable, organic, crafting, etc. then you can’t handle Asheville.

(If it isn’t clear, I’m describing only one aspect of Asheville from a yuppie kind of perspective, because that’s what I know. There’s a lot of poverty here, too, and the city looks pretty different from that standpoint. And of course there’s a “tourists and yuppies go home!” point of view to be found.)

Getting Oriented

You have the bullet points, now here’s some detail.

Asheville is a small city in Western North Carolina (“WNC”), about 80,000 people in city limits, 400,000 in the statistical area.  In any direction you look, there’s a mountain vista Eastern-style: covered in green, 4,000-6,000 foot peaks, rather than the 10,000-20,000 feet out west. Asheville itself is in a valley, around 2,100 feet, but there’s a 2,600 foot mountain ridge running straight into the middle of town. You’ll see this mountain, rather than the downtown skyline, anytime you’re south of it.

Asheville has a tourism-based economy. As the largest city in the immediate area, it’s also the home of a regional hospital, the largest employer in town.

The city is surrounded by areas that aren’t open to development; Pisgah National Forest, Biltmore Estate, and  Blue Ridge Parkway, are some of the larger ones. Past Pisgah to the West, there’s Great Smoky Mountains National Park.

If you’re used to a larger city with actual traffic, understand the scale of Asheville. Driving from one side of the city to the other takes around 15 minutes.

My family’s approach to Asheville is to live in the city for daily proximity to what it offers, and then drive 15 minutes out to do outdoor stuff. Another approach is to live outside the city (cheaper) and either save money on housing or spend your money on having some land. I’ll focus on the in-city option because there are lots of places you could live in the country, this post is about the city of Asheville. Another option, btw, is to live in one of the charming smaller towns in the area, such as Hendersonville or Waynesville.

Biltmore House

Vanderbilt's house

History

In the 1890s,  George Washington Vanderbilt II decided to live like European nobility and built what remains the largest house in the United States here in Asheville. Today it’s a tourist attraction, with the house, a winery, restaurants, hiking trails, a resort hotel, and so on. (If you live here, you can get a cheap annual pass to visit the estate unlimited times, treating it as a giant city park.)

Asheville was a resort town in the last big credit bubble, in the 1920s. Downtown is packed with fabulous Art Deco buildings, and a number of neighborhoods are full of houses built in the 20s. It was a Great Gatsby kind of place (midway through the Great Depression, F. Scott Fitzgerald showed up and drank himself to death).  Post-1929, the city went into stasis for fifty years; they didn’t even have enough money to tear down or renovate the old 20s stuff — historic preservation through poverty.


asheville downtown from the southwest

Aerial photo of downtown Asheville in Fall

Downtown

Twenty years ago Asheville’s downtown was a wasteland (you’ve probably visited many cities that are still this way). All the great old 20s architecture boarded up and empty. Now, when I walk out of my office downtown on Friday or Saturday night the place is just swarming with people. There are an outrageous number of bars, restaurants, and coffee shops, with heavy competition pushing quality up. There are loads of art galleries. There are clothing boutiques and gift shops and a place that sells 900 beers. A great thing about downtown Asheville (and one reason it’s a tourist destination) is that most of the businesses are local and unique.

Chimney Rock State Park

less than an hour south, Chimney Rock State Park

Outdoors

For those who’ve been to Western Massachusetts, Vermont, and New Hampshire, the overall feel of Western North Carolina is similar to those mountain areas. The Berkshires are lower-altitude than the WNC mountains, but they’re also farther north, so their climate comes out colder.

East coast mountains are green and different in scale from those out West.

I don’t ski, and by all accounts it’s far inferior in the East. However, we have great whitewater, backpacking, mountain and road biking, trail running, leaf peeping, camping, fishing, and so on and so forth. You could spend years and never run out of new trails, rivers, and waterfalls.

When it’s nice out we go hike up a mountain or something on a moment’s notice. It’s not a trip you have to plan, it’s just as convenient as going to a movie.

Weather

You can’t beat Asheville’s climate while still having seasons.

North Carolina isn’t in the same heat league as Georgia or Texas, even in Raleigh/Durham. Western North Carolina moderates things further because of the altitude; Asheville is around 2400 feet. Spring and Fall are mostly perfect in the 60s and 70s, Summer tends to be 70s to 80s. 2009 had zero days above 90, though in most years there would be a few. On a 90-degree day, a short drive up a mountain can take 30 degrees off, plus offer a scenic picnic.

In the winter it snows a few times, so it feels like winter. Snow doesn’t stay on the ground for a couple months the way it does in the Northeast; within a few days there will be highs enough above freezing to melt snow. Asheville mostly lacks bitterly cold days, not venturing too far below freezing.

Some won’t like rain and humidity, but they are about average compared to the United States as a whole; while say Seattle (in winter) or Miami (in summer) are well above average. In the mountains, it often rains in short bursts, as wet air from the coast slows down.

asheville city from afar

Downtown, below it the mountain dividing downtown from South Asheville

Neighborhoods

You can split the city up into two broad categories. North, Center, and West are older areas with many houses from the 20s (and 40s,50s,60s; pretty much none from the 30s). These neighborhoods tend to be an older style with sidewalks, etc. For the most part these neighborhoods are in the city school district. East and South are newer areas and have sprawl tendencies (gated communities, box stores). These areas are in the county school district. In all directions things eventually fade into a more living-in-the-country feel. Of the older areas, West Asheville has had less gentrification and remodeling, so it’s cheaper. The old houses in the west often have no more than two bedrooms, while many old houses in northern and central neighborhoods have been redone and expanded. There’s a fair bit of new construction mixed into the older neighborhoods, as well.

Here’s a map of neighborhood names (only useful if you’re looking for a place to live).

International-style house in our neighborhood, set up for Halloween

Food and Beer

Asheville has an outrageous number of bars and restaurants for its size, thanks to tourist traffic. It’s competitive enough that many of them are very good, and often not even expensive. While the town has Friday’s and Chilis and so on, we haven’t been to those places since moving here: they are more expensive than the twice-as-good unique local places.

Food here tends to be honest, simple, and fresh, rather than showy fine dining or molecular gastronomy. Local ingredients are more common than exotica.

Craft breweries are big. Typically, restaurants have several of the local beers available.

I’d say the “restaurant rotation” near my office downtown beats the one near my old office on Boylston Street in Boston.

There are quite a few farmer’s markets that set up temporarily, in-season we visit a couple of them regularly. Plus the permanent WNC Farmer’s Market. There are four different “crunchy/organic” grocery stores, including Whole Foods, Fresh Market, the regional Earth Fare chain (my favorite), and the French Broad Food Coop. We have regular grocery stores as well, of course.

The quality food options are way ahead of those in most similarly-sized cities, they tend to be relatively cheap compared to large cities, and as always in Asheville, you can get there in less than 15 minutes.

Drinking a beer, watching the weather

Beer with a view

Tourist Attractions

Lots of people have written tourist guides for the area, here are some:

I’d tend to do some shopping/eating/drinking downtown in between visiting the surrounding mountains for your choice of outdoor adventures. There are some great hotels and spas though if you aren’t up for anything active.

But it’s in the South!

Lots of people just can’t handle the south. You’re being silly, people. Also, there’s a good chance you’re basing this on Atlanta. Livability-wise, Atlanta is a sprawl nightmare with superheated summers. Give the rest of the region a chance.

Asheville isn’t very “Southern” in the stereotypical way; lots of people relocated here from other parts of the country, and those who are from the South are often fleeing small towns where they didn’t fit in. Like Chapel Hill, Asheville is a little “blue” island in a red state.

That said, there’s plenty of Western North Carolina tradition in the area, including friendly people, good food, and all the rest.

An Incredible Value

Asheville excels in livability, with a bit less excitement than a condo near downtown in a large city, but far more excitement and convenience than a typical large city suburb. You get easy-to-visit-daily convenient access to both downtown amenities and outdoor recreation, which means in practice taking advantage of all those things.

When I lived in a Chicago apartment, I did city things but rarely left the city; when I lived in the suburbs of Boston, I rarely went into the city (and the suburbs are a wasteland!). In a typical Asheville week, we’ll do some stuff outdoors, and we’ll go downtown, because it’s all less than 15 minutes away.

Purple Aster

Town Mountain Road, just north of downtown

Egg nog preparation

Lots of people don’t like eggnog and then there are those with the energy to make their own from scratch. For those of us in between, here’s my favorite preparation so far. (Though experiments continue.)

  • Put a mix of half brandy and half sweet whiskey such as Maker’s Mark in the bottom of the glass. How much alcohol is up to you.
  • Add a pinch of decent Pumpkin Pie Spice (I use Trader Joe’s). This is better than just nutmeg.
  • Add a little bit of good vanilla extract, not too much, maybe half a teaspoon or something.
  • Stir the pie spice in well with the alcohol. Putting the spice in the alcohol avoids clumps and extracts flavor.
  • Fill the rest of the glass with cold Organic Valley Eggnog or another one you know is good. Do not buy the only shelf stable eggnog on the market today, for example.
  • Stir to mix alcohol and nog.
  • Place in freezer for 15 minutes or so.
  • Stir again.

Happy holidays!

If you don’t like that, then

Since eggnog is roughly ice custard that hasn’t been frozen, it’s also acceptable to just dump liquor in a milkshake.

Web server with URL fingerprinting out of the box

Years ago when we built Mugshot we stumbled on “URL fingerprinting,” Google describes it here. We used a “build stamp” (a continuously incrementing build number) instead of an MD5, but same thing. My guess is that many web sites end up doing this. Owen implemented the feature by writing a custom Apache module.

(The idea, if you aren’t familiar with it, is to give your static files an effectively infinite cache expiration time, but change their URL whenever the resource changes. If you have a bunch of JavaScript or CSS or whatever, people won’t have to re-download it on every visit to the site.)

It seems like the major web servers should do this out of the box. For a directory of static files, the web server could:

  • Generate a fingerprint for each file
  • Generate URLs containing the fingerprints
  • Communicate the fingerprint-containing URL back to the app server for use in templates (for example by writing out a simple text file with the mapping from original to fingerprinted URLs)
  • Set the infinite-expiration headers properly on the fingerprinted URLs

It is not a huge deal to script this yourself I guess, but do any web servers do this out of the box? Or maybe it’s a Varnish feature?

Ideally it’s dynamic, so if you change your static files the fingerprinted URLs automatically update.

Do centrists have an -ism to back them up?

In the past I complained about “libertarianism” and “socialism” melodrama in US politics.

There’s a broken pattern of thought, where people speak as if the only two economic ideologies are “government good, everyone must have equal everything” or “government bad, night watchman state.”  Moderates and centrists are seen as compromising — mixing the two extreme perspectives, and therefore unprincipled. This leads to a lot of slippery slope arguments: “if we go from a 36% to 37% tax rate, it must be because we think socialism is good! we’ll keep going all the way to 95%! run for your lives!”

Do we have to choose between the extremes, and an unprincipled “split the difference”? The words “centrism” and “moderation” imply compromise, rather than higher purpose.

But, there’s at least one principled ideological position that happens to be between the extremes. David Leonhardt’s article today brings it up.

The goal is a free market, but with limits on personal catastrophe.  Encourage tightrope walking by putting a net under the rope. The government goes one or two levels up Maslow’s hierarchy and then stops.

As Leonhardt puts it,

Guaranteeing people a decent retirement and decent health care does more than smooth out the rough edges of capitalism. Those guarantees give people the freedom to take risks. If you know that professional failure won’t leave you penniless and won’t prevent your child from receiving needed medical care, you can leave the comfort of a large corporation and take a chance on your own idea. You can take a shot at becoming the next great American entrepreneur.

In addition to encouraging entrepreneurial activity, a solid safety net prevents extreme economic inequality. As many have pointed out, the United States over the last decades has become less and less a middle class nation. There’s a huge gap opening up between the educated knowledge-workers doing well, and everyone else. This leads to crime, riots, gated compounds, political polarization, and all kinds of other badness. While it’s hard to imagine in the United States, there sure are a lot of historical examples where unchecked inequality led to government overthrow and the rise of wingnut dictators.

A centrist, safety-net approach has its own bright line; it isn’t just a hilltop with a slippery slope down to socialism or libertarianism on either side.

The line is: provide a way for anyone who makes an effort to meet their basic needs, even if they have bad luck. But don’t provide more than that. Try to offer everyone the opportunity to succeed, by providing a safety net, public education, and clear, predictable rule of law. But there’s no guarantee of success, it’s up to you and the free market. In this worldview, making it hard to fire underperformers is bad (free market), but the unemployed would have basic food, shelter, and health care while looking for their next job (safety net).

The goal is a “best of both worlds” scenario, a relatively stable society without extreme destitution and misery, and an efficient, productive economy where people are free to do what makes them happy.

This ideology better matches actual United States policies than either of the utopian, purist ideologies.

As far as I know, this pragmatic ideology doesn’t have a name that makes it stand alone. At least not a popularly-known name in the US. The only way to discuss it is to make it sound like a compromise, defining it relative to two extremes.

Isn’t it easier to rally around ideas when they have a good name attached?

Ridiculous settings screen showdown

Here’s a new one from today:

"Please individually acknowledge each bug in our code"

And also a classic:

where's the settings for the settings for the settings?