Wednesday, February 25, 2009

Maintaining a .emacs file

Since I run Windows with Ubuntu in a virtual machine, and also use lab computers and also use my fiancee's computer, etc., I wanted to have a way to manage my Emacs configuration without doing any direct computer to computer file copying, or worrisome flash drive couriering. (I imagine such situations happening: oh save me God, my .emacs file just fell down that street drain...)

Instead, I've decided to maintain my .emacs and ~/elisp/ with git.

Here's what I did, let me know if you have any suggestions to do it better:

# create the repo (I don't mind it being in my home dir):
git init

touch README # only since I'm using GitHub for my repo


(For the curious, yes I did use gvim to convert the above script to html. Does Emacs do that? I never looked.)

After I got the links set up, I committed to a GitHub repo. Useful to have a repo I know will be around when I need it. I'd rather not host this on my own web server, for convenience of configuration sake.

Add the files to the repo, and push to master:
git remote add origin git@github.com:bluepojo/bluepojo.emacs.git
git add *
git add elisp/*
git commit -m "Initial Commit"
git push origin master


And there we go: I can get a copy of my emacs configuration where ever I go. One of the benefits of git is that even if I don't have an internet connection, I can still safely update my .emacs file with revision history, then push it back to GitHub when I find a connection again.

Labels: , ,

Monday, February 16, 2009

Found that link for the Amazon.com internal blog.

Check out the post, updated:

Amazon.com - Job Interview

Labels: ,

DoritosGuru.ca - LIVE!

We've pushed the public launch of the Canadian video competition.

Check it out here:
DoritosGuru.ca

If you want to see the French side of things:
GourouDoritos.ca

(technically .com works too, but eh.)

Friday, February 13, 2009

DoritosGuru.ca

Canada's largest paper circulator picked up a story on the project I'm working on. Check it out:

http://www.theglobeandmail.com/servlet/story/LAC.
20090213.RADHOCRACY13/EmailTPStory/Business

Full text here, in case the story ever gets removed:

It's crunch time

Frito Lay rolls out a multi-level, consumer-driven campaign for Doritos that promises to do everything but make your fingers orange

JENNIFER WELLS

February 13, 2009

On Super Bowl Sunday, a strange commercial aired across the nation's airwaves.

There was a little toy man in a suit. And a little toy caveman with a club. And little toy men dialogue about making an advertisement and reaping heaps of cash. The closing bit of dialogue was a simple two words: "Chip hat."

It was immensely weird.

"Literally we called that the 'What the f---?' part of the campaign," says Gilad Coppersmith, managing director of media agency OMD Canada. Some after-the-game comments posted online offered those exact words: "What the f---?"

"You couldn't have scripted it any better," says Mr. Coppersmith, who could not have been happier with the consumer response. Nor could his client, Tony Matta, vice-president of marketing for Frito Lay Canada and the point person behind an intricately integrated campaign that, on Monday, will move beyond the official WTF phase into the full-frontal assault phase.

For what, you might ask?

For Doritos.

Commencing Monday the shelves of the nation's C and G channel - that's convenience stores and gas stations - will be stacked with single-serve bags of tortilla chips: plain white bags with a big fat dollar sign on the front and the words "Unidentified flavour."

"It's literally handing over the brand to the consumer," says Mr. Matta.

By that he means the task of naming the new chip - developed in Frito Lay's Toronto lab - has been turned into a contest challenging consumers to not only name the new product but produce a 30-second advertisement as well.

"We're handing them a blank canvas," says Mr. Matta. "We're asking them for their idea in terms of what they would name the product. We're also asking them for how they would promote the product, specifically through advertising. In return they're going to get a piece of the action and we're going to make them stars."

The winner takes home $25,000 and, get this, 1 per cent of sales in perpetuity.

The dough is eye catching. If sales of the new chip keep pace with, say, Bold BBQ or Jalapeno & Cheddar, the winning contestant can expect to receive $65,000 to $70,000 a year for as long as the chip is in market.

What will be eye catching for the advertising industry is the breadth of the campaign's integration.

There's the television spot, airing on Monday on MuchMusic and MusiquePlus, featuring a cat sporting an unsettling set of man lips. The commercial, created by BBDO Toronto, directs viewers to a microsite, http://www.doritosguru.ca, which will invite the posting of contestants' videos. "The breakdown is usually five to 10 per cent are content creators, the rest are voyeurs," says Paul Lin, account supervisor at Proximity Canada, BBDO's interactive arm. To engage those voyeurs the site will invite online voting as well as the opportunity to post online comments.

The Guru microsite is supported by YouTube - which stores the videos - and a novel integration with Facebook. "All the content that is created on the website is automatically uploaded to Facebook," says Mr. Lin. And vice versa.

The product promotion reaches into the gaming universe, with neon block ad placements in 30 game titles, including Spider Man: Web of Shadows, Guitar Hero 4, and rink board placement in NHL 09. The creative is so standout that Mr. Lin wonders whether gaming companies will allow such bright, brazen placement in the future.

On the television side, the level of enthusiasm from MuchMusic and MusiquePlus has been "absolutely key to making this program work," says Mr. Coppersmith. MuchMusic will create "Doritospiece Theatre" spots in which VJs will critique the entries. MusiquePlus has allowed for live cut-ins, in which the product will be featured in live programming.

And on and on.

The target market, says Mr. Matta, is the millennials.

"For us the quality of engagement with the Doritos consumer is critical, and when you're talking about millennials, they react differently to brands. They have a different relationship with brands. One of the key insights from our own research and broadly available research is that their level of engagement is actually quite high."

Internally, this consumer is seen as leading the "hyper-life," so little wonder that the cross agency collaboration, which extends from OMD and BBDO to in-store promotion from Capital C, is engaged in an exercise in hyper-marketing. "At the end of the day we're trying to ignite curiosity," says Capital C group account director Julie Petch, whose team has designed all-black in-store displays from which the all-white chip bags will really pop.

After the contestants are winnowed to five finalists (contest submissions will be accepted until March 18) the contest will ramp up to a final reveal on May 1. A panel of judges is still being assembled, but Frito Lay can disclose that Toronto Raptors forward Chris Bosh will be among them. All the marketing participants agree: Chris Bosh is really cool.

Ian MacKellar, executive creative director at BBDO Toronto, says it has been more than a year since the creative process was engaged. "We started literally with a complete and empty page much like this white bag," he says, picking up a bag of Doritos. "Very few clients out there really let agencies play."

Tony Matta has been the play-master.

"We feel really good about this," he says of the multilayered campaign. "But at the end of the day, who knows? At the very least we can say we broke new ground."

Sunday, February 1, 2009

Amazon.com - Job Interview

I've taken a 6 month internship with Amazon.com. Not sure what I'll be doing there just yet, but I'm excited to start with such a great company.

Since other helpful people posted their interview experiences on their blogs (and thereby, helped me get the job) I figured I'd do the same.

First of all, Resources:

google.com - Since you found this site, you probably already got this: Find people's blogs to read about what to expect from the interview.
Steve Yegge's Amazon.com rant-blog - A particularly awesome resource... An ex-Amazon employee posted his internal blog publicly after leaving. It had a guide to interviewing employees... which it was very clear that my first interviewer had read that very guide, as he followed many of the points it made.

Highlight posts for Steve's blog:


That was all I used, but other useful things are basic Java and Object Oriented details. Can you explain multiple-inheritance? What about the difference between an abstract class and an interface? Go reread your old notes, wikipedia, etc. You'll need it.

My second interview was the hardest, though it's hard to say which interview was the "Bar Raiser" that people talk about. None of them were monumentally different. The first interviewer gave me a homework assignment due in 3 hours, which was unusual, but not hard.

I won't post all the questions I got, as some were silly easy: (Fold a 1mm paper 50 times.. how thick will the resulting paper be...? 2^50.)

Only 1 question really caught me off guard:
Given a 32 bit integer, how can you count the number of set bits?

I was really taken aback by this question for a few reasons. First: I have never gotten binary operations in any of my classes so far. Second: I've never even considered that this sort of thing might be important.... or even anything close, so my brain took a bit to get in gear to answer the question.

I gave a quick answer, which I admitted was brute forcing the solution:

Imagine the 32bit integer is x.

I just talked it out, but to explain it better here, I'll write it out in pseudo-code:

z = 1;
for (int i = 0; i < 32; i++){
x XOR z = y;
if(y = 1)
counter++;
z*2;
}



This worked well enough, but he talked me through it a bit, and I decided that instead of y*2, it'd be better off to do a >> (right bitwise shift) on x, rather than bother messing with y.

I don't believe my first solution would work without a bit of tweaking, but it sounded good.

So... I brute forced the solution.

A bit of googling after the interview lead to several articles like this one: http://graphics.stanford.edu/~seander/bithacks.html

There is a way to do it in constant time... but that takes a very special person to figure out on the fly in an interview. ;)

That question threw me off rather badly, as it was wholly unexpected, so the next question he asked me... which SHOULD have gone in the "stupid easy" category, took me a bit of work.

Remember what I said about getting into the right gear for the first question? Well, upon setting that gear in my brain, the gear-shift stuck solid, and I had a hard time getting out of it.

Here's the second question in that interview:
Given two integer registers, how would you switch the values without a third register?

My first thought: "Wow, I hope a register is like a variable, cause I've never heard that before" so I pretended that they were variables, and it turns out my guess was right, as the interviewer didn't correct me.

Brain gear: bitwise operations. Question? Apparently solvable with bitwise operations.

Given two ints, x and y:

x XOR y;


Figure out which bits are set following the XOR, then flip the bits in both x and y in each position that is set.

Tadaa, x and y are flipped values. (Note: I don't believe you can do that without a third variable, but I think that slipped past the interviewer).

The interviewer responded that he liked my solution but wondered if I could do it with more conventional means... my brain snapped back into conventional mode and replied immediately, albeit flatly, realizing I was overengineering the solution:

Oh.

x = x + y;
y = x - y;
x = y - x;


The interviewer laughed, and said very good.

His final question was for me to find the depth of a binary tree.

I TRIED and tried and tried to explain to him what I was thinking... and some how I couldn't convey what I was thinking. After 5mins of failing to convince him I knew what I was talking about, I asked for his email address and emailed him this:

static int findDepth(TreeNode root) {
if (null == root) {
return 0;
}
return (Math.max(findDepth(root.getLeftChild()), findDepth(root.getRightChild()))+1);
}


Sigh. Well, apparently that convinced him well enough, as I got a call for the final interview later that week.

Hope that helps someone out there. I'll update this post with other points if I think of any. Leave a comment if you want ot know more. I start work there at the end of March, as my 3rd interview was easily the best of my 3. :)

Testing in Code

Test Driven Development feels backwards. As a programmer, it feels very strange to write tests that you know will fail. Furthermore, it feels even more strange to figure out the logic for the function you're writing before you are allowed to write any actual code. I'm used to figuring out the logic as I'm writing, rather than before.

However, as strange as it feels: it's a step in the right direction for a stronger code base.

How it helps:

Particularly in environments with multiple programmers, small changes can cause huge errors.

In a recent project, I made a change to change the domain name when the user switches from English to French. Unfortunately: not every person does JavaScript the same way. Where I prefer to do <a href="javascript:[function]">, another developer on my team prefers to do <a href="#" onclick="[function]">. This is fine, but my fix caused huge problems due to the other developers code. Entire ajax calls were fried in the process. I didn't think to test random links on the page, cause my code didn't touch them, and of course everyone uses the first method of calling javascript via a link... but I should have. Automated testing doesn't think, it just tests. I rationalized why I didn't need to test something to save time. Automated testing doesn't need to save time.

If we had tests (in this case Selenium tests would do well), then I'd have noticed the problem immediately and would have fixed it before I checked in my changes, or perhaps immediately after if the tests fire off on commit. My changes wouldn't have gone live for half an hour and our CEO would not have had another mini heart attack, and further more: I would not look as stupid.

I think the biggest problem is that tests feel unproductive, when in fact, they probably save more time than writing the code itself, as tests are largely for the rest of your team, and will continue to help months down the line when you forget that you even wrote that code.

The importance of a structured team in programming

It is 3:12am, Sunday Morning. The reason I'm not sleeping right now would not have occurred had the following been considered.

I'm finding out with my recent exposure to an absolutely unstructured dev team: Subversion is not enough to structure a development team.

Here's some things to look out for:

Testing:
  • How is QA handled?
  • Do programmers have any automated testing (unit testing, regression testing, etc. -- separate post on this coming soon)?
  • How are server and general configuration issues handled?
Development:
  • How do programmers know what other programmers are working on?
  • Are the latest versions of requirements and resources (Copy Decks, Mocks, etc.) being used?
  • Is there anyone responsible to handle branching and tagging, or is that done ad hoc?
  • If programmers are located remotely, how are their contributions kept visible to the local team?