Consoles and Tabs - console

When I start the tomcat server from console using the startup.bat script, a new command window opens which is filled with java logging statements.
I use Console2 which leverages tabs for each open console window. Is it possible to let the java system create a new tab within console2 instead of just opening a new command window?

This has nothing to do with java, its merely down to the way the catalina.bat is called from startup.bat
catalina.bat can be called with either a "start" argument or a "run" argument.
run Start Catalina in the current window
start Start Catalina in a separate window
So open startup.bat, scroll to the bottom you should see
"%EXECUTABLE%" start %CMD_LINE_ARGS%
change that to
"%EXECUTABLE%" run %CMD_LINE_ARGS%
exit
I add an exit after to close the calling window.

Unless Console2 hooks any APIs that create console windows – no. And that's also highly unlikely that they do or even can. Console2 does nothing more than hook up input and output of console windows. What the programs in those do is beyond what it's interested in.

Related

iTerm2 to attach to tmux session using tabs instead of windows?

I got tmuxinator to work with iTerm2 the following: https://stackoverflow.com/a/19747819/1009332
However, each tab initially opens in a different window. Is there any way to attach to an existing tmux session using tabs rather than new windows?
There's some more info about this cool feature here: https://code.google.com/p/iterm2/wiki/TmuxIntegration
My motivation for this was:
1. copy/paste/find locks the process in tmux, whereas with iterm2, you can find in a tail of logs and not lock the process.
2. key bindings are simpler in iTerm2.
3. I like tmuxinator to start many shell windows (tabs) when doing rails web development, so that my stdout of different processes goes to different windows, rather than mixing together when using foreman.
It is an option in iTerm2: Preferences > general Open tmux windows as native tabs in a new window, but you have to disconnect then reconnect.
Solution found here

How to make Rscript stay open until gWidgets gui is closed

I have a script which launches various gWidgets windows with buttons that have functions attached. I'd like to be able to launch this with rscript.exe so others can use it without seeing R. My problem is that when I launch the script using rscript.exe myscript.r an rscript instance shows up in task manager, it loads all the packages, the widget pops up for a second, and then it's gone (including the rscript process from task manager) before the user can even do anything. How can I make the instance of rscript stay active until all the gWidgets windows are closed? If I launch the script from either Rstudio or Rgui it stays open until done. As a similar question, is there also a way to prevent the dialog box showing the various commands from coming up too? I'm using Windows 7 by the way.

How to call an app that expects stdin input from QtGui?

I'm using Ubuntu and Qt Creator 4
I have a .cpp program in the executable form (say abc.out) that I wish to run when I press a button. It contains a number of cin and cout, so I want it to run on a "terminal" (on Ubuntu) so that I am able to input and output values to it. How can I do that?
I've tried system() and
also,
QProcess p1;
p1.start(./abc.out);
Using QProcess, my executable runs but stops at the first cout. It runs on the application output screen in Qt Creator and not on terminal.
For example:
I see on application output:
enter name:
When I type the value and press enter here, it doesn't accept the value, but moves to the next line and allows me to type further.
I want to run this abc.out file on the terminal. Any ideas would be really helpful.
Do you mean Qt Creator 2.4? In any case, on the Projects tab, you should find the Run settings section and from there you can find a "Run in terminal" checkbox. You could also use a Custom Executable option and type there: gnome-terminal --command ./abc.out The exact details can vary a bit as I'm using Qt Creator 2.5.
This should work when launching from Qt Creator, but when you use your app outside the IDE, you need to launch it from terminal and not by double clicking the executable. To fix this, I can think of two ways:
Launch a terminal window from QtGui (something like QProcess::execute("gnome-terminal --command ./abc.out"); ), though the problem is different systems have different terminal names.
Provide a Qt input/text box yourself as part of your GUI which then forwards the user input to the executable (something like myqprocess.write(input_asked_from_user_by_QtGui); ). Here you probably need to know what information to ask the user beforehand. If you want to display the cout output of the started process, you can use the read method and friends of the QProcess.
From your question I assume that you are writing an application that launches other applications using QProcess. Thats fine, but if your subprocess is waiting for data from the standard input it will wait forever since you did not provide any data. The stdin of your parent application cannot be automatically guided to the subprocess. Imagine you are starting two processes from your main app. To which child process should the input go?
If you want to communicate with child processes, you must use the QIODevice methods of QProcess and send/read data from/to that application.
The only sensible solution is to launch the target application in a terminal. Whether your own code provides the terminal window or you reuse an existing terminal application is up to you.

Pydev - startup

Maybe I got simple questions so I googled it but I can't find answer.
I am using Pydev/Eclipse and I want to run the script within Console.
First I want to modify the startup of the session - it means some modules are loaded during start (math, numpy, scipy, etc...).
Where/how can I modify Pydev Console startup?
Secondly, I execute the script using righ-click on script file and "Run as -> Python Run" then it's executed within console and terminated. So I want to stay within Console and to be interactive and not be terminated.
How can I get such feature?
Thank you!
Best regards,
Peter
The startup configuration can be found in the PyDev preferences menu. The preferences can be found in the upper menubar under 'Window'.
Window -> Preferences -> PyDev -> Interactive Console
There you will find a big text input field with a label 'Initial interpreter commands'. Often it is allready in use and imports sys only to print the name and version number of the starting console.
The only solution I am aware of for staying connected with your script is to set a breakpoint at the end and start your script in debug mode. But maybe there is another way. To do so just double click at the left corner of the editor window with your script opened. A green dot will appear marking a breakpoint. Now right click an choose 'Debug As'. Your script will run till the line is reached where you have set the breakpoint.
Hope I could help.
I think that what you want is the interactive console. See: http://pydev.org/manual_adv_interactive_console.html
You can configure the initial commands in the preferences page.

How to launch qt application with the command window in minimized state, without any flicker?

I am working on VS2005 sp2, with qt3.3.7. I have set the linkers>system>subsystem to Console (/SUBSYSTEM:CONSOLE) as I need the command window to check runtime status of my project at runtime.
I want to launch my application with the command window minimized. The problem is, whenever my application launches, the command window comes in maximize state.
If I minimize this window using :
HWND hWnd = GetConsoleWindow();
ShowWindow( hWnd, SW_MINIMIZE );
still I get a flicker, ie for a split second the command window opens and then minimizes.
How can I launch my qt application with the command window in minimized state, without any flicker?
The only thing I can think of is launching your own console process using CreateProcess() with startupInfo.wShowWindow=SW_SHOWMINIMIZED, and startupInfo.dwFlags |= STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES; setting startupInfo.hStdOutput to a handle you can use for output. I've tried launching cmd.exe like this, and while I can get it to start minimized, I haven't managed to write to it. I don't have any more time to play with it tonight, if you manage it I'd like to see the solution!

Resources