rails console pry/irb "stuck" after displaying long value/string - ruby-on-rails-3

I am developing with rails on a mac using the rails console via pry/irb.
When I display a long result in the console ie. Model.all or .really_long_string, I cant seem to get past the string or value that is displayed and the console displays "(END)" at the end of the console.
What command do I use to get past this so I can continue entering ruby statements on the console without having to close the terminal window?
I recently discovered Ctrl Z to close the console, but I assume there is a better way

Looks likes the END is made by a pager. Have u tried typing "q"?

Related

VB - How to bring an application to the front?

I am trying to make a program that will run on a system. The program will launch a driver on startup, which displays a cmd window. I am trying to get my program to come back to the front after it opens this. I have tried using a few different things such as:
Me.BringToFront
Me.Activate
Me.Show
However, none of these have worked so far, does anyone know of another way I can do this?

Applescript: how to "tell" an app in the background?

I'm using Chrome to get the HTML of a webpage which is generated by javascript. The applescript which does all this needs to run every 2 minutes. Everything is working perfectly, except that I obviously need Chrome to do this completely in the background. My script contains the following uses of Chrome (as well as a block to set theTab, which doesn't seem to ever cause Chrome to come to the front):
set URL of theTab to theURL
set isLoading to (loading of theTab)
execute front window's active tab javascript javascriptLocation
set theSource to execute front window's active tab javascript "document.documentElement.outerHTML"
Putting this line:
tell application "Finder" to set visible of process "Google Chrome" to false
after each of the above lines either produces no hiding at all, or at best Chrome flashes onscreen and then goes away. I find this very distracting.
Is there any way to have an application run reliably and permanently in the backround? Or, failing this, is there an invisible way to get javascript executed server-side so an applescript can get hold of its generated source?
Chrome 66.0.3359.181 running on Mac OS 10.11.6, Applescript 2.5.
The following is not an answer to the question I posted, but it is an answer to the problem I was trying to solve which is why I posted the question.
As stated in my question, I need to get hold of the HTML which some javascript generates on a site (which is not under my control). I can't do a client-side scrape because of CORS restrictions on the site. I tried the cross-domain tools listed here and couldn't get them to work.
So I was using Chrome's applescript command, execute, to first execute the javascript (to produce the HTML), and then a second time to grab hold of the HTML with document.documentElement.outerHTML. But having Chrome flash onto the screen every 2 minutes throughout the day was doing my head in.
Turns out Chrome can also run in headless mode, from the command line, and just happens to have an option to run javascript and return the generated HTML!
So my code got a whole lot simpler and I don't have to have Chrome in my apps list all the time. Happy coder am I :-)
Here's the one line that gets me the HTML generated on the site I need:
set theSource to (do shell script ((quoted form of POSIX path of googlePath) & " --headless --dump-dom " & theURL))
Thanks, once again, #matt. I'd never heard of headless mode and would never have found this without your suggestion of PhantomJS!

CodedUI prints "pipe" instead of "slash"

I have a problem with using Keyboard.SendKeys in CodedUI tests during entering date. I have simple html page with textbox (input[type='text']) and I'm trying to enter date in format (M/dd/yyyy) into it by following command (I am using VB.NET):
Mouse.Click(htmledit)
Keyboard.SendKeys("^A") ' Sending keys to select all and delete hence clear content of the textbox
Keyboard.SendKeys("{DEL}")
Keyboard.SendKeys("10/10/2014")
In my machine, it works just quick and perfect.
But, today's morning I tried to run test on the another machine and I noticed that it types pipe (vertical bar) instead of each slash! So, what I got is: 10|10|2014..
I was very surprised and tried another symbols and they work just as fine as on the my machine.
By googling this problem I have nothing. Does anyone know how to fix it? And I am very curious why it happens? Keyboard.SendKeys depends on what?
Thank you.

SendKeys VB.net

Hi ive developed a application that works with my site by using
SendKeys.send("{ENTER}") to submit info on one of my forms.
Is there a way to stop it from running outside the application?
For example im trying to run the program in the background and when im browsing my facebook or on google it randomly keeps hitting enter.
Any help is greatly appreciated thanks for your time.
The short answer is to look at the windows available for a process and check the titles to see if it's the page you want.
If System.Diagnostics.Process.GetProcessesByName("firefox").MainWindowTitle = 'My Page Title'
...
End If
That said, there are much better ways to do this - If you're using firefox, look into GreaseMonkey, if in Chrome, look at TamperMonkey.
Both allow you to inject custom javascript into any page whose url matches a pattern you choose. In effect, you could write some Javascript to submit a form (say) 30 seconds after page load.
This would have the benefit of working if a different tab is selected as well as not requiring a whole application.
The SendKeys.Send method will indiscriminately send the key stroke to the active application. There is no way to use this API to target a specific application.
You could change your app to try and verify the active application is the one you want to send keys too. This is destined to be a flaky process though. No matter how good your verification is it's always possible that the active app is switched to another app after your verification completes.
If VerifyActiveAppIsTarget() Then
SendKeys.Send("{Enter}") ' Active app could change before this runs
I would persue a different solution for sending data between my apps

Exit rails console after long output

I would've thought this would be an easy thing, but when I use the rails console, if I query a variable that has multi-page output, I can continue scrolling until the console yields (END) but then I can't get out of that state without CTRL+Z, which requires me to restart said rails console to continue. I'd like to just exit that output, but CTRL+C, CTRL+D, ESC, and every other combo I can think of simply do nothing. I'm certain there is a way to do it, can someone put me straight?
Thanks
You're in a pager. Press "Q", for "Quit".