I have a Windows 7 laptop, and I think I installed everything correctly, and I am trying to follow a couple tutorials to learn from. I can make a new application ok, and I can start the server just fine by typing "rails server", and I can go to the localhost:3000 'welcome aboard' page just fine, but after that the tutorials ask me to type other stuff into the command prompt window. The problem is, with the server running, I can't type anything into the command prompt window! I'm obviously doing something wrong.. anyone have any idea of what I should be doing?
The easiest way is to open another command window.
I set up students to use more than one command window like this:
one for typing most commands
one for running the server
one for printing the log file using the "tail -f" command to show ongoing progress
one for running rails console
Related
In Rails console I entered an Active Record query, and it took up more than the whole screen, so it was scrolling. I forgot to hit q to get out of it and instead hit Ctrl-C. I got some errors, then I got some of the Rails console output, then I hit ^C again, then my prompt came up...
But I can't type anything. Well, actually I can type, but I can't see anything.
If I type exit it will exit the Rails console and get me back to my prompt, and then if I type rails c I'll get back to my console. Except none of the things I just mentioned typing appear on the screen when I type them.
And once I'm back inside the console I still can't see what I'm typing. I have to open a new terminal.
I've had this happen in a number of different scenarios, probably all where my reflexes exited a process the wrong way (like with ^C instead of q), and this is just the first one where I could pin it down.
Does anyone know how to fix this without having to scrap my work and open a new terminal?
Something you've typed, or something output from your query in console, has disabled or redirected the "echo" setting in your shell - so, you're still able to type commands, but you just can't see them. If the Active Record query returned binary data, it's quite likely that some bytes of the binary data happened to be an escape code that changed your echo setting. It's also important to realize that if your echo setting changed, it's quite possible that other settings have changed as well.
If you're at your shell prompt, you would just type the unix command reset to restore normal settings. However, if you're still in your Rails console, you'll need to type:
system 'reset'
to run that command from Ruby.
Type reset and press enter, it should be fixed.
Last year I thought I would give Dart a try, so I downloaded the Dart + Editor zip from the dartlang.org website and got it working on my Ubuntu 12.04 environment. When trying to get the Sunflower demo to run (by clicking the Run button), I got the "Unable to run current selection - please select a runnable resource" error. After exploring Google for answers, I found nothing, so I gave up on Dart at the time, not wanting to spend the time on something that is still buggy. Since then I prepared a completely new Ubuntu 14.04 environment on a new computer and thought I would give Dart another try. So I downloaded and installed it again this year and I am experiencing the exact same problem, still with no answers from Google searches. If this were a bug, I figured something like this would have been resolved after a year, or at least some discussion somewhere on Google about it. Am I doing something consistently wrong?
I extracted the dart zip into /opt/dart
I installed openjdk-7-jre
I executed DartEditor and it runs
I select the Sunflower demo
I click the green Run button
I get the following error: "Unable to run current selection - please select a runnable resource"
Any ideas?
Try the context menu on the entry page file (index.html or sunflower.html) in the web sub-directory and choose Run in Dartium
There is no unique or default entry point in a Dart package and no way to configure one.
You always have to run a specific Dart script file or HTML page that contains a ` tag.
I almost never used the run Button in the toolbar.
When you have for example the menu Run/Always run last launch activated and run an entry point like described above the toolbar run button should work to run the same entry point again.
I guess there are other ways to make this run button work but as I said, I almost never use this one myself.
Context menu Run in Dartium, Run as Javascript for web applications and context menu Run for command line scripts worked always for me.
I am an absolute beginner with Ruby on Rails and I seem to have a problem with the way I should be doing things.
If I use "rails server" in order to be able to test my application, I can't do anything else in the command line.
Is there another way of doing scaffolding, other than command line? If not, how to I get two "Command prompts with Ruby" at the same time?
When you search for it from your metro screen, right click on it and then click on Open in a new window.
Open a new terminal tab before you start your Rails server, and then you can just leave it running in the background. However, do make sure you go back to that tab and specifically shut the server down before closing terminal as it doesn't always automatically shut down when terminal is closed and then you may have problems when reopening later.
Okay here's my problem.
I type in "rails s" and then my terminal won't let me type in any commands. So I have to start a new terminal window, which is pretty annoying.
On the other hand I can type in "rails s -d" which detaches, and then it's a pain to stop the server when I need to. (Instead of using control+c, I have to find the PID and use kill -9 PID)
I'm not a professional, so if anyone has any advice it would be much appreciated, thank you!
I don't believe there is a way to do the thing you are specifically asking for.
However, I use Iterm2 which allows me to open multiple terminal windows in one window, either by splitting my iTerm2 window or by creating multiple tabs. That way I can just make the terminals that are holding rails server and my development.log tail very small unless something interesting happens in them.
I use screen, you can also use TMUX but they are window managers in terminal and you can create multiple windows in same terminal window :)
Read up on them at WikiVS as that might help you :)
http://www.wikivs.com/wiki/Screen_vs_tmux
Screen: http://www.gnu.org/software/screen/
TMUX: http://tmux.sourceforge.net/
So you can easily switch and maintain same terminal window. You can't obviously use the EXACT same window that rails server running but it's close enough without having to do the searching for the PID.
You can type: rails s &. I'm not sure if this is what you meant.
I'm on mac osx using zsh. If I start a rails server with "rails s" I can put it in the background by hitting "ctrl-z" in my terminal (zsh).
If I open up a different terminal window then I don't see the rails server if I do "jobs". However, I can see it when I do "ps".
Is there a way I can somehow "unpause" the rails server in this new terminal window?
You can not easily move a process to a new tty. The easiest solution would be to start it in a screen session, detach screen and then resume in the new terminal.
The job is "stopped" by sending it a SIGSTOP.Your C-z doesn't send the job into the background. It "stops" it. You can then move it into the background using the bg shell builtin. However, if you send this process a SIGCONT (kill -CONT <pid>), it should bring the process back to the foreground. This can be done from a different shell.
You will not see it if you type jobs because it is a job controlled by a different shell (the other terminal window and not the one where you typed jobs). Processes however are "global" and can be seen from anywhere using the ps command (as you rightly pointed out).
Update: Looks like I spoke too soon. Apparently, the signal alone isn't enough to bring it back to the foreground. Probably something to do with the shell.