Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Nguyen Tuyen

Ranch Hand
+ Follow
since Apr 15, 2017
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
5
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 Nguyen Tuyen

You would need another dependency for your code:
A char is corresponding with a integer value in a specific type of encoding. For example in ascii table, the character 'a' will corresponding with value 97. So that basically you can compare a char with an int value.
3 years ago
When you have some line of codes which do solve a common problem, you can use it more and more times then you should split it into a Helper class like you did. But remember that this method must be a common method for all class can use, not in case inheritance. For example, you have a supper class A, with method called run() and all child of it also using this method, then you must put it there not moving it into a helper class.
Another comment to your code, when you have split code to the helper function, remember that this function only do a very common function, it will not process any particular problems, you must make it as general as you can. All particular problems (if need for run helper) must pre-process then pass into helper function via it's arguments.
As I see in your code, the function 'doSomeThing()' after you split the helper, this function does not have any code you just call the helper, it will be not a good practice.
Your code should be like this:
3 years ago
Maven install is to build maven project, get all the dependencies. But you just need to do that for the first time or whenever you add dependencies to your project. You don't need to that all the times. When you add some code but eclipse debugger not go into that code then means that it does not build your code, let's try some work around:
- Remember to save your code before build/run/debug
- Set eclipse auto build project
- Refresh project
If it does not works, then your eclipse might have problem!
3 years ago
Let's try using a while loop, when your loop go out of table index, the value would be null. By this way, you don't need to know how many rows in the table, you will get all of it.
3 years ago
At this line: you want to print the "back here" to the respone. But in previous line: you have already set the response object to return, so the error will throw. Let's make sure that you set any things to the response before pass it into the `include` function.
So the code should be:

       
3 years ago
JSP
I understand that you want to sort your ArrayList, if so you don't have to worry about Insertion sort or the way you have import items to your array list, there is a sort function in Collections class for help. Please refer to this link to see the use in detail.
3 years ago
"select * from users where username like '%@gmail%' " this is a query to database, If your webservice support this type of summit then it will very danger, it's a big problem about security! Others people can submit any query to your webservice.

If you need the webservice support to query and return a list of user for above query, then make a function to do it, then just submit the data you need to replace to query.
Example (just idea, not right syntax):

3 years ago
Can you run your app in local?
Show us the project structure and the code you are using the external jar!
3 years ago
"but I want to be able to make multiple branches during run time if the user selects add branch?" what is your problem?
3 years ago
The idea is create a global variable to save your created Branch in run time, then using it when you need.
The code sample like:

3 years ago
Using add method, refer to this tutorial

Example:
3 years ago

Basil Smart wrote:Hi Guys, thanks for your reply.

Nguyen, I get this output when I print array indexes below from my PC:



Dave, I agree but if code works on PC , it should also work on server unless java library used on PC is missing on server, but libraries are in both PC and server.

Any other suggestions, thanks?





You got problem when using on server and it's works on your machine, so why did you make a simple test on your PC? Your test is meaningless! The thing you need to check is print out value of the editionDate when running on server!
3 years ago
JSP
Let's try to debug your program to see what truely happen. I just giving some guest here:
This line can make outputDate an array with 2 or more value if editionDate exits the "-", but if "-" is not exist then outputDate will be empty.
That's why outputDate[2] can throw an IndexOutOfBoundException. ==> Try to check here before using it

The reason I thought is in your computer the date using pattern with "-" to split date-month-year, but the server using pattern: "/" to split date/month/year
3 years ago
JSP