Tag Archives: ProgrammerAH

bash: /opt/ros/kinetic/ setup.bash : there is no file or directory

I installed ROS Melodic version, but I used the installation tutorial of “Kinetic” version. As a result, I forgot to change “Kinetic” into “Melodic” in the tutorial by using the echo command when adding environment variables at one step, so the following phenomena occurred:

An error occurred when I source ~/.bashrc
Bash:/opt/ros/kinetic/setup. Bash: no files or directories

After looking, I use the command
tlf@tanglifan:~$ gedit ~/.bashrc

At the bottom of a add error source: the source/opt/ros/kinetic/setup. Bash
Delete it and save it. It’s back to normal.

Idea installation vue.js After plug-in, new has no Vue component

New does not have a Vue Component after installing the Vue.js plugin
First to install the vue related plug-in vue. Js

a lot of people in after installing the vue plug-in, right-click the new found no vue component this option. As follows:

Solution:
Settings> Editor> File and Code Templates
after completing the above steps
,

right click new again at this time, found that option in the Vue Component

Android can’t transfer value when using extras, bundle and intent

Working environment (bold blue for special attention)
1, System environment: Win7 Ultimate SP1, Android Studio 3.2
Oddly enough, today when a Bundle is used to pass values between activities, it is not possible to get the value passed in. Look at the pass-value code:

 Bundle bundle = new Bundle();
 bundle.putInt(EXAM_CENTER_TYPE, EXAM_CENTER_1);
 toActivity(ExamTypeActivity.class, bundle);

protected void toActivity(Class<?> clazz, Bundle bundle) {
        Intent intent = new Intent();
        intent.setClass(this, clazz);
        if (bundle != null) {
            intent.putExtras(bundle);
        }
        startActivity(intent);
    }

Value code:

    protected Bundle getExtra() {
        Intent intent = getIntent();
        if (intent != null) {
            return getIntent().getExtras();
        } else {
            return null;
        }

    }

    protected String getExtraString(String key) {
        Bundle bundle = getExtra();
        if (bundle != null) {
            return bundle.getString(key);
        } else {
            return "";
        }
    }
    

    protected int getExtraInt(String key) {
      String extra = getExtraString(key);
      return NumberUtils.getInt(extra);
    }

GetExtraaint (EXAM_CENTER_TYPE) cannot get a value. The reason is that the data type passed to PUT must be the same as that of GET. If you put is a string, get is a string. The getExtraint function can be changed to the following function:

  protected int getExtraInt(String key) {
        Bundle bundle = getExtra();
        if (bundle != null) {
            return bundle.getInt(key);
        } else {
            return 0;
        }
    }

 
 

Some uncommon problems and solutions of cookie

preface
At present, the company has two platforms, one is for ordinary users to use the h5 client and provide enterprises with services of PCWeb side, the two platforms are sharing a set of login system and user system, over time, in order to distinguish between different business scenarios result in the field of the user system there is a large amount of redundancy, this time is about to start refactoring, the original user separation, but still use the same set of login system. In the process of reconstruction, because of the wrong judgment of the Cookie caused some problems, went a lot of detours, so I decided to record these problems, as a warning.
Cookie is a string of strings written by the server to the client browser, mainly including keys, values, expiration time, path and domain, here mainly says the use of domain.
1. Domain domain don’t fill in
The default is only valid under the current domain
2. The domain specified domain
The cookie is valid for the specified domain and for all subdomains under the domain. This means that the browser automatically puts the cookie in the request header when accessing a resource under a valid domain name
3. Implementation of SSO Single Sign-On
Suppose the login domain name is login.olang.cn, and the login sites need to be verified are a.olange.cn and b.olange.cn. When I access a.olange.cn, because I have not logged in at this time, I will jump to the login page on login.olange.cn. After submitting the login name and password, the verification is successful, and then I will start writing the token into the Cookie. Set the cookies’ domain to their parent domain olange. CN, so that browsers will carry the token when accessing a.olange. CN and b.olange. CN
4. Can the domain be set freely
Yes, but the browser won’t accept it. For security reasons, the browser will only store cookies from the current domain and its parent domain; the rest will be discarded.

Clear the user name and password stored in GIT

Clear the username and password stored in Git
Issue: When vscode is not connected to the remote and the new key is still not working, it may be because you set the SSH key on Gitlab with another account. Even if you generate a new id_rsa.pub on this computer and set its value to Gitlab, this setting will not take effect. When you pull the code, you will find that Git will still log in with your old account.
: To try to clear the username and password stored in git, type the following command.
git config --global credential.helper wincred

Error:could not fork child process: There are no available terminals (-1).

Git Bash terminal cannot be opened

1, in the CMD command input tasklist check git – bash. Exe process, find the corresponding process pid
no. 2, tasklist | findstr searches process, pid # find process, the corresponding process
no. 3, taskkill/pid process pid – t – f # is corresponding process termination command, after the termination, can open the git bash terminal
If that still doesn’t work, restart your computer
 
 
 
 
 
 
 
 

