How can I use Bumblebee and QtCreator together? - linux

How can I use Bumblebee and QtCreator together without starting QtCreator in Bumblebee?
For those who don't know what bumblebee is:
It is an unoffical version of Nvidia Optimus in Linux. It allows you to activate your dGPU only when you need it. But if you are a graphics programmer you probably want to create your OpenGL context with your dGPU.

1.) Create your project.
2.) Go to your project debug folder, in my example /home/maik/untitled-build-Desktop_Qt_5_0_1_GCC_64bit-Debug
3.) create a new file. Call it optimus.sh
4.) Open optimus.sh and write the following -> optirun ./untitled
Note that untitled is just name of your executable in your debug folder, in my case it is "untitled"
5.) Go to QtCreator -> Projects -> Build & Run -> Select your kit that you want to use -> Go to Run -> Under 'Run' click on 'Add' -> Custom executable -> Under 'Command' , select your optirun.sh file -> Turn on Run in Teminal .
Now every time you click run in QtCreator, your executable will be started with optirun. Now your dGPU only gets activated if you run your application, instead of being activated the entire time.

The other answer worked, but I feel like my way is cleaner:
In Qt Creator, go to the Projects tab.
Go to Build & Run -> [your kit] -> Run.
On the right hand side, under Run, click to add a Custom executable.
In Executable fill in /usr/bin/optirun (or whatever output which optirun gives).
In Command line arguments fill in ./foobar if your executable is named foobar and resides in the build directory.
Keep Working directory as %{buildDir}.

Related

Failed to run '/usr/local/go/bin/go env. The config change may not be applied correctly

Whenever i try save a go file inside vc code i get this pop up Failed to run '/usr/local/go/bin/go env. The config change may not be applied correctly. . Also there is any no go intelliSense, code navigation, and code editing support.
I guess, you are using go modules and have go.mod file inside project directory. In this case, inside VsCode, go to preferences. Under extensions, select Go. Untick checkbox labelled "Infer GOPATH from the workspace root." for both "User" and "Workspace".
Close all terminal and VsCode instance, and restart VsCode. It should no longer display the error, and prompt message to install Go Tools. Else you can manually install go tools from VsCode (pressing crtl/cmd + shift + P), which will bring back intellisense and linting.
In case you are using Mac OS and installed Go via homebrew add
"go.goroot": "/opt/homebrew/opt/go/libexec"
To your settings.json file. The path may be different. Check it via export GOROOT="$(brew --prefix golang)/libexec".
Also see install go on mac
I have solved this issue. The solution is that, create a new Golang project and move all the required logic files from older project to newer project and it will work. The problem is with .mod and .sum files. It is a older project that i have created on my other laptop that has Ubuntu based Feren OS. When I moved this project to my newer laptop that has Ubuntu based Zorin OS. It creates problem. So after trying lots of solution, I just created a new Golang project and moves all the required files and it works.

"npm" is not recognized

