Monday, August 20, 2012

Behaving Like a Leader

I've been an engineering manager at Google now for a couple of years and it's been quite an eye-opening experience for me.  I won't say I've got a ton of advice to offer (see first bullet below) but here are a few things I've taken away from the people that I take as great leaders around me:


  • Don't give advice unless you really have to.  This is easily the most important thing to remember and something I have to constantly work on.  Most people just want someone to talk to and they usually already know what the right thing is to do.  Offering advice is rarely considered helpful.  Listen and support their decision.  Most of the time the decision itself doesn't really matter as long as people move forward.
  • Learn to look people in the eye when you talk to them.  Many people find this challenging (myself included) and find themselves looking everywhere in the room except in the other person's eyes.  From what I've read, this is more often true for guys.  Especially for 1:1s, the best way to show that you're listening carefully and talking honestly to someone is to look at them when one of you is talking.  In particular, never look at your phone or computer without first saying why you're doing this (e.g., "Just checking the time to make sure we're not running late since I know you've got lots to do").
  • Take the personal issues seriously.  Don't dismiss things if they're unrelated to the task at hand or seem minor.  These things really matter to people and you should treat them as such.  Acknowledge them, enforce that you think this is important and include these things in your decision making (although they don't necessarily have to be the deciding factors).
  • Don't try to appear busier than you are.  Yes you'll likely be busy and people will realize this.  Resist any temptation to look like you're too busy to be approached (even if you really have a lot of stuff to do).  Always err on the side of appearing less busy than you are to remain approachable.  Avoid giving the impression that you're just trying to look busy so people will think you're important.  Nothing good can come of this.
  • Be modest.  You're probably not as good of a leader as you think you are.  Keep trying to evaluate your successes and failures.  Downplay the successes and over-emphasize the failures to keep yourself grounded, fight complacency and highlight your efforts to improve.
  • Wash your hands with soap every time.  This may sound like a minor thing but getting the details right and taking every situation seriously is important.  You should *always* (try to) conduct yourself in a way that you would like others to behave.  Every situation is an opportunity to influence people's impression of you and the little things really matter.


Monday, May 25, 2009

RIP Jay Bennett

Really sorry to hear about Jay Bennett's death. Bennett-era Wilco albums are among my most listened-to records. He'll be missed.

Sunday, April 19, 2009

HTML 5 on Mobile Browsers

Our most recent release of Gmail for the Android and iPhone browser tries to take advantage of some of the cool new HTML-5 capabilities that these browsers are supporting. In particular, both app-cache and the database are used heavily by our application. It's pretty amazing that these mobile browsers are pushing ahead as fast (or faster) than the desktop browsers. Just a year ago, writing anything for a mobile browser was slightly more painful than banging your head against the wall. Today, it's actually pretty reasonable.

See our first post here on the code.google.com blog: http://google-code-updates.blogspot.com/2009/04/html5-and-webkit-pave-way-for-mobile.html We plan to post regularly to this blog with details on how we worked with HTML-5, including details on new features, browser quirks, etc.

In my opinion it's great that mobile browsers are starting to do their part to make the web truly available to people on the go. Now if only carriers in Canada would provide reasonably priced data plans so people could actually take advantage of this. Ugh.

Tuesday, February 24, 2009

One New Thing Per Day(?)

I would like to learn one new random thing each day.  They have those tear-away desk calendars but what I really want is a daily email that teaches me one thing I (likely) didn't know the day before.  Anyone know if such a service exists?  If not, anyone interested in building one of these?  I wouldn't mind collaborating on this.

This reminds me of an old idea a friend and I started on called "Lore of Nations"...  Won't mean anything to anyone but him and I, so you know how far this idea went.

Saturday, January 17, 2009

Javascript fun

Unlike most Googlers, I have very little experience with JavaScript. I've only recently started dabbling and it's quite an experience. Many, many articles have been written on all the cool/bizarre quirks of the language, so I won't repeat them here. Instead, I'll point out a couple of tiny things that I ran into recently that are kind of cool/bizarre.

!!boolean_var - This is really just syntactic sugar, but it is pretty nice. If you want boolean_var to be treated as a boolean, this will nicely cast it from any value (including undefined) to its boolean negation and back, so you're guaranteed that boolean_var is a boolean.

arguments fun - The javascript "arguments" object is quite handy, but it can be pretty tricky. Consider these two definitions of a simple function to add 2 or more values:

>>> addAll = function(x, y) { 
      if (x != null && y != null) { 
        for (b = 1; b <>
          x += arguments[b]; 
        } 
      } 
      return x; 
    }; 

>>> addAll2 = function(x, y) { 
      if (x != null && y != null) { 
        for (y = 1; y <>
          x += arguments[y]; 
        } 
      } 
      return x; 
    }; 

>>> addAll(10, 2, 4, 6);
22
>>> addAll2(10, 2, 4, 6);
21


The first method works nicely but the second one fails. At first glance, it might appear the second method should work fine since "y" is not accessed after the null check, but notice that "y" and "arguments[1]" are aliased to the same variable, so using "y" as the loop iterator will mess things up. This is not a very common case, but if you're trying to optimize the javascript by avoiding unnecessary variable declarations, these details become quite important.  Be careful out there!


Wednesday, November 5, 2008

What if Obama is a flop?

Despite having not written for months, I didn't see how I could possibly let an event like this go by without comment. Far more significant than the Canadian election (even to us Canadians), last night's election says a lot about where the U.S.A. is at.

Of course, this is a very significant result. Despite a difference of only 0.1% of the popular vote, Americans actually did vote in favour of a minority for president. Unlike in Canada, where we picked the candidate that the rest of the world would look down on us for choosing, the U.S.A. picked the candidate that every other country wanted.

In a time like this, when everyone is happy and reflecting on the significance of the moment, I can't help but think of the worst-case outcome of this. What if 4 years from now the U.S.A. is still a disaster? Imagine that Obama floats through his presidency, without delivering on any of his promises, the country falls deeper into recession, the divide widens, etc. It certainly could happen. Specifically I'm thinking of a 2012 America where:

- Most citizens don't have free access to health care.

- They are still at war with (at least) three countries and losing many lives in the process.

- The sagging American economy has dragged down the entire world, such that new and emerging economies sink back to their old levels bringing many countries back to 3rd world status.

- More than 50% of Americans long for the days when a decisive Republican ran the country.

This could happen for a variety of reasons. Since every writer in the world is commenting on this election, the coming 100 days, the coming 4 years, etc. I won't comment on it here. Needless to say, despite every good intention and the rising hope of an entire nation (and arguably the world), it's entirely possible that nothing substantial gets accomplished and things operate pretty much as normal. I hope that's not the case, but it could be.

Despite the possible doom-and-gloom scenarios, this was, without a doubt, the right thing to do. This is the single biggest gift the U.S.A. has given itself and the rest of the world in my lifetime and regardless of what the next 4 years are like, I doubt anyone, from any country will be able to shake their heads and say "I told you so".

Sunday, June 8, 2008

On code reviews

One of the most valuable lessons I've learned from working at Google is the importance of code reviews. There was no mention of code reviews in school or at my previous employers, but now I can't imagine developing without it. Code reviews come in many forms but for my current project it comes down to one thing: Every piece of code must be okay'ed by at least one coder other than the code's writer before it gets checked in. That's it.

Here's a typical cycle:

1) Coder A writes code to add a small feature (or fixes a bug, or whatever).
2) Coder A shows diffs for this change to coder B (and possibly C, D, E, etc.)
3) Coder B reads through the code and notices some small logic bugs, a few style issues, and raises some other concerns.
4) Coder A fixes the issues that B brought up and responds to B's concerns.
5) Repeat 2-4 as many times as required.
6) Coder B is now happy and says so - in writing (e.g., via email)
7) Coder A checks in the change.

