Category Archives: How to Fix

Error: (49,15) error: tag can access private in fragmentactivity

Suddenly report an error. After careful examination of the code, I found that I forgot the first sentence

public static final  String TAG="MainActivity";

In general, when developing a program, you will add a log in the method you write or in the position you are not sure about, so that you can accurately find the error point when running the program,

The general format is log. V (tag, “the name you want to remark”);

Log. E or log. V or log. D or log. I

The main activity is the file name

Error: Could not link: /usr/local/share/doc/homebrew

From: http://c.n-di.com/2017/07/17/1827.html
The copyright belongs to the original author!

Error: could not link: / usr / local / etc / Bash_ completion.d/brew

Update brew and report an error;

Error: Could not link:
/usr/local/etc/bash_completion.d/brew

Please delete these paths and run `brew update`.
Error: Could not link:
/usr/local/share/zsh/site-functions/_brew

Please delete these paths and run `brew update`.
Error: Could not link:
/usr/local/share/man/man1/brew.1

Please delete these paths and run `brew update`.
Error: Could not link:
/usr/local/share/doc/homebrew

Please delete these paths and run `brew update`.

terms of settlement

rm -rf /usr/local/etc/bash_completion.d/brew
rm -rf /usr/local/share/zsh/site-functions/_brew
rm -rf /usr/local/share/man/man1/brew.1
rm -rf /usr/local/share/doc/homebrew
brew update

tcpdump: no suitable device found

Transferred from http://blog.sina.com.cn/s/blog_ 7d49c18001014 vgg.html

1、tcpdump: no suitable device found

Problem analysis and solution:

There are two reasons:
1. The permissions are not enough and are not processed generally. Only the root user can use tcpdump , sudo. / tcpdump
2. By default, only four tcpdumps can be used at the same time. If they are used up, this kind of error will be reported. We need to stop the extra tcpdump

2、

In Fedora 14, sudo
should be added to run the make install command

3、

Linux uid or euid of 0 required

It’s also a matter of authority. Add sudo under fedora

Python:ImportError: No module named indexes.base

When I use pickle to reload data, all the errors are as follows:

Traceback (most recent call last):
  File "segment.py", line 17, in <module>
    word2id = pickle.load(pk)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1378, in load
    return Unpickler(file).load()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 858, in load
    dispatch[key](self)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1090, in load_global
    klass = self.find_class(module, name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1124, in find_class
    __import__(module)
ImportError: No module named indexes.base
 

one hundred and twenty-three trillion and four hundred and fifty-six billion seven hundred and eighty-nine million one hundred and one thousand one hundred and twelve

one hundred and twenty-three trillion and four hundred and fifty-six billion seven hundred and eighty-nine million one hundred and one thousand one hundred and twelve

The reason for this

The same code and data run on two different machines. At first, I thought the wrong machine was missing some Python packages. But there are too many packages to install, so I can’t try them one by one. Fortunately, I use virsualenv to copy the environment from another machine to this machine directly. After running, there is no problem. But in order to find out which Python installation package is missing, I use the original compilation environment, reuse pickle to generate the original data to be loaded, and then reload it At this time, there was no error.

summary

To sum up, the reason is that the original version of panda used in the generation of pickle file is different from the current version of load pickle file. So whether it is to write code in Python or other languages, the compiling environment is very important. Once the version of a package is different, it may also lead to program errors.

Install the specified version of the package with PIP.

pip install pandas==x.x.x

Annotations are not allowed here

Problem Description:

Annotations are not allowed here
when developing with idea, if a unit test is created manually instead of using the method provided by IDE, this error will be reported because the annotation is not fully imported (even if the package is imported)

resolvent:

First, create a unit test class by using the steps provided by ide to create a unit test class for a class

Right click the class code that needs to create the unit test class – & gt; go to – & gt; test

Shortcut key: Ctrl + Shift + T

After creating one, you can create a new test class in the Java / test directory.

 

 

error: Microsoft Visual C++ 9.0 is required

Install scrapy with PIP under windows and report the following error. Just look at the error prompt http://aka.ms/vcpython27 There’s a solution

error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat ). Get it from http://aka.ms/vcpython27

