Strict Standards: Declaration of Walker_Page::start_lvl() should be compatible with Walker::start_lvl(&$output) in /home/galeal/ideaforge.org/blog/wp-includes/classes.php on line 576

Strict Standards: Declaration of Walker_Page::end_lvl() should be compatible with Walker::end_lvl(&$output) in /home/galeal/ideaforge.org/blog/wp-includes/classes.php on line 576

Strict Standards: Declaration of Walker_Page::start_el() should be compatible with Walker::start_el(&$output) in /home/galeal/ideaforge.org/blog/wp-includes/classes.php on line 576

Strict Standards: Declaration of Walker_Page::end_el() should be compatible with Walker::end_el(&$output) in /home/galeal/ideaforge.org/blog/wp-includes/classes.php on line 576

Strict Standards: Declaration of Walker_PageDropdown::start_el() should be compatible with Walker::start_el(&$output) in /home/galeal/ideaforge.org/blog/wp-includes/classes.php on line 593

Strict Standards: Declaration of Walker_Category::start_lvl() should be compatible with Walker::start_lvl(&$output) in /home/galeal/ideaforge.org/blog/wp-includes/classes.php on line 687

Strict Standards: Declaration of Walker_Category::end_lvl() should be compatible with Walker::end_lvl(&$output) in /home/galeal/ideaforge.org/blog/wp-includes/classes.php on line 687

Strict Standards: Declaration of Walker_Category::start_el() should be compatible with Walker::start_el(&$output) in /home/galeal/ideaforge.org/blog/wp-includes/classes.php on line 687

Strict Standards: Declaration of Walker_Category::end_el() should be compatible with Walker::end_el(&$output) in /home/galeal/ideaforge.org/blog/wp-includes/classes.php on line 687

Strict Standards: Declaration of Walker_CategoryDropdown::start_el() should be compatible with Walker::start_el(&$output) in /home/galeal/ideaforge.org/blog/wp-includes/classes.php on line 710

Strict Standards: Redefining already defined constructor for class wpdb in /home/galeal/ideaforge.org/blog/wp-includes/wp-db.php on line 58

Deprecated: Assigning the return value of new by reference is deprecated in /home/galeal/ideaforge.org/blog/wp-includes/cache.php on line 99

Strict Standards: Redefining already defined constructor for class WP_Object_Cache in /home/galeal/ideaforge.org/blog/wp-includes/cache.php on line 404

Deprecated: Assigning the return value of new by reference is deprecated in /home/galeal/ideaforge.org/blog/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /home/galeal/ideaforge.org/blog/wp-includes/theme.php on line 576
Even Better Progress Bars for Erlang — The Idea Forge

Even Better Progress Bars for Erlang

An erlang progress bar module really should support concurrency. You should be able to have multiple processes notifying the progress bar of the completion of their task. The progress bar should notify those waiting for completion, etc. So - time for an update!

Now you can start a progress bar server and easily run tasks in parallel. To see a sample use:

progress_bar:example_processes( 1000, 10 ).

That’s just starting a progress server and calling increment server:

example_processes(N, P) ->
    start_server(”Example“, N),
    for(1, P, fun() -> spawn_link( fun() -> example_work_process(N div P) end ) end ),
    receive
        finished -> finished
    end.

example_work_process(0) -> void;
example_work_process(N) ->
    timer:sleep(100),
    increment_server(),
    example_work_process(N-1).

for(N, N, F) -> [F()];
for(I, N, F) -> [F()|for(I+1, N, F)]



Dan Bravender was kind enough to point out that if we change the record name to the same as the module name we can use it in a more object oriented fashion… so PBar:finish instead of progress_bar:finish(PBar). Thanks Dan.

Also - github’s new “gist” is awesome. It lets you create code snippets that are git repositories. Perfect for tiny little erlang modules like this! So you can now get the progress bar from git://gist.github.com/58.git or just download it from here

1 comment so far ↓

#1 harvey on 12.05.13 at 6:19 pm

theatricals@invalidated.druncke” rel=”nofollow”>.…

thanks!…

You must log in to post a comment.