问:
React: Generating dynamically a nested component
I am really struggling in this problem.
I am making an admin page based with next.js, I am working for the layouts.
What I want is based of the url path, I generate the nested layouts for my web page.

For example: if the URL is home/test/route1 then I should generate in a variable something like this:

```<code><HomeLayout>
    <TestLayout>
        <Route1Layout>
            <main>{children}</main>
        </Route1Layout>
    </HomeLayout>
</TestLayout>

</code>```

This is how I have implement it in the main component file (layoutsManager.js):

```<code>// we import the layout that will be persistent trought the home url and his child
import HomeLayout from "./home/HomeLayout.jsx";

// this map must containt other map or Component functions
const layoutsMap = new Map(Object.entries({
    "home": new Map(Object.entries({
        "index":HomeLayout,
        "test": new Map(Object.entries({
            "route1":HomeLayout,
            "route2":HomeLayout
        }))
    })),
}));

export default function DisplayLayout({urlPath,children}) {
    let pathArray =  urlPath.slice(1).split("/");

    function GenerateLayout({path, map, children}) {
        let newMap = map;
        let layoutsArray = [];

        path.forEach((name) => {
            if (newMap.has(name)) {
                if (newMap.get(name) instanceof Map) {
                    newMap = newMap.get(name);
                    if (newMap.has("index")) {
                        let NewElement = newMap.get("index");
                        layoutsArray.push(NewElement);
                    }
                }
                else {
                    let NewElement = newMap.get(name);
                    layoutsArray.push(NewElement);
                }
            }
        });

        let NewLayout = ({children}) => <>{children}</>;
        if (layoutsArray.length > 0) {
            let LastLayout = layoutsArray.pop();
            layoutsArray.forEach((Layout,index) => {
                NewLayout = <NewLayout><Layout></Layout></NewLayout>;
            });
            NewLayout = <NewLayout><LastLayout></LastLayout></NewLayout>;
        }
        else {
            NewLayout = <h1 className="text-red-600 font-bold text-2xl">Error, there is no layouts in the layoutsMap Map</h1>;
        }

        return (NewLayout);
    };

    return (
        <GenerateLayout path={pathArray} map={layoutsMap}>{children}</GenerateLayout>
    );
};
</code>```

To explain it, in the local GenerateLayout component, I first retrieve all the React Component from the layoutsMap variable then I get an array full of react components.
Next I read each element of the array by adding the child component into the new parent component and when I reach the last element, I add the last child with the content of the page.

Like this for the following array [HomeLayout,TestLayout,Route1Layout]:

Index 0:

```<code><><HomeLayout></HomeLayout></>
</code>```

Index 1:

```<code><><HomeLayout><TestLayout></TestLayout></HomeLayout></>
</code>```

Index 2:

```<code><><HomeLayout><TestLayout><Route1Layout><main>{children}</main></Route1Layout></TestLayout></HomeLayout></>
</code>```

I hope you get the idea but my nightmare is that I always get stuck with the same damn error:

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: ...

Any help would be really appreciated.
Thanks in advance.

Body:
I am really struggling in this problem.
I am making an admin page based with next.js, I am working for the layouts.
What I want is based of the url path, I generate the nested layouts for my web page.

For example: if the URL is home/test/route1 then I should generate in a variable something like this:

<HomeLayout>
    <TestLayout>
        <Route1Layout>
            {children}
        </Route1Layout>
    </HomeLayout>
</TestLayout>

This is how I have implement it in the main component file (layoutsManager.js):

// we import the layout that will be persistent trought the home url and his child
import HomeLayout from "./home/HomeLayout.jsx";

// this map must containt other map or Component functions
const layoutsMap = new Map(Object.entries({
    "home": new Map(Object.entries({
        "index":HomeLayout,
        "test": new Map(Object.entries({
            "route1":HomeLayout,
            "route2":HomeLayout
        }))
    })),
}));

export default function DisplayLayout({urlPath,children}) {
    let pathArray =  urlPath.slice(1).split("/");

    function GenerateLayout({path, map, children}) {
        let newMap = map;
        let layoutsArray = [];

        path.forEach((name) => {
            if (newMap.has(name)) {
                if (newMap.get(name) instanceof Map) {
                    newMap = newMap.get(name);
                    if (newMap.has("index")) {
                        let NewElement = newMap.get("index");
                        layoutsArray.push(NewElement);
                    }
                }
                else {
                    let NewElement = newMap.get(name);
                    layoutsArray.push(NewElement);
                }
            }
        });

        let NewLayout = ({children}) => <>{children}</>;
        if (layoutsArray.length > 0) {
            let LastLayout = layoutsArray.pop();
            layoutsArray.forEach((Layout,index) => {
                NewLayout = <NewLayout><Layout></Layout></NewLayout>;
            });
            NewLayout = <NewLayout><LastLayout></LastLayout></NewLayout>;
        }
        else {
            NewLayout =
Error, there is no layouts in the layoutsMap Map
;
        }

        return (NewLayout);
    };

    return (
        <GenerateLayout path={pathArray} map={layoutsMap}>{children}</GenerateLayout>
    );
};

To explain it, in the local GenerateLayout component, I first retrieve all the React Component from the layoutsMap variable then I get an array full of react components.
Next I read each element of the array by adding the child component into the new parent component and when I reach the last element, I add the last child with the content of the page.

Like this for the following array [HomeLayout,TestLayout,Route1Layout]:

Index 0:

<><HomeLayout></HomeLayout></>

Index 1:

<><HomeLayout><TestLayout></TestLayout></HomeLayout></>

Index 2:

<><HomeLayout><TestLayout><Route1Layout>{children}</Route1Layout></TestLayout></HomeLayout></>

I hope you get the idea but my nightmare is that I always get stuck with the same damn error:

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: ...

Any help would be really appreciated.
Thanks in advance.


来源: stackexchange

问:
How to get data of a week from firebase database in android studio using java?
I'am new to programming. I want to get all the data of an week from firebase database when radio button is checked . How can i achieve that ?

FirebaseReference Class

```<code>package com.prabinchand.myexpensev2;

import android.content.Context;

import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;

import java.util.Objects;

public class FirebaseReference {
    public static GoogleSignInAccount account;
    public static DatabaseReference databaseReference;
    public static DatabaseReference incomeReference;

    public static DatabaseReference databaseReference(Context context) {
        account = GoogleSignIn.getLastSignedInAccount(context.getApplicationContext());
        databaseReference = FirebaseDatabase.getInstance().getReference()
                .child("UsersExpense").child(Objects.requireNonNull(account.getDisplayName()));

        return databaseReference;
    }

    public static DatabaseReference incomeDBReference(Context context) {
        account = GoogleSignIn.getLastSignedInAccount(context.getApplicationContext());
        incomeReference = FirebaseDatabase.getInstance().getReference()
                .child("UsersIncome").child(Objects.requireNonNull(account.getDisplayName()));
        return incomeReference;
    }
}
</code>```
```<code>weeklyCB.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
    @Override
    public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
        if (compoundButton.isChecked()){
            if (getActivity()!=null){
                showTodayDate();
                FirebaseReference.databaseReference(getActivity())
                        .addValueEventListener(new ValueEventListener() {
                            @Override
                            public void onDataChange(@NonNull DataSnapshot snapshot) {
                                for (DataSnapshot dataSnapshot : snapshot.getChildren()){
                                    String getDate = dataSnapshot.child("time").getValue(String.class);
                                }
                                Query q = FirebaseReference.databaseReference(getActivity()).orderByChild("time")
                                        .equalTo(Calendar.DAY_OF_YEAR, String.valueOf(-7));
                                adapter.updateOptions(new FirebaseRecyclerOptions.Builder<ExpenseModel>()
                                        .setQuery(q, ExpenseModel.class).build());
                            }

                            @Override
                            public void onCancelled(@NonNull DatabaseError error) {

                            }
                        });
            }
        }else {
            Toast.makeText(getActivity(), "Weekly unchecked !", Toast.LENGTH_SHORT).show();
        }
    }
});
</code>```

Below is the JSON structure of my database reference. From Users Expense i want to get all the data of a week, or can say data from 7 days including today.

How can i code that gets all the data for 7 days or a week?

JSON structure

