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 passe
Head>
Note that the survey items in the file data.txt must be consistent with the number and arrangement of the above survey items, or they may be wrong or the results of the investigation will not be accurate. In order to display the survey results in a bar chart, you should prepare a number of different color bar pictures. such as: 0.gif,1.gif,2.gif,3.gif,4.gif and so on.The following is the survey.php code to implement th
This article is an example of Android programming to achieve ListView Head Viewpager Advertising Poll chart effect. Share to everyone for your reference, specific as follows:
Before looking at someone else's software, found that its advertising map polling time, the ads feel and viewpager effect is not the same, and later checked, because of the time problem, to find some information, their own practice.
1, in order to solve the ListView head plus V
Error | Error handling | design Errhdleventlogclass:
This class is the concrete implementation class that writes error information to the system log, which inherits from Abstracthandleclass. Users can customize the error-handling method by imitating the class. The specific code is as follows:
public class Errhdleventlogclass:abstracthandleclass
{
public const int ID = 2; Number of error-handling methods
Public Errhdleventlogclass ()
{
copying data from the kernel to the process (copying the data from the kernel to the)The LInux IO mode is divided into 5 types:Blocking io (blocking IO)Non-blocking IO (non-blocking io)IO multiplexing (IO multiplexing)Signal-driven IO (signal driven IO) (not commonly used)Asynchronous IO (Asynchronous IO)Blocking io (blocking IO):In Linux, by default, all sockets are blocking. This is illustrated below:There are two stages mentioned above, and in blocking IO, both phases are blocked.Non-blockin
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
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
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"
We see TCP clients processing two inputs at a time: standard input and TCP sockets. The problem we are experiencing is that the server process will be killed when the customer is blocking the (standard input) Fgets call. Server TCP sends a FIN correctly to client TCP, but since the client process is blocking the process of reading from standard input, it will not see this EOF until the socket is read (possibly over a long time). Such a process requires a capability to inform the kernel beforehan
This is a simple voting procedure, for just learning PHP and friends is a very good entry program. Here to introduce you, hope to be helpful to friends.
The system is composed of the following four files: The survey.htm of the HTML survey form, the survey.php of the investigation function, the data.txt of the investigation project are recorded. and record the results of the survey survey.txt. Data.txt and Survey.txt We can create them with notepad and upload them to the program directory. The f
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
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.