Php configuration file modification Sample code
$ Fp = fopen ("aaa. conf", 'r ');
$ Configfile = fread ($ fp, filesize ("aaa. conf "));
Fclose ($ fp );
// Use regular expression replacement
$ Configfile = preg_replace ("/\ n \ [password \] (. + ?) \ N/is "," ", $ configfile); // you only need to match the content between the [password] and the next
Example: # Environment: python3.xdefgetExportDbSql (db, index ): # obtain the SQL statement sqlmysqldump-u % s-p % s-h % s-P % d -- default-character-setutf8 -- databasesmu_ins_s % s gt; % s. s % d. mu_ins _ % d. SQL % (db [user], db [pwd], db [host], db [port], ind
This article shares the sample code for generating a bat script file for exporting the database using python.
Example:
# Environment: python3
# Copyright (c) 1993-1999 Microsoft Corp.## This was a sample HOSTS file used by Microsoft TCP/IP for Windows.## This file contains the mappings for IP addresses to host names. each# entry should is kept on a individual line. The IP address should# is placed in the first column followed by the corresponding host name.# The IP address and the host name should is s
Results:The field name IsjeffThe upload file name isd:\c language Exam sample/job title. rar
Example 2
Upload two files to the specified directory.
Demo2.html
demo2.jsp
Results:Upload Succeed
At this point, under "D:\temp" you can see the two files you uploaded.
Example 3
Upload a file to the specified directory and qualify
server log before the other slave node logs, MHA will apply the difference log from the Binlog server before recoveryIf Gtid is not turned on, MHA ignores Binlog servers. The following sample:manager_host$ cat/etc/app1.cnf[Server default]# MySQL user and passwordUser=rootPassword=mysqlpass# working directory on the managerManager_workdir=/var/log/masterha/app1# Manager log FileManager_log=/var/log/masterha/app1/app1.log# working directory on MySQL serversRemote_workdir=/var/log/masterha/app1[Se
Standard Controls Example:http://developer.xamarin.com/content/StandardControls/The iOS sample "Standard Controls" compilation error on the Xamarin website:Xamarin Failed to compile interface file. See Build Output for detailsSearch Xamarind Forums, a few posts are about the same error message, seemingly the most authoritative answer is the following: http://stackoverflow.com/questions/16938250/xamarin-stud
Sample Code for jquery to access the ashx file,
The. ashx file is used to write web handler .. The ashx file is similar to the. aspx file. It can be used to call the HttpHandler class, which removes the need for normal. aspx page control parsing and page processing. It is ac
Two threads, one per minute writes the current time to the specified file, and the other thread reads the newly written content per minute.
Using simple Thread.Sleep technology to implement timing
Package Test.thread Import java.io.BufferedReader; import java.io.File; Import Java.io.FileReader; Import Java.io.FileWriter; Import java.util.Date; /** * A sample that reads and writes the same
DIRECTORY CONTENTS ...') self.top.update () dirlist= Os.listdir (Tdir)#list all files under file directory TdirDirlist.sort ()#SortOs.chdir (Tdir)#set the current working directory to TdirSelf.dirl.config (TEXT=OS.GETCWD ())#configuration To set the second label content as the current working directorySelf.dirs.delete (0, END)#Delete the contents of the following table boxes in the old directorySelf.dirs.insert (END, Os.curdir)#Add the current direct
Android vcard uses the sample to generate the VCF file
When we back up the phone contacts, when exporting to the SD card, a VCF file is generated in the SD card to save the contact name and phone number.
The VCard specification allows for public exchange of personal Data exchange (Personal Data Interchange PDI) information, which can be found in tradit
In daily operation, without text processing, such as program input data preparation, Python by virtue of its simple and elegant syntax, in the text processing than C + + and other compiled language development efficiency of a large section, the following look at the codeThe sample file operation copies the code code as follows: #输入文件 f = open (R ' D:python27pro123.bak ') #输出文件 FW = open (R ' D:python27pro12
. Response.ContentType = "Image/jpeg";HC. Response.WriteFile (strFileName);26}/Else28 {HC. Response.ContentType = "Image/jpeg";HC. Response.Write ("No right");31}32}public bool IsReusable34 {# get36 {Panax Notoginseng return true;38}39}40}412. Front Page *.aspx Code1 23 45 6 7 8 9 13183. Register your own handler class configuration in the Web.config file
1 2 3 4 5 6Here I am putting the handler class JpgHandler.cs under the App_Code folder, if this c
Json file is a lightweight data interaction format. The getJSON () method is generally used in jquery to read data. The sample code is as follows. For more information, see, it is expected that your json file is a lightweight data interaction format. GetJSON () is generally used in jquery to read data.
The Code is as follows:
$. GetJSON (url, [data], [callback
("Content-Disposition: attachment; filename = \" ". basename ($ fullPath )."\";");Header ("Content-Transfer-Encoding: binary ");Header ("Content-Length:". $ fsize );Ob_clean (); // Clean (erase) the output bufferFlush (); // refresh the buffer of the PHP program, regardless of the situation in which PHP is executed (CGI, web server, etc ). This function sends all the output of the program so far to the user's browser.Readfile ($ fullPath); // read a file
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.