How to get code from editor into console in Sublime? - console

Ok this is a pretty simple question. I am new to Python and have been using JES up to this point. I just downloaded Sublime 2 and love it. But in JES there was a command that would open your code in the editor in the command console (load program). I know how to open the command console (ctrl `), but is there a way other than copying and pasting to get the code into the command console?

The Ctrl` console in ST2 uses the internal version of Python that comes with the program, Python 2.6, not the system version(s) you may have installed yourself. It's fine for some stuff, but it is outdated, and there is no (easy/intended) way to install third-party modules.
SublimeREPL is what you need. It supports Python 2 and 3 (including IPython), as well as a bunch of other languages if you're a polyglot. It basically runs a Python interpreter in another tab, which you can interact with directly, just like at the command line or via IDLE, and you can also send selected text, files, lines, or blocks (functions/classes) to the running REPL. It is available through Package Control, which you should install anyway, if you haven't come across it yet.
If up to this point you've just used JES and haven't installed a version of Python from python.org then you'll want to do that before installing SublimeREPL.

Related

Downloading R on Linux for multiple clients

I've created a program that runs in R that I plan on distributing among a lot of other people. Currently the R script is ran completely automatically and behind the scenes with one .sh script which is exactly how it is intended to be. I'm trying to make it so theres no need for client intervention. The R script itself loads the packages and installs them if they aren't present which takes away the task of them installing the packages themselves.
Is there a way I can provide a folder within my Application's folder that they already download that contains R-script and its dependencies so the code can use that location of Rscript to compile and run the R-program I have created. The goal is to be able to download it and run without the need of internet connection to download R and maybe even the programs required packages if possible.
Any help or ideas is appreciated.
I assume that process you want called "creating binary package". Binary is programs (like EXE files) which can run directly on target CPU without any interpreter software (like Python interpreter for python scripts, or Java VM for java applications). I'm not so familiar with packaging of R programs but I found some materials regarding this issue:
1 - Building binary package R
2 - https://seandavi.github.io/post/build-linux-r-binary-packages/
3 - https://support.rstudio.com/hc/en-us/articles/200486508-Building-Testing-and-Distributing-Packages
Second link assumes Linux as target system. Opposite to interpreted languages, binary files often OS dependent (Linux, Windows, or Mac). I, personally, don't know how compatible are packages between Linux systems with different library sets.
Please comment if you find some information misleading, I'll correct the answer.

How to install pkg to julia without console

Start to learn Julia recently. And do not want to use console ever.
How can I install a new package from IDE, with no use of console commands? I'm using Juno, but I'm opened to change IDE if Juno does not support such a feature. Than the question is - what IDE does?
You can evaluate commands from a script. Just type Pkg.add into a script and Ctrl+Enter on it. But I don't think avoiding the console entirely is a good way to program though!
Write a script
Pkg.add("Distributions")
and run it.

Console isn't showing up when running print() using LOVE2d with atom-editor

Using atom-editor 1.13 with the love-ide package installed to run LOVE2d 10.2 games (windows 7)
Apparently if you create a conf.lua file in the same folder as your main.lua file you can add some configuations to main.lua. So, I've got these lines of code in my conf.lua to show console.
function love.conf(t)
t.console = true
end
But when I go back to my main.lua and type print("ballz"), all I see is a blank LOVE2d game screen with no extra console window. Not really sure if this is because I'm using atom editor or not. Everything seems to be PATH'ed correctly.
On a side note, whenever I run atom using the love-ide package it always tries to install some "dependecy files" like the hyperclick-love package, and the auto-complete-love package. These fail to install because I don't have git installed.. honestly I really don't know what git is, but neither it, hyperclick, or auto-complete seemed like requirements to run my game, so in the spirit of not installing unnecessary things onto my computer I never installed these things... annoying as it is to see this notification always pop up when I start atom. Anyone know if this is contributing to the issue, or know a way to remove these notifications or auto-download-attempts? My LOVE2d code still seems to run without these packages.
Have you set up the terminal emulator in your configuration?
(Windows only) Try using the lovec.exe executable instead of the normal love.exe. The first one attaches to the console that executed the game, the second one ignores it.
Lua has a buffered output, try adding io.stdout:setvbuf('no') to the top of main.lua

Julia's execution using Juno gets blocked because of not being able to access the console

In another question:
Juno IDE for Julia, how to interact?
One of the answers stated:
You can't enter commands into the console in Juno--that's for displaying output. Commands can be submitted from within the editor by setting your cursor in the line to submit and pressing Ctrl+Enter or Shift+Enter. The value will then be displayed in a small popup next to the line and the output will be printed to the console if you have the console visible.
Note that the inability to use the console as you desire is by design. See here for information about the console from the Juno docs.
I am encountering an issue that might make this design decision a bit impractical at times.
First, let me say that I am new to Julia and Juno (not to coding, just trying to learn Julia now), so there might be a way to fix this and I do not know about it.
I am using the package RCall, that allows to include R code into Julia, so I am trying to install some R packages. One of the packages is asking me a "y/n:" question and I cannot answer it because I cannot access the console, and sending code from the editor to the console using command+Enter is blocked (because the console line is executing).
To reproduce this issue (note that R 3.2.0 or above needs to be installed, and I had to restart Juno after installing RCall for it to work):
Pkg.add("RCall")
Pkg.build("RCall")
restart Juno
using RCall
reval("install.packages(\"rgdal\")")
A pop-up will appear asking to select a mirror, just choose 0 and OK. Then the package is asking me if I want to install some dependencies "y/n:" and the whole execution is blocked.
I guess that this can be fixed just by using Julia from the command line (and forgetting about Juno), but I like to use IDEs.
Do you have any ideas about how to circumvent this issue? or another IDE for Julia?

Is there a library for Visual C++ that renders math formulas?

I've been looking all over, but I can't find anything free that will let me simply display math formulas on a window. I found one for Visual C++.net, but no APIs. Are there any out there?
What format are the Math formulas in?
My first impulse would be to try and find a LaTeX library for C++ which will let you render out LaTeX to an image. That way you could display most basic formulas, but the formulas would have to be in the LaTeX format.
Try ReforMath (http://reformath.webnode.com). Runs under both Windows and Linux. It is unfinished though, but can render a number of elements.
What a great question! Yes, there is now: latexpp.
You'll have to install VS 2017 Community first with the minimal amount of C++ features checked (so it doesn't take all day).
Then you install Boost using the binary (try the latest).
But you still have to build boost. By using the VS > Tools > Visual Studio Command Prompt. CD to your boost directory and run .\bootstrap.bat, then .\bjam.exe. This will take all day.
Good news is it seems to be working so far on Windows 7, 64-bit with VS 2017 community and the latest boost 1.6.x.
The Latex library has other requirements, and I still haven't tried it but will post my notes here if any hickups.
Make sure all your directories are short, such as C:\VisualStudio2017. However, boost will then fail if you use your regular windows command prompt unless you do the vcvarsall.bat trick. The VS Command Prompt does that for you, so that boost can find your MSVC stuff. Boost would still probably fail if you used the default directory and didn't use the VS command prompt.
So, again, my boost is in C:\boost_{blah version} which you should shorten to C:\boost assuming you'll only use one version of boost.
One reason is that if you have to add the respective /bin directories to your system Path, then you won't fail by maxing out the length of Path value (yes, it has a max length). Also stuff is easy to find and especially from the command line so you can cd quickly there. If you don't want everything in C:\ then make a C:\__TOOLS or something short.
I will post my notes here when I've gotten LaTeX rendered.
Notes
When building boost with bjam, if it seemingly hangs for more than 10 mins on one item, then hit ctrl-C at the command line once. This seems to unhang it without canceling the install.
TODO

Resources