```<code>{
  "Users": {
    "Prabin Chand": {
      "email": "prabinchand77@gmail.com",
      "name": "Prabin Chand",
      "picture": "https://lh3.googleusercontent.com/a/AEdFTp7oaRy1fb0vs9ZYwGamVup5a7zatX5M5EfOeDNmrg"
    },
    "gibl rpa": {
      "email": "gibl.rpa@gmail.com",
      "name": "gibl rpa",
      "picture": "null"
    },
    "prabin chand": {
      "email": "prabinchand333@gmail.com",
      "name": "prabin chand",
      "picture": "https://lh3.googleusercontent.com/a/ALm5wu30fbdm8MUC0moXMg1Xjr5N002LOR1wXnfdEOX4"
    }
  },
  "UsersExpense": {
    "Prabin Chand": {
      "-NImTBCIMgzWSDc3Kv-9": {
        "amount": "250",
        "description": "Gros",
        "exType": "Grocery",
        "milli": -1670515310217,
        "time": "Thu, 08/12/2022"
      },
      "-NImTEqAMkKijjtGr46u": {
        "amount": "450",
        "description": "Vada deko",
        "exType": "Rent",
        "milli": -1670515325121,
        "time": "Thu, 08/12/2022"
      },
      "-NImTHA4Qk-MY-Bc56ij": {
        "amount": "1500",
        "description": "Fuel",
        "exType": "Bike",
        "milli": -1670515334652,
        "time": "Thu, 08/12/2022"
      },
      "-NImX8bXGd-dTZbctQEB": {
        "amount": "500",
        "description": "Beer",
        "exType": "Beer",
        "milli": -1670516755479,
        "time": "Tue, 6/12/2022"
      },
      "-NIpyTVQwIB4L7e143Xt": {
        "amount": "45",
        "description": "Ajaja",
        "exType": "Grocery",
        "milli": -1670574106276,
        "time": "Fri, 09/12/2022"
      },
      "-NIpyZ73MtQPh9nmoAnR": {
        "amount": "45",
        "description": "Ajai",
        "exType": "Bike",
        "milli": -1670574129294,
        "time": "Fri, 09/12/2022"
      },
      "-NIpycMQKnGrfqaEKKV7": {
        "amount": "10",
        "description": "Beer aja",
        "exType": "Beer",
        "milli": -1670574146661,
        "time": "Fri, 09/12/2022"
      },
      "-NIq50Tcd8VZJHvQihSy": {
        "amount": "45",
        "description": "Hsksk",
        "exType": "Rent",
        "milli": -1670576084282,
        "time": "Fri, 09/12/2022"
      },
      "-NJ4ARWmLeaIsdnxmkXi": {
        "amount": "45",
        "description": "Aja",
        "exType": "Grocery",
        "milli": -1670829164672,
        "time": "Mon, 12/12/2022"
      }
    }
  }
}
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I'am new to programming. I want to get all the data of an week from firebase database when radio button is checked . How can i achieve that ?

FirebaseReference Class

package com.prabinchand.myexpensev2;

import android.content.Context;

import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;

import java.util.Objects;

public class FirebaseReference {
    public static GoogleSignInAccount account;
    public static DatabaseReference databaseReference;
    public static DatabaseReference incomeReference;

    public static DatabaseReference databaseReference(Context context) {
        account = GoogleSignIn.getLastSignedInAccount(context.getApplicationContext());
        databaseReference = FirebaseDatabase.getInstance().getReference()
                .child("UsersExpense").child(Objects.requireNonNull(account.getDisplayName()));

        return databaseReference;
    }

    public static DatabaseReference incomeDBReference(Context context) {
        account = GoogleSignIn.getLastSignedInAccount(context.getApplicationContext());
        incomeReference = FirebaseDatabase.getInstance().getReference()
                .child("UsersIncome").child(Objects.requireNonNull(account.getDisplayName()));
        return incomeReference;
    }
}

weeklyCB.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
    @Override
    public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
        if (compoundButton.isChecked()){
            if (getActivity()!=null){
                showTodayDate();
                FirebaseReference.databaseReference(getActivity())
                        .addValueEventListener(new ValueEventListener() {
                            @Override
                            public void onDataChange(@NonNull DataSnapshot snapshot) {
                                for (DataSnapshot dataSnapshot : snapshot.getChildren()){
                                    String getDate = dataSnapshot.child("time").getValue(String.class);
                                }
                                Query q = FirebaseReference.databaseReference(getActivity()).orderByChild("time")
                                        .equalTo(Calendar.DAY_OF_YEAR, String.valueOf(-7));
                                adapter.updateOptions(new FirebaseRecyclerOptions.Builder<ExpenseModel>()
                                        .setQuery(q, ExpenseModel.class).build());
                            }

                            @Override
                            public void onCancelled(@NonNull DatabaseError error) {

                            }
                        });
            }
        }else {
            Toast.makeText(getActivity(), "Weekly unchecked !", Toast.LENGTH_SHORT).show();
        }
    }
});

Below is the JSON structure of my database reference. From Users Expense i want to get all the data of a week, or can say data from 7 days including today.

How can i code that gets all the data for 7 days or a week?

JSON structure

{
  "Users": {
    "Prabin Chand": {
      "email": "prabinchand77@gmail.com",
      "name": "Prabin Chand",
      "picture": "https://lh3.googleusercontent.com/a/AEdFTp7oaRy1fb0vs9ZYwGamVup5a7zatX5M5EfOeDNmrg"
    },
    "gibl rpa": {
      "email": "gibl.rpa@gmail.com",
      "name": "gibl rpa",
      "picture": "null"
    },
    "prabin chand": {
      "email": "prabinchand333@gmail.com",
      "name": "prabin chand",
      "picture": "https://lh3.googleusercontent.com/a/ALm5wu30fbdm8MUC0moXMg1Xjr5N002LOR1wXnfdEOX4"
    }
  },
  "UsersExpense": {
    "Prabin Chand": {
      "-NImTBCIMgzWSDc3Kv-9": {
        "amount": "250",
        "description": "Gros",
        "exType": "Grocery",
        "milli": -1670515310217,
        "time": "Thu, 08/12/2022"
      },
      "-NImTEqAMkKijjtGr46u": {
        "amount": "450",
        "description": "Vada deko",
        "exType": "Rent",
        "milli": -1670515325121,
        "time": "Thu, 08/12/2022"
      },
      "-NImTHA4Qk-MY-Bc56ij": {
        "amount": "1500",
        "description": "Fuel",
        "exType": "Bike",
        "milli": -1670515334652,
        "time": "Thu, 08/12/2022"
      },
      "-NImX8bXGd-dTZbctQEB": {
        "amount": "500",
        "description": "Beer",
        "exType": "Beer",
        "milli": -1670516755479,
        "time": "Tue, 6/12/2022"
      },
      "-NIpyTVQwIB4L7e143Xt": {
        "amount": "45",
        "description": "Ajaja",
        "exType": "Grocery",
        "milli": -1670574106276,
        "time": "Fri, 09/12/2022"
      },
      "-NIpyZ73MtQPh9nmoAnR": {
        "amount": "45",
        "description": "Ajai",
        "exType": "Bike",
        "milli": -1670574129294,
        "time": "Fri, 09/12/2022"
      },
      "-NIpycMQKnGrfqaEKKV7": {
        "amount": "10",
        "description": "Beer aja",
        "exType": "Beer",
        "milli": -1670574146661,
        "time": "Fri, 09/12/2022"
      },
      "-NIq50Tcd8VZJHvQihSy": {
        "amount": "45",
        "description": "Hsksk",
        "exType": "Rent",
        "milli": -1670576084282,
        "time": "Fri, 09/12/2022"
      },
      "-NJ4ARWmLeaIsdnxmkXi": {
        "amount": "45",
        "description": "Aja",
        "exType": "Grocery",
        "milli": -1670829164672,
        "time": "Mon, 12/12/2022"
      }
    }
  }
}


问:
Why are plots popping up on a separate R Graphics Device 2 after upgrade to R V4.2.2 and not on the Plots section on right hand pane?
I upgraded my Rstudio version to 4.2.2 today.
Normally, my images/curves would display on the Plots tab on the right hand section.
Since upgrading, it keeps displaying on a pop-up window titled R Graphics Device 2.
How do i disable to pop up and revert the images to display within the Plots window on the R studio pane next to console?

I have tried restarting the rstudio version 4.2.2 but it has not worked.


问:
How to disable secientific notation in rust polars?
In rust polars, float number larger than 1e10 will be converted to secientific notation.

EXAMPLE:

```<code>use polars::prelude::*;
use polars::df;
use std::fs;

fn main() {
    let mut df = df!{
        "name" => ["a", "b", "c", "d", "e", "f"],
        "b" => [1, 1, 1, 1, 1, 1],
        "c" => [2, 2, 2, 2, 2, 2],
        "d" => [3, 3, 3, 3, 3, 3],
        "e" => [4.11, 4.12, 4.3, 4.4, 4.5, 4.6],
        "f" => [10000000005.1, 10000000005.2, 10000000005.3, 10000000005.4, 10000000005.5, 10000000005.6]
    }.unwrap();
    dbg!(&df);
    let file = fs::File::create("test.csv").expect("failed");
    CsvWriter::new(&file)
        .has_header(true)
        .with_delimiter(b',')
        .finish(&mut df)
        .unwrap();
}
</code>```

Here is output :

```<code>[src/main.rs:14] &df = shape: (6, 6)
┌──────┬─────┬─────┬─────┬──────┬───────────┐
│ name ┆ b   ┆ c   ┆ d   ┆ e    ┆ f         │
│ ---  ┆ --- ┆ --- ┆ --- ┆ ---  ┆ ---       │
│ str  ┆ i32 ┆ i32 ┆ i32 ┆ f64  ┆ f64       │
╞══════╪═════╪═════╪═════╪══════╪═══════════╡
│ a    ┆ 1   ┆ 2   ┆ 3   ┆ 4.11 ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ b    ┆ 1   ┆ 2   ┆ 3   ┆ 4.12 ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ c    ┆ 1   ┆ 2   ┆ 3   ┆ 4.3  ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ d    ┆ 1   ┆ 2   ┆ 3   ┆ 4.4  ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ e    ┆ 1   ┆ 2   ┆ 3   ┆ 4.5  ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ f    ┆ 1   ┆ 2   ┆ 3   ┆ 4.6  ┆ 1.0000e10 │
└──────┴─────┴─────┴─────┴──────┴───────────┘
</code>```

And here is the csv file:

```<code>name,b,c,d,e,f
a,1,2,3,4.11,1.00000000051e10
b,1,2,3,4.12,1.00000000052e10
c,1,2,3,4.3,1.00000000053e10
d,1,2,3,4.4,1.00000000054e10
e,1,2,3,4.5,1.00000000055e10
f,1,2,3,4.6,1.00000000056e10
</code>```

For those values larger than 1e10, they formated and displayed as secientific notation.
If I use with_float_precision() method in CsvWriter, things will like this.

```<code>    ...
    CsvWriter::new(&file)
        .has_header(true)
        .with_delimiter(b',')
        .with_float_precision(Some(1))
        .finish(&mut df)
        .unwrap();
}
</code>```
```<code>Termianl:
┌──────┬─────┬─────┬─────┬──────┬───────────┐
│ name ┆ b   ┆ c   ┆ d   ┆ e    ┆ f         │
│ ---  ┆ --- ┆ --- ┆ --- ┆ ---  ┆ ---       │
│ str  ┆ i32 ┆ i32 ┆ i32 ┆ f64  ┆ f64       │
╞══════╪═════╪═════╪═════╪══════╪═══════════╡
│ a    ┆ 1   ┆ 2   ┆ 3   ┆ 4.11 ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ b    ┆ 1   ┆ 2   ┆ 3   ┆ 4.12 ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ c    ┆ 1   ┆ 2   ┆ 3   ┆ 4.3  ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ d    ┆ 1   ┆ 2   ┆ 3   ┆ 4.4  ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ e    ┆ 1   ┆ 2   ┆ 3   ┆ 4.5  ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ f    ┆ 1   ┆ 2   ┆ 3   ┆ 4.6  ┆ 1.0000e10 │
└──────┴─────┴─────┴─────┴──────┴───────────┘

CSV File:
name,b,c,d,e,f
a,1,2,3,4.1,10000000005.1
b,1,2,3,4.1,10000000005.2
c,1,2,3,4.3,10000000005.3
d,1,2,3,4.4,10000000005.4
e,1,2,3,4.5,10000000005.5
f,1,2,3,4.6,10000000005.6
</code>```

OR:

```<code>    ...
    CsvWriter::new(&file)
        .has_header(true)
        .with_delimiter(b',')
        .with_float_precision(Some(2))
        .finish(&mut df)
        .unwrap();
}
</code>```
```<code>Terminal:
┌──────┬─────┬─────┬─────┬──────┬───────────┐
│ name ┆ b   ┆ c   ┆ d   ┆ e    ┆ f         │
│ ---  ┆ --- ┆ --- ┆ --- ┆ ---  ┆ ---       │
│ str  ┆ i32 ┆ i32 ┆ i32 ┆ f64  ┆ f64       │
╞══════╪═════╪═════╪═════╪══════╪═══════════╡
│ a    ┆ 1   ┆ 2   ┆ 3   ┆ 4.11 ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ b    ┆ 1   ┆ 2   ┆ 3   ┆ 4.12 ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ c    ┆ 1   ┆ 2   ┆ 3   ┆ 4.3  ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ d    ┆ 1   ┆ 2   ┆ 3   ┆ 4.4  ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ e    ┆ 1   ┆ 2   ┆ 3   ┆ 4.5  ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ f    ┆ 1   ┆ 2   ┆ 3   ┆ 4.6  ┆ 1.0000e10 │
└──────┴─────┴─────┴─────┴──────┴───────────┘

