问:
Adding missing rows to a data frame, filling in data from last known data point
I have a data frame that has missing rows. You can identify the missing rows by looking at the gaps in the sequence.

```<code>Count<-c(1,1,1,1,2,2,2,3,3,4,4,4,4,5,5,6,6,6)
Seq<-c(1,2,3,4,1,2,4,1,4,1,2,3,5,1,3,1,2,3)
MyData<-c(5,4,5,3,4,3,2,1,2,1,3,2,4,2,3,1,4,3)
DF1<-data.frame(Count,Seq,MyData)
DF1
</code>```

The count keeps track of the sequence number, and the sequences will always run as a numeric sequence. In this case it is 1:5, but this can vary so I don't want to hard code this limitation.

My goal is to create two new data frame that contains all of the missing sequence rows. The first would have NA in the data column for the added "missing' rows.

```<code>Count2<-c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5,6,6,6,6,6)
Seq2<-c(1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5)
MyData2<-c(5,4,5,3,NA,4,3,NA,2,NA,1,NA,NA,2,NA,1,3,2,NA,4,2,NA,3,NA,NA,1,4,3,NA,NA)
DF2<-data.frame(Count2,Seq2,MyData2)
DF2
</code>```

The second data frame would be similar, but would contain the last known data point for that Sequence number.

```<code>Count2<-c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5,6,6,6,6,6)
Seq2<-c(1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5)
MyData3<-c(5,4,5,3,NA,4,3,5,2,NA,1,3,5,2,NA,1,3,2,2,4,2,3,3,2,4,1,4,3,2,4)
DF3<-data.frame(Count2,Seq2,MyData3)
DF3
</code>```

Note- the NA remains for the 5th element in the sequence for this first 3 counts as there was no initial value.

答:
A solution using dplyr and tidyr.

```<code>library(dplyr)
library(tidyr)

DF2 <- DF1 %>%
  complete(Count, Seq = full_seq(Seq, period = 1)) %>%
  arrange(Count, Seq)

DF3 <- DF2 %>%
  arrange(Seq, Count) %>%
  group_by(Seq) %>%
  fill(MyData) %>%
  arrange(Count) %>%
  ungroup()

DF2
# # A tibble: 30 x 3
#    Count   Seq MyData
#    <dbl> <dbl>  <dbl>
#  1     1     1      5
#  2     1     2      4
#  3     1     3      5
#  4     1     4      3
#  5     1     5     NA
#  6     2     1      4
#  7     2     2      3
#  8     2     3     NA
#  9     2     4      2
# 10     2     5     NA
# # ... with 20 more rows

DF3
# # A tibble: 30 x 3
#    Count   Seq MyData
#    <dbl> <dbl>  <dbl>
#  1     1     1      5
#  2     1     2      4
#  3     1     3      5
#  4     1     4      3
#  5     1     5     NA
#  6     2     1      4
#  7     2     2      3
#  8     2     3      5
#  9     2     4      2
# 10     2     5     NA
# # ... with 20 more rows
</code>```

Body:
I have a data frame that has missing rows. You can identify the missing rows by looking at the gaps in the sequence.

Count<-c(1,1,1,1,2,2,2,3,3,4,4,4,4,5,5,6,6,6)
Seq<-c(1,2,3,4,1,2,4,1,4,1,2,3,5,1,3,1,2,3)
MyData<-c(5,4,5,3,4,3,2,1,2,1,3,2,4,2,3,1,4,3)
DF1<-data.frame(Count,Seq,MyData)
DF1

The count keeps track of the sequence number, and the sequences will always run as a numeric sequence. In this case it is 1:5, but this can vary so I don't want to hard code this limitation.

My goal is to create two new data frame that contains all of the missing sequence rows. The first would have NA in the data column for the added "missing' rows.

Count2<-c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5,6,6,6,6,6)
Seq2<-c(1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5)
MyData2<-c(5,4,5,3,NA,4,3,NA,2,NA,1,NA,NA,2,NA,1,3,2,NA,4,2,NA,3,NA,NA,1,4,3,NA,NA)
DF2<-data.frame(Count2,Seq2,MyData2)
DF2

The second data frame would be similar, but would contain the last known data point for that Sequence number.

Count2<-c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5,6,6,6,6,6)
Seq2<-c(1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5)
MyData3<-c(5,4,5,3,NA,4,3,5,2,NA,1,3,5,2,NA,1,3,2,2,4,2,3,3,2,4,1,4,3,2,4)
DF3<-data.frame(Count2,Seq2,MyData3)
DF3

Note- the NA remains for the 5th element in the sequence for this first 3 counts as there was no initial value.

Body:
A solution using dplyr and tidyr.

library(dplyr)
library(tidyr)

DF2 <- DF1 %>%
  complete(Count, Seq = full_seq(Seq, period = 1)) %>%
  arrange(Count, Seq)

DF3 <- DF2 %>%
  arrange(Seq, Count) %>%
  group_by(Seq) %>%
  fill(MyData) %>%
  arrange(Count) %>%
  ungroup()

DF2
# # A tibble: 30 x 3
#    Count   Seq MyData
#    <dbl> <dbl>  <dbl>
#  1     1     1      5
#  2     1     2      4
#  3     1     3      5
#  4     1     4      3
#  5     1     5     NA
#  6     2     1      4
#  7     2     2      3
#  8     2     3     NA
#  9     2     4      2
# 10     2     5     NA
# # ... with 20 more rows

DF3
# # A tibble: 30 x 3
#    Count   Seq MyData
#    <dbl> <dbl>  <dbl>
#  1     1     1      5
#  2     1     2      4
#  3     1     3      5
#  4     1     4      3
#  5     1     5     NA
#  6     2     1      4
#  7     2     2      3
#  8     2     3      5
#  9     2     4      2
# 10     2     5     NA
# # ... with 20 more rows


来源: stackexchange

问:
Text Wrapping Issue in CSS Grid
I am having an issue where a ghost line is being added to some text in a CSS grid when it has a certain number of characters.  This is my first time using CSS grids, and I suspect that it's related to the grid.  I see the issue (using Mac OS X) in Chrome and Safari, but not in Firefox.

.grid {
  display: grid;
  border: 1px solid black;
}

.grid > .row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
}

.col-10 {
  grid-column-end: span 10;
}

