Libgdx and Box2D with android studio: Why isn’t the ball responding to touch inputs?

public void create () { 

. . . . . Gdx.input.setInputProcessor(new PlayerControl(camera, BallBody));

}

        public boolean isPointOnPlayer(float x, float y){             for(Fixture fixture : BallBody.getFixtureList())                 if(fixture.testPoint(x, y)) return true;             return false;         }      public class PlayerControl extends InputAdapter {                  private Vector3 _touchPosition;          public PlayerControl(Camera camera, Body ballBody) {             _touchPosition = new Vector3();         }          @Override         public boolean touchDown(int screenX, int screenY, int pointer, int button) {             // don't forget to unproject screen coordinates to game world               camera.unproject(_touchPosition.set(screenX, screenY, 0F));             if (isPointOnPlayer(_touchPosition.x, _touchPosition.y)) {                 // touch on the player body. Do some stuff like player jumping                 BallBody.applyForce(new Vector2(0, 100f),new Vector2(0, 10f),true);                   return true;              } else                 return super.touchDown(screenX, screenY, pointer, button);         }       } 

How and why use validate_username and how to secure inputs fields of registration form?

I would use validate_username to protect username and other inputs from tags, octet, and others filters and conditions from sanitize_user but these functions only remove these dangerous chars and does not warn the user to not use these chars.

Does it exist a wordpress function of the same kind as validate_username that allow to warn and restrict user to use the same chars and conditions than those used in validate_username function ?

Could you help me to write a regex which fulfills the same conditions as validate_username to display error if one of conditions is positive.

And how I must do to add this regex |%([a-fA-F0-9][a-fA-F0-9])| to this one /^[A-Za-z0-9]$ / I don’t understand the use of | and / . In php.net this | is use to say "or" . For example this /^[A-Za-z0-9]$ / does not take into account octet (or exadecimal ?) as it define here : WordPress sanitize_user/

Knowing that hackers always discover solutions to hack what is to date the best solution to protect a registration and login form. If this last question is duplicate could you please post the link of existing response ?

Method for combining derivative free optimization results of different data inputs

I am working on an algorithm that has multiple fixed parameters. The algorithm analyzes time series data and spits out a number. The fixed parameters need to be such that this number is as small as possible.

What I found, is that when optimizing the parameters for a specific time period, these parameters don’t necessarily work well when used on another time period.

The way I see it, is that there are two possible solutions to this problem:

  1. use a longer time period when optimizing the parameters
  2. find a method of combining the optimal parameters for different time periods, such that these “averaged” parameters work well on all time periods

Option 1. would be incredibly expensive in terms of computational time. And although it makes intuitive sense that this should fix the problem, I am not sure that this would indeed be the case.

Option 2. reminds me of training neural networks, where one would feed in a large number of “data points” and somehow take a (weighted) average of the results to find a set of parameters that work well for all data points. Unfortunately, I know very little to nothing about the algorithms used for this kind of optimization/learning.

Any help or suggestions are greatly appreciated. Please let me know if there is anything you’d like me to expand upon.

Thanks!

Making complex boolean circuits that give true as output only for a specific combination of boolean inputs

This is my first question on a stack exchange website so please bear with me. I am making challenges for a jeopardy style capture the flag event in my college and I had come across the minetest challenge in the hardware section of google CTF qualifier conducted last year. A clean and organized solution to this problem has been provided by liveoverflow.

I would like to design a simpler version of this problem for my college’s CTF event but I am unable to design a complex circuit that gives true output only for a specific combination of inputs. I know that a circuit with this functionality is not very difficult to implement and just needs to represent the following logic:

trueinput1 AND trueinput2 AND ... NOT falseinput1 AND NOT falseinput2 ...  

However I want it to be vast and complicated so that participants cannot decode its functionality just by doing a visual analysis. Is there any technique to complicate the boolean logic above and to design a corresponding circuit that looks ugly even for a small number of inputs(32/64).

How Joint Probability Distributions are used to solve the problem of missing inputs in Classification

With n input variables, we can now obtain all 2^n different classification functions needed for each possible set of missing inputs, but the computer program needs to learn only a single function describing the joint probability distribution.

This is page 98 of Ian Goodfellow’s Deep Learning Book. My confusion comes from how joint probability distributions are used to solve the problem of missing inputs. What are the random variables in this scenario? I don’t really understand the connection here so if someone could please elaborate that would be great.

Help in understanding ‘reasonable’ encoding of inputs

I read that a reasonable encoding of inputs is one where the length of the encoding is no more than a polynomial of the ‘natural representation’ of the input. For instance, binary encodings are reasonable, but unary encodings are not.

But say that the input is a graph, and its natural representation is a vertex and edge list. Suppose that the graph has $ k$ vertices. If I use unary to encode, the overall length of the input referring to the vertex list would be $ O(k^2)$ , i.e. $ =|1^1|+|1^2|+|1^3|+…+|1^k|$ . Isn’t this unary encoding still a polynomial with respect to the number of vertices of the graph (which is $ k$ )?

What am I missing here?

Creating logical circut from 4 inputs wtih 1 final output

So I have set truth table:

| x y z t | f ------------- | 0 0 0 0 | 1 | 0 0 0 1 | 1 | 0 0 1 0 | 0 | 0 0 1 1 | 1 ------------- | 0 1 0 0 | 0 | 0 1 0 1 | 0 | 0 1 1 0 | 1 | 0 1 1 1 | 1 ------------- | 1 0 0 0 | 1 | 1 0 0 1 | 0 | 1 0 1 0 | 1 | 1 0 1 1 | 1 ------------- | 1 1 0 0 | 1 | 1 1 0 1 | 1 | 1 1 1 0 | 1 | 1 1 1 1 | 1 

the function is random.

Then I have done the state indexes (just for better orientation).

Σ(x,y,z,t) = (0,1,3,6,7,8,10,11,12,13,14,15) Π(x,y,z,t) = (2,4,5,9) 

Then I used Karnaugh maps

    00  01  10  11    ----------------- 00 | 1 | 1 | 1 | 0 |    ----------------- 01 | 0 | 0 | 1 | 1 |    ----------------- 10 | 1 | 1 | 1 | 1 |    ----------------- 11 | 1 | 0 | 1 | 1 |    ----------------- 

And got minimalized function

              ___    _         _   __ f(x,y,z,t) =  xzt + xy + xz + zt + xyz 

And now I have to draw the schematic of this logical function using only INV, AND, OR gates. After this, I have to draw the schematic using only NAND gates.

I think, that the next step is to use the De Morghan laws and laws of double negation, but im not 100% sure.

Can someone please help me do the circuit realization (only on paper)? Our teacher didn´t had time to explain it to us how to do it, because of the COVID-19 and now we have to learn it at our own. I would appreciate any help.

Logic minimization via 2 inputs NOR gates: Is it monotone w.r.t to adding a minterm?

  • notation: $ x+y:=\mbox{OR}(x,y)$ , $ \bar x:=\mbox{NOT}(x)$ , $ xy:=\mbox{AND}(x,y)$ , 1:=TRUE, 0:=FALSE.

  • Let $ f$ be a Boolean function of $ n$ -variables, i.e. $ f: \{0,1\}^n \to \{0,1\}$ .

  • minterm:= any product (AND) of $ n$ literals (complemented or uncomplemented). e.g, $ x_1 \bar x_2 x_3 $ is a minterm in 3 variables

  • $ \mbox{NOR2}(f)$ is the minimum number of 2-input NOR gates required to represent a given function $ f$ . For instance, $ \mbox{NOR2}(x_1 x_2)=3$ .

Let $ f_1= m_1, f_2=m_2$ , where $ m_1, m_2$ are minterms that are co-prime (i.e, $ f_1+f_2$ can’t be minimized further. In other words, $ m_1,m_2$ are prime implicants of $ f_1+f_2$ ). For instance, $ x_1 \bar x_2 x_3 $ and $ x_1 x_2 \bar x_3 $ are co-prime

Then, is the following true? $ $ \mbox{NOR2}(f_1+f_2)\ge \mbox{max}\{ \mbox{NOR2}(f_1), \mbox{NOR2}(f_2) \}$ $

[i.e, adding two coprime minterms can’t yield a 2-input NOR circuit with fewer gates]

I think it is true but I can’t think of a proof. Any ideas on how to start proving it?

Is there necessarily an infinite number of inputs to any given output in a crypto hash function? [migrated]

This might be a very easy question. Let’s consider cryptograhic hash functions with the usual properties, weak and strong collision resistance and preimage resistance.

For any given output, obviously there are multiple inputs. But is that necessarily an infinite number of preimages, for any given hash value?

How would I go about giving a formal proof that there exists no crypto hash function h() such that there is a given value v = h(m*) for which the possible set of inputs m* is finite? Would this necessarily break collision resistance?