Sound painful? Sometimes it is. But the value added by this cycle is quite remarkable. It's extremely valuable to have people inspect the code before it gets in for many reasons, including:

1) Small logic bugs resulting from the same person staring at the same code for several minutes or hours are often caught quickly by a second set of eyes.

2) At least two people see every piece of code checked in, spreading the knowledge throughout the team and reducing the likelihood of ending up with code that only one person understands and/or can modify.

3) People are more cautious about what they check in. With code reviews, most developers do additional work to clean up, comment, and optimize their code before requesting a review in order to minimize the number of review iterations.

4) The blame can be shared among the team when things go wrong. This may seem like a small deal, but I think it's very important. No matter how careful people are, imperfect code will continue to get checked in. Without code reviews, it's easy to place the blame and this can cause animosity in the team. With code reviews, multiple people are involved in imperfect code getting checked in. This means that not only is it in everyone's best interest to make sure the best possible code gets checked in, but also mistakes become something that the team can improve on instead of just "coder A screwed up".

Code reviews add overhead, there's no question about it. But the value of code reviews is comparable to unit tests and other magic tools of software development productivity, so if you aren't using them, you should.

Wednesday, April 30, 2008

Climbing the CN Tower for WWF

A couple of weeks ago, a few of us Googlers climbed the CN Tower to raise money for the WWF. It was even more difficult than I anticipated, but it was also a great time. We raised $1480 which Google matched (giving $2960) for the WWF. If you get a chance to try it next year, you definitely should. Photo of us (post-climb) from the website here:

