Q: Why does a CP command on linux consume CPU? I just run a copy command for two large directories with a small number of huge files and I see my cp process is consuming around half a core in top:
51116 root      20   0  110m  876  688 D 43.9  0.0   3:23.83 cp -i -r 165 178 temp

Why does the cp process consume any cpu? I would imagine it spends most of it's time waiting on disk...
Thx,
Boaz

A: if you check the percentages, at the top of the screen, you'll see that it's mostly on %wa (waiting) and %id (idle), and very little (if any) in %us(userspace).
but at the process line, all the time it spends idly waiting for a given process is charged to that process. if another CPU-heavy process was running at the same time, it would take most of the CPU without affecting the copy task, because it would use the %id and %wa time.

A: It is managing the move.  This includes finding the files, creating new files, and copying them.  All this takes some CPU time.  Due to the way files are buffered, it may be possible to this very quickly with the file writes occurring asynchronously to the copy operation.  If the files aren't buffered, then the CPU utilization can be quite low while files are accessed.


Q: Bootstrap 5 ReOrdering will not work correctly past 4 columns I have setup a container that should alternate the image & text when the size is md or above. The intention is to have the images above text on small and alternate image, text, text, image etc.
As soon as I exceed 4 columns the ordering does not work.
Please help advise where I am going wrong?
Working code example 4 columns

Is your home insurance proof?

Most insurance companies now ask that you upgrade the security of your home to qualify for home insurance. Did you know you must have kite marked locks on the front and back doors to qualify for a valid claim?

Is your home insurance proof?

Most insurance companies now ask that you upgrade the security of your home to qualify for home insurance. Did you know you must have kite marked locks on the front and back doors to qualify for a valid claim?

Above 4 columns when the code/order does not work (breaks).....

Is your home insurance proof?

Most insurance companies now ask that you upgrade the security of your home to qualify for home insurance. Did you know you must have kite marked locks on the front and back doors to qualify for a valid claim?

Is your home insurance proof?

Most insurance companies now ask that you upgrade the security of your home to qualify for home insurance. Did you know you must have kite marked locks on the front and back doors to qualify for a valid claim?

Is your home insurance proof?

Most insurance companies now ask that you upgrade the security of your home to qualify for home insurance. Did you know you must have kite marked locks on the front and back doors to qualify for a valid claim?

A: Your problem
The .order-* classes are limited at 5. It's in the documentation:

Includes support for 1 through 5 across
all six grid tiers. If you need more .order-* classes, you can modify
the default number via Sass variable.

And .order-6 is equal to order: last.
Easy solution
Add your own CSS classes.

@media (min-width: 768px) {
  .order-md-6 {
   order: 6;
  }
  .order-md-7 {
   order: 7;
  }
  .order-md-8 {
   order: 8;
  }
  .order-md-9 {
   order: 9;
  }
  .order-md-10 {
   order: 10;
  }
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">

    img

    text

    img

    text

    img

    text

    img

    text

    img

    text

Alternative solution
Overwrite the Sass. It can be found in the _utilities.scss.  Here it is in Github. If you don't know how to do this, there are many tutorials to get you started, even here on SO.


Q: textAlign: TextAlign.center, flutter not working I'm a student who is new to learning flutter. I won't align my text and buttons to the center of the screen. I use this code to align the center. also, I used separate widgets to create them as shown in the code.

textAlign: TextAlign.center,

it doesn't work for me. also, the text box I created is not displaying at all. how to fix these errors on my app.

  import 'package:flutter/material.dart';
    import 'package:flutter/services.dart';

    class babyNameScreen extends StatefulWidget {
      const babyNameScreen({Key? key}) : super(key: key);

      @override
      _babyNameScreenState createState() => _babyNameScreenState();
    }

    class _babyNameScreenState extends State<babyNameScreen> {
      @override
      @override
      void initState() {
        // TODO: implement initState
        super.initState();
        SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
      }

      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            backgroundColor: Colors.white,
            leading: IconButton(
              icon: new Icon(
                Icons.arrow_back_rounded,
                color: Colors.black,
              ),
              onPressed: () {
                // Navigator.push(
                //   context,
                //   MaterialPageRoute(
                //       builder: (context) =>  WelcomeScreen()));
              },
            ),
          ),

          body: Padding(
            padding: const EdgeInsets.only(top: 40),

            child: ListView(
              children: [
                StepText(),
                SizedBox(
                  height: 25,
                ),
                NameText(),
                SizedBox(
                  height: 25,
                ),
                EnterNameText(),
                // SizedBox(
                //   height: 25,
                // ),

                TextBox(),           //text field
                ContinueButton(),  //elevated button
              ],
            ),
          ),
        );
      }
    }

    Widget StepText() => Container(
          child: Row(children: [
            Text(
              'STEP 2/5',
              textAlign: TextAlign.center,
              style: TextStyle(
                fontSize: 12,
                color: Colors.deepPurple,
                fontWeight: FontWeight.w700,
              ),
            ),
          ]),
        );

    Widget NameText() => Container(
          child: Row(children: [
            Text(
              'What is her name?',
              textAlign: TextAlign.center,
              style: TextStyle(
                fontSize: 25,
                color: Colors.black,
                fontWeight: FontWeight.w700,

              ),
            ),
          ]),
        );

    Widget EnterNameText() => Container(
      child: Row(children: [
        Text(
          'Enter name of your new profile.',
          textAlign: TextAlign.center,
          style: TextStyle(
            fontSize: 15,
            color: Colors.grey,
            fontWeight: FontWeight.w500,

          ),
        ),
      ]),
    );

    //text field

    Widget TextBox()=> Container(
      child: Row(
        children: [
          TextField(
            decoration: InputDecoration(
              border: OutlineInputBorder(),
              hintText: 'Enter a search term',
            ),
          ),
        ],
      ),

    );

//elevated button
    Widget ContinueButton()=> Container (
      child: Row(
        children: [
          ElevatedButton(
            onPressed: () {
              //playSound(soundNumber);
            },
             child: Text('Continue'),
            style: ButtonStyle(
              backgroundColor: MaterialStateProperty.all<Color>(Colors.deepPurple),
            ),
          ),
        ],
      ),
    );

A: Use,  mainAxisAlignment: MainAxisAlignment.center in Row.
Like this,
    Widget StepText() => Container(
        child: Row(
             mainAxisAlignment: MainAxisAlignment.center, // Add this line...
              children: [
                Text(
                  'STEP 2/5',
                  textAlign: TextAlign.center,
                  style: TextStyle(
                    fontSize: 12,
                    color: Colors.deepPurple,
                    fontWeight: FontWeight.w700,
                  ),
                ),
              ]),
            );

For more info : https://docs.flutter.dev/development/ui/layout
For remove shadow of AppBar use elevation,
appBar: AppBar(
       backgroundColor: Colors.transparent,
       elevation: 0.0,)

For more info : https://api.flutter.dev/flutter/material/Material/elevation.html

A: You can use this way to achieve the layout you want
import 'package:flutter/material.dart';
    import 'package:flutter/services.dart';

    class babyNameScreen extends StatefulWidget {
      const babyNameScreen({Key? key}) : super(key: key);

      @override
      _babyNameScreenState createState() => _babyNameScreenState();
    }

    class _babyNameScreenState extends State<babyNameScreen> {
      @override
      @override
      void initState() {
        // TODO: implement initState
        super.initState();
        SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
      }

      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            backgroundColor: Colors.white,
            leading: IconButton(
              icon: new Icon(
                Icons.arrow_back_rounded,
                color: Colors.black,
              ),
              onPressed: () {
                // Navigator.push(
                //   context,
                //   MaterialPageRoute(
                //       builder: (context) =>  WelcomeScreen()));
              },
            ),
          ),

          body: Padding(
            padding: const EdgeInsets.only(top: 40),

            child: Column(
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                StepText(),
                SizedBox(
                  height: 25,
                ),
                NameText(),
                SizedBox(
                  height: 25,
                ),
                EnterNameText(),
                // SizedBox(
                //   height: 25,
                // ),

                TextBox(),           //text field
                ContinueButton(),  //elevated button
              ],
            ),
          ),
        );
      }
    }

    Widget StepText() => Container(
          child: Text(
            'STEP 2/5',
            textAlign: TextAlign.center,
            style: TextStyle(
              fontSize: 12,
              color: Colors.deepPurple,
              fontWeight: FontWeight.w700,
            ),
          ),
        );

    Widget NameText() => Container(
          child: Text(
            'What is her name?',
            textAlign: TextAlign.center,
            style: TextStyle(
              fontSize: 25,
              color: Colors.black,
              fontWeight: FontWeight.w700,

            ),
          ),
        );

    Widget EnterNameText() => Container(
      child: Text(
        'Enter name of your new profile.',
        textAlign: TextAlign.center,
        style: TextStyle(
          fontSize: 15,
          color: Colors.grey,
          fontWeight: FontWeight.w500,

        ),
      ),
    );

    //text field

    Widget TextBox()=> Container(
      child: TextField(
        decoration: InputDecoration(
          border: OutlineInputBorder(),
          hintText: 'Enter a search term',
        ),
      ),

    );

