For unix-like systems, `tar`

uses `readdir()`

. What does 7-Zip use on Windows to determine tar file order?

# Tag: Determine

## How to determine Windows 10 version when it is not running?

**Where is my Windows OS Product information stored?**

In a functional copy of windows, there is a couple of registry values which contain information about the Windows system.

This can be accessed through the Registry Editor by searching under:

```
HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersion"
```

The registry ‘hive’, which is a subset of keys and values for the system, contains information such as `CurrentVersion`

, `ProductName`

and `EditionID`

– these can be used to evaluate your type of Windows.

To check your version of Windows, locate the CurrentVersion value.

If you are running Windows 10, there are two new values that can be used to evaluate the OS version, `CurrentMajorVersionNumber`

and `CurrentMinorVersionNumber`

.

**What if I want to check the version of an offline Windows?**

- Plug the offline storage of Windows into a host machine (E.g. An old copy of Windows on a HDD).
- Locate the Registry Hives for the offline Windows. They are usually stored under
`C:WindowsSystem32config`

. You should notice the hives as regular file types named in ALL CAPS (E.g. SOFTWARE, DRIVERS, VSMIDK) - Open the host system’s Registry Editor by running
`regedit.exe`

. - Select the
`HKEY_LOCAL_MACHINE`

folder. Click File/Load Hive. Load the`SOFTWARE`

hive from you offline Windows folder. - Give the loaded hive a recognizable name so that you can locate it later.
- View/Modify the loaded hive/value is required. Click
`File/Unload`

Hive once you are done.

Alternatively, you can use a third-party registry editor on you host machine to view/modify the hives.

## dnd 5e – What range is used to determine targets for the victim of a Spectator’s Confusion Ray

The Spectator has an Eye Ray option, Confusion Ray, that says:

[The target] uses its action to make a melee or ranged attack against a randomly determined creature within range.

Unlike the spell Confusion which limits the attack to melee attacks, the Spectator’s victim can be compelled to make a ranged attack.

When determining the random target are creatures that are outside of the weapon’s normal range but within the weapon’s long range included?

For a specific example a Rogue with a light crossbow is hit by the ray and fails their save. On their turn there are three allies within 80 ft, and the Spectator is 90 ft away. Is there a chance that the Rogue randomly targets the Spectator?

## turing machines – Determine if the following problem is decidable or not : Does the read–write head of a TM with the input w leave the word w?

It is not clear if your language $L$ contains the pars $langle T, wrangle$ or if $w$ is fixed and $L$ only contains Turing machines.

In any case the answer is the same.

Let $T$ be a (single tape) TM that does not leave the word $w$. Let $Q$ and $Gamma$, be the set of states and the tape alphabet of $T$.

The number of possible configurations of $T$ can be upper bounded as a function of $|w|$, $|Q|$, and $|Gamma|$ and this upper bound $B_T$ is computable.

To decide $L$ it suffices to simulate $T$ for $B_T$ steps.

If $T$ ever leaves the word $w$ you can reject. Otherwise either $T$ halted without leaving $w$, or $T$ is stuck in an infinite loop that does not leave $w$. In both cases you can accept.

## c# – Algorithm to determine if binary tree is a Binary Search Tree (BST)

Continuing with algorithms I’ve implemented a binary search tree validator. I don’t like the two boolean variables within `NodeFollowsBSTContract`

as it feels too complicated. I feel like it should be cleaned up but don’t see how, yet.

Also, before each recursive step down, to check child nodes, a new list is created. Is there’s a better way to implement this check that doesn’t repeatedly create new lists?

```
public class BinaryTreeNode
{
public BinaryTreeNode Left { get; set; }
public BinaryTreeNode Right { get; set; }
public int? Value { get; }
public BinaryTreeNode(int value)
{
Value = value;
}
}
public class ValidateBST
{
BinaryTreeNode _root;
public ValidateBST(BinaryTreeNode root)
{
_root = root;
}
public bool IsBinarySearchTree()
{
if ((_root.Left?.Value ?? 0) <= (_root.Value)
|| (_root.Right?.Value ?? 0) > (_root.Value))
{
var listIncludingRootValue = new List<int>()
{
_root.Value.Value
};
var leftLegValid = NodeFollowsBSTContract(_root.Left, new List<int>(), new List<int>(listIncludingRootValue));
var rightLegvalid = NodeFollowsBSTContract(_root.Right, new List<int>(listIncludingRootValue), new List<int>());
return leftLegValid && rightLegvalid;
}
else
{
return false;
}
}
private bool NodeFollowsBSTContract(BinaryTreeNode node, List<int> parentSmallerValues, List<int> parentLargerValues)
{
if (node == null)
{
return true;
}
bool isLessThanAllParentLargerValues = !parentLargerValues.Any()
|| parentLargerValues.Where(value => node.Value.Value <= value).Count() == parentLargerValues.Count;
bool isGreaterThanAllParentSmallerValues = !parentSmallerValues.Any()
|| parentSmallerValues.Where(value => node.Value.Value > value).Count() == parentSmallerValues.Count;
if (!isLessThanAllParentLargerValues || !isGreaterThanAllParentSmallerValues)
{
return false;
}
if (node.Left != null)
{
var updatedLargerValues = GenerateUpdatedLists(node.Value.Value, parentLargerValues);
var updatedSmallervalues = new List<int>(parentSmallerValues);
if (!NodeFollowsBSTContract(node.Left, updatedSmallervalues, updatedLargerValues))
{
return false;
}
}
if (node.Right != null)
{
var updatedvalues = GenerateUpdatedLists(node.Value.Value, parentSmallerValues);
if (!NodeFollowsBSTContract(node.Right, updatedvalues, parentLargerValues))
{
return false;
}
}
return true;
}
private List<int> GenerateUpdatedLists(int addValue, List<int> values)
{
var updatedValues = new List<int>(values)
{
addValue
};
return updatedValues;
}
}
```