http://www.flickr.com/photos/saveourclimate/2433116362/in/set-72157604608762941/

Wednesday, April 16, 2008

Listening while coding

I sometimes get on these kicks where I can only work while listening to music. Other times I need silence. Lately, I'm in an unusual situation where I'm getting my best work done listening to This American Life episodes. I only recently learned about this wonderful radio show, but in the past 3 weeks I've logged well over 50 hours listening to one program after another. They have archives for the past 10 years that you can stream for free. There are tons of really interesting programs and somehow you can listen and code at the same time. Definitely worth checking out.

Monday, April 14, 2008

On interviewees' questions...

I do a lot of interviews these days and I'm always amazed at how much trouble people have asking questions. There are lots of good questions you can ask, and several bad ones. For a brief discussion of this (and a fantastic book about managing software engineers) check out Managing Humans.

Here are some bad questions (often asked by otherwise good candidates):
  • What exactly does this company/office/group do? [you should know this and so this really reflects badly]
  • How well did I do? [no way... you didn't just ask this... I don't believe it... ugh... most likely this means you did badly - if not you just lost several points]
  • How can I do better in the next interview? [are you serious? never ask this]
  • Anything about money [unless maybe you're talking to an HR person, which if I'm interviewing you, you're not]
  • I can't think of anything [nothing? nothing at all? really? you know you might have this job for the next 5-10 years; it could be thousands of hours of your life; it might keep you up at night from time to time; it might be the job you've always wanted; it might be the best decision of your life; it might be the worst decision of your life; are you sure there's nothing you want to know? really?!?!]
For me it's very simple. Ask two questions to each interviewer. Clear, concise, insightful questions. I find it easiest to ask one question about the job or a specific project/product and one about the company. And what's a good question to ask about each one? How do you know? You research it in advance! Know what your company does, come with an idea about what your job might be, and find things that interest you in these areas to ask about. If there's nothing that this company does that really interests you, you don't want to be there... really you don't.

Interviewees' questions don't make or break the interview - their answers do. Still, interviewers (especially if they're developers/engineers/etc.) like to know that their potential coworker has interesting things to say and shows some interest in what's going on. Think about it - this is probably what we want to do and we're here doing it. At least pretend you're interested.

But of course if you're just pretending... we'll know.

Saturday, September 1, 2007

Admitting mistakes

Yes, I was wrong.

In a previous post, I argued that you should clear out your inbox in the morning, evening, etc. Recently, I finished reading "The 4-Hour Workweek" (yes four) by Timothy Ferriss. Highly recommended, despite some obvious issues with his methods.

One excellent recommendation he makes is essentially this: "Do not clear out your inbox first thing in the morning." Why? Because you should have a plan for what to get done that day and clearing out your inbox does two things: 1) it takes time. often lots of time. and the morning is (for lots of people) the best time to get things done because other distractions are minimal and 2) it inevitably changes your priorities for the day. The second is the key here. I used to wake up in the morning thinking: "today I need to do this, this, and this". Then I would read my email and someone would say "can you do this for me? it shouldn't take long" and another would say "we should really do this. how soon can it be ready?" and "it would be great if we could do this today". Suddenly the 3 tasks I had in mind are replaced by other tasks (often less important) that I feel obliged to do today. So, nothing I want to get done gets done.

Over the past month I've followed Timothy's advice and not checked email until about 10am. By this point I've already got about 2 hours of work done on the tasks I really want done. In lots of cases, my work is half done by this point. Now the distractions begin, but I have about 6 hours left in my day and much of my work is already done.

This has really improved my productivity and made me feel a lot better about getting the tasks I really want done done. Recommended.

Wednesday, July 11, 2007

Embracing the present

It's been a while, I admit. But this time has been very productive. I got married and enjoyed a two-week honeymoon in the Greek Islands. Things were and are vey good.

