I'm using Preference Loader to load my custom settings into the settings app. I would like to know how to make the device respring from my Preference Loader settings panel. Please help me.
Thanks in advance.
Ive tried system("killall SpringBoard"); but nothing happens.
There's probably many ways to do this, but one way is to take advantage of the same technique I used in this answer. Essentially, the problem is that you're not issuing the command with sufficient privileges.
You can get the privileges you need by moving the killall SpringBoard command into a command script that gets run by SBSettings' privileged daemon.
See reference document here, under Calling External Functions and Scripts ....
You would make an executable script named (for example), com.mycompany.respring. In that script, add
#!/bin/sh
killall SpringBoard
and save it under /var/mobile/Library/SBSettings/Commands. Then, from within your preference bundle's PSListController, you would add this code:
#import <notify.h>
and
notify_post("com.mycompany.respring");
Posting that custom notification will cause SBSettings' daemon to run the script file of the same name. Of course, this forces your package to depend on SBSettings (which you can do by placing this in your package's DEBIAN/control file):
Depends: preferenceloader, sbsettings
... but as it's free, stable, and widely used and loved, that doesn't seem like a big limitation.
Related
I want to distribute a Flutter desktop app outside of App Store. The app includes some extra binaries using the assets key in pubspec.yaml. The binaries end up in this directory inside the app:
flutter_sample.app/Contents/Frameworks/App.framework/Versions/A/Resources/flutter_assets/bin
So that's what I use with Process.run(...) and it works locally. However, if I try to notarize the app in Xcode and export it then app will crash immediately when trying to run an included binary. I opened Console and found the following entry in launchd.log corresponding to the time the app crashed:
2022-01-07 08:28:04.875197 (gui/501/application.com.example.flutterSample.1772919.1772925) : removing job: caller = runningboardd
2022-01-07 08:28:04.875204 (gui/501 [100020]) : removing service: application.com.example.flutterSample.1772919.1772925
2022-01-07 08:28:04.875309 (gui/501/application.com.example.flutterSample.1772919.1772925) : internal event: PETRIFIED, code = 0
2022-01-07 08:28:04.875311 (gui/501/application.com.example.flutterSample.1772919.1772925) : job state = removed
I wasn't able to find any other information about the error. If I enclose the code using Process.run in a try-catch block it doesn't change anything, the entire application crashes anyway. The same happens if I use a zone or onError handler as described on the handling errors page in Flutter docs.
Extra details:
I've disabled com.apple.security.app-sandbox in the *.entitlements files, with it running the processes didn't work even locally
I've enabled hardened runtime in Xcode, it was required to notarize the app.
the app also crashes if instead or exporting from Xcode I plainly archive the build directory (with tar) and send it via internet (or set com.apple.quarantine with xattr). It won't crash if I just pack and unpack it without marking it as quarantined. That makes sense but I expected that notarizing the app would fix it.
So, what can I do to prevent these crashes, or at least get more details when they happen so I can investigate further?
As it turns out, it was an issue with paths. If I go to my project directory and then enter the debug build directory:
$ cd build/macos/Build/Products/Debug
then from this point I can access two identical asset directories:
$ ls -lh App.framework/Versions/A/Resources/flutter_assets
(output omitted)
$ ls -lh flutter_sample.app/Contents/Frameworks/App.framework/Versions/A/Resources/flutter_assets
(the same output, omitted)
As it turns out, I was actually trying to call the binary in the first asset directory (even though I posted the second one in the question). And apparently the other one is correct when the app is packaged for distribution. After changing this the binaries work in the exported, notarized app.
Try to firstly copy your binary from assets folder to somewhere else. Let's say copy to /tmp/myfile. Then ensure you have executable permission to it (chmod +x /tmp/myfile using shell; should have sth similar using code). Then execute that binary.
This is a common practice, at least for platforms like Android. Because in android, an asset does not have a "normal" path so you have to copy it out, IIRC.
If this method works, it is great; even if not, now you can manually call /tmp/myfile in a shell to see what is happening.
I have the following instruction in I need to perform to run a web app I that have received:
"Go to the directory where the app is unpacked and type 'gradle jettyRun'."
Sounds simple enough, if you know the commands for finding out your current directory and changing it. The problem is, searching for these basic things only nets a huge amounts of irrelevant answers to much more advanced questions where the same terms are used with a slightly different meaning. So what do they exactly mean by what they say and how do I achieve that? It sound's so simple I'm almost embarrased to have to ask it, yet I'm still dumbfounded by the MySQL command line enough to have to.
This has nothing to do with the MySQL command line (>>>), or MySQL itself. This is simply saying:
Open your terminal or shell. In Windows, this is called Command Prompt.
Change the directory to where the files are located, you do this with the cd (change directory) command.
Next you simply type gradle jettyRun.
I can't run my ipython notebook with the --read-only option.
It says :
[NotebookApp] CRITICAL | Unrecognized flag: '--read-only'
It's weird because I've seen several blog mentionning it.
I'm running with the 1.1 version of ipython.
Do you know if this option was removed or moved elsewhere?
There is a super easy way to do what you're trying to do I think though--simply use OS security.
Do this:
When you're ready to deploy to read only, make a special folder
for your read-only work, and copy your *.ipynb files into that.
Make the *.ipynb files read-only at the Linux level: chmod 444
*.ipynb.
Run iPython Notebook from that directory. Use a different port
so that it won't conflict.
Send the URL to everyone using the URL that has the read-only
port.
They can then read it all, even run code, but they will not be
able to save changes.
They cannot navigate anywhere outside that directory. E.g. the
little home icon only brings them to the folder with your read-only
content.
Thus they have full access to the page and its functionality, but
cannot mess it up on anyone else. And all you need is a cp and a
chmod. Profit!
At least this solved my need. I have my regular port with write authority for all my development, then I copy it over, chmod it, and let people at it. Works just fine for me.
Hope this helps others!
Yes the option was removed, it might be re-introduced in another form later when nbconvert/nbviewer is refined, but you better run your own local instance of nbviewer to this effect.
If I compile a script for distribution as a standalone exe, is there any way I can store settings within the exe itself, to save having to write to an external file? The main incentive for this is to save having to develop an installation process. I only need to store a few bytes.
Also, can resources such as images be compiled into the exe?
Using alternate data streams opens up a can of worms so i wouldn't go that way. Writing back config data into the exe itself won't work as the file is locked for write access during execution.
What i usually do is to store config data under %A_AppData%\%A_ScriptName%\%A_ScriptName%.ini
When the script starts i use IniRead which also provides a default value if the key isn't found - which is the case the script is executing for the first time.
The complementing IniWrite's in a OnExit subroutine/function will create the ini file if necessary.
This way no installation is needed and the config is stored in the proper, familiar place.
The autohotkey forum has dealt with this question before.
In that case, the user didn't want extra files -- period.
The method was to use the file system to save alternate data.
Unfortunately I can't find the post.
A simpler method is to use fileinstall command.
When the script is compiled, the external file is stored within the exe.
When the script executes the same command as an exe, the file is copied to the same
directory as the running script. It is a simple yet effective 'install'.
With a little testing for the config file, the fileinstall command can be skipped.
Skipping the fileinstall could allow changes to be made to the configuration after 'installation'
I have not tried saving settings within the compiled exe file, but I have included resources. I'm not sure which version of AHK you're using or how you are compiling, but I can right-click my scripts to compile. There's an option to compile with options, where you can include resources in your compiled exe.Compile with options
I want to include the Application Loader process in a software installation, to ensure that users get our software installed on their Blackberry by the time our installer software finishes.
I know this is possible, because Aerize Card Loader (http://aerize.com/blackberry/software/loader/) does this. When you install their software, if your Blackberry is connected the Application Loader will come up and force the .COD file to install to the device.
I can't make it work. Looking at RIM's own documentation, I need to:
Place the ALX and COD files into a subfolder here: C:\Program Files\Common Files\Research In Motion\Shared\Applications\
Add a path to the ALX file in HKCU\Software\Research In Motion\Blackberry\Loader\Packages
Index the application, by executing this at the command line: loader.exe /index
Start the force load, by doing this: loader.exe /defaultUSB /forceload
When I execute that last command, the Application Loader comes up and says that all applications are up to date and nothing needs to be done.
If I execute loader.exe by double-clicking on it (or typing in the command with no parameters), I get the regular Application Loader wizard. It shows my program as listed, but un-checked. If I check it and click next, it will install to the Blackberry. (This is the part that I want to avoid, and that Aerize Card Loader's install process avoids.)
What am I missing? It appears that the Aerize installer is doing something different but I haven't been able to ascertain what.
You can do it easily with the following command:
C:\RIM\JDE_4.7.0\bin\JavaLoader.exe -u load <.cod file>
With this command you don't need an alx at all, just the cod file. Look at JavaLoader usage help to see full options.
JavaLoader.exe can upload one code file. What about two or more cod files?