opengl – calling function via function pointer from dll — no draw

I have a normal executable which has an opengl context and a drawRect() function, this function when called from winmain in this exe works just fine. I then have a dll in which I’m calling a function pointer to that drawrect function (which seems to work fine when stepping through with the debugger) but despite calling into the function with the same parameters, nothing is drawn to the screen this time. Why? The function and the context all belong to the same executable, I’m just round tripping through the dll. In the exe I call into a main() in the dll, this main has the memory block from the exe, in that main I call the function pointer, it goes through to the correct function (which worked when called from the winmain,) but nothing happens. I do not understand. Am I missing something? As far as I can tell it should just work.

algorithms – How to implement a trail for pointer on the screen like the one in fruit ninja game (image in the question)?

So I basically want to make a trail behind a cursor – I’m fairly new to coding and am more interested in the method then some exact code which will do the thing. I’ve attempted to solve the problem in 2 ways.

First I tried matching the normalized dx, and dy of the consequetive samples and drawing the line if they are equal. This was very poor as due to normalization, there only were 8 directions, which however was necessary as I also needed to detect collision with the trail.

Second way was like android Path for on touch event, where I stored sampled locations in a vector fixed capacity and decremented it with time similarly to how one would code a snake game. This was a bit better, but it allowed the pass to be very curved. So I tried to ensure that the angle between the line formed by 2 last added points and the line formed by last added point and the new point is less then certain value. That helped somewhat – but still allowed for snail shell like pattern to be formed.

One thing I’ve considered is to use complex numbers for x and y coordinates so I can get a negative vector magnitude and work from there but at this point i was just wild guessing.

I’m not sure how to properly code such trail as it need to be straight but still allow for any direction, increase its decay rate when moved into opposing side, and still allow for slight curvatures to form – hence I’m asking here.

Example image:
example image

IDA pro resolves a pointer to a string, how to restore?

I’m working on a busybox, there is a table which contains some pointers to the command string, like this:

enter image description here

