Category Archives: How to Fix

Reverse function: reverses container contents

The reverse function reverses the contents of a container, contained in < algorithm> In the library.
1. Function prototype
The reverse function is equivalent to the following code:

template <class BidirectionalIterator> void reverse (BidirectionalIterator first, BidirectionalIterator last)
{
     while ((first!=last)&&(first!=--last))
     {
          std::iter_swap (first,last);
          ++first;
     }
}

The reverse function swaps two elements using iter_swap.

2. Parameters: first and last
First and last are bidirectional iterators, and the scope of reverse function inversion is [first,last], so the elements pointed to by first are included, but the elements pointed to by last are not.
3. Return value
The reverse function returns no value.
Example 4,

// reverse algorithm example
#include <iostream>    
// std::cout
#include <algorithm>   
// std::reverse
#include <vector>      
// std::vector

int main () {
    std::vector<int> myvector;
    // set some values:
    for (int i=1; i<10; ++i) myvector.push_back(i);   // 1 2 3 4 5 6 7 8 9
    std::reverse(myvector.begin(),myvector.end());    // 9 8 7 6 5 4 3 2 1
    // print out content:
    std::cout << "myvector contains:";
    for (std::vector<int>::iterator it=myvector.begin(); it!=myvector.end(); ++it)
        std::cout << ' ' << *it;
    std::cout << '\n';
    return 0;
}

Output:

myvector contains: 9 8 7 6 5 4 3 2 1

5. Complexity

Iterate over the first and last elements. So the complexity is linear and the loop is half the length of the array.

Anaconda upgrade sklearn version

Project github address: bitcarmanlee easy-algorithm-interview-and practice
welcome to star, message, study and progress together
When you call model_selection for Sklearn, you find a module with no Model_selection in Sklearn. Upon inspection, the SkLearn version in Anaconda was found to be too low, at version 0.17. So sklearn started to upgrade.
1. View the original version
First use the conda list command to check the existing version:

Sure enough, version 0.17.1 was too low, so it was time to upgrade.
2. Upgrade to the latest version
Use the conda update scikit-learn command to update the version of sklearn. Before you update, you will be prompted for what version to update to.

As you can see, the latest version is 0.19.0
Then confirm and start updating.

Due to the large number of packages that need to be updated this time, it will take quite a long time…
Once the update is complete, then use the Model_Selection package, and it’s OK to use 1

Delete and unload node on MAC

Uninstall node
and execute the following script in turn on the terminal

sudo npm uninstall npm -g
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
sudo rm -rf /usr/local/include/node /Users/$USER/.npm
sudo rm /usr/local/bin/node
sudo rm /usr/local/share/man/man1/node.1
sudo rm /usr/local/lib/dtrace/node.d

So let’s verify that one last time

node //command not found
npm //command not found

That’s it.

reference address:
https://www.jianshu.com/p/920961b6a538

Installation library on pychar (taking pandas for example)

Some reports on the web show that there are problems when installing pandas, and the prompt seems to be the cause of PIP.
is probably your PIP version for too long. So it’s best to update the PIP at CMD first.
Enter the command in CMD:

python -m pip install -U pip

Successful information: Requirement already up-to-date.
Then turn on pycharm
1, click file/ Settings
2, and select project/project interpreter
in the popup screen
3. Click “+” on the upper right to enter the interface
for searching third-party libraries
4. Search the corresponding library or module to be installed in the search box, and click “Install Package” at the bottom left. If the installation is complete, the library displays the font color to blue, and in the previous screen lists the libraries you have installed

5. When it is finished, it will not be marked red when importing

IT Skill: How to Recall Email Message in Outlook 2007

In Go Lala Go, a hapless Helen accidentally sends a rather private email to everyone and gets fired, as everyone remembers. In real life, it’s not uncommon to accidentally send an email while it’s still being edited. How to do?Recall it immediately!

For the email Sent just now, find it in the Sent Items Folder. Open it. In the Ribbon screen that opens the email, select the following option:
Actions –> Other Actions –> Recall This Message…


Then, choose from the following dialog:


That will do.

It also is not always going to be successful. If it has already been browsed, it is going to be unsuccessful, so it is going to be fast.

Learn English together | three ways to realize digital factorial with JavaScript

