How I can run MyDaemon.php in background in TideSDK app?
MyDaemon.php - it's my completely ready console software (a lot of code, run other my php scripts, run other software, etc). It's endless php script. It must be start after TideSDK APP and live all time before exit (while user don't close app). TideSDK show status from MyDaemon.php and have few buttons to control it.
Issue 1: How can I start MyDaemon.php in:
Ti.Process.createProcess("?path/to/php/from/tide? -f MyDaemon.php");
What write in "path/to/php/from/tide"? Target computer of my users don't have php package. I want run php from TideSDK like console mode. I include feature PHP and use button "Package with Runtime" in TideSDK Developer. I looked for all files inside TideSDK, but there are nothing like "php" (executing file), only libs.
Issue 2: I try to use
< iframe width=0 height=0 src="MyDaemon.php"></ iframe>
But TideSDK can't start UI APP, because can't take FULL source in frame. MyDaemon.php is undless. How can I include < IFRAME> in ASYNC mode like a real browser?
I try to use this trick:
<iframe width=0 height=0 src="" name="php">< /iframe>
<script>setTimeout("frames.php.location.href=MyDaemon.php", 1000)</ script>
But it's not work too (UI APP started, but halted after execute this frame).
MyDaemon.php can communicate with TideSDK APP any way:
start "/bin/php -f MyDaemon.php" and read/write stdin/stdout. MyDaemon.php can write to stdout any commands in JSON format.
start MyDaemon.php in and write to stdout < script>Ti...[commands]< /script> - any direct JS code for TideSDK
write any msg to file1 and read from file2 (TideSDK will read/write there and execute)
write any msg to SQLite DB (TideSDK will read DB on JS code)
Any other way.
It's important: MyDaemon.php want to start in console other php files! Because first process run a lot of childrens for calculating very long tasks. I can ask TideSDK for start this childrens and don't use "exec(/bin/php -f second.php)" in MyDaemon.php.
But I don't want to include double PHP binaries to my APP, because TideSDK APP already have it! It's a lot of extra space in dist.
Thank you and sorry for my language.
I think you should use Ti.Process.CreateProcess() function, where you can receive the output of the command you are using (I'm using JS syntax for this, not php, so I don't need to include extra libraries to execute commands, or write/read operations)
first you have a command cmd or shell command, lets say "ls -la /www"
then you need to send all the set of instruction as an array: var cmd = ["ls","-la","/www"]
then pass it to a var using Ti.Process.CreateProcess() : var echo = Ti.Process.CreateProcess(cmd);
to get the output, you could pipe out the content to another set of instructions.
the final program should look like this:
var cmd = ["ls","-la","/www"];
var echo = Ti.Process.CreateProcess(cmd);
echo.setOnReadLine(function(data) {
console.log(data);
});
echo.setOnExit(function(data){
console.log('process ended');
console.log(data)
});
echo.stdout.attach(echo.stdin);
echo.launch();
Instead console.log, you can pipe out the command output to your div.
also, besides main.html, you cannot load another scripts besides that. TideSDK is not a web based structured platform where you can reach a secondary page inside of the domain accessing it through url (like app://main.html is the only one to be loaded, have tried with no luck to call other "pages"), but instead modularize your app to load elements inside of the main page.
now, creating a daemon is a risk here. You need to be aware that depending on how you refresh the content it could increment severally the CPU usage.
I can suggest you to use a javascript loop to a shell command using the content above written. you do not need a real "daemon" or a secondary script since TideSDK can provide on certain extension that inside TideSDK
Related
I am automating android app tests with Appium, and I need to split my test script in half while the app is still running.
The first script initiates a log into the app, and the next script achieves it. Therefore the second script must get the app in the exact same state as it was left by the first step. The app cannot be closed meanwhile.
Is there a way to do this, and if there is, how?
Thank you!
This is quite simple.
Create your test suite directory and insert Initialization file into it.
In the Initialization file do the following setup:
Suite Setup Open Application
Suite Teardown Close All Apps
Then then in the scripts in this directory do not Open Application, just add your Appium keywords and those will use the current open application.
I use this when I need to do something in iOS application (AppiumLibrary), then do operation over same data on web client (SeleniumLibrary) and then finish in iOS and finally check in web client/database.
The file structure is something like this:
__init__.robot
01_login_appium.robot
02_do_appium_stuff1.robot
03_do_selenium_stuff1.robot
04_do_appium_stuff2.robot
...
Alternatively if you just want to have separate script for logging to reuse in scripts, I prefer to create keyword resource file for setup, logging or other common tasks where I would encapsulate several steps in such keyword and reuse it in setup for different scripts.
I have been trying to run a script automatically using the steps that I found online.
I am trying to run the following R script called AUTO.R
Here is what the script contains:
library(quantmod)
obs <- last(Ad(getSymbols("SPY", auto.assign=FALSE)))
saveRDS(obs, "SAMPLE.rds")
When I build the application it prints Workflow completed
I believe all is well until the time comes to run the script. The alarm pop-up in my desktop is displayed from Calendar but nothing runs. After a few minutes the folder where the .rds file should be saved does not contain anything.
Two suggested changes:
Your Automator task should be more like just /usr/local/bin/Rscript --vanilla /Users/rimeallthetime/Desktop/AUTO.R
You should explicitly set the path in saveRDS; i.e. saveRDS(obs, "/Users/rimeallthetime/Desktop/SAMPLE.rds")
Honestly, though, you should at least make a ~/bin dir (i.e. a directory called bin under your home directory, so in your case /Users/rimeallthetime/bin and put both the workflow and R script in there, and I'd also suggest creating another directory for output files vs the desktop.
UPDATE
I just let the calendar event run and this is really a crude way to automate what you want to do. You'd be better off in the long run using launchd, that way it's fully automated and requires no human intervnention at all (but you may need to adjust your script to send you a notification or "append" to the rds file).
I need to run a shell command, that will call the script file that I have written in RUBY
For eg: Lets say, I have a file.sh in my working directory, How can I execute this file using TideSDK( I tried Using the Process)
Titanium Desktop createProcess to run shell script
Is there some other alternatives for this kind of stuffs in tideSDK?
Thanks
UPDATE:
I need to run the ruby script after a click of a button.
I think you don't need to run a process for that. TideSDK allows you to run other scripts like php, ruby and python directly in script tags. On the tag you just need to define the script on the type attribute: text/ruby
There ar several methods to include scripts on TideSDK. Take a look on the documentation at www.tidesdk.org. There is a section related to how to get started.
http://tidesdk.multipart.net/docs/user-dev/generated/#!/guide/using_ruby
I have a scenario where I want to log every activity for a particular user. I have a script built around the script command which I invoke from the user's .profile. Now the requirement is that the user should not be able to delete the subsequent typescript file that is created. Towards that, I've created a user with the default shell of rksh and put a restriction on commands that can wipe the file out. But the problem is that when I login with that user, if I call the script with the script command, the forked shell is always sh and not rksh. I know that if SHELL is not set, then the forked shell will be /bin/sh by default, but I have SHELL setup properly. How do I ensure that the forked shell is rksh only?
If I comment out the call to the logger from .profile, then I get a rksh shell. But even then if I manually issue the script command, it launches sh. Any help will be appreciated.
Thank you,
I've an application that is published on meteor hosting using command :
meteor deploy spyermeteor
The application is rendered on http://spyermeteor.meteor.com but no data is used on client side.
I can see that application is running well on server-side if i do a :
meteor logs spyermeteor
I then check the browser console and i see that i can access database :
Annonces.find().count() // per exemple
How do you explain that reactivity doesn't work on client-side ? maybe something is wrong with my conception but on my computer (windows) and on a VM (Linux debian) it works well.
Any help is welcome.
The source code is available here http://www.github.com/Rebolon/spyerMeteor
In production mode all files are concatenated and minified into one javascript file. If there is even a slight syntax error somewhere in your code the rest of the code will not execute.
Looking at your deployed site you have to split your client and server side code. I receive an error
Uncaught ReferenceError: Npm is not defined
This is meant to only run on the server but the code where you use Npm is being run on the client when it should only run on the server. It would also cause an error in production mode but since the files are not concatenated & minified the error wouldn't stop other javascript files from running.
You can either move this code to a file in /server or into a if(Meteor.isServer) {..} block
It also looks like your code is made for <= Meteor 0.5.9. You should upgrade your local instance to 0.6.2 and look for all these exceptions in your js console before you deploy your app.