## nearest neighbour – assign points to non-overlapping rectangles

I have N (~100M) points in 2D and M (~10k) non-overlapping rectangles. I’m looking for an algorithm to assign each point to a rectangle it is contained in (or say that it is outside of any rectangle). I’m looking for a solution that works faster than bruteforce.

In 1D, it is achievable in N * log(M) using binary search. is something like that possible in 2D?

## Relationship of R/S points in between signed message and DER signature

this time is difficult for me to explain problem i was facing. i realize that R/S point in DER signature is not match to the 1 in bitcoin signed message? Ok below is my say signed message.

—–BEGIN BITCOIN SIGNED MESSAGE—–
c4ca4238a0b923820dcc509a6f75849b
—–BEGIN SIGNATURE—–
1BxqqjVC29fvCWin4qBuqZhBy4V7Ncdxby
IPnTEOU713+XclrBrUEfTLeP0A7QIR4lObzQjBjyxGQExPwkalrQK1JOggIWk4xrfWIjHEC0RKGv3vtguDfto0o=
—–END BITCOIN SIGNED MESSAGE—–

my working way is \$decoded_content = bin2hex(base64_decode(IPnTEOU713+XclrBrUEfTLeP0A7QIR4lObzQjBjyxGQExPwkalrQK1JOggIWk4xrfWIjHEC0RKGv3vtguDfto0o=))

then i manage to get R/S point from \$decoded_content. after that, i use R/S point to generate DER signature. I realized that this DER signature is fail in signature verification.

shortly to say,

my program check valid signature using function in https://github.com/tuaris/CryptoCurrencyPHP/blob/master/Wallet.class.php#L225

therefore. if i have another party send me DER signature, how do i convert it to get base64_encoded string, so end up i am able to use function i mention just now.

I try alot of methods but no luck, are R/S points in both signed message and DER signature means to same?

## Postfix SMTP sends to localhost, even when MX points to Google Apps aspmx.l.google.com

I have been looking for days for this solution. My CENTOS7 Postfix sever (with Virtualmin, Virtual users) is working fine with the mail services. All its domains. However, one of my domains which only use this server for hosting, POINTS to google for MAILING service (aspmx.l.google.com). People from out of my server can mail to that domain, and Google receives it without issues. So, my MX records are pointing fine.
But other users from INSIDE my server trying to send mails to this domain that points to google get a reply

The following recipient(s) cannot be reached:

Server error: ‘550 5.1.1 :
Recipient address rejected: User unknown in virtual alias table’

The only similar case I just found was on this thread here from 8 years ago:

Postfix SMTP sends to localhost, ignores MX records set to Google Apps

But the solution on that question is not my case.

I verified my postfix main.cf:

mydomain = maindomainserver.com
myhostname = server.maindomainserver.com
mydestination = localhost
myorigin = \$mydomain