Now I'm back in Waterloo and taking on more responsibilities at work than ever before. What does this mean? Three things:

1) More meetings - an unavoidable plague as old as work itself

2) More email - and thus more and more semi-involvement in things I really shouldn't allow to distract me

3) More mobility - in my case meaning the need to embrace technologies that I, for obvious reasons, should be using. In fact, this post is being entirely prepared on my new Blackberry Curve, not because I need to (my laptop's sitting right next to me) but so that when the time comes that I actually need to accomplish tasks like this in an airport, on a bus, or in a meeting (see #1 above), I'll be ready.

I would like to address all three of these points, but I have to say typing on this keyboard is painful beyond my wildest expectations, so let's just talk about #2. How do you/I deal with a big increase in email?

My current strategy has got me pretty far but is starting to buckle under the weight. It goes like this:

1) Keep the inbox clean. I use Gmail filters to apply labels to any mail from a mailing list. (Nearly) every mailing list has its own label, so I'm up to about 30 now. But the nice thing about this is I can always see unread counts for every mailing list. A clean inbox is a happy inbox. Personally, if after sorting through my mail there are still more than five items in my inbox (meaning I've read them but have to respond) I get nervous. I sleep well when the count is about 2.

2) Keep label unread counts near zero. This way I can easily scan which lists had recent activity. Then I go through my labels in decreasing importance/relevance to me until I've spent more than 5 minutes. After this point, I mark all the rest as read and get back to "real" work. It's possible that I would miss some things this way, but to my knowledge it hasn't happened yet.

3) Sort out all email at end of day and beginning of day. If I don't do this, email piles up so badly in between that just opening my inbox makes me depressed.

The real question for me is how to do #3. My ideal situation would be to get a treadmill, a wireless mouse, and a giant projection screen so I could read while exercising (which I absolutely can not do on a normal sized screen). Unfortunately, I'm not there yet. I just suffer through with my laptop while half-watching Hell's Kitchen.

I really do have more to say here, but my fingers are absolutely killing me.

Saturday, April 28, 2007

Hiring at an "Insane" Pace

Google wants to grow. Some would call the growth plan aggressive, others call it insane. I prefer to think of it as ambitious. While the exact numbers are sometimes tough to come by, you can get some approximate numbers on many websites. Take for example, the numbers here. If these numbers are to be believed, Google grew at a rate of 100% per year for the past two years. For a company with several thousand employees, this is pretty good. The growth rates show Google passing Microsoft by 2010. Of course, it's very unlikely that the growth rates can be sustained. But we want them to be.

First, it's clear that we could hit these goals in the short term. We get many, many, many resumes a day. In fact, if we hired everyone that applied, we could probably double in one day. Is this a good idea? Probably not. Clearly, many of the applicants would not be qualified, meaning we would not necessarily get much production from many of the hires. Worse, many of the hires may not be "Googley". I personally believe that this is the most dangerous hire to make.

This deserves more attention, because I haven't seen enough focus placed on this in any other company. Anyone who does not fit the culture of their group, office, or company is very damaging. For example, when I interview someone, the only attribute of a candidate that essentially guarantees an unfavourable review (from me) is arrogance. Don't get me wrong - some people are absolute superstars and they should be confident and proud. But Google is full of smart people, many whom were at the top of their class and were suffocating in school or in other work environments. I don't care who you are, you're applying for a company that employs Vint Cerf. This guarantees one thing - no matter who you are, you will no longer be the smartest person in your company. This is a good thing! This is (or should be) why you want to be here.

Google offers lots of benefits. Everyone's seen the cafeterias, the massage chairs, the gyms, the prestigious visitors, the big monitors... whatever you consider a benefit - Google probably offers it free. But this is not why people want to work for Google. They want to work there because some of the greatest minds in the world are there. People at Google solve interesting problems in interesting ways, because some very smart people are bouncing ideas off even smarter people. If you were in the top 1% of your class, this is probably the exact environment you've been dying for all these years.

Okay, enough of that... Back to the matter at hand. How can you possibly sustain this growth rate (intelligently):

1) Don't lower your standards. Google has lots of smart people now and these people love working with/for other smart people. It's extremely valuable to know that (nearly) every line of code you will come in contact with was written by someone you can trust. There's nothing more frustrating than struggling with code, or a person, or a group that you don't think you can trust. This means you need to believe that everyone in the company knows how to identify, formulate, and solve problems intelligently.