//elevated button
    Widget ContinueButton()=> Container (
      child: ElevatedButton(
        onPressed: () {
          //playSound(soundNumber);
        },
         child: Text('Continue'),
        style: ButtonStyle(
          backgroundColor: MaterialStateProperty.all<Color>(Colors.deepPurple),
        ),
      ),
    );


Q: How to split a sequence in k homogeneous parts? I'd like to split a sequence into k parts, and optimize the homogeneity of these sub-parts.
Example : 0 0 0 0 0 1 1 2 3 3 3 2 2 3 2 1 0 0 0
Result  : 0 0 0 0 0 | 1 1 2 | 3 3 3 2 2 3 2 | 1 0 0 0 when you ask for 4 parts (k = 4)

Here, the algorithm did not try to split in fixed-length parts, but instead tried to make sure elements in the same parts are as homogeneous as possible.
What algorithm should I use ? Is there an implementation of it in R ?

A: Maybe you can use Expectation-maximization algorithm. Your points would be (value, position). In your example, this would be something like:

With the E-M algorithm, the result would be something like (by hand):

This is the desired output, so you can consider using this, and if it really works in all your scenarios. An annotation, you must assign previously the number of clusters you want, but I think it's not a problem for you, as you have set out your question.
Let me know if this worked ;)
Edit:
See this picture, is what you talked about. With k-means you should control the delta value, this is, how the position increment, to have its value to the same scale that value. But with E-M this doesn't matter.

Edit 2:
Ok I was not correct, you need to control the delta value. It is not the same if you increment position by 1 or by 3: (two clusters)

Thus, as you said, this algorithm could decide to cluster points that are not neighbours if their position is far but their value is close. You need to guarantee this not to happen, with a high increment of delta. I think that with a increment of 2 * (max - min) values of your sequence this wouldn't happen.
Now, your points would have the form (value, delta * position).


Q: Ruby to return my entries alphabetically works for all but my first entry This is what it looks like.
word = 'word'
words = []

puts 'enter some words, man. ill tell em to you in alphabetical order.'
puts 'when your\'re done, just press enter without typing anything before.'
puts ''
word = gets.chomp
        while word != ''
        word = gets.chomp
        list = list.push word
    end
    puts ''
    puts 'Your alphabetically ordered words are:'
    puts list.sort
    puts ''

Again, this works, except for the first word I submit to it. Any hints or help is much appreciated.

A: Now it will work
word = gets.chomp
while word != ''
  list = list.push word
  word = gets.chomp
end

In your case, before pushing the first word to list( when you just entered into the while loop), you are calling again Kernel#gets and assigned it to word. That's why you lost the first word, and from that second one you started to pushing the words into the array.

A: Compare with functional approach:
sorted_words =
  (1..Float::INFINITY)
    .lazy
    .map { gets.chomp }
    .take_while { |word| !word.empty? }
    .sort

A: You can make this cleaner if you realize that assignment returns the assigned value.
list = []
until (word = gets.chomp).empty? do
    list << word
end

A: Here is another way your program can be rewritten, perhaps in a little more intuitive and expressive way:
word = 'word'
list = []

puts 'enter some words, man. ill tell em to you in alphabetical order.'
puts 'when your\'re done, just press enter without typing anything before.'
puts ''
keep_going = true
while keep_going
  word = gets.chomp
  keep_going = false if word.empty?
  list = list.push word if keep_going
end

puts ''
puts 'Your alphabetically ordered words are:'
puts list.sort
puts ''


Q: Calculate posterior distribution of unknown mis-classification with PRTools in MATLAB I'm using the PRTools MATLAB library to train some classifiers, generating test data and testing the classifiers.
I have the following details:

*

*N: Total # of test examples

*k: # of
mis-classification for each
classifier and class

I want to  do:
Calculate and plot Bayesian posterior distributions of the unknown probabilities of mis-classification (denoted q), that is, as probability density functions over q itself (so, P(q) will be plotted over q, from 0 to 1).
I have that (math formulae, not matlab code!):
Posterior = Likelihood * Prior  / Normalization constant =
P(q|k,N)  = P(k|q,N)   * P(q|N) / P(k|N)

The prior is set to 1, so I only need to calculate the likelihood and normalization constant.
I know that the likelihood can be expressed as (where B(N,k) is the binomial coefficient):
P(k|q,N) = B(N,k) * q^k * (1-q)^(N-k)

... so the Normalization constant is simply an integral of the posterior above, from 0 to 1:
P(k|N) = B(N,k) * integralFromZeroToOne( q^k * (1-q)^(N-k) )

(The Binomial coefficient ( B(N,k) ) can be omitted though as it appears in both the likelihood and normalization constant)
Now, I've heard that the integral for the normalization constant should be able to be calculated as a series ... something like:
k!(N-k)! / (N+1)!

Is that correct? (I have some lecture notes with this series, but can't figure out if it is for the normalization constant integral, or for the overall distribution of mis-classification (q))
Also, hints are welcome as how to practically calculate this? (factorials are easily creating truncation errors right?) ... AND, how to practically calculate the final plot (the posterior distribution over q, from 0 to 1).

A: I really haven't done much with Bayesian posterior distributions ( and not for a while), but I'll try to help with what you've given. First,
k!(N-k)! / (N+1)! = 1 / (B(N,k) * (N + 1))

and you can calculate the binomial coefficients in Matlab with nchoosek() though it does say in the docs that there can be accuracy problems for large coefficients. How big are N and k?
Second, according to Mathematica,
integralFromZeroToOne( q^k * (1-q)^(N-k) ) = pi * csc((k-N)*pi) * Gamma(1+k)/(Gamma(k-N) * Gamma(2+N))

where csc() is the cosecant function and Gamma() is the gamma function. However, Gamma(x) = (x-1)! which we'll use in a moment. The problem is that we have a function Gamma(k-N) on the bottom and k-N will be negative. However, the reflection formula will help us with that so that we end up with:
= (N-k)! * k! / (N+1)!

Apparently, your notes were correct.

A: Let q be the probability of mis-classification. Then the probability that you would observe k mis-classifications in N runs is given by:

P(k|N,q) = B(N,k) q^k (1-q)^(N-k)

You need to then assume a suitable prior for q which is bounded between 0 and 1. A conjugate prior for the above is the beta distribution. If q ~ Beta(a,b) then the posterior is also a Beta distribution. For your info the posterior is:

f(q|-) ~ Beta(a+k,b+N-k)

Hope that helps.


Q: NoClassDefFoundError with gradle, giraph, and hadoop So, I've been looking around a lot and I haven't found a good answer to my question, and this is driving me crazy, so I figured I'd ask here and hopefully I can get help. I'm trying to do automated testing in a Giraph project using gradle. I'm a total beginner with gradle. Just to get started, I copied the test code for the SimpleShortestPathComputation class into my project, to make sure I could get the tests up and running. When I do gradle test, however, I get the following error:
$ gradle test --info
<skipping some output here...>

Successfully started process 'Gradle Test Executor 1'
Gradle Test Executor 1 started executing tests.
WCCTest > testToyData FAILED
    java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
        at org.apache.hadoop.conf.Configuration.<clinit>(Configuration.java:142)
        at WCCTest.testToyData(WCCTest.java:180)

    Caused by:
    java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
        ... 2 more

Gradle Test Executor 1 finished executing tests.
WCCTest > testOnShorterPathFound FAILED
    java.lang.NoClassDefFoundError: org.apache.hadoop.conf.Configuration
        at sun.reflect.GeneratedSerializationConstructorAccessor33.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
        at     org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator.newInstance(SunReflectionFactoryInstantiator.java:40)
        at org.objenesis.ObjenesisBase.newInstance(ObjenesisBase.java:59)
        at org.mockito.internal.creation.jmock.ClassImposterizer.createProxy(ClassImposterizer.java:128)
        at org.mockito.internal.creation.jmock.ClassImposterizer.imposterise(ClassImposterizer.java:63)
        at org.mockito.internal.creation.jmock.ClassImposterizer.imposterise(ClassImposterizer.java:56)
        at org.mockito.internal.creation.CglibMockMaker.createMock(CglibMockMaker.java:23)
        at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:26)
        at org.mockito.internal.MockitoCore.mock(MockitoCore.java:51)
        at org.mockito.Mockito.mock(Mockito.java:1243)
        at org.mockito.Mockito.mock(Mockito.java:1120)
        at org.apache.giraph.utils.MockUtils$MockedEnvironment.<init>(MockUtils.java:68)
        at org.apache.giraph.utils.MockUtils.prepareVertexAndComputation(MockUtils.java:132)
        at WCCTest.testOnShorterPathFound(WCCTest.java:64)

WCCTest > testToyDataJson FAILED
    java.lang.NoClassDefFoundError: Could not initialize class org.apache.giraph.conf.GiraphConfiguration
        at WCCTest.testToyDataJson(WCCTest.java:127)

WCCTest > testOnNoShorterPathFound FAILED
    java.lang.NoClassDefFoundError: org.apache.hadoop.conf.Configuration
        at sun.reflect.GeneratedSerializationConstructorAccessor33.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
        at org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator.newInstance(SunReflectionFactoryInstantiator.java:40)
        at org.objenesis.ObjenesisBase.newInstance(ObjenesisBase.java:59)
        at org.mockito.internal.creation.jmock.ClassImposterizer.createProxy(ClassImposterizer.java:128)
        at org.mockito.internal.creation.jmock.ClassImposterizer.imposterise(ClassImposterizer.java:63)
        at org.mockito.internal.creation.jmock.ClassImposterizer.imposterise(ClassImposterizer.java:56)
        at org.mockito.internal.creation.CglibMockMaker.createMock(CglibMockMaker.java:23)
        at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:26)
        at org.mockito.internal.MockitoCore.mock(MockitoCore.java:51)
        at org.mockito.Mockito.mock(Mockito.java:1243)
        at org.mockito.Mockito.mock(Mockito.java:1120)
        at org.apache.giraph.utils.MockUtils$MockedEnvironment.<init>(MockUtils.java:68)
        at org.apache.giraph.utils.MockUtils.prepareVertexAndComputation(MockUtils.java:132)
        at WCCTest.testOnNoShorterPathFound(WCCTest.java:95)

4 tests completed, 4 failed
<more output...>
:test FAILED
:test (Thread[main,5,main]) completed. Took 1.663 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':test'.
> There were failing tests. See the report at: file:///...build/reports/tests/index.html

BUILD FAILED

I'm using the totally standard project directory structure, and this is my build.gradle file:
apply plugin: 'java'

repositories {
    mavenCentral()
}

dependencies {
    compile files('$GIRAPH_HOME/giraph-core/target/giraph-1.1.0-SNAPSHOT-for-hadoop-0.20.203.0-jar-with-dependencies.jar')
    compile files('$GIRAPH_HOME/giraph-examples/target/giraph-examples-1.1.0-SNAPSHOT-for-hadoop-0.20.203.0-jar-with-dependencies.jar')
    compile files('$HADOOP_HOME/hadoop-core-0.20.203.0.jar')

    testCompile group: 'junit', name: 'junit', version: '4.+'
    testCompile group: 'org.mockito', name: 'mockito-all', version: '1.9.5'
}

It compiles with no problem, and the jar files I'm including as dependences include the classes for which it says NoClassDefFoundError (according to jar tf). Any ideas what I'm doing wrong? Thanks in advance.

A: try add following into your build.gradle
    println("HADOOP_HOME=$HADOOP_HOME")
    compile files("$HADOOP_HOME/hadoop-core-0.20.203.0.jar")
    println("System.env.HADOOP_HOME=$System.env.HADOOP_HOME")
    compile files("$System.env.HADOOP_HOME/hadoop-core-0.20.203.0.jar")

A: It turned out I just had to add some of the jars from the $HADOOP_HOME/lib directory to the dependencies and it worked. Once I added the dependency for org/apache/commons/logging/LogFactory it cleared up the error for the hadoop Configuration class, and then I just had to add the other required jars later.


Q: Entity Framework n to n relationship add object to another object I have a Model with Clients:
public class Client

{
    [Key]
    public int id { get; set; }
    [Required]
    public string? Hostname { get; set; }
    public ICollection<Software>? Softwares { get; set; }

}

And a Model with Software:
public class Software
    {
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int id { get; set; }
        public string Name { get; set; }
        public ICollection<Client>? Clients { get; set; }
    }

This is supposed to be an n to n connection. How can I add software to my clients?
What I've tried:
public async void add(Software software)
        {
            using (var repo = new ClientRepository(contextFactory.CreateDbContext()))
            {
                client.Softwares.Add(software);
                await repo.Save(client);
            }

Repository:
public async Task Save(Client client)
        {
            _context.Clients.Update(client);
            _context.SaveChanges();
        }
        }

This works for the first software I add, but gives me the following error if I try to add a second one:

SqlException: Violation of PRIMARY KEY constraint 'PK_ClientSoftware'.
Cannot insert duplicate key in object 'dbo.ClientSoftware'. The
duplicate key value is (7003, 5002).

A: It seems you are adding more than one relation of the same. Before adding software to a client, make sure a relation does not exist yet, then you can go ahead and add software to client.
Also, you can improve your entities. Use better naming for the primary keys and add [Key] attribute to Software class as well.
Client:
public class Client
{
    public Client()
    {
        Softwares = new HashSet<Software>();
    }

    [Key]
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public int ClientId { get; set; }
    [Required]
    public string Hostname { get; set; }
    public ICollection<Software> Softwares { get; set; }
}

Software:
public class Software
{
    public Software()
    {
        Clients = new HashSet<Client>();
    }

    [Key]
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public int SoftwareId { get; set; }
    public string Name { get; set; }
    public ICollection<Client> Clients { get; set; }
}

Check if relation already exists:
// Get the client including its related softwares
var client = dbContext.Clients.Include(x => x.Softwares)
    .FirstOrDefault(x => x.Hostname == "Ibrahim");

if (client != null)
{
    // Check with unique property such as name of software
    // If it does not exist in this current client, then add software
    if (!client.Softwares.Any(x => x.Name == software.Name))
        client.Softwares.Add(software);

    dbContext.SaveChanges();
}

Note: If you update your entities, remember to create new migration and database.

A:
Q: Do you make a new one with new() every time?

A: no, its a software that already exists

Then that is the error.
The first SaveChanges() will start tracking it as Existing. You can check: The Id will be != 0.
When you then later add it to the same Client you'll get the duplicate error.
So somewher in your code:
  await add(software);       // existing
  software = new Software(); // add this

Related, change:
public async void add(Software software)

to
public async Task Add(Software software)

Always avoid async void.


Q: how does a drill work? Naively when I want to make a hole, I put a bit in the drill and press downwards and a hole is produced.
Is it more complicated than that?  First of all every time I drill a hole in wood or any other material, shavings are produced, as well as a cylindrical empty space.  By conservation of matter, the shavings should have the same total volume as the volume of the hole I just made.
And there are other issues... how does a screw (or screw-shaped bit) remove the matter?  how much heat am I producing due to friction? what is rotation speed etc.
The main question that motivated me to ask on here, is why a drill requires vertical force, but a router uses only horizontal force.  From theoretical point of view all both objects do is rotate a screw and remove matter from a piece of wood or metal.  So I need a better approximation of how these two machines work.

A: It sounds like you want to know what is going on at the tip of the drill bit. Well, I would say that scraping or gouging or digging, but in a circular motion, would best describe it in layman's terms. It's similar to what happens when you scoop out ice cream with with a twisting motion. It usually requires at least a little force in the direction of the hole, but sometimes the bit sort of pulls itself in, depending on the material.
Note this: A drill requires not only vertical force, but torque, or twisting force as well. Often you don't notice it because it doesn't require much, unless it gets stuck, then you'll definitely notice it.
Screws are different. A normal screw does not remove material, rather it deforms material by pushing it out of the way. It squeezes and wedges its way in. That's why sometimes you want to drill a smaller hole first so that the screw doesn't have to squeeze in too tight and crack the material.
Edit: Ha! I just gave myself an idea for a better ice cream scooper for very cold hard ice cream, which has always frustrated me.


Q: List private property names of the class I need to use some subset of class properties names as values in a map to use inside of the class. In following example I've replaced map by array. The problem is that if property is marked private it's not listed in keyof list. How can I specify type of keys if I need to include private names?
var keys: Array<keyof A> = ["x", "y"]; // Error

class A {
  private x = 7;
  public y = 8;

  private keys: Array<keyof A> = ["x", "y"]; // Error
}

There is the same error both for variable outside of the class and for private property inside of it:

Type '"x"' is not assignable to type '"y"'.

A: As you noticed, private and protected properties of a class C do not appear as part of keyof C.  This is usually desirable behavior, since most attempts to index into a class with a private/protected property will cause a compile error.  There is a suggestion at microsoft/TypeScript#22677 to allow mapping a type to a version where the private/protected properties are public, which would give you a way to do this... but this feature has not been implemented as of TypeScript 4.9.
So this doesn't work:
namespace Privates {
  export class A {
    private x: string = "a";
    public y: number = 1;
    private keys: Array<keyof A> = ["x", "y"]; // Error
  }
  var keys: Array<keyof A> = ["x", "y"]; // Error
}
const privateA = new Privates.A();
privateA.y; // number
privateA.x; // error: it's private
privateA.keys; // error: it's private

But maybe you don't actually need the properties to be private, so much as not visible to outside users of the class.  You can use a module/namespace to export only the facets of your class that you want, like this:
namespace NotExported {
  class _A {
    x: string = "a";
    y: number = 1;
    keys: Array<keyof _A> = ["x", "y"]; // okay
  }
  export interface A extends Omit<_A, "x" | "keys"> {}
  export const A: new () => A = _A;
  var keys: Array<keyof _A> = ["x", "y"]; // okay
}

const notExportedA = new NotExported.A();
notExportedA.y; // number
notExportedA.x; // error: property does not exist
notExportedA.keys; // error: property does not exist

In NotExported, the class constructor _A and the corresponding type _A are not directly exported.  Internally, keyof _A contains both the "x" and "y" keys.  What we do export is a constructor A and a corresponding type A that omits the x property (and keys property) from _A.  So you get the internal behavior you desire, while the external behavior of NotExported.A is similar to that of Privates.A.  Instead of x and keys being inaccessible due to private violation, they are inaccessible because they are not part of the exported A type.
I actually prefer the latter method of not exporting implementation details rather than exposing the existence of private properties, since private properties actually have a lot of impact on how the corresponding classes can be used.  That is, private is about access control, not about encapsulation.
Link to code


