Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 [Tip]Executing Code Without the Command Line
Index -> Programming, Ruby -> Ruby Tutorials
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Clayton




PostPosted: Mon Nov 13, 2006 7:36 pm   Post subject: [Tip]Executing Code Without the Command Line

Ever wanted to show your teacher teaching you OOP in Turing that there is a much better way, and it's free? So now you've come to the conclusion that you're going to show everyone up and use Ruby to show them how much better of an alternative it is. Congratulations. The only problem is, you don't have access to the command line!. Well there is a simple solution to this. If you are using Winders (Windows), simply double click on your *.rb file and a command prompt window will open, running the code. As far as i know though, you have to have Ruby properly installed for this to work, and of course if your .rb extensions aren't properly linked, then this probably won't work, so be sure to install it properly! As far as MacOS or *NIX systems, I don't know if this will work, so you will just have to try.

Thanks to rdrake who let me know about this little trick.
Sponsor
Sponsor
Sponsor
sponsor
[Gandalf]




PostPosted: Tue Nov 14, 2006 1:22 am   Post subject: (No subject)

Or you could, more simply, just try ruby in your browser.
Clayton




PostPosted: Tue Nov 14, 2006 1:35 pm   Post subject: (No subject)

aye, but trying Ruby in a browser only goes so far, there are somethings you need an interpreter offline for...
Cervantes




PostPosted: Tue Nov 14, 2006 5:35 pm   Post subject: Re: [Tip]Executing Code Without the Command Line

Freakman wrote:
The only problem is, you don't have access to the command line!.

Why don't you have access to a command line?

The problem with simply double clicking on the ruby program is that the command prompt closes immediately after the program finishes execution.
Clayton




PostPosted: Tue Nov 14, 2006 5:42 pm   Post subject: (No subject)

because my school is absolutely retarded, and has pretty much restricted everything on the computers. We can't right click, can't access the hard drive, can't access the command prompt, we can barely use the usb ports. Not to mention they are the slowest computers I've ever had to use in the last 4 years. It's really very sad that they would cripple computers so much in order to try and "protect" them.
[Gandalf]




PostPosted: Tue Nov 14, 2006 5:48 pm   Post subject: (No subject)

You don't have access to the command line because, the school computer system being what it is, they block (or so they think) access to the terminal.

And fixing the automatic closing of the window upon completion is as simple as putting a gets at the end of your code.

*edit* Shazam!
Aziz




PostPosted: Tue May 06, 2008 12:27 pm   Post subject: RE:[Tip]Executing Code Without the Command Line

I may be necroposting, but there's another way to get command-line access, and that would be making a batch file.

Open up notepad and save a file called "commandline.bat" or any *.bat file.

This will execute cmd:

code:
cmd


Admins might have cmd disabled, so try "command":

code:
command


If that doesn't work, simply enter the commands in here, such as compilation commands or starting the interpreter. Not sure what the Ruby interpreter command is, if it's "ruby", then the file is:

ruby.bat
code:
ruby


.bat (Batch) files are executable, so you can double-click them in windows.
Display posts from previous:   
   Index -> Programming, Ruby -> Ruby Tutorials
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: