Abhijit Ghatnekar

Greenhorn
+ Follow
since Nov 10, 2007
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 Abhijit Ghatnekar

Greetings.


Is it possible to use this method ServletContext getContext(String uripath) to get a reference to a Web Application Context deployed on a different server? Can the String uriPath accept an HTTP path to a servlet as opposed to an absolute path ?

Regds,
Abhijit.
9 years ago
Hello All,

Is there a way to recursively dump the contents of a collection - any collection or an array for that matter to standard output in Java ?

In PHP, there's a library function called print_r/var_dump that does the same enabling us to inspect the composite datatype's structure before it could be looped over..
in Perl, the same thing could be achieved through a package Data::Dumper.

How about Java? Is there an equivalent of this in Java ?

Regds,
Abhijit.
9 years ago



One object, it is just that you are re-assigning the same String object on the heap to the same String reference. line 1 and line 2 are two alternatives of creating and initializing a string so one object.


The string reference s is now re-assigned to a completely new object on the heap denoted by "jkl". The String instance created above may be garbage collected.....

Do read up on String immutability in Java. You may find it easy to tackle these kinda-questions..

Regds,
Abhijit.

[SCJP 4/5, Zend Certified Engineer for PHP 5, OCPWCD 5, MySQL Certified Associate, Python Certified by OReilly]
9 years ago
Hey All,

I passed the OCPWCD 5 exam a day before yesterday with 89% marks. This is the fifth certification I added to my resume (SCJP 1.4/1.5, Zend Certified Engineer for PHP 5, OCPWCD 5, MySQL 5 Certified Associate and a Python certificate exam that's offered by Oreilly)

To be frank, 89% is quite a decent score I think since I'm not from the Java realm and I haven't worked with ANY of the Java technologies since late 2007.
Here are a few tips that I recommend to prospective candidates.

1) I studied two books diligently - the Head First Servlets and JSP and a book (I do not remember it's title ) by David Bridgewater.
2) I did have a problem in memorizing the APIs (and mind you if you to pass this exam, you SHOULD memorize the APIs) so I had sketched out a large class diagram of the APIs on a chart and framed it in my study room and used to go through it early in the morning and late at night before bed.
3) I programmed like HELL. Rote Learning is not important, you should understand. I recommend to not go for J2EE IDEs (Eclipse) while doing sample assignments. I used Notepad++. Do write code as much as you can.
4) Chalk out a strategy plan and abide by it. Plan your study schedule.
5) Lastly, stick to the Head First Servlets and JSP book, this is your bible for the exam.


Good luck ranchers with the exam.


Regards,
Abhijit.
Hi All,

I'm very much confused by the following question and it's answer. It's a program actually.

Assume the below to be a valid HTTP Servlet that has been registered with a HTTPServletRequestAttribute Listener class.



And the output is this..

=======================
A:a->b P:a->b M:a->c
=====================

Now how is it that we get the old value of the attribute "a" even if we replace the value of the attribute a?
Is there a way, I could get the new, latest value of "a" the moment it is replaced? This could lead to a potential bug in a production code, not sure why it has to work like this.

Any thoughts?

Regds,
Abhijit.
Hello Guys,

I am planning to appear for the SCWCD or OCPJWCD (as it is now known as). However, I am utterly confused between the versions of the exam.


Let me elaborate myself. I am very interested in passing the new JSP and Servlets which are parts of JEE 6. So I was just rummaging through the Oracle Certification site.

http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=41&p_exam_id=1Z0_894

1) Is this list of topics complete? [ Please click the above link and scroll till you find "exam topics". I see some SCWCD 5 topics not there in this list , for example, "Listeners". ]
2) Has anyone attempted the OCPJWCD 6 and passed? Some tips and hints from their side would be highly appreciated.
3) I do hope Head-First Series is available for OCPJWCD 6. Any other books I may refer?



Thank you for reading this post and replying.

Regards,
Abhijit.
Hello All,

I want to set up dynamic attributes (and also the optionlist) for some of the <select> dropdowns on one of my site's search page.
Here are the steps that I followed:

1) My Tag Handler class implements the DynamicAttributes.
2) I then overrode the setDynamicAttributes(String uri, String name, Object value) which stores the attribute names and values in a locally declared Hashmap
3) In doTag() method, I retrieved the set of attributes from the Hashmap and generated the dropdowns.
4) I, then configured the 'required' attributes in the TLD and these have setter methods in my tag handler class and I also set the <dynamic-attributes> element to true.

I have 3 questions.

