Categories
Development

Calculate distance of longitude and latitude using MySQL

Recently a client wanted a search to be performed to return records that were within x amount of miles from a zip code.

Luckily there are a couple of pretty nifty ways of getting this to work with a MySQL db. The first obstacle was that the data didn’t have latitude and longitude coordinates in the db. Luckily there’s a couple of API’s available where we can feed them an address and it will return coordinates. I do recommend the Yahoo! Geo Technologies for this, they’re extremely fast and well documented.

Now if the records do have their coordinates stored in the db, we can make a SQL statement to find the records that are a certain distance from a point.

I found this SQL example here.

SELECT (
(ACOS(SIN(39.339806 * PI() / 180) * SIN(lat * PI() / 180) + COS(39.339806 * PI() / 180) * COS(lat * PI() / 180) * COS((-74.575122 - lon) * PI() / 180)) * 180 / PI()) * 60 * 1.1515)
AS distance, last_name, first_name, city
FROM doctors
HAVING distance<=10
ORDER BY distance ASC

The above example has a starting point hard-coded into it, which can be altered to whatever your starting point is. The HAVING then filters out in miles the records whose value is less than or equal to 10 miles. Again this value can be altered.

Again, thanks to My Random Blog for sharing.

Categories
Sports

Thanksgiving Game 2009

We managed to get in a fine game of flag football in this morning. Thanks to Wes and Josh for rounding up enough able bodies to play as well as providing flags and cones for a respectable game.

A big surprise addition to this game for me were the Shepherd and a slimmed down Alex both playing. And they both played very well. Alex did burn me for a deep score, probably the longest play of the game. The Shepherd with a late QB switch almost lead his team to victory on this fine morning.

However on this day, I was fortunate enough to find myself on the winning side. Kyle gave us some very solid QB play. Wes played an extremely good 2 way day, with the most difficult task of guarding Josh for most of the game. The gunslinger Dave had some amazing catches, including the game winning TD. Very impressive.

Haha, I had a ton of drops. 2 or 3 of which were definite touchdowns. Oops, sorry guys.

Great game with a great bunch of guys. We’ll have to have a rematch next year if all of our bodies have recovered by then.

Categories
Design Development

Playtown Cafe

Playtown CafeFinished up a site a few weeks ago for Playtown Cafe in Boca Raton, Florida. They were looking for a website and overall design package that was unique, fun, and really stood out. Geoff designed a logo for them that really nailed all those requirements.

The site is powered by WordPress, so that the client can easily maintain the site on their own. The client who claimed to be, “horrible with computers” was able to pick up the WordPress CMS in very short time and has really run with it. It’s always great when you can have a client see how easy it is to keep a site fresh and up to date using the latest web technologies available today.

Under the hood this site is using some very impressive technology to power it.

Working with client was a great experience. They had a great idea of what they needed, but also were open enough with creative and tech input that was a pleasure to work with. Check out Playtown Cafe.

Categories
Development

YUI 3 Gallery

I’ve really been meaning to make the switch over from YUI 2.x to 3.x, and I do believe the YUI 3 Gallery has made up my mind. The Gallery is a repository of YUI 3 modules that aren’t addressed by the core library. Also, all modules are released under the same BSD license as the YUI Library.

Even though the Gallery is fairly new, the amount of modules is already pretty impressive. Some that I’m very excited to play with are:

This looks very cool, and if you’re using YUI3 go now.

Categories
Video Games

Mario & Luigi: Bowser’s Inside Story

Mario & Luigi: Bowser's Inside StoryJust got done playing one of the finer DS games I’ve played in a while, Mario & Luigi: Bowser’s Inside Story. This well crafted game provided much entertainment for a couple of weeks, such as while waiting for my car to be serviced. btw I will always bring a game to pass the time now when I’m getting the car serviced.

I’m sure I must’ve looked like the world’s biggest kid playing this game constantly, but I really did enjoy it so who cares.

Bowser’s Inside Story is the third installment in the Mario and Luigi RPG franchise. The game has some challenging puzzles, but nothing too crazy. Graphics are very impressive, and the music/sounds are really well done for a DS game. Mario and Luigi speaking Italian did bring a slight chuckle from me each time they conversed.

Playing as Bowser for a good portion of the game was a nice touch too. Growing up, I’d always found myself pitted against Bowser, so to play as him was cool. I do always kinda root for the bad guys in most fictitious things.

While I still have no idea what “I’ve Got Chortles!” means, Fawful was a pretty solid enemy. All in all a very entertaining and well made game.

Categories
Sports

51st AC Marathon 5k run

I ran with Mr. Mellons in the 51st Atlantic City Marathon’s 5k run. It was pretty cool, I beat Mr. Mellons with a time of 27:27. I don’t think that’s very fast, but considering I’m new to this running stuff I was pleased with the outcome.

The 5k race took place on the AC boardwalk from about The Pier to around where Mr. Mellons lives. So we considered this race to be on our home turf as we run that route pretty often (evidently not often enough based on my time :-)

I woke up really early and put my brand new sneakers on, new sneakers of course are a must for such an event. Then met up and walked over to the starting point. There were a ton of people entering the marathon and half-marathon. I think they’re crazy for running that long.

While walking over some crazy guy yelled some stuff at us. Oh well, I just gave a glare and kept walking as he conveniently opened up his mouth as we were a good several hundred feet away. Plus he seemed kinda not all together, so I just dismissed it as he’s a crazy person and it’s not nice to hit crazy people regardless of what they say.

The actual race went well. I really passed a lot of people during the 2nd mile, but ran out of gas down the final half mile. That’s kinda my trademark move now. I guess I’m just used to more sprinting type stuff than anything of distance.

Afterwards they had a bunch of oranges, pretzels, water ice and doughnuts to eat. And I did eat a lot of each, perhaps too much. But after running you do get really hungry. Oh, also and a dum-dum lollipop. Don’t think I’ve had one since I last visited the pediatrician.