## How to assign a constant value in a recursion relationship

I use the code

``````fv = RecurrenceTable({a(i) ==
1/(i (i + 1)) (1/Sqrt(w) a(i - 1) + (2 i - 1 - ep(i)) a(i - 2)),
a(2) == 1/6 (1/(2*w) - e(i)), a(1) == 1/(2 Sqrt(w))}, a, {i, 3, 10});
``````

to evaluate the three step recursion ratio where

``````e(i_):=e(i)=2i+1
``````

after that i need to get the roots of fv then use

``````sol2 = N(Solve(fv((1)) == 0, w))
``````

My main problem is that e must be calculated using max i, that is, the code must calculate the value of e first, then I must use i to calculate the recursion ratio,
For example, for i = 3, e becomes 7, then one must calculate a (3) which includes e (3) and (2) and (1), where a (2) must be calculated using e (3) again note 2),
Maybe some kind of loop is needed.
I really don't know how to deal with this problem. Any ideas?

## names: How to assign users unique and meaningful identifiers for secondary users and avoid various difficulties?

In my application, we need to assign unique identifiers to users, but this is proving to be more complicated than I would have thought.

We load all users of a massive feed and make the entire assignment programmatically. Users cannot choose theirs.

We also want all usernames to be the same length, for certain viewing purposes.

In addition, users are students of a school district and are children, some of them quite young, so names must be short and reasonably memorable. So, just generating a 7-digit code is not very easy to use.

We know each child's name, but there are laws on the identification of children. We do not want, for example, for someone to post a screenshot of their username online and for someone to identify their real name.

My first idea for this was to choose, say, the first 3 characters of the first name, the first 2 characters of the last name, and then add a sequence number to avoid collisions. Then mine would be something like that `josfr123`.

However, this failed because some children have names with less than 3 letters. But the most condemning problem was that a small number of these combinations produced bad words, and that is so bad in children's software that we cannot allow it to happen even once.

It is surprisingly difficult to avoid this, because there are many combinations of letters that do not spell anything, but if you try to read them aloud, you will get something obscene. Catching all this, reliably, seems impossible, and even if I could, I would still need to find some way to generate a name for that user.

So what to do?

## junit: in Spring Boot Test, how do I assign a temporary folder to a configuration property?

I want to do a self-cleaning test

In my situation, I have one of the components that depends on a directory

``````public class FileRepositoryManagerImpl implements ....

@Value("\${acme.fileRepository.basePath}")
private File basePath;

}
``````

The value is defined in the `application.yml` file, and in DEV points to a directory under `build`.

This is not the worst idea, because `gradle clean` it will eventually clean up the mess created by the evidence.

But, really, what I would like to achieve here, is to make sure that each test is run in an isolated temporary directory that is cleaned after execution.

I know that JUnit has a tool for temporary directories. But once I have defined that directory in the scope of JUnit 4, how do I tell Spring to use that temporary directory?

I tried the inner class without success:

``````@RunWith(SpringRunner.class)
@SpringBootTest(classes = { SecurityBeanOverrideConfiguration.class, App.class })
@EnableConfigurationProperties
public abstract class AbstractFileRepositoryManagerIntTests {

private final static TemporaryFolder temporaryFolder = new TemporaryFolder();

@ClassRule
public static TemporaryFolder getTemporaryFolder()
{
return temporaryFolder;
}

@ConfigurationProperties(prefix = "acme")
static class Configuration
{

public FileRepository getFileRepository()
{
return new FileRepository();
}

static class FileRepository
{

public File basePath() throws Exception
{
return temporaryFolder.newFolder("fileRepositoryBaseDir");
}
}
}
}
``````

I was thinking about retouching with the `Environment`, but what should be the correct way to inject properties programmatically in a Spring Boot test?

## python: why does each array value change when I try to assign to an array?

I am trying to make a simple hill climb using a backpack problem.

I have an adjustment function that is intended to return a slightly modified value from the array of binary values ​​entered into it. Then I compare this new value with the existing one to see which one is better.

However, I have encountered this strange problem in which both the current solution and the new solution are being replaced by the adjusted values ​​immediately when I try to assign the new solution as an adjusted copy of the current solution. Each array in the loop is being replaced with the same values, and I have no idea why. I have tried the same with other matrices with the same effect. Why is this happening?

``````from random import randrange
import numpy as np

val = (8, 7, 6, 3, 3)
iteration = 0

def generateInitialState():
array = ()
k=0
while k != len(val):
array.append(randrange(0,2))
k+=1
return array

CurrentSolution = generateInitialState()

def Quality(Solution):
sum_items = 0
newValue = np.multiply(val,Solution)
for item in newValue:
sum_items += item
return sum_items

def Tweak(Solution):
print(str(Solution) + ' : ' + str(Quality(Solution)))
TempSolution = Solution
if Solution(iteration) is 0:
TempSolution(iteration) = 1
else:
TempSolution(iteration) = 0
print(str(TempSolution) + ' : ' + str(Quality(TempSolution)))
return TempSolution

while iteration < 5:
iteration+=1
NewSolution = Tweak(CurrentSolution)

