Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Java, run/wait/run

Name: Anonymous 2008-09-12 23:03

I've written a program in Java that will let you select the number of 'steps' you want it to take (these represent days in the simulation).
Now I made a run option too but I can not get it to work properly.
I want it to run for X steps, after every step it needs to update the views.

This is what I tried:
for (int i = 0;i<100;i++) {
  try {
    model.simulate(1); (simulates 1 step)
    Thread.currentThread().sleep(500);
  } catch (InterruptedException e1) {
    e1.printStackTrace();
 }
}

The problem is that it will not update the views, only after 100 steps have been completed it will update the views.
I update the views using setChanged() & notifyObservers() which works when I manually do 1 step.

Any suggestions?

Name: Anonymous 2008-09-12 23:04

Use The Algorithmic Language Scheme!

Name: Anonymous 2008-09-12 23:11

Use The Forcibly Indented Language Python!

Name: Anonymous 2008-09-12 23:50

I don't speak The Bloated Language Java, but you should probably make your thread wait on a condition (eg: viewUpdated) instead of sleep(). Or whatever the equivalent is with your observer bullshit.

Otherwise it's pretty much impossible to tell what the problem is since you seem to hide all the shit in model::simulate().

Name: Anonymous 2008-09-13 7:02

>>4
nope.  >>1 obviously didn't read the threading rules for using his GUI.

Name: Anonymous 2008-09-13 10:53

while(1) {
    fork();
}

Name: Anonymous 2008-09-13 11:37

>>6
while (fork());

Name: Anonymous 2008-09-13 12:05

>>7
PROTIP: It's not the same as >>6

Name: Anonymous 2008-09-13 12:05


    start:
        fork();
        goto start;

Name: Anonymous 2008-09-13 12:06

>>7 is safe, >>6 is da bomb.

Name: Anonymous 2008-09-13 19:39

int main ()
{
fork();
main();
return 255
}

Name: Anonymous 2008-09-13 19:44

>>11
win.

Name: Anonymous 2008-09-13 20:55

>>11
umm why dont you do some tail call optimization


int
main(void)
{
f:
  fork();
  goto f;
  return 255;
}

Name: Anonymous 2008-09-13 22:20

>>13
I have a compiler that does that for me.

Name: Anonymous 2008-09-14 0:19

>>14
I'd like to see this tail-call optimization compiler that you have.

Name: Anonymous 2008-09-14 0:31

>>15
$(CC) -froll-tails

Name: Anonymous 2008-09-14 7:14

Hello Thank you very much for sparing your time to read our proposal. We are running a software + website designing and development company. Our team has developed more then 1000 web application successfully. We have 3 designers, 10 programmers, 2 Team leaders and one project manager. I am a project manger who is handling your project and responsible to achieve your goal. As per my job and responsibilities, I will be responsible for any issues you might have during development and designing or testing. We will give you 1-3months of support accept all issues and resolve it within few hours. We will be responsible for any error or bug might be in future of the project We have testing team which test project with more then 100 dummy records We can provide unlimited revisions on design selected. We will request for money only and only if you are happy with the work progress. We always prefer all buyers to use /prog/ and award project using /prog/ Safe and secure for all but PAY only if you get what you want I have read you project specifications; I would like you to read SICP. We can try to complete your project within 1-2weeks only. Waiting for your prompt reply. Regards Anonymous.

Name: Anonymous 2009-03-06 14:05


Team IS MADE UP processor How many   times you get   this if you   dont repost this   comment on 10   other pages i   will hax your   anus tonight and   make a mess   of your computer   ON and go   for real C   C fails and   then SAGE THE   way it would   seem that Randall   endorses the furry.

Name: Anonymous 2014-01-21 21:10

>>15
>le pedophile sage

Don't change these.
Name: Email:
Entire Thread Thread List