CSV File:
name,b,c,d,e,f
a,1,2,3,4.11,10000000005.10
b,1,2,3,4.12,10000000005.20
c,1,2,3,4.30,10000000005.30
d,1,2,3,4.40,10000000005.40
e,1,2,3,4.50,10000000005.50
f,1,2,3,4.60,10000000005.60
</code>```

This method can only disable scientific notation when writing csv, but it will also cause unnecessary precision or pricision loss.

How to disable secientific notation globally without increase or loss of precision?

Body:
In rust polars, float number larger than 1e10 will be converted to secientific notation.

EXAMPLE:

use polars::prelude::*;
use polars::df;
use std::fs;

fn main() {
    let mut df = df!{
        "name" => ["a", "b", "c", "d", "e", "f"],
        "b" => [1, 1, 1, 1, 1, 1],
        "c" => [2, 2, 2, 2, 2, 2],
        "d" => [3, 3, 3, 3, 3, 3],
        "e" => [4.11, 4.12, 4.3, 4.4, 4.5, 4.6],
        "f" => [10000000005.1, 10000000005.2, 10000000005.3, 10000000005.4, 10000000005.5, 10000000005.6]
    }.unwrap();
    dbg!(&df);
    let file = fs::File::create("test.csv").expect("failed");
    CsvWriter::new(&file)
        .has_header(true)
        .with_delimiter(b',')
        .finish(&mut df)
        .unwrap();
}

Here is output :

[src/main.rs:14] &df = shape: (6, 6)
┌──────┬─────┬─────┬─────┬──────┬───────────┐
│ name ┆ b   ┆ c   ┆ d   ┆ e    ┆ f         │
│ ---  ┆ --- ┆ --- ┆ --- ┆ ---  ┆ ---       │
│ str  ┆ i32 ┆ i32 ┆ i32 ┆ f64  ┆ f64       │
╞══════╪═════╪═════╪═════╪══════╪═══════════╡
│ a    ┆ 1   ┆ 2   ┆ 3   ┆ 4.11 ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ b    ┆ 1   ┆ 2   ┆ 3   ┆ 4.12 ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ c    ┆ 1   ┆ 2   ┆ 3   ┆ 4.3  ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ d    ┆ 1   ┆ 2   ┆ 3   ┆ 4.4  ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ e    ┆ 1   ┆ 2   ┆ 3   ┆ 4.5  ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ f    ┆ 1   ┆ 2   ┆ 3   ┆ 4.6  ┆ 1.0000e10 │
└──────┴─────┴─────┴─────┴──────┴───────────┘

And here is the csv file:

name,b,c,d,e,f
a,1,2,3,4.11,1.00000000051e10
b,1,2,3,4.12,1.00000000052e10
c,1,2,3,4.3,1.00000000053e10
d,1,2,3,4.4,1.00000000054e10
e,1,2,3,4.5,1.00000000055e10
f,1,2,3,4.6,1.00000000056e10

For those values larger than 1e10, they formated and displayed as secientific notation.
If I use with_float_precision() method in CsvWriter, things will like this.

    ...
    CsvWriter::new(&file)
        .has_header(true)
        .with_delimiter(b',')
        .with_float_precision(Some(1))
        .finish(&mut df)
        .unwrap();
}

Termianl:
┌──────┬─────┬─────┬─────┬──────┬───────────┐
│ name ┆ b   ┆ c   ┆ d   ┆ e    ┆ f         │
│ ---  ┆ --- ┆ --- ┆ --- ┆ ---  ┆ ---       │
│ str  ┆ i32 ┆ i32 ┆ i32 ┆ f64  ┆ f64       │
╞══════╪═════╪═════╪═════╪══════╪═══════════╡
│ a    ┆ 1   ┆ 2   ┆ 3   ┆ 4.11 ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ b    ┆ 1   ┆ 2   ┆ 3   ┆ 4.12 ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ c    ┆ 1   ┆ 2   ┆ 3   ┆ 4.3  ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ d    ┆ 1   ┆ 2   ┆ 3   ┆ 4.4  ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ e    ┆ 1   ┆ 2   ┆ 3   ┆ 4.5  ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ f    ┆ 1   ┆ 2   ┆ 3   ┆ 4.6  ┆ 1.0000e10 │
└──────┴─────┴─────┴─────┴──────┴───────────┘

CSV File:
name,b,c,d,e,f
a,1,2,3,4.1,10000000005.1
b,1,2,3,4.1,10000000005.2
c,1,2,3,4.3,10000000005.3
d,1,2,3,4.4,10000000005.4
e,1,2,3,4.5,10000000005.5
f,1,2,3,4.6,10000000005.6

OR:

    ...
    CsvWriter::new(&file)
        .has_header(true)
        .with_delimiter(b',')
        .with_float_precision(Some(2))
        .finish(&mut df)
        .unwrap();
}

Terminal:
┌──────┬─────┬─────┬─────┬──────┬───────────┐
│ name ┆ b   ┆ c   ┆ d   ┆ e    ┆ f         │
│ ---  ┆ --- ┆ --- ┆ --- ┆ ---  ┆ ---       │
│ str  ┆ i32 ┆ i32 ┆ i32 ┆ f64  ┆ f64       │
╞══════╪═════╪═════╪═════╪══════╪═══════════╡
│ a    ┆ 1   ┆ 2   ┆ 3   ┆ 4.11 ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ b    ┆ 1   ┆ 2   ┆ 3   ┆ 4.12 ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ c    ┆ 1   ┆ 2   ┆ 3   ┆ 4.3  ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ d    ┆ 1   ┆ 2   ┆ 3   ┆ 4.4  ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ e    ┆ 1   ┆ 2   ┆ 3   ┆ 4.5  ┆ 1.0000e10 │
├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ f    ┆ 1   ┆ 2   ┆ 3   ┆ 4.6  ┆ 1.0000e10 │
└──────┴─────┴─────┴─────┴──────┴───────────┘

CSV File:
name,b,c,d,e,f
a,1,2,3,4.11,10000000005.10
b,1,2,3,4.12,10000000005.20
c,1,2,3,4.30,10000000005.30
d,1,2,3,4.40,10000000005.40
e,1,2,3,4.50,10000000005.50
f,1,2,3,4.60,10000000005.60

This method can only disable scientific notation when writing csv, but it will also cause unnecessary precision or pricision loss.

How to disable secientific notation globally without increase or loss of precision?


问:
Failing to insert total number of records in cassandra cluster from local why?
Full Data before exporting
enter image description here

Connection with cassandra
enter image description here

Exporting data
enter image description here

Loading Data
enter image description here

Failing to insert total number of records in the Cluster why?


问:
How do I save/read to a file
so I have made my code and it works and everything but... now it says that I have to save it to a file. Here's my code:

```<code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace Case3Password
{
    internal class Program
    {
        static void Main(string[] args)
        {
            bool que = false;
            while (que == false)
            {
                Console.WriteLine("Choose whether to login, make or change");
                string command = Console.ReadLine();
                if (command == "make" && !MadeAccount)
                {
                    MakeAccount();
                }
                else if (command == "change" && MadeAccount)
                {
                    ChangePassword();
                }
                else if (command == "login" & MadeAccount)
                {
                    Login();
                }
                else
                {
                    Console.WriteLine("incorrect choice, type either 'login', 'make' or 'change'");
                }
            }
        }
        static bool MadeAccount = false;
        static void MakeAccount()
        {
            Console.WriteLine("Input your username");
            string Username = Console.ReadLine();
            Console.WriteLine("Input your password");
            string password = Console.ReadLine();

            if (ContainsUpperAndLower(password) == true && ContainsNumbersAndSpecialCharacters(password) == true && ContainsNoNumbersAtStartOrEnd(password) == true && ContainNoSpace(password) == true && UsernamePasswordTrue(Username, password) == true)
            {
                string folder = @"C:\Temp\";
                string fileName = "Dokumenter.txt";
                string fullPath = fileName;
                string[] lines = { Username, password };
                File.WriteAllLines(fullPath, lines);
                MadeAccount = true;
                Console.WriteLine("Account succesfully created");
            }
            else
            {
                Console.WriteLine("Sorry this password doesn't meet the requirements");
            }
        }
        static void ChangePassword()
        {
            Console.WriteLine("Input your username");
            string username = Console.ReadLine();
            Console.WriteLine("Input your password");
            string password = Console.ReadLine();
            string folder = @"C:\Temp\";
            string fileName = "CSharpCornerAuthors.txt";
            string fullPath = folder + fileName;
            string[] text = File.ReadAllLines(fullPath);
            string PreviousUsername = text[0];
            string PreviousPassword = text[1];

            if (username == PreviousUsername && password == PreviousPassword)
            {
                Console.WriteLine("What do you want to change your password to?");
                string NewPassword = Console.ReadLine();

                if (PreviousPassword != NewPassword)
                {

                    if (ContainsUpperAndLower(password) == true && ContainsNumbersAndSpecialCharacters(password) == true && ContainsNoNumbersAtStartOrEnd(password) == true && ContainNoSpace(password) == true && UsernamePasswordTrue(username, password) == true)
                    {
                        string[] lines = { username, NewPassword };
                        File.WriteAllLines(fullPath, lines);
                        Console.WriteLine("Password succesfully changed");
                    }
                    else
                    {
                        Console.WriteLine("Sorry this password doesn't meet the requirements");
                    }
                }
            }
        }

        static void Login()
        {
            Console.WriteLine("Input your username");
            string username = Console.ReadLine();
            Console.WriteLine("Input your password");
            string password = Console.ReadLine();
            string folder = @"C:\Temp\";
            string fileName = "CSharpCornerAuthors.txt";
            string fullPath = folder + fileName;
            string[] text = File.ReadAllLines(fullPath);
            string PreviousUsername = text[0];
            string PreviousPassword = text[1];
            if (username == PreviousUsername && password == PreviousPassword)
            {
                Console.WriteLine("Succesfully logged in");
            }
            else
            {
                Console.WriteLine("Sorry either your username or password was incorrect");
            }

            //6 metoder stillet op --->
            //Første metode har jeg kaldet LengthCheck og her har jeg lavet en if/else statement
        }
        public static bool LengthCheck(string password)
        {
            if (password.Length >= 12) //Hvis password er større end/lig med 12 tegn så returnere den en true værdi
            {
                return true;
            }
            else //En else statement hvis nu den password er mindre end 12
            {
                return false; //Hvis den er ´mindre end 12 tegn så kommer den tilbage false
            }

        }

        //2. metode hvor jeg siger at password SKAL anvende både store og små bogstaver
        public static bool ContainsUpperAndLower(string password)
        {
            int i = 0; //det her er tælleren som bliver brugt senere i koden

            //2 booleans som begge er sat til at være false
            bool ContainsUpperCase = false;
            bool ContainsLowerCase = false;

            //Jeg har brugt en while-loop her som siger at password-længde er større end i
            //og UpperCase && LowerCase
            while (i < password.Length && !(ContainsUpperCase && ContainsLowerCase))
            {
                char letter = password[i]; //jeg har sat char letter = password[i]; altså indivduelle bogstaver siden at jeg skal tjekke alle bogstaverne igennem

                if (ContainsUpperCase == false)
                {
                    ContainsUpperCase = Char.IsUpper(letter);
                }
                if (ContainsLowerCase == false)
                {
                    ContainsLowerCase = Char.IsLower(letter);
                }
                i = i + 1; //Man kan også bruge i++ her. Det præcist det samme
            }
            return ContainsUpperCase && ContainsLowerCase;
        }

        public static bool ContainsNumbersAndSpecialCharacters(string password)
        {
            int i = 0;

            bool Numbers = false;
            bool SpecialCharacters = false;

            while (i < password.Length && !(Numbers && SpecialCharacters))
            {
                char letter = password[i];

                if (Numbers == false)
                {
                    Numbers = Char.IsDigit(letter);
                }
                if (SpecialCharacters == false)
                {
                    SpecialCharacters = !Char.IsLetterOrDigit(letter);
                }
                i = i + 1;
            }
            return Numbers && SpecialCharacters;
        }

        public static bool ContainsNoNumbersAtStartOrEnd(string password)
        {
            if (Char.IsDigit(password[0]) == false & Char.IsDigit(password[password.Length - 1]) == false)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public static bool ContainNoSpace(string password)
        {
            int i = 0;

            bool NoSpace = false;

            while (i < password.Length && !(NoSpace))
            {
                if (NoSpace == false)
                {
                    NoSpace = Char.IsWhiteSpace(password[i]);
                }
                i = i + 1;
            }
            NoSpace = !NoSpace;

            return NoSpace;
        }

        public static bool UsernamePasswordTrue(string password, string Username)
        {
            if (Username.ToLower() != password.ToLower())
            {
                return true;
            }
            else
            {
                return false;
            }

        }

    }
}
</code>```

I have tried to look up videos and look up online but I don't really see how I can apply either of what i've seen to my code so i'm hoping someone can help me in here. I've been stuck on this project for so long just because of this whole file thing. I've never really grasped or understood it. Basically I have to save the input from the user when they for example make an account/login/change password etc stuff like that.

Basically I need to Save login and password in clear text in
a text file. Which can again be loaded when logging in or when changing the code.

Title: How do I save/read to a file

Body:
so I have made my code and it works and everything but... now it says that I have to save it to a file. Here's my code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace Case3Password
{
    internal class Program
    {
        static void Main(string[] args)
        {
            bool que = false;
            while (que == false)
            {
                Console.WriteLine("Choose whether to login, make or change");
                string command = Console.ReadLine();
                if (command == "make" && !MadeAccount)
                {
                    MakeAccount();
                }
                else if (command == "change" && MadeAccount)
                {
                    ChangePassword();
                }
                else if (command == "login" & MadeAccount)
                {
                    Login();
                }
                else
                {
                    Console.WriteLine("incorrect choice, type either 'login', 'make' or 'change'");
                }
            }
        }
        static bool MadeAccount = false;
        static void MakeAccount()
        {
            Console.WriteLine("Input your username");
            string Username = Console.ReadLine();
            Console.WriteLine("Input your password");
            string password = Console.ReadLine();

            if (ContainsUpperAndLower(password) == true && ContainsNumbersAndSpecialCharacters(password) == true && ContainsNoNumbersAtStartOrEnd(password) == true && ContainNoSpace(password) == true && UsernamePasswordTrue(Username, password) == true)
            {
                string folder = @"C:\Temp\";
                string fileName = "Dokumenter.txt";
                string fullPath = fileName;
                string[] lines = { Username, password };
                File.WriteAllLines(fullPath, lines);
                MadeAccount = true;
                Console.WriteLine("Account succesfully created");
            }
            else
            {
                Console.WriteLine("Sorry this password doesn't meet the requirements");
            }
        }
        static void ChangePassword()
        {
            Console.WriteLine("Input your username");
            string username = Console.ReadLine();
            Console.WriteLine("Input your password");
            string password = Console.ReadLine();
            string folder = @"C:\Temp\";
            string fileName = "CSharpCornerAuthors.txt";
            string fullPath = folder + fileName;
            string[] text = File.ReadAllLines(fullPath);
            string PreviousUsername = text[0];
            string PreviousPassword = text[1];

            if (username == PreviousUsername && password == PreviousPassword)
            {
                Console.WriteLine("What do you want to change your password to?");
                string NewPassword = Console.ReadLine();

                if (PreviousPassword != NewPassword)
                {

                    if (ContainsUpperAndLower(password) == true && ContainsNumbersAndSpecialCharacters(password) == true && ContainsNoNumbersAtStartOrEnd(password) == true && ContainNoSpace(password) == true && UsernamePasswordTrue(username, password) == true)
                    {
                        string[] lines = { username, NewPassword };
                        File.WriteAllLines(fullPath, lines);
                        Console.WriteLine("Password succesfully changed");
                    }
                    else
                    {
                        Console.WriteLine("Sorry this password doesn't meet the requirements");
                    }
                }
            }
        }

        static void Login()
        {
            Console.WriteLine("Input your username");
            string username = Console.ReadLine();
            Console.WriteLine("Input your password");
            string password = Console.ReadLine();
            string folder = @"C:\Temp\";
            string fileName = "CSharpCornerAuthors.txt";
            string fullPath = folder + fileName;
            string[] text = File.ReadAllLines(fullPath);
            string PreviousUsername = text[0];
            string PreviousPassword = text[1];
            if (username == PreviousUsername && password == PreviousPassword)
            {
                Console.WriteLine("Succesfully logged in");
            }
            else
            {
                Console.WriteLine("Sorry either your username or password was incorrect");
            }

            //6 metoder stillet op --->
            //Første metode har jeg kaldet LengthCheck og her har jeg lavet en if/else statement
        }
        public static bool LengthCheck(string password)
        {
            if (password.Length >= 12) //Hvis password er større end/lig med 12 tegn så returnere den en true værdi
            {
                return true;
            }
            else //En else statement hvis nu den password er mindre end 12
            {
                return false; //Hvis den er ´mindre end 12 tegn så kommer den tilbage false
            }

        }

        //2. metode hvor jeg siger at password SKAL anvende både store og små bogstaver
        public static bool ContainsUpperAndLower(string password)
        {
            int i = 0; //det her er tælleren som bliver brugt senere i koden

            //2 booleans som begge er sat til at være false
            bool ContainsUpperCase = false;
            bool ContainsLowerCase = false;

            //Jeg har brugt en while-loop her som siger at password-længde er større end i
            //og UpperCase && LowerCase
            while (i < password.Length && !(ContainsUpperCase && ContainsLowerCase))
            {
                char letter = password[i]; //jeg har sat char letter = password[i]; altså indivduelle bogstaver siden at jeg skal tjekke alle bogstaverne igennem

                if (ContainsUpperCase == false)
                {
                    ContainsUpperCase = Char.IsUpper(letter);
                }
                if (ContainsLowerCase == false)
                {
                    ContainsLowerCase = Char.IsLower(letter);
                }
                i = i + 1; //Man kan også bruge i++ her. Det præcist det samme
            }
            return ContainsUpperCase && ContainsLowerCase;
        }

        public static bool ContainsNumbersAndSpecialCharacters(string password)
        {
            int i = 0;

            bool Numbers = false;
            bool SpecialCharacters = false;

            while (i < password.Length && !(Numbers && SpecialCharacters))
            {
                char letter = password[i];

                if (Numbers == false)
                {
                    Numbers = Char.IsDigit(letter);
                }
                if (SpecialCharacters == false)
                {
                    SpecialCharacters = !Char.IsLetterOrDigit(letter);
                }
                i = i + 1;
            }
            return Numbers && SpecialCharacters;
        }

        public static bool ContainsNoNumbersAtStartOrEnd(string password)
        {
            if (Char.IsDigit(password[0]) == false & Char.IsDigit(password[password.Length - 1]) == false)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public static bool ContainNoSpace(string password)
        {
            int i = 0;

            bool NoSpace = false;

            while (i < password.Length && !(NoSpace))
            {
                if (NoSpace == false)
                {
                    NoSpace = Char.IsWhiteSpace(password[i]);
                }
                i = i + 1;
            }
            NoSpace = !NoSpace;

            return NoSpace;
        }

        public static bool UsernamePasswordTrue(string password, string Username)
        {
            if (Username.ToLower() != password.ToLower())
            {
                return true;
            }
            else
            {
                return false;
            }

        }

    }
}

I have tried to look up videos and look up online but I don't really see how I can apply either of what i've seen to my code so i'm hoping someone can help me in here. I've been stuck on this project for so long just because of this whole file thing. I've never really grasped or understood it. Basically I have to save the input from the user when they for example make an account/login/change password etc stuff like that.

Basically I need to Save login and password in clear text in
a text file. Which can again be loaded when logging in or when changing the code.


问:
Count function in SQL showing inaccurate numbers
I have this query which selects the date and shows all the attribute values associated with those dates.

When I download the data I get from the 1st query shown below, the number of values associated with a single date - take 07/12/2022 for example - is 12. But when I count the attribute_value (as shown in the second query), I see a count of 139 instead of 12 associated with the attribute_value.

Does anyone happen to know what I'm doing wrong?

```<code>SELECT
  DATE(b.block_timestamp) AS timestamp,
  attribute_value
FROM `immaculate-355716.stride_1.event_attributes` ea
INNER JOIN `immaculate-355716.stride_1.blocks` b
ON CAST(ea.block_height AS STRING) = b.block_height
WHERE ea.attribute_key = 'packet_src_port'
AND ea.attribute_value LIKE 'icacontroller%'
GROUP BY 1,2
ORDER BY 1 DESC`

SELECT
  DATE(b.block_timestamp) AS timestamp,
  COUNT(attribute_value) AS count
FROM `immaculate-355716.stride_1.event_attributes` ea
INNER JOIN `immaculate-355716.stride_1.blocks` b
ON CAST(ea.block_height AS STRING) = b.block_height
WHERE ea.attribute_key = 'packet_src_port'
AND ea.attribute_value LIKE 'icacontroller%'
GROUP BY 1
ORDER BY 1 DESC
</code>```

Body:
I have this query which selects the date and shows all the attribute values associated with those dates.

When I download the data I get from the 1st query shown below, the number of values associated with a single date - take 07/12/2022 for example - is 12. But when I count the attribute_value (as shown in the second query), I see a count of 139 instead of 12 associated with the attribute_value.

Does anyone happen to know what I'm doing wrong?

SELECT
  DATE(b.block_timestamp) AS timestamp,
  attribute_value
FROM `immaculate-355716.stride_1.event_attributes` ea
INNER JOIN `immaculate-355716.stride_1.blocks` b
ON CAST(ea.block_height AS STRING) = b.block_height
WHERE ea.attribute_key = 'packet_src_port'
AND ea.attribute_value LIKE 'icacontroller%'
GROUP BY 1,2
ORDER BY 1 DESC`

SELECT
  DATE(b.block_timestamp) AS timestamp,
  COUNT(attribute_value) AS count
FROM `immaculate-355716.stride_1.event_attributes` ea
INNER JOIN `immaculate-355716.stride_1.blocks` b
ON CAST(ea.block_height AS STRING) = b.block_height
WHERE ea.attribute_key = 'packet_src_port'
AND ea.attribute_value LIKE 'icacontroller%'
GROUP BY 1
ORDER BY 1 DESC


问:
How to set DropDown multi select values in firebase?
I want Drop Down Multi select values are stored in firebase I have that code but its not stored in firebase.

```<code>DropDownMultiSelect(
    onChanged: (membervalue){
    setState(() {
          selectedMembertype =membervalue as String?;
      });
    }
</code>```

options:

```<code> ["Golden Members","Silver Members",],
 selectedValues: selected,
 whenEmpty: 'Select Member Type',
),

</code>```

I want to store multiple values in firebase.

Body:
I want Drop Down Multi select values are stored in firebase I have that code but its not stored in firebase.

DropDownMultiSelect(
    onChanged: (membervalue){
    setState(() {
          selectedMembertype =membervalue as String?;
      });
    }

options:

 ["Golden Members","Silver Members",],
 selectedValues: selected,
 whenEmpty: 'Select Member Type',
),

I want to store multiple values in firebase.


问:
Flutter error '_TypeError (type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'Iterable<dynamic>')' on JSON nested array
I have a json nested array to display on my apps, but i encounter with error as the title question. Here is my code on the controller

```<code>Future<List<staredTender>> staredTenderCon() async {
  final Future<SharedPreferences> _prefs = SharedPreferences.getInstance();

  final SharedPreferences? prefs = await _prefs;
  final token = prefs?.get('jwttoken');
  final response = await http.get(
      Uri.parse(
          ApiEndPoints.baseUrl + ApiEndPoints.otherEndPoints.staredTender),
      headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer $token'
      });

  List<staredTender> staredTenderlist = [];

  if (response.statusCode == 200) {
    var urjson = json.decode(response.body);

    for (var jsondata in urjson) {
      staredTenderlist.add(staredTender.fromJson(jsondata));
    }
    //return staredTender.fromJson(jsonDecode(response.body));
    return urjson.map((e) => staredTender.fromJson(e)).toList();
  }
  return staredTenderlist;
}
</code>```

The error occured on:

var urjson = json.decode(response.body);

for (var jsondata in urjson)

If im right, this error occured because the json.body return map, but my code require it to return in Iterable. Other than that, i have no idea where it is wrong

Here is my json file:

```<code>{
    "status": 0,
    "reason": "successful",
    "data": [
        {
            "_id": "639015d840ca7d1b39017b3f",
            "admin_id": 29169,
            "agency_name": "KEMENTERIAN KESIHATAN",
            "agency_type": {
                "id": 842,
                "term": "Government"
            },
            "attachment": [
                {
                    "filename": "QT220000000039366.zip",
                    "ext": ".zip",
                    "filesize": "444 KB",
                    "url": "https://s3-ap-southeast-1.amazonaws.com/tenderdb2/QT220000000039366.zip"
                },
                {
                    "filename": "QT220000000039366.png",
                    "ext": ".png",
                    "filesize": "73 KB",
                    "url": "https://s3-ap-southeast-1.amazonaws.com/tenderdb2/QT220000000039366.png"
                }
            ],
            "available_at": "",
            "briefing_date": "",
            "briefing_venue": "",
            "cidb": [],
            "cidb_grade": [],
            "cidb_grade_serial": [],
            "cidb_serial": [],
            "closing_date": 1671019200,
            "collection_address": "",
            "contact_person": [
                "MOHD HADI BIN MOHD ZIN"
            ],
            "description": "PERKHIDMATAN PENYELENGGARAAN SISTEM PENGURUSAN INTEGRASI KAWALAN EFEKTIF SUBSTAN (SPIKES) SEDIA ADA DI PROGRAM PERKHIDMATAN FARMASI, KEMENTERIAN KESIHATAN MALAYSIA, QT220000000039366, IBU PEJABAT KEMENTERIAN BAHAGIAN PERKHIDMATAN FARMASI PEJABAT AM | MOHD HADI BIN MOHD ZIN MHADI@MOH.GOV.MY 78413239 |",
            "developer": "RidhZ",
            "document_cost": "",
            "document_title": "SEBUT HARGA - IBU PEJABAT KEMENTERIAN BAHAGIAN PERKHIDMATAN FARMASI PEJABAT AM - QT220000000039366 - PERKHIDMATAN PENYELENGGARAAN SISTEM PENGURUSAN INTEGRASI KAWALAN EFEKTIF SUBSTAN (SPIKES) SEDIA ADA DI PROGRAM PERKHIDMATAN FARMASI, KEMENTERIAN KESIHATAN MALAYSIA",
            "email_address": [
                "mhadi@moh.gov.my"
            ],
            "fax_no": [
                ""
            ],
            "from": "ep-creepy-crawler",
            "last_collection_date": 1671019200,
            "mid_id": "b1eb1400be929e47f28e3b2f8694b927",
            "mof": [
                {
                    "term_id": 602,
                    "term": "Software – Supply all computer software, operating system, database, off-the- Shelf packages including maintenance",
                    "slug": "ep-21-01-03"
                }
            ],
            "mof_serial": [
                602
            ],
            "no": "",
            "no_tender": "QT220000000039366",
            "opening_date": 1670414400,
            "payable_to": "",
            "payment_method": [],
            "payment_method_serial": [],
            "project_value": "",
            "publish_unixtime": 1670414400,
            "site_venue": "",
            "site_visit_date": "",
            "slug": "sebut-harga-tender-ibu-pejabat-kementerian-bahagian-perkhidmatan-farmasi-pejabat-am-qt220000000039366-perkhidmatan-penyelenggaraan-sistem-pengurusan-integrasi-kawalan-efektif-substan-spikes-sedia-ada-di-program-perkhidmatan-farmasi-kementerian-kesihatan-malaysia",
            "source": {
                "id": 841,
                "term": "Internet"
            },
            "source_description": "https://www.eperolehan.gov.my/quotation-tender-notice",
            "states": [
                {
                    "term_id": 26,
                    "term": "Selangor",
                    "slug": "selangor"
                },
                {
                    "term_id": 28,
                    "term": "Kuala Lumpur",
                    "slug": "kuala-lumpur"
                },
                {
                    "term_id": 23,
                    "term": "Putrajaya",
                    "slug": "putrajaya"
                }
            ],
            "states_serial": [
                26,
                28,
                23
            ],
            "status": "1",
            "tel_no": [
                "78413239"
            ],
            "tender_type": {
                "term_id": 844,
                "term": "Open",
                "slug": "open"
            },
            "unixtime": 1670387160,
            "document_type": "sebut-harga"
        },
</code>```

Body:
I have a json nested array to display on my apps, but i encounter with error as the title question. Here is my code on the controller

Future<List<staredTender>> staredTenderCon() async {
  final Future<SharedPreferences> _prefs = SharedPreferences.getInstance();

  final SharedPreferences? prefs = await _prefs;
  final token = prefs?.get('jwttoken');
  final response = await http.get(
      Uri.parse(
          ApiEndPoints.baseUrl + ApiEndPoints.otherEndPoints.staredTender),
      headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer $token'
      });

  List<staredTender> staredTenderlist = [];

  if (response.statusCode == 200) {
    var urjson = json.decode(response.body);

    for (var jsondata in urjson) {
      staredTenderlist.add(staredTender.fromJson(jsondata));
    }
    //return staredTender.fromJson(jsonDecode(response.body));
    return urjson.map((e) => staredTender.fromJson(e)).toList();
  }
  return staredTenderlist;
}

The error occured on:

var urjson = json.decode(response.body);

for (var jsondata in urjson)

If im right, this error occured because the json.body return map, but my code require it to return in Iterable. Other than that, i have no idea where it is wrong

Here is my json file:

{
    "status": 0,
    "reason": "successful",
    "data": [
        {
            "_id": "639015d840ca7d1b39017b3f",
            "admin_id": 29169,
            "agency_name": "KEMENTERIAN KESIHATAN",
            "agency_type": {
                "id": 842,
                "term": "Government"
            },
            "attachment": [
                {
                    "filename": "QT220000000039366.zip",
                    "ext": ".zip",
                    "filesize": "444 KB",
                    "url": "https://s3-ap-southeast-1.amazonaws.com/tenderdb2/QT220000000039366.zip"
                },
                {
                    "filename": "QT220000000039366.png",
                    "ext": ".png",
                    "filesize": "73 KB",
                    "url": "https://s3-ap-southeast-1.amazonaws.com/tenderdb2/QT220000000039366.png"
                }
            ],
            "available_at": "",
            "briefing_date": "",
            "briefing_venue": "",
            "cidb": [],
            "cidb_grade": [],
            "cidb_grade_serial": [],
            "cidb_serial": [],
            "closing_date": 1671019200,
            "collection_address": "",
            "contact_person": [
                "MOHD HADI BIN MOHD ZIN"
            ],
            "description": "PERKHIDMATAN PENYELENGGARAAN SISTEM PENGURUSAN INTEGRASI KAWALAN EFEKTIF SUBSTAN (SPIKES) SEDIA ADA DI PROGRAM PERKHIDMATAN FARMASI, KEMENTERIAN KESIHATAN MALAYSIA, QT220000000039366, IBU PEJABAT KEMENTERIAN BAHAGIAN PERKHIDMATAN FARMASI PEJABAT AM | MOHD HADI BIN MOHD ZIN MHADI@MOH.GOV.MY 78413239 |",
            "developer": "RidhZ",
            "document_cost": "",
            "document_title": "SEBUT HARGA - IBU PEJABAT KEMENTERIAN BAHAGIAN PERKHIDMATAN FARMASI PEJABAT AM - QT220000000039366 - PERKHIDMATAN PENYELENGGARAAN SISTEM PENGURUSAN INTEGRASI KAWALAN EFEKTIF SUBSTAN (SPIKES) SEDIA ADA DI PROGRAM PERKHIDMATAN FARMASI, KEMENTERIAN KESIHATAN MALAYSIA",
            "email_address": [
                "mhadi@moh.gov.my"
            ],
            "fax_no": [
                ""
            ],
            "from": "ep-creepy-crawler",
            "last_collection_date": 1671019200,
            "mid_id": "b1eb1400be929e47f28e3b2f8694b927",
            "mof": [
                {
                    "term_id": 602,
                    "term": "Software – Supply all computer software, operating system, database, off-the- Shelf packages including maintenance",
                    "slug": "ep-21-01-03"
                }
            ],
            "mof_serial": [
                602
            ],
            "no": "",
            "no_tender": "QT220000000039366",
            "opening_date": 1670414400,
            "payable_to": "",
            "payment_method": [],
            "payment_method_serial": [],
            "project_value": "",
            "publish_unixtime": 1670414400,
            "site_venue": "",
            "site_visit_date": "",
            "slug": "sebut-harga-tender-ibu-pejabat-kementerian-bahagian-perkhidmatan-farmasi-pejabat-am-qt220000000039366-perkhidmatan-penyelenggaraan-sistem-pengurusan-integrasi-kawalan-efektif-substan-spikes-sedia-ada-di-program-perkhidmatan-farmasi-kementerian-kesihatan-malaysia",
            "source": {
                "id": 841,
                "term": "Internet"
            },
            "source_description": "https://www.eperolehan.gov.my/quotation-tender-notice",
            "states": [
                {
                    "term_id": 26,
                    "term": "Selangor",
                    "slug": "selangor"
                },
                {
                    "term_id": 28,
                    "term": "Kuala Lumpur",
                    "slug": "kuala-lumpur"
                },
                {
                    "term_id": 23,
                    "term": "Putrajaya",
                    "slug": "putrajaya"
                }
            ],
            "states_serial": [
                26,
                28,
                23
            ],
            "status": "1",
            "tel_no": [
                "78413239"
            ],
            "tender_type": {
                "term_id": 844,
                "term": "Open",
                "slug": "open"
            },
            "unixtime": 1670387160,
            "document_type": "sebut-harga"
        },


问:
Js reduce method ,why 0 at end?
Complete the square sum function so that it squares each number passed into it and then sums the results together. For example, for [1, 2, 2] it should return 9 because 1^2 + 2^2 + 2^2 = 9.

I managed to do the task but I did not understand why i had to add 0 at the end to pass the test. If i remove that 0,it doesn't pass. Can anyone please explain it ? I am newbie.

```<code>function numbers (numbers) {

return numbers.map((num) => num ** 2).reduce((initValue, currentValue) => initValue + currentValue,0)

}
</code>```

Title: Js reduce method ,why 0 at end?

Body:
Complete the square sum function so that it squares each number passed into it and then sums the results together. For example, for [1, 2, 2] it should return 9 because 1^2 + 2^2 + 2^2 = 9.

I managed to do the task but I did not understand why i had to add 0 at the end to pass the test. If i remove that 0,it doesn't pass. Can anyone please explain it ? I am newbie.

function numbers (numbers) {

return numbers.map((num) => num ** 2).reduce((initValue, currentValue) => initValue + currentValue,0)

}


问:
Telerik REPORT designer issue.in telerik report want to add my data in detail section
enter image description herein the above image surplus lines (it is shown in  detail section ) and this fee will be shown after the total tax

surplus line and policy fee's data will show after the total tax.it was design in Telerik report designer


问:
How can I forward traffic to 80Port of K8s Service after SSL termination in AWS NLB?
I am using Waypoint Helm Chart. Here, AWS NLB is created by modifying the annotation of the service, and TLS termination is performed in the NLB. Since TLS termination is completed in NLB, Service should forward traffic to http port, not https port. However, in NLB, it is created to forward traffic to the Target Group using Port 443. I want to change the port settings of the Service, but it is impossible to change it as it is written directly in the helm chart that has already been created. How can I transmit the traffic that came to NLB's 443 Port to Service's 80 port using only annotations?

My values.yaml

ui:
  service:
    annotations: |
      'service.beta.kubernetes.io/aws-load-balancer-type': nlb
      'service.beta.kubernetes.io/aws-load-balancer-ssl-cert': "XXXX.XXXX.XXXX"
      'service.beta.kubernetes.io/aws-load-balancer-ssl-ports': "443"
      'external-dns.alpha.kubernetes.io/hostname': "XXXX.XXXX.XXXX"
```
<p>waypoint helm chart (ui-service.yaml)</p>
<pre class="lang-yaml prettyprint-override"><code>{{- if (and (eq (.Values.ui.service.enabled | toString) "true") (eq (.Values.server.enabled | toString) "true")) }}
# UI Service for Waypoint Server
apiVersion: v1
kind: Service
metadata:
  name: {{ template "waypoint.fullname" . }}-ui
  namespace: {{ .Release.Namespace }}
  labels:
    app: {{ template "waypoint.name" . }}
    chart: {{ template "waypoint.chart" . }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
    component: ui
  {{- if .Values.ui.service.annotations }}
  annotations:
    {{ tpl .Values.ui.service.annotations . | nindent 4 | trim }}
  {{- end }}
spec:
  selector:
    app.kubernetes.io/name: {{ template "waypoint.name" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    component: server
  ports:
    - name: http
      port: 80
      targetPort: http
    - name: https
      port: 443
      targetPort: https
    - name: grpc
      port: 9701
      targetPort: grpc
    - name: https-2
      port: 9702
      targetPort: https
  {{- if .Values.ui.service.type }}
  type: {{ .Values.ui.service.type }}
  {{- end }}
  {{- if .Values.ui.service.additionalSpec }}
  {{ tpl .Values.ui.service.additionalSpec . | nindent 2 | trim }}
  {{- end }}
</code>```

Looking at the Helm Chart above, traffic coming in through 443 cannot be modified because the targetPort is hardcoded as https.

Body:
I am using Waypoint Helm Chart. Here, AWS NLB is created by modifying the annotation of the service, and TLS termination is performed in the NLB. Since TLS termination is completed in NLB, Service should forward traffic to http port, not https port. However, in NLB, it is created to forward traffic to the Target Group using Port 443. I want to change the port settings of the Service, but it is impossible to change it as it is written directly in the helm chart that has already been created. How can I transmit the traffic that came to NLB's 443 Port to Service's 80 port using only annotations?

My values.yaml

ui:
  service:
    annotations: |
      'service.beta.kubernetes.io/aws-load-balancer-type': nlb
      'service.beta.kubernetes.io/aws-load-balancer-ssl-cert': "XXXX.XXXX.XXXX"
      'service.beta.kubernetes.io/aws-load-balancer-ssl-ports': "443"
      'external-dns.alpha.kubernetes.io/hostname': "XXXX.XXXX.XXXX"

waypoint helm chart (ui-service.yaml)

{{- if (and (eq (.Values.ui.service.enabled | toString) "true") (eq (.Values.server.enabled | toString) "true")) }}
# UI Service for Waypoint Server
apiVersion: v1
kind: Service
metadata:
  name: {{ template "waypoint.fullname" . }}-ui
  namespace: {{ .Release.Namespace }}
  labels:
    app: {{ template "waypoint.name" . }}
    chart: {{ template "waypoint.chart" . }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
    component: ui
  {{- if .Values.ui.service.annotations }}
  annotations:
    {{ tpl .Values.ui.service.annotations . | nindent 4 | trim }}
  {{- end }}
spec:
  selector:
    app.kubernetes.io/name: {{ template "waypoint.name" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    component: server
  ports:
    - name: http
      port: 80
      targetPort: http
    - name: https
      port: 443
      targetPort: https
    - name: grpc
      port: 9701
      targetPort: grpc
    - name: https-2
      port: 9702
      targetPort: https
  {{- if .Values.ui.service.type }}
  type: {{ .Values.ui.service.type }}
  {{- end }}
  {{- if .Values.ui.service.additionalSpec }}
  {{ tpl .Values.ui.service.additionalSpec . | nindent 2 | trim }}
  {{- end }}

Looking at the Helm Chart above, traffic coming in through 443 cannot be modified because the targetPort is hardcoded as https.


问:
Leaflet. Does not put a dot exactly where you click

```<code><div class="leaflet-marker-icon leaflet-div-icon leaflet-editing-icon leaflet-div-icon-wh leaflet-zoom-animated leaflet-interactive leaflet-marker-draggable" tabindex="0" style="margin-left: -2px; margin-top: -2px; width: 4px; height: 4px; transform: translate3d(688px, 348px, 0px); z-index: 4348; outline: none;"></div>
</code>```

That is the dot's div.
The problem will be solved when the x and y coordinates are -2 px smaller.

When I click while marking here, the coordinates should be -2px smaller. How can i change the translate3d coordinates before div created


问:
The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()
Dataset

df['sales']

abd
sales

atf
1.2

adstys
0.9

tyugug
5.6

gfygv
1.1

I want to create a new column based on sales values. If sales value is above 1.2 it should replace with 1 or 0 if anything less than 1.2

Applying list comprehension on a float column is throwing truth value error

```<code>df['new_sales_index']=df['sales'].apply(lambda x: [1 if y > 1.2 else 0])
</code>```

Body:
Dataset

df['sales']

abd
sales

atf
1.2

adstys
0.9

tyugug
5.6

gfygv
1.1

I want to create a new column based on sales values. If sales value is above 1.2 it should replace with 1 or 0 if anything less than 1.2

Applying list comprehension on a float column is throwing truth value error

df['new_sales_index']=df['sales'].apply(lambda x: [1 if y > 1.2 else 0])


问:
A problem occurred evaluating project ':app'. > No signature of method: build_d5r6pfvnihwiuw22fy3h0genq.android() is applicable for argument types:
I an trying to generate abb bundle in flutter but got this issue and not able to solve it.

I got this error and trying to solve it, something is extra in build.gradle and i have to remove this for solve this issue but not able to find the unwanted value.

if you can suggest me something so please help me.

```<code>ERORR: FAILURE: Build failed with an exception.

* Where:
Build file 'D:\Flutter\suprbFluter\saveCode\fluter\android\app\build.gradle' line: 33

* What went wrong:
A problem occurred evaluating project ':app'.
> No signature of method: build_d5r6pfvnihwiuw22fy3h0genq.android() is applicable for argument types: (build
_d5r6pfvnihwiuw22fy3h0genq$_run_closure2) values: [build_d5r6pfvnihwiuw22fy3h0genq$_run_closure2@40492b9f]
</code>```

build.gradle

```<code>def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('keystore.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {                    //here is the error(line: 33)
    compileSdkVersion 33
    lintOptions {
        checkReleaseBuilds true
    }
    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "co.seedwill.flutter"
        minSdkVersion 21
        multiDexEnabled true
        targetSdkVersion 33
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }
      signingConfigs {
       release {
           keyAlias keystoreProperties['keyAlias']
           keyPassword keystoreProperties['keyPassword']
           storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
           storePassword keystoreProperties['storePassword']
       }
   }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResource false
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.release
        }
    }

}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
//    implementation 'com.android.support:multidex:2.0.1'
    implementation 'com.google.android.gms:play-services-tagmanager:18.0.2'
    implementation "androidx.multidex:multidex:2.0.1"

}
</code>```

Body:
I an trying to generate abb bundle in flutter but got this issue and not able to solve it.

I got this error and trying to solve it, something is extra in build.gradle and i have to remove this for solve this issue but not able to find the unwanted value.

if you can suggest me something so please help me.

ERORR: FAILURE: Build failed with an exception.

* Where:
Build file 'D:\Flutter\suprbFluter\saveCode\fluter\android\app\build.gradle' line: 33

* What went wrong:
A problem occurred evaluating project ':app'.
> No signature of method: build_d5r6pfvnihwiuw22fy3h0genq.android() is applicable for argument types: (build
_d5r6pfvnihwiuw22fy3h0genq$_run_closure2) values: [build_d5r6pfvnihwiuw22fy3h0genq$_run_closure2@40492b9f]

build.gradle

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('keystore.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {                    //here is the error(line: 33)
    compileSdkVersion 33
    lintOptions {
        checkReleaseBuilds true
    }
    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "co.seedwill.flutter"
        minSdkVersion 21
        multiDexEnabled true
        targetSdkVersion 33
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }
      signingConfigs {
       release {
           keyAlias keystoreProperties['keyAlias']
           keyPassword keystoreProperties['keyPassword']
           storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
           storePassword keystoreProperties['storePassword']
       }
   }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResource false
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.release
        }
    }

}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
//    implementation 'com.android.support:multidex:2.0.1'
    implementation 'com.google.android.gms:play-services-tagmanager:18.0.2'
    implementation "androidx.multidex:multidex:2.0.1"

}


问:
Spring authorization server, how do I set scope for each grant type
I want to make a custom grant_type 'mfa'. let's say a user want to gain access token they have to get access token with scope 'mfa_required' first.

```<code>    RegisteredClient registeredClient = RegisteredClient.withId(UUID.randomUUID().toString())
            .clientId("cheems_doge")
            .clientSecret("very_secret_wow")
            .clientAuthenticationMethod(ClientAuthenticationMethod.NONE)
            .authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE)
            .authorizationGrantType(AuthorizationGrantType.REFRESH_TOKEN)
            .authorizationGrantType(AuthorizationGrantType.CLIENT_CREDENTIALS)
            .redirectUri("http://127.0.0.1:8080/login/oauth2/code/messaging-client-oidc")
            .scope("mfa_required") // so this token will be able to use with mfa grant_type only.
            .clientSettings(
                    ClientSettings.builder() // remove consent page.
                    .requireAuthorizationConsent(false)
                    .requireProofKey(true)
                    .build())
            .build();
