How to open console output in new tab? - rascal

What was the trick to open console output in a new tab in eclipse? (handy for big prints -> no need for scrolling through the tiny console).

I have the answer - I asked prof. Klint, and he knew where it was, so the trick is:
First to import util::ValueUI; in your Rascal code, and then - instead of using print() or its variants, just use text().
Whatever you prompt to standard output, shall be pushed to a new tab in your Eclipse IDE.

Related

How to disable automatic function docstring generation in Spyder?

Spyder (the Python IDE) generates a function docstring automatically when you click Enter after the first line of the function def. How can one disable this feature?
I've looked around in Tools (for instance in Tools -> Preferences -> Editor) and did not find a way to do it. But there are tons of features in Spyder so maybe I'm missing it.
Are you using an anaconda install with kited running in the background? Opening task manager and stopping this from running fixed the problem for me.
Edit: This may be incorrect
When you type in the triple quotes, an icon will pop up that says Generate docstring. When this happens, do not hit Enter. Just hit esc.
Until we can just deactivate it in settings, that's what I've been doing.

How to print a file from VsCode?

I want to send the file I'm currently editing to a printer, like I did in Notepad++ for example.
I havn't found any hint on a print command. Is it not possible ?
It is not yet available, but I found an issue report for that feature.
It's currently in the backlog, so we can expect it soon.
https://github.com/Microsoft/vscode/issues/5953
Edit:
In the meantime:
https://marketplace.visualstudio.com/items?itemName=nobuhito.printcode
https://marketplace.visualstudio.com/items?itemName=pdconsec.vscode-print
Now you can install addon for VS Code - search "PrintCode".
Note that the repository for this extension was last updated in February 2018 with numerous issues outstanding.
I found the PrintCode extension inspiring but unfinished and with a number of flaws. In particular it depends on a specific paper size to wrap and as a result does not respond well if you change paper size or orientation in the print dialog.
It's open source so I looked at the code and didn't like that either. No programmer ever likes another's coding style. So I pinched the idea of using a web-browser as platform driver for HTML printing -- my hat is off to the PrintCode author for that cunning insight -- and wrote my own.
In the process I fixed all the known bugs, added everything on my wishlist and a couple of things suggested by others. The biggest thing was figuring out the CSS required to respect print dialog paper size and orientation. This also sorts out the mysterious disappearing line numbers problem, although I'm not sure why. The next biggest thing was learning to probe for an unused port, a problem that also afflicts PrintCode causing the browser to open showing no content.
Major issues
PrintCode depends on a web service. You can't use it offline.
Many people want to be able to open a file, select a portion and print just the selection.
The print dialog supports changing paper size and orientation. This clashes with the way PrintCode works.
Some people like to run multiple VS Code windows.
When you print a markdown file, you probably don't want it printed like a text file when it can be rendered with fonts and proper headings and bullets etc.
Support is required for remote workspaces.
Because each instance of VS Code needs a different port for its embedded webserver, you can't just use a setting. Dynamic port allocation is necessary.
Remote workspaces weren't even a thing until two years after maintenance ceased on PrintCode.
If you want to survey your options, get onto https://marketplace.visualstudio.com, choose the Visual Studio Code tab and search for printing.
If you just want a link to my version, it's here http://marketplace.visualstudio.com/items?itemName=pdconsec.vscode-print.
If you like what you see but need something I haven't thought of, the marketplace page has a link to the repo on github. Create an issue and tell me what you need -- or write it yourself and submit a PR.
Now there is an extension available for printing from the VS Code Editor.
It's called VS Code Printing Free.
I've tried it for a couple of days and it works fine.
Poor man's answer: Copy code to Notepad2 or Notepad++ and print from there.
The colour coding will be different though
You can use an Extension of VS Code: PrintCode
Install extension PrintCode
On Mac: command + shift + P
choose command> PrintCode
I have modified the https://marketplace.visualstudio.com/items?itemName=pdconsec.vscode-print. If you change the values that I have marked in the picture in the extension settings a browser tab opens with the you can then print this also works on the Ipad. It works also with the code-server Version inside a Docker Container.
I put the file on github https://github.com/chrishdx/vsc-print
enter image description here

Force Open Lua Console or Run Lua Console Automatically on Startup

I'm new to Wireshark & Lua and I have a question that I can't seem to find the answer to by reading around online
Is there a way to open the Wireshark Lua console window on start up? Or even automatically open dialogs created by listeners on start up? I was hoping there were some commands or capability that would allow me to open (not just create) dialogs from within a script.
I've read about the exploit for the console in versions 1.6 and earlier, but I'm running 1.6.8 and I'd rather not use something that could potentially cause Wireshark to be unstable.
Modify the bottom of C:\Program Files\Wireshark\console.lua. Before the final "end", add:
run_console()
You can find an advanced option in the preferences dialog:
Open Preferences from the Edit menu
Navigate to Advanced
Filter for console
Change the value for gui.console_open to ALWAYS

Debugging Rascal code

So i've been using Rascal for a while now, but I was wondering if there is support debugging without using println and the terminal?
So like with c# in Visual Studio, stepping through the code, into functions and so on.
For me this would be a big help and can save time.
Just like visual studio, we have breakpoints and stepping through code. Since Rascal runs in eclipse, it might look slightly differently.
Remember to start your rascal console in debug mode, else it won't work.
You start it in debugging mode:
by selecting a .rsc file and right clicking Debug as > Rascal application.
or, if you select start console from a navigator or editor context-menu, it is a "Debug" console by default.
Adding breakpoints is done by clicking in the margin of an editor.
Any function you call from the console will activate the debug mode of Eclipse as soon as it hits the breakpoint.
Structured statements such as if and for act a little different in the debugger than what you might expect from Java or C#. Namely you have to "step into" them, otherwise if you press "step over" you will jump over their bodies.

Running just the matlab editor

Is there a way to just run the matlab (7.9.0) editor and not the rest of the "desktop" on linux?
This can't be done directly, because the editor stopped being a stand-alone executable many releases ago. It is now launched as a separate Java window from the Matlab desktop. However, you could try hiding the desktop once the editor is displayed, using the following simple code snippet:
com.mathworks.mde.desk.MLDesktop.getInstance.getMainFrame.hide % to hide desktop
com.mathworks.mde.desk.MLDesktop.getInstance.getMainFrame.show % to show desktop
Note that if your editor is docked to the desktop, it will be hidden together with the desktop, so be careful...
No, this is no longer possible since r2007a.
You can get Matlab syntax highlighting for emacs and vi, though.
On my windows machine, I can start MATLAB with the -nodesktop option, then once in the command prompt, I start only the editor with edit.
Im not sure if this is different in terms of memory space used, but this way you only get the editor and the command prompt (no auto-completion though)
You can add Matlab syntax highlighting to Kate via a plugin. I don't know about gedit, but there's probably an addon for that as well.

Resources