open http://aka.ms/vcpython27 Will jump to http://www.microsoft.com/en-us/download/confirmation.aspx?id=44266

Download the installation package

Microsoft Visual C + + compiler for Python 2.7
can be installed back to solve the problem

http://blog.chedushi.com/archives/10610

Dataframe to numpy.ndarray Related issues of

Originally, we tried to use SVM algorithm to classify and predict the data, but we found that there are many problems in SVM model.fit The data in () must be numpy.ndarray Type of data, so start with numpy.ndarray The data of (data) will turn into valueerror: sequence too large; cannot be greater than 32. This problem is not easy to solve. Later found through numpy.array (data) can be converted directly into numpy.ndarray Type of data.

Android error java.lang.IllegalStateException : System services not available to Activities before onC

The full error log is as follows:

 FATAL EXCEPTION: main
                                                 Process: com.example.administrator.followview, PID: 8587
                                                 java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.administrator.followview/com.example.administrator.followview.MainActivity}: java.lang.IllegalStateException: System services not available to Activities before onCreate()
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2327)
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                                                     at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                                                     at android.os.Handler.dispatchMessage(Handler.java:102)
                                                     at android.os.Looper.loop(Looper.java:148)
                                                     at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                     at java.lang.reflect.Method.invoke(Native Method)
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                  Caused by: java.lang.IllegalStateException: System services not available to Activities before onCreate()
                                                     at android.app.Activity.getSystemService(Activity.java:5253)
                                                     at com.example.administrator.followview.MainActivity.<init>(MainActivity.java:18)
                                                     at java.lang.Class.newInstance(Native Method)
                                                     at android.app.Instrumentation.newActivity(Instrumentation.java:1067)
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2317)
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                     at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                     at android.os.Looper.loop(Looper.java:148) 
                                                     at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                     at java.lang.reflect.Method.invoke(Native Method) 
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

The error code is as follows:

public class MainActivity extends Activity implements View.OnTouchListener {
    private Button mButton;
    private ViewGroup mViewGroup;
    private int xDelta;
    private int yDelta;
    WindowManager wm = (WindowManager) this
            .getSystemService(Context.WINDOW_SERVICE);

    int width = wm.getDefaultDisplay().getWidth();
    int height = wm.getDefaultDisplay().getHeight();

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mViewGroup = (ViewGroup) findViewById(R.id.root);

Sure enough, it’s written on oncreate. Just put it into the oncreate method to run.
 

ValueError: Integers to negative integer powers are not allowed.

Contents of articles

The cause of the problem is solved

problem

Run the following code to prompt for an error

rowsum = np.array([1,2,3])
r_inv = np.power(rowsum, -1)

ValueError: Integers to negative integer powers are not allowed.

reason

The data type of rowsum is integer, not floating-point number. Only floating-point number can perform power operation

solve

rowsum = np.array([1,2,3], dtype=np.float32)
r_inv = np.power(rowsum, -1)

After installing CodeBlocks, run the prompt: tried to run compiler executable ‘C: / / MinGW / bin / mingw32- gcc.exe ‘, but failed!

Goto “Settings->Compiler…->Global compiler settings->GNU GCC Compiler->Toolchain executables” and fix the compiler’s setup.

Tried to run compiler executable ‘C:\MinGW/bin/mingw32- gcc.exe ‘, but failed!

Skipping…
Nothing to be done (all items are up-to-date).

 

Contact C for the first time, run the code after installation and report the above error, which means:

An attempt was made to run the compiler executable ‘C’:’mingw / bin / mingw32 ‘- gcc.exe ‘but failed!

The reason is that the compiler location cannot be found. The solution is as follows:

 

Auto detect: automatic detection

Then run it again