PHP loop; how to print each result and delay it for a second before echoing another result?

Servers usually buffer the output of a server side script until there’s enough in it to output try something like this. Combination of setting output buffering off and manually flushing the buffer. Note the implcit flush line and the flush and ob_flush lines. <?php @ini_set(“output_buffering”, “Off”); @ini_set(‘implicit_flush’, 1); @ini_set(‘zlib.output_compression’, 0); @ini_set(‘max_execution_time’,1200); header( ‘Content-type: text/html; charset=utf-8’ … Read more

Ping a list of host names and output the results to a csv in powershell

You can use the following code instead (I simply altered the write-host calls to CSV formatting) and execute it with “PowerShell.exe script.ps > output.csv” Note that you must execute it from the folder that contains hnames.txt, or simply change the “hnames.txt” to a full path. $names = Get-content “hnames.txt” foreach ($name in $names){ if (Test-Connection … Read more

Python: How to get input from console while an infinite loop is running?

Another way to do it involves threads. import threading # define a thread which takes input class InputThread(threading.Thread): def __init__(self): super(InputThread, self).__init__() self.daemon = True self.last_user_input = None def run(self): while True: self.last_user_input = input(‘input something: ‘) # do something based on the user input here # alternatively, let main do something with # self.last_user_input … Read more

Win32: My Application freezes while the user resizes the window

There are a number of modal operations that happen on windows. Win32 Modal operations refer to functions that put an application into a “mode” by starting their own event processing loop until the mode finishes. Common application modes include drag and drop operations, move/size operations, anytime a dialog pops up that needs input before the … Read more