Sree Va

Ranch Hand
+ Follow
since Jan 28, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sree Va

https://coderanch.com/t/383120/java/java/Properties-file-keeping-comments-after
Hi,

My Property file:

base.dir=E:/Test
src=${base.dir}/src
classes=${base.dir}/classes

I am using the following code to read it:

Properties properties = new Properties();
FileInputStream fis = new FileInputStream(propertiesFile);
properties.load(fis);
Enumeration keys = properties.propertyNames();

while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
String value = properties.getProperty(key);
System.out.println("key:" + key + "-value:" + value);
}


I get the following output:

key:base.dir-value:E:/Test
key:src-value:${base.dir}/src
key:classes-value:${base.dir}/classes


I anticipated

key:base.dir-value:E:/Test
key:src-value:E:/Test/src
key:classes-value:E:/Test/classes

Please help!

Thanks

One Answer, I received:
Sree: You are hijacking someone else's topic; please start your own topic next time... To answer your question: So you expected that the Properties class would automatically replace ${...} somehow. It doesn't; that is not functionality of the Properties class. You probably saw this when you were using Ant. Ant is doing this for you; not the java.util.Properties class. So if you need this kind of functionality, you will need to program it yourself: search for ${...} expressions, and replace them by whatever you want.
16 years ago
Hi,

My Property file:

base.dir=E:/Test
src=${base.dir}/src
classes=${base.dir}/classes

I am using the following code to read it:

Properties properties = new Properties();
FileInputStream fis = new FileInputStream(propertiesFile);
properties.load(fis);
Enumeration keys = properties.propertyNames();

while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
String value = properties.getProperty(key);
System.out.println("key:" + key + "-value:" + value);
}


I get the following output:

key:base.dir-value:E:/Test
key:src-value:${base.dir}/src
key:classes-value:${base.dir}/classes


I anticipated

key:base.dir-value:E:/Test
key:src-value:E:/Test/src
key:classes-value:E:/Test/classes

Please help!

Thanks
[ July 11, 2007: Message edited by: Sree Va ]
16 years ago
I introduced delay in each method and changed the calling sequence. In every different calling combination, the static method with sync code block executed first, then the object sync method, then again static method with sync code block, then the object sync method,....... like round robin.
This happens on Win XP Prof sp2.



Result:
The following is my effort to differentiate Thread Monitors and priorities between them. Is this sample code infering more than that?

This my effort is trying to answer an interview question.
The question:
In a class with two sync methods and one static method with sync code block, explain the monitors, priorities and dependencies?





Result:

Member #Post&RepliesWinner's Name
59421
342831Barry Gaunt
360591
448521
504961
527111
745911
855821
887411
916811
935741
952801
986311
1027171
1071291
1128551
1180741
1202201
1332861
1336461
1358501
1404981
1406001
1421621
331002
539322
705482
997242
1077902
1097002
1218442
1242182
1413852
39173
166333
345523
501783
606433John Todd
630996Gian Franco Casula
14262817
14274331
2709837
2552349Lasse Koskela
17 years ago
Right a 2 power result ends with 5.
17 years ago
My topic subject is tampered and prefixed with (Not Official/Not Reliable) and closed by Barry Gaunt, too.
Topic: (Not Official/Not Reliable) SCJP 6.0 available early Summer 2007

Here is the procedure to check the truth of my posting by yourself:
Go to http://www.sun.com/training/contact_us/index.html
Login with your SUN account. If you don't have an account you can create one for free.
Click on the E-mail for U.S. and Canada
OR
Go to https://suned.sun.com/APPS/US/SESWEB?processor=event&caller=question

This link page shows up after a couple of popups of error message windows.

Select Subject: Certification, exams
Name, Phone, e-mail are already filled from your profile.
Question box: enter the question.

Wait for a couple of days before you hear back from them.
This reply from SUN that I received is what I posted in my topic.
========

Another topic is closed, too.
Topic: SCJP Java 6?
========