</code>```

and then they will use this access token to gain another access token with grant_type mfa.

```<code>RegisteredClient registeredClient = RegisteredClient.withId(UUID.randomUUID().toString())
                .clientId("cheems_doge_2")
                .clientSecret("very_secret_wow_2")
                .clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_JWT)
                .authorizationGrantType(CustomGrantType.MFA)
                .redirectUri("http://127.0.0.1:8080/login/oauth2/code/messaging-client-oidc")
                .scope("write read etc..") // this token will be able to access resource server.
                .clientSettings(
                        ClientSettings.builder()
                                .requireAuthorizationConsent(true)
                                .requireProofKey(false)
                                .build())
                .build();
</code>```

but I cant create RegisteredClient with difference scope for each grant_type. I have to create a new RegisteredClient so the client have to store 2 client_id one for the first token and another one for mfa. Is there a way to set difference scope for each grant_type.

Body:
I want to make a custom grant_type 'mfa'. let's say a user want to gain access token they have to get access token with scope 'mfa_required' first.

    RegisteredClient registeredClient = RegisteredClient.withId(UUID.randomUUID().toString())
            .clientId("cheems_doge")
            .clientSecret("very_secret_wow")
            .clientAuthenticationMethod(ClientAuthenticationMethod.NONE)
            .authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE)
            .authorizationGrantType(AuthorizationGrantType.REFRESH_TOKEN)
            .authorizationGrantType(AuthorizationGrantType.CLIENT_CREDENTIALS)
            .redirectUri("http://127.0.0.1:8080/login/oauth2/code/messaging-client-oidc")
            .scope("mfa_required") // so this token will be able to use with mfa grant_type only.
            .clientSettings(
                    ClientSettings.builder() // remove consent page.
                    .requireAuthorizationConsent(false)
                    .requireProofKey(true)
                    .build())
            .build();

and then they will use this access token to gain another access token with grant_type mfa.

RegisteredClient registeredClient = RegisteredClient.withId(UUID.randomUUID().toString())
                .clientId("cheems_doge_2")
                .clientSecret("very_secret_wow_2")
                .clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_JWT)
                .authorizationGrantType(CustomGrantType.MFA)
                .redirectUri("http://127.0.0.1:8080/login/oauth2/code/messaging-client-oidc")
                .scope("write read etc..") // this token will be able to access resource server.
                .clientSettings(
                        ClientSettings.builder()
                                .requireAuthorizationConsent(true)
                                .requireProofKey(false)
                                .build())
                .build();

but I cant create RegisteredClient with difference scope for each grant_type. I have to create a new RegisteredClient so the client have to store 2 client_id one for the first token and another one for mfa. Is there a way to set difference scope for each grant_type.


问:
Tab unselected behaviour in TabLayout - Android
I have implemented TabLayout with Kotlin

```<code>tabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
    override fun onTabReselected(tab: TabLayout.Tab?) {
        Toast.makeText(this@MainActivity, "Reselected ${tab?.text}", Toast.LENGTH_SHORT)
            .show()
    }

    override fun onTabUnselected(tab: TabLayout.Tab?) {
        Toast.makeText(this@MainActivity, "Unselected ${tab?.text}", Toast.LENGTH_SHORT)
            .show()
    }

    override fun onTabSelected(tab: TabLayout.Tab?) {
        Toast.makeText(this@MainActivity, "Selected ${tab?.text}", Toast.LENGTH_SHORT)
            .show()
    }
})
</code>```

I want to make Toast upon users tab selection. Like, If user switches from the tab 1 to tab 2 the desired beahviour is Unselected tab 1 and then Selected tab 2.

But the result I'm getting is only toast for the selected tab i.e Selected tab 2.

So I want to know is there any mistake with my implementation? How should I achieve desired behaviour?

Body:
I have implemented TabLayout with Kotlin

tabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
    override fun onTabReselected(tab: TabLayout.Tab?) {
        Toast.makeText(this@MainActivity, "Reselected ${tab?.text}", Toast.LENGTH_SHORT)
            .show()
    }

    override fun onTabUnselected(tab: TabLayout.Tab?) {
        Toast.makeText(this@MainActivity, "Unselected ${tab?.text}", Toast.LENGTH_SHORT)
            .show()
    }

    override fun onTabSelected(tab: TabLayout.Tab?) {
        Toast.makeText(this@MainActivity, "Selected ${tab?.text}", Toast.LENGTH_SHORT)
            .show()
    }
})

I want to make Toast upon users tab selection. Like, If user switches from the tab 1 to tab 2 the desired beahviour is Unselected tab 1 and then Selected tab 2.

But the result I'm getting is only toast for the selected tab i.e Selected tab 2.

So I want to know is there any mistake with my implementation? How should I achieve desired behaviour?


问:
Swift AppleMap MKOverlayRenderer Image Zoom In Bug
Hi I need Help I do control Apple Map

I want overlay image on map

I use MKOverlayRenderer and this function
override func draw(_ mapRect: MKMapRect, zoomScale: MKZoomScale, in context: CGContext)

and then success overlay

but map zoom level 2.0 over than image broken

if not use CGContext.rotate then image are not broken
but use rotate then image are broken

```<code>class IndoorInfoOverlay: NSObject, MKOverlay {
    let coordinate: CLLocationCoordinate2D
    let boundingMapRect: MKMapRect

    init(indoorInfo: IndoorInfo) {
      boundingMapRect = indoorInfo.overlayBoundingMapRect
      coordinate = indoorInfo.midCoordinate
    }
}

