Ravindranath Chowdary

Ranch Hand
+ Follow
since Nov 08, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Ravindranath Chowdary

Hi Ranchers,
This is regarding the sorting issue I am facing with java.text.Collator class.
I am using java.text.Collator to sort the Strings which can have English/Non-English characters.
If I pass list with two values {'a' , 'A'}, the output for me should be {'A', 'a'}.

I tried by setting strength as PRIMARY, SECONDARY, TERITIARY, IDENTICAL but it has not worked for me.
Also, I have tried RuleBasedCollator where I can define which character should come after the other like A < B < ....Z < a < b <c...; But this option force me to provide the rules for all the languages that we support. So, I cannot use this option.

Sampe code:
---------------
import java.util.*;
import java.text.Collator;

class Test {
public static void main(String[] args) {
ArrayList><String> list = new ArrayList<String>();
list.add("a");
list.add("A");

Collections.sort(list, Collator.getInstance());

System.out.println(list);
}
}

Output: {a, A}
Expected Output: {A, a}

Could some one suggest me how to get case-sensitive sorting using Collator.

Thanks,
Ravindra
15 years ago
Hi,
I am not clear with the explanation provided in HttPJspPage interface. Can anyone please explain this clearly?

Thanks,
Ravindra
15 years ago
JSP
Hi,
Why SUN has provided the interfaces JspPage, HttpJspPage for JSP? What is the necessity of going for these two additional interfaces instead of using Servlet interface directly?

Thanks,
Ravindranath
15 years ago
JSP
Hi Ranchers,
While going through the Type 1 driver I got the following question. Please clarify them

1. If we are using the ODBC driver from the application why we are not allowed to call the method implementation in the driver directly with out using the DriverManager?
2. Is ODBC a C interface? Can we implement ODBC using Java language?
3. Is JDBC-ODBC Bridge driver uses the ODBC interface in the system or it comes as a package with the driver?


Regards,
Ravindra.
Hi Ranchers,
I got SCJP certification. Now, I am planning for SCJD can any one please give an overview of the following.
1. Syllabi for SCJD
2. Books to be followed for SCJD.

Thanks,
Ravindra
Hi Ranchers,
I am planning to write Sun Certified Java Developer exam, can you please suggest what books can I refer to do this?

Thanks,
Ravindra.
Hi Ranchers,
Can you please give me an idea of what is the need of inner classes with an example.

Thanks,
Ravindra
17 years ago
Hi Ranchers,
I have a jar file. How can I create an exe file to run that jar. Give me the steps in detail.

Thanks,
Ravindra.
17 years ago
Hi Ranchers,
I am encountering the following error when I try to integrate Struts with JSF. I am using jdk1.5.0_10 and Tomcat 5.0 and Eclipse 3.1.

Error:

2007-12-06 16:11:25 StandardContext[/poeticWeb]Exception sending context initialized event to listener instance of class org.apache.struts.faces.taglib.LifecycleListener
java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:267)

2007-12-06 16:11:25 StandardContext[/poeticWeb]Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
java.lang.NoSuchMethodError: org.w3c.dom.Node.getTextContent()Ljava/lang/String;
at com.sun.faces.config.processor.AbstractConfigProcessor.getNodeText(AbstractConfigProcessor.java:126)
at com.sun.faces.config.processor.FactoryConfigProcessor.processFactories(FactoryConfigProcessor.java:148)
at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:125)

After I start the Tomcat I am getting the following error:

Dec 6, 2007 7:27:14 PM org.apache.struts.faces.taglib.LifecycleListener attributeAdded
INFO: attributeAdded(com.sun.faces.config.WebConfiguration,com.sun.faces.config.WebConfiguration@1de0c09)
Dec 6, 2007 7:27:14 PM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Initializing Sun's JavaServer Faces implementation (1.2_07-b03-FCS) for context 'Poetic Web'
Dec 6, 2007 7:27:16 PM org.apache.struts.faces.taglib.LifecycleListener contextInitialized
INFO: contextInitialized()
Dec 6, 2007 7:27:16 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Dec 6, 2007 7:27:16 PM org.apache.catalina.core.StandardContext start
SEVERE: Context startup failed due to previous errors
Dec 6, 2007 7:27:16 PM org.apache.struts.faces.taglib.LifecycleListener conte..


Can you please help in this context.


Thanks,
Ravindra.
17 years ago
JSF
Hi Friends,
Can anyone please give clear idea on this.

1. Why the wait/notify/notifyAll are written in Object class?

2. Why the wait/notify/notifyAll need to be called from synchronized blocks or statements?

Thanks,
Ravindra.
Hi Friends,
I read as when ever native method is called the C code corresponding to that method is called. I have two doubts on this...
1. How that C/C++ -language code is executed when java program runs with native methods?
2. How the output from the C code is getback to the java program?

Can you please clarify on this.

Thanks,
Ravindra.
17 years ago
Hi Bu,
The code should be like this, I did a mistake...

public class Test1 implements Runnable{
Thread t;
static Test1 t1 = new Test1();
public static void main(String[] args) {
int i = 10;
System.out.println(i);

}
Test1(){
t = new Thread(this);
t.start();
}
public void run(){
try{
Thread.sleep(1000);
}catch(InterruptedException e){

}
}
}


I am using the Ecipse IDE, in that I noticed as...
At the first line of the main method...in the debug console of Ecipse it is shown as
Thread[main] suspended...and now the control is at
first line of the constructor and in the second line of the constructor a new thread is getting created.
My question is why the main thread is getting created before the thread in the constructor starts.



Thanks,
Ravindranath.
Hi friends,

I have question on when static variables gets initialized.
I read in a book that all the static variables get initialized as soon as the class gets loaded and before the main method starts execution.

In the below program t1 is a static reference variable in the constructor I am creating a thread.

But I noticed that first main thread is getting created later the following variable is getting called...
static Test1 t1 = new Test1(); and new thread is getting created.


public class Test1 implements Runnable{
Thread t;
static Test1 t1 = new Test1();
public static void main(String[] args) {
int i = 10;
System.out.println(i);

}
Test1(){
t = new Thread(this);
t.run();
}
public void run(){
try{
Thread.sleep(10000000);
}catch(InterruptedException e){

}
}
}

As the static variables get initialized after class gets loaded. Then why the thread in the Test1 constructor is created after the main thread.


Thanks,
Ravindranath.
Hi Ranchers,
I have cleared SCJP 5.0 with 91%.
Thanks to all for answering my posts with very good explanations.

Thanks,
Ravindra.
17 years ago
Hi Friends,

Can any one please explain how the doIt() will be executed by the two threads in the below code....



Thanks,
Ravindra.

[ UD: added CODE tags for better readability ]
[ August 19, 2007: Message edited by: Ulf Dittmer ]