Webstorm run command when editor starts - webstorm

Is there a way to have Webstorm run a cmd code when it stars. I'm using grunt watch and at the moment I have to go to the terminal and type "grunt watch" to start the task but I'm pretty sure I'll forget this from time to time and I want it automated.

Is there a way to have Webstorm run a cmd code when it stars.
No.
http://youtrack.jetbrains.com/issue/WEB-11818 -- star/vote/comment to get notified on progress.

Related

Startup Multichain in WIndows Task Scheduler

I run command:
multichaind mychain -deamon
to start up the multichain program.
As per: https://www.multichain.com/developers/creating-connecting/
I'm running on Win 2012. I have tried putting this in a startup script using Windows Task Scheduler so that when the machine reboots, it will restart.
The task scheduler history shows it ran successfully, but it's not running. When I run the command
multichain-cli mychain getinfo
it says it cannot connect to the server.
And of course, that same command works when I start up multichain in a separate command prompt window.
My theory is that the command runs, but then the command windows is closed, but needs to remain open. Is there any way to do this, or debug what is going on?
I tried adding the parms as:
mychain -daemon >>d:\Software\Multichain\log.txt
hoping that it would write to the file so I could read it. But no file was created.
Update: I tried the .cmd file approach as recommended in the comment:
multichaind mychain -daemon
pause
That doesn't make sense to me because the first line should never finish.
It did create the log.txt file, but the whole thing still ran and quit in a few seconds:
d:\Software\Multichain>multichaind mychain -daemon 1>>d:\Software\Multichain\log.txt
d:\Software\Multichain>pause
Press any key to continue . . .

Why isn't gdb working for me

Background
I am currently trying to build an autonomous drone using ROS on my Rapsberry Pi which is running an Ubuntu MATE 16.04 LTS. Solving the Computer Vision problem of recognising red circles as of now.
Specific Problem
I am constantly getting the error I get in this question. To help me solve this, I have decided to use gdb. However, the command rosrun --prefix 'gdb run --args' zlab_drone vdstab does not seem to be working for me. zlab_drone is the name of the package and vdstab is the name of the executable I am trying to run. Since this is inside a ROS environment, I have grabbed the syntax from here, and used the suggestions in this question.
When I invoke this command, even with tui, I get a SIGSEGV and when I invoke list inside gdb itself, the program does not stay at a particular point and keeps listing a different line till it is out of range. This is quite a weird issue.
I managed to make it work without this issue earlier by using a different command, I reckon. I just cannot remember how I made it work last time.
Well, in the link you mentioned, it states clear that you should use either :
launch-prefix="xterm -e gdb --args" : run your node in a gdb in a separate xterm window, manually type run to start it
or :
launch-prefix="gdb -ex run --args" : run your node in gdb in the same xterm as your launch without having to type run to start it
So, it really looks like you missed an -ex as #ks1322 suggeseted in the comments or just type run to start the debug process.
I found out about this exclusive bug that relates to Raspberry Pi's solely. Basically the solution involves, as quoted by Peter Bennet:
There is a workaround. Start the program, then from another command
prompt or from an ssh remote login, use gdp -p xxxxx where xxxxx is
the process number. This works without crashing. If you need to debug
something that happens before you can get in from another command
prompt, add to the program a command that stops process at the
beginning of main, for example a call to gets, which will wait for you
to press enter before continuing.

Terminate the previous iteration when building a new one

