Friday, July 14, 2006
So this evening I was driving down the street, stereo cranking playing "The Raconteurs" at a very high volume, moon roof open feeling pretty cool. Then I realized I'm not cool. I'm driving a camry home from the pharmacy, where I've just picked up my colesterol/triglyceride medication, which is sitting next to me in a childs car booster seat. I am not cool.

7/14/2006 9:17:15 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [0]
Wednesday after work The Little Boy and I were in the backyard playing some "spaceball" (I've been trying to to teach him that the game is baseball, and he says it right most of the time, however I kind of like it when he calls it spaceball). I've been working with him on batting. I've been throwing him some soft under hand pitches and currently he's hitting about a quarter of them. Not a bad average for a 5 year old I must say. We use the soft T-Ball baseballs that have a rubber core. Last thing I want is for him or I to be hit in the face (or lower) with a regular baseball. Brother K can tell you how bad that is. (when he was a kid, he pitched a regular baseball in grade school to a kid during recess and it came back and hit him in the nose. It caused him a lot of sinus trouble over the years. His jerk of a teacher told him he was fine and that he should just walk it off. Years later same teacher gets hit in the face with a soccer ball which is so much softer than a baseball and the guy passes out and had to be taken away in an ambulance.)

Anyhow so I was pitching a few to him and for fun I throw a tennis ball for him to hit. It's about 50 to 60 feet from the area he was batting to the 6 foot high fence in the backyard, well he cracked the tennis balll perfectly and launched that thing high and right out of the yard. I yell, "Incoming" and "Sorry" and the tennis ball landed in the neighbor behind us' patio. The Little Boy look at me, like, "What do I do, I am happy that I hit the ball that well, but I hit the ball over the fence man!" I smiled at him and said. "Yeah, did you see how far you hit that thing, It cleared the fence!" So he ran the bases we have setup and made sure to come by and give me a high five as he was passing second base, and  just because he could he went for a second lap around the bases. Our neighbor was of course very nice and threw the ball back. I told the Little Boy, "I think we'll have batting practice at the school, you hit way too well to practice in the backyard". He smiled and gave me a hug.

7/14/2006 9:31:38 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [0]
Warning: Motorcycle Post.
Reverse Rotating Rotors, try saying that five times fast, go ahead try it, it's difficult isn't it. So what are Reverse Rotating Rotors? Well it is something that Mr. Rob Kasten has been working on that is very interesting and could be huge in the motorcycle racing arena. The basic idea is that you mechanically make the disc rotors on the front wheel of a motorcycle spin in the opposite direction. This counter acts what is know as gyroscopic presession. So you stabilze the motorcycle at almost any speed and make it as easy to turn at 180 mph as it is to turn at 20 mph. What I find complete fasintating about this project, is it all started because Mr. Kasten wanted to understand counter steer better.

7/14/2006 9:15:58 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [0]
 Monday, July 03, 2006
Today I wrote some code that I've been wanting to play around with for a while. I know that Google Map API has been out for a while, infact its in its second version. So this afternoon I took sometime to check it out. My first impression was that it was going to be complicated. However I couldn't that couldn't of been further from the truth. If you know javascript, this is a cake walk.

The first thing I have to say is that Google did an excellent job on documentation and examples. Also when you sign up for your API key they give you an html example to start with that is amazingly helpful. Its the most basic google Maps functionality there is, but I found it to be a great starting point.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps JavaScript API Example</title>
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=abcdefg"
type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[

function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
}
}

