## pr.probability – Anti-concentration of inner product of a uniform unit norm vector with another vector

I have a question, which is necessary at one step of my research. Suppose that $$X$$ is a uniform random vector on the unit sphere $$S^{d-1} := {x in mathbb{R}^d: |x|_2 = 1}~.$$ Is there any simple anti-concentration result, which lower bounds the quantity:
$$mathbb{P}(a^top X > b)$$ for some $$a in mathbb{R}^d$$ and $$b in mathbb{R}$$? Of course, we need to assume that $$b le |a|_2$$ for the event $$a^top X > b$$ to be non-empty. I know that there are multiple concentration inequalities for projections of unit-norm vectors on linear subspaces, but this is not really a projection, and moreover, I want an anti-concentration result. Any help will be greatly appreciated!

## Analytic function on complement of closed unit disk onto open unit disk

Does there exist an analytic function whose domain is the complement of the closed unit disk and whose range is the open unit disk?

## Given a function that has already been unit tested, but is present in another unit, should I bother testing it again?

Say, for instance, I have this simple function in my domain layer:

``````function canCreateNewUsers (principal: User): boolean {
}
``````

And this function has already been unit tested in my domain tests.

Now say I have another layer, the service layer, that has a function which creates a user:

``````// service layer
function createUser (principal: User, email: string) {
// TODO
}
``````

which, in full, would look something such as:

