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
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
Development

NCMPR – Cutting Edge Web Presentation Notes

Thanks to all of you who attended my Cutting Edge Web roundtable discussion. Wow, there were some really great questions, and I learned much from many of you as well.

Below I’ll try and provide more information regarding some of the topics that were brought up:

CMS

ok, there was a lot of questions and feedback regarding using and choosing a CMS (Content Management System) during both sessions. A CMS is a huge investment, both time and financially, and not a decision that should be taken lightly.

A great point that was brought up and one that I cannot stress enough is that multiple parties should always be involved when choosing a CMS. The content managers, the folks in IT who will be installing and deploying it, and any other parties. It’s important that the content managers are comfortable using the CMS, so always test drive it thoroughly before committing. Many have demo accounts that you can login to, or if possible install one locally and kick it’s tires.

I also feel that it’s very important that the CMS can easily be expanded by a developer. Even if you don’t have a developer on staff today, you want a system that can be expanded should the need arise. Don’t be tied to propriety software and await new features to become available when the manufacturer gets around to it. Rarely do these companies roll out new features at a pace that will keep up with your needs.

There are some great open source CMS systems out today that are very stable and ready for production use. Setup and maintenance, will require a developer(s) on staff however. These two are my favorites:

Flickr

The use of flickr was also a very popular topic. I love flickr and $24.95 a year for unlimited storage is one of the best deals you’ll find anywhere. It’s a great resource to share photos, both for internal and external needs.

The flickr uploadr tool is a free tool that makes uploading large amounts of photos a breeze. Download this, it’s simple and does the job.

Be sure to tag your photos, for easy sorting. Tagging really makes navigating through thousands of photos a breeze rather than a tedious chore.

There’s also a free flickr badge that you can easily create and then paste into your website. This is pretty cool and a very easy way to incorporate your flickr photostream with a website. There’s also an amazing API available too.

Easy Widget Generation

I mentioned some easy and free widget generators to incorporate popular web services into your existing site.

Meta Tag and Search Engine Ranking

Google does not use the Meta keyword tag in ranking. It’s still good practice to use meta keywords on your site, however don’t go crazy in hopes of increasing search engine ranking with it.

Google Webmaster Tools provides a great list of guidelines to follow for accurate search results.

Flip Video Camcorder

The Flip Video Camcorder(s) are a really affordable way to capture, edit and share web quality video. They’re tiny, transfer video to your computer via a built in USB jack, have built in editing software (I prefer iMovie) and shoot very good video for their low price ($150-230).

Please let me know if there’s anything other questions or if you have something more to share!

Categories
Development

YQL flickr.photos.search nest query

I wanted to use YQL to build a query to grab photos on an account with certain tags that I could then render on a page. The flickr.photos.search just gets you the photo’s id and not all the other goodness that is required to make the image display.

So I built a nested query in YQL to get the job done.

select farm, id, secret, server, title
from flickr.photos.info
where photo_id in (select id from flickr.photos.search where user_id='<your_user_id>' and tags='soccer,men')

So in one call it’s gets the id of the photos that meet your initial query:

select id from flickr.photos.search where user_id='<your_user_id>' and tags='soccer,men'

It then takes the id’s from that query and grabs the photo.info that you need, all in one call! Very cool stuff.

Go to the YQL Console and play around.

Categories
Adventure Development

Hack Day NYC morning

IMG_0267

Was up till 6:30 AM coding last night (morning). I was beginning to speak in crazy talk due to the last of sleep, so I figured it’d be best to call it a night and try to wake up early to finish our hack up. Oh, a very solid back end developer who just started up his own company is partnering with me on this hack.

We managed to make use of several API’s in building our hack:

  • YQL
    • social.profile
    • craigslist.search
  • Social
    • Social Directory
  • Geo
    • Maps

Based upon the Yahoo! profile of the logged in user, it searches Craigslist sleezy personal ads in the city of NY (and wow there’s some very interesting ones) and displays them on a map for the user along with more information regarding the compatible person. It uses keywords in the logged in users profile to search for a personal with something(s) in common. It makes use of several API’s in a fairly easy to navigate interface.

I have to say that Yahoo! puts on an incredible experience. Everything is completely first class, and I can’t believe that none of the developers here had to pay a cent for all the luxuries that they have shown us. A very classy company, and thanks for the amazing hospitality.

Foosball tables, fast wi-fi, electrical outlets everywhere, and a constant stream of food and beverage are going on. Also Rock Band Beatles on a big screen isn’t too bad either when you need a break from coding. Though after the hours I’ve been here, I must admit I currently despise every song they’re ever recorded.

Also, I haven’t met a bad developer here either. Everyone while competitive, is extremely anxious to help solve a problem when someone finds themselves stuck. It’s really an amazing experience and thus far I’m very glad I was able to attend. Plus they gave out awesome stickers and a very cool t-shirt too.

Later today hacks will be presented and judged, with prizes handed out. So, I gotta finish this thing up really soon.