Which I tried already several combinations (per several forums suggestions, readings, postfix manuals, etc, including removing ALL of those 4 lines above, leaving them to be handled by POSTFIX defaults. Always same thing (the local delivery and SMTP out always working fine in any scenario)

And I also checked my etc/hosts file (as suggestion in the solution from that thread above):

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost server localhost6 localhost6.localdomain6
xx.xx.xxxx.xxx server.maindomainserver.com

so my 127.0.0.1 is not pointing my localhost domain.

What else can be checked here in order to have that domain (pointed to GOOGLE) to finally receive messages from inside-server senders, and avoid POSTFIX to look for that address locally?

## geometry – How to determine the minimum value of the weighted sum of the distances from two points to a point on a circumference

In a two-dimensional Cartesian coordinate system,
there are two points $$A(2, 0)$$ and $$B(2, 2)$$
and a circle $$c$$ with radius $$1$$ centered at the origin $$O(0, 0)$$,
as shown in the figure below.

If $$P$$ is a point on the circle $$c$$,
then what is the minimum value of

$$f = 2sqrt{2}lvert{PA}rvert + lvert{PB}rvert?$$

From my experience,
the solutions to such problems do not seem to be available under elementary form in general,
as indicated by answers to the question Minimize the sum of distances between two point and a circle.
However, when I studied this problem on GeoGebra,
it seems that minimum value is exactly $$5$$ in this specific situation,
with $$P$$ located at roughly the position shown below:

I tried to verify my hypothesis as follows.
Since $$P$$ is located inside $$angle AOB$$,
we set its location to $$(x, sqrt{1 – x^2})$$ (where $$sqrt{2}/2 < x < 1$$).
Therefore,
begin{align*} lvert{PA}rvert &= sqrt{(2 – x)^2 + (1 – x^2)} \ &= sqrt{5 – 4x}, \ lvert{PB}rvert &= sqrt{(2 – x)^2 + (2 – sqrt{1 – x^2})^2} \ &= sqrt{-4sqrt{1 – x^2} – 4x + 9}, \ f &= 2sqrt{2} lvert{PA}rvert + lvert{PB}rvert \ &= 2sqrt{2} sqrt{5 – 4x} + sqrt{-4sqrt{1 – x^2} – 4x + 9}. \ end{align*}

I asked GeoGebra again to plot $$f(x)$$:

and it seems to confirm my conjecture that
$$min_{sqrt{2}/2 < x < 1} f(x) = 5$$

Is my hypothesis correct?
If so, is there a proof of this hypothesis that can be relatively easily by hand
(preferably avoiding, say, the evaluation of $$f'(x)$$)?
Geometric proofs will be especially appreciated.

## algorithms – Joining points of polygon in correct order

I have a point’s array of some 2d shape(polygon). The polygon could be either crossed or convex, I don’t know it. And I want to join those points in the correct order.

My first thought was to take some point as an origin and start looking for the closest one and so on. But this approach doesn’t work for some crossed polygons, for example: on Image1, it would go from `x3` to `x5` because it is closer than to `x4`, but what I really want is to join `x1-x2-x3-x4-x5-x6`.

After some thinking, I’ve realized that my requirement `correct order` is very unclear because on Image2 red lines are in the correct order too. So let’s add the requirement that polygon lines shouldn’t at least cross.

I really confused, can someone point me in what direction I should move? Maybe it’s some famous algorithm but I just don’t know how to google it properly. Thanks.

Image1:

Image2:

## Why do stars appear as circles, not points?

Excluding the Sun, stars are so far away that their angular diameter is effectively zero. However, when you take pictures of them, brighter stars appear as circles, not points. Why?

In theory, any star, regardless of brightness, should hit at most one small point of whatever medium is being used to take the photograph. Why do nearby points of the medium also respond? Does excessive light “bleed” into nearby points, and, if so, is the “bleeding” the same for digital and non-digital cameras?

Does it have something to do with the lens? Does the lens expand a single point of light into a small circle, depending on brightness?

I ran into this while trying to answer https://astronomy.stackexchange.com/questions/22474/how-to-find-the-viewing-size-of-a-star which effectively asks: what’s the function (if any) that relates star brightness to the size of a star’s disk on photographic film (or digital media)?

Note: I do realize that a star’s visual and photographic magnitudes can be different, and am assuming the answer will be based on photographic magnitude.

• Photometry (astronomy) at Wikipedia

• http://www.chiandh.eu/astphot/object.shtml, especially the discussion about “raw image units” and “full width at half maximum” (FWHM)

• http://www.astro-imaging.com/Tutorial/MatchingCCD.html and its discussion of FWHM

## [ Politics ] Open Question : Republicans keep claiming Biden has dementia, so why am I seeing him kicking Trump's butt by over 10 points in national polling?

[ Politics ] Open Question : Republicans keep claiming Biden has dementia, so why am I seeing him kicking Trump's butt by over 10 points in national polling?

## https of one domain points me to the https of another domain

I have two domains in my vps:

raton-inalambrico and rolsbek.

I have installed a ssl with letsencrypt for each one.

But when I put https in rolsbek.com it redirects me to https on raton-inalambrico.com.es

This doesn’t happen with the http because I have two *80 ports for each domain.

The thing is that I don’t know how to do it to create a 443 port for each domain or how it goes so that it doesn’t redirect me from rolsbek’s https to the one of mouse-wireless.

I use to manage ISPConfig