Can someone tell me or point me to some documentation regarding Checkstyle custom checks and accessing property values?
My custom class needs to obtain a regex file the users supply. Can they supply this file as a property in the Checkstyle .xml config file? If so, how does my custom Check class read the value of the property?
thanks.
I found a way around this problem. Just set a java Property using -Dpropertyname=propertyvalue, then in the custom class get the property value.
Related
Is it possible to replace the location property of the Parse Template? Instead of hardcoding in the location like so
Is it possible to replace this with a variable value that points to a path at runtime?
i have tried replacing the location with a variable but the project then fails to deploy because it cannot find that path. When the POST request comes in it states what file it wants parsed. Then we would ideally like to tell the parse template to go fetch that file but thus far i cant see anything that could help me online
Any suggestions would be very helpfull
I don't think it is possible to use an expression in the location attribute. Note that in the screenshot we can see that it is missing the Fx button to switch to expression mode, like the the Target Value attribute has.
I'm looking for a way to read the Name property of the .NET Attachment.Content Stream I can see the property when I setup a watch, but when I try accessing I don't see the "Name" property show up. I need to get the file location with the "C:\Test123.pdf", I've found a way to get the file name...but I need its location/path.
I want to define a number of xml formatted strings in resource file and use the strings in qml code. Is it possible? How to do it? I would be really appreciated any example.
As I know there is no way to store strings in resource file. But you still do that in another way.
First way: create language file with qt translation tool. As bonus you can store string in several languages.
Using in QML is very easy:
Text {
text: qsTr("myTextId");
}
See that link for more info.
Second way: store each string in different resource file.
But in this case you need to extend QML with C++ plugin to get ability to read files.
See that link for more info.
I am using a custom layout in Yii. Everything works great in the web part of the app. Then I tried to run the console part of the app to run a job and it says:
exception 'CException' with message 'Property "CConsoleApplication.layout" is not defined.' in /pathToFramework/base/CComponent.php:173
If I revert to the default layout in config/main.php it works again. I can't find any documentation on how to specify the layout only for the console application. I know I can fix it but don't want to get hacky. Does anyone have a clue about the correct wat to go about this? Thanks.
Generally you don't need to specify a layout in your config, but rather do that within your controllers if you're overriding things. That's probably why your CWebApplication can handle things (you're giving it a layout property in your config), but your CConsoleApplication doesn't allow for that property to be set.
Seems like your options are:
Specify your layout property in each controller (any reason you couldn't just use the default views/layouts/main.php?)
Specify your layout property in a config file that is only used for your CWebApplication system instead of your CConsoleApplication
Override your layout property in a config file specific to your CConsoleApplication
Any of the above should work.
We are trying to use Apache PropertiesConfiguration in our project using JSF and JBoss.
My property file is located inside a package say demo.prop by the name of Prop1.prop
Inside my WAR file the same is present under /WEB-INF/classes/demo/prop/Prop1.prop
Using
FacesContext.getCurrentInstance().getExternalContext().getResource("/WEB-INF/classes/demo/prop/Prop1.prop");
I am able to fetch the property file. So when I try to extract a string from the property file using
PropertiesConfiguration pc1=new PropertiesConfiguration(a);
String s1=(String)pc1.getProperty("User_Name");
I am able to get the proper string. Using set property method I am able to set the property also.
pc1.setProperty("User_Name", "hardcodedString");
But I am not able to save the FILE back to this location. No matter what I do it is not able to save the file using pc1.save.
Can anyone please try to tell me how can I save this file back to its original location so that the changes done in the property file remain as it is.
Modifying the WAR file is a bad idea (for example, some web servers may notice the file
modification an redeploy your app, there may be problems when the server explodes the war on deployment etc.)
I would suggest applying an alternative approach - some possibilities are:
Place the properties in a database table, so they can be easily modified
Use an external properties file for overriding your "Prop1.prop" file settings. You can pull this off for example as follows. Assume that the default property values are bundled in your WAR and the modified values are saved to some other path, which is defined using a system property - let say it's called CONFIG_LOCATION. Now after loading your properties from the bundle you read them also from this external "overrides.prop" file - this overrides your defaults from "Prop1.prop":
PropertiesConfiguration pc1=new PropertiesConfiguration(a);
try(FileReader propReader = new FileReader(System.getenv().get("CONFIG_FILES") +"/overrides.prop"){
pc1.load(propReader);
}
When you need to save changes, you do that to "overrides.prop" - this will save all
the properties, not only the changed ones, but that should have no negative effects.