Link multiple files to same console window in JupyterLab - jupyter

Is there a way in JupyterLab to link different files to the same console window? Suppose I have files A.py and B.py and that I right-click the filename tab for A.py and select "New Console for Editor". Now I if do the same for B.py it will give me the option to "Use Kernel from Other Session", where I can select the kernel that is already running for A.py. However, there will still be two different console windows open, one for A.py and one for B.py, albeit linked to the same kernel. I would like there to be just a single console window that receives input from both A.py and B.py. This would be something more similar to the default behavior in PyCharm or RStudio, where you have a single console window that accepts input from many different files.

Related

Coderunner issues Mac

Please can anyone help me out code runner only shows the right output after running the python file.
For example
Here I used the option "run python file" in terminal and it worked
Then i ran it using coderunner extension and it works
But when i change the output and run it, it doesn't change
It only changes after i run it with python file. So I have to run it in terminal for the right output to show. code runner only mirrors the last output in terminal
This may seem obvious but in the third picture, as you can see from the white circle on the tab where the x to close usually resides indicates that you have not saved the file hence it will output results from the last time you ran it using the 'run python file'. The 'run python file' button saves before running automatically so it would be easy to accidently miss the cause as now its saved with the new input and your code runner will output the new result again making it seem as though its duplicating the 'run python file' button.

Is there a way to open a file in VS Code from the integrated terminal/codespace?

The integrated terminal in VS code means that you can run builds, scripts and other commands and see the results as is. Sometimes though they produce output files that you'd like to view in an editor, like a logfile or exception trace.
Is there a way of running a built-in command in the terminal to say 'please open this file in vscode', specifically in a codespace? On macOS, you might use 'open' or 'start' on Windows, but this only works if your codespace is hosted on the same machine that you're browsing to.
It would be great if there was a command that could be run that would open up the corresponding file in vscode, such that you could set the VIEW or EDITOR environment variables and have such operations edit in the file itself. Then (for example) running git in the integrated terminal would open a new vscode editor for writing the git message, instead of the default vi/emacs/notepad/edit.com/pico/nano.
Yes you can. Use the command:
code filename
Or, if you are running an early release (or GitHub codespaces):
code-insiders filename

Call ./.../bin/spark-submit pythonfile.py in eclipse (Pydev) console when running program

Current situation which works fine:
I'm currently programming my Pyspark files in eclipse with the Pydev plugin
I manually execute these files in the ubuntu shell with the following command:
./.../bin/spark-submit pythonfile.py
Desired situation:
When I press the "run" button in eclipse, eclipse will call the command mentioned above and show the console output in the eclipse console.
Is this possible and if yes, could someone give me a clue on how to do it?
Thank you!
I would recommend an external launch.
From the Run menu, choose External Tools | External Tools Configurations... and then create a launch configuration specifying the command you want to run.
You can generalize the command a little by using Variables For example:
Location: ${workspace_loc:/myprojectname}/../bin/spark-submit
Working Directory: ${workspace_loc:/myprojectname}
Arguments: ${workspace_loc:/myprojectname/myscript.py}
This is what a screenshot of the configuration looks like.
Additionally, in the Common tab you have a control over whether the output is captured in a console (the default) and/or redirected to a file. In this example screenshot, the output comes to a console and is written to a file back in my project:
Output file: ${workspace_loc:/myprojectname/build_output}

How to know some app's console command in unity dash?

Is it possible to see some app's console command from unity dash menu?
For example, I open the Dash via the windows key, type in some app name, it appears in the list below, and I do "something" to see how to start it from the command line.
I am asking this because I came across multiple 3rd party apps whose console command has nothing with the app name, and I was unable to figure out how to open such apps from the console.
Navigate to this path in a file manager: /usr/share/applications
For example, with Nautilus you would run (in a terminal)
nautilus /usr/share/applications
Locate your program by name (using search if required).
Right click the file for your program.
Select 'Properties'.
There should be a 'Command' field which shows the command to be executed. If the program has arguments such as %U, those are file arguments passed when that program is used to open a file.

How do I make a '.cmdtree' window dock at startup in WinDbg?

I have followed Tess Ferrandez' blog for setting up a custom theme in WinDbg.
I have also started launching WinDbg automatically with -c ".cmdtree c:\mycmdtree.txt"
This correctly opens my cmdtree file as a commands window, but I can't get it to dock properly. The problem appears to be that 'commands' windows can only be opened after you have opened a DMP file, but opening a DMP file switches you out of the 'base' workspace, therefore any changes to your workspace aren't saved.
Any ideas?
This simple request turns out to really complicated. WinDbg's window positions are saved in a workspace. WinDbg has several default workspaces:
Base - this is the workspace that is used before you start debugging (no dump open, no exe open, not attached to anything)
Per dump file - for each dump you open, you have a workspace for this file
Per executable file - for each executable file you open.
User-mode - used when you are live user-mode debugging
Kernel-mode - used when you are kernel-mode debugging
Per machine architecture - 1 for x64, 1 for x86, & 1 for IA64
Remote - used when you are remote debugging
For any given type of debug (i.e. Live user-mode or post-mortem dump analysis) you usually end up with a combination of settings of Base+Your type of debug.
If you open a dump file, you get BASE+Per dump file
If you live user-mode debug, you get BASE+User-mode
If you live kernel debug a x64 machine, you get BASE+Kernel-mode+x64
All the changes you make in any given mode are saved in the workspace that was overlapped last. This means that if we open a dump file (so we are Base+Per dump), any changes to settings would be saved in the workspace for this dump.
In addition to the built in workspaces and all of their combinations, there are named (customer) workspaces. These would be when you go to File > Save Workspace, and provide a name to save all you settings which you could then enable on launch of Windbg using the -W command line argument.
Back to your question. How can I get the .cmdtree to open? In the base workspace you can't. Many of the windows are only available when the debugger is NOT in the dormant state (in its BASE workspace). Once you get the debugger into any of its active states, then these windows are available.
The problem you run into is that in order to get everything setup the way you want it, you have to have the debugger in an active state (an exe open, a dump open, live debugging) and when you go to save you window layout, it is also going to save which exe you had open, or dump, or live debug you were doing.
Your best bet is to just do what you were already doing, which is to just use the -c in the registry (HKEY_CLASSES_ROOT\WinDbg.DumpFile.1\shell\Open\command). This will allow you to just double click a dump and get these command line options every time you are doing dump analysis. You can then create a shortcut to windbg that also incorporates the command line so these settings will be applied for the other types of debugging you do.
Here is my command line from the regkey above:
"c:\debuggers\x64\windbg.exe" -z "%1" -Q -W Internal -c ".load winde.dll;.enable_unicode 1;.ignore_missing_pages 1;.logopen /t C:\Users\jasone\Logs\debug.log;aS .p .process /p /r; aS .t .thread /p /r; aS !p !process; aS !t !thread; aS .f .frame; aS dv dv /V /i /t; aS .f .frame"
What does this do?
Launches the debugger, attaches to dump file, NO prompt to save workspace settings, Open my "Internal" workspace (a named workspace I created), and run these commands to load debugger extensions, setup preferences, and create aliases that make my life easier.
This worked for me to dock the command window by default:
Open WinDbg. Do not open a dump file. Just open the app.
Click the menu View - Command
Click the menu Window - Dock All
Click the menu File - Save Workspace