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.

Friday, January 29, 2010

Infernal Machine

Machine, for reference only. Made about a year ago.
  • Processor: Intel Core 2 Quad 2.33 GHz @ 1333. 4mb cache.
  • Ram: 8gb Crucial DDR2 Ballistix PC6400
  • GPU: Radeon HD 4670 PCIE
  • Mobo: Gigabyte EP45-UD3LR
  • HD: 500GB Seagate Barracuda 3.5" SATA 7200rpm
  • Power: 600w Zalman ZM600HP. 4 +12 vde rails
  • NIC: DLink Wireless PCIE DWA556
  • Drive: LG 20x DVD-RW SATA
  • Case: Cooler Master Chassis Sileo 500
  • OS: Windows Vista Ultimate, Ubuntu 9.10


Wednesday, December 30, 2009

New Menu Using jQuery

I wasn't happy with the existing title menu that spread across the top of the screen but didn't provide much value. There was a lot of blue gradient with no content, especially on very wide screens. It needed to be changed.
What I was hoping for was an expanding menu with a small foot print, kind of like the Windows 7 jewel. At first I started shuffling around some divs with homemade dhtml, but that was a pain. I'm not sure where I came across jQuery, but it solved all the problems I was having; working in different browsers, easy syntax, minimal code, etc. It's really a nice library, and I can see why it was so highly recommended.
So the new menu contains 2 parts. The first part is a little icon that, when clicked, shows the navigation. It expands it to fit and I was very surprised at how easy it was. Essentially, this is all the code needed:

<script type="text/javascript" src="/includes/jquery132.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#slider").hide();
$("#button").toggle(function() {
$("#slider").show("fast");
},function(){
$("#slider").hide("fast");
});
$("#slider h1").click(function() {
$("$slider").hide("fast");
});
});
</script>
I hope you like the little icon and new menu. Try it by clicking him in the upper left. I'm definitely going to look into jQuery more for cool dynamic webpages or if I need to have javascript do other magical things.