2) Get a lot of referrals. Referrals are (and have always been) the best source of potential candidates. It's often the case that good, smart people know other good, smart people. They may be former classmates, co-workers, friends, anything. There are clear advantages to these people. For one, they probably come with positive comments and information, before you even interview them. Second, they have some attachment to the company, however small, through their referrer. Third, they often consider referrals flattering. I think lots of people would be happier having a company that wants to woo them, as opposed to having to seek out companies to sell themselves to.

3) Get a lot of resumes. No matter how many people you have, they aren't connected to everyone. Always allow people to apply directly and be diligent about finding the best resumes as they arrive. This bring us to...

4) Filter aggressively. This may seem cruel, but is very important. Interviewing a candidate is very expensive. A phone interview is not as expensive, but still requires anywhere from 30 minutes to 2 hours for someone to prepare for the interview, conduct it, and write feedback. It's frustrating (and sometimes even depressing) for an employee to interview candidate after candidate that is clearly not qualified. This means you want to get to the point where most (or ideally all) candidates that you contact have some reasonable chance of succeeding. This is important because it reduces the strain that the hiring process places on existing employees. Perhaps even more important is that it reduces the negative impact on unsuccessful hires. This brings us to...

5) Try to make the process pleasant. Not everyone is going to get hired. This is a fact at any company. And in a company with a very selective interview process like Google, most people will not get hired. Or at least, they will not get hired on their first try. Not getting hired sucks. You can find many blog posts on the web about people who were mad about not getting hired. They blame the interviewer, the company, the weather, anything. This reflects badly on the company and fosters an unpleasant image of the company's hiring process. There are two important scenarios here: 1. If someone does not get hired (but nearly did), you want them to want to try again. Make sure they enjoy their process, get them excited about working for your company, and encourage them to try again. In a commitee-based hiring process (like many companies, including Google, use), if you nearly get hired this time, you may get hired next time. Companies strive for consistency in the process (and this is especially true of Google), but the process is never precise enough to always make the right call on cases which are not clear-cut. The process should always work for the superstars (the top, say 20-30% of your hires) and the definite not-hires, but in a competitive hiring environment (like Google's) the other 70-80% of the current employees are probably "borderline hires". By this, I mean, for example, that if they went through the same type of interview process 10 times, at least one or two of those times, they would not pass. If this represents the majority of your current employees, it will likely also make up the majority of your future employees. Protect this resource! 2. If someone does not get hired because they are clearly unqualified, you want them to enjoy their process but accept that this is not the job for them. There are many smart people, who simply apply for the wrong job. We want them to enjoy the process (even if they didn't do that well) and understand that it's not that they're not smart, but simply that this is not the job for them. Keep them in good spirits and thinking positive about your company and how you treated them. They might have friends that are a perfect fit and you don't want to lose them.

6) Hire everywhere. This is obvious, but is key. If you can set up offices all over do it. If not, travel everywhere to find the best people. Seek them out and bring them in. This subject doesn't get me as passionate as (5) though, so let's leave it there.

I spent the most time talking about point (5) and there's a good reason for this. This is the one thing companies seem to worry the least about. Lots of people leave their interview unhappy. And when they don't get hired, they carry around a grudge. Your company does not want people carrying grudges around. The tech sector is large, but the clique of top people in the tech sector is small. Part of staying on good terms with these cliques is keeping everybody as happy as possible, whether things go well or badly for them.

If you take nothing else away from this, take this one thing that I now firmly believe is essential to growing quickly and effectively: be good to both the hires and the passes.

Wednesday, April 4, 2007

Review of "The Tipping Point"

Finished reading Malcolm Gladwell's "The Tipping Point". This is quite an interesting book, but I can't say there were too many new insights here.

The basic idea here is pretty simple: small things (or several small things) can lead to epidemics. He gives many examples including crime waves, diseases, fashion, TV shows, etc. He uses this to motivate word-of-mouth marketing. This comes down to the Mavens (well-informed, early adopters, trusted by others for advice), Connectors (who communicate effortlessly with others in many different walks of life - experts in "weak relationships"), and Salesmen (who can sell anything to anyone anytime). To simplify all his arguments: win favour with the Mavens; facilitate communication with the connectors; wait for the salesmen to make you rich.

