Using properties
Hi all,
I'm trying to list documents in a search, based on the country of the user that has logged on to the portal. Therefore I'm using the Search option set with predefined properties this is what I did:
-create a property called country (EN,DE,FR,NL, etc)
-create a search option set with predefined property: country(value=%ume_user_country%). I also tried %user.country% and a lot of variations, but it doesn't work.
-Is this possible?
-What should the values of the property country be restricted to?
-What is the correct statement?
I would also like to do this for the subscription property. same here:
-copied the cm_rnd_subscription property and made it indexable.
-created a search option set with predefined property: cm_rnd_subscription=????? Is this possible and how do I know the allowed values, is there any documentation available for these issues?
Thanks in advance and kind regards,
Barry
Hi Detlev,
> If you want an automatic restriction, you could
> implement your own Search Dialog Box Component, which
> in fact only would provide the dynamically determined
> user language and set this as value for the search
> property country, rendering simply nothing.
Does this mean it will not do nohing? What is the value of the dynamically determined user language if for example someone has logged on in English and how do I read this value without using the development kit and API's?
> > -copied the cm_rnd_subscription property
I copied it to make it an indexable property. In this way I hoped to be able to use it in my search iView. I think however that a subscription is a collection of values and not just one?
Regards,
Barry
PS points willbe rewarded ofcourse:)
Similar Messages
-
Hi,
I want to use properties file in my application. I have kept properties file inside a directory called properties which is inside myProject(which is the parent directory of my project) i.e "myProject/properties".
My java file where i want to call this properties file is inside the myProject/WEB-INF/src/java.
How can i call the properties file from myProject/WEB-INF/src/java/PropertyReader.java
I wrote java program in myProject/WEB-INF/src/java/PropertyReader.java like:::::
ResourceBundle resBun = ResourceBundle.getBundle("Test", Locale.getDefault()); // Test.properties is inside myProject/properties
resBun..getString("name");
After running the program i am getting the following errors:::::
Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name Test, locale en_US
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:836)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:805)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:576)
at PropertiesReader.main(PropertiesReader.java:4)
What is the issue? How to use properties file?
Waiting for reply.
ThanksStill getting same exception. As you explained i tried like the below:::
1. I am using ant as build tool.
2. My properties file is for database configuration
My properties file is::
database.properties (inside myProject/properties)
JDBCDriver=org.gjt.mm.mysql.Driver
JDBCConnectionURL=jdbc:mysql://pmdbmysql:3306/bandwidthshaper?user=admin&password=admin
My java package structure is
WEB-INF/src/java
WEB-INF/src/classes
For build WEB-INF is the base directory and build.xml is inside the src directory
In my build.xml i wrote the following lines for compilation::
<target name="compile" >
<javac srcdir="src" destdir="src/classes" debug="true" debuglevel="lines,vars,source">
<classpath refid="class.path"/>
</javac>
<copy todir = "src/classes" >
<fileset dir = "../properties" />
</copy>
<jar jarfile="lib/${project.jar.file}" basedir="src/classes"/>
</target>
I am copying properties file to the classes directory.
Now in java file which is inside /WEB-INF/src/java, I wrote::
try {
Properties programProps = new Properties();
InputStream is = getClass().getResourceAsStream("/database.properties");
if(is == null)
throw new IllegalStateException("Properties file missing ");
programProps.load(is);
System.out.println("driver name::::::: "+programProps.getProperty("JDBCDriver"));
is.close();
} catch(Exception e) {
e.printStackTrace();
After compilation in my classes directory i am getting database.properties file and my java file with package.
At the time of running i am getting "java.lang.IllegalStateException: Properties file missing"
Now tell me where is the fault. Why again i am getting exception.
Thanks -
I want to save 2 users game data now, use Properties?
hi, i just realized that by using "Properties" to save a users game data like the following
experience=2000;
level=3;
zone=forest;
it will write to the text file, but i just realized, when another user goes to play my game, how do i save his game in another spot, can i still use Properties? otherwise, the new user will get the previous user's saved data. and just when i was all happy about saving ONE users data. HAHAHA. :-Dsilverglade wrote:
its a simple text based game. ive already written one in C++ it will be no problem in Java. but im a bit pissed off that people have a problem with me using their code that they FREELY gave me in the forum to help me. if they have a problem with it, they should give it out in the first place. i got my questions answered and thats what i wanted today. i just gave navy coder 10 duke stars for his work, and my thanks. thats all i can give. i gave the other guy who wrote my code 8 duke stars, and my thanks. now that im using the code, why are they bitter and angry at me after they freely gave it to me , i never said I wrote the code myself. so stop being bitter at me. im just trying to get my questions answered, and yes when i write the rest of the game which is not that hard, i WILL be solving my own problems. youre just seeing a major problem that is PART of my game im having. derekI think you've misunderstood. Nobody's pissed off at you, well, certainly I'm not, and I can't see that anyone else is either. But you just seem to be relying on the forum to write the bits you can't, rather than put in a bit of effort to do it yourself. That's not very satisfying. You were going to use a database for this, and thank god I talked you into using Properties instead, because some poor guy would now be writing reams of JDBC code and SQL for you, and telling you how to install and configure MySQL and Connector/J. I prefer teaching people to fish rather than giving them dinner, it's a bit disheartening when people don't go for that approach. But nobody's pissed off at you. In all seriousness, I think you've been working away at this all weekend without much of a break and it's getting to you. Do yourself a favour and take the night off. It'll all seem so much easier when you've been away from it for a bit -
Using properties in a *REC statement
Hi
I want to copy the result of a cost center allocation from the source cost center profit center to the destination cost center profit center. We use a property on the cost center dimension to define the profit center of the cost center.
I first use *RUN ALLOCATION to generate the cost center allocation results but I then need to copy the results to the right profit center. I have written the following code to do this which validates successfully:
*WHEN ACCOUNT
*IS A10000
*REC(PROFITCENTER=COSTCENTER.PROFITCENTER)
*ENDWHEN
However when I run it I receive the following error message:
'RUN_LOGIC Property value not found'
Does anybody know whether it is possible to use properties in *REC statements and if so how I should write the logic?
Kind Regards
WayneHi,
Try following code. However you should be sure that all the profitcenter property members of costcenter exist in profitcenter dimension members. For example if you have a member of costcenter like na_cc and if property profitcenter of this member is blank, this code doesnt work. So you have to add a XDIM_MEMBERSET.
XDIM_MEMBERSET COSTCENTER <,> NA_CC or
XDIM_MEMBERSET COSTCENTER = BAS(CC)
*WHEN ACCOUNT
*IS A10000
*REC(FACTOR=1, PROFITCENTER=COSTCENTER.PROFITCENTER)
*ENDWHEN
Hope this helps. -
Use properties to get character in file but some char could not be decode
i use properties class to get a file with Big5 character inside the file, but some character could not be display properly.....
sample code:
import java.io.*;
import java.util.*;
public class Frankie {
public static void main(String[] arg) {
try {
Properties p = new Properties();
p.load(new FileInputStream("file.ini"));
Enumeration e = p.propertyNames();
while (e.hasMoreElements()) {
String name = (String)e.nextElement();
String value = p.getProperty(name);
String coded_value = new String(value.getBytes("iso-8859-1"), "Big5");
System.out.println(name + " : " + coded_value);
byte[] bBytes2 = coded_value.getBytes();
for (int k = 0; k < bBytes2.length; k++) {
System.out.println("byte " + "iso1" + "[" + k + "] = " + bBytes2[k]);
catch (Exception e) {
e.printStackTrace();
==================
file.ini
people=你
a=餐
==================
result:
a : ?
byte iso1[0] = 63
people : 你
byte iso1[0] = -89
byte iso1[1] = 65
==================
the proper byte of "餐" should be (-64, 92).....
If i use a varible to store this character in the source code, and use value.getBytes("big5"), the byte could be properly display for this character....
how can i solve this? thanks a lot!The Properties class javadoc says
The load and store methods load and store properties in a simple line-oriented format specified
below. This format uses the ISO 8859-1 character encoding. Characters that cannot be directly
represented in this encoding can be written using Unicode escapes ; only a single 'u' character
is allowed in an escape sequence. The native2ascii tool can be used to convert property files to
and from other character encodings.
which means you are not supposed to use "big5" encoding in your Properties text file
directly. There is a commandline tool "native2ascii" bundled with your jdk package that
you can use to convert your "big5" encoded Properties file into unicode escapes based
text file, then you no longer needs to play the trick
String coded_value = new String(value.getBytes("iso-8859-1"), "Big5");
p.getProperty(name) will give you exactly the correct "value" defined in your properties
file.
-x
btw, when using "native2ascii", if you are not in a "big5" env, using "-encoding big5" option
to force it. -
Exception thrown while reading an XML file using Properties
Exception thrown while reading an XML file using Properties.
Exception in thread "main" java.util.InvalidPropertiesFormatException: org.xml.sax.SAXParseException:
The processing instruction target matching "[xX][mM][lL]" is not allowed.
at java.util.XMLUtils.load(Unknown Source)
<?xml version="1.0"?>
<Config>
<Database>
<Product>FX.O</Product>
<URL>jdbc:oracle:thin:@0.0.0.0:ABC</URL>
</Database>
</Config>Am I missing anything?Thanks a lot for all yr help.I have got the basics of
the DTD
However,when I say thus
<!DOCTYPE Config SYSTEM "c:/PartyConfig">
?xml version="1.0"?>
<Config>
<Database>
<Product>FX</Product>
<URL>jdbc:oracle:thin:@0.0.0.0:ABC</URL>
</Database>
</Config>I get the error
Invalid system identifier: file:///c:/ParyConfig.dtd
Please advise?for goodness sake, how many times do I have to tell you that you can't just expect the Properties class to accept arbitrary XML in any format? it reads XML in the format I linked to, and nothing else. Properties is not a general purpose XML binding. you can't do what you're trying to do with it. read this and in particular pay attention to the following
The XML document must have the following DOCTYPE declaration:
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
Furthermore, the document must satisfy the properties DTD described above.
you are not reading my answers properly, are you? kindly do so -
Revision: 4932
Author: [email protected]
Date: 2009-02-11 15:29:32 -0800 (Wed, 11 Feb 2009)
Log Message:
Fixed RTE with FxAnimate3DInstance, where a check in a superclass on whether the property was a style didn't succeed because the effect was using properties that weren't actually styles or properties on the object. Fine for the effect, but not for the superclass. Fix was to simply stub out the style check.
QE Notes:
Doc Notes: None
Bugs: SDK-19256
Reviewer: Ely
tests: checkintests, Mustella mx/effects/FxRotate3D
Ticket Links:
http://bugs.adobe.com/jira/browse/SDK-19256
Modified Paths:
flex/sdk/branches/i10/frameworks/projects/flex4/src/mx/effects/effectClasses/FxAnimate3DI nstance.asRevision: 4932
Author: [email protected]
Date: 2009-02-11 15:29:32 -0800 (Wed, 11 Feb 2009)
Log Message:
Fixed RTE with FxAnimate3DInstance, where a check in a superclass on whether the property was a style didn't succeed because the effect was using properties that weren't actually styles or properties on the object. Fine for the effect, but not for the superclass. Fix was to simply stub out the style check.
QE Notes:
Doc Notes: None
Bugs: SDK-19256
Reviewer: Ely
tests: checkintests, Mustella mx/effects/FxRotate3D
Ticket Links:
http://bugs.adobe.com/jira/browse/SDK-19256
Modified Paths:
flex/sdk/branches/i10/frameworks/projects/flex4/src/mx/effects/effectClasses/FxAnimate3DI nstance.as -
FR: More Useful Properties
I'd love to see PP provide more information via the Properties pane about the media we work with. It would obviate the frequent need for external tools. Here's an example:
C:\Users\Public\Videos\GH2\Card 1\PRIVATE\AVCHD\BDMV\STREAM\00003.MTS
General #0
ID : 0 (0x0)
Complete name : C:\Users\Public\Videos\GH2\Card 1\PRIVATE\AVCHD\BDMV\STREAM\00003.MTS
Format : BDAV
Format/Info : Blu-ray Video
File size : 965 MiB
Duration : 1mn 21s
Overall bit rate mode : Variable
Overall bit rate : 99.8 Mbps
Maximum Overall bit rate : 157 Mbps
Video #4113
ID : 4113 (0x1011)
Menu ID : 1 (0x1)
Format : AVC
Format/Info : Advanced Video Codec
Format profile : [email protected]
Format settings, CABAC : No
Format settings, ReFrames : 2 frames
Codec ID : 27
Duration : 1mn 21s
Bit rate mode : Variable
Bit rate : 95.6 Mbps
Maximum bit rate : 153 Mbps
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 23.976 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 1.924
Stream size : 924 MiB (96%)
Audio #4352
ID : 4352 (0x1100)
Menu ID : 1 (0x1)
Format : AC-3
Format/Info : Audio Coding 3
Mode extension : CM (complete main)
Format settings, Endianness : Big
Codec ID : 129
Duration : 1mn 21s
Bit rate mode : Constant
Bit rate : 192 Kbps
Channel count : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 KHz
Bit depth : 16 bits
Compression mode : Lossy
Delay relative to video : -24ms
Stream size : 1.86 MiB (0%)
Text #4608
ID : 4608 (0x1200)
Menu ID : 1 (0x1)
Format : PGS
Codec ID : 144
Duration : 1mn 21s
Delay relative to video : -41msHere's the request I submitted, it anyone wants to copy/paste:
https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
*******Enhancement / FMR*********
MORE USEFUL PROPERTIES
I'd love to get PP to show more detailed information in it's Properties window. To wit:
C:\Users\Public\Videos\GH2\Card 1\PRIVATE\AVCHD\BDMV\STREAM\00003.MTS
General #0
ID : 0 (0x0)
Complete name : C:\Users\Public\Videos\GH2\Card 1\PRIVATE\AVCHD\BDMV\STREAM\00003.MTS
Format : BDAV
Format/Info : Blu-ray Video
File size : 965 MiB
Duration : 1mn 21s
Overall bit rate mode : Variable
Overall bit rate : 99.8 Mbps
Maximum Overall bit rate : 157 Mbps
Video #4113
ID : 4113 (0x1011)
Menu ID : 1 (0x1)
Format : AVC
Format/Info : Advanced Video Codec
Format profile : [email protected]
Format settings, CABAC : No
Format settings, ReFrames : 2 frames
Codec ID : 27
Duration : 1mn 21s
Bit rate mode : Variable
Bit rate : 95.6 Mbps
Maximum bit rate : 153 Mbps
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 23.976 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 1.924
Stream size : 924 MiB (96%)
Audio #4352
ID : 4352 (0x1100)
Menu ID : 1 (0x1)
Format : AC-3
Format/Info : Audio Coding 3
Mode extension : CM (complete main)
Format settings, Endianness : Big
Codec ID : 129
Duration : 1mn 21s
Bit rate mode : Constant
Bit rate : 192 Kbps
Channel count : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 KHz
Bit depth : 16 bits
Compression mode : Lossy
Delay relative to video : -24ms
Stream size : 1.86 MiB (0%)
Why is this feature important to you?
This information can be very useful in troubleshooting, and we should not have to go to an outside application to get it. -
In Visual studio 2008 i found in properties/ font option between Behavior and Misc to change font. But in 2012 i am unable to get it.
Hi,
Which type of application/project do you work with? Windows forms app? WPF app?
Which language do you use to develop this app/project?
Thanks,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to use .properties files in Webdynpro Java code?
Hi all,
I want to use a logon.properties file when I initial a JCO connection pool in my webdynpro DC (JCO.addClientPool()),but I found when I deployed this DC to the server, it always giv e me an FileNotFoundException. So I donot know how to deploy a .properties file to the server and how to access this file in my Java code?
Thans and Best regards
DeyangHi,
1) put .properties file to your packege under src\packages folder (src\packages\com\sdn\properties\jco.properties)
2) load property:
final InputStream is = getClass().getClassLoader().getResourceAsStream("com/sdn/properties/jco.properties");
final Properties properties = new Properties();
try
properties.load(is);
catch(Exception e)
wdComponentAPI.getMessageManager().reportException(new WDNonFatalException(e), false);
Regatds Maxim R. -
How to use Properties Metadata global service using KM API's
Hi,
I have a requirement where I need to get the list of property Namespaces configured in the KM Portal and also all property Names associated with each Namespace.
I was able to see the list of Namespaces in KM portal at "ContentManagement --> Global Services --> Property Metadata --> Namespaces"
Is there any way to access the Property Metadata service and get the list of Namespaces?
I have seen few posts using the IPropertyConfigurationService as below:
IPropertyConfigurationService configService;
try {
configService =
(IPropertyConfigurationService) ResourceFactory
.getInstance()
.getServiceFactory()
.getService("PropertyConfigurationService");
} catch (PropertyConfigurationServiceException e) {
e.printStackTrace();
I am not sure if IPropertyConfigurationService has API's to give the list of Namespaces as I was not able to figure out the jar file in which API's related to IPropertyConfigurationService exists.
Will the IPropertyConfigurationService be useful to fetch all the configured Namespaces? If so, which jar file should I place in my build and class path?
Also, Can I get the property names associated with each namespace?
Any help or hint is greatly appreciated.
Thanks,
Suresh.Hi Praveen,
Thanks for the information on km.shared.service.propertyconfig_api.jar file. I have located the file in the mentioned location and was using it sucessfully.
I was able to use IPropertyConfigurationService and fetch the MetaData properties in the Portal application.
But, when I place the same code on WebDynpro application it doesn't work.
I have placed the km.shared.service.propertyconfig_api.jar in lib folder of the WebDynpro project, but on runtime I get ClassNotFound exceptions of various classes.
I was wondering if there is any configuration that need to be mentioned for accessing KM Portal applications in WebDynpro.
I have found one post related to this which was talking about using IPropertyConfigurationService in WebDynpro, but not directly, using EJB
Link:[https://www.sdn.sap.com/irj/sdn/thread?threadID=338383]
Can you throw some hints on how to go about this issue.
Thanks,
Suresh. -
Using .properties file in web dynpro
Hi,
I am having a requirement. I have to create a .properties file and I have to use it in my web dynpro application. How can I do that? Any help...
Thanks & Regards,
RajHi,
Go to the navigator view...select src\Components\<ComponentName> and create create a .properties file.
You can read the configuration file in your webdynpro app as follows
IWDConfiguration configuration =
WDConfiguration.getConfigurationByName(
wdComponentAPI.getDeployableObjectPart(),
"<<>>");
http://help.sap.com/saphelp_nw04/helpdata/en/b8/aa343e32ff1033e10000000a114084/frameset.htm
Regards, Anilkumar
Message was edited by:
Anilkumar Vippagunta -
Use properties file in Struts framework
I develop a websit with struts, web ap is tomcat5.0, and I have a conf.properties file
this file is different from ApplicationResource.properties, conf.properties in the /MySite/conf/ directory, not in src directory
When I Use the conf.properties file in a Common Java Class that not extends any super class
it will occur a FileNotFoundException exception
How to make it
public class Environment
private static Properties prop = new Properties();
private static FileInputStream in = null;
public static String getVariable(String key)
try
in = new FileInputStream(new File("\\conf\\config.properties"));
prop.load(in);
return prop.getProperty(key, null);
catch (Exception e)
e.printStackTrace();
return null;
finally
try
in.close();
catch(Exception e)
e.printStackTrace();
}Your class cannot find the file in the location tht u have given. The path (\\conf\\config.properties) is relative to the location where your source (Environment class) is kept.
Try to hard code the path & see if your source can find the prop file ... -
Using properties from a propery file (for i18n support) in a html:select
<Newbie alert!>
OK, I' d like to be able to put text strings used by my JSP/Struts pages in a properties file so that we can change them for different languages. So I have a file referenced in struts-config.xml as such:
<message-resources parameter="com.myproject.resources.ApplicationResources"/>
This works fine and I can use tags like: <bean:message key="prompt.decision"/> in my JSP files.
I would like to be able to use strings defined in the property file also for a dropdown list like such:
<html:select name="displayForm" property="scoreFinalDecision" >
<html:option value="Approved"><bean:message key="option.approved"/></html:option>
<html:option value="Denied"><bean:message key="option.denied"/></html:option>
etc etc
</html:select>
This works, but I would like the value (i.e. value="Approved") also to be picked up from the
property file, not hard-coded like above.
How can I do that? I know that I could pick up the values from a Collection using html:options,
but I don't understand how that would help me get the values from the property file?
</Newbie>
Many thanks,
Tattersail (who notices that his forum doesn't undertand international characters: ���)Well you could use an <html:optionsCollection tag
Just fetch the content of your property file in your action and then populate a vector with labelvalubean object (comes with the struts package) org.apache.struts.util.LabelValueBean
labels = new Vector();
//loop here
LabelValueBean label = new LabelValueBean("value","label");
labels.add(label);
//end loop
yourForm.setYourOptionCollection(label);
The in your form you write something like
<html:select name="displayForm" property="scoreFinalDecision" >
<html:optionsCollection property="your property here" />
</html:select>
it will iterate through your vector and display the options -
Should i use @properties without ivars?
Previously all @properties were declared with ivars. But now I found out that even in templates for Xcode 4.1 (Navigation-based App template) they use only properties for window and navigationController in NameAppDelegate.h without declaring ivars.
Also I found the same question here http://stackoverflow.com/questions/3336922/whats-the-purpose-of-an-ivar-when-a-p roperty-exists
@shosti says that it works for new runtime systems.
So the question is: is that an Apple recomendation?I found about it more in Apple docs
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Objective C/Chapters/ocProperties.html
The last topic - Runtime Difference -
Hi i read about properties file in java .. i didn't get much more..
how can we use this in program.. what is the benefit..
anyone know any examples in site.please let me know about thatint count=getGoogleSearchCount();
public int getGoogleSearchCount(){
search keyword="http://www.google.co.ke/search?hl=en&q=java+properties+class&btnG=Google+Search";
// missing code
return count;
System.out.println(count);i ran the above code snipplet and guess the output?
291,000 results.
DONT BE LAZY.
Maybe you are looking for
-
How do I load photos & Music to my iPhone 3G from iPhoto /iTunes?
How do I load photos & Music to my iPhone 3G from iPhoto /iTunes? If I want to use photos as wallpaper on the phone do they have to be resized or can I just load them?
-
I do not have any IOS device!!! So how can i create an icloud account
How can I create a il=cloud account if i don"t have and IOS device. How does that actually work???
-
Multi-Touch still not work! MacBookPro 13' late 2013 model!
Sometimes in Safari,still crush and not work! My EFI is the latest 1.3! Always happen......."Two-finger swipe to navigate" always not working. I have to reboot my Macbook,after that everything will be fine.......
-
Regarding Payment Options.
Hi, I am from India. I don't have credit cards. I am interested to buy the license, which is on month to month basis. Kindly let me know any other alternative payment options. Thanks in advance
-
Bdc recording for trancastion ME01
Hi, Can u help me in BDC recording for transaction 'ME01' . I have no idea for transaction 'ME01' & here i like to know how to handle table ctr during bdc recording? give sample code if possible. Thanks