following is the survey.php code to implement the survey function:
?$data = "Data.txt";$votes = "Survey.txt";$dataf =file ($data); /* Read the items in the survey project document * *$file _votes=fopen ($votes, "R");$line _votes=fgets ($file _votes, 255); * * read out the results of the investigation as recorded.Fclose ($file _votes);$single _vote=explode ("|"), $line _votes); /* and the data is cut into the specified string, then the string is passed back to the array variable.if ($result!=1)/
I/O multiplexing: A list of descriptors is constructed first, and then a function is called until one of these descriptors is ready for I/O and the function returns. When returned, it tells the process which descriptors are ready to be I/O.
The three functions poll, Pselect, and select Enable us to perform I/O multiplex transfer.One, select function
On all POSIX-compliant platforms, the Select function allows us to perform I/O multiplexing. The para
Error | Error handling | Design and implementation of a poll-type error handling mechanism (i.)
--------------------------------------------------------------------------------
Summary
This paper briefly introduces the design idea and implementation of a polling error handling mechanism, which can flexibly realize the extension of error handling mode and the customization of error information format.
---------------------------------------------
Reprinted from:Http://www.iteye.com/topic/469644
Let's talk about select:1. Socket quantity limit: the number of sockets that can be operated in this mode is determined by fd_setsize. The default kernel value is 32*32 = 1024.2. Operation restrictions: the fd_setsize socket is traversed to complete the scheduling. No matter which socket is active, it is traversed.
Poll:1. The number of sockets is almost unlimited: The FD list corresponding to the s
I wrote it myself. A poll showed that the bar with the highest number of votes was 100%.
public class voteresult:system.web.ui.page{protected System.Web.UI.HtmlControls.HtmlTableCell td_vote;protected System.Web.UI.HtmlControls.HtmlTable tab_result;private void Page_Load (object sender, System.EventArgs e)// Place the user code here to initialize the page {tab_result=new HtmlTable (); string voteid=request.params["Voteid"];string optionid=request.par
Long Longf[101][101];//recount per round, f[Ouyangwen current votes [Yi等 current votes], current total number of scenarios5 intMain ()6 {7 Long LongM,n;8scanf"%lld%lld",m,n);9f[1][0]=1;//Likewise, the first vote must be given to OuyangwenTen for(intI=1; i) One { A for(intj=0; j) - { - if(I>j (i!=1|| j!=0)) f[i][j]=f[i-1][j]+f[i][j-1];//to reach the current number of votes, either add a vote to Ouyangwen, or add a vote to Yi等. the Else if(I
Question Description
Ouyangwen and Yi等 campaign chairman, Wangliangsen responsible for recount, altogether M+n Zhang, the result Ouyangwen win, known Ouyangwen and Yi等 respectively get M ticket and N ticket (m>n). Now, please calculate how many Ouyangwen the number of votes in the recount process is always more than the number of yi等 votes.
Input
One row, including two numbers, M and N, respectively
Output
A number that r
Similar to log cutting, the system has a logrotate program to complete the archive. But now we're going to write ourselves a shell script to implement the archive. Example: If the output of the service log is 1.log, I asked to file a daily, 1.log the next day to become 1.log.1, the third day 1.log.2, the fourth day 1.log.3 until 1.log.5.Here is a reference script for you to refer to:#!/bin/bashfunction e_df () {[-F $] rm-f $1}for i in ' seq 5-1 2 ' do i2=$[$i-1] e_df/data/1.log. $i if [-f/data/
This articleArticleGood finishing: http://blog.sina.com.cn/s/blog_8fa7dd41010153zx.html
In addition, Poll/select have corresponding ppoll/pselect. The main reasons for existence are,
The reason that pselect () is needed is that if one wants to wait for either a signal or for a file descriptor to becomeReady, then an atomic test is needed to prevent race conditions. (Suppose the signal handler sets a global flag andReturns. Then a test of this global
voting question two
difficulty level: C; run time limit: 1000ms; operating space limit: 51200KB; code length limit: 2000000B
Question Description /td>
Ouyangwen and Yi等 campaign chairman, Wangliangsen is responsible for recount, a total of m+n, the result Ouyangwen win, known Ouyangwen and Yi等 respectively obtained m-ticket and N-ticket (m>n). Now, please calculate how many Ouyangwen the number of votes in the recount process is always more than
Log pollingMethod 1Download Cronlog softwareCd/home/lvnian/toolswget http://down1.chinaunix.net/distfiles/cronolog-1.6.2.tar.gzTar XF cronolog-1.6.2.tar.gzCD cronolog-1.6.2./configureMake make installLl/usr/local/sbin/cronolog###### #3Cronlog System self-bringing mode. Change access log in httpd.conf or httpd.vhost.conf to the following content# # #按天轮询Customlog "|/usr/local/sbin/cronolog/application/apache/logs/www.access_%y%m%d.log" combined# #按周轮询# #CustomLog "|/usr/local/sbin/cronolog/appli
high
Python SelectThe function that calls Select is R, W, E = select.select(rlist, wlist, xlist[, timeout]) , the first three parameters are three lists, the objects in the array are waitable object : Both the file descriptor of the whole number, or an object that has the method of returning the file descriptor (descriptor) fileno() ;
rlist: Waiting for the list to be read ready
wlist: Waiting for the list to be written ready
errlist: Wait for the list of "exceptions"
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.