Before, the code use the table name “cmds_list”, but after I perform certain operations(I hava no idea about what i did), IDA pro auto resolves the “cmds_list” to the string “(” which is the first element of the table “cmds_list”:

enter image description here

so, what should i do to turn the string value “(” to the table name “cmds_list”?

c++ – Class using resource pointer- Resource class with copy constructor and copy assignment operator

I have created two simple classes: resource and container. below is the full code. actually container keeps resources. and in the beganing it will get all the resources and store them in datalist of resources. The other function is simply prints out all the resources in container. Please review my code and see if its ok just review it and let me know what are the wrongs and rights in the code, thanks

////
// Created by noone on 18/8/21.
//
#include <iostream>
#include <cstring>
#define Max 10
class resource{
private:
public:
    int id;
    char name(10);

    resource(int id,char name1(10)):id(id)
    {

        std::memcpy(name,name1,Max);
    }
    resource& operator= (const resource& arr2){
        if (this == &arr2){ return *this; } //make sure you aren't self-assigning
        //same as copy constructor from here
        id=arr2.id;
        std::memcpy(name,arr2.name,Max);
        return *this;
    }


};
class container
{
public:
    container(resource *new_resource,int i)
    {
            size=0;
            size=i;
            datalist=(resource *)malloc(sizeof(resource)*i);
            for(int x=0;x<i;x++)
            {
                datalist(x).id=new_resource(x).id;
                std::memcpy(datalist(x).name,new_resource(x).name,std::strlen(new_resource(x).name));

            }


    }
    void print_all_resources()
    {
        std::cout<< "total "<<size<<" resources found"<<std::endl;
        for(int i=0;i<size;i++)
        {
            std::cout<<"Printintg first resource"<<i+1<<std::endl;
            std::cout<<datalist(i).name << " | "<< datalist(i).id<<std::endl;
        }
    }

private:
    resource *datalist;
    int size;
};

int main()
{
    resource resource1(10,"abc");
    resource resource2(20,"xyz");
    resource r()={resource2,resource1};

    container c(r,2);
    c.print_all_resources();

}

macos – Auto­mat­i­cal­ly move mouse point­er to default but­ton on dia­log box

macos – Auto­mat­i­cal­ly move mouse point­er to default but­ton on dia­log box – Ask Different

In C++, does dereferencing a nullptr itself cause undefined behaviour, or is it the acting upon the dereferenced pointer which is undefined?

I happen to have a reason why I might want to dereference a nullptr.

Of course when I do, my program crashes, and from what I gather, this is due to the compiler playing it safe and stopping my program, rather than risking the program acting upon the dereferenced nullptr, which is undefined behaviour.

So my question is to affirm this:

  1. Is it my compiler crashing my program, or the “undefined behaviour”?
  2. If it is the compiler, suppose it didn’t choose to crash the program, is the act of dereferencing the pointer in any way able to cause something to happen that could alter the behaviour of the program writ large? This is assuming that nothing is done to it at all, like so:
void moot()
{
        QString *s{nullptr};
        *s;
}
  1. Continued: Could I hypothetically run moot() thousands of times without any “undefined behaviour” taking place?
  2. If true, what if I did not do anything to the object, but I did pass it around, like so:
void receiveCC( QString         ) { return; }
void receiveR ( QString &       ) { return; }
void receiveCR( const QString & ) { return; }

void moot()
{
        QString *s{nullptr};
        *s;
        receiveCC(*s);
        receiveR (*s);
        receiveCR(*s);
}
  1. Continued: Same as above; could such be done without any “Undefined behaviour” taking place?

Null pointer exception error in getBooleanArrayExtra() in Android studio

I am getting a null pointer exception error while running my code on Android device. I don’t know how to resolve it…
here is my code

For main activity

package com.example.quizappcwh;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.SparseBooleanArray;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
private Button yes;
private Button no;
private TextView questionText;
private final String() QuestionsList = {
“1) Python is an interpreted language”,
“2) To execute Python statements, the statements must be entered into a
file”,
“3) Python’s print statement writes items to the screen”,
“4) A full list of Python keywords can be obtained from Python itself,
using the Python keyword module”,
“5) A variable called name refers to the same value as a variable called
NAME”,
“6) The keyword function marks the beginning of a function definition”,
“7) Python determines the beginning and end of a statement based on
whitespace”,
“8) Function int retrieves an integer from a program user”,
“9) Python has three high-level data structures: lists, dictionaries and
hashes”,
“10) Tuples are immutable data types; lists are mutable data types”,
“11) List method append adds an element to the end of the list”,
“12) Dictionary values must be immutable data types”,
“13) Single quote characters (‘) inside a string must be “escaped” using
the backslash character (i.e. ‘)”,
“14) Regular expression processing is built into the Python language”,
“15) The compile function of module re returns an instance of a
SRE_Pattern object”,
“16) None is a Python type whose value indicates that no value exists”
};
boolean() AnswersList = {
true,false,true,true,false,false,true,false,
false,true,true,false,false,false,true,true
};
private int index = 0;
boolean() userInput = new boolean(16);
int score = 0;
void updateScore(){
boolean() a = userInput;
Intent intent = new Intent(this, MainActivity2.class);
intent.putExtra(“INPUT_ANSWERS”,a);
intent.putExtra(“FINAL_SCORE”, score);
startActivity(intent);
}
void calScore(){
for(int i=0;i<16;i++){
if(AnswersList(i)==userInput(i)){
score+=1;
}
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
yes = findViewById(R.id.yes);
no = findViewById(R.id.no);
questionText = findViewById(R.id.questionText);
questionText.setText(QuestionsList(index));
yes.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(index<=QuestionsList.length-1)
{
userInput(index) = true;
index++;
if(index<=QuestionsList.length-1) {
questionText.setText(QuestionsList(index));
}
else{
calScore();
updateScore();
}
}
else{
calScore();
updateScore();
}
}
});
no.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(index<=QuestionsList.length-1)
{
userInput(index) = false;
index++;
if(index<=QuestionsList.length-1) {
questionText.setText(QuestionsList(index));
}
else{
calScore();
updateScore();
}
}
else{
calScore();
updateScore();
}
}
});
}
}

For main activity 2

