iTunesLibrary Swift 5.3 macOS - swift

After reading the documentation and looking through the header files of the iTunesLibrary frameworks I am unable to determine how, or if it's even possible, to manually specify the iTunes/Music library file to read?
The documentation within the header files indicate the system dynamic library loads the 'Default' library. The only way I have found so far to load another library is to use the +click method to manually choose the library to be used, then quit the Music app and the last chosen library become the default.
Is there not a way to specify a file? The mediaFolderLocation and musicFolderLocation methods are defined as 'get only' methods.

After lots and lots of research I have determined there is not a way to specify the particular library you want to open. It automatically refers to the system 'default' library.

Related

Unable to select pre-registered files types using UIDocumentPickerViewController with with pre-iOS 14 target

I'm using a document picker to import data into an app. One of the files to import is a .GPX (it's actually an XML file of GPS data, but that's not relevant). I define a custom file type (as it's not covered by the standard file types covered within UniformTypeIdentifiers)
let documentsPicker = UIDocumentPickerViewController(documentTypes: ["com.sourceapp.gpx"], in: .open)
and register it in info.plist as a Document type, and include this in Exported type identifiers and, seeing as it is not a bespoke file type, in Imported type identifiers. These are all still required as the app target is pre-iOS 14 (for 14+ it's not necessary to add the items to info.plist).
This works fine in the simulator where it's a clean environment without any other apps installed. On a device however it doesn't work, and the file is greyed out and not selectable. I'm reasonably certain this is because a custom file type with the same extension is already registered by another app.
So how do I go about using a file type that has already been registered? There must be a "correct" way to go about this as it must be a common scenario.
My understanding was that this is what the Imported type identifiers was for, but I can't seem to get this to work. This may be because I'm not defining the imported type in exactly the same way as the first app to register it.
If so, how do I see what has already been registered, and reuse it? This would need to be a generic apprach as a scenario where a different app has already regsitered the file type but in a different way is highly likely for a common file type such as .gpx
As background, when using a pre-defined file type such as "public.comma-separated-values-text" for a CSV file all works fine.
UPDATE:
I've since seen as the bottom line of documentation that the exported type identifiers overrides imported type identifiers, so have tried deleting the exported one, butit makes no difference.

Is it possible to download and execute an uncompiled dart file (Flutter)

I am trying to make an extension based app, where you can download extensions to the app to add features/widgets. Could I somehow run an uncompiled dart file downloaded from a server that stores the .dart files?
download(file.dart)
compile(file.dart)
storeInPersistentDirectory()
if (dartFile.exists) {
ClassFromDownloadedFile.sayHello()
}
The aim is to decrease the app size by storing all of the data related to an extension in the dart file, (classes, json and images in the form of a string...). Users might want to download features, while some don’t need them, in which case they shouldn’t need to download a large app with many features that they will never use, so the initial app size remains small.
Thank you for anyone who knows anything relating to this in advance!
No, it is not possible. You can download a 'resource' such as image/video/mp3 etc. You can even download the dart file but can't compile and execute.
there is a concept in dart and other modern languages called reflection(mirroring).
Reflection allows us to examine and modify the structure and behavior
of a program at runtime.
search about it and check the below links for more information.
dart document
Understanding Reflection and Annotations in Dart
I recommend searching for RMI too.

GWT Properties file configuration

I am new to GWT, and facing one problem.
How we have .properties file for initial configuration at startup.
I want to create one in GWT App.
Also, GWT has client and server package.
I want to setup the configuration at client package because all configuration belongs to client side.
My actual need,
I have one textArea which takes up only fixed number of characters and length is defined in my properties file like below.
So I have to read a properties file for validation.
my.properties
smsConstraintEnabled=true
smsConstraintCharLimit=160
I found few link but all are talking about properties file regarding Locale, I don't have any need on Locale side but need simple key-value configuration.
I want this file to be loaded at startup or at Entry point itself and then I can use it at any client package classes for my validation.
Thanks in advance.
Use a Constants interface. It's built with I18N in mind but will work just as well in this case, where you provide the constant values for a single locale, the default one (therefore used for every locale you'll compile your app with).
That however means the file is read at compile-time, not runtime (i.e. you'll have to recompile your app each time you change the properties file).
If you want something more dynamic, then read the file on the server-side and pass the information to the client-side. Easiest, and with minimal overhead, is to use a dynamic host page. To read the values in your client code, then either use a Dictionary (and Integer.parseInt et al.) or use JSNI (possibly with an overlay type).

Deploy GWT Application as Single JavaScript File

The compiled JavaScript output of a GWT application is divided into various files, for instance
*.cache.html
*.gwt.rpc
hosted.html
*.nocache.js
...
I know this is done with the purpose of minimizing the size of the JavaScript, which has to be downloaded by users. For instance so that a Firefox user does not have to load the JavaScript specifically compiled for IE6.
However, especially for small GWT applications it might often be faster to download a single file of say 500kb rather than make two sequential requests first for the 5kb *.nocache.js script and then for the rest of the app (cache.html files, etc.).
This leads me to the question: Is there any framework or procedure to bundle the output of the GWT compiler into a single JavaScript file?
First, you can merge all permutations in a single file by using so-called "soft permutations".
Then, you can inline your *.nocache.js into the HTML host page (e.g. using a JSP's #include directive) to cut one additional request (you might have to add a <meta name=gwt:property content='baseUrl=myapp'> where myapp is the subfolder where the .nocache. files are located).
AFAIK that's what Google are doing for their GWT apps.
Alternatively, you can run the permutation selection on the server-side if you can totally replace the selection script (*.nocache.js) with server-side content negotiation (based on User-Agent and Accept-Language request headers for instance) that can directly generates a <script> tag for the appropriate *.cache.js file (provided you use the xsiframe linker).
AFAIK, Google use all these techniques for their GWT apps (such as Google Groups). For a small app, though, I'm not sure it's worth the effort…
Also, the last two techniques work best when your HTML host page is already dynamic and therefore already non-cacheable; otherwise you're mostly moving the problem, not solving it.
I wonder whether the sso linker can be used when you collapse all properties and soft-permutations down to a single hard permutation.
Yes, but it's maybe not something you want. See this answer: https://stackoverflow.com/a/4453716/66416 to this stackoverflow question: Merge GWT generated files.
I found another way to accomplish this: Writing a custom Linker for GWT. Two examples for linkers which compile into a single JavaScript file are:
GwtNodeLinker.java from Gwt Node project
ServerSingleScriptLinker.java from Env.js project

Write setting.bundle in runtime

I can write at design time a setting bundle, but I need to make its content appear according to certain condition
can I do that , if yes any sample code, and where to put this code
Best regards
You can't dynamically create a Settings.bundle and write it out while your application is running on the iPhone. It needs to be included in the code signed application package.
What you can do, though, is customize your already created bundle's content & UI based on those certain conditions. E.G. different preferences load different strings or graphics.