related to this bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7028073 i need to fix the display of the currency format for PERU.
How can i change the properties for de locale of PE_es?
Currenctly the currency is shown as S/ but it should be "S/.".
Can i just replace the properties file? i am looking for a soluction in the jre instalation or the code. I have tried looking for the file without luck.
Java version is 1.7.0 _22 b11
Thanks
The bug you mentioned is already fixed in the version 8u34. However, starting tomorrow, there will be a new "bug" (until it is changed/fixed).
Starting Dic 15th, the Peruvian Symbol will be S/ (without the dot).
Depending on which version of the JVM you currently have, you may (or may not) run into this problem. In case you currently have the last version, your only options might be:
Use a workaround for Peruvian Currency
Wait until they update the JVM with the change so you can update it.
Regarding the second point, you may also want to file a bug/change report (similar to the bug_id 7028073).
Source: El Peruano (Article 2) (Source is in Spanish).
A possible solution for that is make a little function to make it manually:
public String getPeruvianCurrencyFormat(double value)
{
NumberFormat nf = NumberFormat.getNumberInstance();
nf.setGroupingUsed(true);
return "S/. " + nf.format(value);
}
Related
I am currently using Java in Visual Studio Code, and I am having a problem with formatting.
I want to preserve the line breaks I made on purpose even after formatting.
BUT VSCode doesn't allows me to do that.
Is there a solution for this problem?
[Before formatting]
someClass.someMethod(
veryLongParameterOne,
veryLongParameteTwo,
veryLongParameterThree
);
[After formatting]
someClass.someMethod(
veryLongParameterOne,
veryLongParameteTwo,
veryLongParameterThree);
All I want is to keep the code the same before and after formatting.
You can use some special comment to let the extension skip format in a range:
//#formatter:off
someClass.someMethod(
veryLongParameterOne,
veryLongParameteTwo,
veryLongParameterThree
);
//#formatter:on
Or you can trigger a command Java: Open Java Formatter Settings with Preview to view some basic format settings in UI. Meanwhile it will generate a .xml format profile in .vscode folder, in which you can find all format settings there.
Recently we migrated java code to OCI environment from AWS environment.
Below is the code which is giving issue.
sql.addSQLToWhereClause(XXXTable, "? between table1.start_date and table1.end_date")
.addSQLToWhereClause(YYYTable, "table1.ORG_ID = ? ")
.addSQLToWhereClause(XXXTable, "table1.LANG_CODE = ? ")
.bind(new Date())
.bind(ConstValues.ORG_ID)
.bind(locale.toString().toUpperCase());
In AWS environment it is working fine, but in OCI environment we are getting error:
ORA-01830: date format picture ends before converting entire input string
We are getting this error because .bind(new Date()) is putting '07-JAN-2021 10:49:04' in the first parameter. But expected value is '07-JAN-2021'
Please suggest why this additional information is coming in current date and how can we remove it without changing java code.
Thanks
Rahul
Object instances of Java's java.util.Date class always had the time portion in it. Why it should behave differently on AWS … – no idea!
But I assume that the implementation of bind(java.util.Date) is different in those environments, because the implementation of Date.toString() will come with a completely different output than that shown in the question.
So please check the version for the library that provides the respective class.
SPSSReader reader = new SPSSReader(args[0], null);
Iterator it = reader.getVariables().iterator();
while (it.hasNext())
{
System.out.println(it.next());
}
I am using this SPSSReader to read the spss file. Here,every string is printed with some junk characters appended with it.
Obtained Result :
StringVariable: nameogr(nulltpc{)(10)
NumericVariable: weightppuo(nullf{nd)
DateVariable: datexsgzj(nulllanck)
DateVariable: timeppzb(null|wt{l)
DateVariable: datetimegulj{(null|ns)
NumericVariable: commissionyrqh(nullohzx)
NumericVariable: priceeub{av(nullvlpl)
Expected Result :
StringVariable: name (10)
NumericVariable: weight
DateVariable: date
DateVariable: time
DateVariable: datetime
NumericVariable: commission
NumericVariable: price
Thanks in advance :)
I tried recreating the issue and found the same thing.
Considering that there is a licensing for that library (see here), I would assume that this might be a way of the developers to ensure that a license is bought as the regular download only contains a demo version as evaluation (see licensing before the download).
As that library is rather old (copyright of the website is 2003-2008, requirement for the library is Java 1.2, no generics, Vectors are used, etc), I would recommend a different library as long as you are not limited to the one used in your question.
After a quick search, it turned out that there is an open source spss reader here which is also available through Maven here.
Using the example on the github page, I put this together:
import com.bedatadriven.spss.SpssDataFileReader;
import com.bedatadriven.spss.SpssVariable;
public class SPSSDemo {
public static void main(String[] args) {
try {
SpssDataFileReader reader = new SpssDataFileReader(args[0]);
for (SpssVariable var : reader.getVariables()) {
System.out.println(var.getVariableName());
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
I wasn't able to find stuff that would print NumericVariable or similar things but as those were the classnames of the library you were using in the question, I will assume that those are not SPSS standardized. If they are, you will either find something like that in the library or you can open an issue on the github page.
Using the employees.sav file from here I got this output from the code above using the open source library:
resp_id
gender
first_name
last_name
date_of_birth
education_type
education_years
job_type
experience_years
monthly_income
job_satisfaction
No additional characters no more!
Edit regarding the comment:
That is correct. I read through some SPSS stuff though and from my understanding there are only string and numeric variables which are then formatted in different ways. The version published in maven only gives you access to the typecode of a variable (to be honest, no idea what that is) but the github version (that does not appear to be published on maven as 1.3-SNAPSHOT unfortunately) does after write- and printformat have been introduced.
You can clone or download the library and run mvn clean package (assuming you have maven installed) and use the generated library (found under target\spss-reader-1.3-SNAPSHOT.jar) in your project to have the methods SpssVariable#getPrintFormat and SpssVariable#getWriteFormat available.
Those return an SpssVariableFormat which you can get more information from. As I have no clue what all that is about, the best I can do is to link you to the source here where references to the stuff that was implemented there should help you further (I assume that this link referenced to in the documentation of SpssVariableFormat#getType is probably the most helpful to determine what kind of format you have there.
If absolutely NOTHING works with that, I guess you could use the demo version of the library in the question to determine the stuff through it.next().getClass().getSimpleName() as well but I would resort to that only if there is no other way to determining the format.
I am not sure, but looking at your code, it.next() is returning a Variable object.
There has to be some method to be chained to the Variable object, something like it.next().getLabel() or it.next().getVariableName(). toString() on an Object is not always meaningful. Check toString() method of Variable class in SPSSReader library.
We built a website with Tapestry 5.1.0.5 and we encounter, sometimes, a missing key problem when we hit the start-page.
This problem appeared only 4 times, this is a random issue.
Actual configuration:
configuration.add(SymbolConstants.SUPPORTED_LOCALES, "fr"); => so the default local is fr and not en
configuration.add("tapestry.start-page-name", "Accueil"); => so when we hit / tapestry redirects us on /accueil
Here is the problem we sometimes see:
When hitting / tapestry searches keys in *_en.properties instead of *_fr.properties but if we hit /accueil tapestry searches keys in *_fr.properties.
Trace log :
Caused by: java.lang.NumberFormatException: For input string: **"[[missing key: prehome.store.opening.delay]]"**
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:447)
at java.lang.Integer.parseInt(Integer.java:497)
at XXXXXXX.tapestry.components.overlayer.StoreOverlayer.initStoresAndRegions(StoreOverlayer.java:652)
at XXXXXXX.tapestry.components.overlayer.StoreOverlayer.setupRender(StoreOverlayer.java)
at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$SetupRenderPhase.invokeComponent(ComponentPageElementImpl.java:184)
at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.run(ComponentPageElementImpl.java:164)
at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:933)
... 94 more
01-02-2012 11:55:52:979 23120252 ERROR org.apache.tapestry5.internal.services.InternalModule.PagePool - Page Page[Accueil en] is dirty, and will be discarded (rather than returned to the page pool).
Has anyone had this problem?
Do you know why when we hit the start-page, tapestry use en locale instead of our default locale fr?
I'd say that if you want to ensure that default locale is French, then just rename all message_fr.properties to message.properties.
Also please take a look into browser settings. If your browser is requesting English version of the site, then Tapestry obeys. You may override that behavior, but I'd suggest treating that like a feature (as user is getting site related to his preference) rather than a bug.
And last hint, if you are supporting more than one language then list them all in supported locales constant.
-= Edit =-
it's also probably worth checking do you have the global messages.properties file in English or in French
My requirement is simple. At the beginning of each file there should be a block comment like this:
/*
* This file was last modified by {username} at {date} and has revision number {revisionnumber}
*/
I want to populate the {username}, {date} and {revisionnumber} with the appropriate content from SVN.
How can I achieve this with NetBeans and Subversion? I have searched a lot but I can't find exactly what I need.
I looked at this question and got some useful information. It is not exactly duplicate because I am working with NetBeans but the idea is the same. This is my header:
/*
* $LastChangedDate$
* $LastChangedRevision$
*/
Then I go to Team > Subversion > Svn properties and add svn:keywords as property name and LastChangedDate LastChangedRevision as property value.
And when I commit from NetBeans it looks like this:
/*
* $LastChangedDate: 2012-02-13 17:38:57 +0200 (Пн, 13 II 2012) $
* $LastChangedRevision: 27 $
*/
Thanks all for the support! I will accept my answer because other answers do not include the NetBeans information. Nevertheless I give +1 to the other answers.
As this data only exists after the file was committed it should be set by SVN itself, not a client program. (And client-side processing tends to get disabled or not configured at all.) This means there is no simple template/substitute like you want, because then after the first replacement the template variables would be lost.
You can find information abut SVN's keyword substitution here. Then things like $Rev$ can be replaced by $Rev: 12 $.
You can do this with The SubWCRev Program.
SubWCRev is Windows console program which can be used to read the
status of a Subversion working copy and optionally perform keyword
substitution in a template file. This is often used as part of the
build process as a means of incorporating working copy information
into the object you are building. Typically it might be used to
include the revision number in an “About” box.
This is typically done during the build process.
If you use Linux, you can find a Linux binary here. If you wish, you could also write your own using the output of svn log.
I followed Petar Minchev's suggestions, only I put the $LastChangedRevision$ tag not in a comment block but embedded it in a string. Now it is available to programmatically display the revision number in a Help -> About dialog.
String build = "$LastChangedRevision$";
I can later display the revision value in the about dialog using a String that has all of the fluff trimmed off.
String version = build.replace("$LastChangedRevision:", "").replace("$", "").trim();
I recommend a slightly different approach.
Put the following header at the top of your source files.
/*
* This file was last modified by {username} at {date} and has revision number {revisionnumber}
*/
Then add a shell script like this
post update, checkout script
USERNAME=# // use svnversion to get username
DATE=# // use svnversion to get revisio nnumber
sed -e "s#{username}#${USERNAME}#" -e "s#{date}#${DATE}#" ${SOURCE_CONTROL_FILE} > ${SOURCE_FILE}
pre commit script
cat standard_header.txt > ${SOURCE_CONTROL_FILE}
tail --lines $((${LENGTH}-4)) ${SOURCE_FILE} >> ${SOURCE_CONTROL_FILE}