.blue {
  background-color: blue;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="grid">
  <div class="row">
    <div class="blue col-10">
      You must create an account first! See site admin for help.
    </div>
  </div>
</div>
<div class="grid">
  <div class="row">
    <div class="blue col-10">
      You must create an account first! See site admin for help..
    </div>
  </div>
</div></code>```

Basically, a ghost line is being added to You must create an account first! See site admin for help, causing the
 to be as tall as it would be if it had two lines instead of one.  The text is nowhere near the end of the line, and resizing the window makes no difference (until it's narrow enough to actually cause a line break).  If I add two additional characters to the phrase, the ghost line disappears.  If I continue adding characters, the ghost line will reappear at certain points, and then disappear again with the next character.  Once I add enough text to break into two lines, the issue no longer seems to occur, so it only seems to happen to single-line text.

Even though the text is nowhere near the end of the line, it seems to be a line-wrapping issue, and indeed it disappears when I add white-space: nowrap;.

Any idea what's causing this?  Is it a bug in Chrome and Safari, or is there something wrong with my HTML and CSS?

EDIT

Thanks to a suggested edit, a code snippet has been added to illustrate the problem.  I was able to eliminate the outer grid while maintaining the problem, so I updated the code to remove it.  What you see now are two div which are identical except that one has an additional period at the end.  In my browser (Chrome), I the second div is shorter even though it has an additional character.

EDIT 2

When I play with the code snippet in Safari, I'm actually getting a different version of the problem.  As I said, in Chrome, it seems to be based on the total number of characters.  I can add a character and the ghost line goes away, then I delete the character and the line reappears. But with Safari, I am seeing that actually the ghost line appears any time there is more than one space character in the text, no matter how short or long the text is.

Once again, Firefox is having no problem at all.  It is displaying the text exactly as I expect it to.

答:
The whitespace does get interpreted to the degree that it will create a space before and after the line; therefore, use CSS white-space: nowrap;

```<code><div class="full-screen grid">
  <div class="row">
    <div class="align-center padded full-width text-center grid">
      <div class="row">
        <div class="col-10 col-offset-1" style="white-space: nowrap;">
          You must create an account first! See site admin for help.
        </div>
      </div>
    </div>
  </div>
</div>
</code>```

You could also remove the whitespace between > and < :

```<code><div class="full-screen grid">
  <div class="row">
    <div class="align-center padded full-width text-center grid">
      <div class="row">
        <div class="col-10 col-offset-1">You must create an account first! See site admin for help.</div>
      </div>
    </div>
  </div>
</div>
</code>```

Furthermore to ensure no line-breaks, replace space characters with   :

```<code><div class="full-screen grid">
  <div class="row">
    <div class="align-center padded full-width text-center grid">
      <div class="row">
        <div class="col-10 col-offset-1">You must create an account first! See site admin for help.</div>
      </div>
    </div>
  </div>
</div>
</code>```

ContentLicense: CC BY-SA 3.0

Title: Text Wrapping Issue in CSS Grid

Body:
I am having an issue where a ghost line is being added to some text in a CSS grid when it has a certain number of characters.  This is my first time using CSS grids, and I suspect that it's related to the grid.  I see the issue (using Mac OS X) in Chrome and Safari, but not in Firefox.

.grid {
  display: grid;
  border: 1px solid black;
}

.grid > .row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
}

.col-10 {
  grid-column-end: span 10;
}

.blue {
  background-color: blue;
}

      You must create an account first! See site admin for help.

      You must create an account first! See site admin for help..

Basically, a ghost line is being added to You must create an account first! See site admin for help, causing the
 to be as tall as it would be if it had two lines instead of one.  The text is nowhere near the end of the line, and resizing the window makes no difference (until it's narrow enough to actually cause a line break).  If I add two additional characters to the phrase, the ghost line disappears.  If I continue adding characters, the ghost line will reappear at certain points, and then disappear again with the next character.  Once I add enough text to break into two lines, the issue no longer seems to occur, so it only seems to happen to single-line text.

Even though the text is nowhere near the end of the line, it seems to be a line-wrapping issue, and indeed it disappears when I add white-space: nowrap;.

Any idea what's causing this?  Is it a bug in Chrome and Safari, or is there something wrong with my HTML and CSS?

EDIT

Thanks to a suggested edit, a code snippet has been added to illustrate the problem.  I was able to eliminate the outer grid while maintaining the problem, so I updated the code to remove it.  What you see now are two div which are identical except that one has an additional period at the end.  In my browser (Chrome), I the second div is shorter even though it has an additional character.

EDIT 2

When I play with the code snippet in Safari, I'm actually getting a different version of the problem.  As I said, in Chrome, it seems to be based on the total number of characters.  I can add a character and the ghost line goes away, then I delete the character and the line reappears. But with Safari, I am seeing that actually the ghost line appears any time there is more than one space character in the text, no matter how short or long the text is.

Once again, Firefox is having no problem at all.  It is displaying the text exactly as I expect it to.

Body:
The whitespace does get interpreted to the degree that it will create a space before and after the line; therefore, use CSS white-space: nowrap;

<div class="full-screen grid">
  <div class="row">
    <div class="align-center padded full-width text-center grid">
      <div class="row">
        <div class="col-10 col-offset-1" style="white-space: nowrap;">
          You must create an account first! See site admin for help.
        </div>
      </div>
    </div>
  </div>
</div>

You could also remove the whitespace between > and < :

<div class="full-screen grid">
  <div class="row">
    <div class="align-center padded full-width text-center grid">
      <div class="row">
        <div class="col-10 col-offset-1">You must create an account first! See site admin for help.</div>
      </div>
    </div>
  </div>
</div>

Furthermore to ensure no line-breaks, replace space characters with &nbsp; :

<div class="full-screen grid">
  <div class="row">
    <div class="align-center padded full-width text-center grid">
      <div class="row">
        <div class="col-10 col-offset-1">You&nbsp;must&nbsp;create&nbsp;an&nbsp;account&nbsp;first!&nbsp;See&nbsp;site&nbsp;admin&nbsp;for&nbsp;help.</div>
      </div>
    </div>
  </div>
</div>


问:
(JAVA) Code has no errors, yet output ignores variables
I'm trying to get a running Vending Machine GUI to work, I have it all set up, all the buttons are clickable, yet the output doesn't show me what buttons I clicked (What I want to get) or how much it costs, or what card I've used to pay. It seems like it is ignoring variables.

My Entire code is here:

```import java.awt.*;
import java.awt.event.*;
import java.util.EventObject;
import javax.swing.*;

public class FinalProject extends JFrame implements ActionListener {
 private static final long serialVersionUID = 1 L;
 JLabel l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, foodkiosk,
 healthkiosk, sundrieskiosk, shelf1, shelf2, shelf3, shelf4, shelf5, shelf6,
 shelf7, shelf8, shelf9;
 JButton b1, b2, b3, b4, b5;
 JButton potatoes, popcorn, crackers, chipmix, peanuts, chocolate, nutmix,
 healthbar, raisins, cookies, figbar, pretzels;
 JButton aspirin, acetom, vitC, vitB, bandaids, antibiotics, antiitch, gauze,
 toothpaste, toothbrush, dentfloss, adhesive;
 JButton sewingkit, nailkit, facetissue, tolietpaper, handcream,
 bodylotion, deodorant, antiperspirant, schoolshirt, sweatpants, pencilkit,
 handwipes;
 double[] price1 = {
  1.50,
  1.00,
  1.00,
  1.25,
  1.00,
  1.25,
  1.00,
  2.00,
  1.00,
  1.00,
  1.50,
  1.25
 };
 double[] price2 = {
  2.00,
  2.00,
  2.00,
  2.00,
  1.00,
  2.00,
  2.00,
  1.00,
  1.00,
  1.00,
  1.00,
  1.00
 };
 double[] price3 = {
  1.00,
  2.00,
  1.00,
  1.00,
  1.00,
  1.00,
  1.00,
  1.50,
  3.00,
  4.00,
  2.00,
  1.00
 };
 String item = "";
 JTextField t1, t2, t3;
 int potatoes1 = 0;
 int popcorn1 = 0;
 int crackers1 = 0;
 int chipmix1 = 0;
 int peanuts1 = 0;
 int chocolate1 = 0;
 int nutmix1 = 0;
 int healthbar1 = 0;
 int raisins1 = 0;
 int cookies1 = 0;
 int figbar1 = 0;
 int pretzels1 = 0;
 int aspirin1 = 0;
 int acetom1 = 0;
 int vitC1 = 0;
 int vitB1 = 0;
 int bandaids1 = 0;
 int antibiotics1 = 0;
 int antiitch1 = 0;
 int gauze1 = 0;
 int toothpaste1 = 0;
 int toothbrush1 = 0;
 int dentfloss1 = 0;
 int adhesive1 = 0;
 int sewingkit1 = 0;
 int nailkit1 = 0;
 int facetissue1 = 0;
 int tolietpaper1 = 0;
 int handcream1 = 0;
 int bodylotion1 = 0;
 int deodorant1 = 0;
 int antiperspirant1 = 0;
 int schoolshirt1 = 0;
 int sweatpants1 = 0;
 int pencilkit1 = 0;
 int handwipes1 = 0;
 private JRadioButton EDUcard, visa, discover;
 private ButtonGroup group;
 String[] food = {
  "Potato Chips",
  "Popcorn",
  "Crackers",
  "Chip
  Mix ","
  Peanuts ", "
  Chocolate bar ","
  Mixed nuts ", "
  Health bar ", "
  Raisins ",
  "Cookies",
  "Fig bars",
  "Pretzels"
 };
 String[] health = {
   "Aspirin",
   "Acetominophen",
   "Vitamin C",
   "Vitamin B
   Complex ", "
   Bandaids ", "
   Antibiotic Ointment ", "
   Anit - Itch Ointment ", "
   Gauze
   Pad ", "
   Toothpaste ", "
   Toothbrush ", "
   Dental Floss ", "
   Adhesive Tape "};
   String[] sundries = {
    "Sewing Kit",
    "Nail Kit",
    "Facial Tissues",
    "Toliet
    Tissue ","
    Hand Cream ","
    Body Lotion ","
    Deodorant ","
    Anti - Perspirant ","
    School Tee
    Shirt ","
    Sweat Pants ","
    Pencil Pen Stationary Kit ","
    Handy Wipes ",};

    FinalProject() {
     l1 = new JLabel(" Customer Name");
     l2 = new JLabel("  ");
     l3 = new JLabel(" amount to pay");
     l4 = new JLabel("  ");
     l5 = new JLabel("  ");
     l6 = new JLabel("  ");
     l7 = new JLabel("  ");
     l8 = new JLabel("  ");
     l9 = new JLabel("  ");
     l10 = new JLabel("  ");
     l11 = new JLabel("  ");
     l12 = new JLabel("  ");
     l13 = new JLabel("  ");
     l14 = new JLabel("  ");
     foodkiosk = new JLabel("Food Kiosk");
     healthkiosk = new JLabel("Health Kiosk");
     sundrieskiosk = new JLabel("Sundries Kiosk");

     shelf1 = new JLabel("Shelf 1");
     shelf2 = new JLabel("Shelf 2");
     shelf3 = new JLabel("Shelf 3");
     shelf4 = new JLabel("Shelf 4");
     shelf5 = new JLabel("Shelf 5");
     shelf6 = new JLabel("Shelf 6");
     shelf7 = new JLabel("Shelf 7");
     shelf8 = new JLabel("Shelf 8");
     shelf9 = new JLabel("Shelf 9");
     b1 = new JButton("COMPUTE");
     b2 = new JButton("EXIT");
     potatoes = new JButton("Potato Chips");
     popcorn = new JButton("Popcorn");
     crackers = new JButton("Crackers");
     chipmix = new JButton("Chip Mix");
     peanuts = new JButton("Peanuts");
     chocolate = new JButton("Chocolate");
     nutmix = new JButton("Mixed nuts");
     healthbar = new JButton("Health Bar");
     raisins = new JButton("Raisins");
     cookies = new JButton("Cookies");
     figbar = new JButton("Fig Bars");
     pretzels = new JButton("Pretzals");
     aspirin = new JButton("Aspirin");
     acetom = new JButton("Acetominophen");
     vitC = new JButton("Vitamin C");
     vitB = new JButton("Vitamin B Complex");
     bandaids = new JButton("Bandaids");
     antibiotics = new JButton("Antibiotic Ointment");
     antiitch = new JButton("Anit-Itch Ointment");
     gauze = new JButton("Gauze Pads");
     toothpaste = new JButton("Toothpaste");
     toothbrush = new JButton("Toothbrush");
     dentfloss = new JButton("Dental Floss");
     adhesive = new JButton("Adhesive Tape");
     sewingkit = new JButton("Sewing Kit");
     nailkit = new JButton("Nail Kit");
     facetissue = new JButton("Facial Tissues");
     tolietpaper = new JButton("Toliet Tissue");
     handcream = new JButton("Hand Cream");
     bodylotion = new JButton("Body Lotion");
     deodorant = new JButton("Deodorant");
     antiperspirant = new JButton("Anti-Perspirant");
     schoolshirt = new JButton("School Tee-Shirt");
     sweatpants = new JButton("Sweatpants");
     pencilkit = new JButton("Pencil Pen Stationary Kit");
     handwipes = new JButton("Handy Wipes");

     t1 = new JTextField(10);
     t2 = new JTextField(10);

     EDUcard = new JRadioButton("EDUcard", true);
     visa = new JRadioButton("visa", false);
     discover = new JRadioButton("discover", false);
     group = new ButtonGroup();
     group.add(EDUcard);
     group.add(visa);
     group.add(discover);

     add(l1);
     add(t1);
     add(foodkiosk);
     add(shelf1);
     add(potatoes);
     add(popcorn);
     add(crackers);
     add(chipmix);
     add(l4);
     add(shelf2);
     add(peanuts);
     add(chocolate);
     add(nutmix);
     add(healthbar);
     add(l5);
     add(shelf3);
     add(raisins);
     add(cookies);
     add(figbar);
     add(pretzels);
     add(l8);
     add(healthkiosk);
     add(shelf4);
     add(aspirin);
     add(acetom);
     add(vitC);
     add(vitB);
     add(l9);
     add(shelf5);
     add(bandaids);
     add(antibiotics);
     add(antiitch);
     add(gauze);
     add(l10);
     add(shelf6);
     add(toothpaste);
     add(toothbrush);
     add(dentfloss);
     add(adhesive);
     add(l11);
     add(sundrieskiosk);
     add(shelf7);
     add(sewingkit);
     add(nailkit);
     add(facetissue);
     add(tolietpaper);
     add(l12);
     add(shelf8);
     add(handcream);
     add(bodylotion);
     add(deodorant);
     add(antiperspirant);
     add(l13);
     add(shelf9);
     add(schoolshirt);
     add(sweatpants);
     add(pencilkit);
     add(handwipes);
     add(l7);
     add(EDUcard);
     add(discover);
     add(visa);
     add(l2);
     add(l6);
     add(b1);
     add(b2);
     b1.addActionListener(this);
     b2.addActionListener(e -> System.exit(0));
     potatoes.addActionListener(this);
     popcorn.addActionListener(this);
     crackers.addActionListener(this);
     chipmix.addActionListener(this);
     peanuts.addActionListener(this);
     chocolate.addActionListener(this);
     nutmix.addActionListener(this);
     healthbar.addActionListener(this);
     raisins.addActionListener(this);
     cookies.addActionListener(this);
     figbar.addActionListener(this);
     pretzels.addActionListener(this);
     aspirin.addActionListener(this);
     acetom.addActionListener(this);
     vitC.addActionListener(this);
     vitB.addActionListener(this);
     bandaids.addActionListener(this);
     antibiotics.addActionListener(this);
     antiitch.addActionListener(this);
     gauze.addActionListener(this);
     toothpaste.addActionListener(this);
     toothbrush.addActionListener(this);
     dentfloss.addActionListener(this);
     adhesive.addActionListener(this);
     sewingkit.addActionListener(this);
     nailkit.addActionListener(this);
     facetissue.addActionListener(this);
     tolietpaper.addActionListener(this);
     handcream.addActionListener(this);
     bodylotion.addActionListener(this);
     deodorant.addActionListener(this);
     antiperspirant.addActionListener(this);
     schoolshirt.addActionListener(this);
     sweatpants.addActionListener(this);
     pencilkit.addActionListener(this);
     handwipes.addActionListener(this);
     setSize(800, 800);
     setLayout(new GridLayout(10, 5));
     setTitle("Vending Machine");

     double total = 0.0;
     String card = "discover";
     if (chocolate1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (popcorn1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (peanuts1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (crackers1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (raisins1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (healthbar1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (chipmix1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (potatoes1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (cookies1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (nutmix1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (figbar1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (pretzels1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (adhesive1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (dentfloss1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (sweatpants1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (pencilkit1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (schoolshirt1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (antibiotics1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (antiitch1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (gauze1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (toothbrush1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (vitC1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (toothpaste1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (vitB1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (aspirin1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (acetom1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (bandaids1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (sewingkit1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (nailkit1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (facetissue1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (tolietpaper1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (handcream1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (bodylotion1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (deodorant1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (antiperspirant1 < 5) {
      System.out.println("You need to restock back up to 10");
     }

     if (EDUcard.isSelected() == true) {
      card += " EDUcard will be used to pay";
     }
     if (visa.isSelected() == true) {
      card += " Visa will be used to pay";
     }
     if (discover.isSelected() == true) {
      card += " discover will be used to pay";
     }
     if (popcorn.isSelected() == true) {
      System.out.println("Popcorn");
      total += total + price1[1];
      item = "Popcorn";

     }
     if (potatoes.isSelected() == true) {
      System.out.println("Potato chips");
      total = total + price1[0];
      item = "Potato chips";
     }
     if (crackers.isSelected() == true) {
      total = total + price1[2];
      System.out.println("Crackers");

      item = "Crackers";
     }
     if (chipmix.isSelected() == true) {
      System.out.println("Chip Mix");
      total = total + price1[3];
      item = "Chip Mix";
     }
     if (peanuts.isSelected() == true) {
      System.out.println("Peanuts");
      total = total + price1[4];
      item = "Peanuts";
     }
     if (chocolate.isSelected() == true) {
      System.out.println("Chocolate Bar");
      total = total + price1[5];
      item = "Chocolate Bar";
     }
     if (nutmix.isSelected() == true) {
      System.out.println("Mixed Nuts");
      total = total + price1[6];
      item = "Mixed Nuts";
     }
     if (healthbar.isSelected() == true) {
      System.out.println("Health Bar");
      total = total + price1[7];
      item = "Health Bar";
     }
     if (raisins.isSelected() == true) {
      System.out.println("Raisins");
      total = total + price1[8];
      item
       = "Raisins";
     }
     if (cookies.isSelected() == true) {
      System.out.println("Cookies");
      total = total + price1[9];
      item = "Cookies";
     }
     if (figbar.isSelected() == true) {
      System.out.println("Fig Bars");
      total = total + price1[10];
      item = "Fig Bars";
     }
     if (pretzels.isSelected() == true) {
      System.out.println("Pretzels");
      total = total + price1[11];
      item = "Pretzels";
     }
     if (aspirin.isSelected() == true) {
      System.out.println("Aspirin");
      total = total + price2[0];
      item = "Aspirin";
     }
     if (acetom.isSelected() == true) {
      System.out.println("Acetominophen");
      total = total + price2[1];
      item = "Acetominophen";
     }
     if (vitC.isSelected() == true) {
      System.out.println("Vitamin C");
      total = total + price2[2];
      item = "Vitamin C";
     }
     if (vitB.isSelected() == true) {
      System.out.println("Vitamin B Complex");
      total = total + price2[3];
      item = "Vitamin B Complex";
     }
     if (bandaids.isSelected() == true) {
      System.out.println("Bandaids");
      total = total + price2[4];
      item = "Bandaids";
     }
     if (antibiotics.isSelected() == true) {
      System.out.println("Antibiotic Ointment");
      total = total + price2[5];
      item = "Antibiotic Ointment";
     }
     if (antiitch.isSelected() == true) {
      System.out.println("Anti-Itch Ointment");
      total = total + price2[6];
      item = "Anti-Itch Ointment";
     }
     if (gauze.isSelected() == true) {
      System.out.println("Gauze Pads");
      total = total + price2[7];
      item = "Gauze Pads";
     }
     if (toothpaste.isSelected() == true) {
      System.out.println("Toothpaste");
      total = total + price2[8];
      item = "Toothpaste";
     }
     if (toothbrush.isSelected() == true) {
      System.out.println("Toothbrush");
      total = total + price2[9];
      item = "Toothbrush";
     }
     if (dentfloss.isSelected() == true) {
      System.out.println("Dental Floss");
      total = total + price2[10];
      item = "Dental Floss";
     }
     if (adhesive.isSelected() == true) {
      System.out.println("Adhesive Tape");
      total = total + price2[11];
      item = "Adhesive Tape";
     }
     if (sewingkit.isSelected() == true) {
      System.out.println("Sewing Kit");
      total = total + price3[0];
      item = "Sewing Kit";
     }
     if (nailkit.isSelected() == true) {
      System.out.println("Nail Kit");
      total = total + price3[1];
      item = "Nail Kit";
     }
     if (facetissue.isSelected() == true) {
      System.out.println("Facial Tissues");
      total = total + price3[2];
      item = "Facial Tissue";
     }
     if (tolietpaper.isSelected() == true) {
      System.out.println("Toliet Tissue");
      total = total + price3[3];
      item = "Toliet Tissue";
     }
     if (handcream.isSelected() == true) {
      System.out.println("Hand Cream");
      total = total + price3[4];
      item = "Hand Cream";
     }
     if (bodylotion.isSelected() == true) {
      System.out.println("Body Lotion");
      total = total + price3[5];
      item = "Body Lotion";
     }
     if (deodorant.isSelected() == true) {
      System.out.println("Deodorant");
      total = total + price3[6];
      item = "Deodorant";
     }
     if (antiperspirant.isSelected() == true) {
      System.out.println("Anti-perspirant");
      total = total + price3[7];
      item = "Anti-perspirant";
     }
     if (schoolshirt.isSelected() == true) {
      System.out.println("School Tee Shirt");
      total = total + price3[8];
      item = "School Tee Shirt";
     }
     if (sweatpants.isSelected() == true) {
      System.out.println("Sweatpants");
      total = total + price3[9];
      item = "Sweatpants";
     }
     if (pencilkit.isSelected() == true) {
      System.out.println("Pen Pencil Stationary Kit");
      total = total + price3[10];
      item = "Pen Pencil Stationary Kit";
     }
     if (handwipes.isSelected() == true) {
      System.out.println("Handy Wipes");
      total = total + price3[11];
      item = "Handy Wipes";
     }

    }
    String card = "";
    String a = "";
    int total = 0;
    String message = " Hello! your order is \t " + item + " on " + " " + "total
    amount: $ " + total +"
    for: \t " +a +"
    you used card: "+ card;
    public void actionPerformed(ActionEvent ae) {
     if (ae.getSource() == b1) {
      String a1 = t1.getText();
      String a = "";

      message = " Hello! your order is \t " + item + " on " + " " + "total amount: $" + total + " for: \t" + a + "you used card: " + card;
      t2.setText("thank you: " + a);
      JOptionPane.showMessageDialog(null, "summary: \n" + message, "Order Summary", JOptionPane.PLAIN_MESSAGE);
      JOptionPane.showMessageDialog(null, "Summary: \n" + message,
       "Order Summary", JOptionPane.PLAIN_MESSAGE);
     }

     if (ae.getSource() == potatoes) {
      potatoes1 = potatoes1 + 1;
     }
     if (ae.getSource() == popcorn) {
      popcorn1 = popcorn1 + 1;
     }
     if (ae.getSource() == chipmix) {
      chipmix1 = chipmix1 + 1;
     }
     if (ae.getSource() == crackers) {
      crackers1 = crackers1 + 1;
     }
     if (ae.getSource() == peanuts) {
      peanuts1 = peanuts1 + 1;
     }
     if (ae.getSource() == chocolate) {
      chocolate1 = chocolate1 + 1;
     }
     if (ae.getSource() == nutmix) {
      nutmix1 = nutmix1 + 1;
     }
     if (ae.getSource() == healthbar) {
      healthbar1 = healthbar1 + 1;
     }
     if (ae.getSource() == raisins) {
      raisins1 = raisins1 + 1;
     }
     if (ae.getSource() == cookies) {
      cookies1 = cookies1 + 1;
     }
     if (ae.getSource() == figbar) {
      figbar1 = figbar1 + 1;
     }
     if (ae.getSource() == pretzels) {
      pretzels1 = pretzels1 + 1;
     }
     if (ae.getSource() == aspirin) {
      aspirin1 = aspirin1 + 1;
     }
     if (ae.getSource() == acetom) {
      acetom1 = acetom1 + 1;
     }
     if (ae.getSource() == vitC) {
      vitC1 = vitC1 + 1;
     }
     if (ae.getSource() == vitB) {
      vitB1 = vitB1 + 1;
     }
     if (ae.getSource() == bandaids) {
      bandaids1 = bandaids1 + 1;
     }
     if (ae.getSource() == antibiotics) {
      antibiotics1 = antibiotics1 + 1;
     }
     if (ae.getSource() == antiitch) {
      antiitch1 = antiitch1 + 1;
     }
     if (ae.getSource() == gauze) {
      gauze1 = gauze1 + 1;
     }
     if (ae.getSource() == toothpaste) {
      toothpaste1 = toothpaste1 + 1;
     }
     if (ae.getSource() == toothbrush) {
      toothbrush1 = toothbrush1 + 1;
     }
     if (ae.getSource() == dentfloss) {
      dentfloss1 = dentfloss1 + 1;
     }
     if (ae.getSource() == adhesive) {
      adhesive1 = adhesive1 + 1;
     }
     if (ae.getSource() == schoolshirt) {
      schoolshirt1 = schoolshirt1 + 1;
     }
     if (ae.getSource() == sweatpants) {
      sweatpants1 = sweatpants1 + 1;
     }
     if (ae.getSource() == sewingkit) {
      sewingkit1 = sewingkit1 + 1;
     }
     if (ae.getSource() == nailkit) {
      nailkit1 = nailkit1 + 1;
     }
     if (ae.getSource() == facetissue) {
      facetissue1 = facetissue1 + 1;
     }
     if (ae.getSource() == tolietpaper) {
      tolietpaper1 = tolietpaper1 + 1;
     }
     if (ae.getSource() == pencilkit) {
      pencilkit1 = pencilkit1 + 1;
     }
     if (ae.getSource() == handwipes) {
      handwipes1 = handwipes1 + 1;
     }
     if (ae.getSource() == handcream) {
      handcream1 = handcream1 + 1;
     }
     if (ae.getSource() == bodylotion) {
      bodylotion1 = bodylotion1 + 1;
     }
     if (ae.getSource() == deodorant) {
      deodorant1 = deodorant1 + 1;
     }
     if (ae.getSource() == antiperspirant) {
      antiperspirant1 = antiperspirant1 + 1;
     }
    }
    public static void main(String[] args) {
     FinalProject a = new FinalProject();
     a.setVisible(true);
     a.setLocation(200, 200);
    }
   }
```

The code that is giving me issues, or the program is ignoring is this:
https://imgur.com/F0c33AI
 I expect the results to be what items i've clicked, and what they cost me, plus what card I use to pay.

My code has no known errors, but here is what I get when I go to the compute button:  https://imgur.com/shkNHPv

答:
All the condition checks (whether the button is pressed or not) is done in the constructor, so the checks are only going to be done once when the object is created in main. What you need to do is to implement ActionListeners such that the checks are done when a button is pressed.

P.S. There is a lot of improvements you need to do for your code.

Body:
I'm trying to get a running Vending Machine GUI to work, I have it all set up, all the buttons are clickable, yet the output doesn't show me what buttons I clicked (What I want to get) or how much it costs, or what card I've used to pay. It seems like it is ignoring variables.

My Entire code is here:

import java.awt.*;
import java.awt.event.*;
import java.util.EventObject;
import javax.swing.*;

public class FinalProject extends JFrame implements ActionListener {
 private static final long serialVersionUID = 1 L;
 JLabel l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, foodkiosk,
 healthkiosk, sundrieskiosk, shelf1, shelf2, shelf3, shelf4, shelf5, shelf6,
 shelf7, shelf8, shelf9;
 JButton b1, b2, b3, b4, b5;
 JButton potatoes, popcorn, crackers, chipmix, peanuts, chocolate, nutmix,
 healthbar, raisins, cookies, figbar, pretzels;
 JButton aspirin, acetom, vitC, vitB, bandaids, antibiotics, antiitch, gauze,
 toothpaste, toothbrush, dentfloss, adhesive;
 JButton sewingkit, nailkit, facetissue, tolietpaper, handcream,
 bodylotion, deodorant, antiperspirant, schoolshirt, sweatpants, pencilkit,
 handwipes;
 double[] price1 = {
  1.50,
  1.00,
  1.00,
  1.25,
  1.00,
  1.25,
  1.00,
  2.00,
  1.00,
  1.00,
  1.50,
  1.25
 };
 double[] price2 = {
  2.00,
  2.00,
  2.00,
  2.00,
  1.00,
  2.00,
  2.00,
  1.00,
  1.00,
  1.00,
  1.00,
  1.00
 };
 double[] price3 = {
  1.00,
  2.00,
  1.00,
  1.00,
  1.00,
  1.00,
  1.00,
  1.50,
  3.00,
  4.00,
  2.00,
  1.00
 };
 String item = "";
 JTextField t1, t2, t3;
 int potatoes1 = 0;
 int popcorn1 = 0;
 int crackers1 = 0;
 int chipmix1 = 0;
 int peanuts1 = 0;
 int chocolate1 = 0;
 int nutmix1 = 0;
 int healthbar1 = 0;
 int raisins1 = 0;
 int cookies1 = 0;
 int figbar1 = 0;
 int pretzels1 = 0;
 int aspirin1 = 0;
 int acetom1 = 0;
 int vitC1 = 0;
 int vitB1 = 0;
 int bandaids1 = 0;
 int antibiotics1 = 0;
 int antiitch1 = 0;
 int gauze1 = 0;
 int toothpaste1 = 0;
 int toothbrush1 = 0;
 int dentfloss1 = 0;
 int adhesive1 = 0;
 int sewingkit1 = 0;
 int nailkit1 = 0;
 int facetissue1 = 0;
 int tolietpaper1 = 0;
 int handcream1 = 0;
 int bodylotion1 = 0;
 int deodorant1 = 0;
 int antiperspirant1 = 0;
 int schoolshirt1 = 0;
 int sweatpants1 = 0;
 int pencilkit1 = 0;
 int handwipes1 = 0;
 private JRadioButton EDUcard, visa, discover;
 private ButtonGroup group;
 String[] food = {
  "Potato Chips",
  "Popcorn",
  "Crackers",
  "Chip
  Mix ","
  Peanuts ", "
  Chocolate bar ","
  Mixed nuts ", "
  Health bar ", "
  Raisins ",
  "Cookies",
  "Fig bars",
  "Pretzels"
 };
 String[] health = {
   "Aspirin",
   "Acetominophen",
   "Vitamin C",
   "Vitamin B
   Complex ", "
   Bandaids ", "
   Antibiotic Ointment ", "
   Anit - Itch Ointment ", "
   Gauze
   Pad ", "
   Toothpaste ", "
   Toothbrush ", "
   Dental Floss ", "
   Adhesive Tape "};
   String[] sundries = {
    "Sewing Kit",
    "Nail Kit",
    "Facial Tissues",
    "Toliet
    Tissue ","
    Hand Cream ","
    Body Lotion ","
    Deodorant ","
    Anti - Perspirant ","
    School Tee
    Shirt ","
    Sweat Pants ","
    Pencil Pen Stationary Kit ","
    Handy Wipes ",};

    FinalProject() {
     l1 = new JLabel(" Customer Name");
     l2 = new JLabel("  ");
     l3 = new JLabel(" amount to pay");
     l4 = new JLabel("  ");
     l5 = new JLabel("  ");
     l6 = new JLabel("  ");
     l7 = new JLabel("  ");
     l8 = new JLabel("  ");
     l9 = new JLabel("  ");
     l10 = new JLabel("  ");
     l11 = new JLabel("  ");
     l12 = new JLabel("  ");
     l13 = new JLabel("  ");
     l14 = new JLabel("  ");
     foodkiosk = new JLabel("Food Kiosk");
     healthkiosk = new JLabel("Health Kiosk");
     sundrieskiosk = new JLabel("Sundries Kiosk");

     shelf1 = new JLabel("Shelf 1");
     shelf2 = new JLabel("Shelf 2");
     shelf3 = new JLabel("Shelf 3");
     shelf4 = new JLabel("Shelf 4");
     shelf5 = new JLabel("Shelf 5");
     shelf6 = new JLabel("Shelf 6");
     shelf7 = new JLabel("Shelf 7");
     shelf8 = new JLabel("Shelf 8");
     shelf9 = new JLabel("Shelf 9");
     b1 = new JButton("COMPUTE");
     b2 = new JButton("EXIT");
     potatoes = new JButton("Potato Chips");
     popcorn = new JButton("Popcorn");
     crackers = new JButton("Crackers");
     chipmix = new JButton("Chip Mix");
     peanuts = new JButton("Peanuts");
     chocolate = new JButton("Chocolate");
     nutmix = new JButton("Mixed nuts");
     healthbar = new JButton("Health Bar");
     raisins = new JButton("Raisins");
     cookies = new JButton("Cookies");
     figbar = new JButton("Fig Bars");
     pretzels = new JButton("Pretzals");
     aspirin = new JButton("Aspirin");
     acetom = new JButton("Acetominophen");
     vitC = new JButton("Vitamin C");
     vitB = new JButton("Vitamin B Complex");
     bandaids = new JButton("Bandaids");
     antibiotics = new JButton("Antibiotic Ointment");
     antiitch = new JButton("Anit-Itch Ointment");
     gauze = new JButton("Gauze Pads");
     toothpaste = new JButton("Toothpaste");
     toothbrush = new JButton("Toothbrush");
     dentfloss = new JButton("Dental Floss");
     adhesive = new JButton("Adhesive Tape");
     sewingkit = new JButton("Sewing Kit");
     nailkit = new JButton("Nail Kit");
     facetissue = new JButton("Facial Tissues");
     tolietpaper = new JButton("Toliet Tissue");
     handcream = new JButton("Hand Cream");
     bodylotion = new JButton("Body Lotion");
     deodorant = new JButton("Deodorant");
     antiperspirant = new JButton("Anti-Perspirant");
     schoolshirt = new JButton("School Tee-Shirt");
     sweatpants = new JButton("Sweatpants");
     pencilkit = new JButton("Pencil Pen Stationary Kit");
     handwipes = new JButton("Handy Wipes");

     t1 = new JTextField(10);
     t2 = new JTextField(10);

     EDUcard = new JRadioButton("EDUcard", true);
     visa = new JRadioButton("visa", false);
     discover = new JRadioButton("discover", false);
     group = new ButtonGroup();
     group.add(EDUcard);
     group.add(visa);
     group.add(discover);

     add(l1);
     add(t1);
     add(foodkiosk);
     add(shelf1);
     add(potatoes);
     add(popcorn);
     add(crackers);
     add(chipmix);
     add(l4);
     add(shelf2);
     add(peanuts);
     add(chocolate);
     add(nutmix);
     add(healthbar);
     add(l5);
     add(shelf3);
     add(raisins);
     add(cookies);
     add(figbar);
     add(pretzels);
     add(l8);
     add(healthkiosk);
     add(shelf4);
     add(aspirin);
     add(acetom);
     add(vitC);
     add(vitB);
     add(l9);
     add(shelf5);
     add(bandaids);
     add(antibiotics);
     add(antiitch);
     add(gauze);
     add(l10);
     add(shelf6);
     add(toothpaste);
     add(toothbrush);
     add(dentfloss);
     add(adhesive);
     add(l11);
     add(sundrieskiosk);
     add(shelf7);
     add(sewingkit);
     add(nailkit);
     add(facetissue);
     add(tolietpaper);
     add(l12);
     add(shelf8);
     add(handcream);
     add(bodylotion);
     add(deodorant);
     add(antiperspirant);
     add(l13);
     add(shelf9);
     add(schoolshirt);
     add(sweatpants);
     add(pencilkit);
     add(handwipes);
     add(l7);
     add(EDUcard);
     add(discover);
     add(visa);
     add(l2);
     add(l6);
     add(b1);
     add(b2);
     b1.addActionListener(this);
     b2.addActionListener(e -> System.exit(0));
     potatoes.addActionListener(this);
     popcorn.addActionListener(this);
     crackers.addActionListener(this);
     chipmix.addActionListener(this);
     peanuts.addActionListener(this);
     chocolate.addActionListener(this);
     nutmix.addActionListener(this);
     healthbar.addActionListener(this);
     raisins.addActionListener(this);
     cookies.addActionListener(this);
     figbar.addActionListener(this);
     pretzels.addActionListener(this);
     aspirin.addActionListener(this);
     acetom.addActionListener(this);
     vitC.addActionListener(this);
     vitB.addActionListener(this);
     bandaids.addActionListener(this);
     antibiotics.addActionListener(this);
     antiitch.addActionListener(this);
     gauze.addActionListener(this);
     toothpaste.addActionListener(this);
     toothbrush.addActionListener(this);
     dentfloss.addActionListener(this);
     adhesive.addActionListener(this);
     sewingkit.addActionListener(this);
     nailkit.addActionListener(this);
     facetissue.addActionListener(this);
     tolietpaper.addActionListener(this);
     handcream.addActionListener(this);
     bodylotion.addActionListener(this);
     deodorant.addActionListener(this);
     antiperspirant.addActionListener(this);
     schoolshirt.addActionListener(this);
     sweatpants.addActionListener(this);
     pencilkit.addActionListener(this);
     handwipes.addActionListener(this);
     setSize(800, 800);
     setLayout(new GridLayout(10, 5));
     setTitle("Vending Machine");

     double total = 0.0;
     String card = "discover";
     if (chocolate1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (popcorn1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (peanuts1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (crackers1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (raisins1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (healthbar1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (chipmix1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (potatoes1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (cookies1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (nutmix1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (figbar1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (pretzels1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (adhesive1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (dentfloss1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (sweatpants1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (pencilkit1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (schoolshirt1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (antibiotics1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (antiitch1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (gauze1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (toothbrush1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (vitC1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (toothpaste1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (vitB1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (aspirin1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (acetom1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (bandaids1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (sewingkit1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (nailkit1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (facetissue1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (tolietpaper1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (handcream1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (bodylotion1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (deodorant1 < 5) {
      System.out.println("You need to restock back up to 10");
     }
     if (antiperspirant1 < 5) {
      System.out.println("You need to restock back up to 10");
     }

     if (EDUcard.isSelected() == true) {
      card += " EDUcard will be used to pay";
     }
     if (visa.isSelected() == true) {
      card += " Visa will be used to pay";
     }
     if (discover.isSelected() == true) {
      card += " discover will be used to pay";
     }
     if (popcorn.isSelected() == true) {
      System.out.println("Popcorn");
      total += total + price1[1];
      item = "Popcorn";

     }
     if (potatoes.isSelected() == true) {
      System.out.println("Potato chips");
      total = total + price1[0];
      item = "Potato chips";
     }
     if (crackers.isSelected() == true) {
      total = total + price1[2];
      System.out.println("Crackers");

      item = "Crackers";
     }
     if (chipmix.isSelected() == true) {
      System.out.println("Chip Mix");
      total = total + price1[3];
      item = "Chip Mix";
     }
     if (peanuts.isSelected() == true) {
      System.out.println("Peanuts");
      total = total + price1[4];
      item = "Peanuts";
     }
     if (chocolate.isSelected() == true) {
      System.out.println("Chocolate Bar");
      total = total + price1[5];
      item = "Chocolate Bar";
     }
     if (nutmix.isSelected() == true) {
      System.out.println("Mixed Nuts");
      total = total + price1[6];
      item = "Mixed Nuts";
     }
     if (healthbar.isSelected() == true) {
      System.out.println("Health Bar");
      total = total + price1[7];
      item = "Health Bar";
     }
     if (raisins.isSelected() == true) {
      System.out.println("Raisins");
      total = total + price1[8];
      item
       = "Raisins";
     }
     if (cookies.isSelected() == true) {
      System.out.println("Cookies");
      total = total + price1[9];
      item = "Cookies";
     }
     if (figbar.isSelected() == true) {
      System.out.println("Fig Bars");
      total = total + price1[10];
      item = "Fig Bars";
     }
     if (pretzels.isSelected() == true) {
      System.out.println("Pretzels");
      total = total + price1[11];
      item = "Pretzels";
     }
     if (aspirin.isSelected() == true) {
      System.out.println("Aspirin");
      total = total + price2[0];
      item = "Aspirin";
     }
     if (acetom.isSelected() == true) {
      System.out.println("Acetominophen");
      total = total + price2[1];
      item = "Acetominophen";
     }
     if (vitC.isSelected() == true) {
      System.out.println("Vitamin C");
      total = total + price2[2];
      item = "Vitamin C";
     }
     if (vitB.isSelected() == true) {
      System.out.println("Vitamin B Complex");
      total = total + price2[3];
      item = "Vitamin B Complex";
     }
     if (bandaids.isSelected() == true) {
      System.out.println("Bandaids");
      total = total + price2[4];
      item = "Bandaids";
     }
     if (antibiotics.isSelected() == true) {
      System.out.println("Antibiotic Ointment");
      total = total + price2[5];
      item = "Antibiotic Ointment";
     }
     if (antiitch.isSelected() == true) {
      System.out.println("Anti-Itch Ointment");
      total = total + price2[6];
      item = "Anti-Itch Ointment";
     }
     if (gauze.isSelected() == true) {
      System.out.println("Gauze Pads");
      total = total + price2[7];
      item = "Gauze Pads";
     }
     if (toothpaste.isSelected() == true) {
      System.out.println("Toothpaste");
      total = total + price2[8];
      item = "Toothpaste";
     }
     if (toothbrush.isSelected() == true) {
      System.out.println("Toothbrush");
      total = total + price2[9];
      item = "Toothbrush";
     }
     if (dentfloss.isSelected() == true) {
      System.out.println("Dental Floss");
      total = total + price2[10];
      item = "Dental Floss";
     }
     if (adhesive.isSelected() == true) {
      System.out.println("Adhesive Tape");
      total = total + price2[11];
      item = "Adhesive Tape";
     }
     if (sewingkit.isSelected() == true) {
      System.out.println("Sewing Kit");
      total = total + price3[0];
      item = "Sewing Kit";
     }
     if (nailkit.isSelected() == true) {
      System.out.println("Nail Kit");
      total = total + price3[1];
      item = "Nail Kit";
     }
     if (facetissue.isSelected() == true) {
      System.out.println("Facial Tissues");
      total = total + price3[2];
      item = "Facial Tissue";
     }
     if (tolietpaper.isSelected() == true) {
      System.out.println("Toliet Tissue");
      total = total + price3[3];
      item = "Toliet Tissue";
     }
     if (handcream.isSelected() == true) {
      System.out.println("Hand Cream");
      total = total + price3[4];
      item = "Hand Cream";
     }
     if (bodylotion.isSelected() == true) {
      System.out.println("Body Lotion");
      total = total + price3[5];
      item = "Body Lotion";
     }
     if (deodorant.isSelected() == true) {
      System.out.println("Deodorant");
      total = total + price3[6];
      item = "Deodorant";
     }
     if (antiperspirant.isSelected() == true) {
      System.out.println("Anti-perspirant");
      total = total + price3[7];
      item = "Anti-perspirant";
     }
     if (schoolshirt.isSelected() == true) {
      System.out.println("School Tee Shirt");
      total = total + price3[8];
      item = "School Tee Shirt";
     }
     if (sweatpants.isSelected() == true) {
      System.out.println("Sweatpants");
      total = total + price3[9];
      item = "Sweatpants";
     }
     if (pencilkit.isSelected() == true) {
      System.out.println("Pen Pencil Stationary Kit");
      total = total + price3[10];
      item = "Pen Pencil Stationary Kit";
     }
     if (handwipes.isSelected() == true) {
      System.out.println("Handy Wipes");
      total = total + price3[11];
      item = "Handy Wipes";
     }

    }
    String card = "";
    String a = "";
    int total = 0;
    String message = " Hello! your order is \t " + item + " on " + " " + "total
    amount: $ " + total +"
    for: \t " +a +"
    you used card: "+ card;
    public void actionPerformed(ActionEvent ae) {
     if (ae.getSource() == b1) {
      String a1 = t1.getText();
      String a = "";

      message = " Hello! your order is \t " + item + " on " + " " + "total amount: $" + total + " for: \t" + a + "you used card: " + card;
      t2.setText("thank you: " + a);
      JOptionPane.showMessageDialog(null, "summary: \n" + message, "Order Summary", JOptionPane.PLAIN_MESSAGE);
      JOptionPane.showMessageDialog(null, "Summary: \n" + message,
       "Order Summary", JOptionPane.PLAIN_MESSAGE);
     }

     if (ae.getSource() == potatoes) {
      potatoes1 = potatoes1 + 1;
     }
     if (ae.getSource() == popcorn) {
      popcorn1 = popcorn1 + 1;
     }
     if (ae.getSource() == chipmix) {
      chipmix1 = chipmix1 + 1;
     }
     if (ae.getSource() == crackers) {
      crackers1 = crackers1 + 1;
     }
     if (ae.getSource() == peanuts) {
      peanuts1 = peanuts1 + 1;
     }
     if (ae.getSource() == chocolate) {
      chocolate1 = chocolate1 + 1;
     }
     if (ae.getSource() == nutmix) {
      nutmix1 = nutmix1 + 1;
     }
     if (ae.getSource() == healthbar) {
      healthbar1 = healthbar1 + 1;
     }
     if (ae.getSource() == raisins) {
      raisins1 = raisins1 + 1;
     }
     if (ae.getSource() == cookies) {
      cookies1 = cookies1 + 1;
     }
     if (ae.getSource() == figbar) {
      figbar1 = figbar1 + 1;
     }
     if (ae.getSource() == pretzels) {
      pretzels1 = pretzels1 + 1;
     }
     if (ae.getSource() == aspirin) {
      aspirin1 = aspirin1 + 1;
     }
     if (ae.getSource() == acetom) {
      acetom1 = acetom1 + 1;
     }
     if (ae.getSource() == vitC) {
      vitC1 = vitC1 + 1;
     }
     if (ae.getSource() == vitB) {
      vitB1 = vitB1 + 1;
     }
     if (ae.getSource() == bandaids) {
      bandaids1 = bandaids1 + 1;
     }
     if (ae.getSource() == antibiotics) {
      antibiotics1 = antibiotics1 + 1;
     }
     if (ae.getSource() == antiitch) {
      antiitch1 = antiitch1 + 1;
     }
     if (ae.getSource() == gauze) {
      gauze1 = gauze1 + 1;
     }
     if (ae.getSource() == toothpaste) {
      toothpaste1 = toothpaste1 + 1;
     }
     if (ae.getSource() == toothbrush) {
      toothbrush1 = toothbrush1 + 1;
     }
     if (ae.getSource() == dentfloss) {
      dentfloss1 = dentfloss1 + 1;
     }
     if (ae.getSource() == adhesive) {
      adhesive1 = adhesive1 + 1;
     }
     if (ae.getSource() == schoolshirt) {
      schoolshirt1 = schoolshirt1 + 1;
     }
     if (ae.getSource() == sweatpants) {
      sweatpants1 = sweatpants1 + 1;
     }
     if (ae.getSource() == sewingkit) {
      sewingkit1 = sewingkit1 + 1;
     }
     if (ae.getSource() == nailkit) {
      nailkit1 = nailkit1 + 1;
     }
     if (ae.getSource() == facetissue) {
      facetissue1 = facetissue1 + 1;
     }
     if (ae.getSource() == tolietpaper) {
      tolietpaper1 = tolietpaper1 + 1;
     }
     if (ae.getSource() == pencilkit) {
      pencilkit1 = pencilkit1 + 1;
     }
     if (ae.getSource() == handwipes) {
      handwipes1 = handwipes1 + 1;
     }
     if (ae.getSource() == handcream) {
      handcream1 = handcream1 + 1;
     }
     if (ae.getSource() == bodylotion) {
      bodylotion1 = bodylotion1 + 1;
     }
     if (ae.getSource() == deodorant) {
      deodorant1 = deodorant1 + 1;
     }
     if (ae.getSource() == antiperspirant) {
      antiperspirant1 = antiperspirant1 + 1;
     }
    }
    public static void main(String[] args) {
     FinalProject a = new FinalProject();
     a.setVisible(true);
     a.setLocation(200, 200);
    }
   }

The code that is giving me issues, or the program is ignoring is this:
https://imgur.com/F0c33AI
 I expect the results to be what items i've clicked, and what they cost me, plus what card I use to pay.

My code has no known errors, but here is what I get when I go to the compute button:  https://imgur.com/shkNHPv


问:
TextField takes unicode in Django
I am trying to save a string contains characters whose ordinal is not in range(128) into database. The field is declared as TextField in model and when I called the save() method, an exception was thrown:

```<code>File "/Library/Python/2.6/site-packages/django/db/models/base.py", line 434, in save self.save_base(using=using, force_insert=force_insert, force_update=force_update)
File "/Library/Python/2.6/site-packages/django/db/models/base.py", line 500, in save_base rows = manager.using(using).filter(pk=pk_val)._update(values)
File "/Library/Python/2.6/site-packages/django/db/models/query.py", line 491, in _update return query.get_compiler(self.db).execute_sql(None)
File "/Library/Python/2.6/site-packages/django/db/models/sql/compiler.py", line 861, in execute_sql cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
File "/Library/Python/2.6/site-packages/django/db/models/sql/compiler.py", line 717, in execute_sql sql, params = self.as_sql()
File "/Library/Python/2.6/site-packages/django/db/models/sql/compiler.py", line 826, in as_sql val = field.get_db_prep_save(val, connection=self.connection)
File "/Library/Python/2.6/site-packages/django/db/models/fields/subclassing.py", line 28, in inner return func(*args, **kwargs)
File "/Library/Python/2.6/site-packages/django/db/models/fields/subclassing.py", line 28, in inner return func(*args, **kwargs)
File "/Library/Python/2.6/site-packages/django/db/models/fields/__init__.py", line 276, in get_db_prep_save return self.get_db_prep_value(value, connection=connection, prepared=False)
File "/Library/Python/2.6/site-packages/django/db/models/fields/subclassing.py", line 53, in inner return func(*args, **kwargs)
File "/Library/Python/2.6/site-packages/django/db/models/fields/__init__.py", line 652, in get_db_prep_value value = self.get_prep_value(value)
File "/Library/Python/2.6/site-packages/django/db/models/fields/__init__.py", line 647, in get_prep_value return self.to_python(value)
File "/Library/Python/2.6/site-packages/django/db/models/fields/__init__.py", line 610, in to_python if not ansi_date_re.search(value):
TypeError: expected string or buffer
</code>```

Here is what I did:

```<code>str_unicode = str.encode('utf-8')
m = MyModel.new(str = str_unicode)
m.save()
</code>```

So what should I do to enable the unicode compatibility?

Updated: I am currently using sqlite3 for development, python 2.6.1 and Django 1.2.4 on Mac

答:
Django works fine with unicode.

But if your input are not properly converted you will have trouble.
As an exemple : I have had a lot of trouble with an old MyISAM database populated wrongly by a bugged php script.
Check your input.

What database backend do you use? What level of python ?

ContentLicense: CC BY-SA 2.5

Title: TextField takes unicode in Django

Body:
I am trying to save a string contains characters whose ordinal is not in range(128) into database. The field is declared as TextField in model and when I called the save() method, an exception was thrown:

File "/Library/Python/2.6/site-packages/django/db/models/base.py", line 434, in save self.save_base(using=using, force_insert=force_insert, force_update=force_update)
File "/Library/Python/2.6/site-packages/django/db/models/base.py", line 500, in save_base rows = manager.using(using).filter(pk=pk_val)._update(values)
File "/Library/Python/2.6/site-packages/django/db/models/query.py", line 491, in _update return query.get_compiler(self.db).execute_sql(None)
File "/Library/Python/2.6/site-packages/django/db/models/sql/compiler.py", line 861, in execute_sql cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
File "/Library/Python/2.6/site-packages/django/db/models/sql/compiler.py", line 717, in execute_sql sql, params = self.as_sql()
File "/Library/Python/2.6/site-packages/django/db/models/sql/compiler.py", line 826, in as_sql val = field.get_db_prep_save(val, connection=self.connection)
File "/Library/Python/2.6/site-packages/django/db/models/fields/subclassing.py", line 28, in inner return func(*args, **kwargs)
File "/Library/Python/2.6/site-packages/django/db/models/fields/subclassing.py", line 28, in inner return func(*args, **kwargs)
File "/Library/Python/2.6/site-packages/django/db/models/fields/__init__.py", line 276, in get_db_prep_save return self.get_db_prep_value(value, connection=connection, prepared=False)
File "/Library/Python/2.6/site-packages/django/db/models/fields/subclassing.py", line 53, in inner return func(*args, **kwargs)
File "/Library/Python/2.6/site-packages/django/db/models/fields/__init__.py", line 652, in get_db_prep_value value = self.get_prep_value(value)
File "/Library/Python/2.6/site-packages/django/db/models/fields/__init__.py", line 647, in get_prep_value return self.to_python(value)
File "/Library/Python/2.6/site-packages/django/db/models/fields/__init__.py", line 610, in to_python if not ansi_date_re.search(value):
TypeError: expected string or buffer

Here is what I did:

str_unicode = str.encode('utf-8')
m = MyModel.new(str = str_unicode)
m.save()

So what should I do to enable the unicode compatibility?

Updated: I am currently using sqlite3 for development, python 2.6.1 and Django 1.2.4 on Mac


问:
React-Router issues when serving React App with Spring Boot
I'm currently needing to serve my React app with Spring Boot. It is working for the root url - localhost:8080/, but of course none of the sub-routes are recognized by the Spring Controller.

I'm not sure how to get the React Routing and Spring request mapping to line up without hard-coding in every possible route to map to index.html - and then some of the routes have variable sub-routes.

Here is my HomeController that serves the index.html

```<code>@Controller
public class HomeController {

    @RequestMapping(value = "/")
    public String index() {
        return "index.html";
    }
}
</code>```

Here is the Routing render in my React App

```<code>const Root = ({ store }) => (
  <Provider store={store}>
    <Router history={browserHistory}>
      <Route path="/" component={App}>
        <IndexRedirect to="users"/>
        <Route path="/org" component={OrgSearch}>
          {<Route path="/org/:orgId" component={Org}/>}
        </Route>
        <Route path="/users" component={UserSearch}>
          {<Route path="/users/:userId" component={User} />}
        </Route>
      </Route>
    </Router>
  </Provider>
)
</code>```

Any help is greatly appreciated!

EDIT: I tried adding some wildcard functionality, and it is presenting some strange behavior. Here is the updated code for the HomeController.

```<code>@Controller
public class HomeController {

    @RequestMapping(value = {"/", "/users/**", "/org/**"})
    public String index() {
        return "index.html";
    }
}
</code>```

I can access / and /users but not /users/ or /users/2545.

Here is the error when I try to access the latter.

```<code>2017-04-14 09:21:59.896 ERROR 58840 --- [nio-8080-exec-3] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Circular view path [index.html]: would dispatch back to the current handler URL [/users/index.html] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)] with root cause

javax.servlet.ServletException: Circular view path [index.html]: would dispatch back to the current handler URL [/users/index.html] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
    at org.springframework.web.servlet.view.InternalResourceView.prepareForRendering(InternalResourceView.java:205) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:145) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1282) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1037) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:980) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
</code>```

答:
For me, I tried the answer in this link.
I did not have a controller.

Basically it is about defining the addViewController...

```<code>@Configuration
public class WebConfiguration implements WebMvcConfigurer {

  @Override
  public void addViewControllers(ViewControllerRegistry registry) {
      registry.addViewController("/{spring:\\w+}")
            .setViewName("forward:/");
      registry.addViewController("/**/{spring:\\w+}")
            .setViewName("forward:/");
      registry.addViewController("/{spring:\\w+}/**{spring:?!(\\.js|\\.css)$}")
            .setViewName("forward:/");
  }
}
</code>```

Body:
I'm currently needing to serve my React app with Spring Boot. It is working for the root url - localhost:8080/, but of course none of the sub-routes are recognized by the Spring Controller.

I'm not sure how to get the React Routing and Spring request mapping to line up without hard-coding in every possible route to map to index.html - and then some of the routes have variable sub-routes.

Here is my HomeController that serves the index.html

@Controller
public class HomeController {

    @RequestMapping(value = "/")
    public String index() {
        return "index.html";
    }
}

Here is the Routing render in my React App

const Root = ({ store }) => (
  <Provider store={store}>
    <Router history={browserHistory}>
      <Route path="/" component={App}>
        <IndexRedirect to="users"/>
        <Route path="/org" component={OrgSearch}>
          {<Route path="/org/:orgId" component={Org}/>}
        </Route>
        <Route path="/users" component={UserSearch}>
          {<Route path="/users/:userId" component={User} />}
        </Route>
      </Route>
    </Router>
  </Provider>
)

Any help is greatly appreciated!

EDIT: I tried adding some wildcard functionality, and it is presenting some strange behavior. Here is the updated code for the HomeController.

@Controller
public class HomeController {

    @RequestMapping(value = {"/", "/users/**", "/org/**"})
    public String index() {
        return "index.html";
    }
}

I can access / and /users but not /users/ or /users/2545.

Here is the error when I try to access the latter.

2017-04-14 09:21:59.896 ERROR 58840 --- [nio-8080-exec-3] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Circular view path [index.html]: would dispatch back to the current handler URL [/users/index.html] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)] with root cause

javax.servlet.ServletException: Circular view path [index.html]: would dispatch back to the current handler URL [/users/index.html] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
    at org.springframework.web.servlet.view.InternalResourceView.prepareForRendering(InternalResourceView.java:205) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:145) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1282) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1037) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:980) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]

Body:
For me, I tried the answer in this link.
I did not have a controller.

Basically it is about defining the addViewController...

@Configuration
public class WebConfiguration implements WebMvcConfigurer {

  @Override
  public void addViewControllers(ViewControllerRegistry registry) {
      registry.addViewController("/{spring:\\w+}")
            .setViewName("forward:/");
      registry.addViewController("/**/{spring:\\w+}")
            .setViewName("forward:/");
      registry.addViewController("/{spring:\\w+}/**{spring:?!(\\.js|\\.css)$}")
            .setViewName("forward:/");
  }
}

ContentLicense: CC BY-SA 4.0


问:
Acumatica - Need underscores in my email addresses
I have a field in my customization that I've set to [PXDBEmail]  Unfortunately, this field replaces entered underscores with a space.  Is there a way to keep it from doing so?

Update - DAC code below

```<code>    public abstract class customerID : PX.Data.IBqlField
    {
    }
    protected string _CustomerID;

    [PXDBEmail]
    [PXUIField(DisplayName = "User Name")]
    public virtual string CustomerID
    {
        get
        {
            return this._CustomerID;
        }
        set
        {
            this._CustomerID = value != null ? value.Trim() :null;
        }
    }
</code>```

答:
Out of the box, the Email field on the Customers screen accept undercores without any issues:

Could you please compare the decalration of your custom field with the declaration of the EMail field from the Contact DAC?

```<code>public partial class Contact : IBqlTable, IContactBase, IAssign, IPXSelectable, CRDefaultMailToAttribute.IEmailMessageTarget
{
    ...
    #region EMail
    public abstract class eMail : PX.Data.IBqlField { }
    private string _eMail;

    [PXDBEmail]
    [PXUIField(DisplayName = "Email", Visibility = PXUIVisibility.SelectorVisible)]
    [PXMassMergableField]
    [PXDefault(PersistingCheck = PXPersistingCheck.Nothing)]
    public virtual String EMail
    {
        get { return _eMail; }
        set { _eMail = value != null ? value.Trim() : null; }
    }

    #endregion
    ...
}
</code>```

Body:
I have a field in my customization that I've set to [PXDBEmail]  Unfortunately, this field replaces entered underscores with a space.  Is there a way to keep it from doing so?

Update - DAC code below

    public abstract class customerID : PX.Data.IBqlField
    {
    }
    protected string _CustomerID;

    [PXDBEmail]
    [PXUIField(DisplayName = "User Name")]
    public virtual string CustomerID
    {
        get
        {
            return this._CustomerID;
        }
        set
        {
            this._CustomerID = value != null ? value.Trim() :null;
        }
    }

Body:
Out of the box, the Email field on the Customers screen accept undercores without any issues:

Could you please compare the decalration of your custom field with the declaration of the EMail field from the Contact DAC?

public partial class Contact : IBqlTable, IContactBase, IAssign, IPXSelectable, CRDefaultMailToAttribute.IEmailMessageTarget
{
    ...
    #region EMail
    public abstract class eMail : PX.Data.IBqlField { }
    private string _eMail;

    [PXDBEmail]
    [PXUIField(DisplayName = "Email", Visibility = PXUIVisibility.SelectorVisible)]
    [PXMassMergableField]
    [PXDefault(PersistingCheck = PXPersistingCheck.Nothing)]
    public virtual String EMail
    {
        get { return _eMail; }
        set { _eMail = value != null ? value.Trim() : null; }
    }

    #endregion
    ...
}


问:
Change the color of the last cell when mouse hovers over a row, value being taken into consideration
I'm trying to make like this:
If mouse hovers over a row, the last cell becomes red or yellow depending on the value: 1 or 0.

Well, I thought classes could help me: redcell and yellowcell are added.

I am inspired by this: http://jsfiddle.net/u7tYE/1/
My by code doesn't work.

Is it possible with CSS or not?

        tr:hover ~ .redcell {
            background: red;
        }
        tr:hover ~ .yellowcell {
            background: red;
        }```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html>

   <head>

   </head>

   <body>
      <table id="table">
        <tr>
          <td>item1</td>
          <td>item2</td>
          <td>item3</td>
          <td class="yellowcell">1</td>
        </tr>
        <tr>
          <td>item1</td>
          <td>item2</td>
          <td>item3</td>
          <td class="redcell">0</td>
        </tr>
        <tr>
          <td>item1</td>
          <td>item2</td>
          <td>item3</td>
          <td class="yellowcell">1</td>
        </tr>
      </table>
   </body>
</html></code>```

答:
You need child combinator selector:

```<code>tr:hover > .redcell {
            background: red;
        }
        tr:hover > .yellowcell {
            background: yellow;
        }
</code>```

 tr:hover > .redcell {
            background: red;
        }
        tr:hover > .yellowcell {
            background: yellow;
        }```
<pre class="snippet-code-html lang-html prettyprint-override"><code> <table id="table">
        <tr>
          <td>item1</td>
          <td>item2</td>
          <td>item3</td>
          <td class="yellowcell">1</td>
        </tr>
        <tr>
          <td>item1</td>
          <td>item2</td>
          <td>item3</td>
          <td class="redcell">0</td>
        </tr>
        <tr>
          <td>item1</td>
          <td>item2</td>
          <td>item3</td>
          <td class="yellowcell">1</td>
        </tr>
      </table></code>```

Body:
I'm trying to make like this:
If mouse hovers over a row, the last cell becomes red or yellow depending on the value: 1 or 0.

Well, I thought classes could help me: redcell and yellowcell are added.

I am inspired by this: http://jsfiddle.net/u7tYE/1/
My by code doesn't work.

Is it possible with CSS or not?

        tr:hover ~ .redcell {
            background: red;
        }
        tr:hover ~ .yellowcell {
            background: red;
        }

<!DOCTYPE html>

          item1
          item2
          item3
          1

          item1
          item2
          item3
          0

          item1
          item2
          item3
          1

Body:
You need child combinator selector:

tr:hover > .redcell {
            background: red;
        }
        tr:hover > .yellowcell {
            background: yellow;
        }

 tr:hover > .redcell {
            background: red;
        }
        tr:hover > .yellowcell {
            background: yellow;
        }

 <table id="table">
        <tr>
          <td>item1</td>
          <td>item2</td>
          <td>item3</td>
          <td class="yellowcell">1</td>
        </tr>
        <tr>
          <td>item1</td>
          <td>item2</td>
          <td>item3</td>
          <td class="redcell">0</td>
        </tr>
        <tr>
          <td>item1</td>
          <td>item2</td>
          <td>item3</td>
          <td class="yellowcell">1</td>
        </tr>
      </table>


问:
Is there a way to iterate over a range of integers?
Go's range can iterate over maps and slices, but I was wondering if there is a way to iterate over a range of numbers, something like this:

```<code>for i := range [1..10] {
    fmt.Println(i)
}
</code>```

Or is there a way to represent range of integers in Go like how Ruby does with the class Range?

答:
It was suggested by Mark Mishyn to use slice but there is no reason to create array with make and use in for returned slice of it when array created via literal can be used and it's shorter

```<code>for i := range [5]int{} {
        fmt.Println(i)
}
</code>```

Body:
Go's range can iterate over maps and slices, but I was wondering if there is a way to iterate over a range of numbers, something like this:

for i := range [1..10] {
    fmt.Println(i)
}

Or is there a way to represent range of integers in Go like how Ruby does with the class Range?

Body:
It was suggested by Mark Mishyn to use slice but there is no reason to create array with make and use in for returned slice of it when array created via literal can be used and it's shorter

for i := range [5]int{} {
        fmt.Println(i)
}


问:
C++ cross-compiler from Windows to Linux
Are there any user friendly tools out there to cross-compile from Windows to Linux?</p>

答:
crosstool-ng supports building cross-compilers with cygwin host.

Overview:

Install cygwin, with development packages

Download crosstool-ng

Extract the tarball (tar xvjf crosstool-ng*)

Run ./configure

When configure complains about a missing tool, go back to cygwin setup and install the corresponding package (e.g. flex, libtool, ncurses-devel)  You'll need at least the following:

Devel/gperf

Devel/bison

Devel/byacc

Devel/wget

Devel/patch

Devel/make (GNU version)

Devel/automake 1.10+

Libs/libncursesw10

Libs/libncursesw10-devel

make

make install

Create a new directory for building the cross-compiler, e.g. /usr/src/cross-linux-gnu-root

Enable system-wide case sensitivity support in the registry (see https://superuser.com/questions/266110/how-do-you-make-windows-7-fully-case-sensitive-with-respect-to-the-filesystem#answer-842670)

Mount the directory case-sensitive (e.g. mount c:/cygwin/usr/src/cross-linux-gnu-root /usr/src/cross-linux-gnu -o binary,posix=1)

From inside the cross-compiler build directory, ct-ng menuconfig

In the menus, set target architecture to x86 (probably) and subarchitecture to i686 (avoids GCC 4.8 issues, thanks osm0sis), target kernel to linux, and target C library to glibc, and enable the C++ compiler.

To work around make 4.0 issues, also enable EXPERIMENTAL in Paths and misc options then, go in Companion tools (at top-level) and enable Build some companion tools and then make 3.81 (Thanks osm0sis)

wget has issues with the latest kernel.org certificates so use the .wgetrc method in this accepted answer: How do I fix certificate errors when running wget on an HTTPS URL in Cygwin? (Thanks osm0sis)

Currently 3 file patches are required to avoid further errors:

the _libintl_gettext error as mentioned in the comments

the byteshift headers, and

the ELF headers (Thanks Duncan Calvert & osm0sis)

ct-ng build

Of course, this is NOT going to enable you to build linux applications from inside Visual Studio.  (VS2010 and later let you build with other toolchains such as gcc, but you'd need an appropriate toolchain description in addition to the cross-compiler built by crosstool-ng).  But you'll have a working g++-linux-gnu, which you can either run directly or using a Makefile.

NOTE: Building the cross-compiler takes a LONG time.  osm0sis has provided a prebuilt gcc 4.8.1 here, along with his notes on building the cross-compiler (used to update this answer).


问:
Why Query returns some null values to my list Object using dapper
I have this functional query where I only used fictive tables names for security concerns :

SELECT
h.CENID,
 h.BMHFMC,
 h.BMHDONEMIDASSTEP1,
 h.BMHDONEMIDASSTEP2,
 h.LMIID,
 h.BMHHOLD,
 h.BMHBATCHMIDAS,
 h.BMHFMCVALUEDATE AS HeaderValueDate,
 h.SUNID,
 h.BRAID,
 d.BMHID,
 d.BMDRUBRIQUE,
 d.BMDCLIENT,
 d.BMDSEQUENCE,
 d.BMDDATE,
 d.BMDDEVISE,
 d.BMDMONTANT,
 d.BMDTYPE,
 d.BMDNOTE,
 d.BMDENTRYNBRE,
 v.DEVDECIMAL ,
 NVL(t.TYPVERIFCOMPTEMIDAS, 0) AS TYPVERIFCOMPTEMIDAS
 FROM dbo.TableOne h
 INNER JOIN dbo.Tabletwoo d
 ON h.BMHID = d.BMHID
 INNER JOIN dbo.tableThree v
 ON d.BMDDEVISE = v.DEVID
 LEFT JOIN dbo.TableFour t
 ON  t.TYPID=h.BMHFMC
 WHERE d.BMDMONTANT != 0
 AND h.BMHDONEMIDASSTEP1 = 0
 AND h.BMHDONEMIDASSTEP2 = 0
 AND h.LMIID = 0
 AND h.BMHHOLD = 0
```

<p>And I made a class in order to bind every fields </p>

``` public class Batch :BaseRepository ,IList<Batch>
    {
        public Batch()
        {
        }

        private string cendid;
        private string bmhfmc;
        private double bmhdonemidasstep1;
        private double bmhdonemidasstep2;
        private double lmiid;
        private double bmhhold;
        private double bmhbatchmidas;
        private DateTime headervaluedateordinal;
        private double sunid; //
        private string bradid; //
        private double bmhid;
        private string bmdrubirique; //
        private string bmdclient;
        private string bmdsequence;
        private DateTime bmddate;
        private string bmddevise;
        private double bmdmontant;
        private string bmdtype;
        private string bmdnote;
        private string bmdentrynbre; //
        private double devdecimalordinal;
        private double typverifcomptemidasordinal;

        public Batch(string cendid, string bmhfmc, double bmhdonemidasstep1, double bmhdonemidasstep2, double lmiid, double bmhhold, double bmhbatchmidas, DateTime headervaluedateordinal, double sunid, string bradid, double bmhid, string bmdrubirique, string bmdclient, string bmdsequence, DateTime bmddate, string bmddevise, double bmdmontant, string bmdtype, string bmdnote, string bmdentrynbre, double devdecimalordinal, double typverifcomptemidasordinal)
        {
            this.cendid = cendid;
            this.bmhfmc = bmhfmc;
            this.bmhdonemidasstep1 = bmhdonemidasstep1;
            this.bmhdonemidasstep2 = bmhdonemidasstep2;
            this.lmiid = lmiid;
            this.bmhhold = bmhhold;
            this.bmhbatchmidas = bmhbatchmidas;
            this.headervaluedateordinal = headervaluedateordinal;
            this.sunid = sunid;
            this.bradid = bradid;
            this.bmhid = bmhid;
            this.bmdrubirique = bmdrubirique;
            this.bmdclient = bmdclient;
            this.bmdsequence = bmdsequence;
            this.bmddate = bmddate;
            this.bmddevise = bmddevise;
            this.bmdmontant = bmdmontant;
            this.bmdtype = bmdtype;
            this.bmdnote = bmdnote;
            this.bmdentrynbre = bmdentrynbre;
            this.devdecimalordinal = devdecimalordinal;
            this.typverifcomptemidasordinal = typverifcomptemidasordinal;
        }

        public string Cendid
        {
            get { return cendid; }
            set { cendid = value; }
        }

        public string Bmhfmc
        {
            get { return bmhfmc; }
            set { bmhfmc = value; }
        }

        public double Bmhdonemidasstep1
        {
            get { return bmhdonemidasstep1; }
            set { bmhdonemidasstep1 = value; }
        }

        public double Bmhdonemidasstep2
        {
            get { return bmhdonemidasstep2; }
            set { bmhdonemidasstep2 = value; }
        }

        public double Lmiid
        {
            get { return lmiid; }
            set { lmiid = value; }
        }

        public double Bmhhold
        {
            get { return bmhhold; }
            set { bmhhold = value; }
        }

        public double Bmhbatchmidas
        {
            get { return bmhbatchmidas; }
            set { bmhbatchmidas = value; }
        }

        public DateTime Headervaluedateordinal
        {
            get { return headervaluedateordinal; }
            set { headervaluedateordinal = value; }
        }

        public double Sunid
        {
            get { return sunid; }
            set { sunid = value; }
        }

        public string Bradid
        {
            get { return bradid; }
            set { bradid = value; }
        }

        public double Bmhid
        {
            get { return bmhid; }
            set { bmhid = value; }
        }

        public string Bmdrubirique
        {
            get { return bmdrubirique; }
            set { bmdrubirique = value; }
        }

        public string Bmdclient
        {
            get { return bmdclient; }
            set { bmdclient = value; }
        }

        public string Bmdsequence
        {
            get { return bmdsequence; }
            set { bmdsequence = value; }
        }

        public DateTime Bmddate
        {
            get { return bmddate; }
            set { bmddate = value; }
        }

        public string Bmddevise
        {
            get { return bmddevise; }
            set { bmddevise = value; }
        }

        public double Bmdmontant
        {
            get { return bmdmontant; }
            set { bmdmontant = value; }
        }

        public string Bmdtype
        {
            get { return bmdtype; }
            set { bmdtype = value; }
        }

        public string Bmdnote
        {
            get { return bmdnote; }
            set { bmdnote = value; }
        }

        public string Bmdentrynbre
        {
            get { return bmdentrynbre; }
            set { bmdentrynbre = value; }
        }

        public double Devdecimalordinal
        {
            get { return devdecimalordinal; }
            set { devdecimalordinal = value; }
        }

        public double Typverifcomptemidasordinal
        {
            get { return typverifcomptemidasordinal; }
            set { typverifcomptemidasordinal = value; }
        }
```

<p>Now when I execute the query into a list using dapper </p>

```Connection conn = new Connection();
 OracleConnection connection = conn.GetDBConnection();
  myList= connection.Query<Batch>(querySql).ToList();
```

<p>Now,while debugging, all fields returns the expected values .But, I noticed  those fields below  are <code>null</code> in <code>myList</code> not empty but really <code>null</code> , but the problem is they aren't null in the database  </p>

```Bmdrubirique , Sunid, Bmdentrynbre, Bradid ,Cenid
```

<p>In oracle database those fields are like the following : </p>

```CENID is VARCHAR2(3 BYTE)`
Bmhid is VARCHAR2(3 BYTE)
Sunid is NUMBER(38,0)
Bradid is VARCHAR2(3 BYTE)
```

I don't get it , where did it go wrong? why other fields are properly loaded while those returns null value ?

答:
My default assumption would be that there is a typo in the real code and the constructor is assigning a value from a field to itself. However, frankly: since you have a public Batch() {} constructor, I'm not sure what the benefit of the second one is - it just adds risk of errors. Likewise with the fields and manual properties.

So if this as me, where you currently have (simplified to two properties):

```<code>public class Batch
{
    private string cendid;
    private string bmhfmc;
    public Batch() {}
    public Batch(string cendid, string bmhfmc)
    {
        this.cendid = cendid;
        this.bmhfmc = bmhfmc;
    }

    public string Cendid
    {
        get { return cendid; }
        set { cendid = value; }
    }

    public string Bmhfmc
    {
        get { return bmhfmc; }
        set { bmhfmc = value; }
    }
}
</code>```

I would have literally just:

```<code>public class Batch
{
    public string Cendid {get;set;}
    public string Bmhfmc {get;set;}
}
</code>```

All of the rest of the code is just opportunities to make coding errors.

Now: the reason that Cendid is null is because: the column is CENID - only one d. This means that dapper isn't even using your custom constructor, because it isn't a perfect match between the constructor and the columns. Ditto the other fields like BRAID vs BRADID.

So the next thing to do is to fix the typos.

Body:
I have this functional query where I only used fictive tables names for security concerns :

SELECT
h.CENID,
 h.BMHFMC,
 h.BMHDONEMIDASSTEP1,
 h.BMHDONEMIDASSTEP2,
 h.LMIID,
 h.BMHHOLD,
 h.BMHBATCHMIDAS,
 h.BMHFMCVALUEDATE AS HeaderValueDate,
 h.SUNID,
 h.BRAID,
 d.BMHID,
 d.BMDRUBRIQUE,
 d.BMDCLIENT,
 d.BMDSEQUENCE,
 d.BMDDATE,
 d.BMDDEVISE,
 d.BMDMONTANT,
 d.BMDTYPE,
 d.BMDNOTE,
 d.BMDENTRYNBRE,
 v.DEVDECIMAL ,
 NVL(t.TYPVERIFCOMPTEMIDAS, 0) AS TYPVERIFCOMPTEMIDAS
 FROM dbo.TableOne h
 INNER JOIN dbo.Tabletwoo d
 ON h.BMHID = d.BMHID
 INNER JOIN dbo.tableThree v
 ON d.BMDDEVISE = v.DEVID
 LEFT JOIN dbo.TableFour t
 ON  t.TYPID=h.BMHFMC
 WHERE d.BMDMONTANT != 0
 AND h.BMHDONEMIDASSTEP1 = 0
 AND h.BMHDONEMIDASSTEP2 = 0
 AND h.LMIID = 0
 AND h.BMHHOLD = 0

And I made a class in order to bind every fields

 public class Batch :BaseRepository ,IList<Batch>
    {
        public Batch()
        {
        }

        private string cendid;
        private string bmhfmc;
        private double bmhdonemidasstep1;
        private double bmhdonemidasstep2;
        private double lmiid;
        private double bmhhold;
        private double bmhbatchmidas;
        private DateTime headervaluedateordinal;
        private double sunid; //
        private string bradid; //
        private double bmhid;
        private string bmdrubirique; //
        private string bmdclient;
        private string bmdsequence;
        private DateTime bmddate;
        private string bmddevise;
        private double bmdmontant;
        private string bmdtype;
        private string bmdnote;
        private string bmdentrynbre; //
        private double devdecimalordinal;
        private double typverifcomptemidasordinal;

        public Batch(string cendid, string bmhfmc, double bmhdonemidasstep1, double bmhdonemidasstep2, double lmiid, double bmhhold, double bmhbatchmidas, DateTime headervaluedateordinal, double sunid, string bradid, double bmhid, string bmdrubirique, string bmdclient, string bmdsequence, DateTime bmddate, string bmddevise, double bmdmontant, string bmdtype, string bmdnote, string bmdentrynbre, double devdecimalordinal, double typverifcomptemidasordinal)
        {
            this.cendid = cendid;
            this.bmhfmc = bmhfmc;
            this.bmhdonemidasstep1 = bmhdonemidasstep1;
            this.bmhdonemidasstep2 = bmhdonemidasstep2;
            this.lmiid = lmiid;
            this.bmhhold = bmhhold;
            this.bmhbatchmidas = bmhbatchmidas;
            this.headervaluedateordinal = headervaluedateordinal;
            this.sunid = sunid;
            this.bradid = bradid;
            this.bmhid = bmhid;
            this.bmdrubirique = bmdrubirique;
            this.bmdclient = bmdclient;
            this.bmdsequence = bmdsequence;
            this.bmddate = bmddate;
            this.bmddevise = bmddevise;
            this.bmdmontant = bmdmontant;
            this.bmdtype = bmdtype;
            this.bmdnote = bmdnote;
            this.bmdentrynbre = bmdentrynbre;
            this.devdecimalordinal = devdecimalordinal;
            this.typverifcomptemidasordinal = typverifcomptemidasordinal;
        }

        public string Cendid
        {
            get { return cendid; }
            set { cendid = value; }
        }

        public string Bmhfmc
        {
            get { return bmhfmc; }
            set { bmhfmc = value; }
        }

        public double Bmhdonemidasstep1
        {
            get { return bmhdonemidasstep1; }
            set { bmhdonemidasstep1 = value; }
        }

        public double Bmhdonemidasstep2
        {
            get { return bmhdonemidasstep2; }
            set { bmhdonemidasstep2 = value; }
        }

        public double Lmiid
        {
            get { return lmiid; }
            set { lmiid = value; }
        }

        public double Bmhhold
        {
            get { return bmhhold; }
            set { bmhhold = value; }
        }

        public double Bmhbatchmidas
        {
            get { return bmhbatchmidas; }
            set { bmhbatchmidas = value; }
        }

        public DateTime Headervaluedateordinal
        {
            get { return headervaluedateordinal; }
            set { headervaluedateordinal = value; }
        }

        public double Sunid
        {
            get { return sunid; }
            set { sunid = value; }
        }

        public string Bradid
        {
            get { return bradid; }
            set { bradid = value; }
        }

        public double Bmhid
        {
            get { return bmhid; }
            set { bmhid = value; }
        }

        public string Bmdrubirique
        {
            get { return bmdrubirique; }
            set { bmdrubirique = value; }
        }

        public string Bmdclient
        {
            get { return bmdclient; }
            set { bmdclient = value; }
        }

        public string Bmdsequence
        {
            get { return bmdsequence; }
            set { bmdsequence = value; }
        }

        public DateTime Bmddate
        {
            get { return bmddate; }
            set { bmddate = value; }
        }

        public string Bmddevise
        {
            get { return bmddevise; }
            set { bmddevise = value; }
        }

        public double Bmdmontant
        {
            get { return bmdmontant; }
            set { bmdmontant = value; }
        }

        public string Bmdtype
        {
            get { return bmdtype; }
            set { bmdtype = value; }
        }

        public string Bmdnote
        {
            get { return bmdnote; }
            set { bmdnote = value; }
        }

        public string Bmdentrynbre
        {
            get { return bmdentrynbre; }
            set { bmdentrynbre = value; }
        }

        public double Devdecimalordinal
        {
            get { return devdecimalordinal; }
            set { devdecimalordinal = value; }
        }

        public double Typverifcomptemidasordinal
        {
            get { return typverifcomptemidasordinal; }
            set { typverifcomptemidasordinal = value; }
        }

Now when I execute the query into a list using dapper

Connection conn = new Connection();
 OracleConnection connection = conn.GetDBConnection();
  myList= connection.Query<Batch>(querySql).ToList();

Now,while debugging, all fields returns the expected values .But, I noticed  those fields below  are null in myList not empty but really null , but the problem is they aren't null in the database

Bmdrubirique , Sunid, Bmdentrynbre, Bradid ,Cenid

In oracle database those fields are like the following :

CENID is VARCHAR2(3 BYTE)`
Bmhid is VARCHAR2(3 BYTE)
Sunid is NUMBER(38,0)
Bradid is VARCHAR2(3 BYTE)

I don't get it , where did it go wrong? why other fields are properly loaded while those returns null value ?

Body:
My default assumption would be that there is a typo in the real code and the constructor is assigning a value from a field to itself. However, frankly: since you have a public Batch() {} constructor, I'm not sure what the benefit of the second one is - it just adds risk of errors. Likewise with the fields and manual properties.

So if this as me, where you currently have (simplified to two properties):

public class Batch
{
    private string cendid;
    private string bmhfmc;
    public Batch() {}
    public Batch(string cendid, string bmhfmc)
    {
        this.cendid = cendid;
        this.bmhfmc = bmhfmc;
    }

    public string Cendid
    {
        get { return cendid; }
        set { cendid = value; }
    }

    public string Bmhfmc
    {
        get { return bmhfmc; }
        set { bmhfmc = value; }
    }
}

I would have literally just:

public class Batch
{
    public string Cendid {get;set;}
    public string Bmhfmc {get;set;}
}

All of the rest of the code is just opportunities to make coding errors.

Now: the reason that Cendid is null is because: the column is CENID - only one d. This means that dapper isn't even using your custom constructor, because it isn't a perfect match between the constructor and the columns. Ditto the other fields like BRAID vs BRADID.

So the next thing to do is to fix the typos.