Q: Busca com MySQL PDO em Array Tenho esse código:
$whereBusca = "itaim-bibi";
$whereBusca  = explode(',', $whereBusca);
$sql = $pdo->prepare('SELECT id, nome, caminho FROM regiao WHERE caminho IN (:whereBusca)');
$sql->execute(array("whereBusca" => "'".implode("','", $whereBusca)."'"));
$resultadoSql = $sql->fetchAll();
foreach ($resultadoSql as $valorSql) {
    echo utf8_encode($valorSql['id']);
}

Ele funciona bem, mas se o conteudo do $whereBusca for mais que uma região, ele não da o search, não sei o que estou errando, olha o exemplo de quando não funciona:
$whereBusca = "itaim-bibi,jardins";
$whereBusca  = explode(',', $whereBusca);
$sql = $pdo->prepare('SELECT id, nome, caminho FROM regiao WHERE caminho IN (:whereBusca)');
$sql->execute(array("whereBusca" => "'".implode("','", $whereBusca)."'"));
$resultadoSql = $sql->fetchAll();
foreach ($resultadoSql as $valorSql) {
    echo utf8_encode($valorSql['id']);
}

A: Não é possível definir 1 placeholder para N valores, a proporção deve ser a mesma ou seja, 1 placeholder para 1 valor.
Para fazer um IN com um número de parâmetros dinâmicos conte o número de elemento do array, gera um string com o número certo de  placeholders depois joguei isso na consulta e passe um array para execute()
$valores = ['itaim-bibi','jardins', 'Doge island'];
$n = count($valores);

$placeholders = '?'. str_repeat(',?', $n - 1); //no exemplo a string gerada é ?,?,?

$consulta = "SELECT id, nome, caminho FROM regiao WHERE caminho IN ($placeholders)";
$sql = $pdo->prepare($consulta);
$sql->execute($valores);

A SQL gerada é algo como:
SELECT id, nome, caminho FROM regiao WHERE caminho IN (?,?,?)

3 elementos no array, 3 interrogações ;)

A: E se fizer assim:
'SELECT id, nome, caminho FROM regiao WHERE caminho IN ("itaim-bibi","jardins")'

Ai não precisaria do explode e do implode


Q: Get div content and then modify it The scenario is, I want to get a div content and then  modify it in order to insert it in another div.
Code below :
$("#loupe").live("click",function(){
    $('#divBody').empty();
    $('#divTitle').empty();
    var title = $(this).closest('div').find('.stepTitle').text();
    var divContent = $(this).closest('div').html();
    // code to modify the content to be inserted in the modal
    $('#divBody').append(divContent);
    $('#divTitle').append(title);
    $('#div').modal({ dynamic: true });
});

more in detail , the first div contains a title that i want to remove before inserting content into the new div , so the new div must contains content without title

Planing des congés pour le service de <%=service.getNomService() %> au <%=month%> / <%=year%>

//************the div into which content will be inserted

        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

            //here the title

        here the other content

        <input type="button" class="btn" class="close" data-dismiss="modal" value="fermer">

A: jQuery allows you to work with fragments of a page (as well as XML).
Once you've used the .html method to assign the HTML of an element to a variable, you can operate on the HTML like so:
var html, withoutTitle;
html = $('#someDiv').html();
withoutTitle = $(html).remove('#title').html();
$('#someOtherDiv').html(withoutTitle);

I haven't tested this code, so you may need to tweak it a bit to suit your purposes.


Q: Can a QEMU Snapshot taken in an Ubuntu machine be used in a Mac machine? I am trying to understand if QEMU snapshots are cross-platform. I have two queries in particular around this, which I can't fully understand after reading through available info.

*

*Are snapshot cross-platform. Can we copy a snapshot to another host OS. Say from Ubuntu to Mac.

*Can we move a snapshot taken in an arm machine such as Mac M1 be copied and used in a Intel based linux machine?

Closest reference I saw so far is related to docker here.


Q: Limit as n approaches infinity of (log(n!) / nlog(n)) I'm stumped with a limit. I know the answer (because I looked on wolframalpha) but I really want to know how to reach the correct answer. If you have any hints or tips on getting there I'd be most appreciative!

A: Hint:

$$ \ln(n!) = \sum_{k=1}^{n} \ln k \sim \int_{1}^{n} \ln x dx =n\ln n-n+1 .$$


Q: Sequentially arranged and add placeholders in text file I have a text file which contains data. There are 3 columns, each column starts at a specific location and ends a specific location in the file. The first column which is (300, 301, 302, 304...) is always number based. the second column is a string, and the last column is currency.
The current .txt file is missing numbers which is (303, 305).
I was able to find the missing numbers and add it to an array then write it to the file.
My goal is to write all the columns data sequentially to the text file even the missing ones. As for column 2 and 3, I want 0 to be the placeholder for the missing data and aligned with its own column.
I'm close but need help
   //read file
   string[] lines = File.ReadAllLines(FilePath);
   var Numbers = new List<int>();
   int i = 0;
   foreach (var line in lines)
   {
       //get value of first column
       var FirstColumn = line.Substring(0, 3);
       //add it to array
       Numbers.Add(Convert.ToInt32(FirstColumn));
       ++i;
   }
   //find missing numbers add to array
   var result = Enumerable.Range(Numbers.Min(), Numbers.Count);

   //write to file
   using (StreamWriter file = new StreamWriter(OutPutFile, true))
   {
       foreach (var item in result.ToArray())
       {
           file.WriteLine(item);
       }
   }

   Console.ReadKey();

Current .txt file
300     Family Guy      1,123
301     Dexters Lab     456
302     Rugrats         1,789.52
304     Scooby-Doo      321
306     Recess          2,654
307     Popeye          1,987.02

GOAL: Desired Output .txt file
300     Family Guy      1,123
301     Dexters Lab     456
302     Rugrats         1,789.52
303     0               0
304     Scooby-Doo      321
305     0               0
306     Recess          2,654
307     Popeye          1,987.02

A: You are reading the first column, but not the rest.  What I do is create a dictionary, using the first number as the index, and stuffing the other two fields into a System.ValueTuple (you need to include the ValueTyple Nuget package to get this to work).
First I set some stuff up:
 const int column1Start = 0;
 const int column1Length = 3;
 const int column2Start = 8;
 const int column2Length = 15;
 const int column3Start = 24;

 int indexMin = int.MaxValue;     //calculated during the first
 int indexMax = int.MinValue;     //pass through the file

Then I create my dictionary.  That (string, decimal) syntax describes a 2-tuple that contains a string and a decimal number (kind of like the ordered-pairs you were taught about in high school).
 Dictionary<int, (string, decimal)> data = new Dictionary<int, (string, decimal)>();

Then I make a pass through the file's lines, reading through the data, and stuffing the results in my dictionary (and calculating the max and min values for that first column):
 var lines = File.ReadAllLines(fileName);
 foreach (var line in lines) {
     //no error checking
     var indexString = line.Substring(column1Start, column1Length);
     var cartoon = line.Substring(column2Start, column2Length).TrimEnd();
     var numberString = line.Substring(column3Start);

     if (int.TryParse(indexString, out var index)) {
         //I have to parse the first number - otherwise there's nothing to index on
         if (!decimal.TryParse(numberString, out var number)){
             number = 0.0M;
         }
         data.Add(index, (cartoon, number));

         if (index < indexMin) {
             indexMin = index;
         }
         if (index > indexMax) {
             indexMax = index;
         }
     }
 }

Finally, with all my data in hand, I iterate from the min value to the max value, fetching the other two columns out of my dictionary:
 for (int i = indexMin; i <= indexMax; ++i) {
     if (!data.TryGetValue(i, out var val)){
         val = ("0", 0.0M);
     }
     Console.WriteLine($"{i,5}  {val.Item1,-column2Length - 2}  {val.Item2, 10:N}");
 }

My formatting isn't quite the same as yours (I cleaned it up a bit).  You can do what you want.  My results look like:
  300  Family Guy           1,123.00
  301  Dexters Lab            456.00
  302  Rugrats              1,789.52
  303  0                        0.00
  304  Scooby-Doo             321.00
  305  0                        0.00
  306  Recess               2,654.00
  307  Popeye               1,987.02


Q: Custom Fn shortcut Is it possible to make a shortcut with the Fn key? As a example (Fn + w) for open a program.
Have somebody a idea how to add this?

A: Fn keys alter the keyboard signal before it reaches the computer. You can try it yourself using xev: there's no output when you press the Fn key alone. So no, you can't add new Fn + key shortcuts, but you can bind actions to the existing keyboard functions.


Q: Automatically abbreviate the length string in matplotlib Is there a way to automatically reduce the length of string in matplotlib if it conflicts with neighboring texts such as in:

What I'm looking for is if matplotlib detects a conflict with another text, it automatically reduce the texts in order for all the texts to be readable.
Note that one could of course rotate the labels or make the fontsize smaller to prevent overlap. But here I'm asking how to cut the text in case of overlap.


