Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!

Pranav Raulkar

Ranch Hand
+ Follow
since Apr 20, 2011
Pranav likes ...
Android Java Netbeans IDE
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 Pranav Raulkar

HI Martin, thanks for the detailed comments.

I'd probably create several overloaded "close" methods

The reason I wrote this method was exactly yo avoid this.

That way I wouldn't have to cast and would get a compiler warning if I tried to pass a wrong object to the method

Since I'm accepting Object in my method, why would compiler flash a warning? Even if one passed another object type, it would get filtered out in the if conditions.

The catch block should only catch SQLException errors

Agree. Actually this is just a sample I wrote in hurry

Moreover, you should understand that the dbResource variable contains a copy of the reference

Objetcs are passed by reference. No such thing as copy of reference?
Hi All,

Wanted your opinions on the code below for closing JDBC resources. PROS / CONS

Hi Sahil,

Sorry for late reply. I guess you might have figured this by now.
If you haven't I guess we can use ActionBar for creating action bar, just like in contacts.

Have a look at this

Hope this helps.
6 years ago
Hi Sahil,

Lets say that you want to execute something on click so you create an Intent for it,
Then you override the onRecieve method and check to see if Intent's action matches the one you set,
Hope this helps.
6 years ago
Hi Mike,

First things first...
public void addItem(E item)
Adds an item to the item list. This method works only if the JComboBox uses a mutable data model.

I guess the problem in your case is that you haven't specified what type of objects the JComboBox will house as you haven't used any generics. So it goes without saying the default will be Object.
Now you are trying to add String to JComboBox where as it is expecting Object so compilation fails.

Try using something like this,

Tell me if it works!
Hope this helps.
6 years ago
Hi Randall Twede,

If you are skeptical about Calendar instance, there is another way to make sure you create only one instance and use the same for every second
Make the 'now' variable static and class level and change the getTime() to something like

6 years ago
Hi Kd Martin,

In order to know which courses the student has enrolled to, you need to have something, ideally, an collection of Course objects in your student class.

Hope this helps.
6 years ago
Hi Vishal,

One way to increase performace is to do the attachment activity in seperate thread for each attachment.
The only thing you might need to watch out for is weather all the attachments have been attached when user tries to send the mail.

Hope this helps.
6 years ago

I have not been able to use the following:
view plaincopy to clipboardprint?
Process process = Runtime.getRuntime().exec(commandLine);

Could you tell what problem you are facing while doing this.
6 years ago
Hi Shweta,

To parse JSON in Java you'll need to import json-lib-2.2.2-jdk15.jar into your project.
Once you have done that all you need to do is

where s is the string representing the returned JSON string.
This will give you an Object. Convert it into JSONArray

and get the element you need, for instance

Hope this helps.
6 years ago
Thanks Jeff, very brisk reply. I appreciate your pointed out the details and pitfalls that I need to llok out for.

I was aware of certain TZ not being into exsistence, along with the fact that I can use something like GMT-7:00 in getTimeZone.

I wrote the code below

One question again, can this be done using timezone offset? How does the timezone offset work?
6 years ago
Hi all,

I need to get date/time in another timezone say MST that corresponds to my local date/time. Simply stated if my local date is 15 Jan 2009 8 AM what would be the corresponding date/time in MST.

I tried with calendar, but it seems to give me incorrect date.

6 years ago
Hi All,

I'm trying to monitor tomcat (running in SSL mode) located on remote macine using JMX via RMI.
I'm able to connect to tomcat, but how to I detect when tomcat is disconnected?
Do I have to monitor any MBean which will tell me about this?

Any pointers.
6 years ago
First of all, not bumping. I know how things work here.
Secondly thanks for your reply.
Third to update... I found out that IPv6 on MYSQL is not supported on versions < 6. It is supported from version 6 on-wards from what I have read on their site. Correct me if I'm wrong.