class IndoorInfoOverlayView: MKOverlayRenderer {
  var overlayImage: UIImage
  var parent: IndoorMapView

  init(overlay: MKOverlay, overlayImage: UIImage,_ parent: IndoorMapView) {
      self.overlayImage = overlayImage
      self.parent = parent
      super.init(overlay: overlay)
  }

  override func draw(_ mapRect: MKMapRect, zoomScale: MKZoomScale, in context: CGContext) {
    guard let imageReference = overlayImage.cgImage else { return }
      let bearing = degreesToRadians(360 - (Double(self.parent.floorData!.FLOOR_BEARING) ?? 0))

      let rect = self.rect(for: overlay.boundingMapRect)
      context.scaleBy(x: 1.0, y: -1.0)
      context.translateBy(x: 0.0, y: -rect.size.height)
      if self.parent.floorData != nil {
          context.rotate(by: bearing)
      }
      context.draw(imageReference, in: rect, byTiling: false)
  }

  private func degreesToRadians(_ x:Double) -> Double {
    return (Double.pi * x / 180.0)
  }
}
</code>```

Body:
Hi I need Help I do control Apple Map

I want overlay image on map

I use MKOverlayRenderer and this function
override func draw(_ mapRect: MKMapRect, zoomScale: MKZoomScale, in context: CGContext)

and then success overlay

but map zoom level 2.0 over than image broken

if not use CGContext.rotate then image are not broken
but use rotate then image are broken

class IndoorInfoOverlay: NSObject, MKOverlay {
    let coordinate: CLLocationCoordinate2D
    let boundingMapRect: MKMapRect

    init(indoorInfo: IndoorInfo) {
      boundingMapRect = indoorInfo.overlayBoundingMapRect
      coordinate = indoorInfo.midCoordinate
    }
}

class IndoorInfoOverlayView: MKOverlayRenderer {
  var overlayImage: UIImage
  var parent: IndoorMapView

  init(overlay: MKOverlay, overlayImage: UIImage,_ parent: IndoorMapView) {
      self.overlayImage = overlayImage
      self.parent = parent
      super.init(overlay: overlay)
  }

  override func draw(_ mapRect: MKMapRect, zoomScale: MKZoomScale, in context: CGContext) {
    guard let imageReference = overlayImage.cgImage else { return }
      let bearing = degreesToRadians(360 - (Double(self.parent.floorData!.FLOOR_BEARING) ?? 0))

      let rect = self.rect(for: overlay.boundingMapRect)
      context.scaleBy(x: 1.0, y: -1.0)
      context.translateBy(x: 0.0, y: -rect.size.height)
      if self.parent.floorData != nil {
          context.rotate(by: bearing)
      }
      context.draw(imageReference, in: rect, byTiling: false)
  }

  private func degreesToRadians(_ x:Double) -> Double {
    return (Double.pi * x / 180.0)
  }
}


问:
.csv to .dat file with specific right padding using pandas
I have an InputData.csv file that looks like:

```<code>rec_count,Name,code,status
4,nick,T35,T
7,james,T36,F
10,thomas,T37,T
8,dawson,T38,T
16,nickolas,T39,F
90,ravi,T40,T
22,paul,T41,F
87,matt,T42,F
345,hailey,T43,T
344,nada,T44,T

