Prithvi Sehgal

Ranch Hand
+ Follow
since Oct 13, 2009
Merit badge: grant badges
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 Prithvi Sehgal

Dear Ben,

I strongly agree with Jhon. Java uses, python based regular expressions for your information.

On the other hand, you can pick up some sample problems from your daily life. For example, how to create a regex for an email, how to create a regex for
a credit card or a telephone number. Regular expressions cannot be learnt in one day. It's a very strong language itself and it takes time to gain mastery in it.
Most important thing is, you can keep practising. For further reference, i would strongly suggest you to read Mastering Regular Expressions.


mohammad jordan wrote: ok sry .. any way Let me try to explain this with an example...

Consider the following text:

Now, if I apply the regex below over it...

... I would get the following result:

But I don't care about the protocol -- I just want the host and path of the URL. So, I change the regex to include the non-capturing group (?.

Now, my result looks like this:

See !! ? The first group has not been captured. The parser uses it to match the text, but ignores it later, in the final result.

Dear Jordan,

Kindly QuoteYourSources when you provide an answer to the thread. This answer seems a copy from StackOverFlow and i have mentioned the
thread in the reply.

Dear Ben,

For this question, you can have a detailed answer at What is a Non Capturing Group?.
If any further confusion, feel free to ask.

Hi Eric,
Basically, spring by default nature is handing over singleton objects. Now what you are seeing is the instance of entity manager will be
provided via entity manager factory which you have already configured in the context. As these resources are pretty expensive, the responsibility
is of entity manager factory to give the manager when desired. Resource intensive things like entity manager factory implement singleton pattern
themselves, so always a singleton object will be handed over. Thread safety is a different thing, i guess some of the responsibility, programmer has
to cater themsevles also. I will strongly welcome some other opinions as well. Eric, there should be one entity manager for a whole complete web application,
so yes you should not worry about shared entity manager at all.
Hello, Ryan,
Are you using some kind of IDE like eclipse or Intellij ? Please specify.
Hi Eric,

Here is a sample integration project i created for you. My applicationContext.xml now looks like this

My persistance.xml is empty and looks like this

I am writing a small blog article for Spring 3 and JPA2 will be completed by tomorrow. You can have a look at that also in a day or so at my blog.
Hi Eric,

There are the following issues in your configuration

1- You need to give a persistance provider in persistance.xml file. JPA2 has many implementations e.g. Hibernate, OpenJPA, EclipseLink. In your case
provide a persistance provider. You can specify the same in jpaVendor property. Specify the hibernate dialect as well.

2- Why you are specifying session factory for hibernate? JPA uses entity manager. You don't need to give session-factory configuration.


Declare no checked exceptions on implementation methods other than
those declared by the interface method, or subclasses of those declared by
the interface method.

There is no error in this paragraph gurpreet. It simply says that the overriding method should not declare any checked
exception which are not defined in the interface contract or you can declare the subclasses of those exceptions which are
specifically declared by the contract.
Thanks Saloni and Koliraj, actually meanwhile i posted the question, i had a glance over oracle site and got the answer.
Still, thanks a ton for the considerate time.
Dear John,

It's a valuable information. Excellent.
Dear All,

I am preparing for web component developer exam. I was making a sample jsp and was running in Tomcat when i came across this
error. Have a look at error below

type Exception report


description The server encountered an internal error () that prevented it from fulfilling this request.


org.apache.jasper.JasperException: /chap07/poemOfTheDay.jsp (line: 15, column: 22) Attribute value request.getParameter("poem") is quoted with " which must be escaped when used within the value

I tried the following solutions possible added following line into catalina.bat

It started working absolutely fine. Then i commented this line in catalina.bat and changed the double quotes in jsp into single quotes like this

It solved the problem. My main concern is that what is the meaning of the error and what causes it.
12 years ago
Dear All,
I have a question if someone is holding certification for SCJP-6, then the person can directly upgrade to OCP7 or still they need to
first appear in OCA and then OCP7. Please confirm.

Sarah Rising wrote:I suppose I would be remiss if I didn't check to see if anybody knows of where a nested in class in an interface has been used to good effect. I certainly don't know of any good use of the idea.

Dear Sarah,
Practical usage is basically all upto the designer. The main advantage high cohesion. Additionally, good namespace cleanup. You can also seen an example of abstract Map
Entry interface.
Dear Sarah,

It is mentioned in JLS. Please refer to JLS 6 Specification section 9.6
it is quoted that

Interfaces may contain member type declarations (ยง8.5). A member type declaration in an interface is implicitly static and public.

A member type declaration can be a enclosed interface or a class. Fields don't come under this category and not even abstract methods
because they are contract.

A small working program

Dear Sarah,

The nested classes inside the interface are always static. Reason is that, inner classes always live under the instance of enclosing class
by instantiating it. We cannot instantiate an interface. That's why.