Octave GUI: right-click and edit function in a script file - function

In the Editor window of Octave GUI, if I right click on a function (say, f1) in an expression where it is called, and "Edit f1", function file f1.m opens.
But if my function (now plot_color_marker_ranges) is defined in a script file instead of a function file, when I right-click in an expression where it is called (1) and "Edit" (2) I get the following message
(1)
(2)
Can I get hyperlinking and navigation when a function is defined in a script file instead of a function file?
Steps to reproduce
Create script file myscript.m containing a function f1.
This script file has as its first command 1;.
Create script file mymain.m, and add an expression that calls f1.
Add also source('myscript.m') above the first call to f1.
This script is in the same directory as myscript.m.
At this point, both files were saved on disk.
Run mymain.m from the Editor window of Octave GUI to make sure f1 is correctly used from mymain.
Navigate in the Editor window of Octave GUI to the expression that uses f1.
Right click on any part of the text "f1".
Click on "Edit f1".
EDIT:
Notes:
This helps a lot with editing and debugging.
As of now, whenever I need to debug I set an M-file for the functions. Then I may transfer the function to a script file.
Using Octave 5.1.0 configured for mingw32 under Win 10.

Related

Unrecognized function or variable

I'm trying to run the beginning of a script that was sent to me:
function [ FList ] = ReadFileNames(DataFolder)
DirContents=dir(DataFolder);
FList=[];
DataFolder is the name of the folder in which all my data is held. When I click the Run button I receive:
ReadFileNames(DataFolder)
Unrecognized function or variable 'DataFolder'.
And I'm not sure why?
Any help is much appreciated. Thank you.
When you simply click Run, it's the same as running the command
ReadFileNames();
Note there are no inputs here, but your code expects (and requires) the input DataFolder.
So you have to do one of two things
Click the drop-down by the Run button, edit the type code to run prompt and add your folder. Then you can continue to click the Run button to execute this again. Note that once you've edited the default Run command for a function, the Run button icon changes slightly to reflect it:
A more common, and arguably more clear, way to run your function would just be to call it from the Command Window by typing ReadFileNames('your/folder/path/here'); (and hitting Enter to run).

Invoking series of commands in a new tab in cmder

TLDR:
I want to use something like -new_console:t:tabname to open a new named tab in cmder and then transfer focus/control to that tab so that the rest of the commands I'm sending from a Python script run in that console instead. Or, I want to rename a cmder tab from a script running in the console.
DETAILS:
I often have to execute a series of commands in cmder in order to test the latest code from our continuous integration environment. Because there are several applications I often have to have running at a time, it would be helpful for me to have the cmder tabs named according to which application they are running.
The only way I've found to set a tab name from within cmder (apart from manually with mouse clicks) is to do so with the -new_console:t:tab_name command. But that only runs the next command in the newly opened tab, and not all the things that come after it.
I kick off all my commands with a Python script that accepts parameters to let me control which application opens and how things behave. I'd like to do something like this:
os.system('pwd "-new-console:t:' + args.app + '"')
so that a new tab opens with the name of the app I'm about to invoke in it, starting with an indication of the present working directory. But then I'd like all the commands that follow from the Python script to be run in this new tab instead of in the tab used to kick off the Python script. This includes printing some flowerboxed comments, but also invoking a local application server that will continue running.
Is there any way to, as you create a new (named) tab in cmder, transfer focus to that tab so that all future commands run in that tab instead of the initiating tab? Alternately, is there any way from within a cmder console to rename the cmder tab it's running in? That would be just as good.
Thanks!
Thanks for looking, but I found the answer.
In the bottom right corner is a hamburger stack. Click on that and select Settings. In General --> Tab bar, change the Console setting from the default %n to %s. Then the "title" command will change the tab name.

Atom setting to open files in the same window?

