Execute a Script When XCode Runs My App - ios

I have an iOS application that relies on a web server to keep track of information like players and games. Is there some way I can have XCode restart the server every time I start the app in the simulator? I am using Django so starting the server involves one terminal command.

Go to you target settings and add a Build Phase.
You can set an arbitrary script that runs at every build.
Here's an example taken from one of my projects:
Simply click on the Add Build Phase icon on the bottom right and select Add Run Script.
As you can easily find out by yourself, you can specify the shell to run the script into, as well as other handy options.
In your specific case a simple oneliner
python manage.py runserver
would probably do the trick

Related

Electron builder works on development but not on install

I'm trying to follow other people who had a similar issue like this one
Electron-Builder include external folder I wish i could be more specific on what my problem is, the reason is that i dont know whats wrong.
I am making a react app which has a server with an sqlite db and im trying to use electron.js to make it into an installable/executable
here is my dummy repo https://github.com/Juan321654/electron_react_with_build_installer_sqlite_db the master branch was just how to make electron work with react, the server branch is the one that i need help with
you can clone and just do npm i, npm run start to launch executable. npm run build to build
the code works fine in development mode and even after i make the build project with electron i can launch the executable and it works fine and it reads the data from the database, but as soon as i take the dist folder out of the project to send to someone or install the software, it stops working and it loads the app, but it does not read the data from the server/db, I am not sure if its missing node modules or the server folder, or maybe if im missing some kind of command in my scripts in the package.json?

How to run an MSIX installed application from the command line

I have an application packaged and signed as an MSIX, it installs and runs from the start menu. I'd like to be able to run the application from the command line too, for automated testing, but I can't see a way to do it. From powershell the docs suggest Invoke-CommandInsideDesktopPackage, but that requires developer mode which I'd rather not enable on test machines, and also is not the same as just running the app. What I'd love is a simple command line command that starts the app in the same way that the start menu does it.
By design, the binaries from an installation folder of an MSIX folder are not directly accessible through their direct path.
The correct way to run an app from the command line from an MSIX package is with the use of an execution alias. The following article contains more details about how an execution alias works and how you can define it in your package, no matter the tool you use to build the MSIX package.
- App Execution Alias
Also, here is a related question on SO.

How to run a Dart Console Application?

I just follow https://www.dartlang.org/docs/dart-up-and-running/ch01.html to run a Dart console application,but the result is ‘HTML file could not be found’.
If you want to know how to start it from DartEditor, just right-click the file in the Files view and choose Run. If you click the Run button in the toolbar, probably the previously launched file is launched (didn't use DartEditor since 1/2 year)
If you want to launch it from command line just run dart bin/main.dart

Eclipse freezes when erlide tries to run

I'm just getting started with erlide, using a fresh install of Eclipse Juno and erlide. I've used erlang on my system (64-bit Fedora) from the command-line, so I'm just trying to make the switch. I started with R15B, and have upgraded to R15B02 (built from source) as suggested by another SO post. If I right-click on a .erl file and pick Run As..Erlang Application, the IDE freezes and I have to kill it. If I try to run from Run Configurations and specify the module and function, it will start to execute, but never progresses beyond 27%. This is on a simple function that runs instantaneously on the command line.
Please try with the latest nightly from http://erlide.org/update_nightly, we did some work about similar issues, I hope they will solve yours too.
It would help to see the log from /erlide.log.
You can also open the launch configuration from run->configurations and see if there is some weird value in any of the fields in the "runtime" tab, most probably the node host name.
[I will be away for a week or so, so I can't answer very soon. Sorry about that.]
/Vlad

Trigger.io continuous development

I'd like to know if there is any way to develop continuously with Trigger.io and avoid the forge build step with every file change I want to test in my browser or simulator.
I was faced with the same problem and I've got a working solution that uses watchr and watch to automatically rebuild each time I make a change to a source file. If you are running a "web" version of your app you can make a change to a source file and go directly to your browser and see the effect of your changes fairly quickly depending on how long the build takes.
Prerequisites: Ruby, watchr, Unix 'watch', and a terminal.
gem install watchr.
create a new ruby file for watchr to know what files to monitor and what to do when it sees a change. I named my file 'my_watch.rb': https://gist.github.com/3153167
open two terminals. Terminal 1 will run watchr and Terminal two will run 'forge build ...'.
In terminal 1 run 'watchr my_watch.rb' making sure the path to my_watch.rb is correct and make sure you've edited my_watch.rb according to your setup so that the path inside watch(...) reflects the files to be watched. My example watches all files in the same directory (and beneath) as the my_watch.rb script. You can place my_watch.rb in the 'src' folder of your Trigger.io app if you want to match my example and run watchr my_watch.rb directly from the src folder. Also not the shell command and path in the block need to be updated to reflect your environment. Again, in my example 'my_watch.rb' is inside 'src/' so when a change is detected we go up one directory and call 'forge build'.
I tend to develop actively with the 'web' version of my app so I can just open terminal 2 to my forge project directory and 'forge run web'. When I am testing in simulators and on devices, yes I have to run forge build every time I want to see a change. However, I typically don't have to wait for forge build to finish because watchr kicked off the build as soon as I made a change and it happens pretty quickly.
I know this is not an ideal solution but so far developing new features in the 'web' version first and then implementing in mobile versions has been very smooth for me. I've never needed to kill the 'web' version after a build but I maybe just lucky. As for running build each time you want to test the mobile versions if you are good with your keyboard shortcuts it really isn't bad at all. XCode makes you build and run after changes are made to source code when creating native iOS apps so I don't think Trigger is unique in requiring this build step.
I hope this helps and that my answer isn't too specific to me and my setup.
The build phase makes some changes to your source to enable the forge.* APIs - therefore, trying to just use the raw files in your src directory won't work.
You may be tempted to change files directly in the development directory, but this is a pretty bad idea: we delete those files with impunity when we need to!
We have plans on our medium-term roadmap to add a file-system watcher to start builds automatically when changes have occurred.
In the meantime, I just use forge build && forge run PLATFORM which tends to only take a few seconds...
while not perfect... this works for me.
go into development/web
rm src
link to your root src, ie ln -s ../../src src
copy the all.js from the web/forge and add to your index.html
ie
start nodemon web.js
open in browser.
note you will need to comment out the all.js script tag for non web builds.

Resources