How to make the envirinment variables adjustment persist all the time (using command line)? - command-line

In Windows 10, I try to modify the PATH environment variable from the command line like this:
set PATH=%PATH%c:\Oracle\instantclient_21_3\;
However, when I close and reopen the cmd window, this change disappears.
How to make the PATH adjustment persist all the time (using command line)?

Related

Julia history storage with command line outputs

Is there a method to store the command line outputs to a file in Julia.
The command history can be seen at .julia\logs\repl_history.jl in Windows OS.
I wish to store command line output also to a file automatically.
? command outputs also.
Whatever is shown in the julia command line, the whole text should be stored into a file.
Is there a way to do this.
found a similar qn : For Julia saving output to txt/CSV file?
If you run Julia in REPL mode in Widows using PowerShell, you can do the following in PowerShell:
Open the left upper corner menu and in Defaults, change the buffer size to something large enough for your needs, say 500.
After running Julia to do what you need, go the the left hand corner menu and choose Edit - Select all, then Copy. Paste to an editor.

gnuplot command-line options

How to set 'Direct2D backend' option by default for "win" terminal in gnuplot 5.2.8? I know how to set this option interactively by clicking on the drop-off menu in a graph window. Is it possible to set it in the command-line call to gnuplot?
I figured out how to set 'Direct2D backend' option to be the default with pm3d in gnuplot 5.2.8. First, wgnuplot.ini file has to be generated using a gnuplot prompt. Second, the following line has to be deleted (if present): GraphGDI+=0 or GraphGDI+=1. Third, the following line has to be added to wgnuplot.ini file: GraphD2D=1. Save wgnuplot.ini file after editing and run gnuplot. 'Direct2D backend' option is set as default now.

Is there a way to edit last Octave command and /or script typed in Octave CLI

typing and executing a single line command in octave cli is simple.
for example a=1.
If one wants to edit this command and execute it again it is possible by navigating the history with the up/down keys.
But when executing a multi line command-script, one can still navigate to a single line and edit it, but how to execute the all script again, without going line by line in the history and "enter" the line?
for example:
for i=1:6
a(i) = i;
end
Is there a way to open the all script in an editor, edit, and re-execute it?
Yes there is, via the history command.
E.g. history -q 3 will display the last 3 commands -- the -q switch means do not prepend line numbers, such that the output is copy-pasteable.
You can also use the -w switch to redirect the output to a file, which you could then modify in your editor and call as a script, as you suggest.
If you're using the GUI, you can also use the history pane to highlight the lines you're interested in (in the order that you want them!), and paste directly into the editor window.

Can I check the current value in an IPython magic command (%xmode)?

I want to check the current value of a magic command %xmode. The available mode is Context, Plain, and Verbose.
If you just type in %xmode, then it automatically switches to the next value. Certainly, you can know which value it was set to, but it is a pain to run the same command two more times to set it back to the original value.
So is it possible to only chech the value, without changing it?
We can run the following line to get the current xmode from an IPython terminal
get_ipython().config['InteractiveShell']['xmode']

editing objects from MongoDB with an external editor doesn't update the object

I'm using the Mongo shell. I've set my EDITOR to my notepad++ path. I create an object and then I use the EDIT command to edit the obeject using notepad++ but it doesn't update the object.
// mongo shell
var pow = { name: "teest" };
edit pow
// notepad++ opens a document called 'mongo_edit141225123.js' that resides
// in C:\users\...\Appdata\local\temp
// I edit the object, save and close notepad++
pow // object isn't updated :(
what am I missing?
There seem to be a few caveats here. But I can describe how I got this working:
Set the PATH environment variable to include the path to the notepad++ executable. Note to both "apply" this change and not have an existing command line window when doing so. Or at least open a new one once this step is complete.
Specify an EDITOR variable in your command shell window, or otherwise set that under the same system properties as setting the PATH environment variable. Since the program directory is in the PATH just set the executable name:
set EDITOR="notepad++"
Launch your mongo shell and go to edit a variable:
> edit something
This will launch the specified editor, with an "undefined" variable at first. Type in something "valid", as any invalid JavaScript declaration will be discarded. Now for the important part. After your edit and when "closing" click the "tab close" icon and do not close the entire editor as shown:
That last part seems to be the most important. If you are prompted to save (and you likely will be ) then do so. Only "after" the tab has been closed (and saved) should you then close the editor itself.
If you then subsequently issue the same edit something from the mongo shell, then the editor will open with the content that you edited before.
If you don't follow this and just close the editor window first, then you should see an additional tab opened and the original tab with the content that you had before. But subsequent changes will be lost as the shell is now tracking a different temporary file.
So follow those steps and you should be right. I would expect there are similar issues with other external editors that will actually resolve in a similar way.