click me!

Leslie Steward

Tuesday, February 23, 2010

Pictures Gallery is Alive!

Instead of fighting with zend, php, and godaddy, I've added a prebuilt javascript gallery to the pictures page. Give it a try. If you see something that's not quite right, please let me know.

http://lesliesteward.com/pictures/

Many thanks to Jesse Berman's javascript interface for Picasa. It needed to be tweaked to work with jQuery, IE, and my discriminating tastes*, but was very easy to use.

Monday, February 22, 2010

Little program to Use Integer math to find the Date

I was skimming my feeds this morning and saw a puzzle by Paul Jungwirth in the Coding Horror comments.
You have the numbers 123456789, in that order. Between each number, you must insert either nothing, a plus sign, or a multiplication sign, so that the resulting expression equals 2001. Write a program that prints all solutions. (There are two.) This is a pretty tricky problem, actually, if you don't think to use recursion. I was satisfied with pseudocode, but the Perl Mongers version was to fit the whole thing into 80 characters!
So here's my solution (in php, because I've been using that recently):


Included is a form so that you can try it out on just about any number.

Thursday, February 11, 2010

PHP Pic Tweaker

As I was flipping through the pages of PHP Cookbook, I saw that you could manipulate images. All productivity for the rest of the day was lost as I built php functions to resize, add a dropshadow, and add a border to almost any image.


For example, you can turn this:

before

Into this all within the html image tag.

after
Kinda neat, huh.

Wednesday, February 10, 2010

How to disable Google Buzz

The idea of Google Buzz is great. It provides a way to get fast feedback on small issues. But sometimes you don't want it.
  1. Log into Gmail
  2. Scroll down to the bottom of the screen
  3. By "Gmail view:" click "Turn off Buzz"
Maybe you're like me and you don't want everything in one convenient locations, in Gmail. You could try twitter quick thoughts. Perhaps Google reader for reading headlines. And a desktop chat client for, um, chatting.

Thursday, February 4, 2010

Interview Questions from January

The heart of software is solving problems. To practice you need to ask questions. Here's a few questions that were asked during an interview last month. I didn't get the job.

Describe a test plan to test Netflix's search.
My abridged answer: test basic functionality, create use cases, possibly performance test, focus on specific input and expected output.
Their answer: Don't remember, didn't write it down, but something similar.
Shoulda said: Not sure. Talk about different testing techniques.

Write a SQL statement that would pull the second oldest employee from a table.
My answer: "select top 2 * from employees order by age desc" then use the calling function to extract the second.
Their answer: Use a nested query. Grab the two oldest, grab the second in that list using max. (Not sure why max() since it only returns 1, but the hour was up so I didn't press.)
Shoulda said: What they said. They were looking for a query only way to get the result.

A corporate phone directory is in nested folders. Your name is a folder under your boss up to the CEO. In each folder is a phone.txt file with a number with the format xxx-xxx-xxxx. Write a script to change the formats to (xxx)xxx-xxx.
My answer: Use a script that would start at the root and recursively visit each folder, so depth first. In each folder, if there is a phone.txt file, open it and look for the regular expression matching the phone number. If there was a match replace with a correct syntax.
Their answer: None given.
Shoulda said: Upgrade to database. Or, maybe, pull all phone.txt into a list, then iterate through list.