Unity: How to prevent animation from twitching when combined with Navmesh Agent

I am trying to make a third person shooter in Unity and trying to implement a zombie that follows the player and when close to player, attack animation is played. I am using the NavMesh Agent for that purpose. But I am facing the problem that once the zombie comes close and if the player moves back or side ways, the zombie twitches and the transition between the walking and attacking animation appears broken. Also, it slides on the floor around the player. Here is the video of it: Video Here is my code to control the zombie movement:

using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.AI;  public class ZombieController : MonoBehaviour {     public Animator animator;     public NavMeshAgent agent;     public GameObject player;      public float turnSmoothing = 15f;               public float speedDampTime = 0.1f;     private const float stopDistanceProportion = 0.1f;      private int health = 100;      private PlayerContorller pc;      // Start is called before the first frame update     void Start()     {         agent.updateRotation = false;         agent.SetDestination(player.transform.position);         agent.isStopped = true;         pc = player.GetComponent<PlayerContorller>();     }       // Update is called once per frame     void Update()     {         agent.SetDestination(player.transform.position);          if (agent.pathPending)             return;         float speed = 0.0f;         if (!pc.Dead)         {             if (agent.remainingDistance <= agent.stoppingDistance * stopDistanceProportion)             {                 agent.isStopped = true;                 animator.SetBool("PlayerClose", true);                 Quaternion targetRotation = Quaternion.LookRotation(player.transform.position - transform.position);                 transform.rotation = Quaternion.Lerp(transform.rotation, targetRotation, turnSmoothing * Time.deltaTime);             }             else if (agent.remainingDistance < 70.0f)             {                 Quaternion targetRotation = Quaternion.LookRotation(player.transform.position - transform.position);                 transform.rotation = Quaternion.Lerp(transform.rotation, targetRotation, turnSmoothing * Time.deltaTime);                 float proportionalDistance = 1f - agent.remainingDistance / agent.stoppingDistance;                  speed = Mathf.Lerp(0.5f, 1f, proportionalDistance);                 agent.isStopped = false;                 animator.SetBool("PlayerClose", false);             }             else if (agent.remainingDistance < 100.0f)             {                 Quaternion targetRotation = Quaternion.LookRotation(player.transform.position - transform.position);                 float proportionalDistance = 1f - agent.remainingDistance / agent.stoppingDistance;                 transform.rotation = Quaternion.Lerp(transform.rotation, targetRotation, turnSmoothing * Time.deltaTime);                 speed = Mathf.Lerp(0f, 0.5f, proportionalDistance);                 agent.isStopped = false;                 animator.SetBool("PlayerClose", false);             }         }         else         {             agent.isStopped = true;             animator.SetBool("PlayerClose", false);             speed = 0f;         }         animator.SetFloat("Speed", speed);     }      public void Hit()     {         health -= 10;         if(health == 0)         {             animator.Play("Die");             StartCoroutine(Die());          }     }      IEnumerator Die()     {         yield return new WaitForSeconds(10);         Destroy(gameObject);     } } 

The Speed parameter controls Idle (when 0), walking (0-0.5), running(0.5-1) of the zombie, all three are part of a blend tree. And when the PlayerClose parameter is set to true, the animation transitions to the attack animation. How do I fix this? what changes to make in order to fix that?

How does the reaction timing work for Wrath of the Storm? Can it potentially prevent the damage from the triggering attack?

With attacks of opportunity, the PHB is pretty clear that your reaction occurs as an interruption to your opponent’s move, just before they move beyond your reach, then they resume their turn. Fair enough.

However, there are some abilities that happen during an opponent’s attack – for example, the Shield spell, and a Tempest cleric’s Wrath of the Storm ability. These both say they happen when you’re “hit” by an attack – but the Shield spell raises your AC, so I assume that occurs before rolling damage, and makes it possible for you to be retroactively not hit by the attack. Is the same true for Wrath – that your reaction might KO your opponent, and you wouldn’t have to worry about taking damage?

(I was planning to include Hellish Rebuke in this question but I see it specifically refers to “being damaged”, so I assume that means it happens on your opponent’s turn but definitely after getting hit, meaning you can only cast it if you’re still conscious.)

MySQL: how to prevent deadlock on concurrent inserts

Percona Server 5.6.39-83.1-log

Table structure:

CREATE TABLE `myTable` (     `column_1` VARCHAR(50) NOT NULL DEFAULT '',     `column_2` VARCHAR(50) NOT NULL DEFAULT '',     `column_3` VARCHAR(50) NOT NULL DEFAULT '',     `column_4` VARCHAR(50) NOT NULL DEFAULT '',     `column_5` VARCHAR(50) NOT NULL DEFAULT '',     PRIMARY KEY (`column_1`, `column_2`, `column_3`) USING BTREE,     INDEX `column_3` (`column_3`) USING BTREE,     INDEX `column_4_5` (`column_4`, `column_5`) USING BTREE ) COLLATE='utf8_general_ci' ENGINE=InnoDB; 

There are two or more concurrent insert leads to deadlock:

------------------------ LATEST DETECTED DEADLOCK ------------------------ 2020-03-23 18:12:45 7f1c08eb8700 *** (1) TRANSACTION: TRANSACTION 55665288601, ACTIVE 0 sec inserting mysql tables in use 1, locked 1 LOCK WAIT 3 lock struct(s), heap size 1184, 2 row lock(s) MySQL thread id 10275055, OS thread handle 0x7f1c08c6c700, query id 56392293629 localhost user update INSERT IGNORE INTO myDB.myTable (`column_1`, `column_2`, `column_3`, `column_4`, `column_5`) VALUES ('a1', 'a2', 'a3', 'a4', 'a5'), ('b1', 'b2', 'b3', 'b4', 'b5'), ('c1', 'c2', 'c3', 'c4', 'c5'), *** (1) WAITING FOR THIS LOCK TO BE GRANTED: RECORD LOCKS space id 337207190 page no 7370 n bits 200 index `PRIMARY` of table `myDB`.`myTable` trx id 55665288601 lock mode S locks rec but not gap waiting *** (2) TRANSACTION: TRANSACTION 55665288598, ACTIVE 0 sec inserting, thread declared inside InnoDB 4965 mysql tables in use 1, locked 1 3 lock struct(s), heap size 1184, 2 row lock(s), undo log entries 35 MySQL thread id 10275057, OS thread handle 0x7f1c08eb8700, query id 56392293627 localhost user update INSERT IGNORE INTO myDB.myTable (`column_1`, `column_2`, `column_3`, `column_4`, `column_5`) VALUES ('a1', 'a2', 'a3', 'a4', 'a5'), ('b1', 'b2', 'b3', 'b4', 'b5'), ('c1', 'c2', 'c3', 'c4', 'c5') *** (2) HOLDS THE LOCK(S): RECORD LOCKS space id 337207190 page no 7370 n bits 200 index `PRIMARY` of table `myDB`.`myTable` trx id 55665288598 lock_mode X locks rec but not gap *** (2) WAITING FOR THIS LOCK TO BE GRANTED: RECORD LOCKS space id 337207190 page no 83133 n bits 144 index `PRIMARY` of table `myDB`.`myTable` trx id 55665288598 lock_mode X insert intention waiting *** WE ROLL BACK TRANSACTION (1) 

Why is this happening?
Despite the fact that I do not use auto-increment in the primary key and use IGNORE in query.
How should I avoid this problem?

PostgreSQL: Prevent SQL injection for like query with % input

We are allowing the user to post the contents on our application, in a case user entered the % in the title of the post and we are running like query to fetch the data from the database. Here is the snippet from the post table

id |         title           | short_description |   long_description  1   how many % amounts you       ----------          --------------      should save                --------------       ----------------- 

Query we are running:

SELECT id, title from post where post.title LIKE '%string entered by user%' 

Now if the user enters amounts then query works fine and returns something like.

SELECT id, title from post where post.title LIKE '%amounts%' 

and returning the desired result.

But, when a user enters how many % amounts in the search field, it is returning all the rows which are starting from how many and contains amounts in the upcoming words, which is wrong because the generated query is.

SELECT id, title from post where post.title LIKE '%how many % amounts%' 

And another thing is if the user enters only % the query returns all the results.

If we try escaping the % or other special characters and the result is way more different than it should be.

Please suggest a solution if you have any.

Prevent users from installing windows OS in PC

I have hp compac desktop and I want to stop children from accessing the bad stuff on the internet so for this purpose I have installed “Qustudio” app in my PC which can not be uninstalled without my email account. But there is one method by which they can uninstall it, they can install a new window to remove the previous version. My question is, “How can I stop them from installing windows”? (BIOS BOOT menu password, I guess)

Prevent JLink from using a DisabledPreferencesFactory with Java on Linux

This is kind-of a strange question, so please bear with me.

We have a Java application that has a utility for Mathematica 12 that lets you run our app from Mathematica using JLink. This works fine on macOS and Windows. On Linux we get an exception, thrown from the java.util.prefs.Preferences class.

After much nosing around, I noticed the JVM from Mathematica on Linux was setting -Djava.util.prefs.PreferencesFactory=com.wolfram.jlink.DisabledPreferencesFactory, and in the Mathematica SystemFiles I found that DisabledPreferencesFactory class to be returning the null value causing our exception.

That’s when I found this code in InstallJava.m (lines 518 to 527) in the JLink folder (in a createCommandLine function used by InstallJava[]):

(* Disabling the Java prefs subsystem on Unix/Linux is a hack to work around a very annoying problem with    that subsystem. Maybe Sun will fix this in JDK 1.5. Because this is an experimental fix, we'll put in    the $  disablePrefs flag as a backdoor that could be set from top level before launching Java. *) prefsSpec =   If[!osIsWindows[] && !osIsMacOSX[] && $  disablePrefs =!= False,     " -Djava.util.prefs.PreferencesFactory=com.wolfram.jlink.DisabledPreferencesFactory",   (* else *)     ""   ]; 

That made it clear where the issue is coming from, and it looks like we even have a way to disable this, as we’re on Java 1.8 and I don’t think the issue discussed is still a problem, so I’m fine setting that $ disablePrefs flag to false.

So my question is, how do I set that $ disablePrefs flag in a way that the JLink package will see it and not set this Java argument? I tried doing it inside a Mathematica 12 document before loading our package ($ disablePrefs = False;), and then also modified our package to set that flag before calling InstallJava[] from JLink, but neither worked. I’m hoping this is a simple Mathematica thing I just don’t know how to do, as I haven’t used it much. Thanks.

What kind of JavaScript protection is usually applied on password fields to prevent value injection? [closed]

There is a certain website with a certain login form which includes two fields; username and password.

I can successfully inject data with vanilla JavaScript to the first field:

document.querySelector("#username").value = "USERNAME"; 

But when I try to inject a password:

document.querySelector("#password").value = "PASSWORD"; 

I get an error:

VM1766:1 Uncaught TypeError: Cannot set property ‘value’ of null at :1:45

My problem

I double checked if the field exists as is and it is indeed existing in DOM;
I further ran a code like console.log(document.querySelector("#password")); and got lots of output which I purposely evade pasting here due to legal reasons.

My question

What kind of JavaScript protection is usually applied on password fields to prevent value injection?

How does VPN prevent Man In the Middle at the ISP level [duplicate]

If Man-In-The-Middle is at the ISP level (or even before ISP) it seems like they could perform the handshake, swap keys supply a faked or copied cert. The only thing they wouldn’t know is the private key. But it seems like if they were the client for the endpoint server, and they were the server for the victim, they could create two chains of encryption/decryption and two shared-secrets and no one would be the wiser. I think I’m misunderstanding something, though, because people say that a VPN would protect against this. So the basic question is how does an HTTPS web site cert protect against man in the middle at the ISP level?

Added: I guess the real question here is how does the guv’ment do it? Do they have a “spoof-cert” that is trusted by all CAs? (Or would this need to be a different cert for every coneivable site?)

How to prevent Cross-site Scripting in ajax response

I have a page(parent.php) from where i am calling a another page(result.php) through jquery ajax that is returning a response in html format. This response is showed on the parent.php page in a div. How can i secure my ajax response from xss attack. Here is the code snippet of parent.php page

$  .ajax({         type: "POST",         url: "getResult.php",         data:{search_in:search_in},           beforeSend:function(){           $  ("#search_result").html('Loading..');      },        success: function(result)     {         $  ("#search_result").html(result);         $  ("#search_result").show();      } }); 

in the getResult.php page i am quering database based on the parameter and returning some result in html form like table. How can i prevent cross site attack