My life Changed
On November 20th 2009 at 4:50pm my life changed. My son was born. At 7 pounds 6.5 ounces and 21 inches long he is a long skinny little guy. He has a head full of hair and looks like his daddy. I always wanted a family of my own and now I have it. My wife, my son, and I now make up my happy little family. He is quite perfect. I have pictures posted here.
Bit.ly API function
Everyone knows about the bit.ly url shortening service. I have created a php function to automatically shorten a url passed to it. First, you need to go to bit.ly and signup for an account. You will need your api key and your username. With my function, you simply insert your api key and username and it will return a shortened url to you.
If you notice, this function will retry 5 times before it gives up. That is because bitly will only allow 3 concurrent requests per IP. My function also will only make the request to bit.ly once per page per session.
-
-
function getTinyURL($url, $counter = 0){
-
global $_SESSION;
-
-
if($_WP_SESS['bitlyurl'][$url]){
-
return $_SESSION['bitlyurl'][$url];
-
}
-
$counter++;
-
if($counter > 5){
-
return $url;
-
}
-
$login = '';
-
$appkey = '';
-
$bitly = 'http://api.bit.ly/shorten?version=2.0.1&longUrl='.urlencode($url).'&login=goywp&apiKey='.$appkey.'&format=xml';
-
//Debug::printvar($response);
-
$xml = simplexml_load_string($response);
-
if($xml->results->nodeKeyVal->hash){
-
$result = 'http://bit.ly/'.$xml->results->nodeKeyVal->hash;
-
$_SESSION['bitlyurl'][$url] = $result;
-
return $result;
-
}else{
-
if($xml->results->nodeKeyVal->errorCode == 1206){
-
return $url;
-
}else{
-
return Request::getTinyURL($url, $counter);
-
}
-
}
-
}else{
-
return Request::getTinyURL($url, $counter);
-
}
-
}
-
reCAPTCHA
I'm sure that you have seen a captcha somewhere on the web. A captcha is an image that you have to type the contents of to continue on in a form. We use them at work from time to time. I've been interested in but never used the reCAPTCHA system. Recently purchased by google, I get the feeling that they will see alot more use in the coming months.
reCAPTCHA is a system that solves two problems in one. Optical Character Recognition has always had the issue of hard to read words. Computers simply can not read quite like humans. This is precisely why captchas work so well. To defeat a captcha and spread spam, a bot would have to be great at OCR. reCAPTCHA takes scans of old books and presents them to users. One of the words presented is known and the other is unknown. When a certain number of people answer the same on the unknown word, it is considered known. Using the reCAPTCHA system, we are digitising books one word at a time.
Bank Routing Number (ABA) Algorithm
At work, I have recently had to work on some validation for bank routing numbers. Through much research, I have discovered the algorithm. 
The number that I am talking about here is the ABA Routing Number.
We'll start with a routing number like 231381116. Here's how the algorithm works. First, strip out any non-numeric characters (like dashes or spaces) and makes sure the resulting string's length is nine digits,
2 3 1 3 8 1 1 1 6
Then we multiply the first digit by 3, the second by 7, the third by 1, the fourth by 3, the fifth by 7, the sixth by 1, etc., and add them all up.
(2 x 3) + (3 x 7) + (1 x 1) +
(3x 3) + (8 x 7) + (1 x 1) +
(1 x 3) + (1 x 7) + (6 x 1) = 110
If the resulting number is an integer multiple of 10, then the number is valid. To calculate what the checksum digit should be, follow the above algorithm for the first 8 digits. In the case above, you would come up with 104. Thus, to make the total number an integer multiple of 10, the final check digit must be 6.
Enough with the details, on with the algorithm!
PHP5
-
function validateABA($number){
-
//strip everything but numbers (dashes and whatnot)
-
-
//check the length of the number
-
return false;
-
}
-
-
//split the number into an array
-
$number = str_split($number);
-
-
//run the number through our algorithm
-
$rval = $number[0] * 3;
-
$rval = ($number[1] * 7) + $rval;
-
$rval = ($number[2] * 1) + $rval;
-
$rval = ($number[3] * 3) + $rval;
-
$rval = ($number[4] * 7) + $rval;
-
$rval = ($number[5] * 1) + $rval;
-
$rval = ($number[6] * 3) + $rval;
-
$rval = ($number[7] * 7) + $rval;
-
$rval = ($number[8] * 1) + $rval;
-
-
// check if it is an integer multiple of 10
-
return $rval;
-
}else{
-
return false;
-
}
-
}
Gmail HTML Signature

