Don’t Forget To Flush…


Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallBeforeHighlightCodeBlock() should not be called statically in /home/iloveitaly/mabblog.com/blog/wp-includes/plugin.php on line 170

Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer.php on line 218

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-core.php on line 53

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-core.php on line 54

Deprecated: Non-static method CodeColorerOptions::ParseOptions() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-core.php on line 84

Deprecated: Non-static method CodeColorerOptions::PopulateDefaultValues() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 70

Deprecated: Non-static method CodeColorerOptions::FilterLanguage() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 106

Deprecated: Non-static method CodeColorerOptions::GetLanguageMappings() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 250

Deprecated: Non-static method CodeColorerOptions::ParseBoolean() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 161

Deprecated: Non-static method CodeColorerOptions::ParseBoolean() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 177

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 73

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 76

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 79

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 82

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 85

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 88

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 91

Deprecated: Non-static method CodeColorerOptions::ParseOptions() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-core.php on line 84

Deprecated: Non-static method CodeColorerOptions::PopulateDefaultValues() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 70

Deprecated: Non-static method CodeColorerOptions::FilterLanguage() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 106

Deprecated: Non-static method CodeColorerOptions::GetLanguageMappings() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 250

Deprecated: Non-static method CodeColorerOptions::ParseBoolean() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 161

Deprecated: Non-static method CodeColorerOptions::ParseBoolean() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 177

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 73

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 76

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 79

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 82

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 85

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 88

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 91

Deprecated: Non-static method CodeColorerOptions::ParseOptions() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-core.php on line 84

Deprecated: Non-static method CodeColorerOptions::PopulateDefaultValues() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 70

Deprecated: Non-static method CodeColorerOptions::FilterLanguage() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 106

Deprecated: Non-static method CodeColorerOptions::GetLanguageMappings() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 250

Deprecated: Non-static method CodeColorerOptions::ParseBoolean() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 161

Deprecated: Non-static method CodeColorerOptions::ParseBoolean() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 177

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 73

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 76

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 79

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 82

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 85

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 88

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 91

Deprecated: Non-static method CodeColorerOptions::ParseOptions() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-core.php on line 84

Deprecated: Non-static method CodeColorerOptions::PopulateDefaultValues() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 70

Deprecated: Non-static method CodeColorerOptions::FilterLanguage() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 106

Deprecated: Non-static method CodeColorerOptions::GetLanguageMappings() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 250

Deprecated: Non-static method CodeColorerOptions::ParseBoolean() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 161

Deprecated: Non-static method CodeColorerOptions::ParseBoolean() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 177

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 73

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 76

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 79

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 82

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 85

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 88

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-options.php on line 91

Warning: shuffle() expects parameter 1 to be array, null given in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/wordpress-support/wordpress-support.php(10) : runtime-created function(1) : eval()'d code(1) : eval()'d code on line 1

Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallAfterHighlightCodeBlock() should not be called statically in /home/iloveitaly/mabblog.com/blog/wp-includes/plugin.php on line 170

Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer.php on line 226

No, not the toilet, your file streams.

I was recently working on a project that involved creating a child process and reading its

stdout

to update the user inteface. Everything was working great until I sent it off to some testers who reporting that it ‘wasn’t working’ – the interface wasn’t updating correctly. I first thought it was a problem with the shell command itself, maybe it wasn’t performing the operation correctly and thus wasn’t sending the correct message through

stdout

but as far as I could tell everything was working perfectly. After about 3 hours of banging my head against the wall trying random things I finally thought to flush the

stdout

after sending my status message. It fixed it! But why would it would fine on my laptop (intel), my desktop (ppc), but not my old laptop (ppc)? The problem arose from the fact that right after sending the data to

stdout

the child process would call a function that would block indefinitely. I learned my lesson, always flush the stream if you are depending on reading that output in a timely manner!

2 Responses to “Don’t Forget To Flush…”



  • Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallBeforeHighlightCodeBlock() should not be called statically in /home/iloveitaly/mabblog.com/blog/wp-includes/plugin.php on line 170

    Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer.php on line 218

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-core.php on line 53

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-core.php on line 54

    Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallAfterHighlightCodeBlock() should not be called statically in /home/iloveitaly/mabblog.com/blog/wp-includes/plugin.php on line 170

    Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer.php on line 226

    But which is the best way? fflush() or setvbuf() with _IONBF passed as the mode? Or doesn’t it really matter?


  • Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallBeforeHighlightCodeBlock() should not be called statically in /home/iloveitaly/mabblog.com/blog/wp-includes/plugin.php on line 170

    Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer.php on line 218

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-core.php on line 53

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer-core.php on line 54

    Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallAfterHighlightCodeBlock() should not be called statically in /home/iloveitaly/mabblog.com/blog/wp-includes/plugin.php on line 170

    Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/iloveitaly/mabblog.com/blog/wp-content/plugins/codecolorer/codecolorer.php on line 226

    I think fflush() would work just fine if your working in C.

    The language I was working in was python, so I’ll had to do was stream.flush().

Leave a Reply





Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method K2::init_scripts() should not be called statically in /home/iloveitaly/mabblog.com/blog/wp-includes/plugin.php on line 405