Vladas Razas

Ranch Hand
+ Follow
since Dec 02, 2003
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
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Vladas Razas

Try to get Java Web Component Developer Certification, or a book that prepares you for it. Basics are in there.
8 years ago
Check this one:


There are couple of ways you can make table in Swing. You can use default model (data class) which is created by Sun <-Thanks! Also you can create your own model class (it takes more time, but the possibilities are almost endless). Heh, well all of this is probably in the link above.

Regarding containers: Vector is a growable array of objects... You know a[1], a[2] etc. While HashMap is a map: "John"->JohnObject, "Peter"->PeterObject. Anyway I don't use Vector. If I need array like behavior I use ArrayList. Their main difference the latter is not synchronized (but you can synchronize it later).

11 years ago
Most of methods are related to some kind of data retrieval. Naturally, what is the point to ask someone to do something and do not get result. Some people name lengthy data retrieval operations like:
List findSomething() or
List searchSomething() or ... there are quite few versions.

What I do is I just name them getSomething(). It does not matter if it is 1 or 15 lines of code. It does not matter if it works 0.1 sec or 5 mins. So my code consists of 80% of getters. Which are not normal getters that return reference to of class field. They are logic, they are code behind the application.

If programmer follows the first model, it's easier to spot for the caller which method will run faster and which may be slow. I.e. find should take less time than get. Also by properly naming method you may imply implementation details.
In my case, the caller does not care how long it takes. Because the method name does explain the implementation details. I can change the method implementation anytime and I will not have to change find to get etc.

I am more seeing first model , than a second one. I am sometimes scared myself how many "getters" I have! But it works... And it works nice with JSP and Struts too.
So how do you name your methods? And why?

11 years ago
I found I need to run project migration wizard to upgrade application from J2EE 1.3 to J2EE 1.4.

11 years ago
<c:set var="address" value="myaddress"/>
<c ut value="${address}"/>
<input type="text" name="test" value="${address}">


myaddress and input field with value ${address} (not myaddress}
11 years ago
Yes it does, according to the web. And if I create new application it works fine and uses JSP 2.0. Though on the old application JSP 2.0 does not work.
11 years ago

I am working on web application that is using JSP 1.2. Everything I place there from JSP 2.0 does not work. Application runs on IBM Websphere 6. What I have to do to enable JSP 2.0.

11 years ago
They usually call default implementations like "DefaultCellEditor", in JDK.
I think that would be more of adapter pattern. I imagine decorators silently adding some behaviour to object without changing their interface. Sorry if I am wrong.
That's a bit problematic, because the code I give list to, also updates it. And I need those updates synchronized with original list. Here is my code:

I have run into some problems with this approach: sometimes I start getting ConcurrentModificationException. When removing records I have to use iterator's remove. Maybe there is an easy way, I missed somehow?

11 years ago
Hello fellow developers,

I need to filter a List (java.util.list). I.e. there is a list of people, and each person has a type assigned. How could we filter it, so recipient method would still be able to add/remove from the list, but all iterators and get()'s would act just as if there are only people with type X in it.

Thank you!
11 years ago
Also we can staticaly replace one implementation of singleton with another. If half code needs to use one implementation, then half another, we can just make another singleton. Of course if we need dynamicaly decide on what code to use then DI is good (or other ways available)!
Contexts can get dirty if not to be very careful. At some point people will start passing contexts even if the code does not require all things in context so the code will couple with classes it will not even use. We could pass maps with parameters like HttpServletRequest is. But in this case we are saying goodbye to compiler parameters checking. Which is very nice to have.
But again my opinion is that singletons, DI, context they are good tools at the right time.

The point is that requirements change. Every successful system needs to be maintained and extended for years, if not decades. You don't know what requirements will emerge during that time. That's why it's important to manage the dependencies of the code to keep it flexible.

That's an investment! In my project we use old, limited functionality, buggy domain store (something ala Hibernate, but I wish it would be Hibernate). I would love to switch to Hibernate. The singleton we use to access our SQLManager is very small part of the problem. Even if it would not be singleton, still the whole system depends on custom relation mapping file, and API.
I think what you suggest is a upfront system design. That is one has to think through all design issues that may change and do it very flexible. Make big investments in code flexibility. However with rapidly changing systems there no doubt will be problems even with most flexible designs. And this investing thing is like, setting things in stone: "this can change and this not".
But singleton is the most simple of them all! That's the beauty of it. All depends on requirements of course.

There are other solutions to that problem at lower costs than that of the Singleton pattern.

I am intrugued! How to access those DBManagers, Service Locators and alike wihout passing parameters (or using constructors) at low cost?