//]]>
</script>
</head>
<body onload="load()" onunload="GUnload()">
<div id="map" style="width: 500px; height: 300px"></div>
</body>
</html>
This pretty much has everything you need to start. It shows you how to call the Google Maps API with your key. It shows you how to create a GMap2 object and what you div and body code should look like. Well I decided for my test I would mapout the locations of the Credit Union's Southern California branches. What I wanted was something simple and would give some branch information when you clicked on the pushpin icon. Of course like I mentioned earlier Google did a great job with the documentation and I started with the "Using Xml and Asynchronous HTTP with Maps examples". It basically shows how to use their GXml parser for javascript. Which seems to be really fast and easy.
GDownloadUrl("data.xml", function(data, responeCode){
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName("marker");
Of course you need an xml document, which is simple enough, a documentElement of <markers> and the elements <marker> with attributes "lat", "lng", "branch", "address" and "phone". However my little problem was I didn't know how to figure out that latitude, after a quick google search I had what I needed.
<?xml version="1.0" ?>
<markers>
 <marker lat="34.191459" lng="-118.348875" branch="Burbank" address="2340 Hollywood Way<br >
 Burbank, CA 91510" phone="(800) 328-LFCU"/> </markers>
Well now I just needed a function to write out the data to the InfoWindowHtml, well with the little sample code I was about to write a function that took the data from the xml and fill the InfoWindowHtml.
function createMarker(point, address, branch, phone){
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function(){ 
marker.openInfoWindowHtml("
" + branch + "
" + address + "
" + phone); }); return marker; }
Now that I have my marker function I just need to bring it all together.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps - LFCU Southern California Locations/title>
<script src="http://maps.google.com/maps?file=api&v=2&key=abcdefg" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(34.191459, -118.348875), 9);
				
				
function createMarker(point, address, branch, phone){
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function(){ 
marker.openInfoWindowHtml("<div style='font-family:arial, verdana, helvetica, sans-serif;font-size:10pt;'>
<strong>" + branch + "</strong><br />" + address + "<br />" + phone);
});
return marker;	
}
				
GDownloadUrl("data.xml", function(data, responeCode){
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName("marker");
for(var i = 0; i < markers.length; i++){
var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng")));
var address = markers[i].getAttribute("address");
var branch = markers[i].getAttribute("branch");
var phone = markers[i].getAttribute("phone");
map.addOverlay(createMarker(point, address, branch, phone));
}
});
}
}
//]]>
</script>
</head>
<body onload="load()" onunload="GUnload()">
<div id="map" style="width: 700px; height: 500px"></div>
</body>
</html>
That's it, if you know javascript, can fake your way though xml, you can have a google map up and running in no time. :-) Happy Coding
7/3/2006 7:54:25 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [0]
 Friday, June 30, 2006

Okay so let me set the scene, three british guys, at Norway, one mini cooper, some rocket engineers and a  ski jump. This is so something guys do.

6/30/2006 3:45:48 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [0]
 Wednesday, June 21, 2006

Dad sent this over today. Now this is performance Driving!

6/21/2006 9:01:03 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [0]
I mentioned WATIR a while back and I have been using it almost every day for the last month or so. The more I use it the more I like it. WATIR is built around Ruby as I mentioned earlier. So I've been looking into Ruby more and more. I have to say I really like it and am starting to use it for some repeative tasks. For example I have a WATIR test that logs into the applications, hits some links etc. It takes about 40 to 60 seconds to run. Well I decided that I really wanted to have a way to run it multiple times in a row. Well, I decided to write a quick Ruby script to take care of this for me. It took about two minutes to look up the system function, which works almost exactly as it does in PERL, another 5 minutes to code and debug and I was done

i = 0
done = ARGV[0]
testScript = ARGV[1]
 if(done == nil) or (testScript == nil)
 print "usage: ruby runmore.rb N ScriptName\n\r"
 print "N equals number of times test should run\n\r"
 print "ScriptName equals the ruby/watir script you want to run"
 else
    while i < done.to_i do
    system("ruby #{testScript}")
    i = i + 1
    end
 end

I'm really beginning to enjoy Ruby it's as readable as VB and as writable as PERL. Not bad for a interpeted language that doesn't use semicolons :-D Happy Coding

P.S. yes, I wrote a script to run another script...
6/21/2006 3:24:09 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [0]