问:
Terminate process when timeout has been reached and process output in Rust
I'm trying to consume output from a process in Rust. If the process doesn't terminate after a certain time, I want to terminate/kill it. Ideally I'd like to wrap everything in a generator so that I can iterate the output line by line, but I'm not experienced enough for that in Rust yet.

Here's my code (src/main.rs), using the subprocess crate:

use subprocess::{Popen, PopenConfig, Redirection};
use std::io::Read;
use std::time::Duration;

fn main() {
    let mut p = Popen::create(&["bash", "-c", "echo \"Hi There!\"; sleep 1000"], PopenConfig {stdout: Redirection::Pipe, ..Default::default()}, ).unwrap();
    let mut output = p.stdout.take().unwrap();

    let thread = std::thread::spawn(move || {
        let three_secs = Duration::from_secs(3);
        let one_sec = Duration::from_secs(1);
        let r = p.wait_timeout(three_secs).unwrap();
        match r {
            None => {
                println!("Wait timed out, terminating process");
                p.terminate().unwrap();
                let r = p.wait_timeout(one_sec).unwrap();
                match r {
                    None => {
                        println!("Termination didn't seem to work, killing");
                        p.kill().unwrap();
                    },
                    Some(_) => {
                        println!("Terminated process successfully");
                    },
                }
                p.wait().unwrap();},
            Some(_) => { println!("Process returned");},
        }
        println!("Everything fine");
    });

    println!("Starting to read output");
    let mut output_str = String::new();
    output.read_to_string(&mut output_str).unwrap();
    println!("Done reading output");
    thread.join().unwrap();

    println!("Output: {}", output_str);
    println!("Hello, world!");
}
```

<p>I'd expect the following output:</p>

```Starting to read output
Wait timed out, terminating process
Terminated process successfully
Everything fine
Done reading output
Output: Hi There!

Hello, world!
```

<p>and the process finishing after three seconds. But what I get is</p>

```Starting to read output
Wait timed out, terminating process
Terminated process successfully
Everything fine
```

<p>and the process doesn't terminate.</p>

<p>For completeness, here is my <code>Cargo.toml</code> to go along with the <code>src/main.rs</code> from above:</p>

```[package]
name = "subproc"
version = "0.1.0"
authors = ["<snip>"]
edition = "2018"

[dependencies]
subprocess = "0.2.4"
```

答:
I'd look for a crate to help you do this.

Perhaps something like this:
https://docs.rs/wait-timeout/0.2.0/wait_timeout/

Here's the example code adapted to capture stdout and iterate over it line-by-line:

```<code>use std::io::Read;
use std::process::{Command, Stdio};
use std::time::Duration;
use wait_timeout::ChildExt;

fn main() {
    let mut child = Command::new("sh")
        .arg("-c")
        .arg("while true; do date; sleep 1; done")
        .stdout(Stdio::piped())
        .spawn()
        .unwrap();

    let secs = Duration::from_secs(5);
    let _status_code = match child.wait_timeout(secs).unwrap() {
        Some(status) => status.code(),
        None => {
            child.kill().unwrap();
            child.wait().unwrap().code()
        }
    };

    let mut s = String::new();
    child.stdout.unwrap().read_to_string(&mut s).unwrap();

    for (num, line) in s.split("\n").enumerate() {
        println!("{}: {}", num, line);
    }
}
</code>```

Prints:

```<code>0: Mon Jun  1 14:42:06 BST 2020
1: Mon Jun  1 14:42:07 BST 2020
2: Mon Jun  1 14:42:08 BST 2020
3: Mon Jun  1 14:42:09 BST 2020
4: Mon Jun  1 14:42:10 BST 2020
5:
</code>```

If you wanted to do other work whilst the child runs, you'd have to use an event loop or a thread.

Body:
I'm trying to consume output from a process in Rust. If the process doesn't terminate after a certain time, I want to terminate/kill it. Ideally I'd like to wrap everything in a generator so that I can iterate the output line by line, but I'm not experienced enough for that in Rust yet.

Here's my code (src/main.rs), using the subprocess crate:

use subprocess::{Popen, PopenConfig, Redirection};
use std::io::Read;
use std::time::Duration;

fn main() {
    let mut p = Popen::create(&["bash", "-c", "echo \"Hi There!\"; sleep 1000"], PopenConfig {stdout: Redirection::Pipe, ..Default::default()}, ).unwrap();
    let mut output = p.stdout.take().unwrap();

    let thread = std::thread::spawn(move || {
        let three_secs = Duration::from_secs(3);
        let one_sec = Duration::from_secs(1);
        let r = p.wait_timeout(three_secs).unwrap();
        match r {
            None => {
                println!("Wait timed out, terminating process");
                p.terminate().unwrap();
                let r = p.wait_timeout(one_sec).unwrap();
                match r {
                    None => {
                        println!("Termination didn't seem to work, killing");
                        p.kill().unwrap();
                    },
                    Some(_) => {
                        println!("Terminated process successfully");
                    },
                }
                p.wait().unwrap();},
            Some(_) => { println!("Process returned");},
        }
        println!("Everything fine");
    });

    println!("Starting to read output");
    let mut output_str = String::new();
    output.read_to_string(&mut output_str).unwrap();
    println!("Done reading output");
    thread.join().unwrap();

    println!("Output: {}", output_str);
    println!("Hello, world!");
}

I'd expect the following output:

Starting to read output
Wait timed out, terminating process
Terminated process successfully
Everything fine
Done reading output
Output: Hi There!

Hello, world!

and the process finishing after three seconds. But what I get is

Starting to read output
Wait timed out, terminating process
Terminated process successfully
Everything fine

and the process doesn't terminate.

For completeness, here is my Cargo.toml to go along with the src/main.rs from above:

[package]
name = "subproc"
version = "0.1.0"
authors = ["<snip>"]
edition = "2018"

[dependencies]
subprocess = "0.2.4"

Body:
I'd look for a crate to help you do this.

Perhaps something like this:
https://docs.rs/wait-timeout/0.2.0/wait_timeout/

Here's the example code adapted to capture stdout and iterate over it line-by-line:

use std::io::Read;
use std::process::{Command, Stdio};
use std::time::Duration;
use wait_timeout::ChildExt;

fn main() {
    let mut child = Command::new("sh")
        .arg("-c")
        .arg("while true; do date; sleep 1; done")
        .stdout(Stdio::piped())
        .spawn()
        .unwrap();

    let secs = Duration::from_secs(5);
    let _status_code = match child.wait_timeout(secs).unwrap() {
        Some(status) => status.code(),
        None => {
            child.kill().unwrap();
            child.wait().unwrap().code()
        }
    };

    let mut s = String::new();
    child.stdout.unwrap().read_to_string(&mut s).unwrap();

    for (num, line) in s.split("\n").enumerate() {
        println!("{}: {}", num, line);
    }
}

Prints:

0: Mon Jun  1 14:42:06 BST 2020
1: Mon Jun  1 14:42:07 BST 2020
2: Mon Jun  1 14:42:08 BST 2020
3: Mon Jun  1 14:42:09 BST 2020
4: Mon Jun  1 14:42:10 BST 2020
5:

If you wanted to do other work whilst the child runs, you'd have to use an event loop or a thread.


来源: stackexchange

问:
ASP.NET Parser Error Cannot load code behind
Hey I am getting the following error

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type '_AddToCart'.

Source Error:

```<code>Line 1:  <%@ Page Language="C#" AutoEventWireup="true" Codebehind="AddToCart.aspx.cs" Inherits="_AddToCart" Title="Untitled Page" %>
Line 2:
Line 3:  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Source File: /FSAICart/AddToCart.aspx    Line: 1
</code>```

Where I do have the matching code behind file which is defined as follows

```<code>    using System;
  public partial class _AddToCart : System.Web.UI.Page {
</code>```

Any Ideas ?

答:
Specify the namespace of the Inherits property of Page directive

Look at codebehind of your page. It looks like:

```<code>namespace MyWebSite
{
     public partial class _AddToCart : System.Web.UI.Page
     {
        //...
     }
}
</code>```

So you must change Page directive to:

```<code><%@ Page Language="C#" AutoEventWireup="true" Codebehind="AddToCart.aspx.cs" Inherits="MyWebSite._AddToCart" Title="Untitled Page" %>
</code>```

ContentLicense: CC BY-SA 3.0

Body:
Hey I am getting the following error

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type '_AddToCart'.

Source Error:

Line 1:  <%@ Page Language="C#" AutoEventWireup="true" Codebehind="AddToCart.aspx.cs" Inherits="_AddToCart" Title="Untitled Page" %>
Line 2:
Line 3:  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Source File: /FSAICart/AddToCart.aspx    Line: 1

Where I do have the matching code behind file which is defined as follows

    using System;
  public partial class _AddToCart : System.Web.UI.Page {

Any Ideas ?

Body:
Specify the namespace of the Inherits property of Page directive

Look at codebehind of your page. It looks like:

namespace MyWebSite
{
     public partial class _AddToCart : System.Web.UI.Page
     {
        //...
     }
}

So you must change Page directive to:

<%@ Page Language="C#" AutoEventWireup="true" Codebehind="AddToCart.aspx.cs" Inherits="MyWebSite._AddToCart" Title="Untitled Page" %>


问:
Angular - the best approach to keep variables in a project
I'm wondering what's the best approach to keep variables in Angular project.

I have an example, let's suppose I have a component which includes many variables, but I don't like that it makes my component so long and less transparent.

```<code>...
@Component({
    selector: 'app-ballance',
    templateUrl: './balance.component.html',
    styleUrls: ['./balance.component.scss']
})
export class BalanceComponent implements OnInit {

    list = [];
    list3 = [];
    errorMsg;
    numbOfElem = 0;
    numbOfElem2 = 0;
    items: Array<any>;
    items2: Array<any>;
    pageOfItems: Array<any>;
    pageOfItems2: Array<any>;
    clickData = false;
    datas: any;
    correctBalance = false;
    wrongBalance = false;
    extraBalance  = false;
    administrator = false;
    doubleBalance = true;
    individualBalance  = false;
    groupBallance = false;
    verifiedBallance = true;
    blockedBallance = false;
    deletedBallance = false;
    unverifiedBallance = false;
    prepaidBallance = false;
...
    ballanceSelect: any[] = [{
        label: 'xxx',
        name: this.showName,
        inputName: 'showName',
        status: this.showName.status,
    }, {
        label: 'xxx',
        name: this.showEmail,
        inputName: 'showEmail',
        status: this.showEmail.status,
    }, {
        label: 'xxx',
        name: this.showMobilePhone,
        inputName: 'showMobilePhone',
        status: this.showMobilePhone.status,
    },
    ];
...
</code>```

My code is working but it doesn't look beautiful, is there some way to create extra file which would store my variables, objects, arrays etc and  how to connect that with component?

答:
Create a service with your settings variables, also you could create a class to create your data maybe. That way you dont pollute the controller. Then group like/similar variables in an object so the are nice and readable.

Something like this will reduce your vars

PS this is a rough idea of what you could do. I am pointing ideas not exact code to do

```<code>  componentData = [];

    createList(): void { // could put this in a service
        const data = {
            list: [],
            items: [],
            pageOfItems: []
        }
        this.componentData.push(data);
    }

    createList(); // make as many as you want

    componentData[id].list; // access like this instead of list3
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I'm wondering what's the best approach to keep variables in Angular project.

I have an example, let's suppose I have a component which includes many variables, but I don't like that it makes my component so long and less transparent.

...
@Component({
    selector: 'app-ballance',
    templateUrl: './balance.component.html',
    styleUrls: ['./balance.component.scss']
})
export class BalanceComponent implements OnInit {

    list = [];
    list3 = [];
    errorMsg;
    numbOfElem = 0;
    numbOfElem2 = 0;
    items: Array<any>;
    items2: Array<any>;
    pageOfItems: Array<any>;
    pageOfItems2: Array<any>;
    clickData = false;
    datas: any;
    correctBalance = false;
    wrongBalance = false;
    extraBalance  = false;
    administrator = false;
    doubleBalance = true;
    individualBalance  = false;
    groupBallance = false;
    verifiedBallance = true;
    blockedBallance = false;
    deletedBallance = false;
    unverifiedBallance = false;
    prepaidBallance = false;
...
    ballanceSelect: any[] = [{
        label: 'xxx',
        name: this.showName,
        inputName: 'showName',
        status: this.showName.status,
    }, {
        label: 'xxx',
        name: this.showEmail,
        inputName: 'showEmail',
        status: this.showEmail.status,
    }, {
        label: 'xxx',
        name: this.showMobilePhone,
        inputName: 'showMobilePhone',
        status: this.showMobilePhone.status,
    },
    ];
...

My code is working but it doesn't look beautiful, is there some way to create extra file which would store my variables, objects, arrays etc and  how to connect that with component?

Body:
Create a service with your settings variables, also you could create a class to create your data maybe. That way you dont pollute the controller. Then group like/similar variables in an object so the are nice and readable.

Something like this will reduce your vars

PS this is a rough idea of what you could do. I am pointing ideas not exact code to do

  componentData = [];

    createList(): void { // could put this in a service
        const data = {
            list: [],
            items: [],
            pageOfItems: []
        }
        this.componentData.push(data);
    }

    createList(); // make as many as you want

    componentData[id].list; // access like this instead of list3


问:
Importing complex Excel with pandas
I have a problem importing data from a complex excel file. The file looks like the following:

I want import the data and therefore need to perform two steps:

Delete the first 2 rows before importing (this data is not needed)

Pivot "Headphones", "TV" and "Radio"

How can I do this?

EDIT:

I want "Headphones", "TV" and "Radio" in a column after "Name" called "product".

So the columns should be: "Country" "Name" "product" "Sales" "Price" " Bestseller"

example:

```<code>US | Tom | Headphones | 1200 | 100 | Headphone 1
US | Tom | TV         | 1546 | 500 | TV 1
</code>```

答:
Jerry, i am pretty new to python but take a look at this:

```<code>import pandas as pd

e=pd.ExcelFile("sales.xlsx")
df = e.parse(skiprows=2)

for index, row in df.iterrows():
  if (index==0):
      print("Country|Name|product|Sales|Price|Bestseller")
  else:
      print(row[0], row[1], "Headphones", row[2], row[3],row[4], sep='|')
      print(row[0], row[1], "TV", row[5], row[6], row[7], sep='|')
      print(row[0], row[1], "Radio", row[8], row[9], row[10],sep='|')
</code>```

output:

```<code>Country|Name|product|Sales|Price|Bestseller
US|Tom|Headphones|1200|100|Headphone 1
US|Tom|TV|1200|100|Headphone 1
US|Tom|Radio|1200|100|Headphone 1
CA|Megan|Headphones|2300|110|Headphone 2
CA|Megan|TV|2300|110|Headphone 2
CA|Megan|Radio|2300|110|Headphone 2
UK|Ryan|Headphones|1156|120|Headphone 1
UK|Ryan|TV|1156|120|Headphone 1
UK|Ryan|Radio|1156|120|Headphone 1
</code>```

This code give a lof of points for improvement, because (i.e) i did 'hard-code' the column names.

EDIT  (because of dataframe is needed as output:

```<code>mycolumns = ['Country','Name','product','Sales','Price','Bestseller']
i = 0

d = pd.DataFrame(columns=mycolumns)
for index, row in df.iterrows():
   if (index>0):
      d.loc[i] = [row[0], row[1],"Headphones",row[2],row[3],row[4]]
      i = i + 1
      d.loc[i] = [row[0], row[1],"TV",row[5],row[6],row[7]]
      i = i + 1
      d.loc[i] = [row[0], row[1],"Radio",row[8],row[9],row[10]]
      i = i + 1
</code>```

More info on DataFrame

Title: Importing complex Excel with pandas

Body:
I have a problem importing data from a complex excel file. The file looks like the following:

I want import the data and therefore need to perform two steps:

Delete the first 2 rows before importing (this data is not needed)

Pivot "Headphones", "TV" and "Radio"

How can I do this?

EDIT:

I want "Headphones", "TV" and "Radio" in a column after "Name" called "product".

So the columns should be: "Country" "Name" "product" "Sales" "Price" " Bestseller"

example:

US | Tom | Headphones | 1200 | 100 | Headphone 1
US | Tom | TV         | 1546 | 500 | TV 1

Body:
Jerry, i am pretty new to python but take a look at this:

import pandas as pd

e=pd.ExcelFile("sales.xlsx")
df = e.parse(skiprows=2)

for index, row in df.iterrows():
  if (index==0):
      print("Country|Name|product|Sales|Price|Bestseller")
  else:
      print(row[0], row[1], "Headphones", row[2], row[3],row[4], sep='|')
      print(row[0], row[1], "TV", row[5], row[6], row[7], sep='|')
      print(row[0], row[1], "Radio", row[8], row[9], row[10],sep='|')

output:

Country|Name|product|Sales|Price|Bestseller
US|Tom|Headphones|1200|100|Headphone 1
US|Tom|TV|1200|100|Headphone 1
US|Tom|Radio|1200|100|Headphone 1
CA|Megan|Headphones|2300|110|Headphone 2
CA|Megan|TV|2300|110|Headphone 2
CA|Megan|Radio|2300|110|Headphone 2
UK|Ryan|Headphones|1156|120|Headphone 1
UK|Ryan|TV|1156|120|Headphone 1
UK|Ryan|Radio|1156|120|Headphone 1

This code give a lof of points for improvement, because (i.e) i did 'hard-code' the column names.

EDIT  (because of dataframe is needed as output:

mycolumns = ['Country','Name','product','Sales','Price','Bestseller']
i = 0

d = pd.DataFrame(columns=mycolumns)
for index, row in df.iterrows():
   if (index>0):
      d.loc[i] = [row[0], row[1],"Headphones",row[2],row[3],row[4]]
      i = i + 1
      d.loc[i] = [row[0], row[1],"TV",row[5],row[6],row[7]]
      i = i + 1
      d.loc[i] = [row[0], row[1],"Radio",row[8],row[9],row[10]]
      i = i + 1

More info on DataFrame


问:
How to get number's arguments(length) while passing inside back tick
I got a scenario where I'm passing number of arguments inside back tick and i need to find out the
length but every time I'm getting one. I do understand back tick do string concatenation but still i
need some way to find the length. Here Is the example</p>

```<code>var fn = (...args) => {
    console.log(args.length);
};

fn(`'mon', 'tue', 'wed'`);
</code>```

答:
You're passing only one argument, i.e the string 'mon', 'tue', 'wed' so you're getting exactly what you should.
Use String.prototype.split to split you string by the ','.
Also, spreading the arguments is useless in your case, as you have just one argument.

Body:
I got a scenario where I'm passing number of arguments inside back tick and i need to find out the
length but every time I'm getting one. I do understand back tick do string concatenation but still i
need some way to find the length. Here Is the example

var fn = (...args) => {
    console.log(args.length);
};

fn(`'mon', 'tue', 'wed'`);


问:
Rust features which allow the optimizer to change the program's result?
In some languages, optimization is allowed to change the program execution result. For example,

C++11 has the concept of "copy-elision" which allows the optimizer to ignore the copy constructor (and its side-effects) in some circumstances.

Swift has the concept of "imprecise lifetimes" which allows the optimizer to release objects at any time after last usage before the end of lexical scope.

In both cases, optimizations are not guaranteed to happen, therefore the program execution result can be significantly different based on the optimizer implementations (e.g. debug vs. release build)

Copying can be skipped, object can die while a reference is alive. The only way to deal with these behaviors is by being defensive and making your program work correctly regardless if the optimizations happen or not. If you don't know about the existence of this behavior, it's impossible to write correct programs with the tools.

This is different from "random operations" which are written by the programmer to produce random results intentionally. These behaviors are (1) done by optimizer and (2) can randomize execution result regardless of programmer intention. This is done by the language designer's intention for better performance. A sort of trade-off between performance and predictability.

Does Rust have (or consider) any of this kind of behavior? Any optimization that is allowed to change program execution result for better performance. If it has any, what is the behavior and why is it allowed?

I know the term "execution result" could be vague, but I don't know a proper term for this. I'm sorry for that.

I'd like to collect every potential case here, so everyone can be aware of them and be prepared for them. Please post any case as an answer (or comment) if you think your case produces different results.

I think all arguable cases are worth to mention. Because someone can be helped a lot by reading the case details.

答:
If you restrict yourself to safe Rust code, the optimizer shouldn't change the program result. Of course there are some optimizations that can be observable due to their very nature. For example removing unused variables can mean your code overflows the stack without optimizations, while everything will fit on the stack when compiled with optimizations. Or your code may just be too slow to ever finish when compiled without optimizations, which is also an observable difference. And with unsafe code triggering undefined behaviour anything can happen, including the optimizer changing the outcome of your code.

There are, however, a few cases where program execution can change depending on whether you are compiling in debug mode or in release mode:

Integer overflow will result in a panic in debug build, while integers wrap around according to the two's complement representation in release mode – see RFC 650 for details. This behaviour can be controlled with the -C overflow-checks codegen option, so you can disable overflow checks in debug mode or enable them in release mode if you want to.

The debug_assert!() macro defines assertions that are only executed in debug mode. There's again a manual override using the -C debug-assertions codegen option.

Your code can check whether debug assertions are enabled using the debug-assertions configuration option

These are all related to debug assertions in some way, but this list is not exhaustive. You can probably also inspect the environment to determine whether the code is compiled in debug or release mode, and change the behaviour based on this.

None of these examples really fall into the same category as your examples in the original question. Safe Rust code should generally behave the same regardless of whether you compile in debug mode or release mode.


问:
How do I make a listbox clickable, and redirect to a new page in a Windows Phone project?
I have a Listbox in my Windows Phone page, that contains some text among other things. I want each grouped item to be clickable and taken to the same destination page, but passing a different parameter each time. This is the closest approximation to what I want right now:

```<code>        <ListBox Margin="0,0,-12,0" Name="MainListBox" ItemsSource="{Binding Items}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Button Width="460" Height="220" ClickMode="Release" Click="Button_Click" Tag="{Binding Name1}" BorderThickness="0" >
                        <Button.Content>
                            <StackPanel Orientation="Horizontal" Margin="0,0,0,17" >
                                <Border Background="#FFE5001b" BorderBrush="Black" BorderThickness="2" Height="100" Width="100" Margin="12,0,9,0"  >
                                    <TextBlock Text="{Binding Name2, Mode=TwoWay}" TextWrapping="Wrap" Margin="12,-28,9,0" Style="{StaticResource PhoneTextSubtleStyle}" FontSize="40" Name="Name2" />
                                </Border>
                                <StackPanel Width="311">
                                    <TextBlock Text="{Binding Name1, Mode=TwoWay}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}" FontStretch="Condensed" />
                                    <TextBlock Text="{Binding Name3, Mode=TwoWay}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>
                                    <TextBlock Text="{Binding Name4, Mode=TwoWay}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>
                                    <TextBlock Text="{Binding Calories, Mode=TwoWay}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>
                                </StackPanel>
                            </StackPanel>
                        </Button.Content>
                    </Button>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
</code>```

The problem is that the click is set to Release (if set to Press, I cannot scroll at all). Everytime I try to scroll up/down, I get the momentary white glow associated with the click of a button. How do I do this correctly? I don't mind not using the button, just want this to work :/

答:
Don't use a button for this.

Look at the code generated when you create a new DataBound application. It will show a way of doing what you are trying to achieve.

Body:
I have a Listbox in my Windows Phone page, that contains some text among other things. I want each grouped item to be clickable and taken to the same destination page, but passing a different parameter each time. This is the closest approximation to what I want right now:

        <ListBox Margin="0,0,-12,0" Name="MainListBox" ItemsSource="{Binding Items}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Button Width="460" Height="220" ClickMode="Release" Click="Button_Click" Tag="{Binding Name1}" BorderThickness="0" >
                        <Button.Content>
                            <StackPanel Orientation="Horizontal" Margin="0,0,0,17" >
                                <Border Background="#FFE5001b" BorderBrush="Black" BorderThickness="2" Height="100" Width="100" Margin="12,0,9,0"  >
                                    <TextBlock Text="{Binding Name2, Mode=TwoWay}" TextWrapping="Wrap" Margin="12,-28,9,0" Style="{StaticResource PhoneTextSubtleStyle}" FontSize="40" Name="Name2" />
                                </Border>
                                <StackPanel Width="311">
                                    <TextBlock Text="{Binding Name1, Mode=TwoWay}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}" FontStretch="Condensed" />
                                    <TextBlock Text="{Binding Name3, Mode=TwoWay}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>
                                    <TextBlock Text="{Binding Name4, Mode=TwoWay}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>
                                    <TextBlock Text="{Binding Calories, Mode=TwoWay}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>
                                </StackPanel>
                            </StackPanel>
                        </Button.Content>
                    </Button>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

The problem is that the click is set to Release (if set to Press, I cannot scroll at all). Everytime I try to scroll up/down, I get the momentary white glow associated with the click of a button. How do I do this correctly? I don't mind not using the button, just want this to work :/


问:
How do I get the number of members of a server?
I am currently working on a command that requires the number of members of a server.

I just don't know how to do this. This is my code:

```<code>let myGuild = client.guilds.get('guild_id');
let memberCount = myGuild.memberCount;
</code>```

Error:

TypeError: client.guilds.get is not a function

答:
Getting a guild:

const guild = client.guilds.cache.get("guild_id");
```

<p>You were right about member count.</p>

<pre class="lang-js prettyprint-override"><code>const member = guild.memberCount;
</code>```

Body:
I am currently working on a command that requires the number of members of a server.

I just don't know how to do this. This is my code:

let myGuild = client.guilds.get('guild_id');
let memberCount = myGuild.memberCount;

Error:

TypeError: client.guilds.get is not a function

Body:
Getting a guild:

const guild = client.guilds.cache.get("guild_id");

You were right about member count.

const member = guild.memberCount;


问:
Netbeans 11, how to generate a war file from a Springboot app
I was studying Spring boot, now I want to get it to a server on my local machine. When researching for a way to deploy a Spring app the most common way was to generate a war file and deploy it with Tomcat. I've installed Tomcat 9. I want to generate a war file from my Springboot app. I am using Netbeans 11. which are the steps to do this? I've tried to build the app, I looked to look into the folder but there's no war to be found.</p>

答:
Just add this to generate the war file.

```<code><artifactId>artifact id</artifactId>
    <version>0.0.1-SNAPSHOT</version>
        <packaging>war</packaging>
    <name>name</name>
</code>```

I used the command mvn clean package afterwards

it will be under the target folder

Body:
Just add this to generate the war file.

<artifactId>artifact id</artifactId>
    <version>0.0.1-SNAPSHOT</version>
        <packaging>war</packaging>
    <name>name</name>

I used the command mvn clean package afterwards

it will be under the target folder


问:
What to embed the dynamic help command
So I coded a dynamic help command using the discord documentation. But to make it eye-catching, I want to embed it and display it into the users DM.
Here is a small snippet - </p>

```<code>execute(client, message, args) {
        const data = [];
        const { commands } = message.client;

        if (!args.length) {
            data.push('Here\'s a list of all my commands:'); //push on data var to append the info you want
            data.push(commands.map(command => command.name).join('\n'));
            data.push(`\nYou can send \`${prefix}help [command name]\` to get info on a specific command!`);

            return message.author.send(data, { split: true })
                .then(() => {
                    if (message.channel.type === 'dm') return;
                    message.reply('I\'ve sent you a DM with all my commands!');
                })
                .catch(error => {
                    console.error(`Could not send help DM to ${message.author.tag}.\n`, error);
                    message.reply('it seems like I can\'t DM you! Do you have DMs disabled?');
                });
        }
</code>```

<p>Is there anyway I can use data.push in an embed? </p>

答:
```<code>const embed = new Discord.MessageEmbed()
    .setTitle("Command List :")
    .setColor("GREEN")
    .setDescription(data.join(" "));
</code>```

If you think your data will be longer than 1024 characters, try doing this :

```<code>const embed = new Discord.MessageEmbed()
    .setTitle("Command List :")
    .setColor("GREEN");
var tempDesc = "";

for (let line of data) {
    if ((tempDesc + line).length < 1024) tempDesc += line
    else {
        message.channel.send(embed.setDescription(tempDesc));
        tempDesc = "";
    }
}

if (tempDesc.length > 0) message.channel.send(embed.setDescription(tempDesc));

</code>```

Title: What to embed the dynamic help command

Body:
So I coded a dynamic help command using the discord documentation. But to make it eye-catching, I want to embed it and display it into the users DM.
Here is a small snippet -

execute(client, message, args) {
        const data = [];
        const { commands } = message.client;

        if (!args.length) {
            data.push('Here\'s a list of all my commands:'); //push on data var to append the info you want
            data.push(commands.map(command => command.name).join('\n'));
            data.push(`\nYou can send \`${prefix}help [command name]\` to get info on a specific command!`);

            return message.author.send(data, { split: true })
                .then(() => {
                    if (message.channel.type === 'dm') return;
                    message.reply('I\'ve sent you a DM with all my commands!');
                })
                .catch(error => {
                    console.error(`Could not send help DM to ${message.author.tag}.\n`, error);
                    message.reply('it seems like I can\'t DM you! Do you have DMs disabled?');
                });
        }

Is there anyway I can use data.push in an embed?

Body:
const embed = new Discord.MessageEmbed()
    .setTitle("Command List :")
    .setColor("GREEN")
    .setDescription(data.join(" "));

If you think your data will be longer than 1024 characters, try doing this :

const embed = new Discord.MessageEmbed()
    .setTitle("Command List :")
    .setColor("GREEN");
var tempDesc = "";

for (let line of data) {
    if ((tempDesc + line).length < 1024) tempDesc += line
    else {
        message.channel.send(embed.setDescription(tempDesc));
        tempDesc = "";
    }
}

if (tempDesc.length > 0) message.channel.send(embed.setDescription(tempDesc));


问:
React document.removeEventListener is not working
I'm trying to make a draggable React component, and the code always manages to reach the 'removing listeners' block, but afterwards the component continues sticking to my mouse, so definitely I've screwed up the removing listeners step, though I'm not sure how--surely the two functions I've passed into document.add/removeEventListener are the same?</p>

```<code>useEffect(() => {
            if (dragging && !prevDragging) {
                document.addEventListener("mousemove", onMouseMove)
                document.addEventListener("mouseup", onMouseUp)
            } else if (!dragging && prevDragging) {
                console.log('removing listeners')
                document.removeEventListener("mousemove", onMouseMove)
                document.removeEventListener("mouseup", onMouseUp)
                }
            }
        )

 const onMouseMove = (e) => {
            if (!dragging) return;
            setPos({
                x: e.pageX - rel.x,
                y: e.pageY - rel.y
            });
        e.stopPropagation();
        e.preventDefault();
    }

const onMouseUp = (e) => {
        setDragging(false);
        e.stopPropagation();
        e.preventDefault();
    }
</code>```

答:
On each render of React component a new function is created. So if you check in your browser's developer tools for the event listeners you'll see a couple of them added after each render. So even if you remove the latest event listener, the old one's are still there.

So essentially what I am saying is that the function:-

```<code>const onMouseMove = (e) => {
            if (!dragging) return;
            setPos({
                x: e.pageX - rel.x,
                y: e.pageY - rel.y
            });
        e.stopPropagation();
        e.preventDefault();
    }
</code>```

on first render is not same as

```<code>const onMouseMove = (e) => {
            if (!dragging) return;
            setPos({
                x: e.pageX - rel.x,
                y: e.pageY - rel.y
            });
        e.stopPropagation();
        e.preventDefault();
    }
</code>```

on second render and so on. They are logically equivalent but do not refer to the same function.

Body:
I'm trying to make a draggable React component, and the code always manages to reach the 'removing listeners' block, but afterwards the component continues sticking to my mouse, so definitely I've screwed up the removing listeners step, though I'm not sure how--surely the two functions I've passed into document.add/removeEventListener are the same?

useEffect(() => {
            if (dragging && !prevDragging) {
                document.addEventListener("mousemove", onMouseMove)
                document.addEventListener("mouseup", onMouseUp)
            } else if (!dragging && prevDragging) {
                console.log('removing listeners')
                document.removeEventListener("mousemove", onMouseMove)
                document.removeEventListener("mouseup", onMouseUp)
                }
            }
        )

 const onMouseMove = (e) => {
            if (!dragging) return;
            setPos({
                x: e.pageX - rel.x,
                y: e.pageY - rel.y
            });
        e.stopPropagation();
        e.preventDefault();
    }

const onMouseUp = (e) => {
        setDragging(false);
        e.stopPropagation();
        e.preventDefault();
    }

Body:
On each render of React component a new function is created. So if you check in your browser's developer tools for the event listeners you'll see a couple of them added after each render. So even if you remove the latest event listener, the old one's are still there.

So essentially what I am saying is that the function:-

const onMouseMove = (e) => {
            if (!dragging) return;
            setPos({
                x: e.pageX - rel.x,
                y: e.pageY - rel.y
            });
        e.stopPropagation();
        e.preventDefault();
    }

on first render is not same as

const onMouseMove = (e) => {
            if (!dragging) return;
            setPos({
                x: e.pageX - rel.x,
                y: e.pageY - rel.y
            });
        e.stopPropagation();
        e.preventDefault();
    }

on second render and so on. They are logically equivalent but do not refer to the same function.


问:
Parallax effect with React
I'm trying to make a parallax effect in React and I have an error like that:

Here is my code in a JavaScript file for parallax:

```<code>  export const parallax = document.getElementsByClassName("parallax");

  window.addEventListener("scroll", function(){
    let offset = window.pageYOffset;
    console.log("offset", offset)
    parallax.style.backgroundPositionY = offset * 0.7 + "px";
  })
</code>```

And in my JSX file, I'm importing this file like that:

```<code>import parallax from './parallax'
</code>```

So when I log the offset I can see the different values but it doesn't work with parallax.style.backgroundPositionY and I don't understand why.
Your help is welcome, thanks.

答:
You have several options here. If you use your current approach, parallax will be a nodelist and depending how many nodes are inside, you would have to filter it for the correct one. If there is only one, you would only have to change your code to

```<code>  export const [parallax, ...notNeeded] = document.getElementsByClassName("parallax");
</code>```

This will assign the first element to the variable parallax and all remaining ones into notNeeded. But a better solution in this case would be to use querySelector. It will return the first node, which matches the condition:

```<code>const parallax = document.querySelector(".parallax");
</code>```

Title: Parallax effect with React

Body:
I'm trying to make a parallax effect in React and I have an error like that:

Here is my code in a JavaScript file for parallax:

  export const parallax = document.getElementsByClassName("parallax");

  window.addEventListener("scroll", function(){
    let offset = window.pageYOffset;
    console.log("offset", offset)
    parallax.style.backgroundPositionY = offset * 0.7 + "px";
  })

And in my JSX file, I'm importing this file like that:

import parallax from './parallax'

So when I log the offset I can see the different values but it doesn't work with parallax.style.backgroundPositionY and I don't understand why.
Your help is welcome, thanks.

Body:
You have several options here. If you use your current approach, parallax will be a nodelist and depending how many nodes are inside, you would have to filter it for the correct one. If there is only one, you would only have to change your code to

  export const [parallax, ...notNeeded] = document.getElementsByClassName("parallax");

This will assign the first element to the variable parallax and all remaining ones into notNeeded. But a better solution in this case would be to use querySelector. It will return the first node, which matches the condition:

const parallax = document.querySelector(".parallax");


问:
Why does my input function doesn't get input correctly?
I'm new to C. I asked this question before, I knew an error in my code, but still, it is not working.
I want to take input from the user and store it in allocated memory. ptrsptr and patientsnum are global variables. ptrsptr points to another allocated memory that stores pointers to patients' data.

```<code>  char name[51];
  int age=0;
  char agestr[3];
  char infectiondate [11];
  char address[51];
  char *patientptr;
  char **newptr;

  printf("\nEnter the patient name (50 characters at maximum): ");
  scanf ("%50s", name);

  newptr = (char**) realloc(ptrsptr, patientsnum*sizeof(char *));
  if (newptr) ptrsptr = newptr;
  else
  {
    patientsnum --;
    printf ("Not enough memory.\n");
    return;
  }

  patientptr = (char*) calloc (118, sizeof (char)); // allocation after being sure patient doesn't exist
  if (!patientptr)
  {
    patientsnum --;
    printf ("Not enough memory.\n");
    return;
  }

  strcpy(patientptr, name);

  printf("Enter the patient age: ");
  scanf ("%d", &age);
  sprintf (agestr, "%2d", age);
  strcpy((patientptr + 51),agestr);

  printf("Enter the patient date of infection (in form of dd/mm/year): ");
  scanf ("%10d", infectiondate);
  strcpy((patientptr + 54),infectiondate);

  printf("Enter the patient address (50 characters at maximum): ");
  scanf ("%50s", address);
  strcpy((patientptr + 65),address);

  *(ptrsptr+patientsnum-1) = patientptr;

  printf ("\nPatient added succesfully.\n");
}
</code>```

The output is:

```<code>Enter the patient name (50 characters at maximum): John
Enter the patient age: 20
Enter the patient date of infection (in form of dd/mm/year): 20/10/2019
Enter the patient address (50 characters at maximum):
Patient added succesfully.
</code>```

I can't input the address. What is wrong?

答: Well, it looks I am still a beginner that doesn't know much about scanf. But, it looks the error was putting some integer into char string.

Body:
I'm new to C. I asked this question before, I knew an error in my code, but still, it is not working.
I want to take input from the user and store it in allocated memory. ptrsptr and patientsnum are global variables. ptrsptr points to another allocated memory that stores pointers to patients' data.

  char name[51];
  int age=0;
  char agestr[3];
  char infectiondate [11];
  char address[51];
  char *patientptr;
  char **newptr;

  printf("\nEnter the patient name (50 characters at maximum): ");
  scanf ("%50s", name);

  newptr = (char**) realloc(ptrsptr, patientsnum*sizeof(char *));
  if (newptr) ptrsptr = newptr;
  else
  {
    patientsnum --;
    printf ("Not enough memory.\n");
    return;
  }

  patientptr = (char*) calloc (118, sizeof (char)); // allocation after being sure patient doesn't exist
  if (!patientptr)
  {
    patientsnum --;
    printf ("Not enough memory.\n");
    return;
  }

  strcpy(patientptr, name);

  printf("Enter the patient age: ");
  scanf ("%d", &age);
  sprintf (agestr, "%2d", age);
  strcpy((patientptr + 51),agestr);

  printf("Enter the patient date of infection (in form of dd/mm/year): ");
  scanf ("%10d", infectiondate);
  strcpy((patientptr + 54),infectiondate);

  printf("Enter the patient address (50 characters at maximum): ");
  scanf ("%50s", address);
  strcpy((patientptr + 65),address);

  *(ptrsptr+patientsnum-1) = patientptr;

  printf ("\nPatient added succesfully.\n");
}

The output is:

Enter the patient name (50 characters at maximum): John
Enter the patient age: 20
Enter the patient date of infection (in form of dd/mm/year): 20/10/2019
Enter the patient address (50 characters at maximum):
Patient added succesfully.

I can't input the address. What is wrong?


问:
Why are my box plots narrow when I colour them with plotly?
I am trying to plot the data I have stored in a pandas DataFrame using plotly.express as a box plot. The df looks like the following:

This is my code for making the basic boxplot graph in plotly:

```<code>import plotly.express as px

fig = px.box(df1, x="Condition",
             y="Number of Groups")
fig.show()
</code>```

Giving as a result the kind of graph I was looking for:

Now, I wanna color each condition in a different color for what I use:

```<code>import plotly.express as px

fig = px.box(df1, x="Condition",
             y="Number of Groups",
             color="Condition")
fig.show()
</code>```

Giving me this graph in which now the box plots are much narrower than normal. Does anybody knows how to avoid this? Thanks

答: This is a bug which has been fixed in version 4.8 of plotly and a workaround for versions below that is to add boxmode="overlay" inside the px.box() call when color is set to the same value as x. And I should add that the same applies to px.violin and px.strip plots with violinmode and stripmode, respectively :)

Body:
I am trying to plot the data I have stored in a pandas DataFrame using plotly.express as a box plot. The df looks like the following:

This is my code for making the basic boxplot graph in plotly:

import plotly.express as px

fig = px.box(df1, x="Condition",
             y="Number of Groups")
fig.show()

Giving as a result the kind of graph I was looking for:

Now, I wanna color each condition in a different color for what I use:

import plotly.express as px

fig = px.box(df1, x="Condition",
             y="Number of Groups",
             color="Condition")
fig.show()

Giving me this graph in which now the box plots are much narrower than normal. Does anybody knows how to avoid this? Thanks


问:
how to get "(8am - 5pm)" from the given string "Delivery Time (8am - 5pm)" in a best possible way in javascript?
How to get

```<code>(8am - 5pm)
</code>```

from the given string

```<code>Delivery Time (8am - 5pm)
</code>```

in a best possible way in JavaScript?

答:
```<code>"your string with the words and range (8am - 6pm)".replace(/.*\(/, "(")
</code>```

Should replace everything up to the last (.

Body:
How to get

(8am - 5pm)

from the given string

Delivery Time (8am - 5pm)

in a best possible way in JavaScript?

Body:
"your string with the words and range (8am - 6pm)".replace(/.*\(/, "(")

Should replace everything up to the last (.


问:
Problem of large size of .apk file in android?
I have a problem that arise due to large size and no. of images in app, my app stopped installing on emulator. It gives an error report " No Space Left". Size of .apk file is about 60MB. Now, I would like to ask the following questions:

What could be done in this situation, so that it gets installed and doesn't gives this error?

Does android market allow to install app of this size?

Thanks in advance

答:
The limitation of android market now is 50MB.
What you can do is out some resources on the server and download them on demand. You can promt the user that the app is going to download large amount of data, so that user can use wifi to do it.</p>


问:
Unable to access content of API made in apps-script
I tried to make an API using apps-script doGet() function.
I am able access the content of this API on my browser using appropriate authentication steps but am unable to access the same using another apps-script project.

The API looks as follows and is published as web app.

function doGet(request){
  var parameters = request.parameters;
  var request_id = parameters.id;
  var response_obj = getObjectById(request_id);
  return ContentService.createTextOutput(JSON.stringify(response_obj)).setMimeType(ContentService.MimeType.JSON);
}```
</div>
</div>
</p>

<p>and request is simply made using</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const content = UrlFetchApp(url).getContentText();</code>```

is there a fundamental mistake or is there an authentication procedure that can be carried out so as to access this content

Answer found thanks for the help guys

what i needed was an authentication procedure and apps-script is very generous with that

refer Using AuthToken obtained via ScriptApp.getAuthToken() to call web apps in GAS

I was able to implement the solution using the following snippet for authentication

var token = ScriptApp.getOAuthToken();
  var header = {"Authorization":"Bearer " + token};
  var options = {
    "method":"GET",
    "headers": header,
    "muteHttpExceptions": true
  };
const content =UrlFetchApp.fetch(url, options).getContentText();```

答:
The line

const content = UrlFetchApp(url).getTextContent();

should be

const content = UrlFetchApp.fetch(url).getContentText();

See the documentation for UrlFetchApp here.

Body:
I tried to make an API using apps-script doGet() function.
I am able access the content of this API on my browser using appropriate authentication steps but am unable to access the same using another apps-script project.

The API looks as follows and is published as web app.

function doGet(request){
  var parameters = request.parameters;
  var request_id = parameters.id;
  var response_obj = getObjectById(request_id);
  return ContentService.createTextOutput(JSON.stringify(response_obj)).setMimeType(ContentService.MimeType.JSON);
}

and request is simply made using

const content = UrlFetchApp(url).getContentText();

is there a fundamental mistake or is there an authentication procedure that can be carried out so as to access this content

Answer found thanks for the help guys

what i needed was an authentication procedure and apps-script is very generous with that

refer Using AuthToken obtained via ScriptApp.getAuthToken() to call web apps in GAS

I was able to implement the solution using the following snippet for authentication

var token = ScriptApp.getOAuthToken();
  var header = {"Authorization":"Bearer " + token};
  var options = {
    "method":"GET",
    "headers": header,
    "muteHttpExceptions": true
  };
const content =UrlFetchApp.fetch(url, options).getContentText();


问:
FInd .closest() fails
I have trouble understanding whys something like this wont work.
I have read jquery and W3 documentation and I don't see the mistake.

Code should look for a link and highlight the closest button.

The structure is simple:

$('#meni').find('a').each(function() {
console.log(this);
      $(this).closest("button").css("color","red !important");
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="meni">
     <button>button</button>
     <div>
         <a>link1</a>
         <a>link2</a>
         <a>link3</a>
     </div>
 </div></code>```

Also to note it this is part of bigger code, and the actual this-link will be in conditioned and return only one, so problem is not in that it sees multiple.

```<code>  var loc= window.location.href;
  //console.log(loc);

values=loc.split('/');
link=values[values.length-1];
//console.log(link);

    $('#meni').find('a').each(function() {
    //console.log($(this).attr('href').indexOf(link) >= 0);
    if ($(this).attr('href').indexOf(link) >= 0) {
      $(this).css({"color":"#87CEEB !important" , "font-weight":"bold" });
      $(this).closest("button").css({"color":"#87CEEB !important" , "font-weight":"bold", "border-bottom": "1px solid" });
    }
});
</code>```

答:
Check this

$('#meni').find('a').each(function() {
      $(this).parent('div').siblings("button").css("color","red");
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="meni">
     <button>button</button>
     <div>
         <a>link1</a>
         <a>link2</a>
         <a>link3</a>
     </div>
 </div></code>```

Title: FInd .closest() fails

Body:
I have trouble understanding whys something like this wont work.
I have read jquery and W3 documentation and I don't see the mistake.

Code should look for a link and highlight the closest button.

The structure is simple:

$('#meni').find('a').each(function() {
console.log(this);
      $(this).closest("button").css("color","red !important");
});

     <button>button</button>

         link1
         link2
         link3

Also to note it this is part of bigger code, and the actual this-link will be in conditioned and return only one, so problem is not in that it sees multiple.

  var loc= window.location.href;
  //console.log(loc);

values=loc.split('/');
link=values[values.length-1];
//console.log(link);

    $('#meni').find('a').each(function() {
    //console.log($(this).attr('href').indexOf(link) >= 0);
    if ($(this).attr('href').indexOf(link) >= 0) {
      $(this).css({"color":"#87CEEB !important" , "font-weight":"bold" });
      $(this).closest("button").css({"color":"#87CEEB !important" , "font-weight":"bold", "border-bottom": "1px solid" });
    }
});

Body:
Check this

$('#meni').find('a').each(function() {
      $(this).parent('div').siblings("button").css("color","red");
});

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="meni">
     <button>button</button>
     <div>
         <a>link1</a>
         <a>link2</a>
         <a>link3</a>
     </div>
 </div>


问:
Adding custom scrollbars to vuetify data tables
I am trying to add perfect-scrollbar to vuetify's data tables. So I have to wrap the data table inside the perfect-scrollbar component like this -

```<code><perfect-scrollbar>
  <v-data-table :headers="headers" :items="data" />
</perfect-scrollbar>
</code>```

The problem is that its also wrapping the data-table footer. I want to wrap only the data of table within perfect-scrollbar component. So that only data is scrollable and footer remains there.

Now it looks like this -

答:
Actually no need to use perfect-scrollbar here.
You just set the height to v-data-table. Then the component automatically sets the scroll bar.

As the example,

```<code><v-data-table :headers="headers" :items="data" height="200px"/>
</code>```

Try with it.

Body:
I am trying to add perfect-scrollbar to vuetify's data tables. So I have to wrap the data table inside the perfect-scrollbar component like this -

<perfect-scrollbar>
  <v-data-table :headers="headers" :items="data" />
</perfect-scrollbar>

The problem is that its also wrapping the data-table footer. I want to wrap only the data of table within perfect-scrollbar component. So that only data is scrollable and footer remains there.

Now it looks like this -

Body:
Actually no need to use perfect-scrollbar here.
You just set the height to v-data-table. Then the component automatically sets the scroll bar.

As the example,

<v-data-table :headers="headers" :items="data" height="200px"/>

Try with it.


问:
Using For Loop to create a List to then export with Pandas to Excel
Good Morning,

I've been working on this for about 3 days now.  I need some help.

I'm using BeautifulSoup to allow me to parse it.  Everything I'm doing works all the way down to:

```<code>df = pd.DataFrame({'Name':[Var1]})
df.append([Var1], ignore_index=False)
df.to_excel(writer, sheet_name='Names', index=False, header=True, startrow=start_row)
</code>```

I'm grabbing a total of X variables and stripping them. It could be 3, it could be 100. What I would like to do is grab them and write them to an excel sheet formatted so:

Name

Var1

Var1

Var1

Var1

The problem I'm running into is that it only writes the last entry, even though I can use:

```<code>print(df)
</code>```

and see 10 entries.

Which is why I think maybe a list would make it easier.  If I could figure out how to iterate through the for loop and create a list where list=[Var1, Var1, Var1...]I could then just throw that list into the:

```<code>df = pd.DataFrame({'Name':[Var1]})
</code>```

Although looking at it now it might not work.

```<code>import requests
import sys
import re
import pandas as pd
from bs4 import BeautifulSoup

page = requests.get('https://thisisanexampleurl.com')

soup = BeautifulSoup(page.text, 'html.parser')

start_row = 0

writer = pd.ExcelWriter('my_excel_sheet.xlsx', engine='openpyxl')

for link in soup.find_all('h3'):

    Var1 = link.get_text() #grabbing a header string with a Name in it
    Var1 = Var1.strip() #stripping out leading/ending spaces because there's a ton

    df = pd.DataFrame({'Name':[Var1]})
    df.append([Var1], ignore_index=False)
    df.to_excel(writer, sheet_name='Names', index=False, header=True, startrow=start_row)
</code>```

I'm terrible at this I realize, but I appreciate any and all help.

Thank you so much.

答:
You need to put each Var1 that you get in each iteration of the for link in soup... loop inside a structure (like a list) and only after the loop is done you transform that list into a DataFrame and write it to Excel. Otherwise, each call to df.to_excel simply overwrites the same excel file over and over, and you only see the last file that has been written.

For example:

```<code>vars_list = []
for link in soup.find_all('h3'):
    Var1 = link.get_text() #grabbing a header string with a Name in it
    Var1 = Var1.strip() #stripping out leading/ending spaces because there's a ton
    vars_list.append(Var1)

df = pd.DataFrame({'Name': vars_list})
df.to_excel(writer, sheet_name='Names', index=False, header=True, startrow=start_row)
</code>```

Also, writing df = pd.DataFrame({'Name':[Var1]}) simply creates a dataframe with a single column Name and a single row containing Var1. Even though you could initialize a DataFrame and append to it with each iteration, the fact that you write df = pd.DataFrame... inside your for loop effectively means that your DataFrame is overwritten in each iteration.

Body:
Good Morning,

I've been working on this for about 3 days now.  I need some help.

I'm using BeautifulSoup to allow me to parse it.  Everything I'm doing works all the way down to:

df = pd.DataFrame({'Name':[Var1]})
df.append([Var1], ignore_index=False)
df.to_excel(writer, sheet_name='Names', index=False, header=True, startrow=start_row)

I'm grabbing a total of X variables and stripping them. It could be 3, it could be 100. What I would like to do is grab them and write them to an excel sheet formatted so:

Name

Var1

Var1

Var1

Var1

The problem I'm running into is that it only writes the last entry, even though I can use:

print(df)

and see 10 entries.

Which is why I think maybe a list would make it easier.  If I could figure out how to iterate through the for loop and create a list where list=[Var1, Var1, Var1...]I could then just throw that list into the:

df = pd.DataFrame({'Name':[Var1]})

Although looking at it now it might not work.

import requests
import sys
import re
import pandas as pd
from bs4 import BeautifulSoup

page = requests.get('https://thisisanexampleurl.com')

soup = BeautifulSoup(page.text, 'html.parser')

start_row = 0

writer = pd.ExcelWriter('my_excel_sheet.xlsx', engine='openpyxl')

for link in soup.find_all('h3'):

    Var1 = link.get_text() #grabbing a header string with a Name in it
    Var1 = Var1.strip() #stripping out leading/ending spaces because there's a ton

    df = pd.DataFrame({'Name':[Var1]})
    df.append([Var1], ignore_index=False)
    df.to_excel(writer, sheet_name='Names', index=False, header=True, startrow=start_row)

I'm terrible at this I realize, but I appreciate any and all help.

Thank you so much.

Body:
You need to put each Var1 that you get in each iteration of the for link in soup... loop inside a structure (like a list) and only after the loop is done you transform that list into a DataFrame and write it to Excel. Otherwise, each call to df.to_excel simply overwrites the same excel file over and over, and you only see the last file that has been written.

For example:

vars_list = []
for link in soup.find_all('h3'):
    Var1 = link.get_text() #grabbing a header string with a Name in it
    Var1 = Var1.strip() #stripping out leading/ending spaces because there's a ton
    vars_list.append(Var1)

df = pd.DataFrame({'Name': vars_list})
df.to_excel(writer, sheet_name='Names', index=False, header=True, startrow=start_row)

Also, writing df = pd.DataFrame({'Name':[Var1]}) simply creates a dataframe with a single column Name and a single row containing Var1. Even though you could initialize a DataFrame and append to it with each iteration, the fact that you write df = pd.DataFrame... inside your for loop effectively means that your DataFrame is overwritten in each iteration.


问:
How to save the output of multiple confusionMatrix to single csv file in r?
I have calculated confusionMatrix() for multiple stations using following code

```<code>    library(tidyverse)
    result <- df %>%
      xtabs( ~ Observed + Forecasted + Station, data =.) %>%
      array_tree(.,margin=3) %>%
      map(~caret::confusionMatrix(as.table(.x)))
</code>```

Then I have tried to calculate different confusion matrix based indices using the following code

```<code>    as.matrix(result, what = "classes")
    as.matrix(result, what = "overall")
</code>```

which returns:

```<code>   #>          [,1]
   #> Aizawl   List,6
   #> Serchhip List,6
</code>```

My question is how can I write the output to a .csv file?

Below is some sample data to help illustrate my problem:

```<code>    df = structure(list(Station = c("Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip"
    ), Observed = c(1, 1, 1, 5, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1,
    1, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 3, 3, 4, 1, 1, 4, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    4, 4, 4, 3, 4, 1, 1, 1, 1, 1, 3, 5, 5, 5, 3, 1, 1, 3, 1, 1, 1,
    1, 1, 5, 3, 4, 1, 1, 1, 1, 1, 3, 1, 4, 1, 1, 1, 1, 1, 4, 4, 5,
    1, 5, 4, 5, 5, 5, 5, 1, 5, 1, 4, 5, 4, 4, 5, 4, 5, 5, 3, 1, 5,
    3, 4, 3, 4, 5, 5, 5, 5, 4, 4, 5, 4, 4, 5, 5, 5, 5, 4, 5, 5, 5,
    5, 5, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 3, 5, 5, 1, 1, 3, 4, 1, 1, 1, 1, 1, 1, 1, 1,
    3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 3,
    3, 3, 1, 1, 1, 1, 1, 1, 1, 4, 4, 1, 3, 4, 1, 1, 1, 1, 1, 1, 1,
    1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 3,
    6, 5, 5, 4, 1, 5, 1, 1, 1, 1, 4, 5, 5, 5, 5, 5, 5, 1, 1, 4, 1,
    4, 4, 4, 5, 1, 1, 4, 3, 5, 4, 5, 5, 5, 5, 5, 4, 4, 4, 4, 5, 1,
    6, 5, 5), Forecasted = c(1, 1, 1, 5, 5, 1, 1, 1, 5, 5, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 5, 5, 5, 5, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 5, 5, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 4, 4, 1, 1, 5, 3, 1,
    1, 1, 4, 5, 5, 5, 5, 1, 1, 1, 5, 5, 1, 5, 5, 5, 4, 5, 4, 4, 4,
    3, 4, 4, 1, 1, 5, 5, 4, 4, 4, 1, 1, 1, 4, 4, 4, 4, 4, 4, 1, 1,
    5, 4, 4, 5, 4, 4, 4, 4, 5, 4, 5, 5, 5, 5, 5, 4, 5, 5, 4, 1, 1,
    4, 4, 5, 5, 5, 5, 1, 4, 5, 5, 1, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5,
    5, 5, 5, 5, 5, 5, 1, 1, 1, 5, 4, 1, 1, 1, 5, 4, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 5, 5, 5, 6, 5, 5, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 5, 5, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 5, 5, 4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 4, 4, 4, 1, 4, 1, 3,
    1, 1, 1, 4, 4, 4, 4, 4, 4, 1, 1, 1, 4, 4, 3, 5, 5, 5, 4, 3, 5,
    5, 5, 5, 5, 4, 5, 5, 5, 4, 5, 4, 4, 5, 5, 4, 4, 5, 4, 1, 4, 4,
    5, 5, 4, 5, 4, 5, 4, 5, 5, 5, 1, 4, 5, 5, 5, 4, 5, 5, 5, 5, 5,
    5, 5, 5, 5, 5, 6)), row.names = c(NA, 333L), class = "data.frame")
</code>```

Thank you in advance for any help you are able to provide!

答:
The problem with using the as.matrix() function in this example is you're creating a list of lists.  Instead of:

```<code>as.matrix(result, what = "classes")
as.matrix(result, what = "overall")
</code>```

try creating data frames to house your results which you can populate by iterating through your original result list.  The code below should do the trick.

```<code>## iterate through all six parts of the confusionMatrix: "positive", "table", "overall", "byClass", "mode", "dots"
for(i in 1:length(names(result[[1]]))){
  ##create a data frame to house the data for export
  data <- data.frame()
  ## iterate through all results; in the example we have Aizawl" and "Serchhip"
  for(j in 1:length(names(result))){
    ## load the data into a data frame
    df <- data.frame(result[[j]][i])
    ## if data is empty no need to alter or append to data frame so skip to next
    if(nrow(df)==0){next}
    ## add a name column for identifying between result sets; in the example we have Aizawl" and "Serchhip"
    df$name <- names(result)[j]
    ## append the loaded data to the data frame for export
    data <- rbind(data, df)
  }
  ## if data is empty no need to export, therefore skip to next
  if(nrow(data)==0){next}
  ## write the data to a csv with the name of the part of the condusionMatrix it contains
  ## row.names changed to TRUE based on OP's comments
  write.csv(data, file = paste0(names(result[[1]])[i],".csv"), row.names = TRUE, na = "")
}
</code>```

Unless, you'd like you can transform the data frames before using the write.csv() function.  In which case you can use

```<code>for(i in 1:length(names(result[[1]]))){
  data <- data.frame()
  for(j in 1:length(names(result))){
    df <- data.frame(result[[j]][i])
    if(nrow(df)==0){next}
    df$name <- names(result)[j]
    data <- rbind(data, df)
  }
  if(nrow(data)==0){next}
  assign(names(result[[1]])[i], data)
}
</code>```

Body:
I have calculated confusionMatrix() for multiple stations using following code

    library(tidyverse)
    result <- df %>%
      xtabs( ~ Observed + Forecasted + Station, data =.) %>%
      array_tree(.,margin=3) %>%
      map(~caret::confusionMatrix(as.table(.x)))

Then I have tried to calculate different confusion matrix based indices using the following code

    as.matrix(result, what = "classes")
    as.matrix(result, what = "overall")

which returns:

   #>          [,1]
   #> Aizawl   List,6
   #> Serchhip List,6

My question is how can I write the output to a .csv file?

Below is some sample data to help illustrate my problem:

    df = structure(list(Station = c("Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl", "Aizawl",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip",
    "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip", "Serchhip"
    ), Observed = c(1, 1, 1, 5, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1,
    1, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 3, 3, 4, 1, 1, 4, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    4, 4, 4, 3, 4, 1, 1, 1, 1, 1, 3, 5, 5, 5, 3, 1, 1, 3, 1, 1, 1,
    1, 1, 5, 3, 4, 1, 1, 1, 1, 1, 3, 1, 4, 1, 1, 1, 1, 1, 4, 4, 5,
    1, 5, 4, 5, 5, 5, 5, 1, 5, 1, 4, 5, 4, 4, 5, 4, 5, 5, 3, 1, 5,
    3, 4, 3, 4, 5, 5, 5, 5, 4, 4, 5, 4, 4, 5, 5, 5, 5, 4, 5, 5, 5,
    5, 5, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 3, 5, 5, 1, 1, 3, 4, 1, 1, 1, 1, 1, 1, 1, 1,
    3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 3,
    3, 3, 1, 1, 1, 1, 1, 1, 1, 4, 4, 1, 3, 4, 1, 1, 1, 1, 1, 1, 1,
    1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 3,
    6, 5, 5, 4, 1, 5, 1, 1, 1, 1, 4, 5, 5, 5, 5, 5, 5, 1, 1, 4, 1,
    4, 4, 4, 5, 1, 1, 4, 3, 5, 4, 5, 5, 5, 5, 5, 4, 4, 4, 4, 5, 1,
    6, 5, 5), Forecasted = c(1, 1, 1, 5, 5, 1, 1, 1, 5, 5, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 5, 5, 5, 5, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 5, 5, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 4, 4, 1, 1, 5, 3, 1,
    1, 1, 4, 5, 5, 5, 5, 1, 1, 1, 5, 5, 1, 5, 5, 5, 4, 5, 4, 4, 4,
    3, 4, 4, 1, 1, 5, 5, 4, 4, 4, 1, 1, 1, 4, 4, 4, 4, 4, 4, 1, 1,
    5, 4, 4, 5, 4, 4, 4, 4, 5, 4, 5, 5, 5, 5, 5, 4, 5, 5, 4, 1, 1,
    4, 4, 5, 5, 5, 5, 1, 4, 5, 5, 1, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5,
    5, 5, 5, 5, 5, 5, 1, 1, 1, 5, 4, 1, 1, 1, 5, 4, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 5, 5, 5, 6, 5, 5, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 5, 5, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 5, 5, 4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 4, 4, 4, 1, 4, 1, 3,
    1, 1, 1, 4, 4, 4, 4, 4, 4, 1, 1, 1, 4, 4, 3, 5, 5, 5, 4, 3, 5,
    5, 5, 5, 5, 4, 5, 5, 5, 4, 5, 4, 4, 5, 5, 4, 4, 5, 4, 1, 4, 4,
    5, 5, 4, 5, 4, 5, 4, 5, 5, 5, 1, 4, 5, 5, 5, 4, 5, 5, 5, 5, 5,
    5, 5, 5, 5, 5, 6)), row.names = c(NA, 333L), class = "data.frame")

Thank you in advance for any help you are able to provide!

Body:
The problem with using the as.matrix() function in this example is you're creating a list of lists.  Instead of:

as.matrix(result, what = "classes")
as.matrix(result, what = "overall")

try creating data frames to house your results which you can populate by iterating through your original result list.  The code below should do the trick.

## iterate through all six parts of the confusionMatrix: "positive", "table", "overall", "byClass", "mode", "dots"
for(i in 1:length(names(result[[1]]))){
  ##create a data frame to house the data for export
  data <- data.frame()
  ## iterate through all results; in the example we have Aizawl" and "Serchhip"
  for(j in 1:length(names(result))){
    ## load the data into a data frame
    df <- data.frame(result[[j]][i])
    ## if data is empty no need to alter or append to data frame so skip to next
    if(nrow(df)==0){next}
    ## add a name column for identifying between result sets; in the example we have Aizawl" and "Serchhip"
    df$name <- names(result)[j]
    ## append the loaded data to the data frame for export
    data <- rbind(data, df)
  }
  ## if data is empty no need to export, therefore skip to next
  if(nrow(data)==0){next}
  ## write the data to a csv with the name of the part of the condusionMatrix it contains
  ## row.names changed to TRUE based on OP's comments
  write.csv(data, file = paste0(names(result[[1]])[i],".csv"), row.names = TRUE, na = "")
}

Unless, you'd like you can transform the data frames before using the write.csv() function.  In which case you can use

for(i in 1:length(names(result[[1]]))){
  data <- data.frame()
  for(j in 1:length(names(result))){
    df <- data.frame(result[[j]][i])
    if(nrow(df)==0){next}
    df$name <- names(result)[j]
    data <- rbind(data, df)
  }
  if(nrow(data)==0){next}
  assign(names(result[[1]])[i], data)
}


问:
Manipulating position of child div inside parent div and the problems they entail
I wanna position the h1 and button at around bottom: 40% and left: 20% i.e hovering over the bottom left side of the parent div(id="head). Using display: abolute; and positioning tags makes them go outside the screen when the screen size is changed. Is there any other way other than positiong method or without using flex or grid cause i have another div which gets affected when i change display to flex/grid. Thank You.

*{
    margin: 0;
    padding: 0;
}

body{
    background: #888;
    color: #fff;
    line-height: 1.5;
    font-family: 'Work Sans', sans-serif;
    overflow: hidden;
}

.button{
    font-size: 1.5rem;
    text-decoration: none;
    color: #fff;
    border: #fff 3px solid;
    padding: 1.3rem 2.3rem;
    border-radius: 10px;
    margin-top: 2.2rem;
    margin-left: 3rem;
    transition: all 0.6s ease;
}

.button:hover{
    font-size: 1.7rem;
    border: black 3px solid;
}

#head{
    position: relative;
    /* background-image: url(/images/snow-capped-mountains-under-the-cloudy-skies-1054289.jpg); */
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    height: 100vh;
    overflow: hidden;
}

#head .show-top {
    width: 90%;
    margin: auto;
    text-align: right;
    padding: 1.5rem;
    font-size: 1.2rem;
}

.show-top li{
    display: inline;
    padding: 0 1rem;
}

.show-top a{
    text-decoration: none;
    color: #333;
}

#head .showcase{
    position: absolute;
    top: 65%;
    left: 20%;
    transform: translate(-50%, -50%);
}

#head .showcase h1{
    font-weight: bold;
    font-size: 5rem;
    /* padding: 2rem; */
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="style.css">
    <link href="https://fonts.googleapis.com/css2?family=Work+Sans&display=swap" rel="stylesheet">
    <title>Document</title>
</head>

<body>
    <header id="head" style="border: violet 5px solid;">
        <div class="show-top">
            <ul>
                <li>ABOUT</li>
                <li>PROGRAMS</li>
                <li>SPECIALS</li>
            </ul>
        </div>

        <div class="showcase" style="border: turquoise 5px solid;">
            <h1>Take a step</h1>
            Enter
        </div>

    </header>
</body>

</html></code>```

答:
One solution is using margin:

*{
  margin: 0;
  padding: 0;
}

body{
  background: #888;
  color: #fff;
  line-height: 1.5;
  font-family: 'Work Sans', sans-serif;
  overflow: hidden;
}

.button{
  font-size: 1.5rem;
  text-decoration: none;
  color: #fff;
  border: #fff 3px solid;
  padding: 1.3rem 2.3rem;
  border-radius: 10px;
  margin-top: 2.2rem;
  margin-left: 3rem;
  transition: all 0.6s ease;
}

.button:hover{
  font-size: 1.7rem;
  border: black 3px solid;
}

#head{
  position: relative;
  /* background-image: url(/images/snow-capped-mountains-under-the-cloudy-skies-1054289.jpg); */
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  height: 100vh;
  overflow: hidden;
}

#head .show-top {
  width: 90%;
  margin: auto;
  text-align: right;
  padding: 1.5rem;
  font-size: 1.2rem;
}

.show-top li{
  display: inline;
  padding: 0 1rem;
}

.show-top a{
  text-decoration: none;
  color: #333;
}

#head .showcase{
  margin-top: 20%;
  margin-left: 40%;
  transform: translate(-50%, -50%);

}

#head .showcase h1{
  font-weight: bold;
  font-size: 5rem;
  /* padding: 2rem; */
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="style.css">
    <link href="https://fonts.googleapis.com/css2?family=Work+Sans&display=swap" rel="stylesheet">
    <title>Document</title>
</head>

<body>
    <header id="head" style="border: violet 5px solid;">
        <div class="show-top">
            <ul>
                <li>ABOUT</li>
                <li>PROGRAMS</li>
                <li>SPECIALS</li>
            </ul>
        </div>

        <div class="showcase" style="border: turquoise 5px solid;">
            <h1>Take a step</h1>
            Enter
        </div>

    </header>
</body>

</html></code>```

Body:
I wanna position the h1 and button at around bottom: 40% and left: 20% i.e hovering over the bottom left side of the parent div(id="head). Using display: abolute; and positioning tags makes them go outside the screen when the screen size is changed. Is there any other way other than positiong method or without using flex or grid cause i have another div which gets affected when i change display to flex/grid. Thank You.

*{
    margin: 0;
    padding: 0;
}

body{
    background: #888;
    color: #fff;
    line-height: 1.5;
    font-family: 'Work Sans', sans-serif;
    overflow: hidden;
}

.button{
    font-size: 1.5rem;
    text-decoration: none;
    color: #fff;
    border: #fff 3px solid;
    padding: 1.3rem 2.3rem;
    border-radius: 10px;
    margin-top: 2.2rem;
    margin-left: 3rem;
    transition: all 0.6s ease;
}

.button:hover{
    font-size: 1.7rem;
    border: black 3px solid;
}

#head{
    position: relative;
    /* background-image: url(/images/snow-capped-mountains-under-the-cloudy-skies-1054289.jpg); */
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    height: 100vh;
    overflow: hidden;
}

#head .show-top {
    width: 90%;
    margin: auto;
    text-align: right;
    padding: 1.5rem;
    font-size: 1.2rem;
}

.show-top li{
    display: inline;
    padding: 0 1rem;
}

.show-top a{
    text-decoration: none;
    color: #333;
}

#head .showcase{
    position: absolute;
    top: 65%;
    left: 20%;
    transform: translate(-50%, -50%);
}

#head .showcase h1{
    font-weight: bold;
    font-size: 5rem;
    /* padding: 2rem; */
}

<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="style.css">
    <link href="https://fonts.googleapis.com/css2?family=Work+Sans&display=swap" rel="stylesheet">
    <title>Document</title>

ABOUT

PROGRAMS

SPECIALS

Take a step

            Enter

Body:
One solution is using margin:

*{
  margin: 0;
  padding: 0;
}

body{
  background: #888;
  color: #fff;
  line-height: 1.5;
  font-family: 'Work Sans', sans-serif;
  overflow: hidden;
}

.button{
  font-size: 1.5rem;
  text-decoration: none;
  color: #fff;
  border: #fff 3px solid;
  padding: 1.3rem 2.3rem;
  border-radius: 10px;
  margin-top: 2.2rem;
  margin-left: 3rem;
  transition: all 0.6s ease;
}

.button:hover{
  font-size: 1.7rem;
  border: black 3px solid;
}

#head{
  position: relative;
  /* background-image: url(/images/snow-capped-mountains-under-the-cloudy-skies-1054289.jpg); */
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  height: 100vh;
  overflow: hidden;
}

#head .show-top {
  width: 90%;
  margin: auto;
  text-align: right;
  padding: 1.5rem;
  font-size: 1.2rem;
}

.show-top li{
  display: inline;
  padding: 0 1rem;
}

.show-top a{
  text-decoration: none;
  color: #333;
}

#head .showcase{
  margin-top: 20%;
  margin-left: 40%;
  transform: translate(-50%, -50%);

}

#head .showcase h1{
  font-weight: bold;
  font-size: 5rem;
  /* padding: 2rem; */
}

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="style.css">
    <link href="https://fonts.googleapis.com/css2?family=Work+Sans&display=swap" rel="stylesheet">
    <title>Document</title>
</head>

<body>
    <header id="head" style="border: violet 5px solid;">
        <div class="show-top">
            <ul>
                <li><a href="#">ABOUT</a></li>
                <li><a href="#">PROGRAMS</a></li>
                <li><a href="#">SPECIALS</a></li>
            </ul>
        </div>

        <div class="showcase" style="border: turquoise 5px solid;">
            <h1>Take a step</h1>
            <a href="#" class="button">Enter</a>
        </div>

    </header>
</body>

</html>


问:
Where is android studio building my .apk file?
I've been rebuilding my project from the ground up, so there's been a lot of problems with it. At the moment, everything's working great, except that when I try to run the app, I get the message 'Local path doesn't exist.', where the local path is pointing at the path: AndroidStudioProjects\MyProject\MyProject..\build\production\MyProject.apk, and true enough, there is no .apk file at that location, or indeed anywhere else in the project filesystem.

However, I can build the app with no problems, and running gradlew packageDebug gives me the message 'build successful', so .apks should be being generated. My question is, where are they going, or if they aren't being generated, why not?

Where is the build path of each module set? I'm somewhat confused because the Project Structure->Facets->Android->Compiler settings, Project Structure->Modules->Paths->Compiler Output, build.gradle, and MyProject.iml all seem to have something to do with the build path, but I don't quite understand how they relate

edit: I know where it should be, but it's not there so I want to know how to change the build path

edit 2: For some reason running gradlew build does create .apks, but not building or running from inside the program

edit 3: Here's my gradlew build output, note that it does build successfully:

```<code>Creating properties on demand (a.k.a. dynamic properties) has been deprecated and is scheduled to be removed in Gradle 2.0. Please read http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html for information on the replacement for dynamic properties.
Deprecated dynamic property: "target" on "com.android.build.gradle.LibraryExtension_Decorated@9e9aabc", value: "android-16".
:TwoWayLib:mergeReleaseProguardFiles UP-TO-DATE
:TwoWayLib:packageReleaseAidl UP-TO-DATE
:TwoWayLib:prepareReleaseDependencies
:TwoWayLib:compileReleaseAidl UP-TO-DATE
:TwoWayLib:generateReleaseBuildConfig UP-TO-DATE
:TwoWayLib:mergeReleaseAssets UP-TO-DATE
:TwoWayLib:compileReleaseRenderscript UP-TO-DATE
:TwoWayLib:mergeReleaseResources UP-TO-DATE
:TwoWayLib:processReleaseManifest UP-TO-DATE
:TwoWayLib:processReleaseResources UP-TO-DATE
:TwoWayLib:compileRelease UP-TO-DATE
:TwoWayLib:processReleaseJavaRes UP-TO-DATE
:TwoWayLib:packageReleaseJar UP-TO-DATE
:TwoWayLib:packageReleaseLocalJar UP-TO-DATE
:TwoWayLib:packageReleaseRenderscript UP-TO-DATE
:TwoWayLib:bundleRelease UP-TO-DATE
:Rogue:prepareRogueProjectTwoWayLibUnspecifiedLibrary UP-TO-DATE
:Rogue:prepareDebugDependencies
:Rogue:compileDebugAidl UP-TO-DATE
:Rogue:generateDebugBuildConfig UP-TO-DATE
:Rogue:mergeDebugAssets UP-TO-DATE
:Rogue:compileDebugRenderscript UP-TO-DATE
:Rogue:mergeDebugResources UP-TO-DATE
:Rogue:processDebugManifest UP-TO-DATE
:Rogue:processDebugResources UP-TO-DATE
:Rogue:compileDebug UP-TO-DATE
:Rogue:dexDebug UP-TO-DATE
:Rogue:processDebugJavaRes UP-TO-DATE
:Rogue:validateDebugSigning
:Rogue:packageDebug
:Rogue:assembleDebug
:Rogue:prepareReleaseDependencies
:Rogue:compileReleaseAidl UP-TO-DATE
:Rogue:generateReleaseBuildConfig UP-TO-DATE
:Rogue:mergeReleaseAssets UP-TO-DATE
:Rogue:compileReleaseRenderscript UP-TO-DATE
:Rogue:mergeReleaseResources UP-TO-DATE
:Rogue:processReleaseManifest UP-TO-DATE
:Rogue:processReleaseResources UP-TO-DATE
:Rogue:compileRelease UP-TO-DATE
:Rogue:dexRelease UP-TO-DATE
:Rogue:processReleaseJavaRes UP-TO-DATE
:Rogue:packageRelease
:Rogue:assembleRelease
:Rogue:assemble
:Rogue:check UP-TO-DATE
:Rogue:build
:TwoWayLib:mergeDebugProguardFiles UP-TO-DATE
:TwoWayLib:packageDebugAidl UP-TO-DATE
:TwoWayLib:prepareDebugDependencies
:TwoWayLib:compileDebugAidl UP-TO-DATE
:TwoWayLib:generateDebugBuildConfig UP-TO-DATE
:TwoWayLib:mergeDebugAssets UP-TO-DATE
:TwoWayLib:compileDebugRenderscript UP-TO-DATE
:TwoWayLib:mergeDebugResources UP-TO-DATE
:TwoWayLib:processDebugManifest UP-TO-DATE
:TwoWayLib:processDebugResources UP-TO-DATE
:TwoWayLib:compileDebug UP-TO-DATE
:TwoWayLib:processDebugJavaRes UP-TO-DATE
:TwoWayLib:packageDebugJar UP-TO-DATE
:TwoWayLib:packageDebugLocalJar UP-TO-DATE
:TwoWayLib:packageDebugRenderscript UP-TO-DATE
:TwoWayLib:bundleDebug UP-TO-DATE
:TwoWayLib:assembleDebug UP-TO-DATE
:TwoWayLib:assembleRelease UP-TO-DATE
:TwoWayLib:assemble UP-TO-DATE
:TwoWayLib:check UP-TO-DATE
:TwoWayLib:build UP-TO-DATE

BUILD SUCCESSFUL

Total time: 10.848 secs
</code>```

答:
You can find it in the </p>

```<code>project -> app (or your main app module) -> build -> outputs -> apk
</code>```

Body:
I've been rebuilding my project from the ground up, so there's been a lot of problems with it. At the moment, everything's working great, except that when I try to run the app, I get the message 'Local path doesn't exist.', where the local path is pointing at the path: AndroidStudioProjects\MyProject\MyProject..\build\production\MyProject.apk, and true enough, there is no .apk file at that location, or indeed anywhere else in the project filesystem.

However, I can build the app with no problems, and running gradlew packageDebug gives me the message 'build successful', so .apks should be being generated. My question is, where are they going, or if they aren't being generated, why not?

Where is the build path of each module set? I'm somewhat confused because the Project Structure->Facets->Android->Compiler settings, Project Structure->Modules->Paths->Compiler Output, build.gradle, and MyProject.iml all seem to have something to do with the build path, but I don't quite understand how they relate

edit: I know where it should be, but it's not there so I want to know how to change the build path

edit 2: For some reason running gradlew build does create .apks, but not building or running from inside the program

edit 3: Here's my gradlew build output, note that it does build successfully:

Creating properties on demand (a.k.a. dynamic properties) has been deprecated and is scheduled to be removed in Gradle 2.0. Please read http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html for information on the replacement for dynamic properties.
Deprecated dynamic property: "target" on "com.android.build.gradle.LibraryExtension_Decorated@9e9aabc", value: "android-16".
:TwoWayLib:mergeReleaseProguardFiles UP-TO-DATE
:TwoWayLib:packageReleaseAidl UP-TO-DATE
:TwoWayLib:prepareReleaseDependencies
:TwoWayLib:compileReleaseAidl UP-TO-DATE
:TwoWayLib:generateReleaseBuildConfig UP-TO-DATE
:TwoWayLib:mergeReleaseAssets UP-TO-DATE
:TwoWayLib:compileReleaseRenderscript UP-TO-DATE
:TwoWayLib:mergeReleaseResources UP-TO-DATE
:TwoWayLib:processReleaseManifest UP-TO-DATE
:TwoWayLib:processReleaseResources UP-TO-DATE
:TwoWayLib:compileRelease UP-TO-DATE
:TwoWayLib:processReleaseJavaRes UP-TO-DATE
:TwoWayLib:packageReleaseJar UP-TO-DATE
:TwoWayLib:packageReleaseLocalJar UP-TO-DATE
:TwoWayLib:packageReleaseRenderscript UP-TO-DATE
:TwoWayLib:bundleRelease UP-TO-DATE
:Rogue:prepareRogueProjectTwoWayLibUnspecifiedLibrary UP-TO-DATE
:Rogue:prepareDebugDependencies
:Rogue:compileDebugAidl UP-TO-DATE
:Rogue:generateDebugBuildConfig UP-TO-DATE
:Rogue:mergeDebugAssets UP-TO-DATE
:Rogue:compileDebugRenderscript UP-TO-DATE
:Rogue:mergeDebugResources UP-TO-DATE
:Rogue:processDebugManifest UP-TO-DATE
:Rogue:processDebugResources UP-TO-DATE
:Rogue:compileDebug UP-TO-DATE
:Rogue:dexDebug UP-TO-DATE
:Rogue:processDebugJavaRes UP-TO-DATE
:Rogue:validateDebugSigning
:Rogue:packageDebug
:Rogue:assembleDebug
:Rogue:prepareReleaseDependencies
:Rogue:compileReleaseAidl UP-TO-DATE
:Rogue:generateReleaseBuildConfig UP-TO-DATE
:Rogue:mergeReleaseAssets UP-TO-DATE
:Rogue:compileReleaseRenderscript UP-TO-DATE
:Rogue:mergeReleaseResources UP-TO-DATE
:Rogue:processReleaseManifest UP-TO-DATE
:Rogue:processReleaseResources UP-TO-DATE
:Rogue:compileRelease UP-TO-DATE
:Rogue:dexRelease UP-TO-DATE
:Rogue:processReleaseJavaRes UP-TO-DATE
:Rogue:packageRelease
:Rogue:assembleRelease
:Rogue:assemble
:Rogue:check UP-TO-DATE
:Rogue:build
:TwoWayLib:mergeDebugProguardFiles UP-TO-DATE
:TwoWayLib:packageDebugAidl UP-TO-DATE
:TwoWayLib:prepareDebugDependencies
:TwoWayLib:compileDebugAidl UP-TO-DATE
:TwoWayLib:generateDebugBuildConfig UP-TO-DATE
:TwoWayLib:mergeDebugAssets UP-TO-DATE
:TwoWayLib:compileDebugRenderscript UP-TO-DATE
:TwoWayLib:mergeDebugResources UP-TO-DATE
:TwoWayLib:processDebugManifest UP-TO-DATE
:TwoWayLib:processDebugResources UP-TO-DATE
:TwoWayLib:compileDebug UP-TO-DATE
:TwoWayLib:processDebugJavaRes UP-TO-DATE
:TwoWayLib:packageDebugJar UP-TO-DATE
:TwoWayLib:packageDebugLocalJar UP-TO-DATE
:TwoWayLib:packageDebugRenderscript UP-TO-DATE
:TwoWayLib:bundleDebug UP-TO-DATE
:TwoWayLib:assembleDebug UP-TO-DATE
:TwoWayLib:assembleRelease UP-TO-DATE
:TwoWayLib:assemble UP-TO-DATE
:TwoWayLib:check UP-TO-DATE
:TwoWayLib:build UP-TO-DATE

BUILD SUCCESSFUL

Total time: 10.848 secs

Body:
You can find it in the

project -> app (or your main app module) -> build -> outputs -> apk