问:
how to take specific column from text file(.txt) with delimiters with C#
I have example data like this , the data is in the text file(.txt) sry i got this type of file, if its excel or csv maybe it will be easier

Edit : i make a console app with C#

```<code>FamilyID;name;gender;DOB;Place of birth;status
1;nicky;male;01-01-1998;greenland;married
1;sonia;female;02-02-1995;greenland;married
2;dicky;male;04-01-1995;bali;single
3;redding;male;01-05-1996;USA;single
3;sisca;female;05-03-1994;australia;married
</code>```

i want to take the specific column from that data, for example i want to take FamilyID,Name and status.

I already tried some code to read data and take all the data and list it to new text file.

The goal is to create a new text file based on family ID, and only take specific columns.

The problem is : i cant take a specific column that i want from text file (don't know how to select many column in the code that i write)

```<code>DateTime date = DateTime.Now;
            string tgl = date.Date.ToString("dd");
            string bln = date.Month.ToString("d2");
            string thn = date.Year.ToString();
            string tglskrg = thn + "/" + bln + "/" + tgl;

            string filename = ("C:\\Users\\Documents\\My Received Files\\exampledata.txt");
            string[] liness = File.ReadAllLines(filename);
            string[] col;

            var lines = File.ReadAllLines(filename);

            var groups = lines.Skip(1)
                  .Select(x => x.Split(';'))
                  .GroupBy(x => x[0]).ToArray();

            foreach (var group in groups)
            {
                Console.WriteLine(group);
                File.WriteAllLines(@"C:\\Users\\Documents\\My Received Files\\exampledata_"+group.Key+".txt", group.Select(x => string.Join(";", x)));
}

</code>```

maybe someone can help? thankyou

答:
try this.</p>

```<code>var list = new List<String>();
        list.Add("FamilyID;name;gender;DOB;Place of birth;status");
        list.Add("1;nicky;male;01-01-1998;greenland;married");
        list.Add("1;sonia;female;02-02-1995;greenland;married");
        list.Add("2;dicky;male;04-01-1995;bali;single");
        list.Add("3;redding;male;01-05-1996;USA;single");
        list.Add("3;sisca;female;05-03-1994;australia;married");

        var group = from item in list.Skip(1)
                    let splitItem = item.Split(';', StringSplitOptions.RemoveEmptyEntries)
                    select new
                    {
                        FamilyID = splitItem[0],
                        Name = splitItem[1],
                        Status = splitItem[5],
                    };

        foreach(var item in group.ToList())
        {
            Console.WriteLine($"Family ID: {item.FamilyID}, Name: {item.Name}, Status: {item.Status}");
        }
</code>```

Body:
I have example data like this , the data is in the text file(.txt) sry i got this type of file, if its excel or csv maybe it will be easier

Edit : i make a console app with C#

FamilyID;name;gender;DOB;Place of birth;status
1;nicky;male;01-01-1998;greenland;married
1;sonia;female;02-02-1995;greenland;married
2;dicky;male;04-01-1995;bali;single
3;redding;male;01-05-1996;USA;single
3;sisca;female;05-03-1994;australia;married

i want to take the specific column from that data, for example i want to take FamilyID,Name and status.

I already tried some code to read data and take all the data and list it to new text file.

The goal is to create a new text file based on family ID, and only take specific columns.

The problem is : i cant take a specific column that i want from text file (don't know how to select many column in the code that i write)

DateTime date = DateTime.Now;
            string tgl = date.Date.ToString("dd");
            string bln = date.Month.ToString("d2");
            string thn = date.Year.ToString();
            string tglskrg = thn + "/" + bln + "/" + tgl;

            string filename = ("C:\\Users\\Documents\\My Received Files\\exampledata.txt");
            string[] liness = File.ReadAllLines(filename);
            string[] col;

            var lines = File.ReadAllLines(filename);

            var groups = lines.Skip(1)
                  .Select(x => x.Split(';'))
                  .GroupBy(x => x[0]).ToArray();

            foreach (var group in groups)
            {
                Console.WriteLine(group);
                File.WriteAllLines(@"C:\\Users\\Documents\\My Received Files\\exampledata_"+group.Key+".txt", group.Select(x => string.Join(";", x)));
}

maybe someone can help? thankyou

Body:
try this.

var list = new List<String>();
        list.Add("FamilyID;name;gender;DOB;Place of birth;status");
        list.Add("1;nicky;male;01-01-1998;greenland;married");
        list.Add("1;sonia;female;02-02-1995;greenland;married");
        list.Add("2;dicky;male;04-01-1995;bali;single");
        list.Add("3;redding;male;01-05-1996;USA;single");
        list.Add("3;sisca;female;05-03-1994;australia;married");

        var group = from item in list.Skip(1)
                    let splitItem = item.Split(';', StringSplitOptions.RemoveEmptyEntries)
                    select new
                    {
                        FamilyID = splitItem[0],
                        Name = splitItem[1],
                        Status = splitItem[5],
                    };

        foreach(var item in group.ToList())
        {
            Console.WriteLine($"Family ID: {item.FamilyID}, Name: {item.Name}, Status: {item.Status}");
        }


来源: stackexchange

答:
One way to approach this would be capture the details to a data structure and later write the required details to file. For example,

```<code>public class Detail
{
    public int FamilyID{get;set;}
    public string Name{get;set;}
    public string Gender{get;set;}
    public DateTime DOB{get;set;}
    public string PlaceOfBirth{get;set;}
    public string Status{get;set;}
}
</code>```

Now you can write a method that parses the string based on delimiter and returns an IEnumerable.

```<code>public IEnumerable<Detail> Parse(string source,char delimiter)
{
    return source.Split(new []{Environment.NewLine},StringSplitOptions.RemoveEmptyEntries)
          .Skip(1)
          .Select(x=>
          {
            var detail = x.Split(new []{delimiter});
            return new Detail
            {
                FamilyID = Int32.Parse(detail[0]),
                Name = detail[1],
                Gender = detail[2],
                DOB = DateTime.Parse(detail[3]),
                PlaceOfBirth = detail[4],
                Status = detail[5]
            };
          }
          );

}
</code>```

Client Call

```<code>Parse(stringFromFile,';');
</code>```

Output

Now you can pick and write the details you want to write to output file from the collection.

ContentLicense: CC BY-SA 4.0

Title: how to take specific column from text file(.txt) with delimiters with C#

Body:
One way to approach this would be capture the details to a data structure and later write the required details to file. For example,

public class Detail
{
    public int FamilyID{get;set;}
    public string Name{get;set;}
    public string Gender{get;set;}
    public DateTime DOB{get;set;}
    public string PlaceOfBirth{get;set;}
    public string Status{get;set;}
}

Now you can write a method that parses the string based on delimiter and returns an IEnumerable.

public IEnumerable<Detail> Parse(string source,char delimiter)
{
    return source.Split(new []{Environment.NewLine},StringSplitOptions.RemoveEmptyEntries)
          .Skip(1)
          .Select(x=>
          {
            var detail = x.Split(new []{delimiter});
            return new Detail
            {
                FamilyID = Int32.Parse(detail[0]),
                Name = detail[1],
                Gender = detail[2],
                DOB = DateTime.Parse(detail[3]),
                PlaceOfBirth = detail[4],
                Status = detail[5]
            };
          }
          );

}

Client Call

Parse(stringFromFile,';');

Output

Now you can pick and write the details you want to write to output file from the collection.


问:
Create a stored procedure based on known columns (wont break on unknown)?
I have a table with over 100 columns and a database guy who likes to add new ones as he feels;
is there a way to write a stored proc insert that will insert into the known columns (ignoring the extras); like insert set column1 = x</p>

答:
This depends entirely on the database you are using, if the database allows for certain values to be NULL or if the defaults are set up correctly, you can INSERT into specific columns.

```<code>INSERT INTO myCrazyHugeTable (column1Name, column2Name)
    VALUES ('column1Val', 'column2Val');
</code>```

I would be asking some serious questions about:

Why you have a table with over 100 columns

Why the structure is so volatile

ContentLicense: CC BY-SA 3.0

Body:
This depends entirely on the database you are using, if the database allows for certain values to be NULL or if the defaults are set up correctly, you can INSERT into specific columns.

INSERT INTO myCrazyHugeTable (column1Name, column2Name)
    VALUES ('column1Val', 'column2Val');

I would be asking some serious questions about:

Why you have a table with over 100 columns

Why the structure is so volatile


问:
How to add margins between columns in Bootsrap4?
I try to arrange 3 sections columns equally by assigning either col-lg-4 or col-lg-3 for each of them with Bootsstrap 4.

With col-lg-4 or any responsive combination that takes total of 12 columns, I get no margin between the columns.

With col-lg-3 the margins become too wide.

The same problem arises with both "container" and "container-fluid" class.

I tried also to adjust the margins manually, replacing mx-auto with Bootstrap4 margin set at m-3, but it does not solve the problem because in that case all the columns move to the left, leaving empty space on the right side of the screen.

The problem arises the moment I try to put margins. Otherwise, if there are no margins I can set col-lg-4 without a problem. I will get for instance 3 nice columns. But once I put margins, it becomes wrong. I followed the recommendation on https://getbootstrap.com/docs/4.0/utilities/spacing/ but still it does not help.

* {
  box-sizing: border-box;
}

body {
    font-size: 16px;
    color: black;
    background-color: #eeeeee;
    font-family: 'Oxygen', sans-serif;
  }

 .navbar {
    background-color: rgb(178, 238, 13);
    border-radius: 0;
    border: 0;
    margin: 0;
    padding: 0;
  }

  #collapsibleNavbar {
    background-color: rgb(229, 243, 192);
    text-align: center;
  }

  .navbar-nav li a {
    color: black;
    border-style: solid;
    border-width: 1px;
  }

  .navbar-brand {
      color: black;
      padding: 15px;
  }

  h5{
    margin-bottom: 15px;
    padding-top: 7px;
  }

  h2{
    font-size: 175%;
    margin-bottom: 30px;
    margin-top: 20px;
  }

  .paraf{
    background-color: #e6ee9c;
  }```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Module 3</title>
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="styles.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>
<body>

<header>
    <nav class="navbar navbar-expand-md navbar-light">
            Food, LLC

            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
                    <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="collapsibleNavbar">
                    <ul class="d-lg-none d-md-none navbar-nav">
                      <li class="nav-item">
                        Chicken
                      </li>
                      <li class="nav-item">
                        Beef
                      </li>
                      <li class="nav-item">
                        Sushi
                      </li>
                    </ul>
                  </div>
    </nav>

</header>
<h2 class="text-center"> Our Menu </h2>

<div class="container">
<div class="row">

<div class="col-lg-4 col-md-6 col-sm-12 col-12 paraf mx-auto">
<h5 class="text-center" id="chicken">Chicken</h5>
<p>Lorem ipsum dolor sit amet, consectetur felis ut venenatis tortor, nulla fringilla commodo eget ullamcorper
viverra nulla. Quis donec ultricies, in non eget ultricies ut wisi pede. Eget faucibus ligula lacinia, ligula risus quasi,
vestibulum amet mattis mi sit egestas, a velit integer, feugiat lectus et. Ullamcorper ut lobortis est, consequat magnis,
donec lorem posuere sit ridiculus lacinia augue, morbi magna velit pellentesque a vestibulum arcu, in facilisi ultricies
dolor eu dolor quis. Nec eu libero, fermentum sagittis augue wisi wisi adipiscing. Est risus dapibus cursus, praesent
vivamus mattis est, ac euismod quis. Primis diam enim tortor fermentum, varius pede officia pellentesque nibh quam
blandit, accumsan vestibulum interdum vivamus, iaculis wisi lacus sodales facilisi. Molestie accusantium, sed nisl
ratione eu euismod nulla ac, morbi aliquet. Lacus egestas. Purus sem fusce et id nibh mauris, luctus magnis diam morbi
enim, nunc iste, laoreet commodo in tortor lobortis. Congue suspendisse pellentesque eget, nibh pulvinar dolor donec
hac, quis diam at vehicula suspendisse. Eget commodo libero, tortor integer, nec integer, mauris eget iaculis nec
imperdiet dolor eros.
Lorem ipsum dolor sit amet, consectetur felis ut venenatis tortor, nulla fringilla commodo eget ullamcorper
viverra nulla. Quis donec ultricies, in non eget ultricies ut wisi pede. Eget faucibus ligula lacinia, ligula risus quasi,
vestibulum amet mattis mi sit egestas, a velit integer, feugiat lectus et. Ullamcorper ut lobortis est, consequat magnis,
donec lorem posuere sit ridiculus lacinia augue, morbi magna velit pellentesque a vestibulum arcu, in facilisi ultricies
dolor eu dolor quis. Nec eu libero, fermentum sagittis augue wisi wisi adipiscing. Est risus dapibus cursus, praesent
vivamus mattis est, ac euismod quis. Primis diam enim tortor fermentum, varius pede officia pellentesque nibh quam
blandit, accumsan vestibulum interdum vivamus, iaculis wisi lacus sodales facilisi. Molestie accusantium, sed nisl
ratione eu euismod nulla ac, morbi aliquet. Lacus egestas. Purus sem fusce et id nibh mauris, luctus magnis diam morbi
enim, nunc iste, laoreet commodo in tortor lobortis. Congue suspendisse pellentesque eget, nibh pulvinar dolor donec
hac, quis diam at vehicula suspendisse. Eget commodo libero, tortor integer, nec integer, mauris eget iaculis nec
imperdiet dolor eros. <br> (End of Chicken section) Back to Top</p></div>

<div class="col-lg-4 col-md-6 col-sm-12 col-12 paraf mx-auto">
<h5 class="text-center" id="beef">Beef</h5>
<p>Lorem ipsum dolor sit amet, consectetur felis ut venenatis tortor, nulla fringilla commodo eget ullamcorper
viverra nulla. Quis donec ultricies, in non eget ultricies ut wisi pede. Eget faucibus ligula lacinia, ligula risus quasi,
vestibulum amet mattis mi sit egestas, a velit integer, feugiat lectus et. Ullamcorper ut lobortis est, consequat magnis,
donec lorem posuere sit ridiculus lacinia augue, morbi magna velit pellentesque a vestibulum arcu, in facilisi ultricies
dolor eu dolor quis. Nec eu libero, fermentum sagittis augue wisi wisi adipiscing. Est risus dapibus cursus, praesent
vivamus mattis est, ac euismod quis. Primis diam enim tortor fermentum, varius pede officia pellentesque nibh quam
blandit, accumsan vestibulum interdum vivamus, iaculis wisi lacus sodales facilisi. Molestie accusantium, sed nisl
ratione eu euismod nulla ac, morbi aliquet. Lacus egestas. Purus sem fusce et id nibh mauris, luctus magnis diam morbi
enim, nunc iste, laoreet commodo in tortor lobortis. Congue suspendisse pellentesque eget, nibh pulvinar dolor donec
hac, quis diam at vehicula suspendisse. Eget commodo libero, tortor integer, nec integer, mauris eget iaculis nec
imperdiet dolor eros.
Lorem ipsum dolor sit amet, consectetur felis ut venenatis tortor, nulla fringilla commodo eget ullamcorper
viverra nulla. Quis donec ultricies, in non eget ultricies ut wisi pede. Eget faucibus ligula lacinia, ligula risus quasi,
vestibulum amet mattis mi sit egestas, a velit integer, feugiat lectus et. Ullamcorper ut lobortis est, consequat magnis,
donec lorem posuere sit ridiculus lacinia augue, morbi magna velit pellentesque a vestibulum arcu, in facilisi ultricies
dolor eu dolor quis. Nec eu libero, fermentum sagittis augue wisi wisi adipiscing. Est risus dapibus cursus, praesent
vivamus mattis est, ac euismod quis. Primis diam enim tortor fermentum, varius pede officia pellentesque nibh quam
blandit, accumsan vestibulum interdum vivamus, iaculis wisi lacus sodales facilisi. Molestie accusantium, sed nisl
ratione eu euismod nulla ac, morbi aliquet. Lacus egestas. Purus sem fusce et id nibh mauris, luctus magnis diam morbi
enim, nunc iste, laoreet commodo in tortor lobortis. Congue suspendisse pellentesque eget, nibh pulvinar dolor donec
hac, quis diam at vehicula suspendisse. Eget commodo libero, tortor integer, nec integer, mauris eget iaculis nec
imperdiet dolor eros.<br>(End of Beef section) Back to Top</p></div>

<div class="col-lg-4 col-md-12 col-sm-12 col-12 paraf mx-auto">
<h5 class="text-center" id="sushi">Sushi</h5>
<p>Lorem ipsum dolor sit amet, consectetur felis ut venenatis tortor, nulla fringilla commodo eget ullamcorper
viverra nulla. Quis donec ultricies, in non eget ultricies ut wisi pede. Eget faucibus ligula lacinia, ligula risus quasi,
vestibulum amet mattis mi sit egestas, a velit integer, feugiat lectus et. Ullamcorper ut lobortis est, consequat magnis,
donec lorem posuere sit ridiculus lacinia augue, morbi magna velit pellentesque a vestibulum arcu, in facilisi ultricies
dolor eu dolor quis. Nec eu libero, fermentum sagittis augue wisi wisi adipiscing. Est risus dapibus cursus, praesent
vivamus mattis est, ac euismod quis. Primis diam enim tortor fermentum, varius pede officia pellentesque nibh quam
blandit, accumsan vestibulum interdum vivamus, iaculis wisi lacus sodales facilisi. Molestie accusantium, sed nisl
ratione eu euismod nulla ac, morbi aliquet. Lacus egestas. Purus sem fusce et id nibh mauris, luctus magnis diam morbi
enim, nunc iste, laoreet commodo in tortor lobortis. Congue suspendisse pellentesque eget, nibh pulvinar dolor donec
hac, quis diam at vehicula suspendisse. Eget commodo libero, tortor integer, nec integer, mauris eget iaculis nec
imperdiet dolor eros.
Lorem ipsum dolor sit amet, consectetur felis ut venenatis tortor, nulla fringilla commodo eget ullamcorper
viverra nulla. Quis donec ultricies, in non eget ultricies ut wisi pede. Eget faucibus ligula lacinia, ligula risus quasi,
vestibulum amet mattis mi sit egestas, a velit integer, feugiat lectus et. Ullamcorper ut lobortis est, consequat magnis,
donec lorem posuere sit ridiculus lacinia augue, morbi magna velit pellentesque a vestibulum arcu, in facilisi ultricies
dolor eu dolor quis. Nec eu libero, fermentum sagittis augue wisi wisi adipiscing. Est risus dapibus cursus, praesent
vivamus mattis est, ac euismod quis. Primis diam enim tortor fermentum, varius pede officia pellentesque nibh quam
blandit, accumsan vestibulum interdum vivamus, iaculis wisi lacus sodales facilisi. Molestie accusantium, sed nisl
ratione eu euismod nulla ac, morbi aliquet. Lacus egestas. Purus sem fusce et id nibh mauris, luctus magnis diam morbi
enim, nunc iste, laoreet commodo in tortor lobortis. Congue suspendisse pellentesque eget, nibh pulvinar dolor donec
hac, quis diam at vehicula suspendisse. Eget commodo libero, tortor integer, nec integer, mauris eget iaculis nec
imperdiet dolor eros.<br>(End of Sushi section) Back to Top</p></div>
</div>
</div>

</body>
</html></code>```

Can you suggest how to fix this and get margins between the columns.

答:
You can use the col-lg-4 while using padding so it would look like they're separated and come out as:</p>

```<code><div class="col-lg-4 px-1 (other classes...)">
</div>
<div class="col-lg-4 px-1 (other classes...)">
</div>
<div class="col-lg-4 px-1 (other classes...)">
</div>

</code>```

Body:
I try to arrange 3 sections columns equally by assigning either col-lg-4 or col-lg-3 for each of them with Bootsstrap 4.

With col-lg-4 or any responsive combination that takes total of 12 columns, I get no margin between the columns.

With col-lg-3 the margins become too wide.

The same problem arises with both "container" and "container-fluid" class.

I tried also to adjust the margins manually, replacing mx-auto with Bootstrap4 margin set at m-3, but it does not solve the problem because in that case all the columns move to the left, leaving empty space on the right side of the screen.

The problem arises the moment I try to put margins. Otherwise, if there are no margins I can set col-lg-4 without a problem. I will get for instance 3 nice columns. But once I put margins, it becomes wrong. I followed the recommendation on https://getbootstrap.com/docs/4.0/utilities/spacing/ but still it does not help.

* {
  box-sizing: border-box;
}

body {
    font-size: 16px;
    color: black;
    background-color: #eeeeee;
    font-family: 'Oxygen', sans-serif;
  }

 .navbar {
    background-color: rgb(178, 238, 13);
    border-radius: 0;
    border: 0;
    margin: 0;
    padding: 0;
  }

  #collapsibleNavbar {
    background-color: rgb(229, 243, 192);
    text-align: center;
  }

  .navbar-nav li a {
    color: black;
    border-style: solid;
    border-width: 1px;
  }

  .navbar-brand {
      color: black;
      padding: 15px;
  }

  h5{
    margin-bottom: 15px;
    padding-top: 7px;
  }

  h2{
    font-size: 175%;
    margin-bottom: 30px;
    margin-top: 20px;
  }

  .paraf{
    background-color: #e6ee9c;
  }

