Monogame Rectangle Collision Strange Behavior

So I’m making part of the original Legend of Zelda and I’m working on collisions. I want to get the this grey box to collide with the green box (and not be able to go into it). It works when I approach from the bottom, but when I approach from the left it doesn’t detect a collision until right after this point: enter image description here I used the hitbox rectangles as the destination rectangles for these sprites, so I know they have to be intersecting when they visually intersect, but they do not. I am using the Rectangle.Intersects method to detect the intersection, then Rectangle.Intersect to get the rectangle of the intersection. Here’s some of the code where rightTop is the green rectangle and collidable is grey:

public void CheckCollision(ICollidable collidable)     {         if (collidable.GetHitBox().X > maxX)         {             if (!rightOpen)             {                 collidable.SetPosition(maxX, collidable.GetHitBox().Y);                 collidable.BorderCollision();             }             else if (rightTop.Intersects(collidable.GetHitBox()))             {                 Rectangle intersection = Rectangle.Intersect(rightTop, collidable.GetHitBox());                if (intersection.Width > intersection.Height)                 {                     collidable.SetPosition(collidable.GetHitBox().X, rightTop.Bottom);                 }                 else if (intersection.Height > intersection.Width)                 {                     collidable.SetPosition(rightTop.Left-collidable.GetHitBox().Width, collidable.GetHitBox().Y);                 }                  else                 {                     collidable.SetPosition(rightTop.X, collidable.GetHitBox().Y);                 }             }          }      } 

Haskell: difference behavior in ghci concerning “polymorphic recursion”

