Author Archive

Recent Sitemap Enhancements

Released April 12th, 2007

There have been a couple recent enhancements to sitemaps that everyone should start using.

The first is that Google now supports embedding kml data into sitemaps. This allows you to provide a hint as to where information is related to geographicaly as well as more detailed information to be used in popups on the map. For more information on how to make the integration see the maps sitemap API page. We already support sitemaps in our content management solution and we will be integrating this new mapping feature as well.

The second new feature added has to do with getting your sitemap included in search engines. Now all search engines that support sitemaps will inspect your robots.txt file for a pointer to your sitemap. This should remove the need for everyone to submit their sitemap to every search engine. You may still want to submit your sitemap because there are nice tools from engines like Google that let you investigate more information about your site but now you won’t have to if all you are looking for is your site to be crawled correctly.

Computing time with Oracle sysdate

Released April 11th, 2007

If you ever need to work with something other than a day when using sysdate you are in luck. As it turns out you can work on sysdate with fractional days. This is just what a person needs when they want to do something like:

SELECT mycol FROM sometable WHERE sometimestamp < "30 seconds ago"

The main trick here is to know that sysdate math is based in days and fractional days work. Here are a few examples:

Remove hours from a date:

sysdate – hours/hours in a day

Remove minutes from a date:

sysdate – minutes/(hours in a day * minutes in an hour)
or
sysdate – minutes/minutes in a day

Remove seconds from a date:

sysdate – seconds/(hours in a day * minutes in an hour * seconds in a minute)
or
sysdate – seconds/seconds in a day

The example above would be:

SELECT mycol FROM sometable WHERE sometimestamp < sysdate - 30/(24*60*60)

How to Create and Overlay KML on a Google Map Using Google’s My Maps

Released April 6th, 2007

A few days ago Google made their “My Maps” announcment and since then there has been nothing but buzz buzz buzz about it. So I figured I would take a minute to show how someone can use this new tool from Google to create their own embedded maps for their site.

(more…)

Latest on Rails Performance

Released April 1st, 2007

Updated Rails 1.2 performance numbers have been released. While these number look pretty good it is hard to get a good idea of exactly what the performance of Rails is. A couple of other benchmarks that include Rails such as performance tests for 6 frameworks and Grails vs Rails benchmarks show a different picture. Both of these come up with much worse performance than the first. Maybe the issue is that the second two benchmarks are using Apache ab but the first uses a new version of rails bench. Of course most people probably aren’t that worried about the benchmarks that much because you can find ways to make anything fast as shown with Rails doing 4000 requests a second.

Online Vs Offline Applications: Everything old is new again

Released March 28th, 2007

Everyone has probably noticed this already but the old is new again cycle for “online” desktop apps has been shortening at a rapid pace. Everywhere you turn you see people talking about offline and online apps and what should be online vs offline. If you take your time machine back you would see something like the following timeline:

  • 1970s 3270
  • 1980s X terminal
  • 1990s Java applets
  • 2000 Flash
  • 2005 Ajax

Up until about 2000 it was taking 10 years to cycle from “we want everything on our desktop” to “we want everything on the server”. Now the cycle seems to have sped up to every year and then to constant. A couple recent examples of new faces on this old idea are Adobe’s Apollo and Joyent’s Slingshot.

Fundamentally not much has changed from the 1970s. The goal is to centralize computing resources into one place (in the simple view of things) and make issues like software deployment easier.The main difference now is that the industry has come to the point where there isn’t any turning back and everyone has bought on to the need and usefulness of online apps. The main sticking point seems to be finding a way to resolve issues that come up from users being disconnected from time to time. I’ll bet that one won’t be fully resolved until you have connectivity anywhere and everywhere you go.

S3 Streaming With PHP

Released November 25th, 2006

Steven pointed out that someone was looking for a way to stream to S3 using PHP and said I should figure out how to get it going. Since he made a patch to let you stream data with Ruby using S3 I figured I should do one for PHP. There may be better ways of doing this but since I’ve already done it with C using curl I figured that would be the fastest way.
(more…)

Cleaning up stale rails sessions (removing ruby_sess files)

Released June 8th, 2006

