Run configuration with command line program in IntelliJ IDEA - ember.js

I would like to add a configuration inside IntelliJ so that I can run it from the Run context menu (there is included Node.JS launcher but I couldn't find a "Command Line configuration launcher")
Also, is it possible to run the command line terminal as Administrator if ran from Windows ?
The command I would like to run is ember serve
Thanks for the help.

These are the steps:
Go to Run/Edit Configurations...
Add a new one for "Javascript Debug"
Fill Name with the name you want for the configuration, fill the URL with http://localhost:4200 and pick the browser you prefer
Then, in the second white box, add an external tool by clicking in the green plus button and selecting the option Run External tool
Add a new one clicking on the green plus button and fill the following fields: in Name the name you want for the external tool, in Program write ember (it's the command you are going to run), in Parameters write server or s as the options for the command and in Working directory write $ProjectFileDir$ if it's not written already to run it in the folder in which you are working with.
With all this, you should only need to press the play button and it should run and open the browser automatically with a tab directing to localhost:4200, where your ember server is running.
EDIT: I'm not using it on windows so I'm not sure if it will run the command as administrator. Probably running Intellij using "Run as Administrator" will do the job.

Related

Run AHK script as admin on startup

I have four AHK scripts which run on startup, as they have shortcuts placed in my startup folder. How can I make them run as admin?
What I've tried:
I've tried changing their properties to be run as admin, but they just don't run (when I do that).
I've tried changing their shortcuts' properties to be run as admin, but they too just don't run (when I do that).
I've looked at this reddit post on the topic, but I don't know how to implement that code in the scripts.
I've tried creating a basic C++ application which runs them with system("start path\\to\\script"), but it wouldn't compile.
In case it matters, the scripts in question are ahk-active-screenshot, CtrlAlt_Switch.ahk, Kill.ahk, and a modified version of this search script.
You can allow the script to automate administrative programs without running as admin, here're the required steps:
When installing AHK, check the "Add 'Run with UI Access' to context menus" option.
After installation, find AutoHotkeyU64_UIA.exe on your disk.
Open the .ahk script's properties, change the "Open with" option to the AutoHotkeyU64_UIA.exe you just found.
Create a shortcut to this script.
Open %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup in the file explorer.
Move that shortcut to this folder.
And you're done.
How does it work?
The "Add 'Run with UI Access' to context menus" option provides a workaround for common UAC-related issues by allowing the script to automate administrative programs without running as admin.
Reference: Run with UI Access.
Find the UIA version of autohotkey on your machine. For me it is at C:\Program Files\AutoHotkey\AutoHotkeyU64_UIA.exe.
In your startup folder, create a new shortcut (probably one for each of the scripts you want) as follows (replacing paths as appropriate):
Target: "C:\Program Files\AutoHotkey\AutoHotkeyU64_UIA.exe" "D:\path\to\script.ahk"
Start in: "C:\Program Files\AutoHotkey"
This launches your script as an admin using the UIA version of AHK on startup.

Debug Cypress in WebStorm

How do I set up Cypress debugging in WebStorm? I can get a debugger statement in my code to pause execution in Chrome and debug using devtools, but nothing happens in WebStorm.
This is true whether I am running or debugging my configuration, which is simply npm run cypress (with my cypress open script). When debugging the run configuration, I don't get checkmarks on my breakpoints in WebStorm.
The WebStorm docs refer to selecting your configuration type from the menu but there's no Cypress in the menu.
Is this possible to do?
it is a bit of a process but when you are done it is worth it.
Just a couple notes:
I use it on Mac, Version: 2019.3.2, however it should be very similar.
And (at this time) you have to be running the Chrome browser, you cannot attach to electron.
First, in your package.json file you need to have some npm launch script (not technically necessary, but makes everything else stupid simple) here is a sample of mine:
"scripts": {
"start:ci": "serve --no-clipboard --listen ${PORT:-8080}",
"cypress:open:localhost": "ENV=localhost npm run cypress:open",
"cypress:open:dev": "ENV=dev npm run cypress:open",
"cypress:open:qa": "ENV=qa npm run cypress:open",
"cypress:open:staging": "ENV=staging npm run cypress:open",
"cypress:open:production": "ENV=production npm run cypress:open",
"cypress:open": "cypress open"
},
Next you need to setup a debug configuration for npm. On Mac that is under run->Edit Configurations...
Add a new configuration using the npm template (click the plus and choose npm)
The template will have a drop down for scripts, select your npm script (mine is set for cypress:open:qa) Then click apply.
Now when you launch the debuger it will open your cypress instance with debugging attached to cypress. However, you want to attach to the browser so you can debug your JS.
Start any test in chrome, then open a new tab (in cypress chrome instance) go to the chrome extensions site and add the Jet Brains chrome extension, here is the link:
https://chrome.google.com/webstore/detail/jetbrains-ide-support/hmhgeddbohgjknpmjagkdomcpobmllji?hl=en
This will apply it to the chrome version that cypress runs. When you are running your test you right click the JB icon and inspect in WebStorm.
This opens a new tab in your debug dialog box (default bottom left). Open the tab that says scripts in your https://yourproj... tab. Navigate in that dialog to integration file you want to debug, double click it. Slap in a break point and away you go.
There are two plugins that let your run cypress tests from Webstorm. Both let you select a single test and run it then see the result directly in webstorm.
The Pro version allow to debug tests in the cypress runner.
https://plugins.jetbrains.com/plugin/13819-cypress-support (free)
https://plugins.jetbrains.com/plugin/13987-cypress-support-pro (paid)
The pro version debugging capabilities:
You can run cypress as node job in webstorm.
For this:
Set the path to the cypress executable file
Select your folder as working directory
Add run options run --spec cypress/integration/Filters.feature
I am using cucumber so am giving a feature, if you use mocha use your run parameters the same as in the console.
Settings

Can I run/debug files with babel-node in WebStorm?

I know there are Run/Debug configurations in WebStorm, but I don't know how to configure the context menu (when I right click in a file, it has Run... and Debug... in the menu, but I can't find where to configure this).
Run configurations are created via Run | Edit Configurations... : press +, choose Node.js, in created configuration specify babel-node as Node Interpreter:
But note that debugging doesn't work well when using it. I'd strongly recommend using -r #babel/register Node.js parameter instead - see comments in https://youtrack.jetbrains.com/issue/WEB-21949

WebStorm run command or program on project open

Is there any way to run external program or command after I open project in WebStorm?
I've created new external tool which runs database server, and after I click on it in menu, it runs the server and everything works, but I'd like to start this tool automatically on project start. And it'd be awesome if it could also open web browser to certain url which would be database admin tool.
If you can launch your desired task using Grunt/Gulp/npm task or any other Run/Debug Configuration then yes -- there is Startup Tasks functionality available at Settings/Preferences | Tools | Startup Tasks.
Note that you cannot execute External Tools entry directly or launch any DOS/shell command this way.
The easiest way of using this would be creating Grunt/Gulp task that would do your actual job. There you can use exec() method to execute custom command.

Wamp server error. could not execute run action

I am trying to start wamp serve which was totally running fine on my laptop two weeks ago, but now after two weeks I suddenly get this error:
could not execute menu item(internal error)[exception] could not execute run action: the directory name is invalid
When I click on wamp, then I go to apache, then I select service then test port 80 and this is what I see:
when I write localhost, it goes there but when I click on Localhost and phpMyAdmin, i get this error:
please tel me how I can fix this . thanks
WAMP is trying to open your browser, but the directory in the settings is not correct. It could be that your browser is now located somewhere else. To fix this:
Edit the file wampmanager.conf inside your wamp direcotry.
Replace the full file path under the [main] section for the navigator parameter
Save the file
Right-click on the wamp icon and select refresh
Try it now
Good luck!
The paths are incorrect in multiple ini files and the wampmanager conf file. Here are the ones I changed since my installed moved from g drive to e drive. I had to change all instances of g:/ to e:/ as well as my chrome.exe location
wampmanager.conf:
in the [main] section update the path of chrome.exe or ensure it is correct.
wampmanager.ini:
change all instances of g:/ to e:/ (or whatever your install drive letter is)
php.ini (under /wamp/bin/php/php5.5.12/)
again, change all instances of g:/ to e:/ (change to your install letter)
Wampmanager started correctly once these changes were made.
I had a similar problem, and to get my WAMP server working again on my laptop I ran the executables for Apache and MySql independant of the WAMP system tray icon.
In Windows Explorer, I ran (elevated):
{wamp folder in my case C:\wamp}bin\apache\apache2.2.22\bin\ApacheManager.exe
This put the apache manager system tray icon in.
then I used the apache system tray icon to start apache server
Then I ran (elevated):
{C:\wamp}bin\mysql\mysql5.5.24\bin\mysqld.exe
This allowed me to use localhost\phpmyadmin, which to me demonstrates the php, mysql and apache are all working.
My web app was also back and running.
The age of my MySql version and apache version show how long this had been stable for.
I initially thought the problem may have been caused by a google chrome upgrade which included the notifications icon in the system tray, as the chrome upgrade was the only thing I recall changing. I unistalled chrome but this did not fix it - although this does not rule out Chrom Notifications being what broke it!
This appears to be an oversight on the WAMPSERVER developers. For some reason it does not translate the file path syntax from Linux to Windows, resulting in the following error message:
Aestan Tray Menu: Could not execute menu item (internal error)
[Exception] Could not execute run action: The directory name is invalid
To fix this, edit wampmanager.conf and replace the forward slashes in the file path with backslashes.
EXAMPLE:
Incorrect
editor ="C:/Program Files/Sublime Text 3/sublime_text.exe"
Correct
editor ="C:\Program Files\Sublime Text 3\sublime_text.exe"
Save the file, then right click the tray icon and select "Refresh". You should now be able to edit your files with your selected editor without issue :)
i have met this problem and fixed by editing 4 files
- wampmanager.conf in root
- wampmanager.ini in root
- php.ini in (wamp64/bin/php/php5.5.12)
- httpd.conf in (wamp64\bin\apache\apache2.4.18\conf)