Tuesday, July 20, 2010

Call Me Phineas

Originally, I had planned my return to writing in on a less dramatic topic - I've recent purchased a house, had a couple of interesting dinners with the usual interesting people, and made more than my fair share of trouble. However, this is a story that has to be told - my friends and colleagues on Facebook and Twitter have been calling for it. Here you go.


This is a story about head injuries.

But not at first - at first this is a story about a man, a sedan, and Ikea. You see, I recently moved and, like all recently-moved people, I decided that it was time to change my furnished surroundings. However, I'm indecisive about how I want my new place to look and, therefore, that means cheaper furniture in case I get it not-quite-right. Therefore, Ikea, the Swedish süperstöre of affordable, generic, somewhat stylish furniture.

However, I own a sedan. Not the type of car you can carry a couch in. Or a lot of anything. But it is the type of car you might be able to get a leather chair into, if one were so inclined. Or at least, that's what I told myself in the warehouse when I put it on the trolley to head to checkout.

That message quickly changed to "You've made a terrible mistake," when I tried to get it in the car. Didn't fit in the front seat. Didn't fit in the back (couldn't get it through the door). Almost in the trunk, but it turns out that I would have had no visibility.

During this exhausting and exasperating exercise, two young ladies approached me and asked, "Do you need some help?"

Of course not - it was hopeless. They asked me how far I had to go - Capitol Hill in Seattle, I said. Turns out that, by sheer coincidence, that they also lived in Capitol Hill. One block from my new place.

And they had a truck. A glorious, black, spacious marvel of chair-hauling masterful engineering.

This was a windfall and a staggering one at that - people on Seattle are cordial and polite, but typically not so forward or friendly. These strangers, with their helpful attitude and their can-do gumption were just the thing I needed.

The catch was that they needed to do their shopping as well. So, we loaded their truck with my chair and walked into Ikea. During our time, I got to know them better and was overwhelmed that we had a bunch in common - one of them has an extensive boardgame collection, the other kept on getting excited about having a place to put their XBOX. I had not only gotten lucky with getting help, but I had made new friends with similar interests.

My new friends hadn't spent much time in Ikea, so I was their Ikea Pochahontas, their Ikea Marco Polo, their Ikea Christopher Colombus. Wait scratch that last one - we didn't actually kill any Swedes.

One of the things I like to do at Ikea is ride your furniture around in the parking lot - the lot at the Renton Ikea is on a bit of an incline, so you can get a nice ride going down, assuming a car doesn't plow into you. I think this stems from the fact that my parents never let me skateboard as a kid, so as an adult I love it.

So, I do that for a bit, riding a B&oumll&oomlkshelff and a Telvevisssion center down the hill a bit, and I turn to laugh with my new friends, jumping up a bit as I go so I can

BAM

Ow. What happened? I couldn't see, because my glasses were off, which I'm used to. But my hands were slick. And red. And my head was wet. Really wet. And so was the ground.

I hadn't lost consciousness and I'm not dumb (except for the aforementioned and at-this-time current injury), so I quickly put two and two together and realized I was gushing blood form my head. Because I had, in my fun-loving danger-free nature, catapulted my skull into the Ikea entrance sign.

My shirt came off and I started applying pressure.

Ok, so I'm shirtless in the parking lot of Ikea, blood everywhere. One of the young ladies calls 911 and Ikea secürity is approaching. On the phone, I'm talking to the 911 operator...

"Which part of Ikea am I in? Oh, the parking lot. As in the middle. Right in the middle. No, you really can'ty miss me. I'm the shirtless bleeding guy under the Ikea sign. It's super-obvious."

So, the Ikea secürity comes over and checks me out - asks if I want to file an incident report ("32 year-old man acts like 12 year-old and damages self." was what I imagined would go on there.) I think I even made a pass at one of the staffers checking me out - when she asked me to remove the t-shirt from my head, I told her she could remove anything else she wanted, too. Yes, she was cute, but I was nervous about bleeding from my head and humor and weirdness was how I chose to deal with it. It definitely beats screaming and generally freaking out.

The EMTs showed up and were more or less the same as secürity, except a little more condescending and less cute. I suspect they knew what happened and were non-plussed to be handling such a bush-league injury from such a chipper idiot. They gave me some gauze and told me if I started bleeding again to hit an ER.

Which is what I did two hours later, after one of the girls drove me and my car back to Seattle and the other drove our furniture in the truck. I started bleeding again after I tried to check my hair (vanity is a weakness, fellas). Apparently, I disturbed the vital scab-to-hair dyke that was keeping my blood from spilling over and crushing tulips in Holland.

So, after trying to convince myself and the young ladies that I was going to "walk it off", we headed to Harborview where I was admitted to what I was told was "a slow day." I guess I got lucky.

Did I mention that one of the young ladies drove me to Harborview? And stayed? It is this sort of shameless and selfless act that gives me hope. These two were absolute angels and have earned a debt of not only respect and friendship, but a debt of saving me from bleeding alone. For those of you who meet in the Seattle area, I will introduce you to them as "the most wonderful people in the world" and a "shining example of humanity."

This trip included part of which where myself, the young lady, and the physician's assistant discovered that my body had a remarkable immunity to local anesthetic ("Yes, I can feel that." "Yes, I know I shouldn't be able to." "Yes, I know you used the whole bottle." ) that resulted in the most hardcore surgical stapling of all time, replete with devil horns and me trying to play off excruciating pain by saying how metal this all was, including the screaming psyche ward patients nearby.

Meanwhile, the young lady was fascinated, child-like, at the process - she kept on going "Ewwww. Gross!" and backing away, but then started inching forward to keep on looking. She got some good pictures, too - especially the one where they peeled back an inch of my scalp to check for skull fractures.

Finally, it was over. I had lost a pint of blood, have about a dozen staples in my head, will have to shave my head until all the hair grows back, and hey, I also got my chair home. I'm sitting in it right now!

So, those of you who know me might be thinking about what a fool I am. Well, I'll grant you that it was a stupid accident and that I should be more careful. But for those of you who will laugh at my misfortune, I only have this to say: Get stuffed.

Bleeding sucks. ERs suck. Having to wear a hat for the next couple of weeks sucks.

But I made two great friends, who have been very much awesome since I randomly met them in the Ikea parking lot two days ago. They're fantastic human beings and I'm blessed to have met them, in my own weird way.
In a city like Seattle, where people are nice and polite, but not always friendly, that's worth a couple scratches and scars.

Until next time!

Wednesday, June 9, 2010

Changes and Absence

For more than a year, nothing has been said here, but that doesn't mean there was nothing to say - it's been a really busy year, mostly dealing with my work at Amazon and cloud computing development. Obviously, because of NDA agreements, I can't say too much.


In fact, anything about cloud computing or general computing, I'd rather say elsewhere. Friend and family, technical and not, read this journal and it feels as if spending too much time on technical works here will alienate part of the audience. to that end, I'm working on a technical journal to be hosted elsewhere. For those of you interested, more details will be posted at the end of June.

Then what does this make this journal? Everything else that I love - music, photography, cooking, and the Northwest. Entries about my new house, stories about sociology and psychology, and just plain fun.

Stay tuned...

Sunday, April 19, 2009

Desktop Magic: The Art of David Lanham

There are two challenges I face when getting a new computer: what to "name" it* and how to make it as artistically appealing as possible. This always means scouring different sites for a fair deal of different desktop backgrounds and trying them on, much in the same way you'd try on an outfit at a shop before buying it.

Someone or something had pointed me to the art of David Lanham a few years back and I had, in order, downloaded a coupe of his backgrounds and promptly forgotten his name, much to my disappointment. Last week, in my usual "make-computer-look-good-easy-to-use" quest, I found him again - tell me you can't love these:





Between the scary, the surreal, and the sublime, he has it all wrapped up - desktops and icons that keep me subtly stimulated while I'm doing the mundane computational tasks that take up my day-to-day.

*: Jury is still out on the Macbook host name - my past machines have been named, in order: ark, axalon, bismarck, eldridge, zion, puck, and deck. All of these are very masculine names and I'm considering diverging from that convention in the same manner I diverged from Linux and Windows this time around.

Thursday, April 16, 2009

Quarterly Update

Gadget Update: Kindle

Last month, I took the plunge and bought a Kindle. I had held one at the office about six months before we released it, noticing all of the features that I had originally hated were fixed: faster page load, thinner form factor, and a slipcover integration built into the body.

It's nice, and not in a normal way. I've ready two different novels on it: Diamond Age and The Second Book of the Tao, with both being easy to read and, as far as my eyes are concerned, the same as paper. However, it's lighter and less bulky than carrying all of my books around with me and lets me read something that meets my mood.

The best feature, though, is the cost of magazines. I currently get the New Yorker and Reason, both of which cost me about fifty to seventy-five percent less than the print versions and I don't have to recycle the magazines when they're done.

In short, I'm glad I bought it.

Gadget Update: Macbook Pro

On 4/1/2009 I made two updates to my Twitter feed:
bdimmick: is quitting the Internet.
bdimmick: has decided to not quit internet. Bought MacBook Pro instead.

The first is a joke, the second was a joke on myself - I have never owned a Mac for more than five minutes. A few years back, a Mac Mini made it into my home and immediately had Ubuntu installed on it, which doesn't count. So, spending three grand for a machine that I had never used seemed like a stretch, right?

A lot of my coworkers and friends thought so, too. Some strange stares, some puzzled looks, and the only sympathy received was from current Mac owners. "It will change your life," someone told me.

It has. This is probably the best laptop I have ever owned, with the second place going to my ever-dependable IBM Thinkpad, which have not been the same since Lenovo took over the operation a few years back.

The Mac just works. That's the party line, right? The hardware is well-designed, the OS built for that hardware, and that tight coupling makes for a great user experience. For me, it's the little things - the base of the keyboard has an area that my wrists naturally rest, the touchpad sensitive enough to make it usable, and a backlit keyboard that makes it easy to use in the dimly-lit coffee shops and bars of Seattle.

Performance-wise, it's also a dream. The graphics are strong enough to run Second Life or any other 3d application, the memory enough to keep Second Life, GarageBand, Eclipse, Firefox, Skype, iChat, and Twitterific all running at the same time. Additionally, the sound quality has a sharpness in no other laptop I've ever owned - today, I had a small chat with a friend on the East Coast over Skype, over the speaker, and the quality is as good as my studio headphones. That's nice.

New Project: Merkabah

I've been working on a new open source project called "merkabah", named after the chariot from Ezekiel. Details are forthcoming, once Amazon clears me to give the clearance to release more code. Cross your fingers, SQS users!

Favorite New Tool: RescueTime

If you're looking for a great system to track what you do on your computer, check out RescueTime - it's a daemon that runs on your desktop, records everything you do, and at the end of the week, sends you a report detailing everything you did over the week. You can also tag things you do and set goals around those tags - such as my goal to send at least an hour a week writing on this blog and ten hours on an open source project.

Speaking of which - hour's up! That's all for now - with the new laptop, longer daylight in the summer, and a promise to myself to write more in the coming months, expect more substantiative updates.

Monday, March 30, 2009

Hey, Recession: FU!



A note for all you Seattlists and Portlanders: Stumptown Coffee is giving away free cups of coffee every Monday from 9am to 10am. A fresh, french pressed, and delicious way to give the finger to the economica downtown.

Wednesday, January 21, 2009

Data Structures: Try to Trie

(Over the past six months, I've conducted over twenty in-house interviews at Amazon. What follows is the answer to one of the questions I've commonly asked, which is now retired from my list. This makes it imminently boring to non-technical types.)

Lead-in:Can you tell me the best way to store a dictionary?

The candidate usually identifies why we want to store the dictionary correctly - to look up words later - and invariably they come to the same conclusion as previous candidates before them: a hashtable.

At this point, I we talk about the benefits of hashtables - the average lookup time is great. The worst lookup time is horrible, as are the space requirements, which makes a good solution only for certain cases. More conversation is had about different architectures (server, desktop, small machine, mobile, etc) and their differing requirements.

Then I drop a twist on them: the dictionary data structure must fit in less memory than the space the dictionary file uses on disk. After a few minutes of staring at me, the candidate's jaw usually begins to slacken.

At this point, we talk about tries, a data structure that is designed to store information about sets of things (sets of letter in the case of words), especially their existence or non-existence. Essentially, it's a tree of nodes, with each node having a map that connects a letter with a child node. In any given node, you can mark it as an 'end of word' (or 'end of word' in the dictionary case) - any search that ends on a marked node should return 'true' for the existence of that word.

A trie has properties allow you to take advantage of the fact that most words start with a common prefix (think 'presume', 'pressure', 'present', 'presidential' - they all start with 'pres'.) All of the words with common prefixes get compressed down into one path on the tree, which means you can fit a lot of words in relatively little space.

Follow-up: OK, so we know what a trie is - can you code one on the whiteboard?

I've had varying degrees of success with this question - most people can't code on a whiteboard and it shows when they try. That's a topic for another time- right now, let's concentrate on implementing the trie in Java.

Start with the basics - a Trie must be able to do two things - insert a new word and look up the existence of a word. Let's prototype those methods:


public class Trie {
public void insert(String data) {
}
public boolean contains(String data) {
return false;
}
}


So far so, good. Some candidates choose to make Trie and Node a separate class - that's a matter of style the I don't distinguish as different. I choose to implement it in one class because it is easier overall.

Let's take part of the description and make it real: "a trie has a map of characters to child nodes" and "has an 'end of word' marker"


public class Trie {

private Map paths=new HashMap();
private boolean isWord=false;

public void insert(String data) {
}
public boolean contains(String data) {
return false;
}
}


Here, I usually dock the candidate if they don't use byte, don't use a boolean for the marker, and especially if they don't know how to build a map in Java. Generics are optional, but the bonus on this problem requires it and most candidates forget the cast from Object to Trie when they look up nodes later.

Next, we have to implement the insert method. This is essentially picking off the first byte, looking up to see if there is a path present, creting one if not, and repeating until we hit the end of the string. Once we're at the end, we set the marker to true.


public class Trie {

private Map paths=new HashMap();
private boolean isWord=false;

public void insert(String data) {
if (data==null) {
return;
}
byte [] bytes=data.getBytes();
Trie current=this;
for (byte b: bytes) {
if (!current.paths.containsKey(b)) {
Trie next=new Trie();
current.paths.put(b, next);
current=next;
} else {
current=current.paths.get(b);
}
}
current.isWord=true;
}

public boolean contains(String data) {
return false;
}
}


This does what it says - iterate over the bytes and when you get to the end, mark it. Penalties are given for not checking for null and no points are lost if recustion is used instead of iteration.

Next, we do lookup:


public class Trie {

private Map paths=new HashMap();
private boolean isWord=false;

public void insert(String data) {
if (data==null) {
return;
}
byte [] bytes=data.getBytes();
Trie current=this;
for (byte b: bytes) {
if (!current.paths.containsKey(b)) {
Trie next=new Trie();
current.paths.put(b, next);
current=next;
} else {
current=current.paths.get(b);
}
}
current.isWord=true;
}

public boolean contains(String data) {
if (data==null) {
return false;
}
byte [] bytes=data.getBytes();
Trie current=this;
for (byte b: bytes) {
if (!current.paths.containsKey(b)) {
return false;
} else {
current=current.paths.get(b);
}
}
return current.isWord;
}
}


That's it. One working Trie, usable on strings.

Bonus:: Ok, so let's make it work on any arbitrary set of data, such as an array of Integers, but not limited to that. I want a generic Trie.

This is an exercise left to the reader - needless to say, it's not hard and getting it perfect will give you a Trie that will work for every future use. Post your solution in the comments below!

Saturday, January 10, 2009

Thoughts on Service Economies, Economic Depression, and Huiman Awareness

When I moved to the Northwest, I made a journey to a place south of Seattle I had only heard about - Fry's Electronics. Reading about it in Coupland's Microserfs, I fell in love with that place and Ikea, and the two became the things I associated with the Northwest - I think I had gone to Fry's twice before I ever went to Pike Place Market or the Space Needle.

Every couple of months, I make a trip down there - it's about a 30 minute drive, sometimes longer with traffic - usually with no specific reason, just to see what's on sale and maybe pick up some gear for fun. Today I went in to get a second LCD monitor - I found one I had been looking at for a while and it was 50 bucks cheaper than Amazon's list price. It was a great find and I was very excited - finally, some more real estate for projects at home!

Fourty-five minutes later, I walked out of Fry's with no monitor, frustrated and annoyed.

In the time since I saw what I wanted, no salesperson approached me. I looked for a stack of the LCD monitor I wanted and found none - this means a salesperson has to get it from the back and bring it to you for purchase. After the first five minutes, I started making eye contact with a few salespeople, some of whom were tied up with other customers.

I then started making eye contact and smiling, which also didn't work for the next few minutes, while touching and examining the merchandise to show interest. This didn't work.

I finally got a salesperson to acknowledge my presence; she was very nice, smiled, and unfortunately, did not work in that department. She walked over to a salesperson who was busy helping an elderly couple decide on a monitor - she pointed me out, he nodded. And he never got back to me, even after the couple had left.

I switched to folding my arms and pacing around slowly, which is a signal of impatience. One salesperson, whose eye I had caught twenty minutes earlier, came over within three feet,. I made eye contact, he avoided me, and adjusted the monitors, checking some numbers. He walked off without even asking if I had been helped.

I waited five more minutes and left. I couldn't have given Fry's my money that day - I tried and they failed to take it from me.

The point of this isn't to slam this bad service - it's to point out how it could have been better. In a service industry in an economic depression or downturn, sales performers rise to the top and those that do not perform fall to the bottom. It's a simple fact.

By being aware of their surroundings and their customers, each salesperson I saw or saw me could have made a ten-minute sale of two-hundred dollars. That's US$20/minute or US$1200/hour if sustained throughout the store - that should pay for the workforce for a 20-person store easily.

In downturns, companies that have excellent service outshine the others - if people are spending less in general, you want to be known as a service leader. This means that those that buy from you expect quality and will statistically pick you over an unknown or negatively-viewed competitor.

It all starts with the worker - the individual who interacts with the customer.

So, how can workers obtain this awareness? Observe behaviors - people who have not made up their minds usually display generally neutral body language. In business, someone who is overly friendly towards someone they don't know often wants something - the only thing I want from a salesperson when I'm friendly is some quick assistance.

Similarly, pensive customers are sales lost - those who are going to be leaving your store soon and maybe not coming back. By catching them on their way out, you might be able to at least get them to come back to the store, instead of never coming back at all.

The benefit to the worker is enormous as well. Citing a number of sales on a review is going to give you more leverage in getting promoted or a raise. Being able to show how much a department will lack when you leave is a reason to keep you around. And should your reputation as a salesperson get outside your store or to the regional or national management, you may not be working the floors much longer, but training your replacement when you move into management.


"Be civil to all; sociable to many; familiar with few; friend to one; enemy to none."
Benjamin Franklin