Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Sagar kanchi

Ranch Hand
+ Follow
since Oct 07, 2005
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sagar kanchi

Remember the following rules,

1) Variables are never overridden.
2) Variables are binded during compile time

Based on above, 'o' is casted to Fruit and no matter whether 'o' refers to Fruit or Apple or even another subclass of Fruit object at Runtime. Decision to access which variable was taken at compile time and at that time we ONLY know that that variable is of type Fruit because of the cast.

That's why this always prints 'Fruit'

System.out.println(( (Fruit) o).name);
11 years ago
Hi all,
I am trying to store a String into database that contains some special japanese charaters.
The field on the database side is VARCHAR2(4000)

So, from the java code if String has more than 4000 cahracters am taking first 4000 characters only.

if(str.length() > 4000){
// Take first 4000 chars only

This logic did not satisfy the field restrictions on database side if the String contains some special Kanji cahracters. Its giving Exception as the data is too long to fit in.

After that I made the code change as follows as Oracle consider underlying bytes not chars

if(str.getBytes() > 4000){
//Consider characters (from the beginning of String) which
//accounts to less than or equal to 4000 chars

It did not work though. The getBytes() and length() is returning the same value.

Any ideas to sahre?
May be I was dealing with old mock exams. I did not notice the version before I did that mock.
Christophe, Thank you very much for clarification.
Hi all,
I came across the following que in one of the mock exams.

Q) Which of the elements defined within the taglib element of taglib descriptor file are required. Select the two correct answers.

1. tlib-version
2. jsp-version
3. uri
4. display-name

I think the answers are

1 & 3


But the answers are given as 1 & 2 with the explaination "tlib-version and jsp-version are required elemets within the taglib element".

Is there an element named jsp-version exist??
Hi all,
I could search the API provided by BEA Weblogic and find a way to stop a Queue programtically.

Its very simple. The following are the steps to do so.

Properties env = new Properties();
env.put(Context.PROVIDER_URL, "t3://localhost:7001";);
env.put(Context.SECURITY_PRINCIPAL, "username");
env.put(Context.SECURITY_CREDENTIALS, "password");
InitialContext ctx = new InitialContext(env);

Destination queue = (Destination) jndi
.lookup("destiantion JNDI name"); destMBean = weblogic.jms.extensions.JMSRuntimeHelper.getJMSDestinationRuntimeMBean(
jndi, queue);


That's it.
12 years ago
I tried searching vendor specific API to do this task.
But I couldn't find anything related to this.
If anybody has idea, could you please share it?
12 years ago
Hi all,
I have four queues say Q1 to Q4 and a QueueConnectionFactory.
Can anybody suggest me, how can I stop a specific Queue from consuming messages.

I know we can pause the consumption using weblogic Admin console (I am using Weblogic 9.2) but is there any way to do it Programatically?

For example based on some condition I would like to stop Q2 temporarily while other Queues (Q1,Q2,Q3) remain unchanged.

Thanks in advance
12 years ago
Okay. It sounds good.
Thanks a lot, Anderson.
Thanks to every one of you for your suggestions.
I would like to know one more thing.

Do we really need to remember the tag names and attributes (which is mandatory/optional) mentioned in SOAP/WSDL/UDDI?
The real exam expect us to do so?
Hi all,
The chapters 6,7, & 8 are all about UDDI.
The author told in the beginning as follows.

"The truth is you will probably use JAXR to access a
UDDI registry and won't need much about the underlying
UDDI data structures and SOAP messages

But, whether it is necessary to get firm grip on
UDDI, from exam perspective?
I think Class variables are static varibles and class refers to Servlet class itself.
Yes, I have taken the exam.
If there is single Http Session object then nothing will stop it being shared by multiple servlets. So, I think the answer is False.

Just to remind, Single Thread Model guarantees only single thread of execution at any given time and NOTHING ELSE.
Hi Vassili,
This question is from SCWCD mock exams found at
Hi Vassili,
This question is from SCWCD mock exams found at