SublimeREPL + Octave - sublimetext2

I am using Octave for some Machine Learning work and I have noticed in my package library in Sublime that there is SublimeREPL: Octave as an option.
However when I select it, I get the following error message:
FileNotFoundError(2, "No such file or directory: octave")
Is there a way to use sublime to code with Octave?
Many thanks

First, you need to find out where your octave executable lives, and note the full path to it. On Linux or OS X, open your favorite terminal emulator and type which octave, and if it's in your $PATH variable it will print the full path to it (for example, /opt/local/bin/octave or something like that). If it's not in your path, or if you're on Windows, you'll have to search around a bit until you find octave or octave.exe, if you're on Windows.
Once you have the path, open Sublime and select Preferences -> Browse Packages..., which will open your Packages folder (surprisingly). Navigate to Packages/SublimeREPL/config/Octave and open the Main.sublime-menu file in Sublime - don't worry, it's just plain JSON. Go down to line 18 (or thereabouts) - it should say "cmd": ["octave", "-i"],. Change "octave" to "/full/path/to/octave", obviously replacing /full/path/to/ with the actual full path you noted earlier.
Save the file, and you should be all set. Tools -> SublimeREPL -> Octave should now open up an interactive session, just like running octave -i on the command line would do. You can use all of the usual SublimeREPL shortcuts to send code to the running REPL, or just use if for testing functions, code snippets, etc.
Have fun!

I am using Sublime Text 3 on OS X
Octave programs are running perfectly. So you can try the below mentioned steps
Open Sublime
Goto Tools --> Build System --> New Build System...
Paste this code
{
"cmd": ["/usr/local/octave/3.8.0/bin/octave-3.8.0", "$file"],
"selector": "source.m"
}
Save it as Octave.sublime-build
Now use Octave as your build system
Use ⌘ + B to run your code.
Enjoy!

Related

How to run a program from Files, coded using MonoDevelop, Gtk#, Ubuntu

I wrote my HelloWorld.cs using MonoDevelop, and Gtk# 2.0. It runs fine in the debugger, and it builds HelloWorld.exe. When I run from a terminal window "mono ./HelloWorld.exe" then the program runs as expected so I know it is coded as expected. However when I attempt to run it by double clicking on it from Files (Linux version of Windows Explorer) it opens Archive Manager with an error "An error occurred while loading the archive".
I am using Ubuntu 18.04.02 LTS, if that makes a difference.
I tried creating a link "ln -s ./HelloWorld.exe ./meow", and double clicked on meow, however that also opens Archive Manager with the same error.
I don't want my end product to require the user to open a Terminal window to run my program, what do I do so that the user can double click on my program from Files to run?
EDIT: [18FEB2019]
Thanks Some programmer dude, I like the bundle idea as I may port this project to a different flavor of linux and I hope this gives me a path to get there.
However, I got error:
Failure to load i18n assemblies, the following directories were searched for the assemblies:
Path: .
In Custom mode, you need to provide the directory to lookup assemblies from using -L
ERROR: Couldn't load one or more of the i18n assemblies: Failed to load I18N.dll
I searched and found
https://www.mono-project.com/docs/tools+libraries/tools/mkbundle/
I followed those directions and got stuck at this part
mkbundle -o CacheServer --cross mono-5.8.0-ubuntu-16.04-x64 CacheServer.exe --machine-config /etc/mono/4.5/machine.config
my error is
ERROR: Unable to load assembly `gtk-sharp' referenced by `/home/amccombs/Projects/HelloWorld/HelloWorld/bin/Debug/HelloWorld.exe'
I tried
mkbundle --fetch-target gtk-sharp
with result
Failure to download the specified runtime from https://download.mono-project.com/runtimes/raw/gtk-sharp
I then tried
sudo apt-get install gtk-sharp
with result
E: Unable to locate package gtk-sharp
Files is detecting the .exe extension as an archive, and therefore it opens it with File Roller or similar.
Just right-click the file HelloWorld.exe and select "Open With Other Application", click on "Find New Applications", and then type "mono" and press ENTER. The app will open.
Another possibility is to create a .desktopfile, and place it under ~/.local/share/applications, with this contents:
[Desktop Entry]
Exec=mono %F
MimeType=application/x-ms-dos-executable;
Name=mono
NoDisplay=true
Type=Application
MKBundle creates a native app from a mono application. The downside is that you have to compile both the app and all its dependencies, which can be tricky. In any case, the package you are looking for is gtk-sharp2.
An alternative to MKBundle is to include a text file, say HelloWorld.sh with the contents:
mono HelloWorld.exe
And then make it executable with:
chmod +x HelloWorld.sh
You can then pack both files together (use a .tar.gz target, which preserves attributes such as the executable one), and probably with a README file explaining to double-click HelloWorld.sh.
Or maybe you can pack the .exe with the .desktop file, and explain in the README file where it must be placed.
There are tons of possibilities.

Texture Packer won't run

