Recently began to learn python, so I took project Euler to practiced hand
Problem 1
If we list all the natural numbers below is multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
Run Result: 233168
PHP Version:
/** * @desc Project Euler 1 * @Author Tina * @Date 2015-08-27 * * * $sum = 0;for ($i =0; $i Python version:
sum
) variable parameter support slicing operation3) support multiple return values, use _ Skip the return value you do not want to usePackage MainImport ("Errors""FMT")Func Add (A, B int) (ret int, err error) {If aErr = errors. New ("should be non-negative numbers!")Return}Return A+b,nil}Func Main () {Fmt. Println (ADD (1,3))}12. Anonymous functions and closures:1) Anonymous functions can be assigned directly to a variableF:=func (x, y int) int {Return X
1. How to create hidden superusers on the graphic interface
The graphic interface is applicable to bots running local or 3389 Terminal Services. The author I mentioned has a good idea, but it is better to use psu.exe (ProgramIf you want to upload psu.exe to a program running with the System user ID. In my opinion, this deployment will be applied to the psu.exe program. Because Windows2000 has two registry Editors: regedit.exeand regedt32.exe. In X
X values represents the number of final solutions. For a Z, after X is set, y automatically determines ):
Z = 0, x = 100, 98, 96,... 0
Z = 1, x = 95, 93,..., 1
Z = 2, x = 90, 88,..., 0
Z = 3, x = 85, 83,..., 1
Z = 4, x = 80, 78,..., 0
......
Z = 19, x = 5, 3, 1
Z = 20, x =
control. In IE browser, the drop-down list is always at the beginning, which does affect the page effect. The appearance of this control can solve this problem. the pop-up window anytime and anywhere becomes the landmark of the WEB 2.0 website, and more pop-up things are available.[Details](1) controls on which TargetControlID should be extended(2) What does DropDownControlID pop up?(3) In the example, an
The window shown in 1 is displayed when you run webmatrix for the first time.
Figure 1 window displayed when webmatrix is run for the first time
My website
Go to "my website" and you will be able to see the website you have designed.
Create a website from a Web Library
You can create a website from an open-source website system on the "Create a website from a Web
Usage of MySQL time Conversion Function
Dayofweek (date)Returns the index of the week of the date (1 = Sunday, 2 = Monday ,...... 7 = Saturday ). These index values correspond to the ODBC standard.Mysql> select dayofweek (2007-10-31 );-> 4
Weekday (date)Returns the week index of date (0 = Monday, 1 = Tuesday ,...... 6 = Sunday ).Mysql> select weekday ('2017-1
. NET Framework (part 2) (1)
[Author: Unknown addition time: 8:11:13]
! [6.0 programmers, your first choice may be a tested and effective old method. However, if possible, you 'd better get rid of old habits and adopt the new. NET system class. Why? Because the use of the system class makes it easier for your code to be transplanted to other. NET
requirements, use a Shell script to automate the entire backup process.
[Root @ CentOS ~] # Vi mysql-backup.sh notebook create database automatic backup script, as follows:#! /Bin/bashPATH =/usr/local/sbin:/usr/bin:/bin# The Directory of BackupBACKDIR =/backup/mysql# The Password of MySQLROOTPASS = ********* replace the star number with the MySQL root password.# Remake the Directory of BackupRm-rf $ BACKDIRMkdir-p $ BACKDIR# Get the Name of DatabaseDBLIST = 'ls-p/var/lib/mysql | grep/
Common verification rules// Mobile phone number verification The code is as follows:Copy code JQuery. validator. addMethod ("mobile", function (value, element ){Var length = value. length;Var mobile =/^ (13 [0-9] {1}) | (15 [0-9] {1}) + d {8}) $/Return this. optional (element) | (length = 11 mobile. test (value ));}, "Incorrect mobile phone nu
They are all instances. You can refer to them to write them one by one.
They are all instances. You can refer to them to write them one by one.
Usage of mysql time Conversion Function
DAYOFWEEK (date)Returns the index of the week of the date (1 = Sunday, 2 = Monday ,...... 7 = Saturday ). These index values correspond to the ODBC standard.Mysql> select DAYOFWEEK (2007-10-31 );-> 4WEEKDAY (date)Returns th
. **************************************** **************************************** **
Function updatePage (){If (request. readyState Document. getElementById ("Status"). innerHTML = "Loading ...";Document. getElementById ("Pages"). innerHTML = "Previous │ Next ";}
If (request. readyState = 4) {// status 4 ---- complete.If (request. status = 200) {// if the http status is 200 -- when data is obtained successfully.RequestAllright ();} Else {// If the http status is 404 -- http reports an error.Do
NCodeGenerate is very convenient to use.
During use, we often use some common code in different templates. If there is no extension mechanism, the code needs to be copied between various templates, which is obviously too low-level.
By the way, you are right. NCodeGenerate has a good public mechanism. There are two types in total:
I. C # code extension.
Ii. Assembly Extension.
Today we will talk about the first type, C # code extension.
Step 1: Create
(request. readyState Document. getElementById ("Status"). innerHTML = "Loading ...";Document. getElementById ("Pages"). innerHTML = "Previous │ Next ";}If (request. readyState = 4) {// status 4 ---- complete.If (request. status = 200) {// if the http status is 200 -- when data is obtained successfully.RequestAllright ();} Else {// If the http status is 404 -- http reports an error.Document. getElementById ("Status"). innerHTML = "Error:" + request. status;Document. getElementById ("Pages"). inn
, thus reducing page opening time) 3. Use load Balancing (Buy a server ... 4. Use caching (similar to dynamic page statics) 1, minimize the number of HTTP requests 2, reduce DNS lookups 3, avoid jump 4, cacheable Ajax 5, defer loading content 6, preload 7, reduce the number of DOM elements 8, divide page content by domain name 9, minimize the number of IFRAME 10, do not appear 404 error 11, use the content
This feature is relatively simple, and we will continue to talk about it for a long time, but only focus on it. In the following demo, we often use overload functions to handle problems:
Code
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 1 Public Void Process ( Int P1, Float P2, String P3) 2 { 3 // Todo 4 } 5 6 Public Void
.
Bytes
View sourceprint? 1 string sqlcon = "packet size = 4096; data source = 127.0.0.1; persist security info = True; initial catalog = Db_Example; user id = sa ";
2 SqlConnection myCon = new SqlConnection (sqlcon );
3.3 SqlConnection. Open Method to Open the database connection.
3.4 SqlConnection. Close method to Close the database connection.
3.5 SqlConnection. Dispose method to release resources.
Iv.
1.Given A collection of numbers, return all possible permutations.For example,[1,2,3]The following permutations:[1,2,3],,,,, [1,3,2] [2,1,3] [2,3,1] [3,1,2] and [3,2,1] .2.Given A collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2]The following unique permutations:[1,1,2], [1,2,1] , and [2,1,1] .Solution:dfs1
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.