Dinuka Arsakularatne

Ranch Hand
+ Follow
since Aug 12, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 Dinuka Arsakularatne

Zico Gupta wrote:Hello,
In order to stick with his own decision, what should be the approach of an architect so that everyone agrees with his decision without showing much resistance? Is it required to be of dominating nature to some extent?

Also, since there is a chance to become a victim of politics when going against management (mostly in negotiating some technical decision with management,most of them are very unlikely to have strong technical background). How to overcome this problem?

Thanks,
Zico



Hi Zico,

What i have seen from experience is that due to the fact of dealing with non-technical people we have to have quantitative facts to back up our ideas. For once we needed a much required application server upgrade as well as architectural changes which the management perceived as too risky. Once we did a load test on both the new and old architectures/application servers, and showed them the load times and CPU utilization etc they were convinced. Since they do not have the necessary technical backing to take a solid decision, i believe this is the only way you to convince and have a win-win situation. Being dominating will adversely effect on yourself as well the company culture so i will not advice on that.

Hope this helps

Cheers

Dinuka
6 years ago
Hi Aadesh,

In most cases we extend JFrame within a class so that you can do all initialization within your constructor. And in a typical application you will have many Internal frames, panels etc. And trying to initialize them all through in the main method is bad design and not maintainable. And for better separation of concern we move to a different class which extends from JFrame to construct new frames.

Hope that helps

Cheers

Dinuka
7 years ago
Found the answer guys. This is a working example of scrollable table data cell;

7 years ago
Hi Daryl

This is the latest example i tried out. Still no luck. Please if you have the time go through the following and let me know what im doing wrong. Your help is much appreciated.

7 years ago

Darryl Burke wrote:Note that the linked thread suggests the same solution.

Chantal Ackermann wrote:you have to write a custom TableCellEditor for this



So, problem solved?



Hi Daryl,

Im trying it out right now. still was not successful where the horizontal scroll bar wont move. Will try more and post my findings here to find out from you guys what i am doing wrong. Thank you so much for your prompt responses. appreciate it alot.


Dinuka
7 years ago

Darryl Burke wrote:A renderer isn't added to any visible component hierarchy and can't receive input events. What you see in a JTable's cells is the image of the renderer component.

Use a custom editor. An editor responds to input events (obviously!)

I even looked at the threads here and there was one issue listed here but did not have a clear answer.


A link to that thread might help us to help you better.



Hi Darryl,

Thank you for the prompt response. This is the thread i looked at but could not a get a complete idea on it http://www.coderanch.com/t/335150/GUI/java/JScrollPane-inside-JTable-cell#1483844.
7 years ago
Hi guy,

im having a problem with not being able to scroll inside a JTable's cell. I have a cell with JScroll pane added to it. Within that there is a JLabel representing the text to be displayed. But the horizontal scroll bar does not seem to work. Following i have added the test code i have used for this.



Any help in this regard is much appreciated guys. I even looked at the threads here and there was one issue listed here but did not have a clear answer.
7 years ago
Hi All,

Im finding a way to host my webservice i have written over https. I was Googling through but could not find any viable asnwer. Can anyone point me towards some direction regarding this?


Regards,
Dinuka Arseculeratne
8 years ago
sorry guys was able to figure this out. As it seems when in a cluster the MQ is always share between the instances. Didnt know that ... And hence changed the code to find the connection factory through the JNDI. And it works great.
8 years ago
Hi Guys,

We have deployed two JBoss instances in a clustered environment. And have deployed two MDBs in each instance which creates a queue with the same name. The intention is to use the local MQ server of each instance. But in a clustered environment only the first AS that starts up registers the queue and the other instance gets a NameNotFoundException and Connection refused exception. Any help on how to make the two instances call on their separate MQ servers is much appreciated.


Thanks in advance,
Dinuka Arseculeratne
8 years ago
Hi Campbell,

Thank you for your response. I totally agree with your points too. Its just that after reading those two posts i was wondering because if frames are dropped after the method call ends that means the memory is freed right? and what does it mean by occupying memory in a fixed-size array in that post? But i agree on the fact that processing power must be well utilised.
8 years ago
Hi,
you can use jvmstat+visualgc together to see the garbage collection of your application so you can find if there is a memory leak in your application.
Eclipse MAT can only show you the analysis by reading a memory dump file. I have blogged about how to set up jvmstat+visualgc if you are interested here

Regards,
Dinuka
8 years ago
Hi All,

Looking at the following two links

http://java.sun.com/docs/books/jvms/second_edition/html/Overview.doc.html#15722
http://rmathew.blogspot.com/2007/01/local-variables-in-java.html

It says that all local variables are stored within a fixed-size array and as the first link points out "A single local variable can hold a value of type boolean, byte, char, short, int, float, reference, or returnAddress. A pair of local variables can hold a value of type long or double."

My doubt then this means you do not need to use StringBuilders right? because even if you use a normal String and keep appending to it, as long as its memory scope is "local" it will only use a single array space isnt it? Ofcourse there is still the String pool space which will grow but as far as concatenating is conerned it will always only be within a single frame ( which is the method call as explained in the first link) and it will be removed from space as soon as the method returns. Any thoughts on this would be much appreciated.


Regards,
Dinuka Arseculeratne
8 years ago
"should write all beans as if pooling is never used" - This is correct

And if you have a large resource to access i suggest you use DI and if this is a DB connection,user transaction or bean lookup, then these will be correctly saved to secondary storage during passivation and restored correctly during activation. If it is any other resource then you should explicitly free it in the method annotated with @PrePassivate and then inject it back again inside the method annotated with @PostActivate...

Hope this helps

Dinuka
actually the same instance may not be used to serve a different client, it is only associated with one client. when a request comes back to that object, the session bean is activated with respect to the relevant EJB object associated with that request. In an application server, connection pooling is always used. So connections are usually established by the use of Datasources. Hence you would not want to create database connections by your self. If your DB connection is made through injecting to an instance of EntityManger then you do not need to handle this through @PrePassivate and @PostActivate as these are automatically passivated and restored by the container.