Can this Lair Action restore all the lich’s 8th or lower spell slots even when there’s no combat or any of the lich’s enemies within?

One of the Lair Actions of a lich does the following:

The lich rolls a d8 and regains a spell slot of that level or lower. If it has no spent spell slots of that level or lower, nothing happens.

A lich decided to attack the party, using some of its spell slots in the process, and then retreat to its lair to recover and await the party.

If the party manage to find the lich’s lair within 8 hours (i.e. before the lich can long rest and recover its spell slots that way), would the above Lair Action have (likely1) restored all of the lich’s spent spell slots (excluding the 9th level spell slot, obviously)?

Or is there some reason this wouldn’t work, such as the Lair Actions only being "active" when there are enemies of the lich actually in the lair (i.e. during combat)?


1 I say "likely" because there’s a dice roll involved, so technically it could not roll the numbers it needs to actually recover all its spell slots, but let’s discount that possibility as I imagine an hour or so of rolling will almost definitely roll the numbers that it needs eventually.

Do any single-cell organisms exist that approximate NP-hard problems within a factor better than $1/2$ $log$2?

I’ve seen on Wikipedia; that set covering cannot be approximated in polynomial time to within a factor mentioned above. Unless $ NP$ has quasipoly-time algorithms.

Now, this must pertain to classical algorithms and does not mention any approximation algorithms that may only work in nature.

(eg. Things like Amoebas solving $ TSP$ problems)

  • Do any single-cell organisms show any promise in solving $ NP$ -hard problems in polynomial-time?

  • Or approximating them better than any known classical algorithms?

Is there any encryption mechanism where i can ensure that the decryption can only happen within my data center?

I have a requirement where i need to store confidential data in an encrypted format in the url, i understand POST with body is better approach but it is not an option for me. I am thinking of using a pass phrase based AES 128 bit encryption for encrypting the query string parameter. The concern i have is that the url could get cached in different parts of the internet and if the pass phrase is exposed somehow then it could be used to decrypt these values.

Can I teleport within an area warded by Forbiddance?

Can you teleport within an area warded by Forbiddance? It’s already been established you can teleport out of it, but not whether, once inside, you can teleport from one part of it to another.

You create a ward against magical travel that protects up to 40,000 square feet of floor space to a height of 30 feet above the floor. For the duration, creatures can’t teleport into the area or use portals, such as those created by the gate spell, to enter the area. The spell proofs the area against planar travel, and therefore prevents creatures from accessing the area by way of the Astral Plane, Ethereal Plane, Feywild, Shadowfell, or the plane shift spell.

The phrasing uses both phrases, "into" and "enter". If you teleport from one area to another, you are going into an area, and if you enter an area that would only block teleportation from outside.

As such, I’m not sure whether the spell could be used, say, to ward a battleground so that the enemy couldn’t teleport around within said area easily, or used within a mage’s private area to prevent an enemy teleporting around smashing things.

So, can I teleport within an area warded by Forbiddance?

How to calculate movement within an area

Related: How does the UA Tunnel Fighter fighting style's reaction attack interact with the Sentinel feat's speed-reduction effect?

The Tunnel Fighter feat from UA has the following wording:

As a bonus action, you can enter a defensive stance that lasts until the start of your next turn. While in your defensive stance, you can make opportunity attacks without using your reaction, and you can use your reaction to make a melee attack against a creature that moves more than 5 feet while within your reach.

What exactly is meant by moving "more" than 5 feet?

Would either of the two following paths be considered moving "more than 5 feet", assuming the player was holding a weapon with reach?

  • Path 1: Enter range, move 5 feet, exit range
  • Path 2: Enter range, move another 5 feet within range
  • Path 3: Enter range, immediately exit range