Those of us that use Gmail know that adding an HTML signature can be a pain in the behind. Typically, Gmail only allows standard plain text signatures. I have discovered a great Firefox plugin named Blank Canvas Gmail Signatures. This plugin allows you to easily add signatures to each sending address within your account.
Simply compose a message and click "Create Signature". Once you have done that for the sending account that you want, your screen will look something like the image on the right. From now on out, any email that you send from Gmail on that computer will have whatever HTML signature you want.
The “Outside the Home” Home Office
My wife pointed out a website about TINY homes to me tonight (http://www.tinytexashouses.com). After taking a look at the site, I decided that these houses remind me alot of nice garden sheds. If people can live in less than 100 sq ft, I figured that they might make some practical use for the regular person. Then came the thought of an "Office Shed".
After some quick research, I discovered that I am not the first to have this thought. Many freelance designers, programmers, architects, anyone else that works from home sit at home in their den or at the kitchen table. These creatives need a space to be creative in. Along comes the "Office Shed"! They can be as fancy or simple as you want. They range from $5,000 for the standard shed to $15,000 for the office fit for a king. Gone are the days of fighting with kids for the space on the table, or working away after everyone is in bed just to have some peace and quiet. Now a creative simply has to take 10 steps out of the house into their custom, personal office. Feel free to ditch the tie and don the slippers.
Here are some of the offices that I liked:
Just spoke to the wife... She says that when we finally buy a house, I can build a "Back Office". As long as it matches the house. Score one for me!
jQuery – Slide up and down
One of the greatest concepts in the history of programming is abstraction layers. If you haven't used jQuery before, here is a quick example of how to make divs slide up and down. This method requires NO manual javascript. The power of abstraction is very evident here. Here is the main part of what you need:
<script type="text/javascript">
function blind(divid) {
jQuery('#'+divid).slideToggle("slow");
return false;
}
</script><style> .blinder{ display:none; } </style>
The important part is the jQuery('#'.divid).slideToggle("slow"). The jQuery('#'.divid) part just means that we want to apply the next part to the html element that goes by the id passed to our function. The slideToggle("slow") part tells jQuery that we want to run the effect slideToggle on whatever we are applying it to. The return false part just means that we don't want to actually follow the link. We just created a function to make this simpler on the links.
The <style> .blinder{ display:none; } </style> part just means to not display the divs that have the class name "blinder".
As far as the links and divs go, here is all you need:
<a onclick="return blind('div1')" href="#">GO!</a>
<div id="div1">Slide 1</div>
The important part in the link is the onclick. It just means to return the results of the blind function that we created earlier. We are passing the id of the div that we want to show and hide.
Teddy Graham
Teddy G - The name of the yet to be seen (in person) child of mine, strokes my heart in a way I never thought anybody would. Teddy G has created within me a feeling of true family. I am now no longer just a part of a family, I now have my own. Hearing the 150 bpm heart beat of that little unborn child just did something inside me.
All of my life, I have always pictured myself playing ball with my kid in the back yard. I have always dreamed of MY family. I never figured that it would come this fast, but it is still great. To be honest, Amara and I had come to terms with the fact that we might never be able to have children. We had expected to have to try for quite a while. We had discussed the possibility of adoption. Now, I guess those decisions will not be ones that we will need to make.
The house that we are buying is more important than ever. Now, instead of it being the first home of my wife and I, it is becoming OUR family home; the home that we raise our children in. Our children, now there’s a phrase that really makes you feel like you belong.
The Heart of Life is Good — From my wife
Thanks, John. The heart of life is good. Spring time, leaves rustling in the wind. Fresh veggies from the local farmers. California oranges, the only kind to eat. Rolling hills that will always remind me of home, my Mountain Home. Sound nostalgic? I am. As life changes and moves on, I remind myself of the heart of life. Simple things are the best. Coach, that's always good.
With all that being said, life is good. It is with pleasure and, I'll admit, utter shock, that I introduce you to the latest member of the Yancey family, Teddy Graham. Teddy G made his appearance about 8 weeks, 4 days ago, and is scheduled to arrive December 2. TG will be here by our 1st anniversary, no romantic trip for me. Those of you who know me best understand my propensity for plans and structure. This is not within any plan I ever had. But He knows me best, and He knows what's best for me. It's all for Him, every part, every cell, every little limb. Teddy G is on his own little schedule, and we are adjusting. His schedule makes me nauseous every minute of every day, unless I'm eating veggies or fruit. Teddy wakes me up in the middle of night feeling nauseous. Teddy makes me sleep even more than usual, and has eradicated all motivation for schoolwork. Teddy G also has a heartbeat, strong and steady. Its miraculous.
--Amara Yancey
Buying A House
So, with ALL that internet monies that I am making, we are buying a house. My wife and I started looking around just to see what was out there a couple of months ago. We found a couple that we liked and decided to place an offer on one of them. Our first offer was denied. Not countered but simply denied. We countered that denial with a little better offer but still one that they would be losing money on. We fully accepted that they would just deny again or simply not respond. Much to our surprise, they accepted.
More information is to follow. Pictures may be a while (probably after we move in).