I stumbled upon some question that puzzled me, maybe it’s just a feature (or simply because I am doing first “Haskell-steps” without studying the manual too deeply, which I guess I should…

Anyway, the observation want to ask about is as follows: I did some inductive data type definition, though it’s “non-regular”, i.e., requiring polymorphic recursion. I am aware that this is problematic, so I wanted to see to what extent Haskell can handle it. The actual code is at the end of the post.

Ultimately, what I don’t understand is the difference in behavior comparing – doing a :load file.hs in the ghci as opposed to – typing in the definitions manually inside the ghci.

Actually, I am not 100% sure if it has to do with the particular kind of recursion (though for simpler things I did, no such discrepancy showed up.

For concreteness sake, the code looks like the one below: The non-regular data structure is SList (strange list). The datatype in isolation works both with loading the file or typing it manually. I am not surprized by that part. More interesting and the cause of the problem is the function slength. It’s kind of an instance of polymorphic recursion and thus potentially problematic. On the other hand, the non-regularity of the type parameter a vs. Node a, vs. Node (Node a)) etc is not really relevant in the inductive definition.

Indeed, the whole code loads fine in GHCi version 8.6.5, though clipping it in fails, reporting as failure that “Occurs check: cannot construct the infinite type”. Also this seems understandable, caused by the polymorphic recursive definition of slength. What I don’t understand is, why both ways of doing things in ghci behave differently (BTW also compiling with ghc works)

data Node a = Pair a a

data SList a = Nil | Cons a (SList (Node a))

slength :: SList a -> Int

slength Nil = 0

slength (Cons n r) = 1 + (slength r)

How to capture an input device and prevent it’s default behavior

I have an RFID tag reader. But it works like a HID device (like a keyboard). It sends keystrokes to the computer when a tag is scanned. When I open notepad and scan a tag – it types the ID one digit at a time. Is there a way to create a program to listen to this device (or this port) and capture (intercept) all input. So that the keystrokes wouldn’t appear on my system but I could assign my own events when the device sends and input. I don’t want it to show up on Notepad.

I realize that the implementation can differ depending on the OS and programming language used. Ideally, I would like to make this work on both Windows and Linux. I would prefer to use something like Node.js but I suppose C could also be good.

I would appreciate any hints or pointing me in the right direction.

enter image description here

How and when should a lawful good character punish evil behavior?

I’m new to dungeons & dragons and social gaming in general, and I need some guidance on things that are making it not fun for me to play.

I joined a campaign with the guidance that it was a good party, so I made a lawful-good character that follows Lathander. When I started playing with them, I found that one character is a necromancer and is definitely not good. We also had a rogue join that is branded by Lathander but is constantly stealing and murdering people.

What should I do when they murder someone or steal from the party? I know stealing from party members is not being a team player.

It really annoys me when we give them things to identify, and they dispel any awesome magic items related to Lathander that I would have used. Is there a way to punish this?

Furthermore, should I punish the necromancer for raising dead, just to be consistent? They really just use it to help the party out.

This campaign has been going on for a while. The DM said the campaign will probably provide punishment, but they have also looked to the players to punish specific acts like murder. My problem is not knowing when to act and how far to go with it.

FUD payload connection over 443 (meterpreter behavior) still being detected by Windows Defender

I’ve managed to create a obfuscated shellcode that is compatible with windows/meterpreter/reverse_tcp and windows/shell/reverse_tcp (metasploit) payload’s handlers. When testing with metasploit listening with windows/shell/reverse_tcp payload the connection is not detected, when I test with metasploit listening with windows/meterpreter/reverse_tcp set the behavior is detected. The detection seems to post connection..

Is there additional options/variables I can set in the windows/meterpreter/reverse_tcp payload handler to evade antivirus (windows defender) detecting meterpreter behavior?

I’m looking to evade detection server side (metasploit listener options), not client side I’ve done that.

Multi-agent randomized behavior

In Artificial Intelligence: A Modern Approach Edition 3, Page of 43, At Single Vs. Multi-agent section’s last line, Writer says,

In some competitive environments, randomized behavior is rational because it avoids the pitfalls of predictability.

Can someone help me understanding this line? Specially, what does he mean by pitfalls of predictability ?

Weird behavior of `Quantile` function

I found a very strange behavior of Quantile function when evaluating the following expression:

Quantile[TruncatedDistribution[{0, \[Infinity]},    MixtureDistribution[{0.5,      0.5}, {NormalDistribution[30.0505043478260844836,       1.6756943154326708889],      NormalDistribution[30.0505043478260844836,       2.8804367798735217576]}]], 0.5] 

Mathematica was freezing after I hit shift+enter, and there seems to be an infinite loop inside because it kept freezing for a couple of hours.

However, if I change the quantile from 0.5 to 0.500001 it gives me the result immediately.

Or if I remove some digits, e.g., the following:

Quantile[TruncatedDistribution[{0, \[Infinity]},    MixtureDistribution[{0.5,      0.5}, {NormalDistribution[30.0505043478260844836, 1.6756],      NormalDistribution[30.0505043478260844836,       2.8804367798735217576]}]], 0.5] 

(note the 1.6756 v.s. 1.6756943154326708889) gives me the result almost immediately as well.

This is so weird as I don’t see any fundamental differences between these numbers. It should always gives the results immediately.

Is this a BUG or there are some tricky things within these numbers?

System versions:

OS: macOS Catalina 10.15


Does having to introduce alternative behavior always indicate poor UX design?

Take the classical top-left go-back button on mobile apps.

The main two issues with it are:

  • Having to press a lot of times when you want to go far back
  • Not being able to go forward in case you missed the screen you wanted to go back to

With this in mind, I’m tempted to introduce a long-press history popup on the go-back button, so the user can skip to exactly where they want.

Of course, we all know that long-press is not really intuitive.

The question: does having a tool-tip automatically introduce this feature to the user make my UX design bad?

There is a difference between malware detection using automata and family behavior graph?

I have a question,

There is a difference between dynamic malware detection using automata and family behavior – graph?

I think that they are both relying on API function calls but I don’t understand if there is any major difference between them.

Please help me,

if you’re not sure what I’m talking about:

automata –

family behavior – graph –

of course, they are free

first one – just click on Request full-text and it will download the pdf files. the second one is google drive link.

Thank you.

Best behavior for data filtering

I’m by no means a UX expert or a Designer for that matter. But I’ve come up with a doubt about a UX decision made by my manager and what should be the best practice for the case, based on a recent call from a client that was confused by the behavior that it imposed.

Our product makes heavy use of filtering capable datatables with a filter-per-column strategy. A few of these handle large datasets and have date range constraints. Thus creating a situation where not all filtering options have available results at a time.

Coming from this problem, our manager has come up with the ideal that the client must be ‘protected’ from this values that are not ‘valid’, and that at any time the filtering options must have results to show.

I’m my opinion, and probably the confused user that called me, that shouldn’t be the case, and the user should have all its options available at any time, even it that means they will at some time have no results from their filters.

(not even considering the overhead this causes from pre-processing of the resulting dataset to extract the possible filtering options)

Thanks. And I’m eager to read your point of view on this.