The reason is that the header file fstream was not added.
Add the
#include<fstream>
The reason is that the header file fstream was not added.
Add the
#include<fstream>
C:\Users\Administrator>adb devices -l
List of devices attached
adb server version (31) doesn’t match this client (40); Killing…
could not read OK from ADB server
* failed to start daemon
error: cannot connect to daemon
— prompt the above information. The solution is as follows: —
C: (users, administrator & gt; CD \
C: \ & gt; D:
D: \ & gt; CD: androidsdk, platform tools
D: (androidsdk, platform tools & gt; netstat -aon|findstr “5037”
TCP 127.0.0.1:5037 0.0.0.0:0 LISTENING 10676
D:\androidsdk\platform-tools>tasklist|findstr “10676”
LdsMobileLink.exe 10676 Console 1 27,344 K
——–Manually end the above process, from the new ADB devices – L ——– – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – -; starting now at tcp:5037
* daemon started successfully
2PFNW18B08014453 device product:JKM-AL00b model:JKM_ AL00b device:HWJKM-HM transport_ id:1
EditText editText =(EditText)findViewById(R。 id.editText ); in “((R id.editText ))”Error cannot resolve symbol ‘EditText’
Today, there was an error when learning from the Android Studio development document. When starting another activity and building an intent, https://developer.android.google.cn/training/basics/firstapp/starting-activity#java
public void sendMessage(View view) {
Intent intent = new Intent(this, DisplayMessageActivity.class);
EditText editText = (EditText) findViewById(R.id.editText);
String message = editText.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message);
startActivity(intent);
}
Solution, view activity_ main.xml , text edit box section
<EditText
android:id="@+id/editTextTextPersonName3"
Change the EditText in the SendMessage method to the corresponding, I’m here edittexttextpersonname3, as shown in the figure
public void sendMessage(View view) {
Intent intent = new Intent(this, DisplayMessageActivity.class);
EditText editText = (EditText) findViewById(R.id.editTextTextPersonName3);
String message = editText.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message);
startActivity(intent);
}
Problem description
Image resource reference error, there are usually the following similar error logs:
java.lang.NumberFormatException: Color value
'@drawable/xx' must start with #
reason
The most likely cause of this problem is that your image resource name is wrong, and it is likely to start with a number. In Android, if your image is named after a number, the system will treat it as a hexadecimal color value by default, and the definition of these color values often starts with “#”, so there is the following numberformatexception.
Solution
At this time, you need to check whether the name of the wrong resource starts with a number. If it starts with a number, rename it. If not, try to check whether the name of the resource starts with a space in eclipse (of course, the error at this time is that the drawable file cannot be found). If so, modify it. If not, delete the image and add it again.
After renaming, if the layout file cannot be displayed normally, refresh the preview of the layout view or restart the development tool.
When using JSON in Python to read a JSON file, an error is reported because the corresponding method is used incorrectly: typeerror: the JSON object must be STR, bytes or byte array, not ‘textiowrapper’.
Solution: first of all, we need to understand that there are four methods for JSON: dumps and loads, dump and load. Among them, dumps and loads are converted in memory (the conversion between Python objects and JSON strings), while dump and load are the processing corresponding to files.
The reason for this error is that I used the loads method to convert the JSON file into a python object, and the correct way is to use the load method.
SystemError: new style getargs format but argument is not a tuple
**
A very simple but BD less than a small bug
Read data using CV2. Reset() function, the original program: CV2. Reset (IMG, 28,56), the picture to (28,56) size. The error is as follows: systemerror: new style getargs format but argument is not a tuple!
![]()
Parameter non tuple case!
At the beginning, change 28,56 to [28,56], but it still can’t be changed to (28,56)
that is, reset (IMG, (28,56)).
just started to write programs in Python, and used Matlab before, so there are always such and such errors, I hope others can find the debug as soon as possible!
I wish you a quick and successful debug!
1. When the training code is CLF = SVC (probability = false), predict_ The prompt is as follows: attributeerror: predict_ proba is not available when probability=False;
Parameter explanation: probability boolean type; optional; default is false
Decide whether to enable probability estimation. We need to add this parameter when training fit () model, and then we can use the related method: predict_ Proba and predict_ log_ proba
2. The score function can be used to get the score, and the score is the accuracy rate;
#coding=utf-8
import pandas as pd
import xlrd
import os
import matplotlib.pyplot as plt
import numpy as np
from sklearn.svm import SVC
X = np.array ([[-1,-1],[-2,-1],[1,1],[2,1],[-1,1],[-1,2],[1,-1],[1,-2]])
y = np.array ([0,0,1,1,2,2,3,3])
# y= np.array ([1,1,2,2,3,3,4,4])
# clf = SVC(decision_ function_ shape=”ovr”,probability=True)
clf = SVC(probability=True)
#clf = SVC(probability=False)
clf.fit (X, y)
print( clf.decision_ Function (x))
”
for n classification, there will be n classifiers. Then, any two classifiers can work out a classification interface. In this way, the decision_ Function (), for any sample, there will be n * (n-1) / 2 values.
Any two classifiers can work out a classification interface, and then this value is the distance from the classification interface.
I think this function is for statistical drawing. It is most obvious for binary classification. It is used to count how far each point is from the hyperplane, to intuitively represent data in space, to draw hyperplane and interval plane, etc.
decision_ function_ When the shape is “ovr”, it has 4 values, and when it is “ovo”, it has 6 values.
”’
print( clf.predict (X))
print( clf.predict_ Proba (x)) # this is the score, the score of each classifier, take the class corresponding to the maximum score.
print( clf.score (x, y))
# drawing
plot_ step=0.02
x_ min, x_ max = X[:, 0].min() – 1, X[:, 0].max() + 1
y_ min, y_ max = X[:, 1].min() – 1, X[:, 1].max() + 1
xx, yy = np.meshgrid ( np.arange (x_ min, x_ max, plot_ step),
np.arange (y_ min, y_ max, plot_ step))
Z = clf.predict (np.c_ [ xx.ravel (), yy.ravel ()) (?) predicts the points on the coordinate style to draw the interface. In fact, the final boundary of the class is the boundary line of the interface.
Z = Z.reshape( xx.shape )
cs = plt.contourf (xx, yy, Z, cmap= plt.cm.Paired )
plt.axis (“tight”)
class_ names=”ABCD”
plot_ colors=”rybg”
for i, n, c in zip(range(4), class_ names, plot_ colors):
idx = np.where (y = = I) # I is 0 or 1, two classes
are defined plt.scatter (X[idx, 0], X[idx, 1],
c=c, cmap= plt.cm.Paired ,
label=”Class %s” % n)
plt.xlim (x_ min, x_ max)
plt.ylim (y_ min, y_ max)
plt.legend (loc=’upper right’)
plt.xlabel (‘x’)
plt.ylabel (‘y’)
plt.title (‘Decision Boundary’)
plt.show ()
centos 7 postgreSQL pg_ CTL invalid
In the
section
~/.bash_profile
Next configuration
export PGDATA=/var/lib/pgsql/11.0/data
But it didn’t work.
However, it can be written like this
Go to
/usr/pgsql/bin
After that, it can be executed
./pg_ctl -D /var/lib/pgsql/11.0/data start
Take notes
Today, we use Python to implement the restful interface of Flask, and then call it wrong.
ValueError: View function did not return a response
The code is as follows:
@app.route('/xxxx/yyyy_zzzzz', methods=['POST', 'GET'])
def receive():
param = request.json
print(param)
The reason for the error is that the restful interface of flag must have a return value.
Therefore, modify the code to add the return value:
Add: return XXXX
For example:
@app.route('/xxxx/yyyy_zzzzz', methods=['POST', 'GET'])
def receive():
try:
if not request.json:
return jsonify({'code': -1, 'message': 'request is not json'})
param = request.json
return jsonify({'code': 0, 'status': 'running'})
except Exception as e:
print(e)
return jsonify({'code': -1, 'error_message':e})
Error: transfer of control bypasses initialization of: variable XXX
The nature of the problem, causes and Solutions
The nature of the problem
The code may skip the initialization of some variables, which makes the program access the uninitialized variables and crash.
Causes
I encountered this problem when porting the code from the vs compiling environment of windows to the G + + of Linux (actually compiling CUDA C + + code with nvcc, but the nvcc background also calls G + + to compile C / C + + part of the code). Later, it was found that in vs environment, it was just a warning, but in G + +, it was an error, so this problem must be solved.


terms of settlement
// error
goto SomeWhere;
int var = 10;
// right
int ver = 10;
goto SomeWhere;
// error
switch (choice)
{
case 1:
// do something
break;
case 2:
// do something
}
// right
switch (choice)
{
case 1:
{
// do something
break;
}
case 2:
{
// do something
}
}
// or
if(choice == 1)
{
// do something
}
else if(choice == 2)
{
// do something
}
Title:
http://www.1point3acres.com/bbs/thread-131978-1-1.html
realization:
import java.util.*;
/**
* Created by Min on 10/2/2017.
*/
public class LongestChain {
private int getLongestChain(String[] words) {
Map<Integer, Set<String>> map = new HashMap<Integer, Set<String>>();
for (String word : words) {
Set<String> set = map.get(word.length());
if (set == null) {
set = new HashSet<String>();
map.put(word.length(), set);
}
set.add(word);
}
int ans = 0;
List<Integer> lengthList = new ArrayList<Integer>(map.keySet());
Collections.sort(lengthList, Collections.reverseOrder());
return helper(0, lengthList, map, "");
}
private int helper(int start, List<Integer> list, Map<Integer, Set<String>> map, String prev) {
if (start == list.size()) {
return 0;
}
int ans = 0;
if (start == 0) {
for (String word : map.get(list.get(0))) {
ans = Math.max(ans, helper(start + 1, list, map, word) + 1);
}
} else if (prev.length() -1 == list.get(start)) {
Set<String> wordSet = map.get(list.get(start));
for (int i = 0; i < prev.length(); i++) {
String newWord = prev.substring(0, i) + prev.substring(i + 1);
if (wordSet.contains(newWord)) {
wordSet.remove(newWord);
ans = Math.max(ans, helper(start + 1, list, map, newWord) + 1);
}
}
}
return ans;
}
public static void main(String[] args) {
String[] input = {"a","ba","bca","bda","bdca"};
LongestChain solution = new LongestChain();
System.out.println(solution.getLongestChain(input));
}
}
[UNK]
import java.util.*;
/**
* Created by Min on 10/2/2017.
*/
public class LongestChain2 {
public int getLongestChain(String[] words) {
Set<String> set = new HashSet<String>();
for (String word : words) {
set.add(word);
}
HashMap<String, Integer> map = new HashMap<String, Integer>();
int ans = 0;
for (String word : words) {
Integer length =map.get(word);
if (length == null) {
length = dfs(word, map, set);
}
ans = Math.max(ans, length);
}
return ans;
}
private int dfs(String word, Map<String, Integer> map, Set<String> set) {
Integer ans = map.get(word);
if (ans != null) {
return ans.intValue();
}
ans = 0;
for (int i = 0; i < word.length(); i++) {
String newWord = word.substring(0, i) + word.substring(i + 1);
ans = Math.max(ans, dfs(newWord, map, set) + 1);
}
map.put(word, ans);
return ans.intValue();
}
public static void main(String[] args) {
String[] input = {"a","ba","bca","bda","bdca"};
LongestChain2 solution = new LongestChain2();
System.out.println(solution.getLongestChain(input));
}
}
Reproduced in: https://www.cnblogs.com/Gryffin/p/7623249.html
Kafka prompts when executing the following command:
bin/kafka-console-consumer.sh --zookeeper localhost102:2181 --topic test
WARN [console-consumer-87796_ localhost002-1592779486563-9b43649b], no brokers found when trying to rebalance.( kafka.consumer.ZookeeperConsumerConnector )
The reason is that the Kafka process is not started or there is no Kafka cluster information on zookeeper
[root@localhost002 ~]# jps
3667 DataNode
3365 ResourceManager
21446 QuorumPeerMain
23386 Jps
3230 NodeManager
Solve the problem after starting Kafka