1) I have a total of 6 dropdowns on the page and I want onchange attribute (and a few more) to be added to those. How and where should I call the setDynamicAttributes() attributes method?
2) The optionlist for each of those dropdowns comes up from the DB can you propose any generic code/idea that (it has to be reusable) I can use to fill up the optionlist attribute for the 6 dropdowns? And this code goes in the setter method for optionlist, correct?
3) setDynamicAttributes(String uri, String name, Object value) - I did not understand the purpose of the URI parameter here. Does it denote an XML/XSI namespace or something of that sort?

Regards,
Abhijit.
9 years ago
Hello All,

I'm preparing for the SCWCD exam and I had a doubt with the following question...


Which HTTP methods are used to show the client what server is receiving ?
1) HEAD
2) PUT
3) TRACE
4) POST
5) GET

I got this right , it is TRACE. But when I gave it a forethought, I realized that POST, GET could also serve as answers when the context is a development/debugging environment where your application is in the initial stages of development. You can print the response to check the data you sent over through your forms is received properly by your servlet or not... (TRACE also may allow an attacker to steal information such as website credentials so using TRACE to loopback the request is downright incorrect)

And one more thing. For the exam is it essential to memorize the API? like which method is defined in which inteface or which class implements which interface.... ?


What are your thoughts on this? This question should have been a bit more specific.....


Regards,
Abhijit

[ I may sound stupid in some of my posts, but I confess I'm out of touch with the Java realm since 4 and a half years ]
Hello All,

I have written code in the past in 3 non-Java scripting languages - PHP, Perl and Python that deals with uploading a file (to a server) through PUT method. I was wondering if it is possible in Java. I'm also confused with the subtleties of the doPut() method. Could it be put to some use here?

Thank you all for your replies.

Regards,
Abhijit.


[Programmed in 4 languages ; Still In Love with Java ]
9 years ago
Hello All,

The last I worked on Java was 4 years back. It was just a 1 year project and after that I switched jobs and companies as a result of which I worked on Perl CGI, PHP, Python and Cold fusion.

I have cleared SCJP in 2006 with 81%. I now plan to switch over to Java. To do it, I'm planning to take SCWCD exam in December so that with my 1 year experience in Java I manage to get a good start. What will be my prospects - an SCJP, SCWCD with 1 year experience?

I am a good programmer and I am equally good learner. Recruiters demand experience even though they understand that consider ANY platform LOGIC remains the same
Can anyone here shed some light over this?

Regards,
Abhijit.
10 years ago
Hello All,


I'm very confused with the following piece of code that I have which fails to compile -


This fails to compile due to the checked exception declaration in the superclass method eat()

I summarize the following rule of overriding concerning checked exceptions below

1) The overriding method MUST not throw any new or broader checked exceptions than those declared by the method in the superclass.

If I reason with this rule at the back of my mind, this code SHOULD compile. Furthermore, in the code the subclass object is assigned to a superclass reference which means in this case the subclass version of the eat method should execute successfully. Can anyone point me out of this dilemma?

Regds,
Abhijit.
10 years ago
@Rob: Thanks, man. after struggling through the code for sometime, I managed to echo out two different values of that constant.. :-).
@Stephan: That code compiled but I was amazed as to how it did and I wanted to confirm whether it is shadowing or it is something else :-)

This forum rocks and of course Java does too.

Cheers,
Abhijit
10 years ago
Hello All,

So its been 4 long years ever since I'm not working in Java ( all these years i was in PHP/Perl/Python and Cold fusion and I'm an SCJP). I was planning to shift to Java again and started reading my old certification book this morning.

I'm stuck at one point.

It is correct that interfaces define constants. But can a class which implements that interface override (or shadow) that variable?

in other words will the below code execute without any error?

And what if I want the values of both the variables in the above code without changing the variable name?

Thank You,
Abhijit.
(I know being an SCJP I should know this, but sorry. I'm completely out of touch )

10 years ago
Hello all,
I read in Head First JSP and Servlets that ports 0 to 65535 are used as a logical connection to a server-side running application and we are not supposed to use ports 0-1023(well-known ports) for our custom-based applications.That's fine. However, don't you think that port numbers are finite? What if I develop a new protocol (suppose )that does not have an equivalent port number between 0-65535?My question is this--How do TCP port numbers handle or can they really assign a new port number to an entirely new protocol? Are all these numbers 0-65535 currently been assigned to protocols? Can they be made greater than 65535 in the near future when the Web will expand manifold? Kindly guide me. Thank you all in advance for clarifying my weird queries.
Regards,
Abhijit
Hi Sir,
Thank you so much for all your replies,My TomCat is working great!!!
Regards,
Abhijit
13 years ago