<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Module 3</title>
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="styles.css">

            Food, LLC

            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">

            </button>

                        Chicken

                        Beef

                        Sushi

 Our Menu

Chicken

Lorem ipsum dolor sit amet, consectetur felis ut venenatis tortor, nulla fringilla commodo eget ullamcorper
viverra nulla. Quis donec ultricies, in non eget ultricies ut wisi pede. Eget faucibus ligula lacinia, ligula risus quasi,
vestibulum amet mattis mi sit egestas, a velit integer, feugiat lectus et. Ullamcorper ut lobortis est, consequat magnis,
donec lorem posuere sit ridiculus lacinia augue, morbi magna velit pellentesque a vestibulum arcu, in facilisi ultricies
dolor eu dolor quis. Nec eu libero, fermentum sagittis augue wisi wisi adipiscing. Est risus dapibus cursus, praesent
vivamus mattis est, ac euismod quis. Primis diam enim tortor fermentum, varius pede officia pellentesque nibh quam
blandit, accumsan vestibulum interdum vivamus, iaculis wisi lacus sodales facilisi. Molestie accusantium, sed nisl
ratione eu euismod nulla ac, morbi aliquet. Lacus egestas. Purus sem fusce et id nibh mauris, luctus magnis diam morbi
enim, nunc iste, laoreet commodo in tortor lobortis. Congue suspendisse pellentesque eget, nibh pulvinar dolor donec
hac, quis diam at vehicula suspendisse. Eget commodo libero, tortor integer, nec integer, mauris eget iaculis nec
imperdiet dolor eros.
Lorem ipsum dolor sit amet, consectetur felis ut venenatis tortor, nulla fringilla commodo eget ullamcorper
viverra nulla. Quis donec ultricies, in non eget ultricies ut wisi pede. Eget faucibus ligula lacinia, ligula risus quasi,
vestibulum amet mattis mi sit egestas, a velit integer, feugiat lectus et. Ullamcorper ut lobortis est, consequat magnis,
donec lorem posuere sit ridiculus lacinia augue, morbi magna velit pellentesque a vestibulum arcu, in facilisi ultricies
dolor eu dolor quis. Nec eu libero, fermentum sagittis augue wisi wisi adipiscing. Est risus dapibus cursus, praesent
vivamus mattis est, ac euismod quis. Primis diam enim tortor fermentum, varius pede officia pellentesque nibh quam
blandit, accumsan vestibulum interdum vivamus, iaculis wisi lacus sodales facilisi. Molestie accusantium, sed nisl
ratione eu euismod nulla ac, morbi aliquet. Lacus egestas. Purus sem fusce et id nibh mauris, luctus magnis diam morbi
enim, nunc iste, laoreet commodo in tortor lobortis. Congue suspendisse pellentesque eget, nibh pulvinar dolor donec
hac, quis diam at vehicula suspendisse. Eget commodo libero, tortor integer, nec integer, mauris eget iaculis nec
imperdiet dolor eros.
 (End of Chicken section) Back to Top

