Qt Creator 3.5.1 stdin for command line with Deploy to Remote Linux Host - qt-creator

following
[Qt Creator stdin for command line with Deploy to Remote Linux Host
"I found out that there is no way to provide stdin to an app launched by qt creator from within the IDE.
I did try a few things and it looks like a named pipe works just fine. Luckily it’s included with Busybox so it’s on my board.
To use it you launch the app remotely from Qt Creator using the ‘Alternate executable on device’ option under ‘run settings’ and pipe the last line of the named pipe to your c++ program expecting stdin. So your ‘Alternate executable on device looks like:"
tail -f mypipe | /home/prog//test
this is not working for Qt creator 3.5.1 based on qt 5.5.1
when running
run settings->Alternate executable on device: tail -f mypipe | /home/prog//test
getting back
Process tail -f mypipe | /home/prog//test created; pid = xxxx
Cannot executable tail -f mypipe | /home/prog//test: No such file or directory
I can run the program using ssh with out any problem ( using stdin or include using "mkfifo mypipe" and "tail")
tried different syntax with same result:
'...'
setting run settings->working directory: target path
setting run settings->arguments: -qws
tail -f mypipe | /home/prog//test -qws
/home/prog/; tail -f mypipe | ./test -qws
any other combination
it look like QT creator can only handle the syntax using only the exe
Alternate executable on device: /home/prog//test
what I am doing wrong, syntax? any suggestions?

Solve it using different approch
Using argv to send either cin or pathway to fifo file.
Then using ssh remotly with echo command > myfifofile.
My code do the rest
Reading from file or cin
Hope this help

Related

Problems in running a script.sh in Ubuntu app Windows10

I'm trying to learn how to code. I have to say that I'm using the Ubuntu app on the Windows system, so I don't know if my problems are related to this system.
I established these variables in the terminal
FOLDER="/mnt/c/Users/franc/Desktop/nuova"
species=mm10
fragmentsize=200
window=200
gap=200
output="/mnt/c/Users/franc/Desktop/nuova/sicer"
and then I wrote this loop
#!/bin/bash
for fq in $FOLDER/*.bam
do
bedtools bamtobed -i "$fq" > "${fq%.bam}.bed"
sicer -t ${fq%.bam}.bed \
-s $species \
-f $fragmentsize \
-w $window \
-g $gap \
-o $output
echo "DONE"
done
Basically I want the files in the FOLDER to be transformed in "${fq%.bam}.bed" and then I want to run sicer tool on these new files.
If I copy and paste these commands, on the terminal, everything goes fine but if I save the loop as script.sh and I try to run the script I obtain different errors.
Of course, I made the script executable with chmod +x and I also changed the syntax of the script using awk '{ sub("\r$", ""); print }' myscript.sh > myscript1.sh since I edited it in Windows(otherwise ubuntu fails to open it).
But when I launch the script containing the loop, it says that it is not able to open the files in the FOLDER (Failed to open BAM file /*.bam or BAD permission denied). I tried both to open it just giving the command ./myscript1.sh or also using sudo ./myscript1.sh.
What I'm missing? I have in some way link the variable I establish in the terminal to a new variable in the script saved?
thanks
Francesca
You need to export the variables so that they'll be inherited by the shell process running the script.
export FOLDER="/mnt/c/Users/franc/Desktop/nuova"
export species=mm10
export fragmentsize=200
export window=200
export gap=200
export output="/mnt/c/Users/franc/Desktop/nuova/sicer"

SVN filtering commits by messages

I have to accept or not accept the commit on a particular repository based on the comments with the commit (using hooks). I don't know how to do it. I have to do it on a Windows device. I read somewhere that I should modify the pre-commit.tmpl file to accept just that word as the commit so I did modify this statement:
SVNLOOK=/usr/local/bin/svnlook
$SVNLOOK log -t "$TXN" "$REPOS" | \
grep ""[a-zA-Z0-9]"" > /dev/null || exit 1
into this:
SVNLOOK=/usr/local/bin/svnlook
$SVNLOOK log -t "$TXN" "$REPOS" | \
grep "^.*hello.*$" > /dev/null || exit 1
Also, it says to change the .tmpl extension for windows. But I don't know if a grep search is right also, what is the other alternative to doing the same task?
The exampels inside the .tmpl files are made for unix and using unix commands. You need to install the appropriate unix tools and adapt the scripts to your architecture(modifying paths etc..)
On windows you also need to rename the file to .bat so it is executable.
Note that no environment variables are available in hook scripts.
I would recommend to use python as a platform independent way of providing hook scripts. There are tons of python hook scripts available.

Windows 7 Task Scheduler BASH Script Fails

In order to use rsync I created a BASH script. It runs fine from the Cygwin shell in WIN 7 but fails when run from the WIN 7 Task Scheduler. My Task Scheduler Script is a simple:
c:\cygwin\bin\bash.exe -l -c "~user/rsync_Windows_Backup 2>&1 >> ~user/Documents_cron.log"
The initial directory is set to C:\Cygwin\bin.
My BASH script is a typical rsync command with [options] SRC DEST and some related housekeeping.
The rsync command within the "rsync_Windows_Backup" BASH script is:
/bin/time -f "\nElapse (hh:mm:ss.ss) %E" \
rsync.exe -v -rltz --chmod=a=rw,Da+x -u "$SRC" "$DEST" >> "$LOG" \
2 >> "$LOG"
$ ./rsync_Windows_Backup - succeeds.
But the Task Scheduler Job fails carping that it cannot find the DEST Folder that the BASH script references. When I do a "cd DEST" from the BASH command line the Folder is avialable and can be written to.
I should add some more details that the sender is a WIN 7 desktop that is mapped to a Vista desktop receiver with a drive mapping J:. The BASH script does start but fails with:
rsync: writefd_unbuffered failed to write 4 bytes to socket [sender]: Broken pipe (32)
rsync: mkdir "/cygdrive/J/DocumentsBackup" failed: No such file or directory (2) rsync error: error in file IO (code 11)
I have tried several ideas to influence how WIN 7 handles mappings and permissions assuming this is the root of the problem. So far nothing seems to help.
Another characteristic is that the exact same BASH script and Task Scheduler Job does succeed it WIN Vista Business Edition. So I am assuming there is something in WIN 7 that I am missing.
I am stumped and could use some guidance.
Thanks.
I now have this working in Win 7 from the task scheduler as I need. Thank you to #netubsi and #firerat of LinuxQuestionsorg and #konsolebox for the suggestions that lead to a solution.
Here is what I did:
cmd /c net use T: '\\server\share' # Created a separate temporary share for Cygwin
DEST="/cygdrive/T/User/FolderBackup/" # Use temporary Share in Destination
rsync -avuz --copy-links "$SRC" "$DEST" # Do backup
cmd /c net use T: /delete # Remove temporary share
It appears that in WIN 7 the share created in Windows is NOT available to a Cygwin script, IF it is launced from the Win 7 task scheduler. It IS available if the script is launced from the Cygwin command line. It also appears that this is NOT an issue in Win Vista.
This seems odd to me. Perhaps there is another explanation that I am missing. However I am just relieved to have this working!!
You can also just use the network address directly in cygwin:
DEST="//server/share/User/FolderBackup"
Cygwin mounts local and mapped drives under /cygdrive. Using taskscheduler in win7 if you list the contents of /cygdrive, all you will see are local drives???
First option is to run your script as
c:\cygwin\bin\bash.exe -l -c "~/rsync_Windows_Backup >> ~/Documents_cron.log 2>&1"
If you want to capture the stderr output as well, you have to place it in front to copy the fd of the file, and not of stdout.
Make sure that rsync_Windows_Backup has executable permissions. Running ls -l ~/rsync_Windows_Backup should show it.
If it doesn't work, try to use absolute paths. On your Cygwin screen where the current direcory shows ~ in the prompt type pwd which would show something like
User#System ~
$ pwd
/home/User
Basing from that as an example your command should now be like:
c:\cygwin\bin\bash.exe -l -c "/home/User/rsync_Windows_Backup >> /home/User/Documents_cron.log 2>&1"

Shc encrypted shell script not executable

I created an encrypted shell script with the tool shc.
The script works just fine on my computer but when I transfer it to
another one (solaris 10 to solaris 10) I get the following error:
invalid argument
It's not a permission problem and the encrypted script should be ok I guess it's a header/compiler problem.
The shc command used wasshc -rf <filename> so the script should work on another computer!?
According to The Geek Stuff you need to use the -r option to relax security and -f to specify your script file:
shc -r -f script.sh

How to strace adb shell am start myandroidapp

I need to lean on you for some help on stracing android apps in the sdk emulator
here is my setup
android sdk emulator running android api 4.03
adb shell connected to emulator.
I am able to install an apk usng adb install filename.apk
I am able to run the app using
adb shell
am start -a android.intent.action.Main -n com.akproduction.notepad/com.akproduction.notepad.NoteList
I try to strace using (adb shell)
strace am start -a android.intent.action.Main -n com.akproduction.notepad/com.akproduction.notepad.NoteList
but I get nothing!
how do you trace the runtime behavior of android apps and their installation ?
thanks,
Jose.
p.s. the test app is located here: http://www.appbrain.com/app/ak-notepad/com.akproduction.notepad
am is a batch file and cannot be used in strace.
You need to run it like this:
strace -v -fF -tt -s 65535 -o /data/local/tmp/opengl.strace /system/bin/app_process /system/bin com.android.commands.am.Am start -a android.intent.action.MAIN -n demo.opengl.android/.OpenGLDemo
BTW don't use the strace statically compiled binary available for download from:
http://benno.id.au/blog/2007/11/18/android-runtime-strace
It will output nothing.
Instead use the one which comes with the ROM.

Resources