Wednesday, December 6, 2006

Cartographer Google Maps plugin

Cartographer

Ruby on Rails :: Google Maps plugin

Installation

Install as a plugin! From your rails application root, run


script/plugin install -x svn://cartographer.rubyforge.org/
trunk/vendor/plugins/cartographer
Or, install from svn
svn co svn://rubyforge.org//var/svn/cartographer/trunk 

Usage

First you need to sign up for an API key

Then, put your API key into the vendor/plugins/cartographer/lib/keys.rb file.

Open up your layout template (if you're using one) and

insert this code into the HEAD section:

<head>
<%= gmaps_header %>
...
</head>

Now, in your controller* define your map and set up some markers.

def map
@map = Cartographer::Map.new( :name => 'mymap', :width =>
300, :center => [-110,33], :debug => true)
@map.markers << Cartographer::Marker.new( :position =>
[-110,33], :info_window => 'Clicky clicky!!', :map => @map )
end

* Realistically this can also be in your view, but it's a bit naughty of you to consider bending MVC!

Finally, render the map in your view.


<%= @map.to_html >

If you view the source to this page, you'll see what the above lines of code look like in
the rendered code (below this point). You can remove the :debug => true if you don't want commenting (it will compress
the code a little, too)

Requirements

Because Cartographer is a plugin, you need to be running rails 0.14.3 or up (1.0 is great..)

You can easily use the code in other ruby-based frameworks quite easily, because there's nothing
actually tied to Rails.

If you're using an old version of cartographer, or old version of rails, we strongly recommend
you upgrade; however, check out the subversion repository, because we've tagged the old version
for you old-schoolers.

More information

We just underwent a complete changeover of code, so the API code still needs to catch up. Until then,
you're smart, you can more than likely understand what's going on from reading the plugin source.

Cartographer was written by Robert Bousquet,
Courtenay Gasking and Phil Hagelberg
with some additional code by Jeremy Hubert and
Bryan Wood.



source courtesy: Cartographer

Saturday, December 2, 2006

My Friend DOT Net Blog

Hi,

My Friend DOT Net Blog

It has more useful information about Dot-Net & SQL Server 2000

Arun-DOT Net

Friday, December 1, 2006

Interview with Ruby Guru's

Interview with Ruby Guru's
by my friend Satish Talim

Ruby Guru's

Interview with David Heinemeier Hansson

Interview with David Heinemeier Hansson
by my friend Satish Talim


In this interview with Satish Talim, David talks about the growth of Rails and its features.
He also tells us why Rails is relevant to Java developers and
something Java developers need to look at right away.

Pay Pal

Sign up for PayPal and start accepting credit card payments instantly.

Ruby Corner

Earn Money