In a very huge code base I found the following code snippet System.getProperty("some stuff"). I tried to look the property in some of the .properties files though i couldn't find it. Do you guys have any ideas where to look the property anywhere else in the code file system?
You might want to look into "System.setProperty" in your work space:
// Modifying a system property
System.setProperty("java.io.tmpdir","c:\\var\\tmp");
// Adding my own properties
System.setProperty("program.name","Property Test");
System.setProperty("program.version","3.01");
Related
In order to avoid duplication, I want to use several CopySpecs both for creating an EAR file and for creating the "Classpath:" entry in the manifest of one of the WARs. I wanted to simply read the contents of the CopySpecs for that, but I could not find any obvious way to do that, even after reading the code. Is this even possible from a build script? Is there a better way to achieve the same result?
Instead of a CopySpec, I used a fileTree:
def myFiles = fileTree('/files').matching {
include 'my*.jar'
}
So far, this seems to work fine for both purposes:
// ear
into('/') {
from myFiles
}
// classpath
files(configurations.deploy, configurations.earlib, myFiles)
My servlet app uses XML catalogs.
First I used org.apache.xml.resolver.tools.CatalogResolver.
It finds its configuration file CatalogManager.properties under WEB-INF/classes/.
Then I tried the same thing with com.sun.org.apache.xml.internal.resolver.CatalogManager, the version which comes with the JDK.
It doesn’t work:
Cannot find CatalogManager.properties
The spec says that this file must be somewhere on the CLASSPATH, and I suppose it is.
What should I do?
Actually, it should work, the code is the same, just repackaged:
propertyFileURI = CatalogManager.class.getResource("/"+propertyFile);
InputStream in =
CatalogManager.class.getResourceAsStream("/"+propertyFile);
if (in==null) {
if (!ignoreMissingProperties) {
System.err.println("Cannot find "+propertyFile);
// there's no reason to give this warning more than once
ignoreMissingProperties = true;
}
return;
}
What to do? Try debugging, set the breakpoint und see why it does not work.
Why do you need CatalogManager.properties anyway? If you don't, you could disable the error message with the system property xml.catalog.ignoreMissing.
If I try to write that code
Mat.CvType.CV_8UC1
I get the error CvType cannot be resolved or is not a field. What am I missing? I think I've added the correct library and DLL in the project properties because everything else seems to be working. I need to find those CV_8UC1 CV_8UC2, etc.
You can try to use CvType.CV_8UC1 insted of Mat.CvType.CV_8UC1
I am trying to run the sample openNI Skeleton Tracking application (UserTracker.java application) on a pre-recorded .oni file. I have edited the SamplesConfig.xml file to direct the input from the ONI file and not a Kinect (I don't actually have one). However, I get the following Exception. Can anybody help me here?
org.OpenNI.StatusException: Function was not implemented!
at org.OpenNI.WrapperUtils.throwOnError(WrapperUtils.java:30)
at org.OpenNI.Context.initFromXmlEx(Context.java:371)
at org.OpenNI.Context.createFromXmlFile(Context.java:36)
at UserTracker.<init>(UserTracker.java:149)
at UserTrackerApplication.main(UserTrackerApplication.java:67)
Any help will be appreciated. Thanks!
EDIT: I found a solution here, this has removed the earlier exception that I was getting, but now I get the following!
org.OpenNI.StatusException: This operation is invalid!
Anybody knows why this is happening?
I had a similar problem, I wanted to read data from a .oni file that I generated and I was getting the same issue. Now the problem is solved and maybe you solved it too, but I think it's important to share information to others that might come to this post. I found some clues in others posts by the way.
So here is the solution. The NiUserTracker sample can be used with an .oni file so I checked the code and they do the following:
xn::Player g_Player; //Global variable
// This goes in the main or another function
if (argc > 1)
{
nRetVal = g_Context.Init();
CHECK_RC(nRetVal, "Init");
nRetVal = g_Context.OpenFileRecording(argv[1], g_Player);
if (nRetVal != XN_STATUS_OK)
{
printf("Can't open recording %s: %s\n", argv[1], xnGetStatusString(nRetVal));
return 1;
}
}
This is C++ code, I work with c++. So as you can see they don't init the kinect via XML file if they want to open a recorded .oni file, they just init it via Init() method and then open a file with openFileRecording method.
If you want to open a .oni file there's no need to modify your XML, this way you can do an application that allows you to chose if you want to use a .oni or the kinect.
I hope this helps someone.
cheers.
I am using spring/hibernate application. i am using log4j for logging. the problem is i need to place a placeholder in log4j.properties file and i need to set the value to the place holder based on the environment(Dev, UAT or Production).
Environment=${environment}
is it possible? Please help me.
Thanks!
You can pass the variable and value either by command line or set environment variable like below.
-DEnvironment=dev
then you can use this in log file like :
Environment=${Environment}
Why not just use seperate keys, and pick the right one at runtime?
Environment.dev=Development
Environment.prod=Production
Environment.qa=QA
bundle.getKey(ENVIRONMENT_KEY_PREFIX + ".dev");