Archive for May, 2008

What’s an API

Saturday, May 31st, 2008

The term API (Application Programming Interface) is typically used for when referring to a set of methods that are publicly exposed in order to interact/communicate with another application. Let’s say you write a web application that you would like other people to extend and add more features to. In order to do that you create an API…

Here is an example of a very popular “WEB” API: http://apidoc.digg.com/

Digg created a set of public web methods that are accessible via HTTP (hence why I call them “web” methods) and that allowed me to create my own little app on my server that displays Digg data. Now all APIs are different and their is no standard naming convention that I know of.

Google has them as well http://code.google.com/. When you integrate with external API you call that a mashup. I created my own Google maps mashup and you can see it here

Here is another more in-depth example:

Let’s say you have a contacts database and you would like to expose that via an API. Here are the steps you would need to take. Assuming that you are not a programmer I’m going to keep this light.

  1. Write a new page using your programming language (Perl, C#, PHP, Python, Rubi, etc) that talks to your contacts database and call it api.php (Will use PHP for this example)
  2. Create a method inside your page that will return contact info and call it GetContacInfoByName(string name).
  3. Write the necessary code to take a parameter and call that function, so let’s say if I wanted to invoke the GetContactInfoByName method I need to use <domain>/api.php?invoke=GetContactInfoByName&name=Chris This URL contains two parameters “invoke” and “name”. Invoke is used for selecting the method you wish to trigger and name is used for retrieving the data.

I wrote a page on my wiki and created a some code examples for the client/API and the response. Client being the API.

Setting up MaxMind GeoIP Lib to work with Google Maps

Saturday, May 24th, 2008

Google maps has a pretty extensive open API that gives users the ability to create really fancy maps for their websites.  The way you comunicate with the google API is via their own JavaScript Libraries. 

The first thing you need to do is get a developer key
http://code.google.com/apis/maps/signup.html

Then you need you drop the sample HTML on your website and veriy that it works. Like I did here:
http://www.chrisdevbox.com/lab/googlmap/

Then you need to install MaxMind C API library and download their database.  You also need to install the PHP client libraries and recompile PHP.  I added instructions on how to do that here:
http://wiki.chrisdevbox.com/index.php/Setting_up_GeoIP_by_MaxMind

Here is the final example:
http://www.chrisdevbox.com/lab/googlmap/google-map-by-ip.php

Here is the PHP section, as you can see after installing the client API you don’t have to do a lot of coding to maket it work…

$localzone = null;
if(geoip_db_avail(1))
{
 $localzone = geoip_record_by_name($_SERVER['REMOTE_ADDR']);
}

7 Steps to Hi-Jack JibJab’s Sendables…

Tuesday, May 20th, 2008

I ran into this little security hole when I got an email (SPAM *wink*) from JibJab asking me to use their Sendables service.  I started to create one, but then I realized that I had to pay for it, so I stopped!

well being the hacker that I am I looked into circumventing their technology, so that I could use their “preview” version and host it some place else and it worked!!! (SORRY JIBJAB I really love your product, I just felt a little greedy today… plus 10 bucks for 100 credits come one man)

JibJab if you are reading here is how you can reproduce:

  1. Go to the sendables page http://www.jibjab.com/sendables/
  2. Select your favorte sendable, upload photos, save.
  3. Click on the preview button / Link
  4. Right click on the page and select view source
  5. Click CTRL+F and search for .swf
  6. Locate a string that looks liek this: %2Fsendables%2Fapi%2Fpreview%2FIxLyhHno2XoHrM4xbre6q4C5.xml
  7. Insert that string into the ##HERE## area below

<embed src=”http://llnw.jibjab.com/content/player.swf” width=”450″ height=”395″ flashVars=”content_url=http%3A//www.jibjab.com##HERE##” wmode=”transparent” pluginspage=”http://www.macromedia.com/go/getflashplayer” type=”application/x-shockwave-flash”> </embed>

So using the string above it should looke like this

<embed src=”http://llnw.jibjab.com/content/player.swf” width=”450″ height=”395″ flashVars=”content_url=http%3A//www.jibjab.com%2Fsendables%2Fapi%2Fpreview%2FIxLyhHno2XoHrM4xbre6q4C5.xmlwmode=”transparent” pluginspage=”http://www.macromedia.com/go/getflashplayer” type=”application/x-shockwave-flash”> </embed>

And to prove to you that I’m not lying here is a quick sample!

http://www.chrisdevbox.com/hacks/jib-jab-hack/

When you are done with that please check out what I did last night….

Quick CollegeHumor SEO Analysis

Monday, May 19th, 2008

CollegeHumor locked down a pretty nice spot on google for the keyword “Funny Videos”, is probably a combination of good SEO and a link popularity.

http://www.google.com/search?q=funny+videos&hl=en&client=firefox-a&rls=com.google:en-US:official&hs=wtV&start=10&sa=N

Quick analysis / comparison:

http://www.chrisdevbox.com/tools/meta_tag_viewer.php?url=http%3A%2F%2Fwww.break.com%2F&c=1
Break doesn’t have many “funny video” keywords in important areas like the title bar or H1 tags

http://www.chrisdevbox.com/tools/meta_tag_viewer.php?url=http%3A%2F%2Fwww.collegehumor.com%2F&c=1
College Humor on the other hand has the keyword combo “funny videos” on both the title tag, description tag and the keywords tag.

Ohh yeah, and their link value is pretty darn high as well…
http://www.google.com/search?hl=en&client=firefox-a&rls=com.google%3Aen-US%3Aofficial&hs=Fdq&q=link%3Acollegehumor.com&btnG=Search

Simple things that can make a big difference on your site…

Digg clone in drupal…

Sunday, May 18th, 2008

This is an interesting find, I was looking for spanish language sets for pligg and I ran into this… http://www.drigg-code.org/  I’m still staying with pligg though http://www.pligg.com/

New version of wp-cache available… is called super cache

Sunday, May 18th, 2008

The only true reason I installed this blog is to learn more about wordpress themes, pluggins, etc… and off course to write about my site updates.  I manage a couple of websites that uses wordpress, so I figured I should probably get really friggin good at it… SOOO I found super cache!  We currently use wp-cache, but super cache takes is to a whole new level… You can read more about it here http://wordpress.org/extend/plugins/wp-super-cache/

How it works:  Same as wp-cache, this plugin generates an HTML file, BUT (Big but) this version utilizes the apache mod-rewrite to send request directly to the HTML file, instead of relying on PHP to load the file for you…

You can also visit my new wiki and contribute to my wordpress “getting started” wiki page

http://wiki.chrisdevbox.com/index.php/Getting_started_with_Wordpress