Julia Standalone program interacting in a terminal or Console - terminal

I begin to learn Julia on Windows and I would like to write and compile standalone executable programs working in a Console or Terminal. How may I do that ?
I have installed on Windows Julia 1.0 which works as an evaluation loop in a terminal.

Related

How to launch exe from PyCharm Terminal?

I'm trying to launch Blender directly from PyCharm Terminal on Windows. I first use cd 'C:\Program Files\Blender Foundation\Blender 3.1\' to get into the directory containing the executable I need, and this works okay. Then I call blender.exe and expect it to launch Blender executable from the directory I am currently in. But for some reason it launches the older (2.93) version from another folder. The same steps work just right when I do all the same in the Windows cmd.exe. I've thought that the problem could be with the Python interpreter, but I use Python interpreter that goes with Blender 3.1 in the PyCharm project settings. What am I doing wrong and how can I run the exact executable I need?
P.S. I know that I can write a simple script in Python, use subprocess module, and get almost the same result, but anyway I'd like to use the launch from the Terminal if it is possible.

Executing fortran script with single line from Windows cmd

I need to run a fortran (77) script from the Windows 10 command window, but it should be a one-liner. The reason is that the fortran scipt - a file called external_command.f - is actually part of a Matlab script, where I can run external code through the operating system's command window (by using the ! "bang" symbol or system()-command. I quickly want to point that out without focusing too much on Matlab). But I'm having trouble doing that in Windows.
So far I tried:
using a fortran compiler for Windows, like Msys2 (which has the functions of gfortran, as far as I understand). However, it looks like I have to start Msys2 first, which then opens a separate window, which Matlab doesn't seem to be able to use because it's not Windows cmd anymore
installing gfortran in Ubuntu using Windows 10's WSL (Windows Subsystem for Linux). Same problem here: the cmd window changes to a Ubuntu terminal before I can use any fortran scripts. Furthermore, I can't easily change files located in Windows with commands from within a virtual machine
If it's not possible to run fortran scripts in Windows 10 in a one cmd line, I'd appreciate some guidance on how to change my approach.
EDIT: after Ronald kindly explained in a comment how fortran works I think this whole (rather complicated) question is just based on my own misunderstanding of fortran. I'm pretty sure I can now solve the issue after compiling my fortran code and using the resulting exe file in my cmd-window.

How can I use Python to interact with the Ubuntu terminal for windows 10?

I am running compiled c code on the Ubuntu subsystem for Windows. I would like to automate this process with a Python script that can open the terminal, send and read commands as well as closing the window.
I am trying this on Python 3.6 in Windows 10. I thought it was going to be the same as interfacing Python with the CMD but all the things I try are not yielding results. I want to know if anyone has tried to automate processes with the Ubuntu subsystem for Windows and how can that be achieved.
First, I had to find the .exe that launches the Ubuntu app, since it's downloaded from the microsoft store.
Using OS simply gives me the following result without opening the terminal.
import os
os.system(r"C:\Program Files\WindowsApps\CanonicalGroupLimited.UbuntuonWindows_1804.2019.521.0_x64__79rhkp1fndgsc\Ubuntu.exe")
1
Also using subprocess will open the terminal. But parting from there, how can I give it commands and read the outputs?
import subprocess
subprocess.Popen([r"C:\Program Files\WindowsApps\CanonicalGroupLimited.UbuntuonWindows_1804.2019.521.0_x64__79rhkp1fndgsc\Ubuntu.exe"])
I think there's a few things worth mentioning here.
Firstly, I don't think you need to use Python at all. If you want to schedule your compiled C code to run at a particular time (or linked to some other condition etc.), you can do all of this within WSL. I would suggest using cron which already comes with Ubuntu. It's a scheduling daemon that can execute tasks at specified intervals.
Secondly, if you want or need to use Python to achieve this (for whatever reason), I suggest you install a second version of Python within WSL. This will allow you to easily run whatever shell commands you want e.g. to execute your compiled C code. You don't need to worry about opening an Ubuntu window and then closing it etc. Personally I would actually go further and say that you should ditch your Windows 10 Python and just go with the WSL Python - it makes a lot of things much easier, especially if you're already familiar with Linux or are using WSL a lot for other tasks anyway.
Lastly, if you still really need to automate this from Windows 10, I suggest you use the Windows Task Scheduler to schedule a .bat file which opens bash (WSL) and executes a command as per the following link:
How to run program on ( ubuntu bash windows 10 ) from windows task scheduler
(or if you don't need to schedule it, you can instead just execute the command from Python)
Hope that helps!

Haskell SDL app on macOS doesn't recognize keyboard/mouse when run with runhaskell

I'm running into a weird problem when running sdl-apps under macOS. Compiled apps run fine, but when i try to run the same code with runhaskell (or more specifically stack runghc) a window opens with no title bar and doesn't react to mouse or keyboard input. Doing the same under Windows or Linux works fine though.
Is there anything like a command line argument or something that i can do about that or do i just have to live with this?
SDL system librarys were installed via homebrew and the haskell libs via stack lts-8.3

Using Ruby's popen3 or equivalent on Windows

I'm making a Vim plugin that uses Open3.popen3 to run a shell command, and I need the result and exit code. It works fine on Linux, but freezes on Windows. I've checked on pry under Windows and whenever I run Open3.popen3 or Process.spawn the shell just freezes. I've tried to install the win32-open3-19 gem(and load it with require 'win32/open3) - but it still freezes.
Is there any other method or gem I can use? I prefer something as close as possible to Open3(so my Linux and Windows versions can share as much code as possible).
I'm running Ruby 1.9.3 installed via RubyInstaller on Windows 7 64bit.
MORE DETAILS:
This is the exact code I want to run: https://github.com/someboddy/vim-erroneous/blob/master/autoload/erroneous.rb#L43
It works on Linux but freezes on Windows.
On my Windows, I open pry and then write:
require 'win32/open3'
inp,out,err,wait_thr=Open3.popen3('cmd')
And my shell freezes. When I try it on Linux(using 'bash' instead of 'cmd') it works just fine. I've also tried 'dir'(which shouldn't wait for user input) and it also froze.

Resources