I’m not sure if something isn’t set up correctly of if this is just a fact of life with rails but the sessions it creates never seem to go away. I think before rails 1.1 the sessions where stored in /tmp and now they are stored in the apps directory along with everything else so they is probably no internal mechanism to delete them. I only noticed because after about a month of an certain app running the disk on the machine started to fill up. After digging a little I found 50K ruby_sess.* files hanging out in the rails session directory.

Anyway it was easy enough to clean up the stale ruby_sess files by going into the rails webapp/session directory and then running the following command:

find -type f -name "ruby_sess*" -exec rm -f {} \;

I’m not sure why the app is creating sessions but it isn’t something that stores state so I didn’t have to worry about killing active sessions here. If you do need to worry about that you will probably want to toss a time on the find command.

After looking a little more I found a post about this that has a ruby way of cleaning up the sessions.

Creating S3 URLs that expire using PHP

Released June 1st, 2006

After reading this post on the S3 forum I realized that other people are thinking about doing some of the same stuff I have. paolonew was looking for a way to for a way to create URLs to S3 objects that expired. I did this a while back when I was thinking about how to host objects that I wanted to protect with some outside scheme. The confusion on the forum seemed to be about the timestamps used to expire the URL. For PHP it is fairly easy.

To clear up the expiration time issue I think these two steps are needed:

1) Keep in mind that the HTTP header dates must be in GMT.
2) The PHP function time() returns the seconds since the epoch January 1 1970 00:00:00 GMT). Notice here this is in GMT as well.
3) The HTTP Date header you see in a response from an S3 server is the time on that server. The machine you use to sign your request should be synced with that time. I think a good guess is that all the Amazon servers are synced with the atomic clock.

There isn’t much to securing a URL after you have that tucked away. Here is an example that will sign a URL so that it is valid for 60 seconds:

<?php

require_once('Crypt/HMAC.php');

echo getS3Redirect("/test.jpg") . "\\n";

function getS3Redirect($objectName)
{
  $S3_URL = "http://s3.amazonaws.com";
  $keyId = "your key";
  $secretKey = "your secret";
  $expires = time() + 60;
  $bucketName = "/your bucket";

  $stringToSign = "GET\\n\\n\\n$expires\\n$bucketName$objectName";
  $hasher =& new Crypt_HMAC($secretKey, "sha1");
  $sig = urlencode(hex2b64($hasher->hash($stringToSign)));

  return "$S3_URL$bucketName$objectName?AWSAccessKeyId=$keyId&Expires=$expires&Signature=$sig";
}

function hex2b64($str)
{
    $raw = '';
    for ($i=0; $i < strlen($str); $i+=2)
    {
        $raw .= chr(hexdec(substr($str, $i, 2)));
    }
    return base64_encode($raw);
}

?>

The hex2b64 function was pulled from the amazon S3 PHP example library.

Search Engine Marketing and Google’s new trending tools

Released May 11th, 2006

Now that google has anounced their new Google trends site I couldn’t help but mention it. If you spend any type of money at all on SEM you need to check your keywords against this site.

There are a couple of intro articles about the new service at TechCrunch.

To get a real feel for how important this information will be you should try out a few queries for yourself. Take a simple query like “motorcycle” and then look at the regions tab. A lot of the queries about motorcycles originated from the Philippines. Now look at “pizza”, most of the queries there originated from the US. That should make it much easier to target your audience with your advertisments. The trending is nice as well and should give marketers a better idea of when to boost spending to maximize exposure.

This follows another tool Google just release for their AdWords service. You can read more about it at the adwords blog. That tool gives you a different view of the search trends and is more like what you get from Yahoo’s advertising system.

Search Engine Optimization

Released May 10th, 2006

Recently I’ve been collecting links on interesting SEO topics. I figured I would dump a few of them out with quick reasons why I think they are good to read.

A technical read on how search engines work in general. It focuses on google but has a lot of good general information in it.

This is a recent article on how to optimize your site. I like it because it has an acronym on how to do it “camelot”.

SEO chat has a lot of information in its forums.

An article from a guy who works at Google and goes into what the search engines have to deal with to keep people on the up and up. It goes into some of the stuff you don’t want to be doing to try to get your site at the top of a search. For some reason I found it interesting that this guy is from kentucky.

Another good article on the “SEO Code of Conduct” AKA what you should not be doing to get your site at the top of a search.

A nice tool to help you find words to go with your website: WordTracker