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.

Wednesday, December 3, 2008

Google and T-Mobile: Six Weeks with my G1


Six weeks ago, I traded in my Verizon Wireless account and my Windows Mobile 5 phone for a T-Mobile account and an HTC G1. This phone, one of the potential competitors with the unstoppable iPhone, comes equipped with the Google Mobile Operating System, known as Android.

Originally, I had planned on writing a one-week review. After a week of use, I had only scratched the surface of use and had not fully integrated the phone into my life and work. Now, after having it for the holidays and spending a significant ammount of time looking into the developer experience of working with the phone, I humbly submit the following review for the reader's delight and consideration.

The Hardware

The hardware was the first thing I noticed in this model: HTC and T-Mobile no slouches in creating a usable phone that I continue to enjoy, despite some small problems.

The keyboard is excellent. Bigger than my old, chunky Samsung i735, it has the kinetic feedback that I found lacking from the iPhone - touching a screen is not the same as touching a button and only when we have developed and deployed kinetic-feeback LCDs will they be the same. Buttons are good. Some of the key placements take a while to get used to, but after two weeks, I was texting and typing with very little problems.

Also, to reveal the keyboard, you have to slide the screen up in a way that feels natural. On the back, is a curved track that makes the motion intentional without feeling forced.

Next is the screen - bright and responsive to the touch. I've been using a screen protector and even with it on, the brightness is clear. Some of the YouTube videos are grainy, but this is a phone and PDA - not a projector. The touch is responsive although it sometimes lags - this may be part of the screen protector.

The battery is fair - it runs down quickly when you have all of the bells and whistles turned on, so I spend most of my time just on the 3G network with GPS - no wifi and no bluetooth, unless it's plugged in. However, charging the phone is trivial - it takes a mini-USB plug at the bottom and once you attach the phone to a USB 2.0 prot with power, the phone starts charging. Since I have about six of these cords laying around from old phones, cameras, and other peripherals, finding a charging outlet is as hard as finding a computer.

Sound is also fair - the phone itself supports MP3, OGG, AAC, and WMV. With the built-in speaker, the music is great for my one-year old nephew, but not me. With headphones, music becomes vibrant and listenable, with this device replacing my iPod Shuffle and Creative Zen as my music player of choice.

Finally, a sore spot in the whole experience - the camera. I have not used an iPhone camera, but the G1 camera has such a large lag time to focus and adjust its internal light meters that I might as well draw the picture myself. Most of the photography I do is spontaneous non-still shots, which makes this phone useless for those quick "whip-it-and-click-it" moments. I am still carrying my SD1000 daily.

The User Experience

The software user experience is very well done - the landing page has a number of slots on them for different application icons that you drag and drop to where you want them. Very well done, and the feedback on moving the icons around feels like you're moving a tiny postage stamp around a page.

When notifications come in, they appear on the top bar and you have to drag it down to view them - this includes anything from text messages, emails, to running application status. It's a good way to see what is in your 'inbox' for the phone itself - I can context switch between texts, email, chats, and music with a few clicks.

Speaking of email and chats, the integration with Google's services is excellent. I often get emails and gChat messages to the phone before the appear in my browser. Since the keyboard is good, I have fallen back to writing small emails and chats from there, rather than sit at a computer.

Some of the UI elements need work in the second revision. Chief among these is the date and time picker, neither of which have the correct roll-over of the date when you go past the end of a month. Instead of going to the next month, it returns to the start of the current month - this could be easily fixed. Also, having to click seven times to move a date ahead a week is very annoying - Windows Mobile is the best interface for this that I've seen so far. They give you an outlook-like calendar and you just select the box one row down from the current date.

The stock applications are good for a casual user, but most users want more. The application store is currently all-free and has a lot of great applications - I currently have a bartending application, the Consitution, an SSH client, Facebook, and Twitter, to name a few. (I don't expect the number of apps to reach the size of the iTunes store, but I also don't expect it to reach the same level of silliness.)

Speaking of apps, let's talk about...

The Software Development Kit

The SDK for applications is a Java variant that uses XML for describing the layout and resources used by the application builder. It's fairly intuitive and has great Eclipse integration.

Unfortunately, the APIs are so poorly documented, when you get stuck, you get stuck very hard. Parameters are often abbreviated with no documentation on what they expect as inputs or provide as outputs. You're left with guessing as to what the designered expect.

Several books are on the market right now, and I have not had a chance to look into them - I'm willing to bet that having a non-Google written guide would go a long way for getting your development process kickstarted.

Conclusions

It's too early to tell if Android is a winner - it feels very much like a "version one" product and after a refinement period it will have the kinks kicked out - I'm happy for now and glad I made the switch.

Thursday, October 2, 2008

It's Complicated: Dating and Social Networks

At Burning Man, I met someone who has since become "someone special" - we've had some successful dates, enjoy each other's company, and it's generally awesome. I'll spare you all the details, but there's one thing I'm struggling with.

Social networks are great - I've found old friends, new friends, and more readers than if I were not out on things like Facebook, Twitter, Myspace, etc. Two of the three have this "relationship status" that I went to change this week. Let's look at the options:

  • Single - you're not seeing anyone or no one long-term enough or intense enough for their feelings to get hurt if you were to see someone else.
  • Married - you have a house, maybe some kids, and have been through a complicated and over-priced ceremony
  • Engaged - you're planning an over-priced ceremony and everyone is stressed out
  • In a relationship - you have a loving partner and it's been that way for some time
  • In an Open Relationship - you have a loving partner and have relations with other people
  • It's complicated - you don't fit into the above categories.
A lot of things go in that last category - from people who just met (like my case) or people who like animals (not my case). So, with great trepidation, I set my relationship status to "complicated" - and got bombarded by people asking what had happened.

Either I've been single too long or people have weird expectations of me. To get this out in the air:
  • Yes, she's human
  • Yes, she's a she
  • No, she isn't married
  • No, there isn't more than one of her
There we go. It's complicated because there's no better option. Anyone have a better description - like "I'm dating so-and-so"? IS "dating" even something we say anymore? Is it the parlance of our times?


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