Ragu Ram

Greenhorn
+ Follow
since Mar 08, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Ragu Ram


Originally posted by George Lin
do you mean the content of the "cloned" table "my2ndTable" could be affected by the original object reference "m"?


Yes. The example demonstrated it right?


Originally posted by George Lin
I do not agree with this point.I think we can copy MyClass objects manually, by creating new objects and set the values for each of its member variable field, even though it is not an efficient and intelligent method. I am wondering why you mentioned the "Cloneable" interface at this point?


I agree with you that it is possible to copy objects by getting and setting stuff in a new object.
This is not cloning. but copying. For cloning an object that object needs to implement the clone interface.


Output is
:::Test1
:::Test1



I am wondering what is the use of Interface "Externalizable"


Externalizable is an alternative to Serializable and it provides some call back methods to write the contents to a stream.

I am not very strong on this Class. have a look at the api It will give you some light on this.


I have tested that the output is true, which is not the same as we imagined. Do you know what is the reason?



Check out the hashCode and equals contracts.
If object1.equals(object2) then object1.hashCode must be = object1.hashCode()

The reverse ned not be true.
19 years ago
I forgot to mention. You dont have to be grateful to me. Just a thanks will do.
19 years ago
  • Iterate through the ArrayList you have.
  • Get the CourseDetails object from the list and read the status code
  • Check if this Key(The retrieved status code) is already present in the hash map. (You can do that using the HashMap.containsKey(Object key) method).
  • If No add this as a Key to a HashMap and set the value as '1'
  • If Yes get the value corresponding to the Key increment it by one and save it back into the hash map using hashmap.put.
  • After iterating over the arraylist your hashmap will contain the status code and the number of occurences.
  • Use HashMap.keySet to get the list of keys. Iterate over them and get the values (the number of occurences).


  • There could be other solutions but this one just struck my mind. I am not sure if jdk 1.5 has some thing which can make this very simple.
    19 years ago
    You have an ArrayList containing the details of 'n' courses and these courses have their own arrtibutes (like course status ,dates etc.)

    I guess you must be having a data structure something like CourseDetails with fields like status, etc.

    You must iterate through the arraylist get each status and increase the count of this status. You can use a HashMap for this purpose.

    The Key is the Course status/status code and the value is the count(no. of times it has occured).
    19 years ago
    I am not sure about all App servers. But Weblogic (atleast 8.1 and above) skips the bad entries as you had mentioned. It also gives a log on the console saying something like 'non serializable content present in session'.
    19 years ago


    This must work.
    19 years ago
    I am not much familiar with EL but i guess this might help
    In short

    String's are immutable

    Hope this helps
    19 years ago

    Do you mean shallow copy of clone related concepts means copy only the reference?


    Yes

    Could you please show me some sample source codes dealing with why shallow copy is not enough and deep copy is needed?





    Result is


    :::Test1
    :::Test2



    This shallow copy applies to all Collections and arrays.
    Note that you can clone an array also.

    Going for shallow/deep copy is not a rule of thumb and your business scenario dictates which one you are to choose.

    In the example given above deep copy is not possible as MyClass doesnt implement the Cloneable interface.

    I am wondering whether all the keys and values are needed to be serializable if I want to use your method



    You guessed it right all the key/value pairs need to be serializable. I am not sure if having them Externalizable helps.
    19 years ago
    When I saw

    that doesn't use the "split()" method in class "java.lang.String


    I assumed you use a lower version of java but then you actually use 1.4.2_07

    I dont understand why you are against the usage of split()?

    StringTokenizer is the other option that would come to my mind.

    However if you want a solution using Regex then
    19 years ago
    The UnmarshalException occurs when an RMI call is made the same class file is not present on both sides of the wire.

    eg. The method

    doStuff(Object o);

    can be called as doStuff(MyOwnClass m) if this class MyOwnClass is not present on the classpath on the other side of the wire this exception occurs.

    To get more details have a look at the api.
    19 years ago
    I downloaded and used the simplewire sdk it compiles and runs fine but the sms is not delivered to my mobile phone can any one please detail on the steps you have to do to make it send an sms to a number which i can specify?. How do i check the status of the message sent? (whether it is delivered or still in queue) i went through the docs but could not find the corresponding method for it
    20 years ago
    Hello every body,
    I have gone through a lot of discussion on this topic and havent succeeded in sending an SMS from my computer. I would like to have a clarification in this regard.Is it a must that we should have a mobile phone which is connected to the pc while sending the SMS.If it is possible to send SMS without connecting a mobile phone please drop your ideas.
    <http://www.sms-gateway-software.com/products_vgsmlite.htm>;
    this link sells an SMS broad cast server but requires a mobile ph. be connected to make it work. However Yahoo messenger and some softwares like SMSPop are there which do not require a mobile phone to be connected to the pc.
    20 years ago