Categories
Books

Head First SQL

I’m a big fan of the Head First series of books by O’Reilly, and noticed that they had released one of SQL. My SQL skills are pretty solid to begin with, but you can never know too much SQL so I figured I’d have to pick up Head First SQL and give it a read.

Tech books for me almost always written for a complete beginner or an expert in the field. It’s rare that you find one written for someone who already has a basic understanding, but wants to learn a bit more. Head First SQL did a really good job of explaining the basics of SQL as well as the more complex aspects of SQL.

The chapters on subqueries and joins was great for me. Those are areas that I can always get better with. Also some of the early chapters reminded me of IN and BETWEEN both of which I’d pretty much forgotten about over the years.

Another cool thing about this book is that not only is it a guide, but it also serves pretty well as a reference as well. Explaining SQL isn’t always the easiest thing to do, but Head First SQL has done the best job that I’ve read to date.

Categories
Adventure Sports

Carousel Park

The Shepherd and I made a voyage to Carousel Park in Delaware today. They have a very highly rated disc golf course that we were determined to play. It was in the high 20’s and probably not the finest of days to be outdoors playing disc golf, but while not the finest of players we are probably the toughest (or most stupidest) disc golf players east of the Mississippi.

The park was huge! It’s a horse park, dog park, and a bunch of other things too. There were a ton of horses and little ponies there. They poop a lot, but luckily none was to be found on the course.

A lot of people had their dogs at the dog park, and I like dogs so that’s always a plus.

The disc golf course was very impressive. Some great distance and some insane hills really made it unique. It took a little bit to figure out the course the first time through, but that also gave me an excuse to sprint ahead to scout the course out.

I did manage to land a disc in the middle of a frozen pond, but was able to retrieve it by throwing out a life preserver with a rope attached and lassoed it in. I think I enjoy saving lost discs more than actually playing.

While a little bit of a trip, the course was so impressive that we will have to make some more trips out there. It’d also probably be wise to go when it’s a bit nicer out, it was so cold today.

Categories
Development

Insert swf into Joomla article

Joomla TinyMCE Editor settingsI was having a hard time with inserting a swf into a Joomla Article using the TinyMCE editor. It seemed pretty simple, just click the media button, set the path and  you’re done. That seemed fine and simple enough, but the TinyMCE editor was just displaying an image tage, not the object code that I was expecting it to render.

After some time researching this, and trying just about everything I could think of it dawned on me. I have the the Code Cleanup on Save setting for the TinyMCE plugin set to Never, so the editor was never converting the swf code to the necessary code to embed it one the page.

Simply setting the TinyMCE plugin setting Code Cleanup on Save to Always fixed it for me. It’s amazing just how often it’s something so incredibly easy that can be the source of a problem. I’m thinking of a fine script to fix it when all I had to do was simply adjust a setting.

Categories
Adventure

Christmas 2009

Christmas this year wasn’t too bad. Everyone I got a gift(s) for really seemed to appreciate what I’d gotten them. Got Dad a bunch of tools, something he always seems to need but never seems to have. I’m guessing they’ll all be missing too in just a few weeks. Got my younger brother Assassin’s Creed 2 for the xbox 360 and a big book of dogs. He’s always checking out different dogs online, not sure why but he likes that a lot.

I also got my older brother a credit card sized survival kit. It’s actually really cool, has a knife, whistle, light, toothpick, tweezers, and a fire starting thing all in a tiny credit card size package, very cool. Also got him a survival book to go along with the kit and a Judas Priest boxed set.

My Mom has had a pretty rough year. Losing her Mom, some of her siblings acting certifiably insane and really treating her very poorly, and my brothers just really letting her down. So I made her a big collage of old photos to remind her of the good times, back before everyone was so messed up. I scanned and re-touched and cleaned them up in Photoshop, bringing a lot of the ancient one’s back to life. She really appreciated it a great deal, and happy cried. So that made me and everyone else very happy, so that was a really good thing.

I got some pretty cool stuff too. We always joke that my Mom always buys us the worst clothes, which she does. So as I’m opening stuff up, she says how she asked the girl in the store to pick stuff out for me. I thought that was pretty funny, and it actually did work. All in all a pretty good Christmas with the family.

Categories
Development

WordPress 2.9 Embeds

WordPress 2.9 was released today, and the upgrade has some very impressive features. So far the coolest one to me and I’m sure that will be for many of my clients is the Embeds functionality.

Now all you have to do to embed something into a Post or Page is to simply paste the video’s URL on a separate line. WordPress will automatically properly embed the URL. It supports most of the popular formats.

Previously I’ve come up with some Custom Fields solutions to do something very similar to this, but building it right into WordPress should make the process even easier. Thanks WordPress, very cool.

Check out all the other WordPress 2.9 goodness.

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.