TL;DR: How can I make CLion kill off any running versions of the code before building the new one?
I've started playing with CLion for C++. I noticed that I often forget to stop the last iteration before trying to compile again, which leads to "Permission denied" errors -- when I first encountered this, it took me almost half an hour of fiddling with permission settings before realizing that it was because the old version was still running, and therefore couldn't be replaced with the new executable.
As far as I can tell, there's no way to do this in CMake without embedding a Batch (since I'm on Windows) script. I'd like to avoid that, because it'd be a lot of unnecessary complexity for... not that much reward.
In short, is there an option in CLion or something in CMake that will stop the previous iteration when running the new one?
Yes there is. Simply press ctrl + F2 or goto Run > Stop to terminate the previous iteration in case it keeps running.
Alternatively, you can set to run only single instance. This way previous instance will always be terminated before running the new one. To enable this, goto Run | Edit Configurations and select Single Instance Only.
As far as I know, this is not possible by default.
One solution I have found was to create a batch file with the following content:
#echo on
tasklist /FI "IMAGENAME eq %1" 2>NUL |find /I "%1">NUL
if "%ERRORLEVEL%"=="0" taskkill /F /im %1
(Second line checks whether the process is running - found here: How to check if a process is running via a batch script)
And edit the build configuration to make CLion call the batch file and pass the processname to it before every build.
This is how it works:
Run > Edit Configurations > select the configuration to change (in my case "Build All")
In the "Before launch: External..."-section click the green plus
Choose "Run external tool" and click the green plus in the pop-up window
Choose a name for the tool
Add the path of the batchfile in the "Program:" field
Write $ProjectName$.exe into the "Parameters:" field
Click ok until you are back in the config window
Give the script a sufficient priority by selecting it and clicking the arrow up
Now it should try to kill the running process before every build.

Run python script with droneapi without terminal

I managed to run examples in command prompt after running mavproxy.py and loading droneapi. But when I double click on on my script, it throws me "'local_connect' is not defined", it runs in terminal as was told above, but I cannot run it only with double click. So my question is: Is there any way to run script using droneapi only with double click?
using Windows 8.1
Thanks in advance
You'll want to look at the Running an App/Example section of the guide. For now, you can only run a DroneKit script by launching it from inside the MAVProxy terminal. For example, after launching:
$ mavproxy.py --master=127.0.0.1:14550
MANUAL> module load droneapi.module.api
DroneAPI loaded
You can use the api start command to run a local script:
MANUAL> api start vehicle_state.py
STABILIZE>
Get all vehicle attribute values:
Location: Attitude: Attitude:pitch=-0.00405988190323,yaw=-0.0973932668567,roll=-0.00393210304901
Velocity: [0.06, -0.07, 0.0]
GPS: GPSInfo:fix=3,num_sat=10
groundspeed: 0.0
airspeed: 0.0
mount_status: [None, None, None]
Mode: STABILIZE
Armed: False
I think Sony Nguyen is asking for running the vehicle_state.py outside the Mavproxy command prompt, just like runnning the .py file normally.
I'm also looking for a solution as well.
You can only run dronekit from mavproxy at the moment (its structured as a mavproxy module, there are plans to restructure it), however if you simply want to avoid having to load up MavProxy and then running code manually, you can use the cmd flag:
mavproxy.py --cmd="api start app.py"

Child_info_fork error running code on cygwin [duplicate]