</code>```

I have been trying to eliminate the commas, add specific paddings to each column.
The desired output into the .dat file is the following:

```<code>4nick          T35  T
7james         T36  F
10thomas       T37  T
8dawson        T38  T
16nickolas     T39  F
90ravi         T40  T
22paul         T41  F
87matt         T42  F
345hailey      T43  T
344nada        T44  T

</code>```

I don't need the column headers, rec_count has no separator so it stick to Name. Name column is right padded with spaces as much as needed in a way that code column starts at index 16. again as many spaces needed so that status starts at index 21. I also don't need the row count at the left that dataframe outputs.

so far I have tried DataFrame.pad but not much luck. I'm not sure if pandas is the best way to go about this. If you have any other suggestions that could make my life easier i would greatly appreciate it. I don't have to necessarily use pandas.

Body:
I have an InputData.csv file that looks like:

rec_count,Name,code,status
4,nick,T35,T
7,james,T36,F
10,thomas,T37,T
8,dawson,T38,T
16,nickolas,T39,F
90,ravi,T40,T
22,paul,T41,F
87,matt,T42,F
345,hailey,T43,T
344,nada,T44,T

I have been trying to eliminate the commas, add specific paddings to each column.
The desired output into the .dat file is the following:

4nick          T35  T
7james         T36  F
10thomas       T37  T
8dawson        T38  T
16nickolas     T39  F
90ravi         T40  T
22paul         T41  F
87matt         T42  F
345hailey      T43  T
344nada        T44  T

I don't need the column headers, rec_count has no separator so it stick to Name. Name column is right padded with spaces as much as needed in a way that code column starts at index 16. again as many spaces needed so that status starts at index 21. I also don't need the row count at the left that dataframe outputs.

so far I have tried DataFrame.pad but not much luck. I'm not sure if pandas is the best way to go about this. If you have any other suggestions that could make my life easier i would greatly appreciate it. I don't have to necessarily use pandas.


问:
Trying to change the static data in vue.js file
```<code><template>
  <v-card>
    <v-toolbar tabs flat>
      <v-toolbar-title>Branding</v-toolbar-title>

      <v-spacer></v-spacer>
      <template v-slot:extension>
        <v-flex>
          <v-tabs
            v-model="selectedTab"
            :slider-color="app.color_name"
            color="grey darken-3"
            show-arrows
            >
            <v-tab :href="'#general'">
              General
            </v-tab>
            <v-tab :href="'#email'">
              E-mail
            </v-tab>
            <v-tab :href="'#domain'">
              Domain
            </v-tab>
          </v-tabs>
        </v-flex>
      </template>
