Forum: Ruby getting hostname from ruby

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
phil swenson (Guest)
on 2006-01-31 17:14
Is there a cleaner way to get the host name from ruby other than
`hostname`?

phil
Mike F. (Guest)
on 2006-01-31 17:40
phil swenson wrote:
> Is there a cleaner way to get the host name from ruby other than
> `hostname`?

require 'socket'

hostname = Socket.gethostname
Dave B. (Guest)
on 2006-01-31 18:24
(Received via mailing list)
I am trying to insert my own data into an FXImage and the setData
member look just what I need.  Unfortunately, regardless  of the
number of parameters I pass it I always get the

test.rb:10:in `setData': No matching function for overloaded
'FXImage_setData' (ArgumentError)
         from test.rb:10

I have looked at the swig files but am none the wiser as to what I am
doing wrong, or if there is a bug here.

The simple test case is below and while this doesn't achieve anything
it does demonstrate the point.

I am using FX 1.4.3 running on Mac OSX 10.4 with ruby 1.8.3
(2005-09-21) [powerpc-darwin8.3.0]


#!/usr/bin/env ruby

require 'fox14'
include Fox

application = FXApp.new("Hello", "FoxTest")
main = FXMainWindow.new(application, "Hello", nil, nil, DECOR_ALL)
@buffer = FXImage.new(application, nil, IMAGE_KEEP, 640, 480)
data = [0xff00ff00] * 640 * 480
@buffer.setData(data, 0)

application.create()
main.show(PLACEMENT_SCREEN)
application.run()


Thanks,

Dave.
Robert K. (Guest)
on 2006-02-02 00:49
(Received via mailing list)
phil swenson wrote:
> Is there a cleaner way to get the host name from ruby other than
> `hostname`?

16:21:55 [~]: ruby -r socket -e 'p Socket.gethostname'
"bond"

Kind regards

    robert
This topic is locked and can not be replied to.