jay lai

Ranch Hand
+ Follow
since Apr 04, 2002
Merit badge: grant badges
For More
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 jay lai

Jeanne Boyarsky wrote:You've done the first step - define clearly what you wanted. Now the next step is to get started. Can you explain (in Java code or pseudocode or English) how you coudl use a loop to do this? For example:
1) look at the first entry
2) write down the following from it
3) look at the second entry
4) compare it to what is written down. if X matches, do Y. otherwise, do Z

Do post what you come up with here so we can hint at the next step.



This is what I have so far, but still not sure how to get the appending works properly


11 years ago
11 years ago
I have a collection return from DB like bellow, i want to filter the collection so the end result will only has 1 unique name and their concatinate of bank name that they have.

Any suggestion would really appreciated.
Thanks



11 years ago

K Abhijit wrote:there are multiple way you can handle this issue.

[MODERATOR ACTION: Deleted fully coded solution.]

K Abhijit, please remember that this site is NotACodeMill, and LetThemDoTheirOwnHomework. Thank you!



This site used to be a good, and construtive forum back there., that where people got stuck and ask for it. It is getting worse now!!!
11 years ago

PrasannaKumar maddu wrote:By overriding Comparator OR Comparable interfaces methods you can achieve sorting your collection.Google the interfaces.



The collection already sorted. The problem is I have the code above tryign to extract out 1 record of each name, number if they are similar




11 years ago
11 years ago


Your fist step is to figure out how you would do it "manually." What information do you need to keep track of? What operations do you need to perform? What decisions do you make? Describe the steps as precisely, thoroughly, and simply as possible, without regard to Java or computers--just as a general set of instructions. Once you have that, if you've done it correctly, translating it to Java will be relatively easy.



Yes, I tried to, but still need some help....
11 years ago
I have a Collection<Box> , I need to extract certain row from this collection base on some criteria. If number, name are the same, using the most recent statusDate (Date)

Ex:


Sincerely thanks and please help!!!
11 years ago
I have a controller return a Collection<SomeData> and I want to render this data into the HTML static or render as JSP , wrap in a String or whatever format, so I send this result via email. when user receive this data, it will format nicely in html or jsp without going thru the web request. since there is not HttpServletRequest involved.



Thanks in advance
12 years ago
I have a list of number, types is Double. I have a method to pass in the Double as params. I want to compare the input params with each of the values in the collection, if it matches the most closest value then return that value from the collection.

Collections<Double> list = new ArrayList<Double>();
list.add(89000.00);
list.add(78900.00);
list.add(56999.12);

so the method is like this

private Double getTheMatch(Double param) {
pseudo code:
for (Double d : list) {
if (param Match list.getNumber) {
return list.getNumber;
}
}
}

so if passing 88908.00 --> value will return will be 89000.00 , the most match value from the list

What API java class should I use? Thanks
12 years ago
Hi :
I need your help , I would like to redirect URL when user type in certain url and always redirect them to a homepage. From the home page, there are menu, then they can go from there.

Example : type in https://www.abc.com/search.do --> redirect to https://www.abc.com/home.do
type in https://www.abc.com/something/something.do ---> redirect to https://www.abc.com/home.do

Which file I need to modified application.xml? web.xml?
Or I need to do something else.
Thanks in advance.
14 years ago
Thanks Jeanes for your response.
For now, 1 action to use this form bean. I tried to use the setter method and it occurs before the validation, which mean, as soon as the user enter any value it does the transformation right away, without going into the validate() method that i had.
Any suggestion?
thanks in advance
15 years ago
I have a form bean extends ValidatorAction. I have an field call
String docNum with getter/setter
I validate this field using Validate method(Mapping, HttpServeletRequest), this field required to have at least 1 dash(-), and has to be numeric.

After validation go thru, let say the user put in a correct data into this text box and hit submit. I want to padd zero extra zero(0000) after the dash.
EX: input 123-456 ---> hit submit --> valid data----> pad zero ---> 123-0000456.

Where is in the form bean I need to do this check? Thanks for your help

snippet code


Thanks in advance
15 years ago