Launching instruments from command line with iPhone simulator - ios4

Following this question, how do I launch instruments with iPhone simulator as a device.
I tried this:
$ instruments -t /Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -w iphonesimulator5.0 MyApp.app
But I get this error:
Instruments Usage Error : Device failed to become ready for use.

-w <deviceID> is used only when you wish to specify a hardware device as the destination (the 'deviceID' here is the Identifier of the device, found in the Organizer of Xcode).
Instead of using -w, you can specify a flag during the build to force instruments to use iPhone. Details can be found here.

I was doing it as follows:
1.I created a template in which I was calling my UI Automation Main file that Triggers running all the scripts.
EX:
//Main.js file will run auto.js scripts
//auto.js is my main file in which I am running all the scripts
//Main.js file
#import "auto.js"
auto.run();
//Now open terminal and run the following command.
1. Go to the directory where you saved your template
2.Copy the location where you simulator (full path) is
Than run the command below:
instruments -t ./NameOfYourTemplate.tracetemplate /Users/swathyvalluri/Debug-iphonesimulator/MyApp.app
Note : Create a new file in the template and copy the contents into it what ever you want to put, otherwise it will look for Main.js file in your locally and will fail when running it on another server.
Please let me know if you need more help :)

Device id means here UDID of the device.
Also see the link below, it is very useful :
http://lemonjar.com/blog/?p=69

Related

Strange Behavior with clamd scan function

I have a simple python3 script running on ubuntu server 20.04 that tries to call clamd (clamav-daemon process) library to scan a file. The scan ping() and version() function all work correctly. However when I actually do a test write and scan, i get the following error:
{'/filedrop/test.doc': ('ERROR', "Can't open file or directory")}
This is the code that I used to call the test write and scan, and this is all standard sample from the clamd website:
open('/filedrop/test.doc','wb').write(clamd.EICAR)
print(cd.scan('/filedrop/test.doc'))
After the code is run, i get the following string in the test file which indicates that the python3 script was able to successfully write to the file, yet i keep getting the error that the file can't be opened when i use the clamd scan function.
This is the string that was written to the file:
X5O!P%#AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
I am also able to run clamscan from command line on the folder and it successfully scans the files as well.
I'm running as root user while the service is using clamav:clamav.
I did give read/write permission to the folder and the files to "other users", and also indicated by the fact that the file could be written by the python script.
I believe the solution to the problem here is that AppArmour is blocking clamd for that particular directory. I would look at the AppArmour profile for clamd. It should be called something like /etc/apparmor.d/clamav or similar. You can adjust that profile or alternatively disable it (according to Ubuntu):
sudo ln -s /etc/apparmor.d/profile.name /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/profile.name
More complete instructions available here:
https://help.ubuntu.com/community/AppArmor
You can also disable AppArmour, for the purposes of testing (I don't like to advise anyone to remove security features permanently), with:
sudo systemctl stop apparmor
sudo systemctl disable apparmor

Shell script seems to skip over commands while executing

I'm trying to create a process where, on detecting my smart watch connecting to it, my Raspberry Pi (4b 2GB) would automatically download new podcast episodes then transfer them to my watch. I have managed to create a udev rule to execute a shell script on detection, but it seems to skip the most vital commands (upodder and mtp-sendfile)? Code below:
#!/usr/bin/env sh
PATH=$PATH:/home/pi/.local/bin:/home/pi/.vscode-server/bin/485c41f9460bdb830c4da12c102daff275415b53/bin:/home/pi/.local/bin:/home/pi/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
echo "Watch connected at $(date)" >>/tmp/scripts.log
# Download new podcasts
/home/pi/.local/bin/upodder
# Transfer podcasts
/usr/bin/mtp-sendfile ~/Downloads/podcasts/WFH_Beckham_Sweden_and_Bango.mp3 /Podcasts
echo "Upodder should've run by now">>/tmp/scripts.log
I know that the file runs because /tmp/scripts.log is created and updated, but the podcasts aren't downloaded or transferred. upodder is a linux podcast downloader and mtp-tools is a way to transfer files through MTP. It's pretty clear that the issue is with these two commands but I can't seem to find the solution anywhere. Thanks in advance.
edit: Iruvar suggestion has helped but now I get the error:
Unable to determine user's home directory, MTPZ disabled.
Device 0 (VID=091e and PID=4c05) is UNKNOWN in libmtp v1.1.16.
Please report this VID/PID and the device model to the libmtp development team
~/Downloads/podcasts/WFH_Beckham_Sweden_and_Bango.mp3: stat: No such file or directory
Seems the issue is with the home directory.

PRU won't initialize for hcsr-04 ultrasonic sensor (Beaglebone black)

In order to use the hcsr-04 ultrasonic sensor using BBB's PRU, I have tried this git :
https://github.com/HudsonWerks/Range-Sensor-PRU
I get the error "the PRU failed to open", when I try to start "rangepru".
Doing some research, I feel like that is because my PRU is not initialized and that I should do : "echo BB-BONE-PRU-01 > /sys/devices/bone_capemgr.8/slots" to correct it.
But with the recent debian versions (4.x), the cape manager changed and I found the file "slots" at:
/sys/devices/platform/bone_capemgr/slots ; BUT, there is no way to open, modify it :
- using "nano" I get "slots.swp Permission denied"
- and by typing the correct echo command (modified from the one above) : I get : "write error: No such file or directory"
Best regards,
Elrise
You are probably missing a suitable device tree driver.
Try to follow the instructions on:
https://github.com/luigif/hcsr04
related to the compilation and installation of the driver.
If you have a proper development environment, executing make install should do everything for you.

Execute an application before log-in time forever in linux

I am working on a BBB device running on an Angstrom image and the display panel is a 7 inch LCD cape. I want to start an application as soon as log-in message prompts means the application should get start automatically just after the booting. To achieve this I tried
1) To put my script files in /etc/init.d and linked the script with /etc/rc5.d as S99myscript and then updated the rc.d
But it was not an successful attempt.
2) I changed the /etc/issue file a little bit and to invoke the script i appended myscript file in the last as this.
. /home/root/myscript
// tried it like this also
sh . /home/root/myscript
but this time also i couldn't get my desired result.
What's i am missing ? Or how can I get the result.
The service file
Status of service file

How can I get source code of nodejs from running app

I have accidentally delete source code of nodejs application, but this application is running, so how can I get source code back from running app?
I hope source code has been cached in some directory.
I was able to recover the full file by attaching the debugger (as TGrif suggested).
To actually recover the code:
Use setBreakpoint('app.js', 10), where 10 is a line of the code you know will be ran over again in the running process
Say pause, then next until it's paused on the script you want to recover.
Finally, say list(5000), where 5000 is an arbitrarily long number of lines to list.
You will now have your full script printed out, albeit with line numbers at the front, but you can use a site like this to remove them.
Hope this helps anyone who encounters this unique issue in the future, as this took me a couple hours to figure out.
There is maybe a way to retrieve some of your source code with the Nodejs debugger.
Assuming Linux OS, you need to get the process id of your application:
$ ps -e | grep node
Next you entering your app in debug mode with something like that:
$ kill -s USR1 PID
where PID is the pid of your node app.
Then your start the debug console:
$ node debug -p PID
If you have an app console, you'll see:
Starting debugger agent.
Debugger listening on port 5858
In your debug console you should see a debug prompt and you can get available commands with:
debug> help
I am able to show some of the running app source with the list command:
debug> list(NUMBER_OF_LINE)
where NUMBER_OF_LINE is the number of source code line you want to display.
I'm not sure this is a one shot try for you or not because my source code was not deleted.
Hope you can get some results.

Resources