I'm just trying out Atom for the first time and I find it bothersome that Atom keeps opening a new window for each file I click on - I'd prefer that it defaulted to opening each file in the same window.
I'm hoping for something along the lines of "open_files_in_new_window" : false, in Sublime. Unfortunately, all the google results I'm seeing just lament that this toggle is not immediately obvious.
In your terminal you can type atom -a <filename||folder> and the file(s) will open within the same atom window.
Go to Settings > Packages, look for the tabs package. In the settings for this package, choose "use preview Tabs".
Per the atom -h command, one should open files with -n=false or --new-window=false argument passed so that they are opened in an existing window, e.g.
atom -n=false ~/Desktop/test.py
One could make atom -n=false an alias of atom in the ~/.bashrc or ~/.zshrc file, or one could edit the corresponding file in /home/<your username>/.local/share/applications so that the command it invokes is, for instance, /usr/lib/atom/atom -n=false %F.
Just in the editor window, drag the open tab by mouse onto the window you need.

start opened file from sublimetext in associated program

i usually edit files in sublime text 2 that can also be edited and compiled with another program. As i have them already opened in sublimetext i do the following:
right click and choose "copy file path" (to clipboard)
Win+R to open windows run dialog
CTRL+V to paste the file path
hit enter to open the file with the associated program
i wonder some shortcut can be configured so it automatically starts the opened file with its associate program
thanks in advance
This can be done. I was in a very similar situation using Sublime as my editor of choice over the default SAS program editor. I was able to use the win32com.client.dynamic.Dispatch module to connect to SAS via OLE and pass text from Sublime directly to SAS using Sublime's build system to call my plugin. Making the connection was the easy part, it was the other processing that I had to do which was the time consuming part, but since you want to pass just a file name or the entire contents of your file, this should be a fairly straightforward plugin. Since I do not know what program you wish to open, here is the code that makes my implementation work. Maybe you caan glean something out of this.
def send_to_sas_via_ole(selected_code):
from win32com.client.dynamic import Dispatch
sasinstance = Dispatch("SAS.Application")
# submit the lines to sas
for selection in selected_code:
# for some reason cannot send as one big line to SAS, so split into
# multipe lines and send line by line
for line in selection.splitlines():
sasinstance.Submit(line)
and then the call in the run method of my plugin class:
class RunSasMakoCommand(sublime_plugin.TextCommand):
def run(self, edit):
try:
send_to_sas_via_ole(selected_code)
except Exception as e:
print "\n".join(selected_code)
print "Couldn't connect to SAS OLE"
print e
Good luck!
Open 'regedit.exe';
Navigate to
HKEY_CLASSES_ROOT\Applications\sublime_text.exe\shell\open\command
correct the path. Exit 'regedit.exe'
(optional) restart 'explorer.exe' or reboot your PC.
enjoy :p;
Right click on the file, press "Properties". You will see Opens with SomeProgram and then a change button. Click on the change button, and then look through the list for Sublime Text, if you can't find it, you can choose an application using the file explorer, from there you can navigate to C:\Program Files\Sublime Text 2 and choose sublime_text.exe

Empty Text File in SSIS Package

In my Project, I want to create one empty text file when the package triggered.
I'd probably just use a one-line Script task.
System.IO.File.Create(#"C:\OneEmptyTextFile.txt");
On your Control Flow, drag a Task of type Script Task from your SSIS Tool Box
Double click on the new Script Task
In the Script Task Editor, click Edit Script...
In the public void Main() section, where it states // TODO: Add your code here replace that line with the above code. If you are using SSIS 2005 or if you have chosen to use VB.NET in 2008/2012, please remove the trailing semicolon.
Click the X button in the upper right corner of the Integration Services Script Task window
Back in the Script Task Editor, click OK.
Now whenever that Task runs, it will use the static Create method of the File object to create a file in the requested location.
It might be good idea to dispose of the FileStream object after using the File.Create method to avoid locking issues.
Read more here System.IO.File.Create locking a file