Ove Lindström

Ranch Hand
+ Follow
since Mar 10, 2008
Ove likes ...
Android Mac OS X Firefox Browser
Merit badge: grant badges
For More
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 Ove Lindström

Campbell Ritchie wrote:... Also, work out the expression with pencil and paper before trying to code it.

The pen is mightier than the compiler... ;)
12 years ago

Matthew Freake wrote:Does the tester access the servlet via a proxy? I've had production issues where a proxy would re-request a URL if it took longer than a certain time period.

I second that!

We are facing problems with a new proxy that hogs the request. When using the dev-net we are accessing directly to servers and databases but on the test-net they use a local-fw -> proxy -> net-fw -> dev-net.

Temporary solution was to add the dev-net servers in "no proxy for...".
12 years ago

H Und wrote:No, I am using jboss5.1.0. This whole setup is working fine for last 1 yr. in production, but all of sudden this problem started 2 months ago. I would like to know that, this problem is due to OS or JVM or Hardware. As per the postings on various forums, it is getting difficult to come to a conclusion on this problem. Most of the people says the problem is due to a bug in jvm.

What JVM-version?? We have had problems with JBoss 5.1.0 and the _20 and _23 versions of Java 6. _22 and _27 seems stable. _28 is not yet tested.

Edit: Found your version.
Googling at for the 6.0_20-b02 and it seems that it causes a lot of crashes.
12 years ago
Running Tomcat??

You then need to be sure you have the correct TC-libs installed.
12 years ago

ramswaroop ram wrote:I have a problem in sorting nodes.
please post the code for sorting nodes.

What you need is to implement your own TreeModel.

There is a nice example of an OrderedTreeModel at http://seminars.jguru.com/forums/view.jsp?EID=1184178
12 years ago
To answer your question: Yes it is.

What you normally do is that you have one class that extends some sort of Window-based container, such as JWindow or JFrame and that takes care of anything that has to do with the topmost graphical object.

You then create classes that extends a suitable component or container, i.e. a JPanel, and from your topmost object, you instantiate new objects of that type. This means that if you need to have say two different panels that shows the same thing, but for different models, you can create two instances of that panel and assign different models to it. An example is if you show stats for two different players. It should look the same, but have the data from the different Player objects.

The best way to learn this, from my experience, is to physically draw your gui on paper and have the different components on different papers and then just move them around. I often do a mock on paper and when I need a UI-component, I actually go to the photo copier and make a new one. Then I modify it or write data on it. I also use small post-its to mark what model instance is used where.
12 years ago

David Yin wrote:So I'm looking for a way that can do optimization without changing lot of stuff, and a free tool for me to test the performance. dynatrace looks like not free.

There is no such tool. You can tweak the system to go a bit faster, but in the end, you need to profile the system to find the bottleneck.

When you test on your local computer, do you really have the production database or just a fragment of it? If you don't have the full database to profile against, try getting one instance that have, say in your test environment. Then start profiling on the requests where it takes time.

It might not be that big of an issue to find the code that are hogging the CPU and change it. Just a couple of months ago, we found an old SQL-query that was good when the system had the version 1.0 but now, in version 6.2, the database and the table has been modified in such a way that the SQL was now getting a HUGE record set that had to be parsed in a EVEN HUGER for-loop to get the result. A remove of the * in the select, removal off the evil for-loop and an additional change in four lines of code and everything is now running smoothly.

I sometimes use the Splunk log tool to analyze the different logs when multiple servers is used.
12 years ago
An interface is a specification (or contract) that tells the caller that the implementing type has the capability to do something.

A good example is if we take a Person that implements the interfaces HardWorker and GreatLover.

As your boss, I do care about the methods that you implements according to the HardWorker interface. But I don't really care about your other implementing interfaces.

As your partner, I don't like that your boss is calling the methods in the HardWorker interface since that takes away the possibility for me to call the GreatLover-methods. And some stupid programmer has put a synchronization on the implementing methods.

So, depending on who is using the implementing type, they want to know that you can do what your interface/specification promises.
12 years ago

Chuck Barnes wrote:

Ove Lindström wrote:

You can convert any file to a random access. I still think that this is a Parser pattern problem and should be treated as such. Create a factory that can handle a line and parse it from there. Return an object if parsing was ok or a null-implementation of that objects interface if not. Or throw an exception. But I am not that fond out using exceptions to control flows.

I think I'll try that idea. I was wondering if you could point me in the direction of an example of a factory that you refer too? Im not sure I know the concept of what a 'factory' is.

Thanks for the help

The factory pattern is described at http://en.wikipedia.org/wiki/Factory_method_pattern and many more places.

The general idea is to have a logic that somehow chooses what to do so the caller doesn't necessary need to know exactly what or how an object is going to be created. In your case, you could have an identifier on the first line of the cvs-file that tells you what format to use. Depending on that, you select the correct parser for the data and return an object that can be used by the program.
12 years ago
You are using the same port twice.

First you use it in line 37 to start your Registry.
Then you use the same port in your LinkageBroker.

Is it reall the way is should be?

What happens if you use different ports on the Registry and the Broker?
12 years ago

John Quach wrote:Is there a way to make use of this code? I can't seem to get a main class to work with it.

Just call it.

Static methods are called Class methods and is called using the Class/Type without instantiation. So just use ReturnObject.getLabel() from your other class.
12 years ago

John Quach wrote:
Ah. That would be very useful in conditionals would it?

Not if you are a good programer. If you have more than one return-statement, then you should have a really, REALLY good reason.
12 years ago
Why are all you classes extending Exception when they are not exceptions?

I think that you have to look into what Extends actually does.
12 years ago
I'm done writing the program. Please send me the Purchase Order for invoicing and details for how to deliver the code. Total cost was $205 (I always charge at least one hour). ;)
12 years ago

Campbell Ritchie wrote:That tail implementation seems to use a random access file. Can you convert a CSV to random access?

At this point, we are beyond the “beginning” stage, so I shall move this discussion.

You can convert any file to a random access. I still think that this is a Parser pattern problem and should be treated as such. Create a factory that can handle a line and parse it from there. Return an object if parsing was ok or a null-implementation of that objects interface if not. Or throw an exception. But I am not that fond out using exceptions to control flows.
12 years ago