Bien facile. Bon travail.
This will ping every machine in the array HOSTS and if they reply within one second, my program says they are alive.Code:#!/usr/bin/env ruby require 'ping' # On crée un tableau avec la liste des addresses a pinger HOSTS = %w( 192.168.1.1 192.168.1.7 192.168.1.8 192.168.1.9 ) TIME_OK=1 machine_on=0 # On va scanner toutes les addresses dans le tableau HOSTS for i in HOSTS do # Vérifier si l'adresse répond if Ping.pingecho(i, TIME_OK) print "#{i} est vivant\n" machine_on=machine_on+1 else print "#{i} est mort\n" end end # Dire combien de machine sur le réseau sont en fonction puts "==================" print machine_on, " sont en fonction\n"
Bien facile. Bon travail.
1. Is there any particular reason that your variable names are all english, but your comments are all french? Je deteste le French
2. Wouldn't it just be easier to use nmap? ;D
1. Comments are for me. But people can understand my variables1. Is there any particular reason that your variable names are all english, but your comments are all french? Je deteste le French
2. Wouldn't it just be easier to use nmap? ;D
2. Bah, doing it something yourself is a lot of fun
That's an interesting thought process you have: You need comments to help yourself (the person that coded it), but everybody else will just be able to figure it out by the variable names.1. Comments are for me. But people can understand my variables
Please, don't code any big projects with this thinking in mind... at least, nothing I'd want to work on
I know, I'm just bugging you. ;D2. Bah, doing it something yourself is a lot of fun
Hey! Ma ben faire ce que je veux! And if people want to look at my source they need to do what I've been doing every day of my life for the 6 past years: french and english.
That's an interesting thought process you have: You need comments to help yourself (the person that coded it), but everybody else will just be able to figure it out by the variable names.
Please, don't code any big projects with this thinking in mind... at least, nothing I'd want to work on
Uh, well that's not very open-source-like, if you ask me. Anybody who hacks on software you've written will have to read french and english. What kind of restriction is that?? It certainly wouldn't qualify as open source![]()
Quit being prejudiced. French is cool. It's not like he commented it in Canadian English or anything. That would be annoying, eh?Uh, well that's not very open-source-like, if you ask me. Anybody who hacks on software you've written will have to read french and english. What kind of restriction is that?? It certainly wouldn't qualify as open source![]()
I'm just having fun, I'm not prejudiced.Quit being prejudiced.
No.French is cool.
Yeah; Canadian English is so hard to read, what with all those correctly-spelled words like colour, labour, and neighbour, eh?It's not like he commented it in Canadian English or anything. That would be annoying, eh?![]()
Bookmarks