package com.example.quizappcwh;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity2 extends AppCompatActivity {
private Button previous;
private Button next;
private TextView uaText;
private TextView caText;
private TextView ExpText;
private String() explanation = {
“Explanation: Python is an interpreted language.”,
“Explanation: Python can execute programs stored in files, or it can run
in interactive mode, where users enter lines of code one at a time.”,
“Explanation: Python’s print statement writes items to the screen.”,
“Explanation: A full list of Python keywords can be obtained from Python
itself, using the Python keyword module.n”,
“Explanation: Python is case-sensitive, so name and NAME are two different
variable names.”,
“Explanation: The keyword def marks the beginning of a function
definition.”,
“Explanation: Python determines the beginning and end of a statement based
on whitespace.”,
“Explanation: Function raw_input may be used to retrieve input from the
user. Function int changes returns a non-integer value when passed an integer value.”,
“Explanation: Python’s three high-level data structures are tuples, lists
and dictionaries.”,
“Explanation: Tuples are immutable data types; lists are mutable data
types.”,
“Explanation: List method append adds an element to the end of the list.”,
“Explanation: Dictionary values may be of mutable data types; dictionary
keys, however, must be of immutable data types.”,
“Explanation: When placed within a string, the double quote character (“)
needs to be “escaped” using a backslash, so as not to be confused with one of the
characters delimiting the string.”,
“Explanation: Regular expression processing is contained in the re module.
This module must be imported to perform regular expression processing tasks.”,
“Explanation: The compile function of module re returns an instance of a
SRE_Pattern object.”,
“Explanation: None is a Python type whose value indicates that no value
exists.”,
};
Intent intent = getIntent();
boolean() correct_answers = {
true,false,true,true,false,false,true,false,
false,true,true,false,false,false,true,true
};
boolean() user_answers = intent.getBooleanArrayExtra(“INPUT_ANSWERS”);
// int final_score = intent.getIntExtra(“FINAL_SCORE”,0);
private int i = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
uaText = findViewById(R.id.uaText);
caText = findViewById(R.id.caText);
ExpText = findViewById(R.id.ExpText);
next = findViewById(R.id.next);
previous = findViewById(R.id.previous);
setContent(0);
next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(i<16 && i>=0){
i+=1;
if(i<16){
setContent(i);
}
else{
Toast.makeText(MainActivity2.this, “Invalid Option”,
Toast.LENGTH_SHORT).show();
}
}
else{
Toast.makeText(MainActivity2.this, “Invalid Option”,
Toast.LENGTH_SHORT).show();
}
}
});
previous.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(i<16 && i>=0){
i-=1;
if(i>=0){
setContent(i);
}
else{
Toast.makeText(MainActivity2.this, “Invalid Option”,
Toast.LENGTH_SHORT).show();
}
}
else{
Toast.makeText(MainActivity2.this, “Invalid Option”,
Toast.LENGTH_SHORT).show();
}
}
});
}
private void setContent(int x){
uaText.setText(Boolean.toString(user_answers(x)));
caText.setText((Boolean.toString(correct_answers(x))));
ExpText.setText(explanation(x));
}
}

c – Pointer to custom struct typedef issue

As a simple beginner project, I am trying to build a linked list. I have created a structure typedef for the node. My issue is that I want another typedef as a pointer to a list node, for some reason, this is not working and I am very confused. I have read other answers on here and none of them have worked.

main.c

#include <stdio.h>
#include "linkedList.h"


int main(int argc, char **argv){
    return 0;
}

linkedList.h

#ifndef linkedList
#define linkedList

typedef struct listStrNode {
    char *string;
    struct listStrNode *next;
} listStringNode;

typedef listStringNode *linkedList;

#endif

error

In file included from main.c:3:
linkedList.h:9:35: error: expected identifier or ‘(’ before ‘;’ token
    9 | typedef listStringNode *linkedList;
      |

compiled with:

gcc main.c

any ideas?

DreamProxies - Cheapest USA Elite Private Proxies 100 Cheapest USA Private Proxies Buy 200 Cheap USA Private Proxies 400 Best Private Proxies Cheap 1000 USA Private Proxies 2000 USA Private Proxies 5000 Cheap USA Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive.com Proxies-free.com New Proxy Lists Every Day Proxies123.com Proxyti.com Buy Quality Private Proxies