if Quality(NewSolution) > Quality(CurrentSolution):
print('New good value detected'+ str(Quality(NewSolution)))
CurrentSolution = NewSolution
else:
print('Best solution found')
break
``````

## python – Assign unique raw words to a list of code words

issue

Write a function that replaces the words in `raw` with the words in `code_words` such that the first appearance of each word in `raw` it is assigned the first unassigned word in `code_words`. If he `code_words` The list is too short, it generates an error. `code_words` it may contain duplicates, in which case the function should ignore / omit them.

Examples:

``````encoder(("a"), ("1", "2", "3", "4")) → ("1")
encoder(("a", "b"), ("1", "2", "3", "4")) → ("1", "2")
encoder(("a", "b", "a"), ("1", "1", "2", "3", "4")) → ("1", "2", "1")
``````

Solution

``````def encoder(raw, code_words):
cw = iter(code_words)
code_by_raw = {} # map of raw item to code item
result = ()
seen = set() # for ignoring duplicate code_words
for r in raw:
if r not in code_by_raw:
for code in cw: # cw is iter(code_words), "persistent pointer"
if code not in seen:
break
else: # nobreak; ran out of code_words
raise ValueError("not enough code_words")
code_by_raw(r) = code
result.append(code_by_raw(r))
return result
``````

Questions

My main concern is the use of `cw` as a "persistent pointer". Specifically, people could get confused when they see `for code in cw`?

What should be typical best practices in this case?

Would it be better if I used the following?

``````try:
code = next(cw)
while code in seen:
code = next(cw)
except StopIteration:
raise ValueError("not enough code_words")
else:
``````

## How can I assign a formula when a floating value is not specified in the input function?

value1 = 0.324
value2 = 0.438

value3 = float (input ("enter the value"))

# if no value is specified, I want to execute the formula value3 = (lsl + usl) / 2

value3 = (lsl + usl) / 2
print (value3)

## You can ping, but not assign by IP address

I have the weirdest problem.

This is a VM installation of Server 2016 on a Hyper-V 2016 host. The other day I had a problem with an update, and it broke RRAS. I had to remove it and reinstall it. I also deleted and re-added the Hyper-V network card only for the VM.

VM 2016 is a domain controller and has one of two DNS servers, but I don't think it has anything to do with DNS.

The network interfaces are 192.168.100.24 (main) and the RRAS adapter is 192.168.100.134.

Since that happened, I can open a network location in "Start> Run" using 192.168.100.134 (or a NETBIOS name), but not 192.168.100.24, which is the internal main network card.

The firewall is not a problem since I tried it disabled, but I do it anyway from the real server. I CAN ping from any computer, but I can't 192.168.100.24 from any computer, again, not even to itself.

This is causing problems with several encrypted IP addresses that have been there forever.

Thanks for any ideas.

## How to assign an external DNS name to Docker containers

How do I assign DNS names directly to my Docker containers? This is a fairly broad question to avoid an X / Y problem: I will try to explain what I have done, but don't hesitate to suggest another way.

At this time, my idea is to create DNS names in my resolve and route them to an IP dedicated to each container. Many containers will have overlapping ports, so I've been trying to use the `macvlan` controller to assign them separate IP addresses. These are connected to the network interface only for containers. Some of my efforts are shown in this Reddit thread, but so far, I have not been successful in routing inside or outside the container when using `macvlan`.

Is there a recommended way to have a single Docker host, with multiple services on port 80/443 (or other common ports) routed to `one.example.com`, `two.example.com` etc?

## search engine: do not assign anything as default open with the application

Usually, I have a lot of audio files (.mp3) with my music and some other non-audio files (.asd) in the same directory. To play music quickly, I just select everything in the search engine and press cmd + or to open them in my default application (vlc). the .asd files will also open, but I never want to open them. they are used by the liveton application of ableton, but should not be opened with it.

Is it possible to assign "nothing" as the default application for .asd files? I'm thinking possibly using `defaults` or another command line trick, if necessary.

## keyboard – Assign the function key to Debug ("Step Into") in Mac Excel Visual Basic Editor

I tried many things to assign a 1-key shortcut to the "Step-by-step" debugging function in the VBA editor for Mac Excel (Mac VBE). I posted a question about this in Stack Overflow, but my experience is that Macintosh-related questions are often not resolved there, as in this case.

Below are screenshots that show an attempt to reallocate to the `F8` key (used in Windows for this). Although it seems to work, pressing the key does nothing when debugging (although the awkward default value `shift-cmd-i` still works). There are other & # 39; solutions & # 39; For this kind of problem they don't work for me. Namely, use the FN key in combination with `F8` or by checking the "Use `F1`,`F2`, etc. keys as standard function keys "in the configuration. I've also tried using a utility called FunctionFlip, but like others, it didn't work for me.

I am not tied to `F8`, and would be happy to reallocate others like `F5`, `F6` or `F7` which are already used inside Mac VBE. I say this because according to a comment from Emilio `F8` it's special on Mac But when I tried it with `F5`, for example, also failed.

I am using a MacBook pro without a touch panel (which I understand replaces the function keys), and I use both the laptop keyboard and the external keyboard (mac) purchased in 2019.