I downloaded texture packer here https://code.google.com/p/libgdx-texturepacker-gui/downloads/detail?name=gdx-texturepacker-3.2.0.zip&can=2&q=
When I run the .jar file it just shuts down before even displaying the gui. Is anyone experiencing a similar problem? I am running OSX El Capitan.
The project is quite old so you can try it's successor: gdx-texture-packer-gui.
[The] project is a successor of Aurelien Ribon's project with whole new
GUI and features.
You can download the tool here:
https://github.com/crashinvaders/gdx-texture-packer-gui/releases
Do you have the Java runtime environment installed on your computer or just the Java development kit? I don't use the texture packer, but I had a similar problem with the Android SDK manager (it shut down before displaying the GUI) on a new computer where I had only installed the Java JDK. After installing the JRE then it worked fine.
Try this: Create a txt file and change its extension to ".bat". Right click to file and select modify. Copy this into file:
"java -jar "C:\Users\fat2019\Desktop\gdx-texturepacker-3.2.0\gdx-texturepacker.jar" Change path to your own where gdx-texturepacker.jar file is. Then save and close. Double click file.
edit: this is for windows.
I have the same problem. Using Windows 7 I have to do this:
Go to your java directory and copy your java path
C:\Program Files\Java\jdk1.8.0_40\bin
Right click on my computer,
Click properties
Go to "Advanced system settings" click ,
Click on Environment variables.
Go to System variables section, and you will find an entry called path.
Double click on path
Add a semicolon (;) to the end of that line
After the semicolon paste your path previously copied: C:\Program Files\Java\jdk1.8.0_40\bin
Apply
It must be enough. Your file should run at this point.
Double click it and go to the end, put a semicolon and paste your path, apply and ok. It should run now.
For Mac I downloaded the free version of https://www.codeandweb.com/texturepacker/download
This saves as .txt rather than .atlas for some reason.
After adding the animation I got errors in batch.draw ... casting to TextureRegion fixed that.
As always, I have no idea if this will cause problems later but there you go. Looks good so far. :)

How do I extend the $PATH that Sublime Text 2 uses?

I just installed Sublime-jshint (and the requisite node.js + jshint) but get this error when I try to invoke JSHint from within ST2:
[Errno 2] No such file or directory
[cmd: [u'jshint', u'PATH-TO-THE-JS-FILE-I-AM-LINTING', u'--reporter', u'/home/cmg/.config/sublime-text-2/Packages/JSHint/reporter.js']]
[dir: DIR-MY-JS-FILE-IS-IN]
[path: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/cmg/bin]
[Finished]
The final item in the given path is in the home dir of my user (cmg), so it's been customized somehow... but I don't recall how, so I don't know how to add the dir I need (~/node_modules/.bin).
I've added it to $PATH in my shell (via both .bashrc and .bash_profile) but ST2 doesn't pick it up.
(I'm on Ubuntu 14.04. All the usable stuff I've found via Google on this subject has been either OS X specific or related to ST's build system).
Basically, the exec command, which the jshint package uses internally, allows you to set/extend the PATH of the spawned subprocess. (docs)
The package actually uses this path argument on OSX, but has it hardcoded (I am partly guilty of that as I rewrote the command because it was just horrible before). It should allow for a setting to specify the path to your jshint executable, so I suggest you create an issue for that.
I don't know why ST dosn't pick up your PATH from somewhere else since I have very little experience with that.
Open /etc/profile in Sublime (using sudo) and add the following line at the very bottom:
export PATH=/home/cmg/node_modules/.bin:$PATH
and save the file. Restart completely, and your PATH should be updated.

Sublime Text 2 and bin paths

If I print my $PATH in a terminal (zsh) I get:
λ echo $PATH
/Users/jviotti/.nvm/v0.11.13/bin:/Users/jviotti/bin/Sencha/Cmd/4.0.2.67:/usr/sbin:/usr/local/bin:/usr/local/sbin:/sbin:/opt/bin:/Users/jviotti/bin:/home/jviotti/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin
However if I print the environment variables from Sublime Text 2 console I only get:
>>> print(os.environ['PATH'])
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/jviotti/bin
Sublime Text 2 detects that I'm using Zsh, however most of my paths are missing.
How can I fix this?
When you launch Sublime via the command line with the subl command, it picks up your current PATH from your shell. However, files launched from the GUI have a separate PATH, and this is what needs to be changed. Please check out my answer over at Unix.SE for detailed instructions on how to set the PATH for OS X programs launched via the Dock or Finder. This has only been tested on Mountain Lion (there is a different method for Lion), and while it should work on Mavericks I can't guarantee it. It does require having admin privileges.
Briefly, you need to edit /etc/launchd.conf (or create it if it doesn't exist) to include all the entries you want, then restart your computer for the changes to take effect. Keep in mind that this will affect all GUI programs, not just Sublime, so if you start getting unexplained behavior or errors, this may be the reason.
Good luck!

Sublime Text not finding gcc compiler

I'm trying to run Make from Sublime Text 2, but getting an error:
make: arm-none-eabi-gcc: No such file or directory
This only happens from Sublime Text, when I run from Terminal, everything works fine.
I've setup .bash_profile with
export PATH="~/arm-cs-tools/bin:$PATH"
...but still no can do? How can i get ST to resolve the $PATH environment variable?
From unofficial Sublime Documentation:
On some operating systems, the value for PATH will vary from a
terminal window to a graphical application. Thus, even if the command
you are using in your build system works in the command line, it may
not work from Sublime Text. This is due to user profiles in shells.
To solve this issue, make sure you set the desired PATH so that graphical applications such as Sublime Text can find it. See the links below for more information.
Alternatively, you can use the path element in .sublime-build files to override the PATH > used to locate the executable specified in
cmd. This new value for PATH will only be in effect for as long as
your build system is running. After that, the old PATH will be
restored.
Note that while this documentation is for v1 and is deprecated, the official documentation references this passage directly here
So you should be able to define a custom path in the .sublime-build file. using the path option