The book is worth a read, but don't expect any answers. Yes, everyone wants word-of-mouth (or "viral") marketing. Everyone wants their new website to be the next YouTube. But I'm telling you right now, it won't happen. Or it probably won't. You want to be in the 0.001% and so do I. Right now, we're not. And we might as well get used to it.

Everything the author says about how products "tip" (i.e., go from relative unknowns to huge money makers) is believable; however, as the book says, you can't force this process. Any attempt at viral marketing comes off as phony. So although you want this, and in a sense you need it; if you're thinking about trying to make this happen, you should probably forget it. Know that many, many people have failed before you. Think hard about all the issues that can come from this and make sure you avoid them.

There's so much to say on this topic that I will certainly come back to it later. For now, let's just say that mastering viral marketing is like finding the holy grail, and your chances of achieving it are about as slim.

Saturday, March 31, 2007

Google Beyond Waterloo

As Google grows, it helps to get out and visit new people and new offices around the world. Travel is a small part of my job, but I'm always up for it. In the last couple of months, I was in London (England) for one week and California for another. There's nothing like drinking pints of English beer in a real British pub. And visiting California (at +20c) during a Waterloo winter (at -20c) is not too bad either. The plan is to visit as many Google offices as I can find excuses for. Next stop: New York. Or Montreal. Or Hong Kong. Or Sydney, Australia. Or Sao Paulo. Or Bangalore . Or Dublin. Or Munich. Or Istanbul. Or wherever Google opened a new office this week.

Friday, February 9, 2007

Launching a Mobile Client

We launched the Gmail for Mobile app in the UK, France, Italy, Germany, and Spain this week. This is a really difficult thing to do. Of course there's a lot of work in getting all the strings translated and making sure everything shows up nicely, but this is only the start.

Carriers in different countries have different devices, data plans, network restrictions, gateways, etc. It's never clear whether or not the application will run in any of the countries where you want to launch. The way things are now, the only way to know for sure is either (1) know someone in the country who has a phone and/or can buy one or (2) fly someone there. Seems crazy, but this is the only real way to know for sure.

And what if it doesn't work? How do you fix it? You could fly a developer there which is bad because (1) it's expensive (2) it's often not clear that the problem can ever be fixed (3) developers don't like having to fly all over all the time to fix very specific bugs - they like fixing more general problems or implementing cool new features. Debugging remotely is (needless to say) a nightmare. So, no matter what you do, it won't be pleasant.

I guess this is part of why mobile applications are so slow to gain popularity around the globe. Most are only popular in certain countries and are unheard of everywhere else. If it's a hassle for a company like Google, with all our resources, I can't imagine what it must be like for all the little startups.

Tuesday, February 6, 2007

Laptop Magazine - Editor's Choice Award for Gmail for Mobile

One of the projects I work on at Google is the Gmail for Mobile client for cell phones. It was released back on Nov. 2, 2006 and has received lots of press since then. In February's edition of Laptop Magazine, it was given the Editor's Choice award, which is nice. I think our most common compliments have been on the usability and Gmail-y feel of the app. The most common complaint is: "It's missing feature X", where X is one of many, many possible features. Some X's can be implemented on many phones, some on a few phones, and some on about one phone. Hopefully as phones become more and more capable, all these X's will be at least technically feasible. Then it will just be a matter of finding the time to get all these things working. Which is, of course, a much harder problem.

Friday, February 2, 2007

User Agent Switcher

If you do any mobile development, you should definitely get to know the User Agent Switcher add-on for Firefox. What does it do?

Well, when a browser sends a request for a webpage, it includes a string describing some information about who is sending the request (e.g., the browser name, version, etc.). Mobile browsers (well, most of them) send information about the device make, model, MIDP version, etc. Websites can use this information to decide what page to serve up (if any).

The User Agent Switcher add-on allows you to pretend that the request is coming from any device. This means you can see exactly what page would be served up if that device visited the website. How does it do this? By spoofing the user agent, of course. For example, if you want to see what a website would display if you hit it with a Nokia 6230i, you can have the User Agent Switcher send the following user agent: Nokia6230i/2.0 (03.23) Profile/MIDP-2.0 Configuration/CLDC-1.1

I won't go into details about how to use it - it's pretty simple. But, it can be extremely useful for debugging websites, especially those that only have issues on certain devices. There are lots of other nice tricks you can play with the User Agent Switcher to test and debug problems. I'll go into more details in a later post.

Monday, January 29, 2007

Verification Errors With Blackberry Applications

