Unit – How to use the mouse to exert force in direction and / or touch input direction and input speed?

I have to object. I can move object 1 (my player) with the mouse (or touch for smartphone version).

I want to exert a force on object 2 when object 1 hits it. The force direction must be the mouse vector direction or the touch vector direction.

For mouse input, I use the event OnMouseDown and OnMouseDrag to determine the original position of the mouse.

But I think that's not the best approach. Behavior is not what I expect

void OnMouseDown ()
{

mouseDragStartPosition = Input.mousePosition;

// Convert the position of the cubes from the world to Screen Point
screenSpace = Camera.main.WorldToScreenPoint (transform.position);

// Compute the difference between the cube's world position and the mouse's screen position, which has been converted to a world point
offset = transform.position - Camera.main.ScreenToWorldPoint (new Vector3 (Input.mousePosition.x, Input.mousePosition.y, screenSpace.z));

}


void OnMouseDrag ()
{


// track the mouse position
var curScreenSpace = new Vector3 (Input.mousePosition.x, Input.mousePosition.y, screenSpace.z);

// convert the mouse position of the screen to a world point and adjust it with offset
var curPosition = Camera.main.ScreenToWorldPoint (curScreenSpace) + offset;


transform.position = new Vector3 (curPosition.x, ClampY, curPosition.z);
}

void OnCollisionEnter (collision collision)
{
Debug.Log ("OnCollisionEnter");
if (collision.collider.tag == "Disc")
{
ApplyForce ();
}

}



void ApplyForce ()
{
Vector3 direction = mouseDragStartPosition - Input.mousePosition;
direction = new Vector3 (direction.x, ClampY, direction.z); // used ClampY to disallow + -Y
DiscRb.AddForce (direction * 1, ForceMode.Impulse);
}

Enter image description here

Apache 2.4 – Proposals to harden the system against PHP FPM proxy brute force

I recently (about 1 week ago) changed my Virtualmin system to PHP-FPM (MPM-Event) of CGI / FCGI (runs as Virtual Server owner).

OS = Debian 9
Apache = 2.4
php 7.0, 7.1, 7.2, 7.3
FPM = 7.0, 7.1, 7.2, 7.3
Virtualmin has just done an automatic update in the last 24 hours. However, when I checked the websites before going to bed, everyone was still running smoothly. However, I found that the paging file ran at almost 100% and the system memory was over 70% … so I started an Apache reboot before going to bed (which reduced memory usage to 27% and the file obviously again shifted to empty)

CPU usage is always pretty low … usually just a few percent or less (website traffic is usually very low)

This morning, all WordPress sites on the server were offline with the same error message

"503 service not available
The server is temporarily unable to process your request due to maintenance failure or capacity issues. Please try again later. "

All static sites on the server ran fine, an Apache reboot and a server restart did not resolve the error.

In the end, I switched Apache back to CGI / FCGI and the WordPress sites are back online.

Looking at one of Virtualmin / Virtual Server's WordPress logs (/var/log/virtualmin/domain.com_error_log), I notice the following entries (multiple times and very consistent …

[Fri Jun 21 20:57:03.183697 2019] [proxy:error] [pid 886:tid 140047634310912] (111) Connection refused: AH00957: FCGI: An attempt to connect to 127.0.0.1:8003 (*) failed
[Fri Jun 21 20:57:03.183794 2019] [proxy_fcgi:error] [pid 886:tid 140047634310912] [client 46.166.143.116:43883] AH01079: Connection to backend: localhost could not be established

I did an IP search for this IP address and found the following …