``````// service layer
function createUser (principal: User, email: string) {
const exists = await userRepository.checkExistsUserWithEmail(email)

if (exists) {
// return Error
}

if (!canCreateNewUsers(principal) {
// return Error
}

const newUser = createUserWithEmail(email)

await userRepository.insertUser(newUser)

return newUser
}
``````

Now, my question is, how would I unit test this service layer function properly? Right now, I am considering two options:

1. Stub the `canCreateNewUsers` function.

PROS:

I don’t need to make more (duplicate, because `canCreateNewUsers` is already tested) tests.

CONS:

I can’t think of any major cons, besides having to rename `canCreateNewUsers` in the test file, if it ever gets renamed.

Also, isn’t it weird to stub domain functions/objects?

1. Do not stub the `canCreateNewUsers`.

PROS:

My tests don’t care about implementation details.

CONS:

I will end up writing the same tests I did for `canCreateNewUsers`, but now for `createUsers`. Which is okay, if you consider these two to be different units?
However, if I ever change `canCreateNewUsers` (by adding or removing conditions, for example), I will have to mimic the changes in both of the domain and service tests.

What would you guys do in this situation? Thanks.

(Note: I am using fakes for the repository bit)

## Is there a simple algorithm for generating unit tests given a function’s code?

Given the abstract syntax tree (AST) of each line of a function’s code, I am asked to generate code for that function’s corresponding unit tests, similar to what Microsoft’s IntelliTest tool does here: https://docs.microsoft.com/en-us/visualstudio/test/generate-unit-tests-for-your-code-with-intellitest?view=vs-2019.

The issue is that I have to implement this from scratch instead of using built-in tools, since my project is implementing an ABAP to C# interpreter (ABAP is a programming language used for SAP’s enterprise software), which executes ABAP code in C#, so I cannot just use an IDE’s unit test generation tool.

I so far have decided that the first part of the algorithm is to generate the function’s parameters, but I’m not sure how I’m going to generate the function’s parameters exactly. Furthermore, I don’t know how the unit test generator is going to compute the expected outputs of the function.

Note: This algorithm doesn’t need to be an algorithm that works as well as an IDE’s automatic unit test generation, I just need to be able to come up with an algorithm that is an initial working prototype. But so far, I am stumped, and haven’t found any good online resources regarding this topic.

## programming languages – Is there a simple algorithm for generating unit tests given a function’s code?

Given the abstract syntax tree (AST) of each line of a function’s code, I am asked to generate code for that function’s corresponding unit tests, similar to what Microsoft’s IntelliTest tool does here: https://docs.microsoft.com/en-us/visualstudio/test/generate-unit-tests-for-your-code-with-intellitest?view=vs-2019.

The issue is that I have to implement this from scratch instead of using built-in tools, since my project is implementing an ABAP to C# interpreter (ABAP is a programming language used for SAP’s enterprise software), which executes ABAP code in C#, so I cannot just use an IDE’s unit test generation tool.

I so far have decided that the first part of the algorithm is to generate the function’s parameters, but I’m not sure how I’m going to generate the function’s parameters exactly. Furthermore, I don’t know how the unit test generator is going to compute the expected outputs of the function.

Note: This algorithm doesn’t need to be an algorithm that works as well as an IDE’s automatic unit test generation, I just need to be able to come up with an algorithm that is an initial working prototype. But so far, I am stumped, and haven’t found any good online resources regarding this topic.

## ubuntu – `bad-setting (Reason: Unit nftables.service has a bad unit file…` when add `/etc/systemd/system` conf to nftables

System is debian 10 with nftables.
I plan to make `nftalbes` auto restart when failed,script as below:

``````cat << EOF >> /etc/systemd/system/nftables.service.d/override.conf
(Service)
Restart=on-failure
RestartSec=1s
EOF

``````

Output shows `bad-setting`:

``````systemctl status nftables.service

nftables.service - nftables
Drop-In: /etc/systemd/system/nftables.service.d
└─override.conf
Active: active (exited) since Sat 2021-07-24 18:57:51; 1h 13min ago
Docs: man:nft(8)
http://wiki.nftables.org
man:nft(8)
http://wiki.nftables.org
Main PID: 2145 (code=exited, status=0/SUCCESS)
Memory: 0B
CGroup: /system.slice/nftables.service
``````

Where is the problem?

## Swift Package Unit Test classifies a public class as ‘private’, yet honors a struct. Why?

Goal: To access a package’s variable/func within a Unit Test.

Problem: I can access a Struct but not a Class.
The package Unit Test thinks it’s a private vs public variable or function.

Question: Why?, Remedy?

Here’s the entire view of the Swift Package:

## abstract algebra – Generators of the group \$S^3\$ of unit quaternions

Let $$S^3$$ be the group of unit quaternions, and let $$A$$ be the set of all purely imaginary unit quaternions (so $$A$$ is homeomorphic to $$S^2$$). How can we show that $$S^3$$ can be generated by the elements of the form $$alphabeta$$ where $$alpha,beta in A$$? (This is asserted in p.9 of Morgan’s book on Seiberg-Witten equations but I can’t see why.)

## unit testing – How to make mock in python restricted to one input value?

I have a scenario where I need to mock the boto_utils.client function in the python unittest. The problem I’m facing is as follows consider the following piece of code :

`````` @mock.patch('utils.boto_utils.client')
def test_random(self, mock_client):
stubbed_client = boto3.client('quicksight')
stubber = Stubber(stubbed_client)
stubber.activate()
mock_client.return_value = stubbed_client
cl = boto_utils.client('s3')
## Now we see cl is a quicksight client even though we expect a S3 client
``````

How to make sure that the second call to boto_utils.client with ‘s3’ resource makes a normal external API call? Additionally I need to extend this functionality to other external API calls. How to design this functionality in a general way?

## floating point – Unit conversion – Better to divide by an integer or multiply by a double?

I currently have a `long` timestamp measured in units of 100ns elapsed since January 1st, 1900. I need to convert it to milliseconds.

I have the choice of either multiplying by `0.0001` or dividing by `10_000`. Although at first glance they sound the same, the former would actually cause an implicit cast to a `double` – the latter would of course result in another `long` with the remainder truncated.

Which would yield a better result? Obviously `double` is an imprecise type that introduces errors due to the use of a mantissa, floating radix, and exponent, but would that error be less or more than the error from performing the simple integer division? Or would the error be demonstrably negligible?

To give an example of one of my values, here is one of the timestamps: `38348440316924872` .

I’m specifically referring to C#, but this question should be general to computer science.