FY Hsieh

Ranch Hand
+ Follow
since Aug 07, 2006
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 FY Hsieh

click me

This displays a underline under the text. How do I remove the underline and when I click on the text it still invokes the javascript function ?
Inside <select> tag I can have some <option> items. Is there a way for me to specify that a specified <option> is not selectable, i.e. when user selects this <option> item, there is no reaction from screen. This is different from disabling the entire <select>.
By doing "vew source", I saw all the content from test.jsp pasted in the inclduing page. So I think the answers to my questios are YES. Right? If my thought is wrong please do warn me !

Thanks for the help !
12 years ago
JSP
It still works as I tried. So wondering why people always do this in <head> instead ? just a coding convention or what ?


Questions:

1. Does test.jsp and main.jsp share the same javascript "document" ?

2. test.jsp should be able to use any css and javascript imported in main.jsp, correct ?
12 years ago
JSP
I see people usually do
<head>
<script type="text/javascript" src="/..."/>
</head>

I am wondering -- Is it Ok to do

<script type="text/javascript" src="/..."/>


inside html body ? Does this have to be done in "<head>". What if I don't have <head> section in my html ?
I saw some spring jdbc code like




if I have

class Member {
private String name;
private String address;
private int zip;
private int age;
...
}

question --- Using this approach, what if I want to pass null value to zip ?
Does that mean I HAVE to use

private Integer zip;

instead ??

is it true we usually should use wrapper class instead of int, double, etc data type in the POJO so that we can handle passing NULL value ?

13 years ago
I want to insert large amount of data into a table. The data is in a flat file and basically each line matches to a row in table. I can first create a collection of <record> objects, then I use SpringBatchUpdate to insert. Can someone tell me what exactly good about this BatchSqlUpdate ? Is it much faster than inserting record by record ?

Furthermore, is its only advantage on speed ? Anybody thinks about memory consumption ? I still have to load 1 million records objects into memory first!! Does Spring have a way that I don't need to create 1 million objects in memory ?

Thanks.
13 years ago
Thanks for the reply. Can I say

1. After I list as many specific exception in the 'catch" block and if the code passes compilation, then I should NEVER need to add an "catch(Exception e)" or "catch(Throwable e)" in the code ?

2. Same thing for "RuntimeException", just list as many specific exception in the 'catch" block and if the code passes compilation, then I should NEVER need to add an "catch(RuntimeException e)" in the code ?

13 years ago
I have



First I want to mention this is not jdk 1.5 or beyond, it is 1.4.
The compilation is OK but gives run time exception of Class Cast for "Arrays.asList()" part. what's wrong and how should I fix it ?

Thanks.
13 years ago
1. If you know exactly what possible checked exception the code may get, then you should catch the specific exceptions, I understand it. But, I still don't see what's bad about putting "catch(Exception e)" at the end ? Just in case there is any exception you can't or don't list in your catch statements, at least you can catch it here. Some people may say it is not good to put so general exception catch, I agree. My point is, catch as many specfic checked exception as you can, then at the end , catch thise "Exception", what does it hurt ? please tell me.

2. Same question for catching "Runtime exception". Don't tell me people usually do it, tell me what it hurts. If I put this at the end, if there is real Runtime exception, at least I catch it and record the error details. I don't see it hurts anything, it just buy you more information. if you don't have this, when Runtime exception occurs you can't record any stack trace.

I know my idea may be very wrong, so please explain to me if you can. And tell me, if I don't catch "Exception" and "Runtime exception", then what if there is "Runtime exception" how do you record the information ? Similarly, what if there is some checked exception that you didn't list in your catch ?
13 years ago
why I should use comparable instead of comparator ? I read (can't remember where) comprable is more like for natural order and comparator is for customized order, is that true ?
13 years ago
if I have



Question --- when I sort a list of object "Student", since "Student' object contains "Address", and both of them implement Comparator, when "student" object list is sorted, does it automatically sort the associated "Address" objects using the "Address" compare rule ? or does it just sort 'student" obj list using its own rule without looking at "address"'s 'compare' rule ?
13 years ago
I have class like



It compiles but gives run time ClassCastException error "Student can not be casted to Comparable". I am not using Comparable. I am using Comparator.
Why do I get that error ? what's the best and easy way to fix assuming I still use Comparator and Arraylist ?
13 years ago
http://someserver:port/someapp/
https://someserver:port/someapp/

is there API to get url portion like "http://someserver:port" or "https://someserver:port". Is there is not, how do you know if is a SSL url or not ?

Or, is there API that can tell you if it is a http or https (SSL) call ?
13 years ago