click on the top
“Front end talent” can subscribe oh!
Original title: “Three Ways to Factorialize a Number in JavaScript”
Sonya Moisset
The original link: https://medium.freecodecamp.com/how-to-factorialize-a-number-in-javascript-9263c89a4b38
2. The English version of the dictionary is translated by the English version of the dictionary
Front-end technology changes with each new day, a lot of new technical articles are in English, which requires us to have a good English ability, from today on small make up and we learn English while learning the front end, due to limited ability, welcome everyone correct, together to improve English.
This article is based on Free Code Camp Basic Algorithm Scripting “Factorialize a Number”.
Translation:
This article is based on the Free Code Camp basic algorithm script “Digital factorials”.
Note: Free Code Camp is a Free online learning website. Web site address: https://www.freecodecamp.com
Key words:
algorithm
An algorithm, esp in a computer program
In mathematics, the factorial of a non-negative integer n can be a tricky algorithm. In this article, I’m going to explain three approaches, first with the recursive function, second using a while loop and third using a for loop.
Translation:
In mathematics, factorial of a non-negative integer n can be a tricky algorithm. In this article, I’ll do it three ways, first with recursive functions, second with a while loop, and third with a for loop.
Key words:
factorial
It is a factor of two
N. The factorial product
non-negative
non-negative
tricky
Difficult to deal with; Difficult to deal with; Tricky; Crafty; scheming. The treacherous; Sly.
approach
vt.& Come near, come near, come near
Vt. Close to; Get to grips with; Make closer; Try to bribe (or influence, smooth)
N. method; Way; Close to the
Vi. Near
recursive function
Recursive function
We have already seen a recursion approach on a String in the previous article, How to Reverse a String in JavaScript in 3 Different Ways ?This time we will apply the same concept on a number.
Translation:
We’ve seen recursion in string manipulation in the last article. How do you reverse strings in JavaScript in three different ways?This time we’ll apply the same concepts to Numbers.
Key words:
concept
Concept; Point of view; Thought, conception, idea; The overall impression

Algorithm Challenge

Return the factorial of the provided integer.

If the integer is represented with the letter n, a factorial is the product of all positive integers less than or equal to n.

So, flexibly?B: Well, general rules are often terrible.

For example: 5! So it’s 1 times 2 times 3 times 4 times 5, which is 120
Translation:
Challenge algorithm
Returns the factorial of a specified integer.
If integers are represented by the letter N, the factorial is the product of all positive integers less than or equal to N.
Factorial is usually written in shorthand notation N! Said.
For example: 5! So it’s 1 times 2 times 3 times 4 times 5, which is 120
The function factorialize (num) {
return num;    
}
factorialize(5);    
Key words:
represented
V. representative; Reflect; To represent (a past tense and past participle); As a… The representative of the
positive
adj.
Positive; Be sure of STH. Positive; Positive
n.
Positive; Positive; [Language] a primal adjective; Positive quantity
shorthand notation
Simplify the symbol
Provided the test cases
Factorialize (0) should return 1factorialize(5) should return 120factorialize(10) should return 3628800factorialize(20) should return 2432902008176640000
Translation:
Provide test cases:
Factorialize (0) should return 1factorialize(5) should return 120factorialize(10) should return 3628800factorialize(20) should return 2432902008176640000
Key words:
provided
Conj. If; If; In the… Under the condition of
A. provide B. provide C. provide D. provide
What is factorializing a number all about?

When you factorialize a number, you are multiplying that number by each consecutive number minus one.

If your number is 5, you would have:
5! = 5 * 4 * 3 * 2 * 1
The pattern would be:
0! = 1
1! = 1
2! = 2 * 1
3! = 3 * 2 * 1
4! = 4 * 3 * 2 * 1
5! So it’s 5 times 4 times 3 times 2 times 1
Translation:
What exactly is a digital factorial?
When you take the factorial of a number, decrease the number by 1 each time and multiply.
If the number is 5, you should look like this:
5! So it’s 5 times 4 times 3 times 2 times 1
This pattern will:
0! = 1
1! = 1
2! = 2 * 1
3! = 3 * 2 * 1
4! = 4 * 3 * 2 * 1
5! So it’s 5 times 4 times 3 times 2 times 1
Key words:
consecutive
Continuous, continuous, or continuous; Indicating the result
multiplying
Six (multiply) four times from six. Multiply; multiply. Add to; add to Breed
1. Factorialize a Number With Recursion
The function factorialize (num) {
if (num < 0)
return -1;    
Else if (num == 0)
return 1;    
The else {
return (num * factorialize(num – 1));    
}
}
factorialize(5);    
2 Factorialize a Number with a WHILE loop
The function factorialize (num) {
var result = num;    
If (num === 0 || num === 1)
return 1;    
while (num > 1) {
num–;    
result *= num;    
}
return result;    
}
factorialize(5);    
3 Factorialize a Number with a FOR loop
The function factorialize (num) {
If (num === 0 || num === 1)
return 1;    
for (var i = num – 1; i > = 1; I -) {
num *= i;    
}
return num;    
}
factorialize(5);    

