Author Archives: Robins

Error: listen eadrinuse: address already in use

Listen EADDRINUSE: Address already in use Error: Listen EADDRINUSE: Address already in use Error: listen EADDRINUSE: Address already in use Error.
solution (I use MAC system) : type sudo lsof – I: port number in the console, view the pid of the occupied process, and then type sudo kill -9 pid to kill the process.

error C2061: syntax error : identifier ‘BinryTreeNode’

1> D :\ My documentation \ Visual Studio 2005\ Tree \ Tree \tree\tree.h(23) : Error C2061: Syntax Error: Identifier ‘BinryTreeNode’

1> D :\ Visual Studio 2005\ Projects \ Tree \ Tree \ Tree.h (77) : See reference to class Template Instantiation
‘BinaryTree< T> ‘ being compiled

At the error indicated in the first line ‘BinaryTree< T> ‘Writing error

XLReport / Excel 2013 Ole Error 800A03EC

Ole Error 800A03EC is a well-known Error, and the cause of the Error is widely debated.
Recently, I have been using XLReport VCL to generate EXcel reports. This control (2003) was a great piece of Delphi7. Unfortunately, the following part did not update it for any reason, and even the company was cancelled.
Encountered this error Delphi developers are not a few, but have not been able to say why, have not been solved!
https://www.board4all.biz/threads/xlreport-excel-2013-ole-error-800a03ec.611247/
Through the debug tracking the problem is that call xlEngine. Procedure of pas units TxlExcelDataSource. GetRangeInfo
When ir.unmerge is executed, Ole Error 800A03EC, a nasty exception, occurs. The general view is caused by the upgrade of Excel version, but the original company has abandoned this product, no one can maintain and modify the source code, it is a pity, so excellent VCL.
Because there is source code, so after foreign experts modify, Delphi XE2 subsequent version can be installed and used, after constant exploration, finally solved the Ole Error 800A03EC exception, for the report development work brought high efficiency!

React bootstrap loading and how to use modules

React – Bootstrap website: http://react-bootstrap.github.io/
The style of react-bootstrap is basically the same as bootstrap, only the methods of how to load and how to use its modules are described here.
1. Open the command prompt and install react-bootstrap under wrokspace on react:

npm install react-bootstrap --save

Ii. React – Bootstrap method for Page loading:

import ReactBootstrap , {Panel,Button,SplitButton,MenuItem,handleSelect} from 'react-bootstrap';

Description: {the Panel, Button, SplitButton, MenuItem, handleSelect}
the Panel in curly braces, Button, SplitButton, MenuItem, handleSelect is ReactBootstrap group, with which the load which, need not all loading, can reduce the volume.

For example, the Panel component in ReactBootstrap is used for the component Pan
The code of Panel component officially provided is: Title is Panel title; PanelsInstance is Panel Content;

const title = (
<h3>Panel title</h3>
);

const panelsInstance = (
<div>
<Panel header={title}>
Panel content
</Panel>
</div>
);

//Pan components

import React,{Component} from 'react';
import {render} from 'react-dom';
import ReactBootstrap , {Panel} from 'react-bootstrap';

