How to switch a L10N Bundle in running state in CN1 - localization

How can I switch the language and refresh the gui in the running state of my application (without having to restart the application)? I already know how to affect the gui components which contain keys from a managed l10n bundle in a initVars call but not how to do it afterwards.
I'm using the following 2 lines to determine the bundle initially:
Map h = res.getL10N(L10N_BUNDLE_NAME, lBundleKey);
UIManager.getInstance().setBundle(h);

There is no way to refresh a Form that's already created as the values were already extracted from the bundle. Apps that do that recreate the Form e.g. if I have a method such as showSettingsForm(), I'd just invoke it again when changing the language and it will update the Strings.

Related

Passing command line arguments to electron executable (after installing an already packaged app)

I'm trying to pass command line arguments to my already packaged app on execution.
(Already packaged with electron-builder and installed the .dmg on my mac)
I navigated into the /Applications/myApp.app/Contents/MacOS folder where the application executable is located. Then i run.
exec myApp --myNewArgument theFancyValue
For some reason "myNewArgument" does not appear in my process.argv array.
Am i missing anything? I thought the arguements will automaticly be passed to my electron main process.
I am thankfull for any help.
Yes, the passed command line arguments appear in the process.argv array, but only from the main process.
From a renderer process, you'll need to access the main process arguments using remote.process:
require('electron').remote.process.argv
https://www.electronjs.org/docs/api/command-line states that
(commandLine.appendSwitch(...)) This will not affect process.argv. The intended usage of this function is to control Chromium's behavior.
As such, only the appp.commandLine.getSwitchValue as mentioned in other comments allows you to get these command line switches
In addition to the use of switches as command line parameters, the use of arguments is also supported. Arguments take the form of "someData" in the final command line, where switches take the form "--namedParameter=someData".
In code, commandLine.appendArgument(value) is used to add the argument. These arguments are given before all switches in the generated command line.
They are also intended to affect Chromium's behavior. Again:
(commandLine.appendArgument(value)) Note: This will not affect process.argv. The intended usage of this function is to control Chromium's behavior.
Since there is no key for the parameter, there does not appear to be a way to directly read it from code as there is with a switch.
https://www.electronjs.org/docs/api/command-line-switches gives a list of supported switches.
In case of packaged source of electron app, command line arguments can be accessed using following function. Let's say if we have passed the command line argument as --myNewArgument=theFancyValue. It can be retrieved like this in the main.js:
import { app } from "electron";
app.commandLine.getSwitchValue("myNewArgument");
This works for development mode as well.

How to deploy App to Apple Store with repopulated database(SQLite)?

I am developing my mobile app using react-native, and database goes with it, I am using SQLite storage.
The way I work with it:
create it using python script and copy it to path where virtual device takes.
Obviously I need somehow to bundle it within my app in order to run on real device?
I have 2 options in mind:
1. Keep state of app using AsyncStorage, where to store isDBCreated
variable, so we creat DB from json file that is shipped with the app
only once and then use it on consequent runs
2. Somehow bundle created DB
With 1 - I am confident and know how to do it
With 2 - don't know ( I have followed official documentation in order to bundle it on IOS, but without luck)
From your experience, what is the best way to bundle database?

Detecting Quick Access command state

We have an application that is using Windows Ribbon Framework for an UI. The app itself is written in Delphi and uses Windows Ribbon Framework for Delphi to interface with the ribbon API.
Our ribbon XML places few commands into the Quick Access toolbar. Use can then remove/add commands either by using the built-in ribbon mechanism (selecting the drop/down button and clicking on a command name) or by selecting More commands command which opens the configuration dialog.
The problem I've encountered is that I cannot find a way to get the current state of commands in the QA collection (whether they are visible or not).
In the example above (picture) I would like to detect that first five commands are checked and that the last is not so I can prepare the configuration dialog accordingly.
I have no problems enumerating the IUICollection and accessing the items stored inside. I can also get the UI_PKEY_CommandId for each item. I cannot, however, find a way to read the checked/unchecked state. I tried reading UI_PKEY_BooleanValue and UI_PKEY_Enabled for all items in the collection, but they do not return that state.
I have also tried to monitor IUICommandHandler.UpdateProperty but it doesn't get called when such item is checked/unchecked (except that it is called with the UI_PKEY_Label key).
Does ribbon API even support this functionality?

Advanced Installer: Stop installer from clearing temp files on upgrade

I have run into an issue while going through the process of getting Updating to work.
The update method used is to do an uninstall and then install.
My problem is as follows:
I have several custom actions which rely on files in the Temp folder, and these all run perfectly well on a clean install.
When it comes to updating however, the custom actions fail, as it seems the Temp files have been removed as part of the AI_RemoveAllTempFiles action
This action seems to be getting done after install initialize and after install finalize.
Is there a way to turn off the removal of temp files on updating, or should I just remove the AI_RemoveAllTempFiles action that is being done at install initialize?
I have attempted to use the OLDPRODUCTS property to try and stop the AI_RemoveAllTempFiles action but it doesn't seem to have worked. By this I mean I have modified the InstallExecuteSequence table to have a condition of OLDPRODUCTS ="" for AI_RemoveAllTempFiles entry
What I suspect that happens is that the old version of your application removes the temporary files, not the new one. i.e. it does this when its uninstall is triggered by the standard action RemoveExistingProducts from the new package. You can see this in a verbose log easily.
To avoid this problems during updates, you should have the temporary files added in a subfolder from Temporary folder. This subfolder should have a unique name for each version, for example you can set it to be [|ProductCode].
In your custom actions, to make sure you always get the correct path of the temporary files use their corespondent properties, i.e. each temporary file has associated a unique property, visible in the dialog appearing when you double click the file in Files and Folders page, this property resolves to the full path of the file.

Grails - override message bundle property at runtime

Is there a way to override at runtime the value of a property defined in a message bundle?
My grails application contains a property in the messages.properties file:
page1.para1.text=Some text to display to the user
My Config.groovy defines the following config location:
grails.config.locations = [ "file:${userHome}/.myApp/myApp-config.properties" ]
I currently use this approach to override Config.groovy properties (like db connections, etc), but it doesn't seen to apply to message bundle properties.
I was hoping/expecting to just make sure that the myApp-config.properties file contains my new property value, restart the Tomcat server where my app is deployed and it would get picked up and displayed on my page:
page1.para1.text=Some DIFFERENT text to display to the user
Grails docs on Internalization/Message bundles grails i18n doesn't suggest if this is possible or not.
Obviously, I'm trying to achieve this change without the need to recompile and redeliver my Grails application.
Any ideas?
Thanks in advance.
When you are already live and don't want to create a new .war file:
I'm not sure, but the .war file can be found unzipped on the server. You might try to replace the message files directly on the server, but a restart of the app might be necessary. But I wouldn't advice doing so.
If you need to often change the message bundles at runtime, I guess it would make sense to store them in the database. But that means that you have to change your code a little bit and redeploy it once. There is a blog entry which describes how to do it: http://graemerocher.blogspot.de/2010/04/reading-i18n-messages-from-database.html
Another SO question handles the case that you want to store changes to the messages in a DB but fall back to the files:
Grails i18n From Database but Default Back To File
hth
In theory you should be able to replace the messageSource bean with a ReloadableResourceBundleMessageSource inside Resources.groovy. This way you can not only point it to a new location but also declare how often they should be invalidated as cached values.

Resources