Q: C# Visual Studio 2013 suppress 'Class is never instantiated' I have a web api project which accepts HttpPost communications.
The controller's methods always accepting a single validated object.
For example:
public sealed class NumbersRequest
{
    [NumberOne]
    public string Number1 { get; set; }

    [NumberTwo]
    public string Number2 { get; set; }
}

Since I never declare NumbersRequest req = new NumbersRequest() and they only serve as a request object, Im getting the

class is never instantiated

How can I suppress the warning? (its more like a green underline..)
Maybe something with annontations?
Thanks.

A: This looks like a ReSharper warning and as such you can ask ReSharper to be silent about these things.
You can either configure ReSharper to stop complaining about this overall, you do this simply by hitting Alt+Enter on the squiggly in question and use the bottom menu item that usually allows you to configure the inspection severity.
You can opt to save this in your global settings, which means it will affect every project you open from now on, or you can save it to a team-shared settings file which you can then check into source control alongside your project, to make it only count for this one solution.
Now, if you want to keep the warning overall but ask it to stop complaining about one or more particular types, methods, properties or the likes, you can use the attributes that ReSharper provides.
You have several ways of bringing these attributes into your project:

*

*Add a reference to the Nuget package "JetBrains ReSharper annotations"

*Use the options dialog for ReSharper and find the page where it allows you to grab a copy of the source for those attributes onto the clipboard, then simply paste this into a file in your project.

*Define just the one or two attributes you want, even in your own namespace (which you then have to tell ReSharper about)

The recommended way is option 1, use the nuget package.
Assuming you now have the attributes available you can use either PublicAPIAttribute or the UsedImplicitlyAttribute.
Either one should suffice but they may have different connotations. Since you're flagging objects being transferred to or from clients I would go with the PublicAPIAttribute first.

Since you say in a comment that the PublicAPIAttribute didn't work but UsedImplicitlyAttribute did then I guess they do have different meanings.


Q: What is wrong passing a 2D array to a respective pointer argument? I've been doing some matrix calculation in C for university the other day where I had a 5x5 matrix to begin with so I hard-coded it into the source. It was a 2D array of doubles like:
/**
 * This is the probability-matrix for reaching from any profile
 * to another by randomly selecting a friend from the friendlist.
 */
static const double F[5][5] = {
  /*           P    , F    , L    , A    , S    */
  /* Peter */ {0    , 0.5  , 0.5  , 0    , 0    },
  /* Franz */ {1.0  , 0    , 0    , 0    , 0    },
  /* Lisa  */ {0    , 1/3.0, 0    , 1/3.0, 1/3.0},
  /* Anna  */ {0    , 0    , 0    , 0    , 1    },
  /* Sepp  */ {0    , 0.5  , 0.5  , 0    , 0    }
};

I wanted my functions to not be fixed to operate on 5-by-5 matrices so I always pass the number of rows and/or cols to the function. This forces me not to use the double [][X] syntax because it can not be completely "variable" and instead use a double* as function parameter.
inline size_t matrix_get(int rows, int i, int j);

inline void matrix_print(double* m, int rows, int cols);

inline void matrix_copy(double* d, const double* s, int rows, int cols);

void matrix_multiply(
  int m, int n, int l,
  const double* a, const double* b, double* d);

But I always get this warning when calling a function that accepts double* when I passed double [5][5] instead.
fuenf_freunde.c:138:17: warning: incompatible pointer types passing 'double [5][5]' to parameter of
      type 'double *' [-Wincompatible-pointer-types]
  matrix_print( R, 5, 5);
                ^
fuenf_freunde.c:54:27: note: passing argument to parameter 'm' here
void matrix_print(double* m, int rows, int cols)
                          ^

Casting using (double*) F resolves the warning.
Now my questions are

*

*am I wrong casting a 2D double array to a double pointer?

*why is it working if its illegal?

*what is the right way to pass an n-dimensional arbitrary size array to a function?

EDIT: This cleared a lot up for me: Accesing a 2D array using a single pointer
So I should just use double[x*y] instead of double[x][y] I think. But is it legal to cast double[] to double*?

