Arun Bommannavar

Ranch Hand
+ Follow
since Jan 11, 2003
Merit badge: grant badges
For More
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 Arun Bommannavar

Steve,

Thank you very much. I'll implement my code as per your suggestion. On the second point regarding version of JVM, I am using JBuilder2006 and it comes bundled in with 1.5.0_03b07. Most likely, I will get myself on track with using Eclipse and this way I would be able to use the latest JDK and not get stuck with what comes bundled in with IDE.

Again, I appreciate your help very much.

Steve Luke wrote:
It is really impossible to talk about the logic if we don't know how it is used. It might be right, near right, or completely off. Please provide a more real-world explanation than "The server updates ClassB and ClassA must wait for a new value".



The scenario are as follows:

Server : Monitors water level measuring devices and controls motors associated with those devices.. At any given time, only some values change, , i.e. few water levels change and hence the server makes adjustments to corresponding motor positions. After it respositions the motors it sends event flag(lets name it CHANGE) to the Clients. After the event flag is sent, it then sends values of water levels and motor positions of only those that have changed.
There can be any number of clients, typically 2-5.

Client: Needs to Plot the values of water and motor positions Vs. Time. Client does not query server for values.

So here I have the following: For example if there are 3 water level monitor devices and 3 Motors, I'll have three instances of Motor class and three instances of WaterLevel class and one plot class.

In addition there is a supervisor class that recieves notifications from server. All the motor class instances, water level class instances and Plot class have registered themselves with supervisor class. They implement PropertyChangeListener.

If the server sends motor 1 value change, then supervisor gets it, figures out that it is motor 1 value and executes firePropertyChange. Since, Motor class has implemented PropertyChangeListener, the method propertyChange(PropertyChangeEvent evt) gets executed. Similarly for water level.

When the server sends a CHANGE event flag, supervisor executes firePropertyChange.When the plot class recieves CHANGE event flag, it queries all threee instances of Motor and WaterLevel class. At this point it does not know which have changed. So it will only get the latest value for motor positions and water levels. If the value didnt change, it takes the current stored value. Since, the sequence followed by the Server, is first send the values for water level and motor positions then only send the CHANGE event flag and , I'd assume those values are current. The plot class does not attempt to read values from Motor and Water level class untill CHANGE event flag has arrived.

Coming back to the code snippet. ClassA is Plot class. ClassB is motor class. Left out Water Level class.

The reason for valid flag: For the first time when the client starts the program, if all the Motor positions and water levels values are not read, then without a valid flag I presume incorrect values would be read by Plot class. So it will have to wait unitl the values are updated and valid flag is set to true. This is the part of the code that is not working correctly.

Sometimes, when Plot class tries to read Motor value and the code gets stuck in "while(!valid)" loop because first time value hasnt been read yet. Even when the value is read and it sets valid = true, the code is still stuck in "while(!valid)" loop. This I found out by print statements. I tried declaring valid as volatile but it doesnt help. In the following code, I changed wait() to wait(20) and then printed the value for valid, it still printed false. So I am not sure why it gets stuck in the while(!valid) loop.

Steve Luke wrote:What kind of critique do you want?

If you just want critique on the strategy we need to know a bit more about the use-case. Can the value to be returned ever be invalid once a valid value has been retrieved? Or is the local - cached value good until a new value comes along?



Code snippet was meant to illustrate logic dilemna.

Here is what I wish to do. ClassB implements PropertyChangelistener. ClassA wants to get the value of the variable "val" from ClassB via getVal(). It will have to wait until the server sends a new value (that part of code is too big to post) and the listener triggers and set a new value for the variable "val" in ClassB. At this point, getVal() in ClassB should get out of wait status and provide the value to the caller whcih is classA.doSomething().

So, the question how best can I implement the solution.

Regards


What is/are the mistake/s in this code?

In summary, the goal is classA.doSomething() should get the val from classB and should wait until a new value for "val" is set by the propertychange listener. This value is sent by a server running in the same subnet. How best can I achieve the goal? Any comments/suggestions?

Originally posted by Brian Cole:


Don't put instances of JRadioButton() in your table model.
Instead, put either Boolean.TRUE or Boolean.FALSE in your model,
then worry about table cell renderers at a later step.



Here is what works and what doesn't.


Following code Works :
mp is my TableModel that extends DefaultTableModel



Following code also works:





But (and more importantly) the following code doesn't.





Appreciate your comments and suggstions.

Regards
Arun
15 years ago
I need to make radio buttons in one row and one column in a JTable, the rest being either Strings or data (double).

For example,


So it looks like a matrix. I wish to select either a row of data or column of data depending on the radio button selected.

Any hints, suggestions are most appreciated.

Regards
Arun
15 years ago

Originally posted by Gregg Bolinger:
Well, the problem is that you are adding a JLabel to a JPanel and chances are the JLabel isn't resizing. So its not really the images. If you are simply trying to add an image to a JPanel (as a background image) then you should do it something like what is written here.

If you still need it on a JLabel then you need to be sure your layout manager is resizing your JLabel correctly.



I finally ended up overriding the paintComponent as follows:



works well.

Regards
Arun
15 years ago
I can add a GIF (or PNG) to a JPanel (see code below) but the image doesn't rescale automatically. I need to have this image rescale when the JPanel is resized. I appreciate any suggestion.



Regards
Arun
15 years ago