IP: 46.166.143.116
Decimal number: 782667636
Hostname: 46.166.143.116
Delivery advice: 43350
ISP: NFOrce Entertainment B.V.
Organization: NFOrce Entertainment B.V.
Services: Suspected network sharing
Recently reported spam source in the forum. (131)
Assignment: Probably static IP
Blacklist:
Continent: Europe
Country: Netherlands nl flag
Width: 52.3824 (52 ° 22 '56.64 "N)
Longitude: 4.8995 (4 ° 53 '58.20 "O)

I would like to harden fpm and ask for suggestions on options?

I am also not sure why fail2ban does not care about this?

htaccess – Force HTTPS with a URL and a different URL so as not to force HTTPS

In the DNS zone, I configured 2 URLs, the first for public access on the web, the second for web service communication. I have to do it this way because there is no cache / DNS.

The problem is that if I leave the two rules, accessing the second URL will change the URL to the main URL (with https) because of the first rule, but if I comment on the first rule, the second address will work normally but the public URL is not working.

Rewrite Engine On
RewriteBase /
RewriteCond% {SERVER_PORT} 80
RewriteCond% {HTTP: X-Forwarded-Proto}! https

## With SSL for public use on the Web
RewriteRule ^ (. *) $ Https://www.mysite.com/$1 [R,L]

## Access to the same site, but without SSL for the web service
RewriteRule ^ http: //meusite.vm2921.vzcloud.com$ http://meusite.vm2921.vzcloud.com/$1 [R]

Algorithms – Force an edge to be in the minimum S-T cut

For a given flow network N = (G, c, s, t) and an edge e = (u, v) I am trying to create an algorithm that finds a minimal (S, T) intersection in the given network that contains e.

So I tried a few steps, first I know I have to saturate e so it can be in every min-cut. I tried to add a supersource that connects to u (with infinite capacity) and a supersink that connects to v. But that will only saturate e if it is not yet saturated.
I also thought maybe reducing an epsilon from the capacity of e, but I'm not sure if it's enough.

I also tried to connect the supersource with all u neighbors and the supersinks with all v neighbors and then reduce an epsilon of e. Again, I do not know if that's enough.

I'm not sure how to proceed (or if I can) or if I'm missing something.

Document Library – How do I force IE to download a copy of the file instead of opening a temporary copy in SP 2013/16?

When you open the document with Chrome, a copy of the file is downloaded, saved to a local directory, and opened with the client application. Users can only make changes and save the changes in the local copy.

When you open the document with Internet Explorer, it opens with the client application, but this seems to be connected to the online copy. The user does not change anything and simply saves the file, which updates the library file. (Old SharePoint 2010 does not have this problem, but I use 2016 that behaves like that.)

Is there a setting I can change to force IE to download a copy of the file instead of opening a temporary copy?

I tried opening Document Library Settings> Advanced Settings> Documents in Browser, but nothing has changed.

Firewalls – Central Brute Force credential discovery using Netflow data

Is it possible to detect brute-force logins with netflow data?
Netflow data could be used to check the number of incoming packets at a particular destination port (for the search flow). If the number is below a service-specific threshold (SSH, FTP, etc.), the source IP address can be considered an attacker.

Does anyone have experience with it or is there an alternative to building a central brute-force detection? It's about protecting a few hundred Linux hosts running different services (SSH, FTP, HTTP, SMTP, IMAP, POP3).

Python – How can I force garbage collection?

I have doubts I'm developing an application that needs to work with fairly heavy files (300k lines in each of several Excel) and I want to know if there's a way to clean up the memory between the executions in Python to allow for a possible MemoryError avoid.

My code follows the following scheme:

Main function (parameter1, parameter2) (each of the parameters is an xlsx)
~~~~~~ (function code)

main (xlsx1, xlsx2)
main (xlsx1, xlsx3)
---
main (xlsx2, xlsx1)
---

That is, I have a function that I call once for every possible pair of files (and therefore parameters).

For more information, I use openpyxl as a module for working with xlsx.

Thanks in advance

usb – Force the display of the cursor / pointer on Android

I bought a graphics tablet (Huion HS64) that works great with my S10. The only problem is that I can not see where I'm going to type because no cursor is displayed. Can I somehow force the mouse pointer to be always on, or have my tablet recognize the tablet as a mouse?

I could try connecting both a mouse and the tablet to a USB hub, but I'd rather have a coding solution. My phone is not rooted, but I am not against rooting to solve the problem. Thank you in advance!