So, I am trying to use command prompt for something. But it isn't working.
The steps were, get Node.js. Download a dropbox file of what I need. Copy the path thing that I use to get to the file in File Explorer.
Turn on Command Prompt type in "cd C:\Users\Evan\Desktop\GoAniFire-master_10.zip" and it worked.
I have Node installed, but then when i type in "npm install" after i hit enter on the last step. Nothing besides a error saying "npm isn't recognized" pops up, I have no idea what to do as I am new to Node.js and only recently started using command prompt. ;-;'
-Nate
If you installed Node from the official site, you should already have the Node Package Manager. You're likely receiving this error because Node isn't in your Path, so your command prompt doesn't know what it's looking for.
Open Control Panel -> System and Security -> System -> Advanced System Settings -> Environment Variables
In "User variables" or "System variables" find the variable Path. (If it doesn't exist, create it.)
Add your node.js folder path at the end of the variable value, beginning with a semicolon separating it from previous values. e.g. ;C:\Program Files\nodejs
Restart your command prompt.
This should work.
Make sure you installed node. Try restarting your computer first. If that doesn't work follow what user Elo wrote.
Open Control Panel -> System and Security -> System -> Advanced
System Settings -> Environment Variables
In User variables find variable PATH and add path to nodejs. Usually
-> C:\Program Files\nodejs;. If variable doesn't exists, create it.
Restart PC and IDE.
If you're using VSCode, close old terminal and open a new one. Even
when I did everything VSCode could not see node + npm, because old
terminal was broken.

How to configure Atom script to run main.py

I recently started used Atom IDE. It feels good. The only thing that I find difficult is to setup a project profile to run. In pycharm there is Run configuration, is there something similar to it in Atom ?
I have a project with multiple classes. When ever I want to run my script,I have to go to the main.py to launch 'ctrl + i'.
Could any one help me to setup the project in a such a way, when I execute 'ctrl + i' it automatically launch's main.py instead of the py file I am calling from.
In order to run a python script in tha Atom IDE, you can either press Ctrl+Shift+B or install a package called "terminal-tab" (https://atom.io/packages/terminal-tab). This package in an integrated command prompt like cmd on windows.
In the top bar, under "packages", go to "script", and select "configure script".
There put in the directory in which the program is, what command to run (python3 main.py), and select "save as profile." The window explains itself.
Then, you should be able to run from that profile with Alt+Ctrl+Shift+B, from whatever tab you're on.

sublime text 3 & haskell : change compilation directory

I use sublime text 3 on linux mint 17.3, with the haskell plugin.
I opened a directory containing a haskell file (.hs) and I edited it, but when I hit CTRL+B to launch it, it is run correctly but I don't see the binaries file produced in the folder of the source file.
do you know:
- where the files are?
- how I can change this setting?(I searched in the settings but without success)
thanks
ctrl + b doesnt produce binaries, it runs runhaskell instead. If you want to create binaries you have to define your own Sublime's build system. To do so use Tools -> Build System -> New Build System ... and use any python script you want. More info about build systems can be found in Sublime's manual.

Opening Microsoft Visual Studio Code from command prompt Windows

Is there a way to launch Microsoft Visual Studio Code from the command line in windows? I can't even seem to find the directory for code on my computer. It didn't even ask me where to download it.
Navigate to the directory that you want to open and type code . to launch VS Code.
As many folks already suggested ways to open code from command prompt using code . command. This will only open Visual Studio Code Stable build. But If you have downloaded Visual Studio Code Insider build/version (Which has all latest build/features but unstable version) then you need to follow below instructions in windows :
Go to Control Panel\System and Security\System. Click on Advanced System Settings
Click on Environment Variables
Under System Variables tab, Click on Edit for Path Variable
Add a new path C:\Users\tsabu\AppData\Local\Programs\Microsoft VS Code Insiders\bin
(or)
C:\Program Files\Microsoft VS Code Insiders\bin based on location at which you have installed vscode insider in your machine.
Open a new command prompt and type code-insiders . to open vscode-insider
build/version
Short answer:
code your_path your_filename
Long answer:
Here your_path can simply be . if you want to use the current directory as your working path. Or .. for 1 level up, etc.
code is the name of the executable of Visual Studio Code (code.exe). If it doesn't launch, perhaps your VSC path hasn't been added to the path environment variable. Run this command to add it:
set PATH=";C:\Program Files\Microsoft VS Code\bin"
Of course you'll need to specify a different path if your VSC is installed somewhere else.
How can you find out the installation path? (click for screenshot) Go to "Start" menu, type in "Visual Studio Code", right click on the found program, "Properties", check "Target". Now you'll see!
It may come already added to your path when installed. Try using code <filename> in your command line. If it's not you can add the command line script's directory to your path. The command line script's directory is downloaded by default in the following location
C:\Users\<username>\AppData\Local\Code\bin
Point your command prompt to the specific folder that has the file that you want to open. Let's say you want to open the file titled main.scss. Simply run this command:
start code main.scss
If Visual Studio Code is already open, you can simply do:
code main.scss

Resources