Tran Tuan Hung

Ranch Hand
+ Follow
since Apr 08, 2007
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 Tran Tuan Hung

Jeanne Boyarsky wrote:It sounds like you are asking whether you should cache the tables in Java. Like many good computer questions, "it depends." Some critieria:
- how big is the table?
- what percentage of the table do you typically read?
- how often do you read the same records from the table?



Thanks you for reply, below is my answer
- The table some time have 1000 records.
- I dont need read this table too many times
- when client sent to server request with some conditions, server need to query from Databse and get String value or Integer value to reply to client. I think if i use solution 1, i query only one time and when i need get value, i will get it from HashMap but if i use solution 2 so when i need to get value (Integer or String) i have to query every times.
But i dont like to use the solution one because it's use singleton pattern.
thanks you
I have a table in Oracle database, this is NE_DB_ENUM_VALUE table, in this table i have 4 column:
1- ENUMNAME: varchar
2- STRINGVALUE: varchar
3- INTEGERVALUE: int
4- ENUMTYPE: varchar
I wanna get String value and Integer value from this table. So i have 2 solution:
Solution 1
I select both value Integer value and String value one time then store it in HashMap, when i need to get String value or Integer value i will get from HashMap. I use Singeton pattern.



Solution 2.
I select directly.


I need get Integer value and String value many time so can you recommend me which solution is better.
Thanks you so much.
Best regards
Dear Shailesh Chandra,
Thanks for your help,
I already try your code, so it's work properly too.
So i see that, two code below is equal result in oracle driver:
This code:

And this code:

Thanks.
[ October 24, 2008: Message edited by: Tran Tuan Hung ]
Thanks you for your reply,
I dont know why when i replace the line:
resultSet.first() by the line: resultSet.next(), so it's work properly.
Hi all,
I code on MySQL Driver is OK, but when i transfer to oracle driver, so it not work, i am using ojdbc14.jar for connector.
Here is my source code:

Here is my error on console of eclipse ide.

Exception in thread "main" java.sql.SQLException: Invalid operation for forward only resultset : first
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
at oracle.jdbc.driver.BaseResultSet.first(BaseResultSet.java:85)
at com.goodsw.performance.AlarmCountRetriever.selectCountOfMinor5Min(AlarmCountRetriever.java:68)
at com.goodsw.performance.AlarmCountRetriever.main(AlarmCountRetriever.java:123)


please help me to slove my problem
thanks very much
[ October 22, 2008: Message edited by: Tran Tuan Hung ]
Oh, OK and sorry for my misunderstood.
I post it now, hihi
Here is my source code, please comment for me hihi, i modify from your links.

[ October 07, 2008: Message edited by: Tran Tuan Hung ]
13 years ago
OK You are the man,
I'll keep this solution for helping others. I think CardLayout that's userfull, interesting, but perhaps there're few persion know that.
13 years ago
I already successed, thanks you very much.
13 years ago
Thanks you for reply,
OK, i already research on CardLayout, anhd i code it follow, but it still not works, please help me to correct it.
Here is my source code:
13 years ago
i try this:

But it's not work, i already find the method revalidate() but i was not found.
I will research CardLayout follow your suggestion.
13 years ago
dear all
i have new problem, i want to show the corresponding panel when i click on the button.(when i click on button with BART.jpg image it's will show panel1, when i click on button with LINE.jpg image it's will show panel2)I already create a flag, but it's not work.
Here is my source code:

please help me, thanks you very much
[ October 06, 2008: Message edited by: Tran Tuan Hung ]
13 years ago
Thanks you very much.
That's my requrement, i have to finish it.
When i click on button 1, i will show panel1 and draw the chart in panel1 whith bar chart.
When i click on button 2, i will show panel2 and draw the chart in panel2 with line chart.
Button1 and button2 must the same location or only one button but deference image.
thanks for your help
13 years ago
1- i have 2 buttons, i want to add them to the same location, when i click on button1 then the button1 will hidden and show button2, when i click on button2 then
button2 will hidden and show button1 again? please help me to slove my problem.
2- I have one button, but in this button i want to add 2 images (image1 and image2), when start the program, it's will show default button with image1, i want to
when i click on this button then image1 will hidden and show image2 on the button, when i click obn this button again so image2 will hidden and image1 show again.\
thanks for you help
13 years ago
Ok thanks very much
Here is my code
This is FileFormat.java

Here is class ReadFile.java to read the text file.

Now I have two questions:
1/ When I run the program, it appear the error, help me to correct it.

java.lang.NumberFormatException: For input string: "123 test1y"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:456)
at java.lang.Integer.parseInt(Integer.java:497)
at com.goodsw.myroute.ReadFile.read(ReadFile.java:24)
at com.goodsw.myroute.ReadFile.main(ReadFile.java:40)


2/
In the my code, i only set value of x, y , z, t (format.setX(), format.setY()�..) when line startWith(�123�), but I have many, many lines something like this it is line that start with an integer number with three digits:
So what kind of regex I can try? The idea as following:


Please help me to slove my problem, thanks very much.
14 years ago
I have a text file with following format:

I want to read this file and extract the values of x, y, z ,t. So how to extract it? I use regular expression for that, but it's not work, so please help me.

Thanks you very much.

[ September 08, 2008: Message edited by: Tran Tuan Hung ]
[ September 08, 2008: Message edited by: Tran Tuan Hung ]
14 years ago