A: I contend that there is nothing wrong with what you do. Your code just lacks an explicit cast which would get rid of the warning, indicating that your assignment is intentional.
You can access a one dimensional array through a pointer to its elements, and recursively applied, it follows that n-dimensional matrices can be accessed through pointers to the atomic elements.
C guarantees a contiguous memory layout for them. This pattern is common. In  fact passing arrays is hard or impossible to do differently, given the little information C stores with types (as opposed to, say, C#). So the matrix decays to a pointer to its first element (in your case to the first one dimensional array), which can safely be cast to an address of its first element, a double. They all share the same numerical address.
Typical concerns with pointer type casting are aliasing issues with modern optimizing compilers (a compiler can assume that you don't access memory through pointers of unrelated types except char*), but there is an explicit exemption in the standard draft 1570 which I have, par. 6.5.7, which I think is applicable here:

An object [that would be a double in your matrix, -ps] shall have its stored value accessed only by an lvalue
  expression that has one of the following types:
— a type compatible with the effective type of the object [that would be a dereferenced double pointer, -ps]
  [...]
— an aggregate [e.g. array, -ps]
  [...] type that includes one of the aforementioned types among its
  members (including, recursively, a member of a subaggregate or
  contained union) [that would be your matrix variable, containing, eventually, doubles, -ps]
[...]


Q: Need help setup windows server 2008 SMTP server I am trying to setup windows server 2008 smtp server to relay emails to gmail smtp. Everything appears to be setup but it is not sending emails. Could you please help me figure out whats wrong.
Below is the setup:

*

*Windows server 2008 with SMTP server
feature installed. Need SMTP server
to forward all messages to gmail smtp
server to send.

*I have google apps    setup for my
domain, also I can send    emails
throught my test app using
gmail smtp.

*SMTP Server Configuration: By default has default smtp server virtual directory.

*In Properties of that virtual smtp server changed following.

*Fully qualified domain name = mydomain.com

*smart host = smtp.gmail.com

*TCP Port = 587

*Out Bound Security = Basic Authentication(my username password for google apps email account)

*In domains list under virtual smtp server. I have one default domain that's server dns. I added another one for my domain name.

With above setup i am trying to redirect all email to gmail smtp.
I tested connection to smtp.gmail.com from server on port 587 through telnet and it works.
I am trying to use above server from my web application also by just dropping emails in pickup directory. It get's picked up and also accepts request form web application but never sends an email.
I can see that it adds those emails in queue folder but it stays there forever.
When i try to send emails from web app to above server it rejects if To address is other than my domain.(Am i missing something in list of domains)

A: Thanks for all answers, finally found solution there is a property for maximum sessions which value was 0 by default. Changed it to 100 and it send all pending emails immediately.

A: This souds like a DNS issue. Check your /badmail directory. It will have .bad and .bdp files in there. You can open these in notepad (there will be some binary in there).
However, it may point to the possible problem.
You may also want to try and enable logging on the SMTP service. There may be something in there.

A: Possible reasons are that some SMTP servers block the outgoing messages if there domain name mismatch, possible to prevent spam mails from being sent. So for example, I will not be able to send my email with an address abc@mydomain.com from my domain yourdomain.com.
Hope that helps.

A: Ensure your sending domain is the same as the google apps domain
Ensure your sending address is a real address and not just an alias
IIRC you need to use STARTTLS (SSL) not basic authentication


Q: why can't I pass the return twice? I'm practicing python and I don't understand why I am getting this error. I tried searching it but I can't find put why.
I tried to put pass_two = two(x) but it didn't work. it kept saying it was undefined.
can any one correct and explain why? thanks
def one():
    x = 'blue'
    return x

def two(x):
    y = 'red'
    xy = x+y
    return xy

def three(z):

    w = 'black'
    print('all three passes ' + z+w)

def main():
    pass_one = one()
    two(pass_one)

    pass_two = two()
    three(pass_two)

if __name__ == '__main__':
    main()

A: You defined the function two to work with an argument so if you try to type two(), Python will output TypeError: two() missing 1 required positional argument: 'x'.
Now, if you try to type two(x)without having defined x before, you will get a NameError.
Maybe you wanted to write pass_two = two(pass_one)


Q: Insert multipe rows after specific row in Excel 2003 For example, my table is like this :
  AAA
  bb
  cc
  AAA
  dd...

How can I insert 3 empty rows just below AAA row? So that, my table becomes :
  AAA
  first empty row
  second empty row
  third empty row
  bb
  cc
  AAA
  first empty row
  second empty row
  third empty row
  dd..

A: If you are in Excel, right click on the row numbers on the left to show a context menu, then click on "Insert". This will add a new row.


Q: Java project can display a new scene pretty easily, but only for certain JavaFXML files, how to fix this? Here's my code I'm struggling with (I marked the line that's giving me errors):
package sample.controller;

import java.io.IOException;
import java.net.URL;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import sample.database.DBConnection;
import sample.model.User;

public class LoginController {

    @FXML
    private ResourceBundle resources;

    @FXML
    private URL location;

    @FXML
    private Button loginButton;

    @FXML
    private TextField loginEmail;

    @FXML
    private Button createAccountSwitchButton;

    @FXML
    private PasswordField loginPassword;

    private DBConnection dbConnection;

    @FXML
    void initialize() {

        dbConnection = new DBConnection();

        loginButton.setOnAction(event-> {
            String loginEmailText = loginEmail.getText().trim();
            String loginPasswordText = loginPassword.getText().trim();

            User user = new User();
            user.setEmail(loginEmailText);
            user.setPassword(loginPasswordText);

            ResultSet userRow = dbConnection.checkForUser(user);
            int counter = 0;

            try{
                while (userRow.next()){
                    counter++;
                }
                if (counter==1){
                    loginButton.getScene().getWindow().hide();
                    FXMLLoader loader = new FXMLLoader();

//THE LINE BELOW THIS LINE-------------------------------------------------------------------

                    loader.setLocation(getClass().getResource("/sample/view/CreateAccount.fxml")); //THIS LINE

//THE LINE ABOVE THIS LINE-------------------------------------------------------------------
                    try {
                        loader.load();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }

                    Parent root = loader.getRoot();
                    Stage stage = new Stage();
                    stage.setScene(new Scene(root));
                    stage.showAndWait();

                }
            }catch(SQLException e){
                e.printStackTrace();
            }
        });

        //  Takes user to Create Account page
        createAccountSwitchButton.setOnAction(event -> {
            createAccountSwitchButton.getScene().getWindow().hide();
            FXMLLoader loader = new FXMLLoader();
            loader.setLocation(getClass().getResource("/sample/view/CreateAccount.fxml"));

            try {
                loader.load();
            } catch (IOException e) {
                e.printStackTrace();
            }

            Parent root = loader.getRoot();
            Stage stage = new Stage();
            stage.setScene(new Scene(root));
            stage.showAndWait();

        });

    }

//    private void loginUser(String email, String password) {
//        //Checks if fields are empty, if so, bring them to user dashboard.
//        if(!email.equals("") || !password.equals("")){
//
//        }else{
//
//        }
//    }
}

At this point, it does exactly what I want it to do, it loads a new scene of "CreateAccount.fxml" file whenever I click the login button. But I want it to load a different FXML file, so I change the name to "Dashboard.fxml" which is my dashboard file name, but all of a sudden it no longer works and it's giving me errors that don't make any sense since my path is right and my name is right as well. This is what I changed that line to to throw the error below:
loader.setLocation(getClass().getResource("/sample/view/Dashboard.fxml"));

Lastly, to make sure, I created a completely new and blank FXML file and it won't load either.
Here are the full errors:
javafx.fxml.LoadException:
/C:/Users/andre/IdeaProjects/Covix/out/production/Covix/sample/view/Dashboard.fxml:12

    at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)
    at javafx.fxml.FXMLLoader.access$700(FXMLLoader.java:103)
    at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:922)
    at javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:971)
    at javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:220)
    at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:744)
    at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2707)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2527)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409)
    at sample.controller.LoginController.lambda$initialize$0(LoginController.java:68)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
    at javafx.event.Event.fireEvent(Event.java:198)
    at javafx.scene.Node.fireEvent(Node.java:8411)
    at javafx.scene.control.Button.fire(Button.java:185)
    at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
    at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
    at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
    at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
    at javafx.event.Event.fireEvent(Event.java:198)
    at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
    at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
    at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
    at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:432)
    at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:410)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431)
    at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
    at com.sun.glass.ui.View.notifyMouse(View.java:937)
    at com.sun.glass.ui.win.WinApplication._enterNestedEventLoopImpl(Native Method)
    at com.sun.glass.ui.win.WinApplication._enterNestedEventLoop(WinApplication.java:215)
    at com.sun.glass.ui.Application.enterNestedEventLoop(Application.java:511)
    at com.sun.glass.ui.EventLoop.enter(EventLoop.java:107)
    at com.sun.javafx.tk.quantum.QuantumToolkit.enterNestedEventLoop(QuantumToolkit.java:633)
    at javafx.stage.Stage.showAndWait(Stage.java:474)
    at sample.controller.CreateAccountController.lambda$initialize$0(CreateAccountController.java:59)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
    at javafx.event.Event.fireEvent(Event.java:198)
    at javafx.scene.Node.fireEvent(Node.java:8411)
    at javafx.scene.control.Button.fire(Button.java:185)
    at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
    at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
    at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
    at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
    at javafx.event.Event.fireEvent(Event.java:198)
    at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
    at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
    at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
    at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:432)
    at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:410)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431)
    at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
    at com.sun.glass.ui.View.notifyMouse(View.java:937)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$4(WinApplication.java:186)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: sample.view.Dashboard
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:920)
    ... 106 more
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException: Root cannot be null
    at javafx.scene.Scene.<init>(Scene.java:336)
    at javafx.scene.Scene.<init>(Scene.java:194)
    at sample.controller.LoginController.lambda$initialize$0(LoginController.java:75)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
    at javafx.event.Event.fireEvent(Event.java:198)
    at javafx.scene.Node.fireEvent(Node.java:8411)
    at javafx.scene.control.Button.fire(Button.java:185)
    at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
    at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
    at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
    at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
    at javafx.event.Event.fireEvent(Event.java:198)
    at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
    at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
    at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
    at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:432)
    at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:410)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431)
    at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
    at com.sun.glass.ui.View.notifyMouse(View.java:937)
    at com.sun.glass.ui.win.WinApplication._enterNestedEventLoopImpl(Native Method)
    at com.sun.glass.ui.win.WinApplication._enterNestedEventLoop(WinApplication.java:215)
    at com.sun.glass.ui.Application.enterNestedEventLoop(Application.java:511)
    at com.sun.glass.ui.EventLoop.enter(EventLoop.java:107)
    at com.sun.javafx.tk.quantum.QuantumToolkit.enterNestedEventLoop(QuantumToolkit.java:633)
    at javafx.stage.Stage.showAndWait(Stage.java:474)
    at sample.controller.CreateAccountController.lambda$initialize$0(CreateAccountController.java:59)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
    at javafx.event.Event.fireEvent(Event.java:198)
    at javafx.scene.Node.fireEvent(Node.java:8411)
    at javafx.scene.control.Button.fire(Button.java:185)
    at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
    at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
    at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
    at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)

Here's my Dashboard.fxml:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.text.Font?>

<AnchorPane prefHeight="800.0" prefWidth="1400.0" xmlns="http://javafx.com/javafx/15.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sample.view.Dashboard">
   <children>
      <AnchorPane layoutX="-6.0" layoutY="-12.0" prefHeight="816.0" prefWidth="325.0" style="-fx-background-color: #001E8A;">
         <children>
            <ImageView fitHeight="46.0" fitWidth="46.0" layoutX="64.0" layoutY="60.0" pickOnBounds="true" preserveRatio="true">
               <image>
                  <Image url="@../assets/whiteLogo.png" />
               </image>
            </ImageView>
            <Label layoutX="132.0" layoutY="55.0" text="Covix" textFill="WHITE">
               <font>
                  <Font size="43.0" />
               </font>
            </Label>
            <Rectangle arcHeight="5.0" arcWidth="5.0" fill="WHITE" height="5.0" layoutX="51.0" layoutY="155.0" stroke="BLACK" strokeType="INSIDE" width="222.0" />
         </children>
      </AnchorPane>
      <TableView layoutX="379.0" layoutY="342.0" prefHeight="402.0" prefWidth="397.0">
        <columns>
          <TableColumn prefWidth="75.0" text="C1" />
          <TableColumn prefWidth="75.0" text="C2" />
        </columns>
      </TableView>
      <Label layoutX="371.0" layoutY="30.0" text="Dashboard">
         <font>
            <Font name="System Bold" size="44.0" />
         </font>
      </Label>
   </children>
</AnchorPane>

Here's my CreateAccount.fxml:
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.PasswordField?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Font?>

<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="1050.0" xmlns="http://javafx.com/javafx/15.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sample.controller.CreateAccountController">
   <children>
      <AnchorPane layoutX="417.0" layoutY="-8.0" prefHeight="610.0" prefWidth="634.0" style="-fx-background-color: #001F8E;">
         <children>
            <ImageView fitHeight="378.0" fitWidth="534.0" layoutX="46.0" layoutY="118.0" pickOnBounds="true" preserveRatio="true">
               <image>
                  <Image url="@../assets/loginart.png" />
               </image>
            </ImageView>
            <Label layoutX="247.0" layoutY="514.0" text="Stay Safe With Covix" textFill="WHITE">
               <font>
                  <Font name="System Bold" size="16.0" />
               </font>
            </Label>
            <Label layoutX="160.0" layoutY="542.0" text="Update your scores and see other user's scores to keep yourself" textFill="WHITE" />
            <Label layoutX="160.0" layoutY="564.0" text="        and others around you as healthy and safe as possible." textFill="WHITE" />
         </children></AnchorPane>
      <AnchorPane layoutY="-2.0" prefHeight="606.0" prefWidth="417.0" style="-fx-background-color: white;">
         <children>
            <ImageView fitHeight="44.0" fitWidth="44.0" layoutX="38.0" layoutY="39.0" pickOnBounds="true" preserveRatio="true">
               <image>
                  <Image url="@../assets/covixapplogo.png" />
               </image>
            </ImageView>
            <Label layoutX="94.0" layoutY="40.0" text="Covix" textFill="#111111">
               <font>
                  <Font size="32.0" />
               </font>
            </Label>
            <Label layoutX="40.0" layoutY="111.0" text="Create Account">
               <font>
                  <Font name="System Bold" size="27.0" />
               </font>
            </Label>
            <Label layoutX="42.0" layoutY="155.0" text="Get safer with your score. Create an account today!" textFill="#6c6c6c" />
            <Button fx:id="createAccountButton" layoutX="49.0" layoutY="480.0" mnemonicParsing="false" prefHeight="30.0" prefWidth="313.0" style="-fx-background-color: #001F8E; -fx-border-radius: 10; -fx-border-color: none; text: white;" text="Create Account" textFill="WHITE" />
            <TextField fx:id="createAccountEmail" layoutX="44.0" layoutY="294.0" prefHeight="35.0" prefWidth="324.0" promptText="Email" />
            <Label layoutX="43.0" layoutY="265.0" prefHeight="18.0" prefWidth="235.0" text="Your email:" textFill="#191919">
               <font>
                  <Font size="15.0" />
               </font>
            </Label>
            <Label layoutX="47.0" layoutY="337.0" prefHeight="18.0" prefWidth="235.0" text="Password:" textFill="#191919">
               <font>
                  <Font size="15.0" />
               </font>
            </Label>
            <CheckBox layoutX="55.0" layoutY="421.0" mnemonicParsing="false" text="By creating an account you agree to the terms and conditions.">
               <font>
                  <Font size="10.0" />
               </font>
            </CheckBox>
            <Label layoutX="134.0" layoutY="531.0" text="Already have an account?" textFill="#6c6c6c" />
            <Button fx:id="loginButtonSwitch" layoutX="176.0" layoutY="549.0" mnemonicParsing="false" style="-fx-background-color: none;" text="Log In" textFill="#041cf2">
               <font>
                  <Font name="System Bold" size="12.0" />
               </font>
            </Button>
            <PasswordField fx:id="createAccountPassword" layoutX="44.0" layoutY="369.0" prefHeight="35.0" prefWidth="324.0" promptText="Password" />
            <TextField fx:id="createAccountFullName" layoutX="42.0" layoutY="218.0" prefHeight="35.0" prefWidth="324.0" promptText="e.g. John Doe" />
            <Label layoutX="42.0" layoutY="189.0" prefHeight="18.0" prefWidth="235.0" text="Your Full Name" textFill="#191919">
               <font>
                  <Font size="15.0" />
               </font>
            </Label>
         </children>
      </AnchorPane>
   </children>
</AnchorPane>

So for some reason, my CreateAccount.fxml file loads, but not a completely new FXML file that's blank or my Dashboard.fxml file. I'm not sure what the problem could be. Thanks in advance!

A: The problem is this line of the stack trace:
Caused by: java.lang.ClassNotFoundException: sample.view.Dashboard

This means that the FXML loader could not find a class named Dashboard in package sample.view.
The FXML loader looked for this class because that is what was written in file Dashboard.fxml, namely:
<AnchorPane prefHeight="800.0" prefWidth="1400.0" xmlns="http://javafx.com/javafx/15.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sample.view.Dashboard">

Notice the part at the end of the line:
fx:controller="sample.view.Dashboard"

If you don't need a controller class then simply remove that part.


Q: .htaccess nginx качает php RewriteRule ^auth_callback([^?]*)$ index.php?route=common/social/login/facebook/int_callback&code=$1 [QSA,L]

location /auth_callback {
  rewrite ^/auth_callback([^?]*)$ /index.php?route=common/social/login/facebook/int_callback&code=$1 break;
}

Не работает - скачивает index.php
В чем ошибка?

A: файлы .htaccess обрабатываются, насколько мне известно, лишь одной реализацией http-сервера — apache.
программа nginx не обрабатывает эти файлы. всё необходимое должно быть указано в конфигурации nginx.


Q: Error building react native app on Android Hi I´m trying to run my react native app on android but when i build it shows me this error:
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 952 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Installing the app...
> Task :react-native-safe-area-context:compileDebugJavaWithJavac FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings
48 actionable tasks: 2 executed, 46 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-safe-area-context:compileDebugJavaWithJavac'.
> Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 5s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-safe-area-context:compileDebugJavaWithJavac'.
> Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 5s

    at makeError (/Users/calebgarcia/Dev/Auth/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:174:9)
    at /Users/calebgarcia/Dev/Auth/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:278:16
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async runOnAllDevices (/Users/calebgarcia/Dev/Auth/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:106:5)
    at async Command.handleAction (/Users/calebgarcia/Dev/Auth/node_modules/@react-native-community/cli/build/index.js:192:9)
info Run CLI with --verbose flag for more details.

It´s a bit puzzling since when i build the app on the ios simulator it runs perfectly.
Do you guys have any idea how i can solve the issue?
Thanks.

A: npm install react-native-safe-area-context

Try this and build.
If not,
Please check your computer's environment variables and set JAVA_HOME if it has not already been setup.


Q: Boyd & Vandenberghe, problem 3.49 (c) — proving that a function is log-concave In the problem 3.49(c) of the book it is asked to prove that product over sum function is log-concave. I have some questions related to the solution of this problem which I have mentioned in the following. Please clarify them.
In the solution manual, they have shown that the double derivative of $$\tilde{f}(t)=\sum_{i}\log(x_i+tv_i)-\log \sum_{i}(x_i+tv_i)$$ is less than equal to zero at $t=0$. The double derivative of $\tilde{f}(t)$ at $t=0$ is given as $$\tilde{f}(0)''=-\sum_{i}\frac{v_i^2}{x_i^2}+\frac{(\sum_iv_i)^2}{(\sum_i x_i)^2}$$ which should be $\leq 0$ for all $v$. It is written in the solution manual that when $\sum_iv_i\neq 0$ then $$\tilde{f}(t)=\sum_{i}\log(x_i+tv_i)-\log \sum_{i}(x_i+tv_i)\leq 0 \tag1$$ is homogeneous of degree two in $v$ (what does this mean and why it is homogenous of degree two in $v$?) and due to this reason they say that it can be assumed that $$\sum_iv_i=\sum_ix_i$$ (why it can be assumed without generality?). After this they say that Eq. (1) is equivalent to showing that $$\sum_{i}\frac{v_i^2}{x_i^2}\geq 1$$holds whenever $\sum_iv_i=\sum_ix_i$. To establish this they fix a value of $x$ and minimize the convex quadratic form $\sum_{i}\frac{v_i^2}{x_i^2}$ over $\sum_iv_i=\sum_ix_i$. After this I do not understand how they reach to the conclusion that the optimality condition gives $$\frac{v_i}{x_i^2}=\lambda$$
Please explain this part too. Is there some use of KKT conditions? (Actually, up till chapter 3 the book does not discuss about KKT conditions so I do not understand even if KKT conditions are used.) Any help in this regard will be much appreciated. Thanks in advance.

A: Homogeneous of degree 2 means that if you scale $v$ by a factor $c$, then the expression $\tilde{f}''(0)$ increases by a factor $c^2$. Since it is $c^2$, the sign of the inequality $\tilde{f}''(0)\leq 0$ does not change after rescaling $v$, even if $c<0$. Therefore, we can always rescale $v$ to have its sum equal to the sum of $x$.
Then they study the problem:
$$\min_v \left\{ \sum_i \frac{v_i^2}{x_i^2} : \sum_i x_i = \sum_i v_i \right\}$$
The Lagrangian is $L(v,\lambda) = \sum_i v_i^2 / x_i^2 + \lambda(\sum_i x_i - \sum_i v_i)$, so the stationarity condition (taking the derivative with respect to $v_i$) is $2 v_i / x_i^2 - \lambda = 0$ for $i=1,2,\ldots,n$, leading to $\lambda = 2v_i/x_i^2$. The factor 2 is not that relevant, it will cancel out in solving $\sum_i x_i = \sum_i v_i$.

A: Here is an alternative proof since I noticed you asked about $v$ and $t$ before. The hessian of $f$ is:
$$H=-\begin{pmatrix}
\frac{1}{x_1^2} & c & \cdots & c \\
c  & \frac{1}{x_2^2} & \cdots & c \\
\vdots & \vdots  & \ddots & \vdots \\
c & c & \cdots & \frac{1}{x_n^2}
\end{pmatrix}$$
with all off-diagonal elements $c=1/(\sum_i x_i)$. We need it to be negative semidefinite for concavity, so:
$$v^THv= - \sum_i \frac{v_i^2}{x_i^2} + \frac{1}{(\sum_i x_i)^2}\sum_{i,j : i \neq j}v_i v_j \leq 0 \quad \forall v.$$
This is also homogeneous of degree 2, so (assuming $v \neq 0$) we can rescale $v$ to get $\sum_{i,j : i \neq j}v_i v_j = (\sum_i x_i)^2$. The remainder of the proof is similar.


Q: CSS column bug fix or alternative Due to Chrome (and other Blink browsers) having a bug where only the first 500 columns are painted i need either a fix/hack, or an alternative solution.
See bug here (there is 509 pages - not 500): https://codepen.io/anon/pen/pLxozK
/* codepen link must be accompanied by code */
column-width: 400px;

I parse EPUB html to a single file. The EPUB's styling must be preserved, so i can't change the html structure.
CSS columns does a good job of rendering such a flat document horizontally. But the 500 limit in Blink means blank pages in Android Webviews.
Is there any workaround for this bug?
Users can adjust font size etc meaning amount of columns can change. So an alternative solution must be able to adjust.

A: What a cool little bug, I've never seen that before!
By the looks of things you'll need to add display:none to some of your divs. You'll need to use Javascript to see what's in view and see what's not. You'll get the added bonus of not using any system resources unnecessarily as you won't be painting any of the pages that aren't in view.


Q: PHP preg_replace exclude < and > I need to change this code:
$output = preg_replace("#<a ([^>]*)>([^<]*)<\/a>#", "$2", $output)

to make from <a some.url>description</a> to HTML code description, but after i changed < and > to < and > it doesn't make what I wanted.
Thank you for your help.
EDIT:
I wouldn't use html_entity_decode(), because I want this for enabling slightly simplified HTML tags, but the most of HTML i would have disabled.
Input for my function is a variable, obtained from a form:
Firstly the code replaces all < and > with < and >.
Than it changes back some text-modifying static HTML tags, for example  and .
But in the end, i want to change every link inputed as link (and than by code changed to <a some.url>link</a>) to be changed by preg_replace() into standard HTML code link

A: http://php.net/manual/en/function.html-entity-decode.php
$str = "this 'quote' is <b>bold</b>"
html_entity_decode($output)
// output This 'quote' is bold

http://php.net/manual/en/function.htmlentities.php
$str = "This 'quote' is bold";
htmlentities($output);
// output this 'quote' is <b>bold</b>


Q: Open a PDF file from C#.NET using Impersonate I have a folder on the server containing pdf files(Windows Server 2008 R2 Enterprise). I have to open the folder with the authorized user account and display the pdf file in the browser. The user has full control permissions on the folder and is a member of the Administrator group.
Bellow code works from my local as it opens the pdf file from the folder located in the server in Adobe Reader. But on the server the process does not start(Adobe Reader does not open) and no exception occurs. Most of the forums say that turning off UAC will help, but I don't want to do it, because of security reasons.
How can I deal that issue? Please help.
try
{
    WindowsIdentity wi = new WindowsIdentity(@"user_name@DOMAIN");
    WindowsImpersonationContext ctx = null;

    try
    {
        ctx = wi.Impersonate();

        // Thread is now impersonating you can call the backend operations here...
        Process p = new Process();

        p.StartInfo = new ProcessStartInfo()
        {
            CreateNoWindow = true,
            Verb = "open",
            FileName = ConfigurationManager.AppSettings["mobil"] + "\\" + prmSicilNo + "_" + prmPeriod.ToString("yyyyMM") + ".pdf",
        };

        p.Start();
    }
    catch (Exception ex)
    {
        msj = ex.Message;
    }
    finally
    {
        ctx.Undo();
    }

    return msj;
}
catch (Exception ex)
{
    return msj + "Error: " + ex.Message;
}

A: Try to execute your .exe with Run as Adminstrator on the server.If it works properly then add the below code:
p.StartInfo.Verb = "runas";

A: @Chintan Udeshi Thank you for you quick answer. I can run the AcroRd32.exe by Run as Administrator but when I tried with runas I got the error which says; "No application is associated with the specified file for this operation".
I also tried to place absolute Acrobat Reader Path, but it still didn't work. Any idea?
p.StartInfo = new ProcessStartInfo(@"C:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.exe")
{
   CreateNoWindow = true,
   Verb = "runas",
   FileName = ConfigurationManager.AppSettings["mobil"] + "\\" + prmSicilNo + "_" + prmPeriod.ToString("yyyyMM") + ".pdf", // "c:\\pdf\\",
};


Q: DNS resolving troubles in 19.10 I recently upgraded to 19.10. From time to time, I see that DNS is not resolving properly e.g. within Firefox or Thunderbird. Trying the same request in another tab will yield the same result. Trying the same URL immediately in a private tab (while the other tabs are still hanging), resolves the site normally. Other URLs are still resolved without any issue while the other URLs are still hanging to be resolved.
After a few seconds, the effect goes away and everything is back to normal for all URLs and all protocols.
This happens ~10-15 times seemingly randomly per work day currently. It's also happening for IMAP connections or SSH connections.
Using wireshark, I see lot's of ICMP Destination unrechable towards my router when the issue is happening. I also recently updated the router to its latest firmware (Asus RT-AC68U). Logs reveal nothing at this time. Connection is over Cat6/ethernet.
My DNS resolver is using a symlinked resolv.conf to /run/systemd/resolve/stub-resolv.conf:
nameserver 127.0.0.53
options edns0

Edit:
My current /etc/systemd/resolved.conf
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as         published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See resolved.conf(5) for details

[Resolve]
#DNS=
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#DNSOverTLS=no
#Cache=yes
#DNSStubListener=yes
#ReadEtcHosts=yes

ping -c 5 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=55 time=1.29 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=55 time=1.05 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=55 time=1.11 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=55 time=1.12 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=55 time=1.12 ms

--- 8.8.8.8 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4004ms
rtt min/avg/max/mdev = 1.046/1.136/1.288/0.080 ms

www.ebay.com is an alias for slot9428.ebay.com.edgekey.net.
slot9428.ebay.com.edgekey.net is an alias for e9428.b.akamaiedge.net.
e9428.b.akamaiedge.net has address 23.211.5.229


Q: setAttribute a href in Selenium Java I got href of an element. After that, I subString,...to make a new href and want to set it back to element. But Selenium doesn't have setAttribute method
nextListByNumber = driver.findElement(By.xpath("//*[@id='paginater']//*[text()='"+2+"']"));
String href = nextListByNumber.getAttribute("href");
int manualcode1 = href.lastIndexOf("MANUAL");
int manualcode2 = href.lastIndexOf("/sort");
String manualcode = href.substring(manualcode1, manualcode2);

String hrefNew = "http://localhost/jp/courseassign/course_assign_search_result/"+manualcode+"/sort:User.login_id/direction:asc/page:"+i+"?limit=20";

A: You can use JavaScript for this
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].setAttribute(arguments[1], arguments[2]);", nextListByNumber, "href", hrefNew);


Q: DELETE function is deleting the logo, but I don't want it to delete the logo I have a GUI in Matlab, where I have a DELETE BUTTON, after I click on it, it as well deletes the logo in it.
The code for the DELETE function:
clc

figure('Name', 'Vektorkardiogram');
%Return handle to figure named 'Vectorcardiogram'.
h = findobj('Name', 'Vektorkardiogram');
close(h);

figure('Name', 'Roviny');
%Return handle to figure named 'Vectorcardiogram'.
r = findobj('Name', 'Roviny');
close(r);

figure('Name', 'P vlna');
%Return handle to figure named 'Vectorcardiogram'.
p = findobj('Name', 'P vlna');
close(p);

figure('Name', 'QRS komplex');
%Return handle to figure named 'Vectorcardiogram'.
q = findobj('Name', 'QRS komplex');
close(q);

figure('Name', 'T vlna');
%Return handle to figure named 'Vectorcardiogram'.
t = findobj('Name', 'T vlna');
close(t);

arrayfun(@cla,findall(0,'type','axes'));
delete(findall(findall(gcf,'Type','axe'),'Type','text'));

The code for uploading the logo (I have made a GUI in Matlab using the guide command, so this code below is inserted inside the GUI code):
logo4 = imread('logo4.png','BackgroundColor',[1 1 1]);
imshow(logo4)

Pusghing the DELETE BUTTON, I just want to close certain figure windwos, not to delete the logo. Could you please help me out?

A: You are clearing all axes using cla which includes the logo that you don't want to delete.
arrayfun(@cla,findall(0,'type','axes'));

Instead of clearing everything, it's better to delete and clear specific objects.
cla(handles.axes10)
cla(handles.axes11)

Alternately, if you keep the handle to the image object, you can ignore the axes that contains it when clearing axes
himg = imshow(data);

allaxes = findall(0, 'type', 'axes');
allaxes = allaxes(~ismember(allaxes, ancestor(himg, 'axes')));

cla(allaxes)

Also, you shouldn't ever do findall(0, ... in your GUI because if I open a figure before opening my GUI you will alter the state of my other figure. Instead, use findall(gcbf, ... which will only alter children of your own GUI. Either that, or use a 'Tag' specific to your GUI and then use findall to filter for that specific tag.
figure('Tag', 'mygui')

findall(0, 'Tag', 'mygui')

Update
You should use findall combined with the 'Name' parameter to figure out which of your figures actually exists
figs = findall(0, 'Name', 'Vektorkardiogram', ...
               '-or', 'Name', 'Roviny', ...
               '-or', 'Name', 'P vlna', ...
               '-or', 'Name', 'QRS komplex', ...
               '-or', 'Name', 'T vlna');
delete(figs);

And for clearing the axes, you can ensure that they exist
ax = findall(0, 'tag', 'axes10', '-or', 'tag', 'axes11', '-or', 'tag', 'axes12');
cla(ax)