If you've worked on applications for the Blackberry and you're unlucky (like me), you may have tried to run your application on the simulator or a device and seen an error message something like this:

"Error starting MyApp: Module 'MyApp' has verification error 2778 at offset 3fce"

It appears that the two numbers (2778 and 3fce, in this case) are not helpful in diagnosing the problem. Basically, you're on your own. And it's going to get ugly.

According to RIM, it's likely that the COD files have been corrupted. Unfortunately, this can happen just by building with the rapc compiler, and optionally signing the app. So, what can you do? Well, I've fought with this a few times and I can at least give you some suggestions to try:

1) If you started by building a JAR and then used the rapc compiler to create COD files, make sure you turn obfuscation off when building the JAR. The rapc compiler will do its own obfuscating and it often has issues if the code is already obfuscated.

2) Comment out dead code. Sometimes the verification errors seem to have something to do with the size of the main code file and the library files. If you comment out some code that never gets called, the file sizes change somewhat, and this often fixes the problem.

3) Remove references to a static instance variable from an inner class. For example, code like the following can sometimes be a problem:

public class MyOuterClass {
static int var;

class MyInnerClass {
public void doSomething() {
var = 7;
}
}
}

There are a few ways you can try to remove these references. E.g., create get/set methods for var in the outer class, or modify your logic so you can pull MyInnerClass out of MyOuterClass.

4) Remove any System.out.* calls. These generally do nothing on the Blackberry, but sometimes cause verification errors.

5) Remove unused import statements.

6) Explicitly specify the access for every function or variable (i.e., make sure every one is specified as public, private, or protected). It's pretty easy to grep your Java code to find the missing access specifications.

Now, it's not clear to me whether these changes actually fix anything. However, you're really just stabbing in the dark with verification errors, so any changes you can think to make may help. My best advice is to use source control and build/test often. You're really just trying to avoid code that makes the compiler unhappy. And it's much easier to do this if 15 lines of code have been checked in since it last worked, as opposed to 1000.

Tuesday, January 23, 2007

Review of "Little Red Book of Sales Answers"

I'm working my way through a number of different books on programming, UI, and many other topics. Most of these are picked out of Joel Spolsky's list. This is a great list and everyone should try to read everything on it.

Most recently, I finished reading the Little Red Book of Sales Answers by Jeffrey Gitomer. This is a very interesting book. I know nothing about sales and have no interest in it, but still there's a ton of good stuff here. The whole book consists of 100 small questions and answers, so it could not be easier to read. And everyone should!

There are lots of themes in the book, but some of the most important ideas include:
  • Communicate! Jeffrey writes newspaper columns, articles, and books. He has his own sales newsletter. He speaks at hundreds of conferences and shows a year. Essentially, if you're in sales, you know Jeffrey. Becoming a figure like this gives him recognitions, makes people trust him, and gives him every employment opportunity imaginable.
  • Read! The book recommends that you read a few books each year on positive attitude, sales techniques, etc. In my mind, the subject matter is not really important. I read as much about sales and marketing as I do about programming and software development. And I couldn't care less about sales or marketing. The key here is that Good Books on any topic are worth reading. Of course, if you're dying to become a product manager, you should read some books on product management. But not only product management. Read about as many topics as you can related to your coworkers, customers, managers, etc. Know everything you should know and as much about what everyone around you should know as you can.
  • Practice! From public speaking, to negotiating, to cold-calling, this book reminds you that nothing is easy the first time. Like most of the suggestions in the book, this is so obvious. But what do we do about it? Mostly, we avoid the problem with excuses (too busy, low priority, I'm already good enough, etc.) Stop it! Now! I will try to do the same.
  • Quit your job! Well, not necessarily. If you don't love it and don't believe in it, do something else. From a sales perspective, Jeffrey argues that if you don't own the product your selling, use it all the time, and love it, you can't sell it. The same goes for pretty much any job. If you're a programmer, for example, and you hate the software you're developing, get out! Otherwise, everyone will suffer. Not just you.

The book is not perfect. For one thing, it reminds you of what kind of person gets involved in sales and how annoying they can be. For example, Jeffrey talks about cold calls and how when a customer says "No", it means "Not yet". This is the kind of attitude that forces me to tell a telemarketer four or five times: "I'm not interested in saving money on long distance/health insurance/wireless costs/energy costs!" But this is more of a general complaint against the entire profession, than an attack on the book. As long as there are sales people, there will continue to be a world of people annoyed by their perseverance.