┌───┬───┬───┰───┬───┐ │MAX-RANGE->┃   │   │ ├───┼───┼───╂───┼───┤ │   │   │ .------P_1│ ├───┼───┼─|─╂───┼───┤ │ME │   │ `-->F │   │ ├───┼───┼───╂───┼───┤ │   │ F <--------P_2│ ├───┼───┼───╂───┼───┤ │   │   │ .------P_3│ ┝━━━┿━━━┿━|━╃───┼───┤ │   │   │ F │   │   │ └───┴───┴───┴───┴───┘ 

PURELY looking at the diagram and adding up the lengths of the lines, you could calculate the sum of lines WITHIN my range as being:

  • Path 1: 2.5 + 5 + 2.5 = 10
  • Path 2: 2.5 + 5 = 7.5
  • Path 3: 2.5 + 2.5 = 5

But I don’t know if this is strictly correct. I suspect that partial values may only be calculated before, or after, movement.

If movement is calculated before the step is taken, then stepping into my reach won’t count as movement within my reach, but stepping out will count as 5 feet. This makes Path 2 safe to travel.

If movement is calculated after the step is taken, then stepping into my reach will count as moving 5 feet within my reach, but stepping out won’t count as any. This makes Path 2 dangerous.

If movement is only calculated when it is entirely (start+finish) within reach, then all paths are safe.

There’s a lot of different ways to spin this. Is there any official ruling on how to calculate movement within an area?

Add ID to widget within a dynamic sidebar

I would like my widgets to have a unique ID, preferably based on the title given to the widget. My specific case is that I would like to have a jump link (<a href="#widget-title">) to target widgets in a dynamic sidebar located in the footer of my site. I would like my widget to be wrapped in a div, i.e. <div id="widget-title">, or even better, if I could add that id to the tag that contains the widget’s title, i.e. <h3 id="widget-title"> (I’d love to avoid an extraneous div).

I know that each widget has its own ID somewhere that I could access, but I worry that if I use that, then add/change/delete widgets later, the ID may change. But I can and will always keep the widget title consistent. Right now the widget I have in mind has an ID of custom_html-4, but I’d like something more static and semantic.

Getting numerous HEAD requests by Java user agents to resources that require authentication to view within a web application. Should I block them?

I have recently started using Cloudflare’s firewall in front of a web application. This app has a limited user base of selected applicants and they must log in to view anything. There is no public registration form and nothing within the portal can be accessed without an account.

Since moving the DNS to Cloudflare I can see we are receiving numerous daily HEAD requests to paths that are only accessible within the portal.

These requests come from one of two groups of IP addresses from the United States (we are not a US-based company; our own hosting is based in AWS Ireland region and we’re pretty sure at least 99% of our users have never been US-based):

Java User Agents

  • User agent is Java/1.8.0_171 or some other minor update version.
  • The ASN is listed as Digital Ocean.
  • The IP addresses all seem to have had similar behaviour reported previously, almost all against WordPress sites. Note that we’re not using WordPress here.

Empty User Agent

  • No user agent string.
  • The ASN is listed as Amazon Web Services.
  • The IP addresses have very little reported activity and do not seem at all connected to the Java requests.

Other Notes

  • The resources being requested are dynamic URLs containing what are essentially order numbers. We generate new orders every day, and they are visible to everyone using the portal.
  • I was unable to find any of the URLs indexed by Google. They don’t seem to be publicly available anywhere. There is only one publicly accessible page of the site, which is indexed.
  • We have potentially identified one user who seems to have viewed all the pages that are showing up in the firewall logs (we know this because he shows up in our custom analytics for the web app itself). We have a working relationship with our users and we’re almost certain he’s not based in the US.

I am aware that a HEAD request in itself is nothing malicious and that browsers sometimes make HEAD requests. Does the Java user agent, or lack of a user agent in some cases, make this activity suspicious? I already block empty user agents and Java user agents through the firewall, although I think Cloudflare by default blocks Java as part of its browser integrity checks.

Questions

  1. Is there any reason why these might be legitimate requests that I shouldn’t block? The fact it’s a HEAD request from a Java user agent suggests no, right?

  2. One idea we had is that one of the users is sharing links to these internal URLs via some outside channel, to outsource work or something. Is it possible some kind of scraper or something has picked up these links and is spamming them now? As I say, I was unable to find them publicly indexed.

  3. Is it possible the user we think is connected has some sort of malware on their machine which is picking up their browser activity and then making those requests?

  4. Could the user have some sort of software that is completely innocent which would make Java based HEAD requests like this, based on their web browsing activity?

Any advice as to how I should continue this investigation? Or other thoughts about what these requests are?

How To Place Object On Ground Within Radius?

I’m using Unity and I’m building an object placement system where you’ll be able to position objects around the player.

I’d like to place objects flush with the ground, parallel to world up, even on slopes, so I’ll use a raycast for that.

How would I limit the distance to maxDistance? I tried using ScreenPointToRay but the max distance on the raycast makes the movement of the object stop if the raycast doesn’t hit.

As an example, If I’m looking down in front of me, the object i’m controlling should be at that position. However, if I’m looking straight forward into Infinity, the object should only ever be maxDistance away. If I rotate, the object should follow smoothly.

Thanks!

How to separate information within 1 line of user input? (Python3) [closed]

I want to know how to separate information within 1 line of user input using Python3. For example, the user types

5 1 7 8 12 13 

The 5 represents the number of numbers that follow, and I want to store those numbers (1, 7, 8, 12, 13) in 1 array as integers. I have tried splitting off each number as a String and then casting it as an int, but this doesn’t work well if the input line contains two (or possibly more) digit numbers.