export default class Pan extends Component{
//initialize state
constructor(props){
super(props);
this.state = {
title: this.props.title
}
}
render(){
//import official module
const title = (
<h3>Panel title</h3>
);

const panelsInstance = (
<div>
<Panel header={title}> //set title as variable
Panel content
</Panel>
</div>
);

//return
return ( <div>
{panelsInstance}
</div>
)
}

Reprint please indicate the source!

[$ injector:unpr ] Unknown provider:–angular.module () function solution

This is undoubtedly one of the trickiest issues to encounter when developing a project with AngularJS:

ionic.bundle.js:26799 Error: [$injector:unpr] Unknown provider: fifoServiceProvider <- fifoService <- FifoController
http://errors.angularjs.org/1.5.3/$injector/unpr?p0=fifoServiceProvider%20%3C-%20fifoService%20%3C-%20FifoController
    at ionic.bundle.js:13443
    at ionic.bundle.js:17793
    at Object.getService [as get] (ionic.bundle.js:17946)
    at ionic.bundle.js:17798
    at getService (ionic.bundle.js:17946)
    at injectionArgs (ionic.bundle.js:17970)
    at Object.instantiate (ionic.bundle.js:18012)
    at $controller (ionic.bundle.js:23417)
    at Object.self.appendViewElement (ionic.bundle.js:59908)
    at Object.render (ionic.bundle.js:57901)

Encounter this problem, have no hint at all, look for a problem all have no way to start, headache unceasingly.
before we talk about the solution, let’s look at the angular.module function:

angular.module('MyApp',[])

In a SPA project, we can actually add more than one module. The module’s dependencies are then declared in that bracket.
This type of dependent function is called a module declaration.

angular.module('MyServices',['OtherService'])

He also USES it in another way, without the parenthesis:

angular.module('MyServices')

This method without brackets is used to refer to the module. So, the same module, of course, we only need to declare once OK:

angular.module('MyApp',['MyControllers','MyServices','MyDirectives']);

angular.module('MyControllers',[]);
angular.module('MyServices',[]);
angular.momdule('MyDirectives'[]);

So, angular.module(“,[]) is used to declare a module, equivalent to the setter function of an Angular module. Angular.module (), which refers to a module, on which we can add our own definitions.
So I check the code. Almost every service has an Angular. Module (“,[] “) in it. This is used to declare modules. Specially here to write, record down, hope to have encountered the same problem can adopt, this pit is really deep…

The garbage plug-in mixed in chrome causes an error in the front-end JS operation: only one instance of Babel Polyfill is allowed

NPM recently compiled a Vue project and ran it under Chrome, and got off to a bad start:
What r.d. fine is not a function
What is only one instance of babel-polyfill is allowed
I’m surprised that it works fine in QQ browser speed mode, but it doesn’t work well in chrome.
This is the bottom left side of the junk plug-ins, I don’t know when mixed into the Chrome browser. Chrome’s plugin is also written by JS, and it gets mixed up in the same programming domain as its own, causing interference. This thing loads all the other NPM components in the mess.

Solve MySQL error 1698 (28000): access denied for user ‘root’ @’localhost ‘

I believe that many users who just installed MySQL on Linux will encounter this problem, how to solve it?I found the answer on StackOverflow (I used method 1 and it worked), carried it over and translated it into Chinese.
The original address: https://stackoverflow.com/questions/39281594/error-1698-28000-access-denied-for-user-rootlocalhost

Problem description: When I log in to the MySQL database via root, I get an ERROR “ERROR 1698 (28000): Access deniedfor user ‘root’ @’ localhost ‘”.

Answer:
This is because MySQL USES the UNIX Auth_Socket Plugin by default in recent Ubuntu installations (and possibly others).
In simple terms, this means that when DB_users use the database, they will be authenticated through the system user authentication table. You can see if your root user is set to this by using the following command:

$ sudo mysql -u root # I had to use "sudo" since is new installation

mysql> USE mysql;
mysql> SELECT User, Host, plugin FROM mysql.user;

+------------------+-----------------------+
| User             | plugin                |
+------------------+-----------------------+
| root             | auth_socket           |
| mysql.sys        | mysql_native_password |
| debian-sys-maint | mysql_native_password |
+------------------+-----------------------+

As you can see from the query, root is using the AUTH_socket plug-in. There are two ways to solve this problem:
1. You can set your root user to use mysql_native_password plug-in 2. You can create a new database user that is consistent with your system user (recommended)
(Note: Method 2 meets the requirements of auth_Socket plug-in)
Option 1:

$ sudo mysql -u root # I had to use "sudo" since is new installation

mysql> USE mysql;
mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> exit;

$ service mysql restart

Option 2 (substitute your operating system username for YOUR_SYSTEM_USER) :

$ sudo mysql -u root # I had to use "sudo" since is new installation

mysql> USE mysql;
mysql> CREATE USER 'YOUR_SYSTEM_USER'@'localhost' IDENTIFIED BY '';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'YOUR_SYSTEM_USER'@'localhost';
mysql> UPDATE user SET plugin='auth_socket' WHERE User='YOUR_SYSTEM_USER';
mysql> FLUSH PRIVILEGES;
mysql> exit;

$ service mysql restart

Remember that if you choose to use Method 2, you should connect to MySQL by using your operating system user name (mysql-u YOUR_SYSTEM_USER).
Note: In some operating systems (such as Debian), the ‘auth_Socket’ plugin is called ‘unix_socket’, so the corresponding SQL command statement should be UPDATE User SET plugin= ‘unix_socket’ WHERE user = ‘YOUR_SYSTEM_USER’.

error: unclosed character literal (How to Fix)

Error: Error: the unclosed character literal value that has not ended

String variables using single quotes, double quotes, very low error.
The difference between char and String in Java
1. Char represents characters, defined with single quotes, and can store only one character, e.g. Char c=’x’;
A String is a String, defined in double quotes, that can store one or more characters, such as String name=” Tom “;

2. Char is the basic data type, while String is a class with object-oriented characteristics that can call methods such as name.length() to get the length of the String.

Network Error (dns_unresolved_hostname) -postman

directory
Background error reporting solution

background
Using Postman to access the jSON-Server’s virtual data failed, but there was no problem opening it locally
An error

The solution
File-> setting-> proxy-> Cancel the Add a custom proxy configuration

to cancel the Add a custom proxy configuration

the send again, success (, ̀ omega, ́) y, pay attention to choose the body – & gt; Json format

Python error: urllib.error.HTTPError : http Error 404: not found

The code is as follows:

import sys
import random
from urllib.request import urlopen
WORD_URL = "http://learncodethehardway.org/word.txt"
WORDS = []
PHRASES = {
    "class %%%(%%%):":
        "Make a class named %%% that is-a %%%.",
    "class %%%(object):\n\tdef __init__(self,***)":
        "class %%% has-a __init__ that takes self and *** params.",
    "class %%%(object): \n\tdef ***(self, @@@)":
        "class %%% has-a function *** that takes self and @@@ params.",
    "*** = %%%()":
        "Set *** to an instance of class %%%.",
    "***.*** = @@@":
        "From *** get the *** function, call it with params self, @@@,",
    "***.*** = '***'":
        "From *** get the *** attribute and  set it to '***'."
}
if len(sys.argv) == 2 and sys.argv[1] == "english":
    PHRASE_FIRST = True
else:
    PHRASE_FIRST = False

for word in urlopen(WORD_URL).readlines():
    WORDS.append(str(word.strip(), encoding='utf-8'))
    
def convert(snippet, phrase):
    class_names = [w.capitalize() for w in random.sample(WORDS, snippet.count("%%%"))]     
    other_names = random.sample(WORDS, snippet.count("***"))         
  results = []
    param_names = []
    for i in range(0, snippet.count('@@@')):
        param_count = random.randint(1, 3)    
        param_names.append(', '.join(random.sample(WORDS, param_count)))        
    for sentence in snippet, phrase:
        result = sentence[:]
        for word in class_names:
            result = result.replace('%%%', word, 1)     
        for word in other_names:
            result = result.replace('***', word, 1)     
        for word in param_names:
            result = result.replace('@@@', word, 1)     
        results.append(result)
    return results

try:
    while True:
        snippets = list(PHRASES.keys())    
        random.shuffle(snippets)        
        for snippet in snippets:
            phrase = PHRASES[snippet]      
            question, answer = convert(snippet, phrase)   
            if PHRASE_FIRST:
                question, answer = answer, question
            print(question)
            input("> ")
            print(f"ANSWER:  {answer}\n\n")

  except EOFError:
      print("\nBye")

Error message:

Traceback (most recent call last):
  File "E:/python/ex41.py", line 30, in <module>
    for word in urlopen(WORD_URL).readlines():
  File "D:\pycharm\lib\urllib\request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "D:\pycharm\lib\urllib\request.py", line 531, in open
    response = meth(req, response)
  File "D:\pycharm\lib\urllib\request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)
  File "D:\pycharm\lib\urllib\request.py", line 563, in error
    result = self._call_chain(*args)
  File "D:\pycharm\lib\urllib\request.py", line 503, in _call_chain
    result = func(*args)
  File "D:\pycharm\lib\urllib\request.py", line 755, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "D:\pycharm\lib\urllib\request.py", line 531, in open
    response = meth(req, response)
  File "D:\pycharm\lib\urllib\request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)
  File "D:\pycharm\lib\urllib\request.py", line 569, in error
    return self._call_chain(*args)
  File "D:\pycharm\lib\urllib\request.py", line 503, in _call_chain
    result = func(*args)
  File "D:\pycharm\lib\urllib\request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found