Beef

Lorem ipsum dolor sit amet, consectetur felis ut venenatis tortor, nulla fringilla commodo eget ullamcorper
viverra nulla. Quis donec ultricies, in non eget ultricies ut wisi pede. Eget faucibus ligula lacinia, ligula risus quasi,
vestibulum amet mattis mi sit egestas, a velit integer, feugiat lectus et. Ullamcorper ut lobortis est, consequat magnis,
donec lorem posuere sit ridiculus lacinia augue, morbi magna velit pellentesque a vestibulum arcu, in facilisi ultricies
dolor eu dolor quis. Nec eu libero, fermentum sagittis augue wisi wisi adipiscing. Est risus dapibus cursus, praesent
vivamus mattis est, ac euismod quis. Primis diam enim tortor fermentum, varius pede officia pellentesque nibh quam
blandit, accumsan vestibulum interdum vivamus, iaculis wisi lacus sodales facilisi. Molestie accusantium, sed nisl
ratione eu euismod nulla ac, morbi aliquet. Lacus egestas. Purus sem fusce et id nibh mauris, luctus magnis diam morbi
enim, nunc iste, laoreet commodo in tortor lobortis. Congue suspendisse pellentesque eget, nibh pulvinar dolor donec
hac, quis diam at vehicula suspendisse. Eget commodo libero, tortor integer, nec integer, mauris eget iaculis nec
imperdiet dolor eros.
Lorem ipsum dolor sit amet, consectetur felis ut venenatis tortor, nulla fringilla commodo eget ullamcorper
viverra nulla. Quis donec ultricies, in non eget ultricies ut wisi pede. Eget faucibus ligula lacinia, ligula risus quasi,
vestibulum amet mattis mi sit egestas, a velit integer, feugiat lectus et. Ullamcorper ut lobortis est, consequat magnis,
donec lorem posuere sit ridiculus lacinia augue, morbi magna velit pellentesque a vestibulum arcu, in facilisi ultricies
dolor eu dolor quis. Nec eu libero, fermentum sagittis augue wisi wisi adipiscing. Est risus dapibus cursus, praesent
vivamus mattis est, ac euismod quis. Primis diam enim tortor fermentum, varius pede officia pellentesque nibh quam
blandit, accumsan vestibulum interdum vivamus, iaculis wisi lacus sodales facilisi. Molestie accusantium, sed nisl
ratione eu euismod nulla ac, morbi aliquet. Lacus egestas. Purus sem fusce et id nibh mauris, luctus magnis diam morbi
enim, nunc iste, laoreet commodo in tortor lobortis. Congue suspendisse pellentesque eget, nibh pulvinar dolor donec
hac, quis diam at vehicula suspendisse. Eget commodo libero, tortor integer, nec integer, mauris eget iaculis nec
imperdiet dolor eros.
(End of Beef section) Back to Top

Sushi