The solution of centos7’s inaccessibility after installing nginx

The firewall of Centos7 is changed to “iptables” and is no longer called “iptables”. The firewall of Centos7 is not called “iptables” anymore. The firewall of Centos7 is changed to “iptables”.

firewall-cmd --zone=public --add-port=80/tcp --permanent  

1
Command meaning:
— zone # scope
— add-port=80/ TCP # Add port in format: port/communication protocol
— permanent # is permanent and will fail if restarted without this parameter
Restart firewall:

systemctl stop firewalld.service  
systemctl start firewalld.service  

Git stash temporary storage recovery and file deletion recovery

The server returns a local file that has been modified.
1. Git Stash: Hold local code
2, git pull origin develop: get the remote branch code
3. Git Stash Pop: Restores previously saved files
 
Git accidentally deletes files and restores instructions
1, git FSCK — lost-found: View recently removed files
2, git show ‘delete number by mistake’ : view the contents of deleted files
Git merge: merge the contents of a file that was deleted by mistake

Opne GL es learning experience!

Long time to update! Next, I will update my learning experience or notes of Open GL ES.
 
OpenGL ES 1.0 uses a fixed pipeline through its built-in functions to set things like lights, vertexes, colors, cameras, and so on.
OpenGL ES 2.0 uses a programmable pipeline, so you have to write any features yourself.
 
#import< UIKit/UIKit.h>
#import< QuartzCore/QuartzCore.h>
#import< OpenGLES/ES2/gl.h>
#import< OpenGLES/ES2/glext.h>

Reproduced in: https://www.cnblogs.com/pinping/archive/2012/05/17/2506082.html

A strange problem in compiling OpenGL program

I encountered a strange problem compiling an OpenGL program today.
A short code to draw a triangle. The project file contains a CPP file. The project was run correctly before, and is now run correctly when opened. My OpenGL is configured according to this article:
Click the open link. There shouldn’t be any problems.
But when I create a new project and copy the original code, it runs wrong. And I remember building that project before with nothing in it. Why are two engineering pieces of code exactly the same but behave differently?Very depressed ah!
Here is the code:
#include < GL/glut.h> Void init () {glClearColor (0.0, 0.0, 0.0, 0.0); glShadeModel(GL_SMOOTH); // render mode} void triangle() {glBegin(GL_TRIANGLES); GlColor3f (1.0, 0.0, 0.0); GlVertex2f (5.0, 5.0); GlColor3f (0.0, 1.0, 0.0); GlVertex2f (25.0, 5.0); GlColor3f (0.0, 0.0, 1.0); GlVertex2f (5.0, 25.0); glEnd(); } void display() { glClear(GL_COLOR_BUFFER_BIT); triangle(); glFlush(); Void reshape(int w,int h) {glViewport(0,0,(GLsizei)w,(GLsizei)h); void reshape(int w,int h) {glViewport(0,0,(GLsizei)w,(GLsizei)h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); if(w < = h) gluOrtho2D(0.0,30.0,0.0,30.0 * (glFloat)h/(glFloat)w); Else gluOrtho2D(0.0,30.0 * (glFloat)w/(glFloat)h,0.0,30.0); glMatrixMode(GL_MODELVIEW); } int main(int argc,char** argv) { glutInit(& argc,argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); GlutInitWindowSize (500500); GlutInitWindowPosition (100100); glutCreateWindow(argv[0]); init(); glutDisplayFunc(display); glutReshapeFunc(reshape); glutMainLoop(); return 0; } Open the original project and it ran successfully:


But when I create a new project and copy the code exactly as it is, I get an error. Error message:
1> — — — — — – has started to generate: project: Test, configuration: Debug Win32 — — — — — –
1 & gt; Compiling…
1> Test.cpp
1> Linking…
1> LINK: did not find E:\ Learning \ Program Exercise \OpenGL\Test\Debug\Test.exe or last incremental LINK did not generate it; Performing full link
1> Test.obj: error LNK2019: Unable to resolve external symbol __imp____glutInitWithExit@12, which is referenced in function _glutInit_ATEXIT_HACK@8
1>; Test.obj: error LNK2019: Unable to resolve external symbol __imp____glutCreateWindowWithExit@8, which is referenced in function _glutCreateWindow_ATEXIT_HACK@4
1>; E:\ Learning \ Program Practice \OpenGL\Test\Debug\Test.exe: fatal error LNK1120: 2 external commands
1>; Build log is saved in “file:// E :\ Learning \ Program Practice \OpenGL\Test\Test\Debug\BuildLog.htm”
1>; Test – 3 error, zero warning
= = = = = = = = = = : zero success, failure, the latest zero, skip the 0 = = = = = = = = = =

After a long search on the Internet, I finally found a solution: #include lt; GL/glut.h> Before adding the following code:
#ifndef GLUT_DISABLE_ATEXIT_HACK #define GLUT_DISABLE_ATEXIT_HACK #endif But why add this?

It’s still not clear. I hope you know who can help me solve my doubts.