Windows Subsystem for Linux DISPLAY variable setup - windows-subsystem-for-linux

I'm experimenting with Windows Subsystem for Linux and am trying to create python plots using Matplotlib. But i get the following error
RuntimeError: Invalid DISPLAY variable
echo DISPLAY shows nothing. How can I setup the DISPLAY variable?

The Windows Subsystem for Linux doesn’t officially support graphical GNU/Linux desktop applications, so we have no guarantee that the calls made by our graphical program of choice will be implemented as windows system calls.
The main issue you are running into is the lack of a graphical interface to these programs, called an "X-server". We can try to get around this problem by:
Installing an X-server (Such as Xming).
Telling the Windows Subsystem for Linux to use this X-server as the DISPLAY by setting the environment variable.
For (1), to install Xming, you can just download and accept the default settings, it will automatically launch and wait for graphical programs to display.
To address (2), before you run your graphical program, run:
export DISPLAY=:0
so that bash knows where to send the graphical output of the program you're running.
Then you can try running a simple graphical program (for example gvim or python's turtle module).
Again, there is no guarantee that this will work for all GNU/Linux applications, since Microsoft has not translated every Linux system call to a Windows system call, and if the graphical program you're running makes such an unsupported call, your program may just crash.
Most of these instructions were taken from the following guide which shows how to get gvim working on Windows Subsystem for Linux:
http://www.howtogeek.com/261575/how-to-run-graphical-linux-desktop-applications-from-windows-10s-bash-shell/
Edit: Since you also asked about checking what's in DISPLAY, I'm adding that you can check the value of the DISPLAY variable by running:
echo $DISPLAY
(The $ ensures that bash interprets what follows as a variable, rather than a string literal. Running echo DISPLAY will just echo the string DISPLAY.)

Related

How to type in the Windows Ubuntu terminal while a windows exe is processing?

Typically in most terminals I've worked with (for instance, powershell or OSX's built-in "terminal") if you start typing your next command while the previous is still running, the terminal will receive your keyboard inputs and insert them anyway.
With the windows ubuntu terminal, all my keystrokes while the current command is running are lost.
This seems to only happen when I run a windows exe through the ubuntu terminal.
For example, this suppresses all my keyboard input: "ping.exe windows.com", while using ubuntu's ping does not: "ping windows.com"
Is there a fix to make it so that my keyboard input is not suppressed when running windows tools in the ubuntu terminal? I find this valuable since I often being typing the next command while the previous is still running.

Call scp from VB.net running under Wine on Ubuntu

There are a few question around this subject but nothing that answers my question (at least, nothing that I found).
I have a VB.Net app built on .Net 4.8 that I run under Wine (via CrossOver, in case that matters) on Ubuntu 20.04.
I want to add a feature to this app whereby it calls scp to transfer some files over to another Linux server.
I tried the obvious (assume there are valid parameters here)
System.Diagnostics.Process.Start("scp")
However, this just said there was no app associated.
Is there a way to call to Linux commands from VB.net running under Wine?

install weblogic on VM with Solaris OS

I stuck in install weblogic on my vm solaris. i try that
java -d64 -jar fmw_12.2.1.3.0_wls.jar
and i got an error
Checking monitor: must be configured to display at least 256 colors. DISPLAY environment variable not set. Failed <<<<
Any solution for these error?
This happens if you want to do an graphical install of the system without having a X11 running. The error message is quite normal for such an situation.
You could:
Not running the installer in the graphical mode by doing a silent install (please refer to https://docs.oracle.com/cd/E24329_01/doc.1211/e24492/silent.htm#WLSIG131 for information)
Install the nescessary package to have an X11 and stuff running in your VM with pkg install solaris-desktop. Then execute the java command again from the GUI . This obviously only works if you can get a the graphical output of the VM for example via VNC or other tools.
You could set the DISPLAY variable to an installed X11 implementation. For example i use Xquartz on my Apple notebook. Then configure DISPLAY and XAUTHORITY correctly. Or you could simply log into the Solaris system with ssh -X . I prefer the second one, as it does everything automatically.

What is the best way to remotely edit a file using VS code?

Currently, I have two machines, one with Ubuntu in the company and one with Mac OS at home. Sometimes I would like to work at home while accessing the Ubuntu machine in the company. I can ssh into the Ubuntu machine and navigate and compile there. However, when I actually want to edit some cpp source codes, I realize that the editor (VS code) is actually opened in the Ubuntu machine, so I cannot view it from Mac. What should I do if want to edit files remotely on my Mac through VS code?
Though many of the answers mention using version control tools like git, it can be hard to use in my specific case. The problem is that the building environment of my company is Linux, so most of the building tools I have can only run on Linux. This means that I can only compile my source codes in Linux. If I use git, then every time I want to compile and debug my codes, I have to commit and push with my Mac, and then pull and test on Linux. This can be time consuming if want to incrementally modify, test and debug my codes.
Use some version control system like git. Then you might edit and compile at home (provided your code is portable between Linux & MacOSX, e.g. because it is POSIX compliant).
You could install some X11 server on your Mac and use ssh -X to access the remote Ubuntu machine (then run a GUI or editor remotely, e.g. ssh -X remotelinuxhost.company.com emacs). However, that requires good bandwidth and latency between your home computer and the remote one.
BTW, you might use some other source code editor, like emacs (it is capable of remote editing) or vim.
Since Linux and MacOSX are both POSIX systems, it is usually (but not always) easy to port source code from Linux to MacOSX and write source code compilable on both systems. BTW, many Linux frameworks (e.g. Qt, GTK, POCO, Boost, etc...) and build systems are usable and ported to MacOSX. Some Linux system calls (listed in syscalls(2)) are not available on MacOSX (e.g. signalfd(2)...)
Of course you could install Linux (perhaps inside some VM) on your Apple laptop.

Problems with Octave on Windows 8: crashes after any error

I have installed (and re-installed) Octave 3 times on Windows 8, and I still can't get it right. The first and most obvious problem is that the prompt is missing; the screen only shows the flashing underscore that follows the prompt. This is not a major problem since the system properly responds to commands.
The major problem is that Octave crashes whenever it encounters a syntax error, instead of politely giving a diagnostic. This makes for extremely tedious software development.
Is there a way around this problem, or do we just have to wait for one side or the other to come up with an accommodation?
I encountered the same problem. I solved it by this:
create a shortcut to octave.exe, then right click->property-> change the "target" to something like:
C:\Program Files\Octave\Octave3.6.*_gcc*.*.*\bin\octave.exe -i --line-editing
Then it won't exit if u have syntax errors.
I don't understand the meaning of the parameters yet.
reference:
http://exciton.eo.yzu.edu.tw/~lab/?p=1121
Type octave --help can check the meaning of parameters.
-i also --interactvie, to force Octave interactive behavior.
Maybe Octave run at non-interactive mode at default, that means prompt should not be shown and it should terminate immediately when encountered error when reading a file.
I don't know if this will solve your problem, or if this is too bloated of a solution for you, but I use Octave on Windows 7 through Cygwin without any problems.
If you can't get Octave to run on Windows 8, you may consider running Octave through Linux via computer virtualization technology (virtual computer). Two, off the top of my head that you could use are VirtualBox by Oracle or VMWare Player
Once you have it installed, you can go to any number of sites that have pre-built Linux images that you can download and then run inside of Windows 8.X. Do a Google search of for 'Virtualbox images' or as 'VMWare appliances'. You can then download and use that to run the lastest version of Octave. I hope that helps.
Cheers,