Lorem ipsum dolor sit amet, consectetur felis ut venenatis tortor, nulla fringilla commodo eget ullamcorper
viverra nulla. Quis donec ultricies, in non eget ultricies ut wisi pede. Eget faucibus ligula lacinia, ligula risus quasi,
vestibulum amet mattis mi sit egestas, a velit integer, feugiat lectus et. Ullamcorper ut lobortis est, consequat magnis,
donec lorem posuere sit ridiculus lacinia augue, morbi magna velit pellentesque a vestibulum arcu, in facilisi ultricies
dolor eu dolor quis. Nec eu libero, fermentum sagittis augue wisi wisi adipiscing. Est risus dapibus cursus, praesent
vivamus mattis est, ac euismod quis. Primis diam enim tortor fermentum, varius pede officia pellentesque nibh quam
blandit, accumsan vestibulum interdum vivamus, iaculis wisi lacus sodales facilisi. Molestie accusantium, sed nisl
ratione eu euismod nulla ac, morbi aliquet. Lacus egestas. Purus sem fusce et id nibh mauris, luctus magnis diam morbi
enim, nunc iste, laoreet commodo in tortor lobortis. Congue suspendisse pellentesque eget, nibh pulvinar dolor donec
hac, quis diam at vehicula suspendisse. Eget commodo libero, tortor integer, nec integer, mauris eget iaculis nec
imperdiet dolor eros.
Lorem ipsum dolor sit amet, consectetur felis ut venenatis tortor, nulla fringilla commodo eget ullamcorper
viverra nulla. Quis donec ultricies, in non eget ultricies ut wisi pede. Eget faucibus ligula lacinia, ligula risus quasi,
vestibulum amet mattis mi sit egestas, a velit integer, feugiat lectus et. Ullamcorper ut lobortis est, consequat magnis,
donec lorem posuere sit ridiculus lacinia augue, morbi magna velit pellentesque a vestibulum arcu, in facilisi ultricies
dolor eu dolor quis. Nec eu libero, fermentum sagittis augue wisi wisi adipiscing. Est risus dapibus cursus, praesent
vivamus mattis est, ac euismod quis. Primis diam enim tortor fermentum, varius pede officia pellentesque nibh quam
blandit, accumsan vestibulum interdum vivamus, iaculis wisi lacus sodales facilisi. Molestie accusantium, sed nisl
ratione eu euismod nulla ac, morbi aliquet. Lacus egestas. Purus sem fusce et id nibh mauris, luctus magnis diam morbi
enim, nunc iste, laoreet commodo in tortor lobortis. Congue suspendisse pellentesque eget, nibh pulvinar dolor donec
hac, quis diam at vehicula suspendisse. Eget commodo libero, tortor integer, nec integer, mauris eget iaculis nec
imperdiet dolor eros.
(End of Sushi section) Back to Top

Can you suggest how to fix this and get margins between the columns.

Body:
You can use the col-lg-4 while using padding so it would look like they're separated and come out as:

<div class="col-lg-4 px-1 (other classes...)">
</div>
<div class="col-lg-4 px-1 (other classes...)">
</div>
<div class="col-lg-4 px-1 (other classes...)">
</div>


问:
kubectl apply -f k8s: is unable to recognize service and deployment and has no matches for kind "Service" in version "v1"
I have kubernetes running on OVH without a problem. But i recently reinstalled the build server because of other issues and setup everything but when trying to apply files it gives this horrable error.. did i miss something? and what does this error really mean?

+ kubectl apply -f k8s
unable to recognize "k8s/driver-cluster-ip-service.yaml": no matches for kind "Service" in version "v1"
unable to recognize "k8s/driver-deployment.yaml": no matches for kind "Deployment" in version "apps/v1"
unable to recognize "k8s/driver-mysql-cluster-ip-service.yaml": no matches for kind "Service" in version "v1"
unable to recognize "k8s/driver-mysql-deployment.yaml": no matches for kind "Deployment" in version "apps/v1"
unable to recognize "k8s/driver-mysql-persistent-volume-claim.yaml": no matches for kind "PersistentVolumeClaim" in version "v1"
unable to recognize "k8s/driver-phpmyadmin-cluster-ip-service.yaml": no matches for kind "Service" in version "v1"
unable to recognize "k8s/driver-phpmyadmin-deployment.yaml": no matches for kind "Deployment" in version "apps/v1"
```

<p>I tried all previous answes on SO but none worked out for me. I don't think that i really need it, "correct me if i am wrong on that". I really would like to get some help with this.</p>

<p>I have installed kubectl and i got a config file that i use.
And when i execute the <code>kubectl get pods</code> command i am getting the pods that where deployed before </p>

<p>These are some of the yml files </p>

<blockquote>
  <p><em>k8s/driver-cluster-ip-service.yaml</em></p>
</blockquote>

```apiVersion: v1
kind: Service
metadata:
  name: driver-cluster-ip-service
spec:
  type: ClusterIP
  selector:
    component: driver-service
  ports:
    - port: 3000
      targetPort: 8080

```

<blockquote>
  <p><em>k8s/driver-deployment.yaml</em></p>
</blockquote>

```apiVersion: apps/v1
kind: Deployment
metadata:
  name: driver-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      component: driver-service
  template:
    metadata:
      labels:
        component: driver-service
    spec:
      containers:
        - name: driver
          image: repo.taxi.com/driver-service
          imagePullPolicy: Always
          ports:
            - containerPort: 8080
      imagePullSecrets:
        - name: taxiregistry
```

<blockquote>
  <p><em>dockerfile</em></p>
</blockquote>

```FROM maven:3.6.0-jdk-8-slim AS build
COPY . /home/app/
RUN rm /home/app/controllers/src/main/resources/application.properties
RUN mv /home/app/controllers/src/main/resources/application-kubernetes.properties /home/app/controllers/src/main/resources/application.properties
RUN mvn -f /home/app/pom.xml clean package

