From: "Ara.T.Howard" Date: 2004-08-07T00:41:29+09:00 Subject: Re: I want to use ruby, but I don't think I can... help On Fri, 6 Aug 2004, Michael Hale wrote: > This email is sort of a public cry for help. As a language I really love > ruby and I would like nothing better than to be able to use it for all my > scripting needs, but I keep running into obstacles that keep me from doing > so. you should post them as you find them - this group is generally extremely helpful. ;-) > Most recently I wanted to script a telnet session to automate configuring a > network device. The scripts were written in TCL and I figured it would be > an easy job to convert it to ruby. I didn't count on running into so many > socket issues with ruby on windows. In ruby sockets are not responsive. I > have to close the socket before I get any output. TCL works fine. what do you mean 'not responsive'? here is a little program which connects to my local wiki server and displays the output - it seems to get output before the connection is closed either manually or automatically before the program exits... jib:~ > cat a.rb require 'net/telnet' tn = Net::Telnet.new({'Port'=>4242}){|s| print s} tn.cmd(""){|s| print s} puts 'sleeping...' sleep 4.2 jib:~ > ruby a.rb Trying localhost... Connected to localhost. HTTP/1.1 400 Bad Request Connection: close Date: Fri, 06 Aug 2004 15:19:15 GMT Content-Type: text/html Server: WEBrick/1.3.1 (Ruby/1.8.1/2003-12-25) Content-Length: 288 Bad Request

Bad Request

bad Request-Line `'.
WEBrick/1.3.1 (Ruby/1.8.1/2003-12-25) at jib.ngdc.noaa.gov:4242
sleeping... again - let us see your code... > I wanted to validate an xml schema using ruby but again I could not make > this work under windows. > > I tried connecting to a third party library smartlib from Spirent. I > developed all of my code in linux and it worked fine, but when I tried to > move it to windows (our primary development platform) it was unable to > establish a tcp connection to the test device. > > I guess maybe the answer is fill in the holes with "C". The only problem is > I have never been a "C" programmer. I came to ruby as a java programmer, > which in my particular case means I can't get very far at all with "C". I > defiantly don't have the expertise to create a working sockets > implementation. > > I have tried many of the various ruby to java integration solutions, but > none of them work well enough to be useful in my situations. > > What should I do? Any sage words of wisdom? Technical advice? Any help is > welcome > > -- Frustrated (Michael Hale) sounds like platform dependant issues have crept into your code or into the 3rd party code, but these are a varied set of problems. why don't you start a thread on some (each) of them and see what the group finds - maybe you'll just need to put in an initial effort to 'get over the hump' and then things will be smooth sailing. make an effort to distill each problem to it's smallest possible representative peice of code and post as much information as possible - i'd be suprised if most of these issues were not resolvable. i'm learning ocaml at the moment and having similar feelings to what you are having - i think it natural when you learn a new language to get hung up on little things. fortunately, with ruby you have a very responsive group to help you get through it. the ocaml group is not nearly so active so i'm having to actually rtfm ;-) cheers. -a -- =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | A flower falls, even though we love it; | and a weed grows, even though we do not love it. | --Dogen ===============================================================================