How to enable x11 forwarding in vscode integrated terminal? - qt

X11 forwarding working fine in ubuntu's terminal. but if I try to run any GUI from a remote in my VSCode terminal, it shows : cannot connect to X server.
Any suggestions?

I found a solution using the menubar run and run without debugging option.
Just we need to configure the launch.json file and open a terminal from the client pc with this command ssh -Y -i ~/.ssh/Key.pem username#server.
In my case launch.json looks like this:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"args": ["--target", "dataset", "--output", "dataset_softmax", "--nChannel", "32", "--minLabels", "8", "--filetype", "png"],
"console": "integratedTerminal",
"env": {
"DISPLAY": "localhost:10.0"
},
}
]
}

Related

AWS Serverless how to use "sam local start-api" to debug .net core 3.1 applications

I would like to start serverless application locally and then debug it using Visual Studio. I see command line arguments --debug-port, --debugger-path, --debug-args and --debug-function, but no example of how these can be used for .net core.
This is what I'm using for Visual Studio Code. I'm on Windows using dotnetcore3.1.
Firstly, I had to download the Linux vsdbg debug files (yes, Linux, as these files will be mounted in the SAM docker container)
https://vsdebugger.azureedge.net/vsdbg-17-0-10712-2/vsdbg-linux-x64.tar.gz
Unzip them into a folder, e.g. C:\vsdbg
I have a task to launch SAM. My tasks.json looks like:
{
"version": "2.0.0",
"tasks": [{
"label": "sam local api",
"type": "shell",
"command": "sam",
"args": [
"local",
"start-api",
"-d", "5858",
"--template", "${workspaceFolder}/template.yaml",
"--debugger-path", "C:\\vsdbg",
"--warm-containers", "EAGER"
],
}]
}
IMPORTANT:
** --debugger-path points to the linux debug files folder. the sam cli will mount the files for you.
** I had to use --warm-containers EAGER to keep the container from closing after every request
launch.json looks like this:
{
"name": "sam local api attach",
"type": "coreclr",
"processName": "dotnet",
"request": "attach",
"pipeTransport": {
"pipeCwd": "${workspaceFolder}",
"pipeProgram": "powershell",
"pipeArgs": [
"-c",
"docker exec -i $(docker ps -q -f publish=5858) ${debuggerCommand}"
],
"debuggerPath": "/tmp/lambci_debug_files/vsdbg",
"quoteArgs": false
},
"sourceFileMap": {
"/var/task": "${workspaceFolder}"
}
},
This bit: $(docker ps -q -f publish=5858) gets the id of your docker container by filtering on the port that you're using.
This took quite a bit of fiddling to get working, I'm surprised it's not easier or at least some decent documentation on it.

MSBUILD : error MSB1008: Only one project can be specified. Switch: Release

I am trying to publish my code onto a linux server by using
dotnet publish –-configuration Release
in the terminal command line. This should create a folder in bin/release/publish with all of the files ready to be deployed onto the server.
however, I get an error message which says
"MSBUILD : error MSB1008: Only one project can be specified. Switch: Release" and nothing gets published to the bin folder.
I have created a settings.json folder in the vscode folder
{
"deploy.reloaded": {
"packages": [
{
"name": "Version 1.0.0",
"description": "Package version 1.0.0",
"files": [
"Schedule.API/bin/Release/netcoreapp3.0/publish/**"
]
}
],
"targets": [
{
"type": "sftp",
"name": "Linux",
"description": "SFTP folder",
"host": "192.168.0.152", "port": 22,
"user": "webuser", "password": "password",
"dir": "/var/www/schedule",
"mappings": {
"Schedule.API/bin/Release/netcoreapp3.0/publish/**": "/"
}
}
]
}
}
You seem to have a copy/paste error in the first dash here:
dotnet publish –-configuration Release
The first dash is – (U+2013 : EN DASH). It should be a plain dash - (U+002D : HYPHEN-MINUS), like the second one. This should work:
dotnet publish --configuration Release

Issue using VSCode tasks with dotnet run

I have two projects in a parent folder:
parentFolder
| webApiFolder
| testsFolder
Using the terminal, I need to pass the --project parameter to dotnet run. As such, I figure it'd be easier to just create a task and run the task instead. However, I can't get the task to work.
Task:
{
"label": "run api",
"command": "dotnet",
"type": "process",
"args": [
"run",
"--project ${workspaceFolder}\\WebApi\\mercury-ms-auth.csproj"
],
"problemMatcher": "$msCompile"
}
Output:
> Executing task: C:\Program Files\dotnet\dotnet.exe run --project G:\Git_CS\mercury-ms-auth\WebApi\mercury-ms-auth.csproj <
Couldn't find a project to run. Ensure a project exists in g:\Git_CS\mercury-ms-auth, or pass the path to the project using --project.
The terminal process terminated with exit code: 1
However, if I run dotnet run --project G:\Git_CS\mercury-ms-auth\WebApi\mercury-ms-auth.csproj, that launches the project perfectly.
Similarly, my test and code coverage task works perfectly:
{
"label": "test with code coverage",
"command": "dotnet",
"type": "process",
"args": [
"test",
"${workspaceFolder}/Tests/Tests.csproj",
"/p:CollectCoverage=true",
"/p:CoverletOutputFormat=cobertura"
],
"problemMatcher": "$msCompile"
}
One solution is to "type": "shell" and pass through the whole command.
{
"label": "run api",
"command": "dotnet run --project ${workspaceFolder}\\WebApi",
"type": "shell",
"problemMatcher": "$msCompile"
}

How to debug a Deno Typescript code on Windows 10, x64

I 'm trying to debug a Deno project, but I dont know, how to debug this on Windows 10 using the lldb debugger as the documentation says.
The LLDB, on windows 10 seems to be not so easy to install.
///reference path="../../deno.d.ts"
import * as deno from 'deno';
import { color } from 'https://deno.land/x/colors/main.ts';
const s = new Set();
[*] s.add('test')
console.log(s);
[*] <-- a breakpoint
In order to debug with Deno:
Add somewhere in your code a debugger; line of code.
Run with --inspect-brk flag. deno run --inspect-brk ... or deno test --inspect-brk ... to debug tests.
Open chrome://inspect page on Chrome.
On the Remote Target section press to "inspect".
Press the Resume script execution button, the code will pause just in your breakpoint.
Reference: https://aralroca.com/blog/learn-deno-chat-app#debugging
If you use VSCode here is a launch.json I am using.
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Deno",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "deno",
"runtimeArgs": ["run", "-A", "--inspect-brk", "index.ts"],
"port": 9229
}
]
}

My sqlite3 rebuild generates the electron-v1.4-win32-x64 and require asks for electron-v1.4-win32-ia32 . Does any have idea?

This are the snap of the app and the snap of the compiled node file
I got the solution.
We are getting wrong build because we are using the 32bit version of nodejs in 64bit arch.
You can verify the arch of your nodejs by using the process.
c:\> node
> process
Search for target_arch
If there written 32 than goto the nodejs.org and download the 64bit installer of the nodejs.
Step to follow
Remove the node_modules folder
Open command prompt (run as admin)
Check the node process arch type is x64 shown in image.
run npm install
My package.json file
{
"name": "sqlite",
"version": "1.0.0",
"description": "This is the tutorial for the sqllite",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "electron .",
"rebuild": "electron-rebuild -f -w sqlite3"
},
"author": "",
"license": "ISC",
"dependencies": {
"electron-prebuilt": "^1.4.13",
"sqlite3": "^3.1.8"
},
"devDependencies": {
"electron-rebuild": "^1.5.10"
}
}

Resources