I'm working in code generator project with the use of Xtend2. I want to use global variable. Right now I'm using map for that purpose. Is there any possibilities to declare global variable instead of map?
It's not entirely clear to me what a global variable means to you. You could use a static field in a class and access that, but in general I'd recommend to avoid these patterns and pass the necessary state into the methods that need it or hold it as local state in the instance that needs it.
I'm trying to override the graph.set-vertex-id configuration in Titan 1.0.0
By loading the configuration from an xml file:
cache.db-cache-time = 180000
cache.db-cache-size = 0.25
graph.set-vertex-id=true
storage.batch-loading=true
....
I'm getting the error :
Local setting graph.set-vertex-id=true (Type: FIXED) is overridden by globally managed value (false). Use the ManagementSystem interface instead of the local configuration to control this setting.
I also tried
BaseConfiguration configuration = new BaseConfiguration();
configuration.setProperty("storage.hostname", "any_hostname");
configuration.setProperty("storage.backend", "thrift");
configuration.setProperty("graph.set-vertex-id", Boolean.TRUE);
titanGraph = TitanFactory.open(configuration);
But by checking the config with TitanManagement
titanGraph.openManagement().get("graph.set-vertex-id");
I can see that it's still 'false'.
Has anyone tried to assign custom vertices ids in this version of Titan? Before the upgrade we used Titan 0.4.2 and it worked just fine.
The documentation (http://s3.thinkaurelius.com/docs/titan/1.0.0/configuration.html ) says that
GLOBAL: These options are always read from the cluster configuration and cannot be overwritten on an instance basis.
FIXED: Like GLOBAL, but the value cannot be changed once the Titan cluster is initialized.
When the first Titan instance in a cluster is started, the global configuration options are initialized from the provided local configuration file. Subsequently changing global configuration options is done through Titan’s management API.
To access the management API, call g.getManagementSystem() on an open Titan instance handle g. For example, to change the default caching behavior on a Titan cluster:
mgmt = graph.openManagement()
mgmt.get('cache.db-cache')
// Prints the current config setting
mgmt.set('cache.db-cache', true)
// Changes option
mgmt.get('cache.db-cache')
// Prints 'true'
mgmt.commit()
// Changes take effect
Firstly, there is no getManagementSystem() on a graph in Titan 1.0.0. Secondly, overriding the "graph.set-vertex-id" config like that will throw another error, because at this point the graph is already initialised:
Cannot change the fixed configuration option: root.graph.set-vertex-id
Thank you !
I am trying to configure a key store in the Play server.
I was able to do this sucessfuly by define command line paramters Dhttps.keyStore and https.keyStorePassword as shown below.
... -Dhttps.keyStore="C:/tempKS/myserver.jks" -Dhttps.keyStorePassword="xxxxx" ...
My question is how to define these two properties in the application.conf instead of passing as parameters at the command line.
I tried this in the application.conf but server didn't pick those values.
https.keyStore="C:/tempKS/myserver.jks"
https.keyStorePassword="xxxxx"
Take a look at https://github.com/typesafehub/activator-play-tls-example/blob/master/app/https/CustomSSLEngineProvider.scala and set it to read from the application's Configuration object.
My problem is every time after changing the Liferay portal-properties (and this is frequent especially at beginning of a new portal project) I need to restart the whole portal.
Some properties I can set over hook and these values will be changed after redeployment. Also that must be possible to change most portal properties at run time.
However, do you know some approach to reflect changes in portal-ext.properties without restarting Liferay portal?
As stoldark mentioned, this is not possible in a production environment at all. Since portal.properties's properties are loaded at portal start-up.
But for development you can use a tool like JRebel, some steps to configure it here. The only issue you would get with this tool is that it is paid ;-).
I know it is a very old thread but it may be helpful for someone who is looking for some type of work around
As we know there is no straight forward way for this but I did this by using java reflection and class loader.
Liferay Version : 6.x
//Loading the PropsUtil class by using PortalClassLoader
Class<?> prospsUtilClass = PortalClassLoaderUtil.getClassLoader().loadClass("com.liferay.portal.util.PropsUtil");
//getting the reload method of PropsUtil class
Method reloadMethod = prospsUtilClass.getMethod("reload", null);
//Invoking the static reload method
reloadMethod.invoke(null, null);
Reload method (re)loads the portal-ext properties to the portal so we can use new properties without restarting Liferay server.
This has also been asked in Liferay forums:
https://www.liferay.com/community/forums/-/message_boards/message/800954
But I am afraid that most properties are only read once during portal startup.
Usually, the use of a properties file as in this case has this drawback.
There's even an issue open at Liferay about this, but is still unresolved:
http://issues.liferay.com/browse/LEP-5579
If you create a hook to override portal properties, you will be able to change properties with just deploying the hook without restarting the Portal.
Be aware that you cannot modify all properties with a hook. For a list of the ones that you can modify, check out: https://docs.liferay.com/portal/6.2/definitions/.
I've just searched for reloading portal-ext.properties and landed here.
Ok - not a feature in Liferay.
So I'll use an old trick I like:
place custom properties in (liferay-tomcat-home)/conf/filename.properties
reload them whenever you want by
Properties customProperties = new Properties();
customProperties.load(new FileInputStream(new File(System.getProperty("catalina.base"), "conf/filename.properties")));
I must confess I haven't tried this in a Liferay-Portlet-Environment, but this system property ("catalina.base") should be available in this context, at least by using some Liferay-Helper-Class.
Some of the Liferay classes read their properties when initialising static field constants. E.g.:
public static final boolean ENABLED = GetterUtil.getBoolean(
PropsUtil.get(DynamicCSSFilter.class.getName()));
Basically, it is possible to reload the properties (eg via script in control-panel), but all those static constants will remain.
I started up my local MYSQL server with the shared memory protocol turned on.
How can I connect to my server with ZeosLib? Where do I specify that it is using shared-memory?
I am using Lazarus(freepascal), although the directions would be the same for Delphi (probably).
Even if the TZConnection has no connection string property you can set the additional connection parameters in TZConnection.Properties.
I presume you run your MySQL server this way
mysqld --skip-networking --shared_memory=1 --shared-memory-base-name='MyMemoryDB'
To enable your shared memory connection you might try to add the following configuration lines into the property TZConnection.Properties at design time in Object Inspector.
Note that the protocol must be set as it is and shared-memory-base-name to the same value as you used in the command line parameter. The default value is MYSQL so if you omit the parameter in command line then you should change the following MyMemoryDB values to MYSQL.
So in TZConnection.Properties property try to add these two lines
protocol=memory
shared-memory-base-name=MyMemoryDB
or at runtime in the TZConnection.BeforeConnect event handler use
procedure TForm1.ZConnection1BeforeConnect(Sender: TObject);
begin
ZConnection1.Properties.Add('protocol=memory');
ZConnection1.Properties.Add('shared-memory-base-name=MyMemoryDB');
end;
Hope this will help you somehow. I haven't tested it because I don't have the proper environment.
IF ZeOS support it, it is probably a textual property that can be added to the (TZ)connection options. Just like other clientlib properties.