[Ruby] Ruby on Windows questions

Roy Pardee (Poulsbo WA) rpardee at comcast.net
Sat Aug 26 09:15:38 PDT 2006


The cpu & network load can be inspected via the 'task manager' (hit window-r
& type 'taskmgr', or right-click anywhere on the task bar thingy at the
bottom of the screen & choose it off the context menu)--see the processes &
network tabs respectively.  While loaded, taskmgr puts a little faux-led CPU
activity meter in the system tray.  I like to show that all the time, so I
put a shortcut to taskmgr in my startup folder (set to start minimized, and
choose the 'hide when minimized' option off the Options menu in taskmgr, so
I don't also get an icon for it on the task bar).  Taskmgr will also let you
kill processes.

Another potentially useful thing to do is right-click your network
connection (control panel -> network connections) and pop the properties
dialog, and check the 'show icon in the notification area when connected'.
That gets you a little animated icon that shows you when there's any
appreciable network activity on that connection (the upper monitor lights up
when you're receiving, and the lower one lights up when you're sending).

For better command-liney stuff (and good gui stuff too actually), visit
www.sysinternals.com and load up on their free utilities.  And of course
there's always cygwin, if you really want to feel at home.

In ruby I believe a lot of the platform-specific stuff is abstracted away
(at least the little things like path seperators in filespecs).  So see how
far you can get before you do too much inquiring into the platform.

The pickaxe book has a chapter on using ruby on windows, btw--that's worth
picking up, if you don't already have it.

HTH,

-Roy

-----Original Message-----
From: ruby-bounces at zenspider.com [mailto:ruby-bounces at zenspider.com] On
Behalf Of Joe Van Dyk
Sent: Tuesday, August 22, 2006 11:50 AM
To: Seattle Ruby Brigade!
Subject: [Ruby] Ruby on Windows questions


On 8/22/06, Joe Van Dyk <joevandyk at gmail.com> wrote:
> Gotta port some software to Windows... :-(  I'm a Windows newbie.
>
> Using Ruby on Windows (XP)....
>
> 1.  How do I find out the CPU % (or some sort of a load indicator) of 
> the machine?
>
> 2.  How do I find out how much of a given ethernet connection is being 
> used?  (i.e. if it's a gigabit connection and 1Mbps are being used, 
> I'd like to get back "1%".
>
> 3.  Starting programs into the background is done the same way as on 
> *nix, right?
>
> 4.  How can I tell how much of a CPU a program is currently using?
>
> 5.  How do I start a Ruby program at boot (a service)?
>
> 6.  Can I use something like ruby2exe to package up my Ruby service?
>
> 7.  Does Windows use signals?  How can I tell a program that I've 
> started to stop (i.e. on *nix, I'd do it via SIGTERM or SIGKILL).
>
> 8.  Any known issues with DRb and Windows?
>
> Any help is greatly appreciated!

Also, is there a Ruby idiom for how to properly do platform-specific stuff?

My first instinct is to have something like ("end"s omitted)

module OS_Services
    module POSIX
        module Linux
            module 2.4
            module 2.6
        module BSD
        module Solaris
        module OSX
    module Windows
end

And then query (somehow) what OS I'm on and including the appropriate
modules.

Joe
_______________________________________________
Ruby at zenspider.com
http://www.zenspider.com/seattle.rb
http://www.zenspider.com/mailman/listinfo/ruby




More information about the Ruby mailing list