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.
1ed4bbef573bfc014d32356d53103ca2?d=identicon&s=25 phil swenson (Guest)
on 2006-01-31 16:14
Is there a cleaner way to get the host name from ruby other than
`hostname`?

phil
357558a6682f4d6624594763d9acdb35?d=identicon&s=25 Mike Fletcher (fletch)
on 2006-01-31 16:40
phil swenson wrote:
> Is there a cleaner way to get the host name from ruby other than
> `hostname`?

require 'socket'

hostname = Socket.gethostname
D8914caf9cc67403f1f153e0a2104293?d=identicon&s=25 Dave Baldwin (Guest)
on 2006-01-31 17: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.
5befe95e6648daec3dd5728cd36602d0?d=identicon&s=25 Robert Klemme (Guest)
on 2006-02-01 23: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.