Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!

# Sam Benry

Ranch Hand
since Mar 21, 2008
Cows and Likes
Cows
0
In last 30 days
0
Total given
0
Likes
0
0
Total given
0
Given in last 30 days
0
Scavenger Hunt
Ranch Hand Scavenger Hunt
Greenhorn Scavenger Hunt

## Recent posts by Sam Benry

well i was thinking if i could find out the repeating pattern of the infinite decimal number then i can do computations to figure out the fraction.
but i dont have a clue how to find the repeating pattern.
some decimals are easy: 0.3333333333
others are hard: 0.78689988998899889988998899

etc

any ideas?
9 years ago
so I am trying to convert infinite decimal numbers to proper fractions
for example,
2.333333333.... is 2 1/3

It works perfectly on finite decimal numbers, example: 5.5 = 5 1/2
but returns wrong results on infinite decimal numbers, example: 2.333333333 = 2 3333/10000
which is 2 + 0.3333

Any idea how to fix it and correct the result ?

If anyone wants to test the function, this is the gcd() function:
9 years ago
I want to ask what is the difference between SQL, MySQL, and JDBS
Where can I find good beginner guide to start using databases in java coding ? (ie, create a database, update it, read it, create tables, insert values .. etc)
10 years ago
Interesting, I wrote this quickly, what do you think ?

10 years ago
I'm basically looking for a good algorithm or method to do the following:
I have 10 numbers, you can use List<Integer> or int[] or what ever you want.

I want to sort the 10 numbers so the sum of the first 5 is approximately (or exactly if possible) equal to the sum of the last 5. The sum of the first 5 must be as close as possible to the sum of the last 5.

How can I do that?
Thank you.
10 years ago
so I want to make a program that downloads that and saves it on my desktop.
Where can I find basic guides to download files from the internet using java?
10 years ago
how to do this ?

I should cancel RemindSignInTask only ? how ?
10 years ago
I didn't know that. Thanks a lot.
This changes the problem completely. What I am trying to do is enable and disable the timer at different places. Here is an example:
The program runs timer.schedule(); will run
Some info is received timer.cancel(); will run
Some info is received timer.schedule(); will run to start the timer again.
etc...

After I stop the timer the first time, I can't start it again ? What should I do? I need to start it and cancel it as much times as requested..
10 years ago
Look at this code

I'm receiving IllegalStateException, timer is already canceled when I call stopTimer().
But this is a try {} catch {} ... why isn't it working ?
I even tried adding a boolean to check if timer is canceled or no, and I still get same result. It's always crashing..
Anyone knows any solution for this? And why the try statement not working ?
10 years ago

this code shows that contains method is case sensitive. Is there any alternative method or way to make it not case sensitive and thus return true?
10 years ago
I am new to Set and List, so bare with me please.
I have this code:

I worked on it and everything is cool, until i got to a place where order is important, I read around and found that I should have used list instead.
My questions:
1) How do I declare a list ? Is this correct:

2) I don't want to allow duplicate entries, that is done automatically in Set, how to do this in List ?
3) How do I randomly shuffle a List? Can a set be shuffled?
4) Can you demonstrate a loop over a list ?
5) commands like (add, remove, contains .. etc) are also available in list ?
10 years ago
I'm fairly new to this, so is it worse to use drag and drop ? why ?
10 years ago
thanks a lot, I started building GUI applications. I have 2 questions:
1) Is it good to use NetBeans IDE ? I used to use eclipse but its much easier to use Netbeans for GUI... (drag and drop)
2) Can you please tell me how to trigger Form_Load ? I want to hide some components when the application starts, but I cant figure out where to place the code that is triggered when the Form is loaded...
10 years ago
Well I know how to create command line application with
public static void main(String[] args)... as main argument..
I am searching for a guide to tell me the BASICS of creating forms, text boxes and buttons .. etc
Please can you guide me and tell me where to start. Any tutorials would be helpful, where should I read guides for an absolute newbie ?
Thanks
10 years ago
I need to develop a very easy to use application that can 100 % test router port forwarding for a specific given port. For example, the user enters the port number, and the program will test to see if the port is open for incoming connection (to check if the port forwarding worked correctly), can anyone help me start this or guide me where to read to solve this?
I want to make something very similar to this one:
http://home.no.net/tgrumpy/ct/dex.php
Thanks
10 years ago