Shanky Sohar

Ranch Hand
+ Follow
since Mar 17, 2010
Shanky likes ...
Eclipse IDE Firefox Browser
Gurgoan
TechieSafari.com
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
21
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Shanky Sohar

Henry Wong wrote:

Shanky Sohar wrote:
what i actually mean is why do we have
List<? extends T>
Where we are actually using this in a real time sceneria.



How about a method to add up all numbers from the list? And you don't care if the caller passes a List<Integer>, List<Float>, or List<Double>? By having your parameter be of type List<? extends Number>, you can take any of the three list types and calculate the sum.

Henry



Great henry,
I was just looking up the src file of HashMap,Arraylist etc to understand this throughly.

Thanks a lot for clearing this.
Sorry for not quoting my complete question.
I always did such stupid mistakes in hurry.

what i actually mean is why do we have
List<? extends T>
Where we are actually using this in a real time sceneria.
Thanks for your reply but where actually we are using this.
Hi,

What wrong with this .

Even though Integer extends Number.

List<? extends Number> lst2 = new ArrayList<Integer>();
Integer num2 = new Integer(20);
lst2.add(num2); // Line 3

But still we are getting error at Line No 3.Could not understand why,Can anybody help me with this.

Thanks
Shanky
Hi All,

As we know there are three simple ways to set timeout.

1)WEB.XML(Application's).

2)WEB.XML(tomcat's in conf folder).

Format :
<session-config>
<session-timeout>3</session-timeout>
</session-config>

3)Is in Particular session Object

request.getSession().setMaxInactiveInterval(60*10);


I am confused which one will take more precedence at the time when application run,if i set timeout for a session in

Application web.xml to 30 Min
and tomcat web.xml to 60 min

and in session Object to 10 min.

After how much time session will get timeout

Thanks
Shanky
Hi All,

I am running a unix script from multiple threads,by passing some input parameter like directory name etc.

In the unix script i am login to some other envirnment and trying to SFTP files from there to my own server directory.

These files are in different directory & needs to be copied in different location on the server.

Now the problem coming is,when the scipt is doing copy task to some directory.

Other thread which is also running the same script comes and changes the directory which leads the files to get copied at different location.

Any suggestions to resolve this.

Thanks
Shanky



I have completed my certificatation on 23 August 2010 but not yet received any certificate from Sun,
I was thinking that the one score card which is received from Prometric is the final one.

Can any body tell me how can i get the original certificate from Sun.

Thanks
Shanky

In the case of multithreading,,, we have four option for a map to use...

Can anybody Know which one to consider so that we can have a better performance/////

1...
Use hashmap()
Map map = new HashMap();
and synchronize all the methods where are using hashmap

2..
Synchronized the hashMap using Collections class static utility method synchronizedMap(..);
Like Map map = Collections.synchornizedMap(new HashMap());


3. use ConcurrentHashMap();

4.HashTable()..as it already have all the method as synchronized....

Which one will give better performance...

As per what i think...concurrentHashMap() will win among all the four ways...



6 years ago
This is my spring xml file...

6 years ago
Hi Friends..

I am getting error while build Spring AOP and i hope this is due to spring version of jars not matched to each others.
I have downloaded Spring framework3.1 and all the jars from it is included in classpath using custum user library..
and also i am having
aspectjrt-1.6.0
aopalliance
asm-3.0
aspectjrt1.5.4-src
aspectjweaver1.5.4-src
cglib

jars in the classpath...

Could you please help me with this.


Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/aop]
Offending resource: class path resource [spring.xml]

at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:316)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1416)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1409)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:184)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:140)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:111)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:243)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:127)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:93)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:522)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:436)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
6 years ago

Dan Drillich wrote:

Shanky Sohar wrote:

I am really confused with the use of List<?>....



The Need for Generics says -


The motivation for adding generics to the Java programming language stems from the lack of information about a collection's element type, the need for developers to keep track of what type of elements collections contain, and the need for casts all over the place. Using generics, a collection is no longer treated as a list of Object references, but you would be able to differentiate between a collection of references to Integers and collection of references to Bytes. A collection with a generic type has a type parameter that specifies the element type to be stored in the collection.

As an example, consider the following segment of code that creates a linked list and adds an element to the list:

LinkedList list = new LinkedList();
list.add(new Integer(1));
Integer num = (Integer) list.get(0);


As you can see, when an element is extracted from the list it must be cast. The casting is safe as it will be checked at runtime, but if you cast to a type that is different from, and not a supertype of, the extracted type then a runtime exception, ClassCastException will be thrown.

Using generic types, the previous segment of code can be written as follows:

LinkedList<Integer> list = new LinkedList<Integer>();
list.add(new Integer(1));
Integer num = list.get(0);


Here we say that LinkedList is a generic class that takes a type parameter, Integer in this case.







Completely out of my question....
Hi Friends,

I am really confused with the use of List<?>....

Like
List<?> lst=new ArrayList<Integer>();

I know i cannt add anything other than null in this..But can anybody know the use of this...Why we need this..Please provide me one example for its usage..


Thanks
Shanky
I already understood your feeling when i was searching for that...
yes you are right....

I will consider JLS for that....But i was searching for some book for studying JVM...

Atul Darne wrote:




Thanks Atul...But this is not enough for me...i need more to understand....By the way thanks...