About today’s article sharing here, I hope you have a harvest, about the original English please click on the original reading view (need over the wall to see, you know)

The public,
The front-end talent
Long press to identify the left two-dimensional code to follow me click below “read the original” to view the English text down down down

How to come a good theoretical physics

I read physics related major, but I feel confused after studying for a long time, I hereby reprint the relevant opinions of two great cattle, at least have a look at what physics is in the end, and read the blog “Academic corruption is inevitable in history” article is quite fruitful.
One: How to be a good theoretical physicist.
Gerard’s Hooft gives a list, Suggestions, explanations, and links to related resources on what to learn as a theoretical physicist.
The following link is the translation version of HMY (the translation version has the website address of the original version in foreign language) :
https://www.douban.com/group/topic/23010402/
 
2. Landau Barrier:
Content: differential equations, mathematical physics equations, tensor analysis and differential geometry
2. Mechanics
, except 27, 29, 30, 37, 51 (1988)
v.i.a.old, Mathematical methods of classical mechanics
3. Classical field theory
: Landau and Lifshits II, except for the following subsections: 50, 54-57, 59-61, 68, 70, 74, 77, 97, 98, 102, 106, 108, 109, 115-119 (1989)
4. Mathematics 2
exam content: complex function, special function (Bessel, ellipse, gamma, orthogonal polynomial), integral transform
5. Quantum mechanics
exam content: Landau-Lifshits III (1989) except the following subsections: 29, 49, 51, 57, 77, 80, 84, 85, 87, 88, 90, 101, 104, 105, 106-110, 114, 138, 152
6. Quantum electrodynamics
exam content: Landau-Lifshits IV (1980) except the following subsections: 9, 14-16, 31, 35, 38-41, 46-48, 51-52, 55, 57, 66-70, 82, 84-85, 87, 89-91, 95-97, 100-101, 106-109, 112, 115-144
7. Statistical physics I
exam content: Landau-Lifshits V divided by the following subsections: 22, 30, 50, 60, 68, 70, 72, 79, 80, 84, 95, 99, 100, 125-127, 134-141, 150-153, 155-160
8. Continuum mechanics
exam content: fluid mechanics, Landau-Lifshits VI (1986), divided by the following subsections: 1, 13, 14, 21, 23, 25-27, 28, 30-32, 34-48, 53-59, 63, 67-78, 80, 83, 86-88, 90, 91, 94-141
9. Continuum electrodynamics
examination contents: Landau-Lifshits VIII (1982) except the following subsections: 1-5, 9, 15, 16, 18, 25, 28, 34-35, 42-44, 56-57, 61-64, 69, 74, 79-81, 84, 91-112, 123, 126
10. Statistical physics II
exam content: landau-lifshits IX (1978), exam the following subsections: 1-5, 7-18, 22-27, 29, 36-40, 43-48, 50, 55-61, 63-65, 69
11.
physical kinetics: Landau-Lifshits X (1979), with the following section: 1-8, 11, 12, 14, 21, 22, 24, 27-30, 32-34, 41-44, 66-69, 75, 78-82, 86, 101.
while working in kharkiv, the 24-year-old Landau laid down the “minimum standard in theoretical physics”, a set of exams that came to be known as Landau’s “barrier”, for graduate students who wished to follow him. In accordance with the later standardized requirements, the “minimum standard” consists of a mathematics and eight theoretical physics interview. The last eight are theoretical mechanics, classical field theory including special and general relativity, statistical physics, non-relativistic quantum mechanics, continuum electrodynamics, physical dynamics, continuum fluid mechanics and elastic mechanics, and quantum field theory. The test focuses on problem-solving rather than abstract theoretical frameworks, and Mr. Landau once told young students that a well-prepared person should be able to pass the ‘minimum’ in three months or, if necessary, in a year. Many of Landau’s own students have been admitted on the “minimum” basis. In fact, the “minimum” is far from a barrier for Russian students interested in theoretical physics, who usually start at the beginning of their undergraduate studies. At first Landau presided over every exam, and later his professor-level assistants Shared most of the courses, but the first mathematics and the last quantum field theory were always landau himself. Landau kept a notebook in which he kept a personal record of the names and years of those who eventually passed. According to incomplete statistics, at least 18 of the 43 went on to become members or correspondents of the Academy of Sciences of the Soviet Union or the Republic of Korea, with one winning the Nobel Prize in physics. The only non-Soviet citizen on the list is L szlOTisza, a Hungarian who passed his exam in Kharkiv in 1935 and is still alive. He was a year older than Landau, moved to America in 1941 and taught at the Massachusetts Institute of Technology until he retired. A small number of people, after passing the “barrier”, are exhausted, exhausted and exhausted, and never appear again.

