Search:

Type: Posts; User: Slapy

Search: Search took 0.25 seconds.

  1. Replies
    1
    Views
    928

    How to end reading from console?

    Hi, so this is my program. All is working fine expcet stoping reading from console. Problem is that even after you write done if you are fast enought you are able to write more. As you can see I...
  2. Replies
    10
    Views
    1,763

    [SOLVED] Re: Am I doing it right?

    I think it should execute 3 threads:


    for (int i = 0; i < 3; i++)
    pool.execute(new Counter(i));

    or am I wrong?

    --- Update ---
  3. Replies
    10
    Views
    1,763

    [SOLVED] Re: Am I doing it right?

    oh am so sorry. I messed it up. It should be just 3 threads not 4 and it is just luck which thread will be selected. For example this is one of my outputs.
  4. Replies
    10
    Views
    1,763

    [SOLVED] Re: Am I doing it right?

    It is just simpl program that have to count form 0 to 50 and to do so have to use 3 threads and output have to be:

    Thread 1: 0
    Thread 0: 1
    Thread 2: 2
    Thread 2: 3
    Thread 1: 4
    ...
    Thread 0: 50
  5. Replies
    10
    Views
    1,763

    [SOLVED] Re: Am I doing it right?

    Yes, I was just asking if there is any way how to do it better.
  6. Replies
    10
    Views
    1,763

    [SOLVED] Re: Am I doing it right?

    So here is it after few changes I made:


    import java.util.concurrent.ExecutorService;
    import java.util.concurrent.Executors;
    import java.util.concurrent.atomic.AtomicInteger;

    public class...
  7. Replies
    10
    Views
    1,763

    [SOLVED] Am I doing it right?

    This are my two classes:


    import java.util.concurrent.ExecutorService;
    import java.util.concurrent.Executors;

    public class Main {

    public static int number = 0;
  8. Replies
    1
    Views
    896

    [SOLVED] Re: Help with setup db in JUnit tests.

    I find out that this


    ClientDataSource ds = new ClientDataSource();
    ds.setDatabaseName("testDB;create=true");
    con = ds.getConnection();

    is working.
  9. Replies
    1
    Views
    896

    [SOLVED] Help with setup db in JUnit tests.

    First I was using this way how to get connection and all was fine.


    con = DriverManager.getConnection("jdbc:derby:memory:datab;create=true");

    But now I have to change it to DataSource and how...
  10. Thread: java SQL problem

    by Slapy
    Replies
    2
    Views
    1,037

    [SOLVED] Re: java SQL problem

    System.out.println(rs); is getting back null but by my opinion it should get back that id or am I wrong?

    god am so dumb. Problem was in line PreparedStatement query =...
  11. Thread: java SQL problem

    by Slapy
    Replies
    2
    Views
    1,037

    [SOLVED] java SQL problem

    Connection connection = null;
    try {
    connection = DriverManager.getConnection("jdbc:derby://localhost:1527/database","root","root");
    connection.setAutoCommit(false);...
  12. Thread: Help wit regex

    by Slapy
    Replies
    0
    Views
    756

    [SOLVED] Help wit regex

    Hi can u help me? I have this string:


    {"hash":"ckF3DaT","title":"","description":"","width":3264,"height":2448,"size":372322,"ext":".jpg","animated":0,"datetime":"2013-01-21...
  13. Why is this code not returning me content of JSON?

    I think everything is ok but program will end with output null. In real code I have my own API_ID this is just replacement.

    Imgur JSON java reader - Pastebin.com

    --- Update ---

    What the ...?...
  14. Replies
    13
    Views
    1,242

    Re: Problem with method

    So that if have to break for if there are same values as you can see in first one it's all ok but in another ones it just failed I don't know why.

    [-100.0, -100.0]; [-100.0, -100.0]
    0; 5
    true
    ...
  15. Replies
    13
    Views
    1,242

    Re: Problem with method

    Try to add this
    System.out.println(vertices[0] +"; "+ pol.getVertex(i)); before
    if (vertices[0].equals(pol.getVertex(i) ) ) break; and you will see it have to break that shitty for but it doesn't...
  16. Replies
    13
    Views
    1,242

    Re: Problem with method

    Sorry for duplicate I don't know how to delete it.
  17. Replies
    13
    Views
    1,242

    Re: Problem with method

    yes I am sure and like I said values of 4 digits: 0 5 5 5 have to be numbers of variable in array with match but it doesn't.

    --- Update ---

    It's just little bit different. First number have to...
  18. Replies
    13
    Views
    1,242

    Re: Problem with method

    it's value of int i but like I said output have to be 0 3 1 1 or 1 4 2 2 not 0 5 5 5 and there is no case when match is not found so I think it's not necessary to fix.

    Edit: so value of i have to...
  19. Replies
    13
    Views
    1,242

    Re: Problem with method

    basically I am comparing two instances of class Vertex 2D.


    int i = 0;

    for (; i < vertices.length; i++) {

    if (vertices[0].equals(pol.getVertex(i) ) ) break;
    }
  20. Replies
    13
    Views
    1,242

    Problem with method

    public abstract class SimplePolygon {

    public abstract Vertex2D getVertex(int index) throws IllegalArgumentException;
    public abstract int getNumVertices();

    public double getArea() {

    ...
Results 1 to 20 of 20