Urgent request: the test code for PHP real-time data output to the client is as follows: lt ;? Phpob_start (); for ($ I = 1; $ I lt; = 100; $ I ++) { nbsp; $ sourceName = 'filetoupload '. $ I; nbsp; urgent: questions about real-time PHP Data output to the client
The test code is as follows:
Ob_start ();
For ($ I = 1; $ I $ SourceName = 'filetoupload'. $ I;
$ ImageArray = array ();
$ Message = "Image $ I has been uploaded to the server ";
Echo $ message;
Flush ();
Ob_flush ();
Time_out_callback () { if (connection_status () = = 2) { B (); }} Function C () { //Your possible timeout code echo __function__, '; while (true) { echo '. '; Echo Connection_status (). "";//echo 0 Usleep (100000);//Give CPU breath }}function B () { echo ')' . __function__, "; Echo ' C Timeout connection status: '. Connection_status ();//echo 2,c Timeout}
PHP itself provides this type of functionalityWhether it is beaut
until the DMA buffer is idle. At this time, to some extent, the application's propulsion speed depends on the playback speed. Different playback speeds may produce different propulsion speeds. Therefore, sometimes we do not want the write to be blocked, so we need to know the usage of the DMA buffer.
For (;;){Audio_buf_info Info;/Ask OSS if there is any free space in the buffer./If (IOCTL (DSP, sndctl_dsp_getospace, info )! = 0 ){Perror ("unable to query buffer space ");Close (DSP );Return 1;
");While (! Quit ! Shmptr-> quit){If (shmptr-> windex + 1) % QEUELEN! = Shmptr-> rindex){/* Production data if the queue has an empty slot */For (idx = 0; idx (Shmptr-> item) [shmptr-> windex]. items) [idx] = I;++ I;/* Modify the cursor after writing data */Shmptr-> windex = (shmptr-> windex + 1) % QEUELEN;}Else/* Avoid idling and take the initiative to discard the time slice */Usleep (1 );}/* Notify the other party to exit */Shmptr-> quit = 1;/* Cle
crecttracker; // tracker for rectangle objects
5. usage of the extern variable
Extern can be placed before a variable or function to indicate that the definition of a variable or function is in another file, prompting the compiler to find its definition in other modules when it encounters this variable or function.In addition, extern can be used to specify links.
Iii. LCD Driver Analysis
1. MMAP (void *) target, length, prot_read | prot_write, map_shared, FD, target) // parameter xiangjie? Esp
Application:# Include Usleep (n) // n microsecondsSleep (n) // n MsSleep (n) // n secondsDriver:# Include Mdelay (n) // milliseconds implementation# Ifdef notdef# Define mdelay (N )(\{Unsigned long MSEC = (n); While (MSEC --) udelay (1000 );})# Else# Define mdelay (N )(\(_ Builtin_constant_p (n) (n) ({Unsigned long MSEC = (n); While (MSEC --) udelay (1000 );}))# EndifCall the udelay of ASM/delay. h. The udelay should be a latency of nanoseconds.
DoS:
it is interrupted.(You can continue reading, or wait for subsequent notifications from epoll or select) When errno is ewouldblock | eagain, it indicates that the current buffer has no data readable.(You can continue reading, or wait for subsequent notifications from epoll or select )*/If (errno = eagain | errno = Eint | errno = ewouldblock ){/*That is, when buflen> 0 and errno = eagain | errno = ewouldblock | errno = Eint,Indicates that no data is available. (Read/write is like this)*/Method 1,
program autoruntest has been added as a system service and runs along with the system. Here you can customize the started service. Press F1 to see the introduction of each service. The system service description is attached.
3 appendix 3.1 example of a service script file
#! /Bin/bash
#
# Autoruntest the shell script takes care of autoruntest Auto Start and Stop
#
# Chkconfig: 2345 20 80
# Description: autoruntest
# Processname:/etc/rc. d/init. d/autoruntest
Exec_path =/home/Robin/code
Exec
Http://blog.csdn.net/kerry_xiaowei/article/details/6367570
Http://mobile.51cto.com/symbian-270600.htm
The audio and video solutions in QT are as follows:
Phonon framework
QT is really a little rubbish, and a delay is also so troublesome
Qtime;
T. Start ();
While (T. elapsed ()
Qcoreapplication: processevents ();
The program keeps responding to events.
QwaitconditionWaitcond; waitcond. Wait (400); // or any otherTime in [MS]
Step 2: solve the problem of high CPU usage-make the program
experiment design and the format of the performance test results: to ensure the reliability of the results, each group of experiments repeats 20 times, in a single experiment, the same interface URL set is given, measure the time consumption (in seconds) of the two concurrency mechanisms, Classic (the Classic concurrency mechanism) and Rolling (the improved concurrency mechanism), respectively ), calculate the time saved (Excellence, in seconds) and the performance improvement ratio (Excel. % )
In linux, first confirm whether to add ob_start () and ob_flush ().
Copy codeThe Code is as follows: ob_start ();
For ($ I = 1; $ I Echo $ I. "Ob_flush ();
Flush ();
Usleep (500000 );
}
If the output is still unavailable, add the header information before the code.Copy codeThe Code is as follows: header ("Content-Type: text/html; charset = utf8 ;");Ob_start ();For ($ I = 1; $ I Echo $ I. "Ob_flush ();Flush ();
Sleep command details
The linux sleep command is used to sleep for a period of time. sleep can be used to delay the current action for a period of time. The unit of time is: second (s), minute (m), hour (h), Day (d)
The usage is as follows:
Sleep Number (suffix)
The default unit is seconds)
Sleep 1 = sleep 1 s
Sleep 0.01
View version
Differences between linux sleep and windows sleep
In linux, sleep is measured in seconds, that is, sleep 1000 means 1000 seconds of sleep. In windows,
I/O requests
-Y system status
-- Ipc displays ipc message queues, signals, and other information.
-- Socket is used to display the tcp udp port status
-A all this is the default option equivalent to-cdngy
-V vmstat is equivalent to-pmgdsc-D total
-- Output file this option is also useful. You can redirect the status information to the specified file in csv format for future viewing. E. g dstat -- output/root/dstat.csv now let the program run silently in the background and output the results to
Analysis of run loop in iOS and iosloopAnalysis of run loop in iOS
Although runloop is an important concept related to thread thinking, runloop in cocoa is not used much at all, but it is not getting started with its "why" in related blog posts ". So a few days of study, I have to share a rough text, as a note, write down its own. I am not very grateful for any errors or errors.Run loop
After the thread is executed, it will be destroyed. To keep the thread running, we can get a run loop in the t
To testProgramTo generate random numbers, find a demo that many people use on the Internet and find that if many random numbers are generated consecutively, most of them are duplicated because they are seed based on the system time, I made a small modification to the program to generate a real random number. After testing, the program rarely repeats.
# Include # Include # Include
# Deprecision max 100
Int my_rand (INT base );
IntMain (){While (H {Day = my_rand (100 );Cout H ++;
Reprinted from: http://www.cnblogs.com/feisky/archive/2010/03/20/1690561.html
The purpose of using a timer is nothing more than to periodically execute a task, or to execute a task at a specified time. To achieve this goal, there are generally two common effective methods.
One is to use three internal Linux Timers: itime_real, itimer_virtual, itime_prof;
The other is to use sleep, the usleep function to sleep the process for a period of time;
In fact,
The following sectionCodeIn front of the folder, A test.txt file can be generated, and a timestamp can be written to it every 20 seconds, regardless of whether the client closes the browser.Ignore_user_abort (true );Set_time_limit (0 );
Function write_txt (){If (! File_exists(”test.txt ")){$ Fp = fopen(‑test.txt "," WB ");Fclose ($ FP );}$ STR = file_get_contents('test.txt ');$ Str. = "\ r \ n". Date ("h: I: S ");$ Fp = fopen(‑test.txt "," WB ");Fwrite ($ FP, $ Str );Fclose ($ FP );}
Function
= "processdata.txt ";$ Fp = fopen ($ filename, "");For ($ I = 0; $ I Fwrite ($ fp, "process1:". $ I. "rn ");Usleep (100000 ); }Fclose ($ fp );?> The statement must first execute the first transaction and write the 100 rows in the processdata.txt file.Process2.php The code is as follows:Copy code $ Num = 100;$ Filename = "processdata.txt ";$ Fp = fopen ($ filename, "");For ($ I = 0; $ I
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.