FROM openjdk:8-jre-slim
COPY --from=build /home/app/controllers/target/controllers-1.0.jar /usr/local/lib/driver-1.0.0.jar
EXPOSE 8080
ENTRYPOINT ["java","-jar","/usr/local/lib/driver-1.0.0.jar"]
```

kubectl get pods command

kubectl api-versions

答:
solution found

I had to place the binary file in a .kube folder which should be placed in the root directory
In my case i had to manually create the .kube folder in the root directory first.

After that I had my env variable set to that folder and placed my config file with my settings in there as well

Then i had to share the folder with the jenkins user and applied rights to the jenkins group

Jenkins was not up to date, so I had to restart the jenkins server.

And it worked like a charm!

Keep in mind to restart the jenkins server so that the changes you make will take affect on jenkins.

Body:
I have kubernetes running on OVH without a problem. But i recently reinstalled the build server because of other issues and setup everything but when trying to apply files it gives this horrable error.. did i miss something? and what does this error really mean?

+ kubectl apply -f k8s
unable to recognize "k8s/driver-cluster-ip-service.yaml": no matches for kind "Service" in version "v1"
unable to recognize "k8s/driver-deployment.yaml": no matches for kind "Deployment" in version "apps/v1"
unable to recognize "k8s/driver-mysql-cluster-ip-service.yaml": no matches for kind "Service" in version "v1"
unable to recognize "k8s/driver-mysql-deployment.yaml": no matches for kind "Deployment" in version "apps/v1"
unable to recognize "k8s/driver-mysql-persistent-volume-claim.yaml": no matches for kind "PersistentVolumeClaim" in version "v1"
unable to recognize "k8s/driver-phpmyadmin-cluster-ip-service.yaml": no matches for kind "Service" in version "v1"
unable to recognize "k8s/driver-phpmyadmin-deployment.yaml": no matches for kind "Deployment" in version "apps/v1"

I tried all previous answes on SO but none worked out for me. I don't think that i really need it, "correct me if i am wrong on that". I really would like to get some help with this.

I have installed kubectl and i got a config file that i use.
And when i execute the kubectl get pods command i am getting the pods that where deployed before

These are some of the yml files

k8s/driver-cluster-ip-service.yaml

apiVersion: v1
kind: Service
metadata:
  name: driver-cluster-ip-service
spec:
  type: ClusterIP
  selector:
    component: driver-service
  ports:
    - port: 3000
      targetPort: 8080

k8s/driver-deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: driver-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      component: driver-service
  template:
    metadata:
      labels:
        component: driver-service
    spec:
      containers:
        - name: driver
          image: repo.taxi.com/driver-service
          imagePullPolicy: Always
          ports:
            - containerPort: 8080
      imagePullSecrets:
        - name: taxiregistry

dockerfile

FROM maven:3.6.0-jdk-8-slim AS build
COPY . /home/app/
RUN rm /home/app/controllers/src/main/resources/application.properties
RUN mv /home/app/controllers/src/main/resources/application-kubernetes.properties /home/app/controllers/src/main/resources/application.properties
RUN mvn -f /home/app/pom.xml clean package

FROM openjdk:8-jre-slim
COPY --from=build /home/app/controllers/target/controllers-1.0.jar /usr/local/lib/driver-1.0.0.jar
EXPOSE 8080
ENTRYPOINT ["java","-jar","/usr/local/lib/driver-1.0.0.jar"]

kubectl get pods command

kubectl api-versions


问:
ServiceWorker / Cache / Set TTL
with regards to this api https://developer.mozilla.org/en-US/docs/Web/API/Cache, I'd like to also set the cache lifetime.

let's say, cache this request for no longer than 10 minutes

答:
You can dynamically create cache names that encode their creation time and max age, something simple like: ${dateStr}_${maxAgeMs}. Then when intercepting a fetch in your service worker you can look through the existing caches using caches.keys and find one that isn't expired using just its name and match against that, or create a new one if they're all expired and populate it with the incoming fetches. This also gives you an opportunity to delete the expired caches.

I needed to do this as well and took a look at the mentioned workbox project, seems like they're doing a similar thing with IndexedDB storage but that seems overkill for the ask.

Title: ServiceWorker / Cache / Set TTL


问:
NoSuchMethodError: The method 'drive' was called on null
I know there are quite a few questions that have a resembling title of NoSuchMethodError: The method '#**something**#' was called on null. And usually this issue happens when you try to access a null object's method. But, in my case this Exception is shown when I try to add the following code to my StatefulWidget:

```<code> _handleMyBusinessesTap() {
    Navigator.of(context).push(
    MaterialPageRoute(
      builder: (context) => PageBusinessList(
           firebaseUser: widget.firebaseUser,
      ),
    ),
  );
}
</code>```

Once I try to use the Navigator object in my code I'm getting this exception.
The only difference I can think of that I have in this page from the other pages in which Navigator object does not causes any issues is that I build my page this way:

```<code> Widget build(BuildContext context) {
  return DefaultTabController(
    length: 3,
    child: Scaffold(
      appBar: _buildAppBar(),
      drawer: _buildDrawer(),
      body: _buildBody(),
    ),
  );
}
</code>```

I'm using here DefaultTabController contains a body of 3 page:

```<code> Widget _buildBody() {
  return TabBarView(
    children: [
      MyCardScreen(),
      ReceivedScreen(),
      SentScreen(),
    ],
  );
}
</code>```

The _handleMyBusinessesTap method is one of the options I have in the drawer which I want to take me to a new page, but for some reason once I add it it throws this exception in the title. Does someone encountered this problem and know how it should be handled?

here is the buildDrawer method:

```<code> Widget _buildDrawer() {
return Drawer(
  child: ListView(
    padding: EdgeInsets.zero,
    children: <Widget>[
      UserAccountsDrawerHeader(
        accountName: _buildAccountNameWidget(),
        accountEmail: _buildAccountEmailWidget(),
        currentAccountPicture: _buildAccountCircleAvatar(),
      ),
      ListTile(title: Text("My Default Business Card"), onTap: _handleMyDefaultBusinessCardTap()),
      ListTile(title: Text("My Businesses"), onTap: _handleMyBusinessesTap()),
      ListTile(title: Text("Terms and Conditions"), onTap: _handleTermsAndConditionsTap()),
      ListTile(title: Text("Privacy Policy"), onTap: _handlePrivacyPolicyTap()),
      ListTile(title: Text("Log Out"), onTap: _handleLogOutTap()),
    ],
  ),
);
}
</code>```

here is there rest of the stack:

```<code>I/flutter (  722): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (  722): The following assertion was thrown building PageMain(dirty, dependencies: [_InheritedTheme,
I/flutter (  722): _LocalizationsScope-[GlobalKey#b039d]], state: _PageMainWidgetState#e33af):
I/flutter (  722): setState() or markNeedsBuild() called during build.
I/flutter (  722): This Overlay widget cannot be marked as needing to build because the framework is already in the
I/flutter (  722): process of building widgets. A widget can be marked as needing to be built during the build phase
I/flutter (  722): only if one of its ancestors is currently building. This exception is allowed because the framework
I/flutter (  722): builds parent widgets before children, which means a dirty descendant will always be built.
I/flutter (  722): Otherwise, the framework might not visit this widget during this build phase.
I/flutter (  722): The widget on which setState() or markNeedsBuild() was called was:
I/flutter (  722):   Overlay-[LabeledGlobalKey<OverlayState>#51a6b](state: OverlayState#7d0ac(entries:
I/flutter (  722):   [OverlayEntry#f42cb(opaque: false; maintainState: false), OverlayEntry#d6b18(opaque: false;
I/flutter (  722):   maintainState: true), OverlayEntry#75d78(opaque: false; maintainState: false),
I/flutter (  722):   OverlayEntry#02406(opaque: false; maintainState: true), OverlayEntry#8f4e5(opaque: false;
I/flutter (  722):   maintainState: false), OverlayEntry#11c40(opaque: false; maintainState: true)]))
I/flutter (  722): The widget which was currently being built when the offending call was made was:
I/flutter (  722):   PageMain(dirty, dependencies: [_InheritedTheme, _LocalizationsScope-[GlobalKey#b039d]], state:
I/flutter (  722):   _PageMainWidgetState#e33af)
I/flutter (  722): When the exception was thrown, this was the stack:
I/flutter (  722): #0      Element.markNeedsBuild.<anonymous closure> (package:flutter/src/widgets/framework.dart:3503:11)
I/flutter (  722): #1      Element.markNeedsBuild (package:flutter/src/widgets/framework.dart:3529:6)
I/flutter (  722): #2      State.setState (package:flutter/src/widgets/framework.dart:1133:14)
I/flutter (  722): #3      OverlayState.insertAll (package:flutter/src/widgets/overlay.dart:346:5)
I/flutter (  722): #4      OverlayRoute.install (package:flutter/src/widgets/routes.dart:43:24)
I/flutter (  722): #5      TransitionRoute.install (package:flutter/src/widgets/routes.dart:180:11)
I/flutter (  722): #6      ModalRoute.install (package:flutter/src/widgets/routes.dart:895:11)
I/flutter (  722): #7      NavigatorState.push (package:flutter/src/widgets/navigator.dart:1742:11)
I/flutter (  722): #8      _PageMainWidgetState._handleMyBusinessesTap (package:bizooc_client/pages/page_main.dart:86:27)
I/flutter (  722): #9      _PageMainWidgetState._buildDrawer (package:bizooc_client/pages/page_main.dart:60:57)
I/flutter (  722): #10     _PageMainWidgetState.build (package:bizooc_client/pages/page_main.dart:33:17)
I/flutter (  722): #11     StatefulElement.build (package:flutter/src/widgets/framework.dart:3825:27)
I/flutter (  722): #12     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3739:15)
I/flutter (  722): #13     Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #14     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter (  722): #15     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3864:11)
I/flutter (  722): #16     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter (  722): #17     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #18     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #19     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
I/flutter (  722): #20     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #21     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #22     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #23     Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #24     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter (  722): #25     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter (  722): #26     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #27     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #28     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
I/flutter (  722): #29     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #30     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #31     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
I/flutter (  722): #32     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #33     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #34     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
I/flutter (  722): #35     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #36     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #37     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
I/flutter (  722): #38     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #39     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #40     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #41     Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #42     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter (  722): #43     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3864:11)
I/flutter (  722): #44     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter (  722): #45     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #46     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #47     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #48     Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #49     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter (  722): #50     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter (  722): #51     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #52     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #53     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #54     Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #55     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter (  722): #56     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3864:11)
I/flutter (  722): #57     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter (  722): #58     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #59     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #60     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
I/flutter (  722): #61     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #62     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #63     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #64     Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #65     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter (  722): #66     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter (  722): #67     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #68     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #69     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
I/flutter (  722): #70     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #71     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #72     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #73     Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #74     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter (  722): #75     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3864:11)
I/flutter (  722): #76     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter (  722): #77     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #78     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #79     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #80     Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #81     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter (  722): #82     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter (  722): #83     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #84     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #85     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
I/flutter (  722): #86     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #87     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #88     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #89     Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #90     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter (  722): #91     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter (  722): #92     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #93     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #94     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #95     Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #96     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter (  722): #97     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3864:11)
I/flutter (  722): #98     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter (  722): #99     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #100    Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #101    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #102    Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #103    ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter (  722): #104    StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3864:11)
I/flutter (  722): #105    ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter (  722): #106    Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #107    Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #108    RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:4659:32)
I/flutter (  722): #109    MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4992:17)
I/flutter (  722): #110    Element.updateChild (package:flutter/src/widgets/framework.dart:2753:15)
I/flutter (  722): #111    _TheatreElement.update (package:flutter/src/widgets/overlay.dart:607:16)
I/flutter (  722): #112    Element.updateChild (package:flutter/src/widgets/framework.dart:2753:15)
I/flutter (  722): #113    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #114    Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #115    StatefulElement.update (package:flutter/src/widgets/framework.dart:3894:5)
I/flutter (  722): #116    Element.updateChild (package:flutter/src/widgets/framework.dart:2753:15)
I/flutter (  722): #117    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #118    Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #119    ProxyElement.update (package:flutter/src/widgets/framework.dart:4006:5)
I/flutter (  722): #120    Element.updateChild (package:flutter/src/widgets/framework.dart:2753:15)
I/flutter (  722): #121    SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4883:14)
I/flutter (  722): #122    Element.updateChild (package:flutter/src/widgets/framework.dart:2753:15)
I/flutter (  722): #123    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #124    Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #125    StatefulElement.update (package:flutter/src/widgets/framework.dart:3894:5)
I/flutter (  722): #126    Element.updateChild (package:flutter/src/widgets/framework.dart:2753:15)
I/flutter (  722): #127    SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4883:14)
I/flutter (  722): #128    Element.updateChild (package:flutter/src/widgets/framework.dart:2753:15)
I/flutter (  722): #129    SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4883:14)
I/flutter (  722): #130    Element.updateChild (package:flutter/src/widgets/framework.dart:2753:15)
I/flutter (  722): #131    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #132    Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #133    BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2278:33)
I/flutter (  722): #134    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:700:20)
I/flutter (  722): #135    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:286:5)
I/flutter (  722): #136    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1012:15)
I/flutter (  722): #137    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:952:9)
I/flutter (  722): #138    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:864:5)
I/flutter (  722): #142    _invoke (dart:ui/hooks.dart:219:10)
I/flutter (  722): #143    _drawFrame (dart:ui/hooks.dart:178:3)
I/flutter (  722): (elided 3 frames from package dart:async)
I/flutter (  722): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter (  722): Another exception was thrown: NoSuchMethodError: The getter 'status' was called on null.
I/flutter (  722): Another exception was thrown: NoSuchMethodError: The method 'drive' was called on null.
</code>```

答:
This is a common error when use callbacks functions.

```<code>   ListTile(title: Text("Log Out"), onTap: _handleLogOutTap()),
</code>```

To fix your issue you have some options :

1-

```<code> ListTile(title: Text("Log Out"), onTap: _handleLogOutTap),
</code>```

2-

```<code>  ListTile(title: Text("Log Out"), onTap: () => _handleLogOutTap()),
</code>```

3-

```<code>  ListTile(title: Text("Log Out"), onTap: () { _handleLogOutTap() ; }),
</code>```

The same for all of your ListTile's.

Body:
I know there are quite a few questions that have a resembling title of NoSuchMethodError: The method '#**something**#' was called on null. And usually this issue happens when you try to access a null object's method. But, in my case this Exception is shown when I try to add the following code to my StatefulWidget:

 _handleMyBusinessesTap() {
    Navigator.of(context).push(
    MaterialPageRoute(
      builder: (context) => PageBusinessList(
           firebaseUser: widget.firebaseUser,
      ),
    ),
  );
}

Once I try to use the Navigator object in my code I'm getting this exception.
The only difference I can think of that I have in this page from the other pages in which Navigator object does not causes any issues is that I build my page this way:

 Widget build(BuildContext context) {
  return DefaultTabController(
    length: 3,
    child: Scaffold(
      appBar: _buildAppBar(),
      drawer: _buildDrawer(),
      body: _buildBody(),
    ),
  );
}

I'm using here DefaultTabController contains a body of 3 page:

 Widget _buildBody() {
  return TabBarView(
    children: [
      MyCardScreen(),
      ReceivedScreen(),
      SentScreen(),
    ],
  );
}

The _handleMyBusinessesTap method is one of the options I have in the drawer which I want to take me to a new page, but for some reason once I add it it throws this exception in the title. Does someone encountered this problem and know how it should be handled?

here is the buildDrawer method:

 Widget _buildDrawer() {
return Drawer(
  child: ListView(
    padding: EdgeInsets.zero,
    children: <Widget>[
      UserAccountsDrawerHeader(
        accountName: _buildAccountNameWidget(),
        accountEmail: _buildAccountEmailWidget(),
        currentAccountPicture: _buildAccountCircleAvatar(),
      ),
      ListTile(title: Text("My Default Business Card"), onTap: _handleMyDefaultBusinessCardTap()),
      ListTile(title: Text("My Businesses"), onTap: _handleMyBusinessesTap()),
      ListTile(title: Text("Terms and Conditions"), onTap: _handleTermsAndConditionsTap()),
      ListTile(title: Text("Privacy Policy"), onTap: _handlePrivacyPolicyTap()),
      ListTile(title: Text("Log Out"), onTap: _handleLogOutTap()),
    ],
  ),
);
}

here is there rest of the stack:

I/flutter (  722): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (  722): The following assertion was thrown building PageMain(dirty, dependencies: [_InheritedTheme,
I/flutter (  722): _LocalizationsScope-[GlobalKey#b039d]], state: _PageMainWidgetState#e33af):
I/flutter (  722): setState() or markNeedsBuild() called during build.
I/flutter (  722): This Overlay widget cannot be marked as needing to build because the framework is already in the
I/flutter (  722): process of building widgets. A widget can be marked as needing to be built during the build phase
I/flutter (  722): only if one of its ancestors is currently building. This exception is allowed because the framework
I/flutter (  722): builds parent widgets before children, which means a dirty descendant will always be built.
I/flutter (  722): Otherwise, the framework might not visit this widget during this build phase.
I/flutter (  722): The widget on which setState() or markNeedsBuild() was called was:
I/flutter (  722):   Overlay-[LabeledGlobalKey<OverlayState>#51a6b](state: OverlayState#7d0ac(entries:
I/flutter (  722):   [OverlayEntry#f42cb(opaque: false; maintainState: false), OverlayEntry#d6b18(opaque: false;
I/flutter (  722):   maintainState: true), OverlayEntry#75d78(opaque: false; maintainState: false),
I/flutter (  722):   OverlayEntry#02406(opaque: false; maintainState: true), OverlayEntry#8f4e5(opaque: false;
I/flutter (  722):   maintainState: false), OverlayEntry#11c40(opaque: false; maintainState: true)]))
I/flutter (  722): The widget which was currently being built when the offending call was made was:
I/flutter (  722):   PageMain(dirty, dependencies: [_InheritedTheme, _LocalizationsScope-[GlobalKey#b039d]], state:
I/flutter (  722):   _PageMainWidgetState#e33af)
I/flutter (  722): When the exception was thrown, this was the stack:
I/flutter (  722): #0      Element.markNeedsBuild.<anonymous closure> (package:flutter/src/widgets/framework.dart:3503:11)
I/flutter (  722): #1      Element.markNeedsBuild (package:flutter/src/widgets/framework.dart:3529:6)
I/flutter (  722): #2      State.setState (package:flutter/src/widgets/framework.dart:1133:14)
I/flutter (  722): #3      OverlayState.insertAll (package:flutter/src/widgets/overlay.dart:346:5)
I/flutter (  722): #4      OverlayRoute.install (package:flutter/src/widgets/routes.dart:43:24)
I/flutter (  722): #5      TransitionRoute.install (package:flutter/src/widgets/routes.dart:180:11)
I/flutter (  722): #6      ModalRoute.install (package:flutter/src/widgets/routes.dart:895:11)
I/flutter (  722): #7      NavigatorState.push (package:flutter/src/widgets/navigator.dart:1742:11)
I/flutter (  722): #8      _PageMainWidgetState._handleMyBusinessesTap (package:bizooc_client/pages/page_main.dart:86:27)
I/flutter (  722): #9      _PageMainWidgetState._buildDrawer (package:bizooc_client/pages/page_main.dart:60:57)
I/flutter (  722): #10     _PageMainWidgetState.build (package:bizooc_client/pages/page_main.dart:33:17)
I/flutter (  722): #11     StatefulElement.build (package:flutter/src/widgets/framework.dart:3825:27)
I/flutter (  722): #12     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3739:15)
I/flutter (  722): #13     Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #14     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter (  722): #15     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3864:11)
I/flutter (  722): #16     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter (  722): #17     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #18     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #19     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
I/flutter (  722): #20     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #21     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #22     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #23     Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #24     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter (  722): #25     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter (  722): #26     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #27     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #28     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
I/flutter (  722): #29     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #30     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #31     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
I/flutter (  722): #32     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #33     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #34     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
I/flutter (  722): #35     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #36     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #37     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
I/flutter (  722): #38     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #39     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #40     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #41     Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #42     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter (  722): #43     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3864:11)
I/flutter (  722): #44     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter (  722): #45     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #46     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #47     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #48     Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #49     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter (  722): #50     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter (  722): #51     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #52     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #53     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #54     Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #55     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter (  722): #56     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3864:11)
I/flutter (  722): #57     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter (  722): #58     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #59     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #60     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
I/flutter (  722): #61     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #62     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #63     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #64     Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #65     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter (  722): #66     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter (  722): #67     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #68     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #69     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
I/flutter (  722): #70     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #71     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #72     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #73     Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #74     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter (  722): #75     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3864:11)
I/flutter (  722): #76     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter (  722): #77     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #78     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #79     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #80     Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #81     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter (  722): #82     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter (  722): #83     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #84     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #85     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
I/flutter (  722): #86     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #87     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #88     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #89     Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #90     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter (  722): #91     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter (  722): #92     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #93     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #94     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #95     Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #96     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter (  722): #97     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3864:11)
I/flutter (  722): #98     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter (  722): #99     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #100    Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #101    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #102    Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #103    ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter (  722): #104    StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3864:11)
I/flutter (  722): #105    ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter (  722): #106    Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter (  722): #107    Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter (  722): #108    RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:4659:32)
I/flutter (  722): #109    MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4992:17)
I/flutter (  722): #110    Element.updateChild (package:flutter/src/widgets/framework.dart:2753:15)
I/flutter (  722): #111    _TheatreElement.update (package:flutter/src/widgets/overlay.dart:607:16)
I/flutter (  722): #112    Element.updateChild (package:flutter/src/widgets/framework.dart:2753:15)
I/flutter (  722): #113    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #114    Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #115    StatefulElement.update (package:flutter/src/widgets/framework.dart:3894:5)
I/flutter (  722): #116    Element.updateChild (package:flutter/src/widgets/framework.dart:2753:15)
I/flutter (  722): #117    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #118    Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #119    ProxyElement.update (package:flutter/src/widgets/framework.dart:4006:5)
I/flutter (  722): #120    Element.updateChild (package:flutter/src/widgets/framework.dart:2753:15)
I/flutter (  722): #121    SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4883:14)
I/flutter (  722): #122    Element.updateChild (package:flutter/src/widgets/framework.dart:2753:15)
I/flutter (  722): #123    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #124    Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #125    StatefulElement.update (package:flutter/src/widgets/framework.dart:3894:5)
I/flutter (  722): #126    Element.updateChild (package:flutter/src/widgets/framework.dart:2753:15)
I/flutter (  722): #127    SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4883:14)
I/flutter (  722): #128    Element.updateChild (package:flutter/src/widgets/framework.dart:2753:15)
I/flutter (  722): #129    SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4883:14)
I/flutter (  722): #130    Element.updateChild (package:flutter/src/widgets/framework.dart:2753:15)
I/flutter (  722): #131    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter (  722): #132    Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (  722): #133    BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2278:33)
I/flutter (  722): #134    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:700:20)
I/flutter (  722): #135    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:286:5)
I/flutter (  722): #136    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1012:15)
I/flutter (  722): #137    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:952:9)
I/flutter (  722): #138    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:864:5)
I/flutter (  722): #142    _invoke (dart:ui/hooks.dart:219:10)
I/flutter (  722): #143    _drawFrame (dart:ui/hooks.dart:178:3)
I/flutter (  722): (elided 3 frames from package dart:async)
I/flutter (  722): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter (  722): Another exception was thrown: NoSuchMethodError: The getter 'status' was called on null.
I/flutter (  722): Another exception was thrown: NoSuchMethodError: The method 'drive' was called on null.

Body:
This is a common error when use callbacks functions.

   ListTile(title: Text("Log Out"), onTap: _handleLogOutTap()),

To fix your issue you have some options :

1-

 ListTile(title: Text("Log Out"), onTap: _handleLogOutTap),

2-

  ListTile(title: Text("Log Out"), onTap: () => _handleLogOutTap()),

3-

  ListTile(title: Text("Log Out"), onTap: () { _handleLogOutTap() ; }),

The same for all of your ListTile's.


问:
Select the most recent record with groupby in Laravel
I have two tables entries similar as follows:

```<code>gym_clients
+---------+---------+-----------------+
|      id | first_name|     last_name |
+---------+-----------+---------------+
|      1  |  Name 1   |        Last 1 |
|      2  |  Name 2   |        Last 2 |
+---------+-----------+---------------+

gym_client_purchases

+---------+---------+-----------------+
|      id | client_id | purchase_date |
+---------+-----------+---------------+
|      15 |       1   |    2018-04-01 |
|      16 |       1   |    2018-05-01 |
|      17 |       2   |    2018-05-01 |
+---------+-----------+---------------+

</code>```

I want to group by the purchases of each client and show the latest.

I tried this query but the groupby shows me the oldest purchase (id 15).

any ideas?

```<code> $this->data['latestSubscriptions'] = GymPurchase::select('first_name', 'last_name', 'gym_client_purchases.*')
              ->leftJoin('gym_clients', 'gym_clients.id', '=', 'client_id')
              ->groupBy('gym_client_purchases.client_id')
              ->orderBy('gym_client_purchases.purchase_date', 'desc')
              ->get();
</code>```

Thanks in advance.

答:
If you are explicitly calling the table names to specify their columns, isn't that supposed to be the same on the ON clause? on your code it's  like this

```<code>$this->data['latestSubscriptions'] = GymPurchase::select('first_name', 'last_name', 'gym_client_purchases.*')
      //client_id here isn't specified
      ->leftJoin('gym_clients', 'gym_clients.id', '=', 'client_id')
      ->groupBy('gym_client_purchases.client_id')
      ->orderBy('gym_client_purchases.purchase_date', 'desc')
      ->get();
</code>```

It should be like this:

```<code>$this->data['latestSubscriptions'] = GymPurchase::select('first_name', 'last_name', 'gym_client_purchases.*')
      ->leftJoin('gym_clients', 'gym_clients.id', '=', 'gym_client_purchases.client_id')
      ->groupBy('gym_client_purchases.client_id')
      ->orderBy('gym_client_purchases.purchase_date', 'desc')
      ->get();
</code>```

I tested your code, it should be working properly due to the orderby descending, I think just a little typo on your code snippets

Body:
I have two tables entries similar as follows:

gym_clients
+---------+---------+-----------------+
|      id | first_name|     last_name |
+---------+-----------+---------------+
|      1  |  Name 1   |        Last 1 |
|      2  |  Name 2   |        Last 2 |
+---------+-----------+---------------+

gym_client_purchases

+---------+---------+-----------------+
|      id | client_id | purchase_date |
+---------+-----------+---------------+
|      15 |       1   |    2018-04-01 |
|      16 |       1   |    2018-05-01 |
|      17 |       2   |    2018-05-01 |
+---------+-----------+---------------+

I want to group by the purchases of each client and show the latest.

I tried this query but the groupby shows me the oldest purchase (id 15).

any ideas?

 $this->data['latestSubscriptions'] = GymPurchase::select('first_name', 'last_name', 'gym_client_purchases.*')
              ->leftJoin('gym_clients', 'gym_clients.id', '=', 'client_id')
              ->groupBy('gym_client_purchases.client_id')
              ->orderBy('gym_client_purchases.purchase_date', 'desc')
              ->get();

Thanks in advance.

Body:
If you are explicitly calling the table names to specify their columns, isn't that supposed to be the same on the ON clause? on your code it's  like this

$this->data['latestSubscriptions'] = GymPurchase::select('first_name', 'last_name', 'gym_client_purchases.*')
      //client_id here isn't specified
      ->leftJoin('gym_clients', 'gym_clients.id', '=', 'client_id')
      ->groupBy('gym_client_purchases.client_id')
      ->orderBy('gym_client_purchases.purchase_date', 'desc')
      ->get();

It should be like this:

$this->data['latestSubscriptions'] = GymPurchase::select('first_name', 'last_name', 'gym_client_purchases.*')
      ->leftJoin('gym_clients', 'gym_clients.id', '=', 'gym_client_purchases.client_id')
      ->groupBy('gym_client_purchases.client_id')
      ->orderBy('gym_client_purchases.purchase_date', 'desc')
      ->get();

I tested your code, it should be working properly due to the orderby descending, I think just a little typo on your code snippets


问:
DOM Not Updating although function changes var
Even though the variable value changes to a value that would cause the element not to render, the page does not update and the element remains rendered.

Tried moving inside component, did not work.

```<code>function clickHandler(item)
    {
    object[item].active = 0;
    }

let object = [{data:
              <p onClick={() => clickHandler(0)}> Data </p>,
              active:1},
              {data:
              <p onClick={() => clickHandler(1)}> Data2 </p>,
              active:1}
             ];

class Objects extends React.Component {
    constructor(props) {
        super(props);
    }

render() {
   return (
    <div class="notifications">
    {object[0].active == 1 ? object[0].data : " "}
    {object[1].active == 1 ? object[1].data : " "}
    </div>
    );
  }
}

ReactDOM.render(<Objects />, document.querySelector('#object_display'));"
</code>```

Expects to disappear but it does not.

答:
Changing external data isn't going to trigger an update of your component. You need to either change the props passed to the component or keep track of it in state inside the component itself.

Consider this:

// data declared outside the component; gets passed as a prop
// in the ReactDOM.render call below.
const data = [
  {
    title: "Object 1"
  },
  {
    title: "Object 2"
  },
  {
    title: "Object 3"
  },
]

class Objects extends React.Component {
  // initial state; start with the first item
  state = {index: 0}

  // onClick handler
  switch = () => {
    // get the current index out of this.state
    const {index} = this.state;

    // get the number of items in data so
    // we can loop back to 0 when we get to
    // the last item
    const {data: {length}} = this.props;

    // increment the index, don't go beyond length
    const newIndex = (index + 1) % length;

    // calling setState triggers a re-render
    // with the new index value
    this.setState({index: newIndex});
  }

  render () {
    const {data} = this.props;
    const {index} = this.state;
    const item = data[index];

    return (

{item.title} (Click for next item)

    );
  }
}

// data passed as a prop
ReactDOM.render(<Objects data={data} />, document.getElementById('app'))```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>

<div id="app" /></code>```

Body:
Even though the variable value changes to a value that would cause the element not to render, the page does not update and the element remains rendered.

Tried moving inside component, did not work.

function clickHandler(item)
    {
    object[item].active = 0;
    }

let object = [{data:

 clickHandler(0)}> Data
,
              active:1},
              {data:

 clickHandler(1)}> Data2
,
              active:1}
             ];

class Objects extends React.Component {
    constructor(props) {
        super(props);
    }

render() {
   return (

    {object[0].active == 1 ? object[0].data : " "}
    {object[1].active == 1 ? object[1].data : " "}

    );
  }
}

ReactDOM.render(<Objects />, document.querySelector('#object_display'));"

Expects to disappear but it does not.

Body:
Changing external data isn't going to trigger an update of your component. You need to either change the props passed to the component or keep track of it in state inside the component itself.

Consider this:

// data declared outside the component; gets passed as a prop
// in the ReactDOM.render call below.
const data = [
  {
    title: "Object 1"
  },
  {
    title: "Object 2"
  },
  {
    title: "Object 3"
  },
]

class Objects extends React.Component {
  // initial state; start with the first item
  state = {index: 0}

  // onClick handler
  switch = () => {
    // get the current index out of this.state
    const {index} = this.state;

    // get the number of items in data so
    // we can loop back to 0 when we get to
    // the last item
    const {data: {length}} = this.props;

    // increment the index, don't go beyond length
    const newIndex = (index + 1) % length;

    // calling setState triggers a re-render
    // with the new index value
    this.setState({index: newIndex});
  }

  render () {
    const {data} = this.props;
    const {index} = this.state;
    const item = data[index];

    return (
      <div onClick={this.switch}>{item.title} (Click for next item)</div>
    );
  }
}

// data passed as a prop
ReactDOM.render(<Objects data={data} />, document.getElementById('app'))

<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>

<div id="app" />


问:
Why can't `blake2_256` prevent the "first key pair" in a StorageDoubleMap from being compromised when using decl_storage?
decl_storage! is a "procedural macro" used for storing data to make it available in subsequent blocks.

It says if the user is able to set the first key pair in the double_map, then we cannot trust that key pair, and so we must use a cryptographic hasher such as blake2_256 to prevent "other values of all storage items being compromised".

Then it goes on to say that if the user is able to set the second key pair in the double_map, then we cannot trust that key pair, and so we must use a cryptographic hasher such as blake2_256 to prevent "other items in storage with the same first key being compromised".

With regard to the first key pair, why does it say that it's just to prevent "other values of all storage items being compromised"? Isn't blake2_256 also used to prevent the first key pair itself from being compromised (rather than just "other values")?

答:
Let's say the hash of module1.someValue is 0x12345678

hash of module2.doubleMapValue.firstKey(value1) is 0x1234

hash of module2.doubleMapValue.secondKey(value2) is 0x5678

This means module2.doubleMapValue.fullKey(value1, value2) and module1.someValue have same hash. i.e. the values are stored in the same place.

If a user is able to control both keys of module2.doubleMapValue and figure out the value of value1 and value2, then they will be able to override the value of module1.someValue and cause security issues.

That's why the hash function of key1 of double map needs to be a cryptographic hasher if the value is controlled by a user. Otherwise a user may be able to craft value1 such it collides with the storage of all other modules, and hence compromise them.

In case a user does not control key2, double map provides a clear all keys with hash(key1) prefix feature that could be hijacked to cause troubles as well.


问:
How to get lines from the last match to the end of file?
Need to print lines after the last match to the end of file. The number of matches could be anything and not definite. I have some text as shown below.

```<code>MARKER
aaa
bbb
ccc
MARKER
ddd
eee
fff
MARKER
ggg
hhh
iii
MARKER
jjj
kkk
lll
</code>```

Output desired is

```<code>jjj
kkk
lll
</code>```

Do I use awk with RS and FS to get the desired output?

答:
Could you please try following.

```<code>tac file | awk '/MARKER/{print val;exit} {val=(val?val ORS:"")$0}' | tac
</code>```

Benefit of this approach will be awk will just read last block of the Input_file(which will be actually first block for awk after tac prints it reverse)and exit after that.

Explanation:

```<code>tac file |                      ##Printing Input_file in reverse order.
awk '
  /MARKER/{                     ##Searching for a string MARKER in a line of Input_file.
    print val                   ##Printing variable val here. Because we need last occurrence of string MARKER,which has become first instance after reversing the Input_file.
    exit                        ##Using exit to exit from awk program itself.
  }
  {
    val=(val?val ORS:"")$0      ##Creating variable named val whose value will be keep appending to its own value with a new line to get values before string MARKER as per OP question.
  }
' |                             ##Sending output of awk command to tac again to make it in its actual form, since tac prints it in reverse order.
tac                             ##Using tac to make it in correct order(lines were reversed because of previous tac).
</code>```

Body:
Need to print lines after the last match to the end of file. The number of matches could be anything and not definite. I have some text as shown below.

MARKER
aaa
bbb
ccc
MARKER
ddd
eee
fff
MARKER
ggg
hhh
iii
MARKER
jjj
kkk
lll

Output desired is

jjj
kkk
lll

Do I use awk with RS and FS to get the desired output?

Body:
Could you please try following.

tac file | awk '/MARKER/{print val;exit} {val=(val?val ORS:"")$0}' | tac

Benefit of this approach will be awk will just read last block of the Input_file(which will be actually first block for awk after tac prints it reverse)and exit after that.

Explanation:

tac file |                      ##Printing Input_file in reverse order.
awk '
  /MARKER/{                     ##Searching for a string MARKER in a line of Input_file.
    print val                   ##Printing variable val here. Because we need last occurrence of string MARKER,which has become first instance after reversing the Input_file.
    exit                        ##Using exit to exit from awk program itself.
  }
  {
    val=(val?val ORS:"")$0      ##Creating variable named val whose value will be keep appending to its own value with a new line to get values before string MARKER as per OP question.
  }
' |                             ##Sending output of awk command to tac again to make it in its actual form, since tac prints it in reverse order.
tac                             ##Using tac to make it in correct order(lines were reversed because of previous tac).


问:
Is that possible that using stack pointer to locate/index local variables on stack with llvm?
I'm trying to modify llvm X86 backend to use rsp to locate/index local variables rather than rbp. The problem is that the offset between local variables and rsp is not fixed, so I have to calculate it by myself.
It's easy to handle it if rsp's location was modified by these instructions as follows:

```<code>push
pop
sub rsp, $immediate
</code>```

In these situations, I can know the offset at compile-time.
But nowadays I get stuck in a problem. I find that rsp is not only modified by these instructions mentioned before. For example:

```<code>lstr = (char *)alloca(strlen(ss) + 1);
</code>```

This instruction will modify rsp like this and I can't know the offset at compile-time.

```<code>sub rsp, $register
</code>```

Is it possible or not to use llvm to generate execute file which using stack pointer to locate local variables?

答: Short answer: no. There are many cases when stack pointer value may change in "non-constant way". Examples include VLAs (either direct or via alloca() calls), variadic functions, etc. Also note that in some cases the stack could be realigned dynamically as well.</p>

Body:
I'm trying to modify llvm X86 backend to use rsp to locate/index local variables rather than rbp. The problem is that the offset between local variables and rsp is not fixed, so I have to calculate it by myself.
It's easy to handle it if rsp's location was modified by these instructions as follows:

push
pop
sub rsp, $immediate

In these situations, I can know the offset at compile-time.
But nowadays I get stuck in a problem. I find that rsp is not only modified by these instructions mentioned before. For example:

lstr = (char *)alloca(strlen(ss) + 1);

This instruction will modify rsp like this and I can't know the offset at compile-time.

sub rsp, $register

Is it possible or not to use llvm to generate execute file which using stack pointer to locate local variables?


问:
How to get token details like access token,access token expiry time and refresh token etc. on OnAuthorization() method
I want to eject a logic that if access token is expired then generate refresh token on onAuthorization(AuthorizationFilterContext context) method in ASP.NET WEB API Core.

But i am not able to find a way to get token details.Basically how to get token details like expiry , refresh token from AuthorizationFilterContext.

```<code>public void OnAuthorization(AuthorizationFilterContext context)
{
    var user = context.HttpContext.User;
    if (!user.Identity.IsAuthenticated)
    {
        var test = context.;
        ..code to get refresh token...
    }
}
</code>```

答:
For token authentication, you could retrive the token from header and then decode the token.   </p>

<p>Try code below:   </p>

```<code>public void OnAuthorization(AuthorizationFilterContext context)
{
    //var token = context.HttpContext.GetTokenAsync("access_token").GetAwaiter().GetResult();
    var token = context.HttpContext.Request.Headers["Authorization"].FirstOrDefault().Split(" ")[1];
    var handler = new JwtSecurityTokenHandler();
    var jsonToken = handler.ReadToken(token);
    var tokenS = handler.ReadToken(token) as JwtSecurityToken;
}
</code>```

Body:
I want to eject a logic that if access token is expired then generate refresh token on onAuthorization(AuthorizationFilterContext context) method in ASP.NET WEB API Core.

But i am not able to find a way to get token details.Basically how to get token details like expiry , refresh token from AuthorizationFilterContext.

public void OnAuthorization(AuthorizationFilterContext context)
{
    var user = context.HttpContext.User;
    if (!user.Identity.IsAuthenticated)
    {
        var test = context.;
        ..code to get refresh token...
    }
}

Body:
For token authentication, you could retrive the token from header and then decode the token.

Try code below:

public void OnAuthorization(AuthorizationFilterContext context)
{
    //var token = context.HttpContext.GetTokenAsync("access_token").GetAwaiter().GetResult();
    var token = context.HttpContext.Request.Headers["Authorization"].FirstOrDefault().Split(" ")[1];
    var handler = new JwtSecurityTokenHandler();
    var jsonToken = handler.ReadToken(token);
    var tokenS = handler.ReadToken(token) as JwtSecurityToken;
}