• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

passing 'mode' as one of the command line parameters

 
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Currently, I do not let user specify the mode within the GUI. The program runs in the specified mode when it was started. So, I expect a string 'local' or 'remote' as one of the command line parameters. I read in this forum somewhere that asking user to type in mode is not permissible. In my instructions they do specify the possible command line parameters and mode is not one of them.
But I do not see any other reasonable way to figure out the mode only based on either file name or host name. Unless I try to instantiate the Data class with the only parameter I get from user (it could be file name or host name, port number is optional) and if it throws exception, I will not know if user entered filename or hostname. Even when there is exception thrown by Data class, it could be for two reasons file does not exist or it is not a file name.
The other way is to make port number mandatory and then the number of parameters will tell if user intends to run the program in local or remote mode. I feel it is rather clumsy to do this way.
Appreciate anyone's rely on this. Thanks
 
Rasika Chitnis
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anybody please give feedback on this ? Am I to assume that one command line parameter means it is local mode and two command line parameters mean remote mode ??
thanks
 
Rasika Chitnis
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One more point:
If I have to make user type in two parameters, just because I am using it as a way to distinguish between local and remote mode, I am forcing user to enter port number even if it is a default port. If I do not consider number of parameters as a test of local/remote, I could use default port in my code if user did not give me one.
Relying on number of parameters to decide if the mode is local or remote, seems odd to me.
Anyone, please respond >>>
 
This tiny ad is guaranteed to be gluten free.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic