问:
change width of columns from Nebular NbTreeGridComponent
how can you change the width of the columns of an Nebular NbTreeGridComponent? In the docs, they mention equalColumnsWidth, which default value is 'false'. However, my columns remain equal width, no matter what I do..

here's my code html:

```<code><table [nbTreeGrid]="source" style="font-family: exo; font-size: 12px;">
    <tr nbTreeGridHeaderRow *nbTreeGridHeaderRowDef="allColumns"></tr>
        <tr nbTreeGridRow *nbTreeGridRowDef="let row; columns: allColumns"></tr>

        <ng-container [nbTreeGridColumnDef]="customColumn">
          <th nbTreeGridHeaderCell *nbTreeGridHeaderCellDef>{{customColumn}}</th>
          <td nbTreeGridCell *nbTreeGridCellDef="let row">

            <nb-tree-grid-row-toggle
              [expanded]="row.expanded"
              *ngIf="row.data.kind === 'dir'">
            </nb-tree-grid-row-toggle>

            {{row.data[customColumn]}}

          </td>
        </ng-container>

        <ng-container *ngFor="let column of defaultColumns" [nbTreeGridColumnDef]="column">
          <th nbTreeGridHeaderCell *nbTreeGridHeaderCellDef>{{column}}</th>
          <td nbTreeGridCell *nbTreeGridCellDef="let row">{{row.data[column] || '-'}}</td>
        </ng-container>
      </table>
</code>```

code ts:

```<code>        customColumn = 'Organisme';
  defaultColumns = [ 'Score', 'Symbool'];
  allColumns = [ this.customColumn, ...this.defaultColumns ];
  source: NbTreeGridDataSource<FSEntry>;
  spinner_active = true;

  public _data: FSEntry[] = [];
  lijst_maldi : maldi[] = [];

  constructor(public _monitorservice: MonitorService, public http: HttpClient, dataSourceBuilder: NbTreeGridDataSourceBuilder<FSEntry>) {
    _monitorservice.current_isolid_active.subscribe(x => {
      if (x.orderid != 0){
        this.http.get<maldi[]>("https://test.be/getmaldi?specimenid=" +  x.specimenid + "&seq=" + x.sequentie ).subscribe(data =>
        {
          this._data = [];
          this.lijst_maldi = data;
          for (let x of data){
            this._data.push({Symbool: x.symbool, Organisme: x.organisme, Score: x.score.substring(0,4) });
            }

            const getters: NbGetters<FSEntry, FSEntry> = {
              dataGetter: (node: FSEntry) => node,
              childrenGetter: (node: FSEntry) => node.childEntries || undefined,
              expandedGetter: (node: FSEntry) => !!node.expanded,
            };
            this.source = dataSourceBuilder.create(this._data, getters);

        });
      }
</code>```

答:
try to set the table-layout CSS property to auto:</p>
```<code><table [nbTreeGrid]="source" style="table-layout: auto;">
</code>```

Body:
how can you change the width of the columns of an Nebular NbTreeGridComponent? In the docs, they mention equalColumnsWidth, which default value is 'false'. However, my columns remain equal width, no matter what I do..

here's my code html:

        <ng-container [nbTreeGridColumnDef]="customColumn">
          {{customColumn}}

            <nb-tree-grid-row-toggle
              [expanded]="row.expanded"
              *ngIf="row.data.kind === 'dir'">
            </nb-tree-grid-row-toggle>

            {{row.data[customColumn]}}

        </ng-container>

        <ng-container *ngFor="let column of defaultColumns" [nbTreeGridColumnDef]="column">
          {{column}}
          {{row.data[column] || '-'}}
        </ng-container>

code ts:

        customColumn = 'Organisme';
  defaultColumns = [ 'Score', 'Symbool'];
  allColumns = [ this.customColumn, ...this.defaultColumns ];
  source: NbTreeGridDataSource<FSEntry>;
  spinner_active = true;

  public _data: FSEntry[] = [];
  lijst_maldi : maldi[] = [];

  constructor(public _monitorservice: MonitorService, public http: HttpClient, dataSourceBuilder: NbTreeGridDataSourceBuilder<FSEntry>) {
    _monitorservice.current_isolid_active.subscribe(x => {
      if (x.orderid != 0){
        this.http.get<maldi[]>("https://test.be/getmaldi?specimenid=" +  x.specimenid + "&seq=" + x.sequentie ).subscribe(data =>
        {
          this._data = [];
          this.lijst_maldi = data;
          for (let x of data){
            this._data.push({Symbool: x.symbool, Organisme: x.organisme, Score: x.score.substring(0,4) });
            }

            const getters: NbGetters<FSEntry, FSEntry> = {
              dataGetter: (node: FSEntry) => node,
              childrenGetter: (node: FSEntry) => node.childEntries || undefined,
              expandedGetter: (node: FSEntry) => !!node.expanded,
            };
            this.source = dataSourceBuilder.create(this._data, getters);

        });
      }

Body:
try to set the table-layout CSS property to auto:

<table [nbTreeGrid]="source" style="table-layout: auto;">


来源: stackexchange

问:
How to subset R data frame based on duplicates in one column and unique values in another
This seems pretty straightforward but I am stumped. I have a data frame that looks like this:

```<code>df1 %>% head()
  values  paired
  <ch>     <int>
1 apples      1
2 x           1
3 oranges     2
4 z           2
5 bananas     3
6 y           3
7 apples      4
8 p           4

</code>```

I would like to create a new data frame that extracts all paired values based on a search criteria. So if I want all pairs that correspond to apples I would like to end up with something like this:

```<code>df1 %>% head()
  values  paired
  <ch>     <int>
1 apples      1
2 x           1
3 apples      4
4 p           4
</code>```

I have tried using:

```<code>new_pairs <- df1 %>%
  arrange(values, paired) %>%
  filter(duplicated(paired) == TRUE,
         values=="apples")
</code>```

But I am getting only the apple rows back

答:
Here is another tidyverse possibility. I filter for the rows that have apples and also keep the rows that immediately follow apples.

```<code>library(tidyverse)

df %>%
  filter((values == "apples" |
            row_number() %in% c(which(
              values == "apples", arr.ind = TRUE
            ) + 1)))
</code>```

Output

```<code>  values paired
1 apples      1
2      x      1
3 apples      4
4      p      4
</code>```

Here is a data.table option (subset is only used to change the order of the columns):

```<code>library(data.table)

dt <- as.data.table(df)
subset(dt[, .SD[any(values == "apples")], by = paired], select = c("values", "paired"))

   values paired
1: apples      1
2:      x      1
3: apples      4
4:      p      4
</code>```

Data

```<code>df <-
    structure(list(
      values = c("apples", "x", "oranges", "z", "bananas",
                 "y", "apples", "p"),
      paired = c(1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L)
    ),
    class = "data.frame",
    row.names = c(NA,-8L))
</code>```

ContentLicense: CC BY-SA 4.0

Body:
This seems pretty straightforward but I am stumped. I have a data frame that looks like this:

df1 %>% head()
  values  paired
  <ch>     <int>
1 apples      1
2 x           1
3 oranges     2
4 z           2
5 bananas     3
6 y           3
7 apples      4
8 p           4

I would like to create a new data frame that extracts all paired values based on a search criteria. So if I want all pairs that correspond to apples I would like to end up with something like this:

df1 %>% head()
  values  paired
  <ch>     <int>
1 apples      1
2 x           1
3 apples      4
4 p           4

I have tried using:

new_pairs <- df1 %>%
  arrange(values, paired) %>%
  filter(duplicated(paired) == TRUE,
         values=="apples")

But I am getting only the apple rows back

Body:
Here is another tidyverse possibility. I filter for the rows that have apples and also keep the rows that immediately follow apples.

library(tidyverse)

df %>%
  filter((values == "apples" |
            row_number() %in% c(which(
              values == "apples", arr.ind = TRUE
            ) + 1)))

Output

  values paired
1 apples      1
2      x      1
3 apples      4
4      p      4

Here is a data.table option (subset is only used to change the order of the columns):

library(data.table)

dt <- as.data.table(df)
subset(dt[, .SD[any(values == "apples")], by = paired], select = c("values", "paired"))

   values paired
1: apples      1
2:      x      1
3: apples      4
4:      p      4

Data

df <-
    structure(list(
      values = c("apples", "x", "oranges", "z", "bananas",
                 "y", "apples", "p"),
      paired = c(1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L)
    ),
    class = "data.frame",
    row.names = c(NA,-8L))


问:
What's the difference between SYSOUT and SYSPRINT of a job?
While coding a JCL, we give SYSOUT and SYSPRINT DDs. Which type of output goes to SYSOUT and what else to SYSPRINT?

答:
SYSOUT system defined dd name used for file status codes and system abend codes information and output of the display statement can be viewd

and sysout parameter used to direct the output device and genarete during execution of the job to an output device

SYSPRINT contains the compiled source listing and for each line in the soucrce listing a line number and offset no can be genarated

ContentLicense: CC BY-SA 2.5

ContentLicense: CC BY-SA 3.0


问:
Image does not respect parent flex size
I have been scratching my head for quite some time now trying to make this image respect its parent flex size.

The scenario is, I want to build a component that would have a height of 150px. This component will have a column flex display of two sections: an image and its description. I wanted each child to have 1/2 (flex: 1) of their parent's height. However, the image doesn't respect its flex size! It pushes its sibling down.

I've noticed that if I apply the flex: 1 to the image itself this doesn't happen, but I'd like to understand why this image is not respecting its parent flex: 1 (which should be around 67.5px)

Thank you!

* {
  box-sizing: border-box;
}

.carousel {
  width: 150px;
  height: 150px;
  display: flex;
  flex-flow: column nowrap;
  align-items: center;
  gap: 1rem;
  outline: 1px solid black;
}

.carousel__image-container {
  outline: 1px solid red;
  flex: 1;
}

.carousel__image {
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
}

.carousel__description {
  flex: 1;
  display: flex;
  gap: .5rem;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="carousel">
    <div class="carousel__image-container">
        <img class="carousel__image"
             src="https://images.unsplash.com/photo-1614006160288-14eba44816d6?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=400&q=80"
             alt="Little Cato"
        />
    </div>
    <div class="carousel__description">
      Lorem ipsum dolor sit amet, consectetur.
    </div>
</div></code>```

答: is not use flex: 1. The size of the image depends on the width and height settings of the image</p>

Title: Image does not respect parent flex size

Body:
I have been scratching my head for quite some time now trying to make this image respect its parent flex size.

The scenario is, I want to build a component that would have a height of 150px. This component will have a column flex display of two sections: an image and its description. I wanted each child to have 1/2 (flex: 1) of their parent's height. However, the image doesn't respect its flex size! It pushes its sibling down.

I've noticed that if I apply the flex: 1 to the image itself this doesn't happen, but I'd like to understand why this image is not respecting its parent flex: 1 (which should be around 67.5px)

Thank you!

* {
  box-sizing: border-box;
}

.carousel {
  width: 150px;
  height: 150px;
  display: flex;
  flex-flow: column nowrap;
  align-items: center;
  gap: 1rem;
  outline: 1px solid black;
}

.carousel__image-container {
  outline: 1px solid red;
  flex: 1;
}

.carousel__image {
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
}

.carousel__description {
  flex: 1;
  display: flex;
  gap: .5rem;
}

      Lorem ipsum dolor sit amet, consectetur.


问:
Will array memory allocation be destroyed when function ends
Just wondering if garbage collector takes care of an array returned by function. Will this function cause memory leaks if called many times?

```<code>1.    myFun = () => {
2.       let data = []
3.       for (let i=1; i<5; i++){
4.           data.push(id: i, name: 'temp')
5.       }
6.       return data
7.    }
8.
9.    let myData1 = myFun()
10.   let myData2 = myFun()
11.   let myData3 = myFun()
</code>```

so it creates three new arrays. But what the one defined in row #2?

答:
But what the one defined in row #2?

That is the same exact array that is being returned. You aren't creating six arrays total (three inside, three outside) - you're creating three arrays total (three inside, which then get returned to the outside).

So, that array will remain un-garbage-collected as long as the returned expression remains referenceable. If your myData1, myData2, myData3 remain referenceable forever, none of the arrays will ever be garbage collected. If they become unreferenceable and nothing can continue using them, then they'll get garbage collected - for example, if you did

```<code>(() => {
    myFun = () => {
        let data = []
        for (let i = 1; i < 5; i++) {
            data.push(id: i, name: 'temp')
        }
        return data
    }

    let myData1 = myFun()
    let myData2 = myFun()
    let myData3 = myFun()
})();
</code>```

Since myData1 etc aren't used again, and since the scope they're declared in ends, all arrays would then be shortly garbage collected.

Body:
Just wondering if garbage collector takes care of an array returned by function. Will this function cause memory leaks if called many times?

1.    myFun = () => {
2.       let data = []
3.       for (let i=1; i<5; i++){
4.           data.push(id: i, name: 'temp')
5.       }
6.       return data
7.    }
8.
9.    let myData1 = myFun()
10.   let myData2 = myFun()
11.   let myData3 = myFun()

so it creates three new arrays. But what the one defined in row #2?

Body:
But what the one defined in row #2?

That is the same exact array that is being returned. You aren't creating six arrays total (three inside, three outside) - you're creating three arrays total (three inside, which then get returned to the outside).

So, that array will remain un-garbage-collected as long as the returned expression remains referenceable. If your myData1, myData2, myData3 remain referenceable forever, none of the arrays will ever be garbage collected. If they become unreferenceable and nothing can continue using them, then they'll get garbage collected - for example, if you did

(() => {
    myFun = () => {
        let data = []
        for (let i = 1; i < 5; i++) {
            data.push(id: i, name: 'temp')
        }
        return data
    }

    let myData1 = myFun()
    let myData2 = myFun()
    let myData3 = myFun()
})();

Since myData1 etc aren't used again, and since the scope they're declared in ends, all arrays would then be shortly garbage collected.


问:
How important is optimization?
I got into a bit of a debate yesterday with my boss about the proper role of optimization when building software. Essentially, his position was that optimization needs to be a primary concern during the entire process of development.

My opinion is that you need to make the right algorithmic decisions during development, but you should never be counting cycles during development. In fact, I feel so strongly about this I had to walk away from the conversation. I've seen too many bad programming decisions in the name of "optimization", and too much bad code defended with the excuse "this way is faster".

What does the StackOverflow.com community think?

答: Engineer throughout, optimize at the end.</p>

OwnerDisplayName: dicroce

Title: How important is optimization?

LastEditorDisplayName: jpalecek

OwnerDisplayName: Brian


问:
How to get form data from login screen into a usable string in my controller in flutter
I feel as if this should be something very easy but I cannot figure it out, I have everything working I just need to make the 'email' and 'password' fields change to whatever the user enters. Below is my controller where the data gets sent via HTTP

```<code> postData() async {
    try {
      var response = await http
          .post(Uri.parse("http://exampleIP/untitled/authentication/login.php"), body: {
        "username": 'email',   // needs to be what user inputs//
        "password": 'password' // needs to be what user inputs//
</code>```

I understand all the code is not there but the code works I just need to know how to get the input from the form

Here is form code

```<code>import 'package:flutter/material.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'package:flutx/flutx.dart';
import 'package:harralander/images.dart';
import 'package:harralander/theme/app_theme.dart';

import '../controllers/login_controller.dart';

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

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

class _LogInScreenState extends State<LogInScreen> {
  late ThemeData theme;
  late CustomTheme customTheme;

  late LogInController controller;
  late OutlineInputBorder outlineInputBorder;

  @override
  void initState() {
    super.initState();
    theme = AppTheme.theme;
    customTheme = AppTheme.customTheme;

    controller = FxControllerStore.putOrFind(LogInController());
    outlineInputBorder = OutlineInputBorder(
      borderRadius: BorderRadius.all(Radius.circular(4)),
      borderSide: BorderSide(
        color: Colors.transparent,
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return FxBuilder<LogInController>(
        controller: controller,
        builder: (controller) {
          return _buildBody();
        });
  }

  Widget _buildBody() {
    return Scaffold(
      body: Padding(
        padding: FxSpacing.x(20),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            FxText.h3(
              'Log In',
              fontWeight: 700,
            ),
            FxSpacing.height(20),
            Form(
              key: controller.formKey,
              child: Column(
                children: [
                  TextFormField(
                    style: FxTextStyle.b2(),
                    decoration: InputDecoration(
                        floatingLabelBehavior: FloatingLabelBehavior.never,
                        filled: true,
                        isDense: true,
                        fillColor: customTheme.card,
                        prefixIcon: Icon(
                          FeatherIcons.mail,
                          color: theme.colorScheme.onBackground,
                        ),
                        hintText: "Email Address",
                        enabledBorder: outlineInputBorder,
                        focusedBorder: outlineInputBorder,
                        border: outlineInputBorder,
                        contentPadding: FxSpacing.all(16),
                        hintStyle: FxTextStyle.b2(),
                        isCollapsed: true),
                    maxLines: 1,
                    controller: controller.emailTE,
                    validator: controller.validateEmail,
                    cursorColor: theme.colorScheme.onBackground,
                  ),
                  FxSpacing.height(20),
                  TextFormField(
                    style: FxTextStyle.b2(),
                    decoration: InputDecoration(
                        floatingLabelBehavior: FloatingLabelBehavior.never,
                        filled: true,
                        isDense: true,
                        fillColor: customTheme.card,
                        prefixIcon: Icon(
                          FeatherIcons.lock,
                          color: theme.colorScheme.onBackground,
                        ),
                        hintText: "Password",
                        enabledBorder: outlineInputBorder,
                        focusedBorder: outlineInputBorder,
                        border: outlineInputBorder,
                        contentPadding: FxSpacing.all(16),
                        hintStyle: FxTextStyle.b2(),
                        isCollapsed: true),
                    maxLines: 1,
                    controller: controller.passwordTE,
                    validator: controller.validatePassword,
                    cursorColor: theme.colorScheme.onBackground,
                  ),
                ],
              ),
            ),
            FxSpacing.height(20),
            Align(
              alignment: Alignment.centerRight,
              child: FxButton.text(
                  onPressed: () {
                    controller.goToForgotPasswordScreen();
                  },
                  padding: FxSpacing.zero,
                  splashColor: customTheme.fitnessPrimary.withAlpha(40),
                  child: FxText.b3(
                    'Forgot password ?',
                    color: customTheme.fitnessPrimary,
                  )),
            ),
            FxSpacing.height(20),
            Row(
              children: [
                FxButton(
                    padding: FxSpacing.xy(16, 12),
                    onPressed: () {
                      controller.postData();
                    },
                    backgroundColor: customTheme.card,
                    splashColor: theme.colorScheme.onBackground.withAlpha(40),
                    elevation: 0,
                    borderRadiusAll: 4,
                    child: Row(
                      children: [
                        Image(
                          image: AssetImage(Images.google),
                          height: 17,
                          width: 17,
                        ),
                        FxSpacing.width(20),
                        FxText.l2(
                          'Login with Google',
                          fontWeight: 600,
                          color: theme.colorScheme.onBackground,
                        ),
                      ],
                    )),
                FxSpacing.width(20),
                Expanded(
                  child: FxButton(
                    padding: FxSpacing.y(12),
                    onPressed: () {
                      controller.postData();
                    },
                    backgroundColor: customTheme.fitnessPrimary,
                    elevation: 0,
                    borderRadiusAll: 4,
                    child: FxText.b2(
                      'Log In',
                      color: customTheme.fitnessOnPrimary,
                      fontWeight: 600,
                    ),
                  ),
                ),
              ],
            ),
            FxSpacing.height(20),
            Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                FxText.b3(
                  'New to Harralander? ',
                ),
                FxButton.text(
                    onPressed: () {
                      controller.goToRegisterScreen();
                    },
                    padding: FxSpacing.zero,
                    splashColor: customTheme.fitnessPrimary.withAlpha(40),
                    child: FxText.b3(
                      'Register',
                      color: customTheme.fitnessPrimary,
                    )),
              ],
            ),
          ],
        ),
      ),
    );
  }
}

</code>```

Thank you

答:
Try this on your LogInController declare a TextEditingController

xample:

```<code>  class LogInController extends GetxController{
 // xample as your textediting as this
 final emailTE = TextEditingController()
     , passwordTE = TextEditingControler();

 callToLoging() async{
    //validate first as you use formKey
   if(formKey.currentState!.validate()){
        //call the loginApiService
        await LoginApiService.postData(
            email: emailTE.value!.text // or email!.text,
            password : passwordTE.value!.text // or password!.text,
             );
      }
  }

  }

  class LoginAPIService{

  //Use Future or static it depends on you
  static postData({String? email , String? password}) async {
        try {
          var response = await http
              .post(Uri.parse("http://exampleIP/untitled/authentication/login.php"), body: {
            "username": email ?? "",   // needs to be what user inputs//
            "password": password ?? ""});
       } catch(e){

       }
    }

  }
</code>```

mention me if something happens if it works or not.

Body:
I feel as if this should be something very easy but I cannot figure it out, I have everything working I just need to make the 'email' and 'password' fields change to whatever the user enters. Below is my controller where the data gets sent via HTTP

 postData() async {
    try {
      var response = await http
          .post(Uri.parse("http://exampleIP/untitled/authentication/login.php"), body: {
        "username": 'email',   // needs to be what user inputs//
        "password": 'password' // needs to be what user inputs//

I understand all the code is not there but the code works I just need to know how to get the input from the form

Here is form code

import 'package:flutter/material.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'package:flutx/flutx.dart';
import 'package:harralander/images.dart';
import 'package:harralander/theme/app_theme.dart';

import '../controllers/login_controller.dart';

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

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

class _LogInScreenState extends State<LogInScreen> {
  late ThemeData theme;
  late CustomTheme customTheme;

  late LogInController controller;
  late OutlineInputBorder outlineInputBorder;

  @override
  void initState() {
    super.initState();
    theme = AppTheme.theme;
    customTheme = AppTheme.customTheme;

    controller = FxControllerStore.putOrFind(LogInController());
    outlineInputBorder = OutlineInputBorder(
      borderRadius: BorderRadius.all(Radius.circular(4)),
      borderSide: BorderSide(
        color: Colors.transparent,
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return FxBuilder<LogInController>(
        controller: controller,
        builder: (controller) {
          return _buildBody();
        });
  }

  Widget _buildBody() {
    return Scaffold(
      body: Padding(
        padding: FxSpacing.x(20),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            FxText.h3(
              'Log In',
              fontWeight: 700,
            ),
            FxSpacing.height(20),
            Form(
              key: controller.formKey,
              child: Column(
                children: [
                  TextFormField(
                    style: FxTextStyle.b2(),
                    decoration: InputDecoration(
                        floatingLabelBehavior: FloatingLabelBehavior.never,
                        filled: true,
                        isDense: true,
                        fillColor: customTheme.card,
                        prefixIcon: Icon(
                          FeatherIcons.mail,
                          color: theme.colorScheme.onBackground,
                        ),
                        hintText: "Email Address",
                        enabledBorder: outlineInputBorder,
                        focusedBorder: outlineInputBorder,
                        border: outlineInputBorder,
                        contentPadding: FxSpacing.all(16),
                        hintStyle: FxTextStyle.b2(),
                        isCollapsed: true),
                    maxLines: 1,
                    controller: controller.emailTE,
                    validator: controller.validateEmail,
                    cursorColor: theme.colorScheme.onBackground,
                  ),
                  FxSpacing.height(20),
                  TextFormField(
                    style: FxTextStyle.b2(),
                    decoration: InputDecoration(
                        floatingLabelBehavior: FloatingLabelBehavior.never,
                        filled: true,
                        isDense: true,
                        fillColor: customTheme.card,
                        prefixIcon: Icon(
                          FeatherIcons.lock,
                          color: theme.colorScheme.onBackground,
                        ),
                        hintText: "Password",
                        enabledBorder: outlineInputBorder,
                        focusedBorder: outlineInputBorder,
                        border: outlineInputBorder,
                        contentPadding: FxSpacing.all(16),
                        hintStyle: FxTextStyle.b2(),
                        isCollapsed: true),
                    maxLines: 1,
                    controller: controller.passwordTE,
                    validator: controller.validatePassword,
                    cursorColor: theme.colorScheme.onBackground,
                  ),
                ],
              ),
            ),
            FxSpacing.height(20),
            Align(
              alignment: Alignment.centerRight,
              child: FxButton.text(
                  onPressed: () {
                    controller.goToForgotPasswordScreen();
                  },
                  padding: FxSpacing.zero,
                  splashColor: customTheme.fitnessPrimary.withAlpha(40),
                  child: FxText.b3(
                    'Forgot password ?',
                    color: customTheme.fitnessPrimary,
                  )),
            ),
            FxSpacing.height(20),
            Row(
              children: [
                FxButton(
                    padding: FxSpacing.xy(16, 12),
                    onPressed: () {
                      controller.postData();
                    },
                    backgroundColor: customTheme.card,
                    splashColor: theme.colorScheme.onBackground.withAlpha(40),
                    elevation: 0,
                    borderRadiusAll: 4,
                    child: Row(
                      children: [
                        Image(
                          image: AssetImage(Images.google),
                          height: 17,
                          width: 17,
                        ),
                        FxSpacing.width(20),
                        FxText.l2(
                          'Login with Google',
                          fontWeight: 600,
                          color: theme.colorScheme.onBackground,
                        ),
                      ],
                    )),
                FxSpacing.width(20),
                Expanded(
                  child: FxButton(
                    padding: FxSpacing.y(12),
                    onPressed: () {
                      controller.postData();
                    },
                    backgroundColor: customTheme.fitnessPrimary,
                    elevation: 0,
                    borderRadiusAll: 4,
                    child: FxText.b2(
                      'Log In',
                      color: customTheme.fitnessOnPrimary,
                      fontWeight: 600,
                    ),
                  ),
                ),
              ],
            ),
            FxSpacing.height(20),
            Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                FxText.b3(
                  'New to Harralander? ',
                ),
                FxButton.text(
                    onPressed: () {
                      controller.goToRegisterScreen();
                    },
                    padding: FxSpacing.zero,
                    splashColor: customTheme.fitnessPrimary.withAlpha(40),
                    child: FxText.b3(
                      'Register',
                      color: customTheme.fitnessPrimary,
                    )),
              ],
            ),
          ],
        ),
      ),
    );
  }
}

Thank you

Body:
Try this on your LogInController declare a TextEditingController

xample:

  class LogInController extends GetxController{
 // xample as your textediting as this
 final emailTE = TextEditingController()
     , passwordTE = TextEditingControler();

 callToLoging() async{
    //validate first as you use formKey
   if(formKey.currentState!.validate()){
        //call the loginApiService
        await LoginApiService.postData(
            email: emailTE.value!.text // or email!.text,
            password : passwordTE.value!.text // or password!.text,
             );
      }
  }

  }

  class LoginAPIService{

  //Use Future or static it depends on you
  static postData({String? email , String? password}) async {
        try {
          var response = await http
              .post(Uri.parse("http://exampleIP/untitled/authentication/login.php"), body: {
            "username": email ?? "",   // needs to be what user inputs//
            "password": password ?? ""});
       } catch(e){

       }
    }

  }

mention me if something happens if it works or not.


问:
'' RuntimeError: main thread is not in main loop '' once function is called
So im writing my first program and it is 2000+ lines, and i have this function down below that works on its own, but when i past it in the program and once i call the function via a button i get the error above. The function sits within other functions and is a few indents in which i assume is the reason it doesn't work. The function is pasted below (shitty code with unnecessary lines) but i dont think i can paste my 2000 line program here. Im not even sure i provided enough info so that i can get help, but the question is really, am i getting this error because the thread is called from the wrong place?</p>
```<code>from PIL import ImageTk,Image
from tkinter import ttk
import time
import threading

root = Tk()

root.title("AutoInspect")
root.geometry("1110x590")
root.iconbitmap(r"icon.ico")
root.configure(background="#333333")

bromsdata = open("lufttryck.txt", "r")
tasksleft = 3
tasksgodk = 0
tasksundk = 0

def starta_i1():
    toplabel = Label(root, text="blablabla", font=("Bell Gothic Std Black", 28), width=39, background="#414141",
                     foreground="#878AFF")
    toplabel.grid(row=0, column=1, columnspan=3, pady=40, ipadx=40)

    procent_label = Label(root, text="0%", font=("Bell Gothic Std Black", 50), height=1, width=22, background="#414141",
                          foreground="#878AFF")
    procent_label.grid(row=1, column=1, columnspan=3, pady=0, ipadx=40)

    task_label = Label(root, text="...", font=("Bell Gothic Std Black", 28), height=2, width=39, background="#414141",
                       foreground="#878AFF")
    task_label.grid(row=3, column=1, columnspan=3, pady=0, ipadx=40)

    status_godk = Label(root, text="Godkända: ", font=("Bell Gothic Std Black", 28), height=1, width=12,
                        background="#414141", foreground="#878AFF")
    status_godk.grid(row=4, column=1, columnspan=1, pady=40, sticky="w")

    status_undk = Label(root, text="Underkända: ", font=("Bell Gothic Std Black", 28), height=1, width=16,
                        background="#414141", foreground="#878AFF")
    status_undk.grid(row=4, column=2, columnspan=1, pady=40, padx=40)

    status_kvar = Label(root, text="Kvar: ", font=("Bell Gothic Std Black", 28), height=1, width=10,
                        background="#414141", foreground="#878AFF")
    status_kvar.grid(row=4, column=3, columnspan=1, pady=40, sticky="e")

    avsluta = Button(root, text="AVSLUTA", font=("Bell Gothic Std Black", 28), cursor="hand2", height=0, width=39,
                     border=0, foreground="#878AFF", background="#414141", activebackground="#999999",
                     activeforeground="#D3D5FF", relief="sunken")
    avsluta.grid(row=5, column=1, columnspan=3, pady=(0, 40), ipadx=40)
    global tasksleft
    global tasksgodk
    global tasksundk
    tasksleft = 3
    tasksgodk = 0
    tasksundk = 0
    procent_label.config(text="0%")
    task_label.configure(text="Just nu pågår: 4.0.1 Kontroll av Bromscylindertryck...")
    status_kvar.configure(text="Kvar: " + str(tasksleft))
    status_godk.configure(text="Godkända: " + str(tasksgodk))
    status_undk.configure(text="Underkända: " + str(tasksundk))
    time.sleep(1)
    punkt1_i1()

def punkt1_i1():
    toplabel = Label(root, text="blablabla", font=("Bell Gothic Std Black", 28), width=39, background="#414141",
                     foreground="#878AFF")
    toplabel.grid(row=0, column=1, columnspan=3, pady=40, ipadx=40)

    procent_label = Label(root, text="0%", font=("Bell Gothic Std Black", 50), height=1, width=22, background="#414141",
                          foreground="#878AFF")
    procent_label.grid(row=1, column=1, columnspan=3, pady=0, ipadx=40)

    task_label = Label(root, text="...", font=("Bell Gothic Std Black", 28), height=2, width=39, background="#414141",
                       foreground="#878AFF")
    task_label.grid(row=3, column=1, columnspan=3, pady=0, ipadx=40)

    status_godk = Label(root, text="Godkända: ", font=("Bell Gothic Std Black", 28), height=1, width=12,
                        background="#414141", foreground="#878AFF")
    status_godk.grid(row=4, column=1, columnspan=1, pady=40, sticky="w")

    status_undk = Label(root, text="Underkända: ", font=("Bell Gothic Std Black", 28), height=1, width=16,
                        background="#414141", foreground="#878AFF")
    status_undk.grid(row=4, column=2, columnspan=1, pady=40, padx=40)

    status_kvar = Label(root, text="Kvar: ", font=("Bell Gothic Std Black", 28), height=1, width=10,
                        background="#414141", foreground="#878AFF")
    status_kvar.grid(row=4, column=3, columnspan=1, pady=40, sticky="e")

    avsluta = Button(root, text="AVSLUTA", font=("Bell Gothic Std Black", 28), cursor="hand2", height=0, width=39,
                     border=0, foreground="#878AFF", background="#414141", activebackground="#999999",
                     activeforeground="#D3D5FF", relief="sunken")
    avsluta.grid(row=5, column=1, columnspan=3, pady=(0, 40), ipadx=40)
    global tasksleft
    global tasksgodk
    global tasksundk
    for line in bromsdata:
        if "bromscylindertryck" in line:
            break
    bromsindex = (line.find("="))
    bromstryckindex = int(bromsindex) + 1
    bt = line[bromstryckindex:]
    bt = int(bt.strip())
    print(bt)
    if bt > 41:
        print("fail")
        tasksundk = tasksundk + 1
    elif bt < 36:
        print("fail")
        tasksundk = tasksundk + 1
    else:
        print("Success")
        tasksgodk = tasksgodk + 1
    tasksleft = tasksleft - 1

    task_label.configure(text="Just nu pågår: 4.0.2 Kontroll av Huvudledningstryck...")
    procent_label.config(text="33%")
    status_kvar.configure(text="Kvar: " + str(tasksleft))
    status_godk.configure(text="Godkända: " + str(tasksgodk))
    status_undk.configure(text="Underkända: " + str(tasksundk))
    time.sleep(1)
    punkt2_i1()

def punkt2_i1():
    toplabel = Label(root, text="blablabla", font=("Bell Gothic Std Black", 28), width=39, background="#414141",
                     foreground="#878AFF")
    toplabel.grid(row=0, column=1, columnspan=3, pady=40, ipadx=40)

    procent_label = Label(root, text="0%", font=("Bell Gothic Std Black", 50), height=1, width=22, background="#414141",
                          foreground="#878AFF")
    procent_label.grid(row=1, column=1, columnspan=3, pady=0, ipadx=40)

    task_label = Label(root, text="...", font=("Bell Gothic Std Black", 28), height=2, width=39, background="#414141",
                       foreground="#878AFF")
    task_label.grid(row=3, column=1, columnspan=3, pady=0, ipadx=40)

    status_godk = Label(root, text="Godkända: ", font=("Bell Gothic Std Black", 28), height=1, width=12,
                        background="#414141", foreground="#878AFF")
    status_godk.grid(row=4, column=1, columnspan=1, pady=40, sticky="w")

    status_undk = Label(root, text="Underkända: ", font=("Bell Gothic Std Black", 28), height=1, width=16,
                        background="#414141", foreground="#878AFF")
    status_undk.grid(row=4, column=2, columnspan=1, pady=40, padx=40)

    status_kvar = Label(root, text="Kvar: ", font=("Bell Gothic Std Black", 28), height=1, width=10,
                        background="#414141", foreground="#878AFF")
    status_kvar.grid(row=4, column=3, columnspan=1, pady=40, sticky="e")

    avsluta = Button(root, text="AVSLUTA", font=("Bell Gothic Std Black", 28), cursor="hand2", height=0, width=39,
                     border=0, foreground="#878AFF", background="#414141", activebackground="#999999",
                     activeforeground="#D3D5FF", relief="sunken")
    avsluta.grid(row=5, column=1, columnspan=3, pady=(0, 40), ipadx=40)
    global tasksleft
    global tasksgodk
    global tasksundk
    for line in bromsdata:
        if "huvudledningstryck" in line:
            break
    huvudlindex = (line.find("="))
    huvudltryckindex = int(huvudlindex) + 1
    hlt = line[huvudltryckindex:]
    hlt = int(hlt.strip())
    print(hlt)
    if hlt > 62:
        print("fail")
        tasksundk = tasksundk + 1
    elif hlt < 44:
        print("fail")
        tasksundk = tasksundk + 1
    else:
        print("Success")
        tasksgodk = tasksgodk + 1
    tasksleft = tasksleft - 1

    task_label.configure(text="Just nu pågår: 4.0.3 Kontroll av Huvudbehållartryck...")
    procent_label.config(text="66%")
    status_kvar.configure(text="Kvar: " + str(tasksleft))
    status_godk.configure(text="Godkända: " + str(tasksgodk))
    status_undk.configure(text="Underkända: " + str(tasksundk))
    time.sleep(1)
    punkt3_i1()

def punkt3_i1():
    toplabel = Label(root, text="blablabla", font=("Bell Gothic Std Black", 28), width=39, background="#414141",
                     foreground="#878AFF")
    toplabel.grid(row=0, column=1, columnspan=3, pady=40, ipadx=40)

    procent_label = Label(root, text="0%", font=("Bell Gothic Std Black", 50), height=1, width=22, background="#414141",
                          foreground="#878AFF")
    procent_label.grid(row=1, column=1, columnspan=3, pady=0, ipadx=40)

    task_label = Label(root, text="...", font=("Bell Gothic Std Black", 28), height=2, width=39, background="#414141",
                       foreground="#878AFF")
    task_label.grid(row=3, column=1, columnspan=3, pady=0, ipadx=40)

    status_godk = Label(root, text="Godkända: ", font=("Bell Gothic Std Black", 28), height=1, width=12,
                        background="#414141", foreground="#878AFF")
    status_godk.grid(row=4, column=1, columnspan=1, pady=40, sticky="w")

    status_undk = Label(root, text="Underkända: ", font=("Bell Gothic Std Black", 28), height=1, width=16,
                        background="#414141", foreground="#878AFF")
    status_undk.grid(row=4, column=2, columnspan=1, pady=40, padx=40)

    status_kvar = Label(root, text="Kvar: ", font=("Bell Gothic Std Black", 28), height=1, width=10,
                        background="#414141", foreground="#878AFF")
    status_kvar.grid(row=4, column=3, columnspan=1, pady=40, sticky="e")

    avsluta = Button(root, text="AVSLUTA", font=("Bell Gothic Std Black", 28), cursor="hand2", height=0, width=39,
                     border=0, foreground="#878AFF", background="#414141", activebackground="#999999",
                     activeforeground="#D3D5FF", relief="sunken")
    avsluta.grid(row=5, column=1, columnspan=3, pady=(0, 40), ipadx=40)
    global tasksleft
    global tasksgodk
    global tasksundk
    for line in bromsdata:
        if "huvudbehallartryck" in line:
            break
    huvudbindex = (line.find("="))
    huvudbtryckindex = int(huvudbindex) + 1
    hbt = line[huvudbtryckindex:]
    hbt = int(hbt.strip())
    print(hbt)
    if hbt > 12:
        print("fail")
        tasksundk = tasksundk + 1
    elif hbt < 8:
        print("fail")
        tasksundk = tasksundk + 1
    else:
        print("Success")
        tasksgodk = tasksgodk + 1
    tasksleft = tasksleft - 1

    procent_label.config(text="100%")
    task_label.configure(text="INSPEKTION KLAR")
    status_kvar.configure(text="Kvar: " + str(tasksleft))
    status_godk.configure(text="Godkända: " + str(tasksgodk))
    status_undk.configure(text="Underkända: " + str(tasksundk))

def inspektera_click():
    print("inspect!")

    toplabel = Label(root, text="blablabla", font=("Bell Gothic Std Black", 28), width=39, background="#414141",
                     foreground="#878AFF")
    toplabel.grid(row=0, column=1, columnspan=3, pady=40, ipadx=40)

    procent_label = Label(root, text="0%", font=("Bell Gothic Std Black", 50), height=1, width=22, background="#414141",
                          foreground="#878AFF")
    procent_label.grid(row=1, column=1, columnspan=3, pady=0, ipadx=40)

    task_label = Label(root, text="...", font=("Bell Gothic Std Black", 28), height=2, width=39, background="#414141",
                       foreground="#878AFF")
    task_label.grid(row=3, column=1, columnspan=3, pady=0, ipadx=40)

    status_godk = Label(root, text="Godkända: ", font=("Bell Gothic Std Black", 28), height=1, width=12,
                        background="#414141", foreground="#878AFF")
    status_godk.grid(row=4, column=1, columnspan=1, pady=40, sticky="w")

    status_undk = Label(root, text="Underkända: ", font=("Bell Gothic Std Black", 28), height=1, width=16,
                        background="#414141", foreground="#878AFF")
    status_undk.grid(row=4, column=2, columnspan=1, pady=40, padx=40)

    status_kvar = Label(root, text="Kvar: ", font=("Bell Gothic Std Black", 28), height=1, width=10,
                        background="#414141", foreground="#878AFF")
    status_kvar.grid(row=4, column=3, columnspan=1, pady=40, sticky="e")

    avsluta = Button(root, text="AVSLUTA", font=("Bell Gothic Std Black", 28), cursor="hand2", height=0, width=39,
                     border=0, foreground="#878AFF", background="#414141", activebackground="#999999",
                     activeforeground="#D3D5FF", relief="sunken")
    avsluta.grid(row=5, column=1, columnspan=3, pady=(0, 40), ipadx=40)

inspektera_click()
t1= threading.Thread(target=starta_i1)
t1.start()

root.mainloop()
</code>```

答:
Here's how to use root.after instead of threading:</p>
```<code>def starta_i1():
    ...
    root.after(1000, punkt1_i1) # wait 1 second, then call punkt1_i1()

def punkt1_i1():
    ...
    root.after(1000, punkt2_i1) # wait 1 second, then call punkt2_i1()

def punkt2_i1():
    ...
    root.after(1000, punkt3_i1) # wait 1 second, then call punkt3_i1()

def punkt3_i1():
    ...

inspektera_click()
starta_i1() # start first function

root.mainloop()
</code>```

Body:
So im writing my first program and it is 2000+ lines, and i have this function down below that works on its own, but when i past it in the program and once i call the function via a button i get the error above. The function sits within other functions and is a few indents in which i assume is the reason it doesn't work. The function is pasted below (shitty code with unnecessary lines) but i dont think i can paste my 2000 line program here. Im not even sure i provided enough info so that i can get help, but the question is really, am i getting this error because the thread is called from the wrong place?

from PIL import ImageTk,Image
from tkinter import ttk
import time
import threading

root = Tk()

root.title("AutoInspect")
root.geometry("1110x590")
root.iconbitmap(r"icon.ico")
root.configure(background="#333333")

bromsdata = open("lufttryck.txt", "r")
tasksleft = 3
tasksgodk = 0
tasksundk = 0

def starta_i1():
    toplabel = Label(root, text="blablabla", font=("Bell Gothic Std Black", 28), width=39, background="#414141",
                     foreground="#878AFF")
    toplabel.grid(row=0, column=1, columnspan=3, pady=40, ipadx=40)

    procent_label = Label(root, text="0%", font=("Bell Gothic Std Black", 50), height=1, width=22, background="#414141",
                          foreground="#878AFF")
    procent_label.grid(row=1, column=1, columnspan=3, pady=0, ipadx=40)

    task_label = Label(root, text="...", font=("Bell Gothic Std Black", 28), height=2, width=39, background="#414141",
                       foreground="#878AFF")
    task_label.grid(row=3, column=1, columnspan=3, pady=0, ipadx=40)

    status_godk = Label(root, text="Godkända: ", font=("Bell Gothic Std Black", 28), height=1, width=12,
                        background="#414141", foreground="#878AFF")
    status_godk.grid(row=4, column=1, columnspan=1, pady=40, sticky="w")

    status_undk = Label(root, text="Underkända: ", font=("Bell Gothic Std Black", 28), height=1, width=16,
                        background="#414141", foreground="#878AFF")
    status_undk.grid(row=4, column=2, columnspan=1, pady=40, padx=40)

    status_kvar = Label(root, text="Kvar: ", font=("Bell Gothic Std Black", 28), height=1, width=10,
                        background="#414141", foreground="#878AFF")
    status_kvar.grid(row=4, column=3, columnspan=1, pady=40, sticky="e")

    avsluta = Button(root, text="AVSLUTA", font=("Bell Gothic Std Black", 28), cursor="hand2", height=0, width=39,
                     border=0, foreground="#878AFF", background="#414141", activebackground="#999999",
                     activeforeground="#D3D5FF", relief="sunken")
    avsluta.grid(row=5, column=1, columnspan=3, pady=(0, 40), ipadx=40)
    global tasksleft
    global tasksgodk
    global tasksundk
    tasksleft = 3
    tasksgodk = 0
    tasksundk = 0
    procent_label.config(text="0%")
    task_label.configure(text="Just nu pågår: 4.0.1 Kontroll av Bromscylindertryck...")
    status_kvar.configure(text="Kvar: " + str(tasksleft))
    status_godk.configure(text="Godkända: " + str(tasksgodk))
    status_undk.configure(text="Underkända: " + str(tasksundk))
    time.sleep(1)
    punkt1_i1()

def punkt1_i1():
    toplabel = Label(root, text="blablabla", font=("Bell Gothic Std Black", 28), width=39, background="#414141",
                     foreground="#878AFF")
    toplabel.grid(row=0, column=1, columnspan=3, pady=40, ipadx=40)

    procent_label = Label(root, text="0%", font=("Bell Gothic Std Black", 50), height=1, width=22, background="#414141",
                          foreground="#878AFF")
    procent_label.grid(row=1, column=1, columnspan=3, pady=0, ipadx=40)

    task_label = Label(root, text="...", font=("Bell Gothic Std Black", 28), height=2, width=39, background="#414141",
                       foreground="#878AFF")
    task_label.grid(row=3, column=1, columnspan=3, pady=0, ipadx=40)

    status_godk = Label(root, text="Godkända: ", font=("Bell Gothic Std Black", 28), height=1, width=12,
                        background="#414141", foreground="#878AFF")
    status_godk.grid(row=4, column=1, columnspan=1, pady=40, sticky="w")

    status_undk = Label(root, text="Underkända: ", font=("Bell Gothic Std Black", 28), height=1, width=16,
                        background="#414141", foreground="#878AFF")
    status_undk.grid(row=4, column=2, columnspan=1, pady=40, padx=40)

    status_kvar = Label(root, text="Kvar: ", font=("Bell Gothic Std Black", 28), height=1, width=10,
                        background="#414141", foreground="#878AFF")
    status_kvar.grid(row=4, column=3, columnspan=1, pady=40, sticky="e")

    avsluta = Button(root, text="AVSLUTA", font=("Bell Gothic Std Black", 28), cursor="hand2", height=0, width=39,
                     border=0, foreground="#878AFF", background="#414141", activebackground="#999999",
                     activeforeground="#D3D5FF", relief="sunken")
    avsluta.grid(row=5, column=1, columnspan=3, pady=(0, 40), ipadx=40)
    global tasksleft
    global tasksgodk
    global tasksundk
    for line in bromsdata:
        if "bromscylindertryck" in line:
            break
    bromsindex = (line.find("="))
    bromstryckindex = int(bromsindex) + 1
    bt = line[bromstryckindex:]
    bt = int(bt.strip())
    print(bt)
    if bt > 41:
        print("fail")
        tasksundk = tasksundk + 1
    elif bt < 36:
        print("fail")
        tasksundk = tasksundk + 1
    else:
        print("Success")
        tasksgodk = tasksgodk + 1
    tasksleft = tasksleft - 1

    task_label.configure(text="Just nu pågår: 4.0.2 Kontroll av Huvudledningstryck...")
    procent_label.config(text="33%")
    status_kvar.configure(text="Kvar: " + str(tasksleft))
    status_godk.configure(text="Godkända: " + str(tasksgodk))
    status_undk.configure(text="Underkända: " + str(tasksundk))
    time.sleep(1)
    punkt2_i1()

def punkt2_i1():
    toplabel = Label(root, text="blablabla", font=("Bell Gothic Std Black", 28), width=39, background="#414141",
                     foreground="#878AFF")
    toplabel.grid(row=0, column=1, columnspan=3, pady=40, ipadx=40)

    procent_label = Label(root, text="0%", font=("Bell Gothic Std Black", 50), height=1, width=22, background="#414141",
                          foreground="#878AFF")
    procent_label.grid(row=1, column=1, columnspan=3, pady=0, ipadx=40)

    task_label = Label(root, text="...", font=("Bell Gothic Std Black", 28), height=2, width=39, background="#414141",
                       foreground="#878AFF")
    task_label.grid(row=3, column=1, columnspan=3, pady=0, ipadx=40)

    status_godk = Label(root, text="Godkända: ", font=("Bell Gothic Std Black", 28), height=1, width=12,
                        background="#414141", foreground="#878AFF")
    status_godk.grid(row=4, column=1, columnspan=1, pady=40, sticky="w")

    status_undk = Label(root, text="Underkända: ", font=("Bell Gothic Std Black", 28), height=1, width=16,
                        background="#414141", foreground="#878AFF")
    status_undk.grid(row=4, column=2, columnspan=1, pady=40, padx=40)

    status_kvar = Label(root, text="Kvar: ", font=("Bell Gothic Std Black", 28), height=1, width=10,
                        background="#414141", foreground="#878AFF")
    status_kvar.grid(row=4, column=3, columnspan=1, pady=40, sticky="e")

    avsluta = Button(root, text="AVSLUTA", font=("Bell Gothic Std Black", 28), cursor="hand2", height=0, width=39,
                     border=0, foreground="#878AFF", background="#414141", activebackground="#999999",
                     activeforeground="#D3D5FF", relief="sunken")
    avsluta.grid(row=5, column=1, columnspan=3, pady=(0, 40), ipadx=40)
    global tasksleft
    global tasksgodk
    global tasksundk
    for line in bromsdata:
        if "huvudledningstryck" in line:
            break
    huvudlindex = (line.find("="))
    huvudltryckindex = int(huvudlindex) + 1
    hlt = line[huvudltryckindex:]
    hlt = int(hlt.strip())
    print(hlt)
    if hlt > 62:
        print("fail")
        tasksundk = tasksundk + 1
    elif hlt < 44:
        print("fail")
        tasksundk = tasksundk + 1
    else:
        print("Success")
        tasksgodk = tasksgodk + 1
    tasksleft = tasksleft - 1

    task_label.configure(text="Just nu pågår: 4.0.3 Kontroll av Huvudbehållartryck...")
    procent_label.config(text="66%")
    status_kvar.configure(text="Kvar: " + str(tasksleft))
    status_godk.configure(text="Godkända: " + str(tasksgodk))
    status_undk.configure(text="Underkända: " + str(tasksundk))
    time.sleep(1)
    punkt3_i1()

def punkt3_i1():
    toplabel = Label(root, text="blablabla", font=("Bell Gothic Std Black", 28), width=39, background="#414141",
                     foreground="#878AFF")
    toplabel.grid(row=0, column=1, columnspan=3, pady=40, ipadx=40)

    procent_label = Label(root, text="0%", font=("Bell Gothic Std Black", 50), height=1, width=22, background="#414141",
                          foreground="#878AFF")
    procent_label.grid(row=1, column=1, columnspan=3, pady=0, ipadx=40)

    task_label = Label(root, text="...", font=("Bell Gothic Std Black", 28), height=2, width=39, background="#414141",
                       foreground="#878AFF")
    task_label.grid(row=3, column=1, columnspan=3, pady=0, ipadx=40)

    status_godk = Label(root, text="Godkända: ", font=("Bell Gothic Std Black", 28), height=1, width=12,
                        background="#414141", foreground="#878AFF")
    status_godk.grid(row=4, column=1, columnspan=1, pady=40, sticky="w")

    status_undk = Label(root, text="Underkända: ", font=("Bell Gothic Std Black", 28), height=1, width=16,
                        background="#414141", foreground="#878AFF")
    status_undk.grid(row=4, column=2, columnspan=1, pady=40, padx=40)

    status_kvar = Label(root, text="Kvar: ", font=("Bell Gothic Std Black", 28), height=1, width=10,
                        background="#414141", foreground="#878AFF")
    status_kvar.grid(row=4, column=3, columnspan=1, pady=40, sticky="e")

    avsluta = Button(root, text="AVSLUTA", font=("Bell Gothic Std Black", 28), cursor="hand2", height=0, width=39,
                     border=0, foreground="#878AFF", background="#414141", activebackground="#999999",
                     activeforeground="#D3D5FF", relief="sunken")
    avsluta.grid(row=5, column=1, columnspan=3, pady=(0, 40), ipadx=40)
    global tasksleft
    global tasksgodk
    global tasksundk
    for line in bromsdata:
        if "huvudbehallartryck" in line:
            break
    huvudbindex = (line.find("="))
    huvudbtryckindex = int(huvudbindex) + 1
    hbt = line[huvudbtryckindex:]
    hbt = int(hbt.strip())
    print(hbt)
    if hbt > 12:
        print("fail")
        tasksundk = tasksundk + 1
    elif hbt < 8:
        print("fail")
        tasksundk = tasksundk + 1
    else:
        print("Success")
        tasksgodk = tasksgodk + 1
    tasksleft = tasksleft - 1

    procent_label.config(text="100%")
    task_label.configure(text="INSPEKTION KLAR")
    status_kvar.configure(text="Kvar: " + str(tasksleft))
    status_godk.configure(text="Godkända: " + str(tasksgodk))
    status_undk.configure(text="Underkända: " + str(tasksundk))

def inspektera_click():
    print("inspect!")

    toplabel = Label(root, text="blablabla", font=("Bell Gothic Std Black", 28), width=39, background="#414141",
                     foreground="#878AFF")
    toplabel.grid(row=0, column=1, columnspan=3, pady=40, ipadx=40)

    procent_label = Label(root, text="0%", font=("Bell Gothic Std Black", 50), height=1, width=22, background="#414141",
                          foreground="#878AFF")
    procent_label.grid(row=1, column=1, columnspan=3, pady=0, ipadx=40)

    task_label = Label(root, text="...", font=("Bell Gothic Std Black", 28), height=2, width=39, background="#414141",
                       foreground="#878AFF")
    task_label.grid(row=3, column=1, columnspan=3, pady=0, ipadx=40)

    status_godk = Label(root, text="Godkända: ", font=("Bell Gothic Std Black", 28), height=1, width=12,
                        background="#414141", foreground="#878AFF")
    status_godk.grid(row=4, column=1, columnspan=1, pady=40, sticky="w")

    status_undk = Label(root, text="Underkända: ", font=("Bell Gothic Std Black", 28), height=1, width=16,
                        background="#414141", foreground="#878AFF")
    status_undk.grid(row=4, column=2, columnspan=1, pady=40, padx=40)

    status_kvar = Label(root, text="Kvar: ", font=("Bell Gothic Std Black", 28), height=1, width=10,
                        background="#414141", foreground="#878AFF")
    status_kvar.grid(row=4, column=3, columnspan=1, pady=40, sticky="e")

    avsluta = Button(root, text="AVSLUTA", font=("Bell Gothic Std Black", 28), cursor="hand2", height=0, width=39,
                     border=0, foreground="#878AFF", background="#414141", activebackground="#999999",
                     activeforeground="#D3D5FF", relief="sunken")
    avsluta.grid(row=5, column=1, columnspan=3, pady=(0, 40), ipadx=40)

inspektera_click()
t1= threading.Thread(target=starta_i1)
t1.start()

root.mainloop()

Body:
Here's how to use root.after instead of threading:

def starta_i1():
    ...
    root.after(1000, punkt1_i1) # wait 1 second, then call punkt1_i1()

def punkt1_i1():
    ...
    root.after(1000, punkt2_i1) # wait 1 second, then call punkt2_i1()

def punkt2_i1():
    ...
    root.after(1000, punkt3_i1) # wait 1 second, then call punkt3_i1()

def punkt3_i1():
    ...

inspektera_click()
starta_i1() # start first function

root.mainloop()


问:
How to get list of all folders and files within a drive with their respective paths
I am trying to get the list of all folders and files (including hidden and operating system files) within a drive. I cannot loop it as each folder has different depth. Is there any command in cmd that lets us see each file and folder within a drive with their absolute paths provided? Thanks.</p>

答:
In the Windows command prompt, you could try tree /f.

However this might not include hidden files.


Title: get last week date from last group for each group by pandas?

Body:
        hy_code date       week_date   last_week_date
340     880301  2006/10/31  2006/11/5   NaT
341     880301  2006/11/1   2006/11/5   NaT
342     880301  2006/11/2   2006/11/5   NaT
343     880301  2006/11/3   2006/11/5   NaT
355     880301  2006/11/21  2006/11/26  2006/11/5
482916  880969  2021/12/24  2021/12/26  NaT
482918  880969  2021/12/28  2022/1/2    2021/12/26
482919  880969  2021/12/29  2022/1/2    2021/12/26
482920  880969  2021/12/30  2022/1/2    2021/12/26
482921  880969  2021/12/31  2022/1/2    2021/12/26

Goal

I want to get last week date for each group week date.The expected result is above.

Try

df['new_week_date']=tmp_df.groupby(['hy_code','week_date'])['week_date'].shift(1), but failed.

    hy_code date    week_date   last_week_date
340 880301  2006-10-31  2006-11-05  NaT
341 880301  2006-11-01  2006-11-05  2006-11-05
342 880301  2006-11-02  2006-11-05  2006-11-05
343 880301  2006-11-03  2006-11-05  2006-11-05
355 880301  2006-11-21  2006-11-26  NaT
482916  880969  2021-12-24  2021-12-26  NaT
482918  880969  2021-12-28  2022-01-02  2021-12-26
482919  880969  2021-12-29  2022-01-02  2022-01-02
482920  880969  2021-12-30  2022-01-02  2022-01-02
482921  880969  2021-12-31  2022-01-02  2022-01-02

Body:
You can first drop_duplicates, then create the shift week date and merge back

out = df.drop_duplicates(['hy_code','week_date']).copy()
out['lastweekdate'] = out.groupby('hy_code')['week_date'].shift(1)

df = df.merge(out.drop('date',1),how='left')
df
Out[233]:
   hy_code        date   week_date lastweekdate
0   880301  2006/10/31   2006/11/5          NaN
1   880301   2006/11/1   2006/11/5          NaN
2   880301   2006/11/2   2006/11/5          NaN
3   880301   2006/11/3   2006/11/5          NaN
4   880301  2006/11/21  2006/11/26    2006/11/5
5   880969  2021/12/24  2021/12/26          NaN
6   880969  2021/12/28    2022/1/2   2021/12/26
7   880969  2021/12/29    2022/1/2   2021/12/26
8   880969  2021/12/30    2022/1/2   2021/12/26
9   880969  2021/12/31    2022/1/2   2021/12/26


问:
Regex, php : how to negate a capturing parentheses
I want to analyse a mysql request with a php regex,
that is, extract the select_expr and the table_references from a mysql statement.
For example, here are two mysql queries that I would like my regex to match :

```<code>select id, name from table

select id, name
</code>```

From that query I would like to extract 2 parts : the "id, name" information and the "table" information too.

The first part can actually contain a string like CONCAT('id','.','nom') AS alias,

and the second part can look like : table t INNER JOIN table2 t2 ON t.id=t2.user_id.

So I tried this "I know it's not working but will get me on the road" regex :

```<code>'!select (.*)( from (.*))?!i'
</code>```

And of course, the first capturing parentheses get all until the end, which is not what I want.

In the

```<code>select id, name from table
</code>```

string, it matches "id, nom from table" as the first part, which is not what I want.
(I want "id, nom" as the first part and "table" as the second in this case).

What I would like to do from this point is to tell the regex that the first capturing parentheses
should not match the " from " sequence if founded.
I know there is the negated character class feature, [^a-z],
but that just negate one character and not a whole string (as a sequence of letters in the right order).

Do you have any lights on this ?
Can we negate the content of parentheses for example with regex ?

答:
Try this out:

```<code>$string = "select id, name, CONCAT('id','.','nom') AS alias as a from table t INNER JOIN table2 t2 ON t.id=t2.user_id";
preg_match_all("!select (.*) from (.*)!i", $string, $result);
var_dump($result);
</code>```

I just tested it and it works just fine.

Body:
I want to analyse a mysql request with a php regex,
that is, extract the select_expr and the table_references from a mysql statement.
For example, here are two mysql queries that I would like my regex to match :

select id, name from table

select id, name

From that query I would like to extract 2 parts : the "id, name" information and the "table" information too.

The first part can actually contain a string like CONCAT('id','.','nom') AS alias,

and the second part can look like : table t INNER JOIN table2 t2 ON t.id=t2.user_id.

So I tried this "I know it's not working but will get me on the road" regex :

'!select (.*)( from (.*))?!i'

And of course, the first capturing parentheses get all until the end, which is not what I want.

In the

select id, name from table

string, it matches "id, nom from table" as the first part, which is not what I want.
(I want "id, nom" as the first part and "table" as the second in this case).

What I would like to do from this point is to tell the regex that the first capturing parentheses
should not match the " from " sequence if founded.
I know there is the negated character class feature, [^a-z],
but that just negate one character and not a whole string (as a sequence of letters in the right order).

Do you have any lights on this ?
Can we negate the content of parentheses for example with regex ?

Body:
Try this out:

$string = "select id, name, CONCAT('id','.','nom') AS alias as a from table t INNER JOIN table2 t2 ON t.id=t2.user_id";
preg_match_all("!select (.*) from (.*)!i", $string, $result);
var_dump($result);

I just tested it and it works just fine.


问:
Package a Folder in C#
I'm looking to make a program to make my life easier, I need to be able to easily select a folder, which I can do, I don't need help with that. I want to take the directory of a folder, and put that folder into a new folder with a specified name, and then zip up that folder into a zip format in which I can change the name and filetype of. Is this possible in vanilla C#? I've only ever done files for text and I've never looked at moving and packaging files. SO I'm really clueless, I'd just like to be guided into the right direction.

Edit: I found this code online, but I need to put the folder inside another folder, may I adapt upon this to do so?

```<code>string startPath = @"c:\example\start";
string zipPath = @"c:\example\result.zip";
string extractPath = @"c:\example\extract";

ZipFile.CreateFromDirectory(startPath, zipPath);
ZipFile.ExtractToDirectory(zipPath, extractPath);
</code>```

答:
So, after an extended chat discussion, here's what we've established.

The goal is to put the contents of a source directory into a zip with the following structure:

```<code>- Payload
|- name of source
|-- contents of source
</code>```

Okay, so, starting from an input path called startPath:

```<code>var parent = Path.GetDirectoryName(startPath);

var payload = Path.Combine(parent, "payload");
Directory.CreateDirectory(payload); // ensure payload ex
Directory.Move(startPath, Path.Combine(payload, Path.GetFileName(startPath));

var zipPath = Path.Combine(parent, "export.zip");
File.Delete(zipPath);
ZipFile.CreateFromDirectory(payload , zipPath, CompressionLevel.Optimal, true);
</code>```

The key is that true in the CreateFromDirectory call, that puts the entries in the archive under a directory with the same name as the directory being zipped (in this case, "payload"). Feel free to change CompressionLevel to other values if you want.

Now, this has the side effect of actually physically moving the source directory, which might not be the best user experience. If you want to avoid that, you'll have to basically do what ZipFile.CreateFromDirectory does by hand, which is to enumerate the source directory yourself and then copy the files into the zip archive (in which case you can name those files whatever you want):

```<code>    var parent = Path.GetDirectoryName(startPath);

    var zipPath = Path.Combine(parent, "export.zip");
    File.Delete(zipPath);

    using var zip = ZipFile.Open(zipPath, ZipArchiveMode.Create);

    foreach(var file in Directory.EnumerateFiles(startPath, "*", SearchOption.AllDirectories))
    {
        // get the path of the file relative to the parent directory
        // this gives us a path that starts with the source directory name
        // e.g. C:\example\start\file.txt -> start\file.txt
        var relativePath = Path.GetRelativePath(parent, file);

        // construct the path of the entry in the archive
        // this is "Payload", and then the relative path of the file
        // we need to fix up the separators because zip entries use /
        // e.g. start\file.txt -> Payload/start/file.txt
        var entryPath = Path.Combine("Payload", relativePath).Replace(Path.DirectorySeparatorChar, '/');

        // put the file in the archive
        // to specify a compression level, pass it as the third parameter here
        zip.CreateEntryFromFile(file, entryPath);
    }
</code>```

Title: Package a Folder in C#

Body:
I'm looking to make a program to make my life easier, I need to be able to easily select a folder, which I can do, I don't need help with that. I want to take the directory of a folder, and put that folder into a new folder with a specified name, and then zip up that folder into a zip format in which I can change the name and filetype of. Is this possible in vanilla C#? I've only ever done files for text and I've never looked at moving and packaging files. SO I'm really clueless, I'd just like to be guided into the right direction.

Edit: I found this code online, but I need to put the folder inside another folder, may I adapt upon this to do so?

string startPath = @"c:\example\start";
string zipPath = @"c:\example\result.zip";
string extractPath = @"c:\example\extract";

ZipFile.CreateFromDirectory(startPath, zipPath);
ZipFile.ExtractToDirectory(zipPath, extractPath);

Body:
So, after an extended chat discussion, here's what we've established.

The goal is to put the contents of a source directory into a zip with the following structure:

- Payload
|- name of source
|-- contents of source

Okay, so, starting from an input path called startPath:

var parent = Path.GetDirectoryName(startPath);

var payload = Path.Combine(parent, "payload");
Directory.CreateDirectory(payload); // ensure payload ex
Directory.Move(startPath, Path.Combine(payload, Path.GetFileName(startPath));

var zipPath = Path.Combine(parent, "export.zip");
File.Delete(zipPath);
ZipFile.CreateFromDirectory(payload , zipPath, CompressionLevel.Optimal, true);

The key is that true in the CreateFromDirectory call, that puts the entries in the archive under a directory with the same name as the directory being zipped (in this case, "payload"). Feel free to change CompressionLevel to other values if you want.

Now, this has the side effect of actually physically moving the source directory, which might not be the best user experience. If you want to avoid that, you'll have to basically do what ZipFile.CreateFromDirectory does by hand, which is to enumerate the source directory yourself and then copy the files into the zip archive (in which case you can name those files whatever you want):

    var parent = Path.GetDirectoryName(startPath);

    var zipPath = Path.Combine(parent, "export.zip");
    File.Delete(zipPath);

    using var zip = ZipFile.Open(zipPath, ZipArchiveMode.Create);

    foreach(var file in Directory.EnumerateFiles(startPath, "*", SearchOption.AllDirectories))
    {
        // get the path of the file relative to the parent directory
        // this gives us a path that starts with the source directory name
        // e.g. C:\example\start\file.txt -> start\file.txt
        var relativePath = Path.GetRelativePath(parent, file);

        // construct the path of the entry in the archive
        // this is "Payload", and then the relative path of the file
        // we need to fix up the separators because zip entries use /
        // e.g. start\file.txt -> Payload/start/file.txt
        var entryPath = Path.Combine("Payload", relativePath).Replace(Path.DirectorySeparatorChar, '/');

        // put the file in the archive
        // to specify a compression level, pass it as the third parameter here
        zip.CreateEntryFromFile(file, entryPath);
    }


问:
Twitter API returned a 401 (Unauthorized), Could not authenticate you
I simply want to post a tweet from my Raspberry Pi and keep getting a 401 error.

-----------------------------------------This is my code-----------------------------------------

```<code>import sys
from twython import Twython
consumer_key='x'
consumer_secret='x'
access_token='x'
access_token_secret='x'

twitter = Twython(
   consumer_key,
   consumer_secret,
   access_token,
   access_token_secret
)

twitter.update_status(status='Test')
</code>```

----------------------------------------Trace back------------------------------------------------

```<code>Traceback (most recent call last):
  File "/home/pi/Desktop/Programs/tweetTest.py", line 29, in <module>
    twitter.update_status(status='Test')
  File "/usr/lib/python3/dist-packages/twython/endpoints.py", line 123, in update_status
    return self.post('statuses/update', params=params)
  File "/usr/lib/python3/dist-packages/twython/api.py", line 274, in post
    return self.request(endpoint, 'POST', params=params, version=version)
  File "/usr/lib/python3/dist-packages/twython/api.py", line 264, in request
    api_call=url)
  File "/usr/lib/python3/dist-packages/twython/api.py", line 199, in _request
    retry_after=response.headers.get('X-Rate-Limit-Reset'))
twython.exceptions.TwythonAuthError: Twitter API returned a 401 (Unauthorized), Could not authenticate you
</code>```

答:
First of all, it appears you have misspelled 'consumer_secret' in your Twython instance: concumer_secret.

Secondly, if you have a desktop app (which I assume you have since this is tagged "raspberry-pi") it looks like you don't need to provide access tokens, just the 'APP_KEY' and 'APP_SECRET'. If you are using the oauth tokens, you might want to provide the code where you are receiving those in case that is the source of the problem.

Body:
I simply want to post a tweet from my Raspberry Pi and keep getting a 401 error.

-----------------------------------------This is my code-----------------------------------------

import sys
from twython import Twython
consumer_key='x'
consumer_secret='x'
access_token='x'
access_token_secret='x'

twitter = Twython(
   consumer_key,
   consumer_secret,
   access_token,
   access_token_secret
)

twitter.update_status(status='Test')

----------------------------------------Trace back------------------------------------------------

Traceback (most recent call last):
  File "/home/pi/Desktop/Programs/tweetTest.py", line 29, in <module>
    twitter.update_status(status='Test')
  File "/usr/lib/python3/dist-packages/twython/endpoints.py", line 123, in update_status
    return self.post('statuses/update', params=params)
  File "/usr/lib/python3/dist-packages/twython/api.py", line 274, in post
    return self.request(endpoint, 'POST', params=params, version=version)
  File "/usr/lib/python3/dist-packages/twython/api.py", line 264, in request
    api_call=url)
  File "/usr/lib/python3/dist-packages/twython/api.py", line 199, in _request
    retry_after=response.headers.get('X-Rate-Limit-Reset'))
twython.exceptions.TwythonAuthError: Twitter API returned a 401 (Unauthorized), Could not authenticate you


问:
Disable print pdf in iframe
does anybody know how to disable print/save pdf file? i'm making an application that enable user to view pdf file in an iframe. but i've just been ordered to make it to be as 'viewable but not printable'. now, what i can do is removing the toolbar button, but user still can right click and choose the print option. i had also disabling right click, but id doesn't work in iframe.

Please help.

答:
When you create the PDF,

set an admin password

set an EMPTY user password

set printing document permission to false

If you do not create the PDFs or cannot edit them, then you cannot make the document view-only.

Title: Disable print pdf in iframe


问:
Debugging ASP.NET Core in release mode
I have built an API with ASP.NET Core 5, when I publish it from my laptop (localhost), I am getting a good response but when I move the project to Windows Server 2019, I can't get a good response anymore (response is null).

I have tried with Postman to understand the issue, from localhost I can get good response but from the server it's always null (but Postman returns 200 as code response).

What I want is to debug the app from the server, please how can I achieve that?

答:
You can't debug your web app with release mode.

From your description, I think you should double check the connection string in your appsetting.json or web.config file.

Suggestion

How to deploy webapp to remote IIS.

Deploy your webapp with debug mode.

Remote debug your web app.

Title: Debugging ASP.NET Core in release mode


问:
How to access contained value in C++23 std::optional without writing identity boilerplate?
I am playing with C++23 std::optional additions, but I can not figure out how to elegantly access the value of object if optional is active.

I know I can use if, but that is so C++20.

I really like C++23 API changes, but I can not figure out how to skip the boilerplate of implementing identity.
For example:

```<code>#include <functional>
#include <iostream>
#include <optional>

void print(std::optional<std::string>& name) {
    name.transform([](std::string& x) {
        std::cout << x << std::endl;
        // I just want to print, without modifying optional, but next line is required
        return x;
    });
}

int main() {
    std::optional<std::string> name{{"Bjarne"}};
    print(name);
}
</code>```

It almost feels like std::optional is missing invoke member function.

note: in my example I do not chain anything else after transform, but that is for brevity, I care about optional not being modified.

答:
The operations that were added to optional in C++23 are monadic in nature. That was the design of them. They fulfill certain common usage patterns that would otherwise be verbose and cumbersome to use. transform is for conditional transformations. and_then is for conditionally processing a whole new optional from an existing one. or_else is for cases where processing the lack of a value is pretty simplistic. And all of them work together to allow chaining.

But the basic act of "do something if the optional has a value" doesn't fit into this paradigm. It's not chainable. It's not monadic manipulation of the value. It's just normal use of an optional.

And doing it with if will not only be clearer as to what's going on, it'll have less noise (no lamdba and parameters, for example). There's just no reason to do that when the usual mechanism is just fine.

Body:
I am playing with C++23 std::optional additions, but I can not figure out how to elegantly access the value of object if optional is active.

I know I can use if, but that is so C++20.

I really like C++23 API changes, but I can not figure out how to skip the boilerplate of implementing identity.
For example:

#include <functional>
#include <iostream>
#include <optional>

void print(std::optional<std::string>& name) {
    name.transform([](std::string& x) {
        std::cout << x << std::endl;
        // I just want to print, without modifying optional, but next line is required
        return x;
    });
}

int main() {
    std::optional<std::string> name{{"Bjarne"}};
    print(name);
}

It almost feels like std::optional is missing invoke member function.

note: in my example I do not chain anything else after transform, but that is for brevity, I care about optional not being modified.


问:
need help on installing eth-brownie on windows 10
While installing eth-brownie via "pip install eth-brownie" on vscode terminal, I am getting the error below:

I already chose the default terminal CMD

I already tried installing the required VS CODE build tools

Please help, thanks!

Error:

```<code>Running setup.py install for cytoolz ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\simpl\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\simpl\\AppData\\Local\\Temp\\pip-install-rncdvkky\\cytoolz_dc3d86c874b8423fa2581a6b8be8ab33\\setup.py'"'"'; __file__='"'"'C:\\Users\\simpl\\AppData\\Local\\Temp\\pip-install-rncdvkky\\cytoolz_dc3d86c874b8423fa2581a6b8be8ab33\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\simpl\AppData\Local\Temp\pip-record-q40t7042\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\simpl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Include\cytoolz'
         cwd: C:\Users\simpl\AppData\Local\Temp\pip-install-rncdvkky\cytoolz_dc3d86c874b8423fa2581a6b8be8ab33\
    Complete output (50 lines):
    ALERT: Cython not installed.  Building without Cython.
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.9
    creating build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\compatibility.py -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\utils_test.py -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\_signatures.py -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\_version.py -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\__init__.py -> build\lib.win-amd64-3.9\cytoolz
    creating build\lib.win-amd64-3.9\cytoolz\curried
    copying cytoolz\curried\exceptions.py -> build\lib.win-amd64-3.9\cytoolz\curried
    copying cytoolz\curried\operator.py -> build\lib.win-amd64-3.9\cytoolz\curried
    copying cytoolz\curried\__init__.py -> build\lib.win-amd64-3.9\cytoolz\curried
    copying cytoolz\dicttoolz.pyx -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\functoolz.pyx -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\itertoolz.pyx -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\recipes.pyx -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\utils.pyx -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\cpython.pxd -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\dicttoolz.pxd -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\functoolz.pxd -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\itertoolz.pxd -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\recipes.pxd -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\utils.pxd -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\__init__.pxd -> build\lib.win-amd64-3.9\cytoolz
    creating build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\dev_skip_test.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_compatibility.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_curried.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_curried_toolzlike.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_dev_skip_test.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_dicttoolz.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_docstrings.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_doctests.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_embedded_sigs.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_functoolz.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_inspect_args.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_itertoolz.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_none_safe.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_recipes.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_serialization.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_signatures.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_tlz.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_utils.py -> build\lib.win-amd64-3.9\cytoolz\tests
    running build_ext
    building 'cytoolz.dicttoolz' extension
    error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\simpl\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\simpl\\AppData\\Local\\Temp\\pip-install-rncdvkky\\cytoolz_dc3d86c874b8423fa2581a6b8be8ab33\\setup.py'"'"'; __file__='"'"'C:\\Users\\simpl\\AppData\\Local\\Temp\\pip-install-rncdvkky\\cytoolz_dc3d86c874b8423fa2581a6b8be8ab33\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\simpl\AppData\Local\Temp\pip-record-q40t7042\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\simpl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Include\cytoolz' Check the logs for full command output.
</code>```

答:
I also faced same error even after installing vs tool (https://visualstudio.microsoft.com/visual-cpp-build-tools/). Therefore, I found conda installation.
https://anaconda.org/anaconda/cytoolz</p>

Body:
While installing eth-brownie via "pip install eth-brownie" on vscode terminal, I am getting the error below:

I already chose the default terminal CMD

I already tried installing the required VS CODE build tools

Please help, thanks!

Error:

Running setup.py install for cytoolz ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\simpl\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\simpl\\AppData\\Local\\Temp\\pip-install-rncdvkky\\cytoolz_dc3d86c874b8423fa2581a6b8be8ab33\\setup.py'"'"'; __file__='"'"'C:\\Users\\simpl\\AppData\\Local\\Temp\\pip-install-rncdvkky\\cytoolz_dc3d86c874b8423fa2581a6b8be8ab33\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\simpl\AppData\Local\Temp\pip-record-q40t7042\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\simpl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Include\cytoolz'
         cwd: C:\Users\simpl\AppData\Local\Temp\pip-install-rncdvkky\cytoolz_dc3d86c874b8423fa2581a6b8be8ab33\
    Complete output (50 lines):
    ALERT: Cython not installed.  Building without Cython.
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.9
    creating build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\compatibility.py -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\utils_test.py -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\_signatures.py -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\_version.py -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\__init__.py -> build\lib.win-amd64-3.9\cytoolz
    creating build\lib.win-amd64-3.9\cytoolz\curried
    copying cytoolz\curried\exceptions.py -> build\lib.win-amd64-3.9\cytoolz\curried
    copying cytoolz\curried\operator.py -> build\lib.win-amd64-3.9\cytoolz\curried
    copying cytoolz\curried\__init__.py -> build\lib.win-amd64-3.9\cytoolz\curried
    copying cytoolz\dicttoolz.pyx -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\functoolz.pyx -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\itertoolz.pyx -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\recipes.pyx -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\utils.pyx -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\cpython.pxd -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\dicttoolz.pxd -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\functoolz.pxd -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\itertoolz.pxd -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\recipes.pxd -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\utils.pxd -> build\lib.win-amd64-3.9\cytoolz
    copying cytoolz\__init__.pxd -> build\lib.win-amd64-3.9\cytoolz
    creating build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\dev_skip_test.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_compatibility.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_curried.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_curried_toolzlike.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_dev_skip_test.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_dicttoolz.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_docstrings.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_doctests.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_embedded_sigs.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_functoolz.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_inspect_args.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_itertoolz.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_none_safe.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_recipes.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_serialization.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_signatures.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_tlz.py -> build\lib.win-amd64-3.9\cytoolz\tests
    copying cytoolz\tests\test_utils.py -> build\lib.win-amd64-3.9\cytoolz\tests
    running build_ext
    building 'cytoolz.dicttoolz' extension
    error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\simpl\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\simpl\\AppData\\Local\\Temp\\pip-install-rncdvkky\\cytoolz_dc3d86c874b8423fa2581a6b8be8ab33\\setup.py'"'"'; __file__='"'"'C:\\Users\\simpl\\AppData\\Local\\Temp\\pip-install-rncdvkky\\cytoolz_dc3d86c874b8423fa2581a6b8be8ab33\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\simpl\AppData\Local\Temp\pip-record-q40t7042\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\simpl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Include\cytoolz' Check the logs for full command output.


问:
php subdomain session sharing not working properly
The site configuration is as follows:

testsite.co.kr :  default site

login.testsite.co.kr : subdomain created for integrated login

100.testsite.co.kr : subdomain

200.testsite.co.kr  : subdomain

session_test.php : content start ===========================

```<code>session_set_cookie_params(0, '/');
session_name("mysession");
session_cache_limiter("no-cache, must-revalidate");
ini_set("session.cookie_domain", ".testsite.co.kr");
session_start();
$_SESSION['userid'] = "kim";
</code>```

session_test.php  : content end ===========================

After placing and running session_test.php on the testsite.co.kr site
,  access to 100.testsite.co.kr or 200.testsite.co.kr, be logged in  (can read $_SESSION['userid'])

After placing and running session_test.php on the login.testsite.co.kr site
, access to 100.testsite.co.kr or 200.testsite.co.kr, not be logged in. (Cannot read $_SESSION['userid'])

Even when logging in at login.testsite.co.kr, is it not possible to log in to another subdomain (session sharing)?

How to log in to login.testsite.co.kr(subdomain) and be logged in state  when accessing another subdomain?

please help me

答:
** Note ** The OP is using PHP4.3 which is 13 years old and cannot satisfy modern browser requirements for cookie security.

Add the domain to your session_set_cookie_params in line 1

```<code> session_set_cookie_params(0, '/', '.testsite.co.kr');
</code>```

The params must be set before initializing the session.

This is all covered in the manual. It also says to keep the leading "." in the domain to allow subdomains to use the cookie.

Body:
The site configuration is as follows:

testsite.co.kr :  default site

login.testsite.co.kr : subdomain created for integrated login

100.testsite.co.kr : subdomain

200.testsite.co.kr  : subdomain

session_test.php : content start ===========================

session_set_cookie_params(0, '/');
session_name("mysession");
session_cache_limiter("no-cache, must-revalidate");
ini_set("session.cookie_domain", ".testsite.co.kr");
session_start();
$_SESSION['userid'] = "kim";

session_test.php  : content end ===========================

After placing and running session_test.php on the testsite.co.kr site
,  access to 100.testsite.co.kr or 200.testsite.co.kr, be logged in  (can read $_SESSION['userid'])

After placing and running session_test.php on the login.testsite.co.kr site
, access to 100.testsite.co.kr or 200.testsite.co.kr, not be logged in. (Cannot read $_SESSION['userid'])

Even when logging in at login.testsite.co.kr, is it not possible to log in to another subdomain (session sharing)?

How to log in to login.testsite.co.kr(subdomain) and be logged in state  when accessing another subdomain?

please help me

Body:
** Note ** The OP is using PHP4.3 which is 13 years old and cannot satisfy modern browser requirements for cookie security.

Add the domain to your session_set_cookie_params in line 1

 session_set_cookie_params(0, '/', '.testsite.co.kr');

The params must be set before initializing the session.

This is all covered in the manual. It also says to keep the leading "." in the domain to allow subdomains to use the cookie.