Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Newbie having serious problems

Reply
Thread Tools

Newbie having serious problems

 
 
Micah Wolfe
Guest
Posts: n/a
 
      02-13-2011
Greetings all,

I've just started learning Ruby (and Geo Ruby), and am trying to create
overlays for Google Maps.

I found a [seemingly] great tutorial for doing this @
http://blog.newsplore.com/2009/02/22...1#import-to-DB

...and it uses Ruby - cool, eh?

The problem is, when I get to the step of running the code, I get a slew
of errors that I can't seem to debug with my limited knowledge of Ruby.

ERRORS: (yeah, I know I should really add this location to my $PATH)
(Terminal_Saved_Output2.txt)

SCRIPT:
(gen_encpolygons.rb)

What, exactly, is wrong with his syntax and if there is how can I change
it so it will run?

Doesn't kEND refer to having an 'end' somewhere you shouldn't?

Any help is greatly appreciated.

Best,
Micah

Attachments:
http://www.ruby-forum.com/attachment...ed_Output2.txt
http://www.ruby-forum.com/attachment...encpolygons.rb


--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Martin DeMello
Guest
Posts: n/a
 
      02-13-2011
On Mon, Feb 14, 2011 at 1:25 AM, Micah Wolfe <(E-Mail Removed)> wrote:
>
> SCRIPT:
> (gen_encpolygons.rb)
>
> What, exactly, is wrong with his syntax and if there is how can I change
> it so it will run?
>
> Doesn't kEND refer to having an 'end' somewhere you shouldn't?


The problem is with this line:

init_borders << "{color: "#0000ff",n
weight: 5,n
points: '"

Note the quotes around the "#0000ff" which clash with the quotes in
the larger string.

Go through and use %{string} for all multiline strings.

martin

 
Reply With Quote
 
 
 
 
Yaser Sulaiman
Guest
Posts: n/a
 
      02-13-2011
[Note: parts of this message were removed to make it a legal post.]

On Sun, Feb 13, 2011 at 10:55 PM, Micah Wolfe <(E-Mail Removed)>wrote:

> What, exactly, is wrong with his syntax and if there is how can I change
> it so it will run?
>


Hi Micah,

I think that you got the code form part 2 of the tutorial [1] by clicking on
the "click to expand" link. For some reason, the code on that page is quite
messed up -- for example, notice the lack of backslashes: the `n`s at the
end of some of the strings should be `\n`, which is the escape sequence for
newline.

The downloadable script file [2] looks OK (based on a quick visual
inspection using Vim). Try downloading it and see if it actually works.

Regards,
Yaser Sulaiman

[1]:
http://blog.newsplore.com/2009/03/01...-google-maps-2
[2]: http://blog.newsplore.com/wp-content...encpolygons.rb

 
Reply With Quote
 
Micah Wolfe
Guest
Posts: n/a
 
      02-14-2011
Thanks guys!

Okay. At least now the script runs...unsuccessfully, but it runs.

I had to add require 'rubygems' at the top because it wasn't recognizing
'mysql'.

Now it's getting as far as line 11 (yea!!!)...
...where it craps out on this line.

borderDB = Mysql::new('localhost', 'root', 'proot', 'dbname')
(not my real proot, nor db name)

and it gives me:
../../Developer/usr/bin/gen_encpolygons.rb:11:in `new': Access denied
for user 'root'@'localhost' (using password: YES) (Mysql::Error)
from ../../Developer/usr/bin/gen_encpolygons.rb:11:in
`generate_js_border_overlay'
from ../../Developer/usr/bin/gen_encpolygons.rb:95

(Yeah, I really need to fix my $PATH)

I've checked Mysql, and I don't have any problem connecting. Could it be
a port issue? I'm running MAMP, and it uses a non-standard port (8889)
for Mysql, but I haven't had any other problems connecting to it via
Ruby on the command line.

Is this a Mysql issue, or a Ruby issue?

Thanks again for the help, and for putting up with a desperate noobie.

Best,
Micah

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Micah Wolfe
Guest
Posts: n/a
 
      02-14-2011
I think this is a Mysql problem.

I'm checking my server configuration.
(and fixing my $PATH)

Thanks again guys.

Best,
Micah

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Micah Wolfe
Guest
Posts: n/a
 
      03-06-2011
Greetings,

Thank you all for the help.

I fixed the connection. Have everything installed properly (as far as I
can tell - gem list gives me the whole bundle including: mysql (2.8.1)).
MySQL working fine.

So now I get this error when trying to run the script from a shell:

Command:
$ ruby ./Desktop/gen_encpolygons.rb

Returns:
/Desktop/gen_encpolygons.rb:11:in `initialize': wrong number of
arguments (4 for 0) (ArgumentError)
from ./Desktop/gen_encpolygons.rb:11:in `new'
from ./Desktop/gen_encpolygons.rb:11:in `generate_js_border_overlay'
from ./Desktop/gen_encpolygons.rb:95

I've googled extensively for similar argument errors, and I'm not
finding any good matches (or solutions).

...so I opened an irb session to try a little test:

Command:
Mysql::new('localhost', 'root', '', 'my_database')

Returns:
NameError: uninitialized constant Mysql
from (irb):1

Then I checked for the gem:
>> require 'mysql'

=> true

I'm really lost here.

Best,
Micah

Attachments:
http://www.ruby-forum.com/attachment...encpolygons.rb


--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XML Newbie needing some serious help.. rh0dium Python 2 05-20-2005 12:20 PM
I have been asked to leave the company for having spotted serious security breaches Curious George Computer Security 55 02-09-2005 12:49 AM
having serious problems getting a python CGI to work John Draper Python 3 06-02-2004 10:43 AM
Re: a serious question for a non-serious cause... henry DVD Video 1 11-08-2003 04:38 PM
ImportError: No module named lang - Serious Jython newbie - Please help! javahead Python 1 10-08-2003 08:17 PM



Advertisments