Originally posted by Rambo Prasad:
I used to jog regularly in morning...but one two occasions I was chased by stray dogs and since then I have stopped jogging...Street dog problem is a big nuisance is bangalore...Any ideas how to terrify the dog if they chase me....?

[ January 03, 2008: Message edited by: Rambo Prasad ]



I was visiting India recently (Bangalore) and read news that a young child was mauled to death by stray dogs. She was watching them feed from a dumpster. I don't think the municipality can do much to contain these stray dogs.

There are few things you could do. These dogs are quite nasty at night and early morning. so...

(1) Jog in the evening rather than morning.
(2) Don't jog alone. Go with a group. Preferably 3-4.
(3) Carry stick and pepper spray.
(I don't know if you get Pepper spray in India)
(4) BEWARE: If you ever get into a fight with the dogs make sure they don't just run away. You have to come a clear winner...otherwise its a game for them and next day they will be more ferocious and more in number.
(5) Go to different part of the city and jog.

Good Luck.
16 years ago

Originally posted by v ray:
How does drinking some vodka help/hinder the sleep on the plane? I'm thinking, if I can down a few drinks, i'll fall asleep only to wake up at the right times, so I will barely feel most of the flight?



It will probably work for you. Its the passengers close to you who have to worry. I read somewhere that alcohol increases snoring.
[ November 13, 2007: Message edited by: Arun Bommannavar ]
16 years ago

Originally posted by Mark Spritzler:


Basically is you use a Noice Cancelling or Noise Isolation ear phones,
Mark



Interesting. I am looking to buy one soon...make it very soon. What brand/model do you recommend? I'd say < $150 would be my cap.

Any experience with Audio-Technica ATH-ANC7
Arun
16 years ago
I (from home) need to connect to a remote Windows PC (at work) and control it. What are my options? pcAnywhere and WebEx were suggested. Which of these is better in terms of ease of use, maintenance, and security.

Does anybody have opinions on these? Security is major issue.

Arun
16 years ago

Originally posted by Rambo Prasad:
Just curious to know if Vegetarianism has a good following outside India?Are there any non Indian Veg ranchers here...



Depends on you define "good following". This past summer we went to an big event organized by "Science of Spirituality" group promoting "Vegetarian" food habits. It was held in Naperville/Lisle, right next to Lucent building. It was an all day event and there must have been at least 30-40 small tents promoting different companies that deal with Vegetarian food. Ateleast 3000-5000 people must have visited the event.

In a period of 3 hours while we were there, we saw may 10-15 Indians, rest were all Americans (white/black).

In one stall a lady was promoting vegetarian food for cats, which I thought was rather extreme. I did get into argument with her about that.

I have also met few Vegans and none of them are Indian.

Arun
16 years ago

Originally posted by Fred Rosenberger:
I've seen Mystere, Dralion and Verekai.




My wife and I went to see the Verekai many years ago in Chicago. It was in a huge huge tent outside United Center (where Bulls play basketball).

They were absolutely fabulous. Just before the half time, the comedian act was on and the fat lady dragged me out on the stage. Yes, I was on the stage for about 10 minutes (it seemed like eternity) and I was nervous all along and tried to stay calm and cheerful. Everything happens so so so fast, you can hardly think what to do next. You just have to pay attention to the actor close to you and do whatever they tell you to do.

Now about the comedy plot. The comedians were a pair (a man and a woman) and the this lady comedian was madly in love with the male comedian. However, he was totaly oblivious to it and was actually trying to woo another damsel. So the fat lady in order to make him jealous, drags one man from the spectator and openly has a fling with him in view of the comedian.

This spectator was me.

So she and I danced around the stage holding hands but the guy wouldn't care less. So then she started kissing me on cheeks (no lips, thank God) and stuff like that. She covered good portion of my cheeks with her lipstick and shirt collar and around too. Finally he got mad at me and ordered me and the fat comedian to stand in front of him. He then took out what appeared like a magical pendulum and started to swing it in front me in order to hypnotize me. Since nobody told me anything, I just stood there, alternately looking at him and squinting to see where my wife was sitting. Now, the fat lady instead of me got hypnotized and fell to ground.

Immediately he ordered my arrest and some damsels took me away and whisked me behind what appeared to be a door. Then they put a monkey costume on me and brought me out. At this point, things were happening so fast I have no clear recollection of where I was being moved to or what I was doing. I was trying to listen to whispers but the spectator's laughing was so loud...

I do remember pressing what appeared to be a dynamite blasting jig and on the count of 3-2-1, I pressed the jig and a hidden platform in front me blasted open and 5-6 acrobats were flung high in air. They all landed beautifully and I was escorted back to my seat.

Whew!!!


Arun
16 years ago
I was about to place an order and by chance read the customer discussion (not customer review). There I found that the 3rd DVD and 5th DVD are identical. Out of four customers, three bought from Amazon and the other some where else(Doesn't say where).

I called Amazon customer service and asked her if this problem has been resolved. I explained to her that I haven't yet bought but would like to place an order if and only if the error has been rectified.

Her answer is that if the problem was reported and they (Amazon) are still selling the product, that means the error has been rectified. She also added that if I see that my copy is also incorrect, then I should send it back and they will refund the money. When pressed, she offcourse cannot gaurentee that error has been rectified.


Question to folks here: Has anyone bought the Planet Earth Series and have you noticed the problem? If you don't have the problem, where did you buy it from?

Arun
16 years ago