Rectangle 27 2

When you write target = func1(url) you actually runnig func1 and passing result to Thread (not a reference do the function). This means functions are run on the loop not in the seperate thread.

Then you are telling Thread to run func1 with arguments (url,)

Also you should wait for Threads to finish after the loop, otherwise your program with terminate just after starting all the threads.

EDIT: and if you want only 3 threads to be run on the same time you may want to use ThreadPool:

if __name__ == '__main__':
    from multiprocessing.pool import ThreadPool

    pool = ThreadPool(processes=3)
    pool.map(func, myArray)

When the first one finished his job, does he recieve another url? , in your edit you didn't write the "for loop"

Yes - ThreadPools creates 3 Threads and pool.map runs func for every element from myArray using this threads. So when one thread finishes its job it runs func with next url from myArray. In this case you don'tneed to write 'for loop' as map functions runs one internally.

python - Make 2 functions run at the same time and in parallel? - Stac...

python parallel-processing scrapy ipython-parallel
Rectangle 27 1

Shooting from the hip here - but really don't make it hard on yourself. Use http://docopt.org/ for option parsing. I can't see anything obviously wrong in your code, but that's probably just me. I'll run it when I have some time ;-)

(edit) It looks like action is being shadowed. One of the reasons I usually prefer a more functional style (let c_args_parse return stuff, not set global variables) is that I'm too lazy to delve into the rules of the various languages I use about shadowing. Add "global action" to the top of the function and it will now work (and ditto for the other variables you set). Still - think about returning stuff, working with global variables is not considered very good style.

That seems like a comment, not an answer.

@Rob - I mistook the original answer for having problems with shadowing, I skipped over the invalid Pdb command :-)

I meant the docopt bit was a comment. +1 for the good answer in the 2nd paragraph.

python - Splitting tuples in for loop - Stack Overflow

python tuples getopt
Rectangle 27 0

The trick is to have 'rendered' evaluate to true when it is time to run the action and then change the condition to false in the action method.

Let's say you have a link rendering based on a boolean in your bean called 'editing'. Then your action would look something like this:

public String myAction() {
    // whatever you want your action to do

    editing = false;
}

Edit: this assumes that the bean is either session scoped or the boolean get propagated between requests.

jsf - How to call an action method of a UICommand Component which was ...

jsf
Rectangle 27 0

The trick is to have 'rendered' evaluate to true when it is time to run the action and then change the condition to false in the action method.

Let's say you have a link rendering based on a boolean in your bean called 'editing'. Then your action would look something like this:

public String myAction() {
    // whatever you want your action to do

    editing = false;
}

Edit: this assumes that the bean is either session scoped or the boolean get propagated between requests.

jsf - How to call an action method of a UICommand Component which was ...

jsf
Rectangle 27 0

Unless your intention is to have them all animate at the same time, you can't set them up in a loop this way. If you do, they're all executed (almost) simultaneously and as you say, you'll only actually see the last one.

You need to trigger each successive one from the completion of the previous one. Chain them together with callbacks.

delay should set up the next setTimeout. Then you'll get the result you're after.

EDIT Given the other answers here, I'll add that you'll probably want to increase your pause time from 10ms to something like 100 and then use the *i solution that the others have suggested. Multiplying 10ms by i isn't going to get you a whole lot in the way of noticeable delay. I'd start with 100ms and if that's too jerky move down from there in increments of 10ms till you have an animation that makes you happy.

I did it before, with for example 4 CONSECUTIVE setTimeout but I want to do it with for loop

maybe I'm not understanding your question then. It seems to me that you're trying to cue up all your animations at once.

@DonRhummy, The closure will solve his scoping issue, but I don't see that it will help with preventing all his animations from firing at once... unless I'm overlooking something. Maybe the OP wants all the items to slide up simultaneously, in which case Kolink's solution is indeed correct.

javascript - setTimeout passing arguments issue - Stack Overflow

javascript jquery settimeout