C / C + + library function (tower / tower) realizes the conversion of letter case

C/C++ library function (tolower/toupper) implements case conversion of letters

This article will introduce the library function to implement the case conversion of letters, commonly used in the type. H (c ++ is cctype) library file under the definition of function methods. First let’s look at the prototype implementation of the tolower/toupper function under C:

int tolower(int c)
{
	if ((c >= 'A') && (c <= 'Z'))
		return c + ('a' - 'A');
	return c;
}

int toupper(int c)
{
	if ((c >= 'a') && (c <= 'z'))
		return c + ('A' - 'a');
	return c;
}

And I’m going to do that with two little demos.

C implementation:

#include<string.h>   //strlen
#include<stdio.h>    //printf
#include<ctype.h>    //tolower
int main()
{
    int i;
    char string[] = "THIS IS A STRING";
    printf("%s\n", string);
    for (i = 0; i < strlen(string); i++)
    {
        string[i] = tolower(string[i]);
    }
    printf("%s\n", string);
    printf("\n");
}

Save as xxX. c file, execute: GCC-O XXX xxX. c generate execute file XXX. Operation:./ XXX



above is the implementation of C. Similarly, the implementation under C++ is as follows:

#include <iostream>
#include <string>
#include <cctype>
using namespace std;
int main()
{
    string str= "THIS IS A STRING";
    for (int i=0; i <str.size(); i++)
       str[i] = tolower(str[i]);
    cout<<str<<endl;
    return 0;
}

Save as xxx. CPP, execute g++ xxx. CPP to generate the execution file a.ut, execute a.ut, and the effect is as follows:



The demo above
implements the upper case tolower case conversion, again, the lower case toupper case conversion is the same, just replace tolower with toupper.

To solve this problem, we can’t find the solution of / storage / emulated / 0 / file. I can’t. You can try this

Open Device File Explorer-& GT; Locate the MNT folder -> Find the SDCard folder -> Find storage – & gt; Find your file in turn (add it if you don’t have one) -> Just put the full path in your code.
eg:

String sdpath = Environment.getExternalStorageDirectory()
                    .getAbsolutePath();
filepath = File.separator + "mnt" + File.separator + "sdcard" + sdpath + File.separator + "movie.mp4";

Anaconda builds a new environment and installs sklearn, numpy and other modules

Under Anaconda we already have gluon’s environment
Now I want to build an environment for TensorFlow,

2. Install Tensorflow
TensorFlow currently only supports Python 3.5 on Windows.
(1) open Anaconda Prompt and input tsinghua warehouse image, so that the update will be faster:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes

12
(2) Also use Anaconda Prompt to create a Python3.5 environment with the name of TensorFlow. Type the following command:

conda create -n tensorflow python=3.5

1
Run start menu -> Anaconda3 - & gt; Anaconda Navigator, click the left Environments, you can see that the environment of tensorflow has been created.


(3) TensorFlow environment is started in Anaconda Prompt:

activate tensorflow

1

Note: when not using tensorflow, close the tensorflow environment with the command: deactivate

After installing the environment, we go to the folder we want to run, such as CD TensorFlow
Then activate tensorFlow

The TensorFlow environment is fine, but tensorFlow is not installed,
conda insatll tensorflow
And in the environment to install jupyter Notebook, NUMpy and other modules
conda install jupyter notebook
conda install scikit-learn

From https://blog.csdn.net/u010858605/article/details/64128466