## analytic number theory – How to determine the coefficient of the main term of $S_{k}(x)$?

Let $kgeqslant 2$, suppose that $p_1,p_2,dotsc,p_k$ are primes not exceeding $x$. Write

$$ S_{k}(x) = sum_{p_1 leqslant x} dotsb sum_{p_k leqslant x} frac{1}{p_1+dotsb +p_k}. $$

By AM-GM inequality, $p_{1}+dotsb + p_{k} geqslant k sqrt(k){p_{1}dotsm p_{k}}$, we have

$$ S_{k}(x) leqslant frac{1}{k} sum_{p_{1}leqslant x}dotsb sum_{p_{k} leqslant x}

frac{1}{sqrt(k){p_{1}dotsm p_{k}}} = frac{1}{k} left( sum_{p leqslant x} p^{-frac{1}{k}} right)^{k}. $$

By Prime Number Theorem and (Riemann–Stieltjes) integration by parts we see that

$$ sum_{p leqslant x} p^{-frac{1}{k}} = mathrm{Li}big( x^{1-frac{1}{k}} big) + O left( x^{1-frac{1}{k}}mathrm{e}^{-csqrt{log x}} right), $$

Here $mathrm{Li}(x)$ is the logarithmic integral, and $mathrm{Li}(x)sim x/log x$. Hence

$$ S_{k}(x) leqslant left( frac{k^{k-1}}{(k-1)^{k}} +o(1) right) frac{x^{k-1}}{log^{k} x}. $$

On the other hand, $p_{1}+dotsb +p_{k} leqslant kx$, we have

$$ S_{k}(x) geqslant frac{1}{kx} sum_{p_{1} leqslant x} dotsb sum_{p_{k} leqslant x} 1 = frac{1}{kx} left( sum_{p leqslant x} 1 right)^{k} = frac{pi^{k}(x)}{kx} = frac{(1+o(1))}{k} frac{x^{k-1}}{ log^{k} x}. $$

My question is how to determine the coefficient of the main term of $S_{k}(x)$? Thanks!

## coin selection – Is there a way to determine the optimal size of a batched transaction to save on fees?

I’ve been looking at other questions about fees and batching, but it seems no one asked if there is some way to determine the optimal size of a transaction to save on fees (assuming all inputs are spending from segwit native UTXOs for simplicity).

To expand a bit on what I have in mind: I need to pay various amounts to different people (let’s consider their number can be anywhere between 1 and infinite), and I guess that by making one “big” transaction paying them all at once instead of 1 transaction for each of them I can save on fees. But is it the more people I can add up in the same transaction the better, or would I save less at some point if my transaction keeps getting bigger? Is there some model to calculate the “optimal” size for my batched transaction, or maybe it doesn’t make sense?

Here’s my best guess for now: adding more people means really adding outputs, which makes the transaction grow linearily (assuming all ouputs are pretty standard and roughly of the same size), so assuming the fees are split between each receivers the more people you can onboard on the same transaction the cheaper it gets for everyone.

But at some point the sum of the amounts of the ouputs will grow bigger than the one input I added at first and I’ll need to add another input. If I have relatively big ouputs to spend this is probably ok, but if I only have small outputs and/or I’m adding relatively big amounts in the outputs at some point adding one more output could need to add one or maybe more inputs, making the growth in size transaction not worthing the save in fees, so I’d rather just stop it and send the batch at this point.

(EDIT) I came across this article that seems to confirm what I was thinking, and that all things being equal it will always save fees to add a new output.

## linear algebra – Determine if a given image is a face or not.

An image can be represented as a vector $vec{g} in mathbb{R^n}$, where $n=text{height} cdot text{width}$. If we have $m$ images in our databank, we can represent those images as a sequence of $m$ vectors $vec{g_0},…,vec{g_{m-1}}$, or as a matrix $G in mathbb{R^{n times m}}$.

A simple way to determine if an image ($g$) is a face, is to determine the smallest distance between $g$ and the face image: $text{argmin}_{i in (0,…,m-1)}||g-g_i||$.

This is the method used in my syllabus to explain, how to determine if a given image is face or not. I’m not sure I fully understand the very last statement in which we determine the smallest distance between the two vectors and how this helps us determine if an image is a face or not.

PS – This is from the section about Singular Value Decomposition.

## unity – (Unity3D) Determine If Ray Intersects Given Rectangle

I’m building a city generator for my game and I want to ensure buildings are never placed in such a way that they overlap roads. Currently I have the system build the roads, then place buildings alongside those roads.

I have the beginning and end points of the roads as Vector3s (only using X and Z, Y is never considered for road/building placement). For buildings, I use the size of their Box Colliders to check if they can fit in a given space (with rotation and scale applied appropriately). I’ve done a fair amount of research for answers on lines intersecting planes, though they always seem to be incredibly hard to follow or just don’t properly apply to my situation (such as determining if the line is coterminous or not). I simply need to know if the line at any point exists within the bounds of the building’s rectangle. I do not need to know where or at what angle.

I also understand that my problem is essentially a 2D math problem, as I’m ignoring Y, and some of the 2D solutions I’ve seen to this would be extremely costly to do in city generation.

Any help would be greatly appreciated.

## malware – What terminal commands can be used to determine whether a device has remote access enabled or is compromised?

I’d ask for examples of how each command could reveal compromise, and what default outputs of the commands should look like for comparison, but I’m new and not entirely sure at what point one goes from a focused to a too-broad question, so I’ll just ask for commands that can be used and then go and research them in depth elsewhere. Thanks!