Server. Java: source code
Import java.net .*;Import java. Io .*;
Public class server {
Public server ()
{
Bufferedreader BR = NULL;
Printwriter PW = NULL;
Try
{
Serversocket Server = new serversocket (8888); // create a server
Socket socket = server. Accept (); // listen to the client
// Obtain the input stream of the Connection
BR = new bufferedreader (New inputstreamreader (socket. getinputstream ()));
// Get the output stream of the Connection
her home directory.
4.3 configure pureftp
1. Add a user:
# Pure-pw useradd xcityr-f/usr/local/pureftp/etc/ftppasswd-u nobody-g nobody-d/data/web/xcity-m
# Pure-pw useradd sports-f/usr/local/pureftp/etc/ftppasswd-u nobody-g nobody-d/data/web/sports-m
--- Note: xcity: ftp user
-F ftppasswd: file for storing user password information
-U user uid is generally a system user, which is the user of your f
SurfaceThe pros and cons do a hash to judge, and then in two hashes to take a $max/min$ hash, and then each string of hash into the $set$, the final statistical set size, you can excellent in $o (nlog^2$ $n) $ in the solutionThen I think this is too no ideal, wrote a chain hash table, the result of running thieves slow ...I hang the chain when the method is to change the modulus and then mold a new value, and then do this when the attention to the hash table and the cardinality and modulus of th
use the following command to implement.Killall PUREF-FTPDcd/usr/local/pureftpd/;/sbin/pure-config.pl./etc/pure-ftpd.conf6. Create a Test CatalogMkdir/tmp/ftpchown-r wyp:wyp/tmp/ftp # prepare to map the virtual user to the system user Wyp, so have permissions. 7. Create User account password/usr/local/pureftpd/bin/pure-pw useradd user1-uwyp-d/tmp/ftp/ EnterEnter Password two times-U associates the virtual user User1 with the system user Wyp, that is,
verify the user name and password, and then you can add the verification code can not be logged in the same time can be verified in the background blacklistYou can also limit the number of times a user enters an incorrect user name or password, and when the number of errors is too much, you can't log in for a certain amount of time. In fact, think carefully, the login function above can add things are still a lot of.
Be aware of SQL injection issues and do not use
SELECT Count (*) from user WH
Add and retrieve ServletContext
(1) Understanding of ServletContext:
(2) Add attributes to servletcontext
Package com. tsinghua; import javax. servlet. http. *; import javax. servlet. *; import java. io. *; public class ServletContextTest1 extends HttpServlet {// process get requests // req: used to obtain information about the client (browser) // res: used to send information to the client (browser) public void doGet (HttpServletRequest req, HttpServletResponse res) {// business logic try {/
. printWriter; import java. util. date; public class PrintWriterTest {public static void main (String args []) {BufferedReader bf = new BufferedReader (new InputStreamRead Er (System. in); String s = null; PrintWriter pw = null; try {// PrintWriter constructor sets whether automatic flush is set to true to automatically flush. If true is not set, you must manually call the flush method to print the content to the file.
1. use URL: URL url = new URL ("ftp: // javaa: javaa@172.168.2.222: 21/test/javaa.txt"); PrintWriter pw = new PrintWriter (url. openConnection (). getOutputStream (); pw. write ("this is a test"); pw. flush (); pw. close (); The above is a piece of code. The URL constructor parameters can use different access protocols
System. out. println ("I Am a server, the client said:" + info); 15} 16 socket. shutdownInput (); // close the input stream 17 // 4. Obtain the output stream and respond to the client's request 18 OutputStream OS = socket. getOutputStream (); 19 PrintWriter pw = new PrintWriter (OS); 20 pw. write ("Welcome! "); 21 pw. flush (); 22 23 24 // 5. Close resource 25
) = = 0) {
Threads[i].setpriority (thread.max_priority);
} else {
Threads[i].setpriority (thread.min_priority);
}
Threads[i].setname ("thread-" + i);
}
7. Create a PrintWriter object that records the transformation of thread state to a file. The code is as follows:
Copy Code code as follows:
Try (FileWriter file = new FileWriter ("D:\\thread.log");
PrintWriter pw = new PrintWriter (file)) {
JAVA7 syntax i
"topic link": https://nanti.jisuanke.com/t/25087
"Topic description":
The integer power of a number is often used in our calculations, but how can we work out the result in the time of O (log (n)).
The code in the Code box is an implementation, please analyze and fill in the missing code to find the result of X^y mod p.
Import java.util.*;public class Main {public static int pw (int x, int y, int p) {if (y = = 0) {return 1;}int res =//* Fill in the n
Use PHP to implement online management code for Ftp users. The leader asked me to plan a web design competition and Flash creation competition. online registration and uploading of works are required. I have implemented this requirement through FreeBSD + Apache + PHP + Mysql + FTP. When the leaders want me to plan a web design competition and Flash creation competition, they must register online and upload works. I have implemented this requirement through FreeBSD + Apache + PHP + Mysql + FTP.
, out IO. Writer), app2 func (in IO. Reader, out IO. Writer)) func (in IO. Reader, out IO. Writer) { return func (in IO). Reader, out IO. Writer) { PR, pw: = Io. Pipe () defer pw. Close () go func () { defer pr. Close () app2 (PR, out) } () App1 (in, PW)} }
To understand the pipe function, you need
allow anonymous logonsNoanonymous YesSyslogfacility FTPDontresolve YesMaxIdleTime 15PUREDB/ETC/PURE-FTPD/PUREFTPD.PDB # Generate a password vault fileLimitrecursion 3136 8 #限制最为文件数 Deepest sub-directoryAnonymouscancreatedirs NoMaxload 4Antiwarez YesUmask 133:022Minuid #最小的用户登录uidALLOWUSERFXP NoALLOWANONYMOUSFXP NoProhibitdotfileswrite NoProhibitdotfilesread NoAutorename NoAnonymouscantupload NoCustomerproof Yes 3 Create a user, password, and assign a local user to the virtual user. and the FTP
. Restarting may be a bit cumbersome, after all, we don't have a startup script. Restart, you can use the following command to implement.Killall PUREF-FTPDcd/usr/local/pureftpd/;/sbin/pure-config.pl./etc/pure-ftpd.conf5. Create an AccountThe account used by PURE-FTPD is not a Linux system account, but a virtual account. Because it's safer to do so.mkdir/data/www/Useradd FTPChown-r ftp:ftp/data/www//USR/LOCAL/PUREFTPD/BIN/PURE-PW Useradd ftp_user1-uftp
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.