I recently reinstalled Cygwin on my computer in order to get access to several command line elements that I was missing. I have never had previous difficulty with Cygwin, but after this reinstallation, an error message continues to appear after (almost) each command entered. For instance:
-bash-4.1$ wc m1.txt
3 [main] bash 2216 child_info_fork::abort: data segment start: parent(0x26D000) != child(0x38D000)
-bash: fork: retry: Resource temporarily unavailable
2013930 4027950 74968256 m1.txt
Generally, the command still runs (as seen above), but not always. Occasionally, the 'error' message occurs several times in a row (the initial number "3" will then change to a "4" or "2", notably if I start a second Cygwin window.
Also, as soon as I start up Cygwin, I get the following message before the prompt:
3 [main] bash 6140 child_info_fork::abort: data segment start: parent(0x26D000) != child(0x36D000)
-bash: fork: retry: Resource temporarily unavailable
-bash: fork: Resource temporarily unavailable
-bash-4.1$
At the moment, I am debating whether to uninstall/reinstall Cygwin again or just live with the error messages, but I was curious if there might be an issue that I am unaware of.
(assuming Cygwin is installed at C:\Cygwin):
Open Task Manager and close any processes that look to be Cygwin related.
Open C:\Cygwin\bin in Windows Explorer
Verify that dash.exe, ash.exe, rebase.exe, and rebaseall exist in this folder
If any of them are missing, re-run Cygwin setup and select the dash, ash, and rebase packages
right-click your C:\Cygwin folder, uncheck Read-only (if its checked), and press OK.
When an error about not being able to switch some files comes up, select "Ignore All". Wait for this process to complete.
Browse to C:\Cygwin\bin in Windows Explorer
Right click dash.exe and click "Run as Administrator". A command Prompt should appear with nothing but a $
Type /usr/bin/rebaseall -v, hit enter, and wait for the process to complete.
If you get errors about Cygwin processes running, try Step 1 again. If that still doesn't work, Restart your computer into safe mode and try these steps again.
A commenter noted that, depending on your settings, you may have to type cd /usr/bin && ./rebaseall -v instead.
Try opening Cygwin again.
This process worked for me. I hope it works for you guys too.
Source: http://cygwin.wikia.com/wiki/Rebaseall
I would like to add the following to the above answers, as it is what I had to do after reinstalling Cygwin:
Navigate to the "/usr/bin" directory (usually, C:\cygwin\bin) and right click, Run as Administrator the file: dash.exe
Then, at the $ prompt type the following, hitting enter after each line:
cd /usr/bin/
/usr/bin/peflags * -d 1
/usr/bin/rebaseall -v
What it does is, it marks the dll's as "rebase-able," and then rebases them. You have to have peflags.exe in addition to the above files (in previous answers). You may have to restart windows after doing this and you will definitely need to make sure that there are no processes nor services belonging to cygwin running. (Use task manager, kill any related processes, and then under the services tab look for any service starting with CYG and stop it.)
After doing this, I was able to get cygwin to run without any errors about dll's being loaded to the wrong addresses aka fork errors, etc.
I hope that this helps others, as it was a pain to find.
SOURCE: http://www.cygwin.com/faq.html#faq.using.fixing-fork-failures
and the rebase README file.
To add on to other answers here, we ran into the same issue but could not run the rebase command from the ash or dash shell. However, when launching the command from the Windows cmd shell, the following worked.
cmd /c "C:\cygwin64\bin\ash.exe /usr/rebaseall -v"
-v is to get verbose output
I found another information here :
http://cygwin.com/ml/cygwin/2014-02/msg00531.html
You have to delete the database at
/etc/rebase.db* and do in a "ash" windows :
peflags * -d 1
rebaseall
It works for me on 2 servers.
I solved this problem by restarting my computer. Probably installed a driver update and kept using sleep instead of shutting down.
Experienced the same issue when loading Cygwin with cygiconv-2.dll forking and not loading successfully in the Cygwin terminal, but after turning off my AntiVirus (it was specifically Ad-aware), the issue resolved, and Cygwin worked properly.
In case you are using babun's Cygwin, after rebaseall, try launching Cygwin by executing .babun\cygwin\cygwin.bat in a Windows command prompt or Windows explorer.
This works for me (while launching babun's default console - mintty results in fork error).
I had the error on win10 and i was trying to rebase to c: before install.
then i saw that the installer was installing it instead to c:/Users/myuser
so i was coping all files from c:/Users/myuser to c:.badun
and then restart plus open badun.bat
not shure if this was wise its now duplicated XD... but then it worked again.
Rebaseing didn't help in my case. In addition to what other people suggested, I noticed that reducing the length of PATH environment variable fixed the issue for me (and for other people as well as can be seen from this answer).
This issue is intermittent in nature & I found this issue when there is network is too slow to connect to remote machine on AWS.... I have Shell script that runs through Gitbash shell & it connects to AWS EC2 instance with ssh..... Most of the time, it ran correctly but 2 out 100 times it get into this issue bash: fork: retry: Resource temporarily unavailable .... Killing the MSYS2 terminal from task manager helps to overcome with this issue....
Negative side is you need to run the scripts from the beginning...
I had the same issue on Windows 10 and the mobaxterm app (which uses cygwin) and I tried all of answers listed here however for me, the solution was to simply delete the "CryptoPro CSP" application.
I started facing this problem after upgrading to windows 10. As of now I do not see that any of the above method working.
What I am noticing is that if you start cygwin with admin right (right click and say "run as admin") then it works fine.
Or you open cmd as administrator and then launch cygwin from there, then also it runs fine.
Just reinstall cygwin and select TCL and activate EXPECT