</code>```

I am trying to replace "Branding"

```<code>   <v-toolbar-title>Branding</v-toolbar-title>
</code>```

to "Branding Testing

```<code>   <v-toolbar-title>Branding Testing</v-toolbar-title>
</code>```

but it is not showing any changes. Can anyone help me with that?

Body:
<template>
  <v-card>
    <v-toolbar tabs flat>
      <v-toolbar-title>Branding</v-toolbar-title>

      <v-spacer></v-spacer>
      <template v-slot:extension>
        <v-flex>
          <v-tabs
            v-model="selectedTab"
            :slider-color="app.color_name"
            color="grey darken-3"
            show-arrows
            >
            <v-tab :href="'#general'">
              General
            </v-tab>
            <v-tab :href="'#email'">
              E-mail
            </v-tab>
            <v-tab :href="'#domain'">
              Domain
            </v-tab>
          </v-tabs>
        </v-flex>
      </template>

I am trying to replace "Branding"

   <v-toolbar-title>Branding</v-toolbar-title>

to "Branding Testing

   <v-toolbar-title>Branding Testing</v-toolbar-title>

but it is not showing any changes. Can anyone help me with that?


问:
Query regrading rasa version 3.2.6
I am using rasa version 3.2.6, I am facing issue while integration rasa chat bot with website using rasa socketIO channel and botfront version It gives me error:

“sanic.exceptions.ServerError: Invalid response type None (need HTTPResponse)”

“The client is using an unsupported version of the Socket.IO or Engine.IO protocols (further occurrences of this error will be logged with level INFO)” Please help me out to solve this problem.

Thank you

It is not showing me appropriate chatbot response.

Title: Query regrading rasa version 3.2.6


问:
function is not working in flutter database
```<code>Future<void> updateNoReqstMinus() async {
try {
  setState(() {
    buttonState = true;
  });
  DocumentReference document = await FirebaseFirestore.instance
      .collection("stations")
      .doc(widget.docId);

  await document.update({"nonotrequest": widget.data['nonotrequest'] + 1});

  (widget.data['nonotrequest'] //this should be new value after above update happend)

  widget.data['nonotrequest']% 10 == 0
          ? document.update({"norequest": widget.data['norequest'] - 1})
          : print(widget.data['nonotrequest']);

  Navigator.push(
    context,
    MaterialPageRoute(builder: (context) => const MyHomePage()),
  );
} catch (e) {
  await QuickAlert.show(
    context: context,
    type: QuickAlertType.error,
    text: 'Something gone wrong',
  );
  Navigator.push(
    context,
    MaterialPageRoute(builder: (context) => MyHomePage()),
  );
}
</code>```

}

in this function this part of function now working if you solve it the  widget.data['nonotrequest'] should be new value after above update happend

```<code>widget.data['nonotrequest'] % 10 == 0
      ? document.update({"norequest": widget.data['norequest'] - 1})
      : print(widget.data['nonotrequest']);
</code>```

Body:
Future<void> updateNoReqstMinus() async {
try {
  setState(() {
    buttonState = true;
  });
  DocumentReference document = await FirebaseFirestore.instance
      .collection("stations")
      .doc(widget.docId);

  await document.update({"nonotrequest": widget.data['nonotrequest'] + 1});

  (widget.data['nonotrequest'] //this should be new value after above update happend)

  widget.data['nonotrequest']% 10 == 0
          ? document.update({"norequest": widget.data['norequest'] - 1})
          : print(widget.data['nonotrequest']);

  Navigator.push(
    context,
    MaterialPageRoute(builder: (context) => const MyHomePage()),
  );
} catch (e) {
  await QuickAlert.show(
    context: context,
    type: QuickAlertType.error,
    text: 'Something gone wrong',
  );
  Navigator.push(
    context,
    MaterialPageRoute(builder: (context) => MyHomePage()),
  );
}

}

in this function this part of function now working if you solve it the  widget.data['nonotrequest'] should be new value after above update happend

widget.data['nonotrequest'] % 10 == 0
      ? document.update({"norequest": widget.data['norequest'] - 1})
      : print(widget.data['nonotrequest']);


问:
Airflow upgrade_check returning command error
I am migrating airflow from 1.10.15 to 2.4.3 and I am trying to run airflow upgrade_check command to check and get recommendation about the actual state of airflow install.

I am running airflow 2.4.3 in a docker container using docker-compose and python 3.9

I have the following error:

airflow command error: argument GROUP_OR_COMMAND: invalid choice: 'upgrade_check' (choose from 'celery', 'cheat-sheet', 'config', 'connections', 'dag-processor', 'dags', 'db', 'info', 'jobs', 'kerberos', 'kubernetes', 'plugins', 'pools', 'providers', 'roles', 'rotate-fernet-key', 'scheduler', 'standalone', 'sync-perm', 'tasks', 'triggerer', 'users', 'variables', 'version', 'webserver'), see help above.

I have tried adding airflow upgrade_check in Dockerfile but without success. I have also tried to run pip install apache-airflow-upgrade-check in the container, and it was showing that all requirements are already satisfied: Requirement already satisfied

Did anyone get the same issue ? Any recommendations ?


问:
why changes applied to new df created by slicing like df[['x','y']] creates changes in the original df?
```<code>df[['High','Symbol']]=df[['High','Symbol']].replace("ethusd", "ETHUSD")
</code>```

since df[['High', 'Symbol']] creates a new Dataframe why are the changes are being made to the original Dataframe?

it's like-

```<code>new_df = original_df["High", "Symbol"]

new_df = new_df.replace("ethusd", "ETHUSD")
</code>```

Changes made to the original_df, as "ethusd" is replaced by "ETHUSD" in original_df

why are changes applied to the original df if df[['High', 'Symbol']] is a new data frame?

Body:
df[['High','Symbol']]=df[['High','Symbol']].replace("ethusd", "ETHUSD")

since df[['High', 'Symbol']] creates a new Dataframe why are the changes are being made to the original Dataframe?

it's like-

new_df = original_df["High", "Symbol"]

new_df = new_df.replace("ethusd", "ETHUSD")

Changes made to the original_df, as "ethusd" is replaced by "ETHUSD" in original_df

why are changes applied to the original df if df[['High', 'Symbol']] is a new data frame?


问:
C# WCF Service Concurrency
I want to create a wcf service that makes insert, update and select queries to the MsSQL database on the remote server.
I will connect with service reference through windows form application and around 1000 people in different places will use this form application. I'm wondering if wcf will be sufficient for the commands from all these users or is it a better choice to use web api instead?

According to my research, there is multi-connection support, but I don't know if it's enough.

```<code>[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)]
</code>```

Title: C# WCF Service Concurrency

Body:
I want to create a wcf service that makes insert, update and select queries to the MsSQL database on the remote server.
I will connect with service reference through windows form application and around 1000 people in different places will use this form application. I'm wondering if wcf will be sufficient for the commands from all these users or is it a better choice to use web api instead?

According to my research, there is multi-connection support, but I don't know if it's enough.

[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)]


问:
How to enable ip address caching in API Gateway proxy resource by path
I have created API using API Gateway proxy resource, now I need to enable caching for each path under resource by ip address.

For example, I have created following APIs

```<code>/profile
ANY
OPTIONS
 /{proxy+}
 ANY
 OPTIONS
</code>```

Now I want to enable caching for /profile/transfer path only, under /profile/{proxy+} by IP Address.

Is there any way to achieve this ?

Body:
I have created API using API Gateway proxy resource, now I need to enable caching for each path under resource by ip address.

For example, I have created following APIs

/profile
ANY
OPTIONS
 /{proxy+}
 ANY
 OPTIONS

Now I want to enable caching for /profile/transfer path only, under /profile/{proxy+} by IP Address.

Is there any way to achieve this ?