Barry Gaunt. Oh! boy(girl)!. YOU SHOULD HAVE FOUND OUT BY YOURSELF OR ASKED ME HOW I FOUND OUT BEFORE YOU, TAMPERING MY TOPIC SUBJECT LINE AND CLOSING MY TOPIC.
DEAR BROTHERS AND SISTERS, DON'T YOU THINK BARRY GAUNT MISUSED HIS POWERS?!
Here is the e-mail from Sun themselves:


Date: Fri, 02 Feb 2007 17:02:11 -0700
From:"Sun Certification" <who2contact@sun.com> Add to Address BookAdd to Address Book Add Mobile Alert
Subject:Re: SESWEB - Questions regarding certification exams.
To:
It should be available early Summer 2007.

Sun Certification Customer Support


On Jan 31, 2007, at 11:03 PM, sesweb-support-np@central.sun.com wrote:

>
> *********************************************************
> QUESTION
> *********************************************************
>
>
> Name____________________________________
>
> Phone___________________________________
>
> Email___________________________________
>
> Comment_________________________________
>
> When is Sun Certified Java Programmer for JDK 6 available?!
>
>


(edited to make clear that this is not an official announcement)

[ February 02, 2007: Message edited by: Barry Gaunt ]
[ February 04, 2007: Message edited by: Barry Gaunt ]
> Actually, it ended with an exclamation mark
I knew you say that. But I have answer: Check the title, Mr/Ms.

>
Ok. I suspected that was what you meant but I wasn't sure because that's an odd statement. After all, Java has these weird things called "primitives" that have nothing to do with objects whereas in Ruby and Smalltalk, for example, everything is an object.

Answer: Auto Boxing & Unboxing
But before that letz visit Dictionary.

Main Entry:
ori�ent�ed Listen to the pronunciation of oriented
Pronunciation:
\ˈȯr-ē-ˌen-təd\
Function:
adjective
Date:
1937

: intellectually, emotionally, or functionally directed <humanistically oriented scholars> <market-oriented production>
[ February 02, 2007: Message edited by: Sree Va ]
17 years ago
How long SUN takes to make the certification exam available after the release of the technology?

Originally posted by Bert Bates:
Hi Sree,

Now that I've seen that you've posted about this at least three times in several forums I have two things to say:

1 - Please don't post the same topic in multiple forums.

2 - Why do you keep knocking our book because it's 14 months old? There are probably a lot of valid critisisms you can make against the book, but this one seems really odd to me? Can you explain more about your concern?

Thanks,

Bert



Tree pulp, paper, ink, ink on paper is SO ANCIENT especially in IT.
Printing books on open source and selling is TOTAL UNETHICAL.
Making people stick to the old fashioned 'read book' habit is so NOT MODERN.
Open sources are 'Open' for a purpose.
When technology creators giving away their fresh sweat for free, doesn't it pinch you to sell your 14 month old sweat?
Geeks come together to make technology. Why not a technical writer joins them? So, the technology along with its publication becomes FREE/Open Source?

Please don't take me wrong. Think twice.

we are here to put a dent in the universe. -- Steve Jobs, Pirates of Silicon Valley.

I sincerely apologize for my words. I visualize a tree fall whenever I see paper.
17 years ago
I (most of we) would like to know:


With availability of Java Tutorial at the source, people around the world answering your questions, assuring your understanding, some free books, some free tutorials, free excerpts, many mock tests,..........
Is it possible to clear these certifications without purchasing a book?
Does it serve the purpose of certification by just reading A book and getting certified?!
17 years ago
Just for, out of curiosity:
Why are the books on open source are for 'BUYING' and 'COSTLY', too?!
Are we loosing the the trueness in 'open source'?!
Is writing the books harder than making the open source itself?!
yeah! right!

try
2**2**2**2**2
on Ruby 15 minutes.

OR

file = File.open("ordinal")
while file.gets
print if ($. == 1) || /eig/ .. ($. == 3) || /nin/
end

IT IS STILL SCRIPTY!
17 years ago