c

When Google introduced their Street View feature into Google Maps, I've always said it would be very cool to see a video for directions from one location to another. I've found this site where they've been able to achieve just that.

The web app is available on Google Code so if you wish to look at the code behind it, you can. To view the app in action, visit http://gmaps-samples.googlecode.com/svn/trunk/streetview/streetview_directions.html.

The first thing you're going to notice is that it's slow, even on the fast speed and also you may receive blurry images if you're like me (in Australia). However as you can 'tap' into the Google Maps via their API, you're able to view all their images and functionality in any means you wish to (without violating their terms and services of course).

A user has created a C++/OpenGL application to give you a game-like experience, where you're able to move back and forwards and move around via the mouse. View the You Tube movie below to see this application in action.

For those who want to make their own Google Maps Street View application, this link is a great starting point.

User Level: Intermediate

This article assumes that you already have the following installed and working:-
* Linux
* Subversion (SVN)
* A SVN Repository
* GCC (To compile your C scripts)
* Vi (or another text editor)

You will also need shell access to your server to perform the following functions, either you are directly on the machine or you are using a utility like Putty to access your server.

The idea of this post is to allow you to automatically update your files in a public html directory after you commit to your SVN repository, you may want to create a subdomain like preview.domain-name.com or sandbox.domain-name.com. You may deploy a particular folder from your svn repository or the complete repository.

 
   $ svn checkout /full/path/to/your/svn/db
      /full/path/to/your/public/html/directory
 

To begin this process, login to your server and checkout the SVN repository (svn checkout) to your public html directory, some servers the public html directory will be "/var/www/html", "/var/www/public_html" or "/var/www/vhosts/domain-name.com/httpdocs". There are many different configurations so check where your public html directory is, you may also create a directory under your public html directory to check out the SVN directory to. You will need to remember the directory to which you have checked out your SVN database to for later. This article does assume you already have a SVN database set-up and working.

 
   $ cd /full/svn/path/hooks
 

Change directory (cd) to your SVN database hooks sub-folder.

 
   $ cp post-commit.tmpl post-commit
 

Copy (cp) the template file "post-commit.tmpl" to "post-commit" (without the quotation marks).

 
   $ chmod +x post-commit
 

Change file system mode (chmod) of the "post-commit" file to execute (-x).

 
   $ vi svnupdate.c
 

We need to write a little C program that will do the work. The command above will open up the vi editor to create the "svnupdate.c" file, you may use any text editor of your choice.

 
   #include <stddef .h>
   #include <stdlib .h>
   #include <unistd .h>
 
   int main(void)
   {
      system("svn update
         /full/path/to/your/public/html/svn/directory");
   }
</unistd></stdlib></stddef>

The above script will execute the command to update the SVN repository in the public html directory we created earlier.

 
   $ gcc -o svnupdate svnupdate.c
 

We need to compile our little C program with GCC. The above command will compile our "svnupdate.c" file and output our little program "svnupdate".

 
   $ env - ./svnupdate
 

Lets test our little program, your SVN repository should update with the latest changes. If you receive any errors here then you either a) haven't specified the correct directory in the "svnupdate.c" script or b) you didn't checkout the SVN database properly. If you receive any errors, go back and fix them, there is no use continuing on from here.

 
   $ chown root:root svnupdate
 

Change the owner (chown) of our compiled C program to root.

 
   $ chmod +s svnupdate
 

Change the mode (chmod) of the "svnupdate" file.

 
   $ vi post-commit
 

Now we need to edit our "post-commit" file to execute our "svnupdate" file.

 
   /full/file/path/to/the/file/svnupdate
 

Add the above line to the "post-commit" file and save the file.

Now when you commit files from your SVN directory, the server will update the SVN repository in your public html folder. To protect your files, you may want to protect the public html directory with a login using a .htaccess file.

I'm happy for any suggestions or any corrections, so please don't forget to leave a comment below.