问:
How To make 2 or more tables From one JSON data
I am working on creating dynamic HTML table from JSON Data, I have already created the table dynamically but now I have to Change it with new Requirement

What I am doing

I have array of objects from which i am creating the table and spiting the table into four columns by dividing the length of JSON to 4

My table is rendering perfectly into 4 columns

What I am trying to Do

I want to show only 5 Rows in a single go then reloads the div and render the next five rows in same dive and so on until all data gets render

Currently I have 68 total data so i am populating it as 17 rows of 4 columns

Now on one go when page lodes I want to show 5 rows then after 5 seconds Next 5 rows in same div

In simple terms I want to split my JSON data into part of 5-5 rows and show only 5 rows at once then next five after 5 seconds

Spiting the Table into Four Columns I have done already,now just want to Show only five rows at a time

I am lacking with idea or approach how to do this, How can i divide my JSON in five-five rows and show them at each time interval of 5 seconds

What I am have done

var tableValue = [{
  "Item Name": "MANCHOW  V SOUP",
  "SellingPrice": 100
}, {
  "Item Name": "MANCHOW NV SOUP ",
  "SellingPrice": 125
}, {
  "Item Name": "CEASER SALAD V",
  "SellingPrice": 175
}, {
  "Item Name": "CEASER SALAD NV",
  "SellingPrice": 230
}, {
  "Item Name": "GAMBUS REBOZADAS",
  "SellingPrice": 350
}, {
  "Item Name": "PANCO FISH FINGER",
  "SellingPrice": 270
}, {
  "Item Name": "MUSHROOM DUPLEX",
  "SellingPrice": 160
}, {
  "Item Name": "FRENCH FRIES",
  "SellingPrice": 99
}, {
  "Item Name": "HONEY GARLIC PRAWN",
  "SellingPrice": 350
}, {
  "Item Name": "CHICKEN MANCHURIAN",
  "SellingPrice": 180
}, {
  "Item Name": "MUSHROOM CHILLY",
  "SellingPrice": 120
}, {
  "Item Name": "SALT N PEPPER BABY CORN",
  "SellingPrice": 120
}, {
  "Item Name": "SOUTHERN STYLE CHICKEN",
  "SellingPrice": 210
}, {
  "Item Name": "PANEER NAGGETS",
  "SellingPrice": 210
}, {
  "Item Name": "HARA BHARA KEBAB",
  "SellingPrice": 160
}, {
  "Item Name": "CHICKEN TIKKA",
  "SellingPrice": 210
}, {
  "Item Name": "KALMI KEBAB",
  "SellingPrice": 250
}, {
  "Item Name": "PIZZA MARGARITTA",
  "SellingPrice": 200
}, {
  "Item Name": "PIZZA VEG FARMHOUSE",
  "SellingPrice": 200
}, {
  "Item Name": "BBQ CHICKEN PIZZA",
  "SellingPrice": 225
}, {
  "Item Name": "CHICKEN TIKKA PIZZA",
  "SellingPrice": 225
}, {
  "Item Name": "PESTO SAUCE",
  "SellingPrice": 175
}, {
  "Item Name": "ARABIATA",
  "SellingPrice": 160
}, {
  "Item Name": "PINK SAUCE",
  "SellingPrice": 160
}, {
  "Item Name": "GARBANZO BEAN SALAD",
  "SellingPrice": 90
}, {
  "Item Name": "MASALA PAPAD",
  "SellingPrice": 50
}, {
  "Item Name": "PEANUT MASALA",
  "SellingPrice": 60
}, {
  "Item Name": "GAJAR KA HALWA",
  "SellingPrice": 90
}, {
  "Item Name": "WATERMELON MARTINI",
  "SellingPrice": 281
}, {
  "Item Name": "Kiwi martini",
  "SellingPrice": 281
}, {
  "Item Name": " Apple gin",
  "SellingPrice": 225
}, {
  "Item Name": "Cucumber  cooler ",
  "SellingPrice": 281
}, {
  "Item Name": "Martini",
  "SellingPrice": 225
}, {
  "Item Name": "Pink lady",
  "SellingPrice": 225
}, {
  "Item Name": " Bloody marry",
  "SellingPrice": 281
}, {
  "Item Name": "Cosmopolitan",
  "SellingPrice": 281
}, {
  "Item Name": "Sex on the beach",
  "SellingPrice": 281
}, {
  "Item Name": "Bull frog",
  "SellingPrice": 506
}, {
  "Item Name": "Long  island iced tea ",
  "SellingPrice": 393
}, {
  "Item Name": "Pinacolada",
  "SellingPrice": 225
}, {
  "Item Name": "Daiquiri",
  "SellingPrice": 225
}, {
  "Item Name": "Mojito ",
  "SellingPrice": 281
}, {
  "Item Name": "Whisky sour",
  "SellingPrice": 281
}, {
  "Item Name": "Hot toddy",
  "SellingPrice": 225
}, {
  "Item Name": "Margarita",
  "SellingPrice": 337
}, {
  "Item Name": "Tequila sunrise",
  "SellingPrice": 337
}, {
  "Item Name": "Red sangria",
  "SellingPrice": 225
}, {
  "Item Name": "White sangria",
  "SellingPrice": 247
}, {
  "Item Name": "Rose sangria",
  "SellingPrice": 247
}, {
  "Item Name": "By chance special ",
  "SellingPrice": 168
}, {
  "Item Name": "Made in heaven",
  "SellingPrice": 168
}, {
  "Item Name": "Strawberry delight",
  "SellingPrice": 168
}, {
  "Item Name": "DRAGON",
  "SellingPrice": 168
}, {
  "Item Name": "Mangochil ",
  "SellingPrice": 168
}, {
  "Item Name": "Cucumber cola",
  "SellingPrice": 168
}, {
  "Item Name": "Virgin mojito",
  "SellingPrice": 168
}, {
  "Item Name": "Virgin mary",
  "SellingPrice": 168
}, {
  "Item Name": "Virgin pinacolada",
  "SellingPrice": 168
}, {
  "Item Name": "CORONA",
  "SellingPrice": 438
}, {
  "Item Name": "CRAFT BEERS",
  "SellingPrice": 337
}, {
  "Item Name": "BIRA WHITE 330",
  "SellingPrice": 157
}, {
  "Item Name": "BIRA BLONDE 330",
  "SellingPrice": 135
}, {
  "Item Name": "BIRA STRONG 650",
  "SellingPrice": 213
}, {
  "Item Name": "KINGFISHER PREMIUM 330",
  "SellingPrice": 123
}, {
  "Item Name": "KINGFISHER PREMIUM 650",
  "SellingPrice": 202
}, {
  "Item Name": "KINGFISHER STRONG 330",
  "SellingPrice": 135
}, {
  "Item Name": "KINGFISHER STRONG 650",
  "SellingPrice": 213
}, {
  "Item Name": "KINGFISHER ULTRA 330",
  "SellingPrice": 146
}, {
  "Item Name": "KINGFISHER ULTRA 650",
  "SellingPrice": 281
}, {
  "Item Name": "KINGFISHER ULTRA MAX 330",
  "SellingPrice": 146
}, {
  "Item Name": "KINGFISHER ULTRA MAX 650",
  "SellingPrice": 281
}, {
  "Item Name": "BUDWIESER 330",
  "SellingPrice": 146
}, {
  "Item Name": "BUDWIESER 650",
  "SellingPrice": 270
}, {
  "Item Name": "BUDWIESER MAGNUM 330",
  "SellingPrice": 168
}, {
  "Item Name": "BUDWIESER MAGNUM 650",
  "SellingPrice": 281
}, {
  "Item Name": "TUBORG 330",
  "SellingPrice": 123
}, {
  "Item Name": "TUBORG 650",
  "SellingPrice": 191
}, {
  "Item Name": "TUBORG STRONG 330",
  "SellingPrice": 123
}, {
  "Item Name": "TUBORG STRONG 650",
  "SellingPrice": 213
}, {
  "Item Name": "CRANBERRY ",
  "SellingPrice": 157
}, {
  "Item Name": "ORANGE",
  "SellingPrice": 157
}, {
  "Item Name": "JAMICAN",
  "SellingPrice": 157
}, {
  "Item Name": "BLACK BERRY",
  "SellingPrice": 157
}, {
  "Item Name": "BLUE BERRY",
  "SellingPrice": 157
}, {
  "Item Name": "MOET CHANDON",
  "SellingPrice": 7875
}, {
  "Item Name": "SULA BRUT",
  "SellingPrice": 1687
}, {
  "Item Name": "MATEUS ROSE",
  "SellingPrice": 2137
}, {
  "Item Name": "HARDYS SIRAZ CABERNET 750",
  "SellingPrice": 1890
}, {
  "Item Name": "HARDYS SIRAZ CABERNET BY GLASS",
  "SellingPrice": 382
}, {
  "Item Name": "JACOB CREEK SIRAZ 750",
  "SellingPrice": 1800
}, {
  "Item Name": "JACOB CREEK SIRAZ BY GLASS",
  "SellingPrice": 360
}, {
  "Item Name": "BIG BANAYAN CHENNIN BLANC 750",
  "SellingPrice": 990
}, {
  "Item Name": "BIG BANAYAN CHENNIN BLANC BY GLASS",
  "SellingPrice": 202
}, {
  "Item Name": "SULA CHENIN BLANC 750 ",
  "SellingPrice": 1293
}, {
  "Item Name": "SULA CHENIN BLANC BY GLASS",
  "SellingPrice": 258
}, {
  "Item Name": "FOUR SEAZON CLASSIC CHENNIN BLANC 750",
  "SellingPrice": 1125
}, {
  "Item Name": "FOUR SEAZON CLASSIC CHENNIN BLANC BY GLASS",
  "SellingPrice": 225
}, {
  "Item Name": "BIG BANAYAN CARBINET SAUVIGNON 750",
  "SellingPrice": 1125
}, {
  "Item Name": "BIG BANAYAN CARBINET SAUVIGNON BY GLASS",
  "SellingPrice": 225
}, {
  "Item Name": "SULA SATORI MERLOT 750",
  "SellingPrice": 1237
}, {
  "Item Name": "SULA SATORI MERLOT BY GLASS",
  "SellingPrice": 247
}, {
  "Item Name": "GROVERS LA RESERVE 750",
  "SellingPrice": 1800
}, {
  "Item Name": "GROVERS LA RESERVE 100",
  "SellingPrice": 360
}, {
  "Item Name": "GLENFIDDICH 12 YEARS 700 ",
  "SellingPrice": 9225
}, {
  "Item Name": "GLENFIDDICH 12 YEARS 30",
  "SellingPrice": 405
}, {
  "Item Name": "TALISKER 750",
  "SellingPrice": 8775
}, {
  "Item Name": "TALISKER 30",
  "SellingPrice": 360
}, {
  "Item Name": "GLENNLIVET 750",
  "SellingPrice": 8887
}, {
  "Item Name": "GLENNLIVET 30",
  "SellingPrice": 360
}, {
  "Item Name": "THE SINGLETON 750",
  "SellingPrice": 7942
}, {
  "Item Name": "THE SINGLETON 30",
  "SellingPrice": 326
}, {
  "Item Name": "AMRUT FUSION 750",
  "SellingPrice": 5062
}, {
  "Item Name": "AMRUT FUSION 30",
  "SellingPrice": 202
}, {
  "Item Name": "JACK DANIELS 750",
  "SellingPrice": 7312
}, {
  "Item Name": "JACK DANIELS 30",
  "SellingPrice": 292
}, {
  "Item Name": "JIM BEAM WHITE 750",
  "SellingPrice": 4095
}, {
  "Item Name": "JIM BEAM WHITE 30",
  "SellingPrice": 168
}, {
  "Item Name": "JAMESON 750",
  "SellingPrice": 4950
}, {
  "Item Name": "JAMESON 30",
  "SellingPrice": 202
}, {
  "Item Name": "JW BLACK LABEL 750",
  "SellingPrice": 8212
}, {
  "Item Name": "JW BLACK LABEL 200",
  "SellingPrice": 2925
}, {
  "Item Name": "JW BLACK LABEL 30",
  "SellingPrice": 337
}, {
  "Item Name": "JW RED LABEL 200",
  "SellingPrice": 1158
}, {
  "Item Name": "BALLENTINSE FINEST BLENDED 750",
  "SellingPrice": 4545
}, {
  "Item Name": "BALLENTINSE FINEST BLENDED 30",
  "SellingPrice": 180
}, {
  "Item Name": "BLACK \u0026 WHITE 375",
  "SellingPrice": 1575
}, {
  "Item Name": "BLACK \u0026 WHITE 180",
  "SellingPrice": 787
}, {
  "Item Name": "BLACK \u0026 WHITE 60",
  "SellingPrice": 258
}, {
  "Item Name": "BLACK \u0026 WHITE 30",
  "SellingPrice": 135
}, {
  "Item Name": "100 PIPERS 180",
  "SellingPrice": 787
}, {
  "Item Name": "100 PIPERS 60",
  "SellingPrice": 258
}, {
  "Item Name": "100 PIPERS 30",
  "SellingPrice": 135
}, {
  "Item Name": "VAT 69 180",
  "SellingPrice": 675
}, {
  "Item Name": "VAT 69 60",
  "SellingPrice": 225
}, {
  "Item Name": "VAT 69 30",
  "SellingPrice": 112
}, {
  "Item Name": "TEACHERS HIGHLAND 180",
  "SellingPrice": 787
}, {
  "Item Name": "TEACHERS HIGHLAND 60",
  "SellingPrice": 258
}, {
  "Item Name": "TEACHERS HIGHLAND 30",
  "SellingPrice": 135
}, {
  "Item Name": "TEACHERS 50 60",
  "SellingPrice": 393
}, {
  "Item Name": "TEACHERS 50 30",
  "SellingPrice": 202
}, {
  "Item Name": "BLACK DOG TRIPPLE GOLD 180",
  "SellingPrice": 1215
}, {
  "Item Name": "BLACK DOG TRIPPLE GOLD 30",
  "SellingPrice": 213
}, {
  "Item Name": "BLACK DOG 8 YEARS 180",
  "SellingPrice": 731
}, {
  "Item Name": "BLACK DOG 8 YEARS 60",
  "SellingPrice": 247
}, {
  "Item Name": "BLACK DOG 8 YEARS 30",
  "SellingPrice": 123
}, {
  "Item Name": "BLENDERS PRIDE 750",
  "SellingPrice": 2283
}, {
  "Item Name": "BLENDERS PRIDE 375",
  "SellingPrice": 1147
}, {
  "Item Name": "BLENDERS PRIDE 180",
  "SellingPrice": 573
}, {
  "Item Name": "BLENDERS PRIDE 60",
  "SellingPrice": 191
}, {
  "Item Name": "BLENDERS PRIDE 30",
  "SellingPrice": 90
}, {
  "Item Name": "SIGNATURE 180",
  "SellingPrice": 450
}, {
  "Item Name": "SIGNATURE 60",
  "SellingPrice": 168
}, {
  "Item Name": "SIGNATURE 30",
  "SellingPrice": 90
}, {
  "Item Name": "GREY GOOSE 750",
  "SellingPrice": 8190
}, {
  "Item Name": "GREY GOOSE 30",
  "SellingPrice": 326
}, {
  "Item Name": "BELVEDERE 700",
  "SellingPrice": 8122
}, {
  "Item Name": "BELVEDERE 30",
  "SellingPrice": 360
}, {
  "Item Name": "CIROC 750",
  "SellingPrice": 7425
}, {
  "Item Name": "CIROC 30",
  "SellingPrice": 303
}, {
  "Item Name": "ABSOLUT 750",
  "SellingPrice": 4556
}, {
  "Item Name": "ABSOLUT 30",
  "SellingPrice": 191
}, {
  "Item Name": "SMIRNOFF RED 180",
  "SellingPrice": 551
}, {
  "Item Name": "SMIRNOFF RED 60",
  "SellingPrice": 202
}, {
  "Item Name": "SMIRNOFF RED30",
  "SellingPrice": 101
}, {
  "Item Name": "SMIRNOFF ORANGE 180",
  "SellingPrice": 551
}, {
  "Item Name": "SMIRNOFF ORANGE 60",
  "SellingPrice": 202
}, {
  "Item Name": "SMINOFF ORANGE30",
  "SellingPrice": 101
}, {
  "Item Name": "SMIRNOFF GREEN APPLE 180",
  "SellingPrice": 551
}, {
  "Item Name": "SMIRNOFF GREEN APPLE 60",
  "SellingPrice": 202
}, {
  "Item Name": "SMIRNOFF GREEN APPLE30",
  "SellingPrice": 101
}, {
  "Item Name": "BOMBAY SAPHIRE 750",
  "SellingPrice": 4725
}, {
  "Item Name": "BOMBAY SAPHIRE 30",
  "SellingPrice": 191
}, {
  "Item Name": "BLUE RIBBAND 750",
  "SellingPrice": 877
}, {
  "Item Name": "BLUE RIBBAND 60",
  "SellingPrice": 78
}, {
  "Item Name": "BACCARDI WHITE 750",
  "SellingPrice": 2418
}, {
  "Item Name": "BACCARDI WHITE 180",
  "SellingPrice": 585
}, {
  "Item Name": "BACCARDI WHITE 60",
  "SellingPrice": 202
}, {
  "Item Name": "BACCARDI WHITE 30",
  "SellingPrice": 101
}, {
  "Item Name": "BACCARDI LEMON 180",
  "SellingPrice": 585
}, {
  "Item Name": "BACCARDI LEMON 60",
  "SellingPrice": 202
}, {
  "Item Name": "BACCARDI LEMON 30",
  "SellingPrice": 101
}, {
  "Item Name": "BACCARDI ORANGE 180",
  "SellingPrice": 585
}, {
  "Item Name": "BACCARDI ORANGE 60",
  "SellingPrice": 202
}, {
  "Item Name": "BACCARDI LEMON 30",
  "SellingPrice": 101
}, {
  "Item Name": "BACCARDI BLACK 180",
  "SellingPrice": 393
}, {
  "Item Name": "BACCARDI BLACK 30",
  "SellingPrice": 67
}, {
  "Item Name": "BACCARDI GOLD 180",
  "SellingPrice": 585
}, {
  "Item Name": "BACCARDI GOLD30",
  "SellingPrice": 101
}, {
  "Item Name": "OLD MONK 180",
  "SellingPrice": 225
}, {
  "Item Name": "OLD MONK 90",
  "SellingPrice": 168
}, {
  "Item Name": "OLD MONK 60",
  "SellingPrice": 90
}, {
  "Item Name": "OLD MONK 30 ",
  "SellingPrice": 45
}, {
  "Item Name": "DON ANGEL 750",
  "SellingPrice": 4668
}, {
  "Item Name": "DON ANGEL 30",
  "SellingPrice": 191
}, {
  "Item Name": "SAUZA SILVER 700",
  "SellingPrice": 6153
}, {
  "Item Name": "SAUZA SILVER 30",
  "SellingPrice": 270
}, {
  "Item Name": "JAGERBOMB",
  "SellingPrice": 506
}, {
  "Item Name": "KAMAKAZI",
  "SellingPrice": 168
}, {
  "Item Name": "JAGERMASTER",
  "SellingPrice": 303
}, {
  "Item Name": "COINTTRAEU",
  "SellingPrice": 303
}, {
  "Item Name": "SAMBUCA",
  "SellingPrice": 258
}, {
  "Item Name": "KHALUA",
  "SellingPrice": 168
}, {
  "Item Name": "MARTINI BLANCO",
  "SellingPrice": 90
}, {
  "Item Name": "MARTINI ROSSO",
  "SellingPrice": 90
}, {
  "Item Name": "HENESSY VS 700",
  "SellingPrice": 7875
}, {
  "Item Name": "HENESSY VS 30",
  "SellingPrice": 348
}, {
  "Item Name": "MORPHEUS 750",
  "SellingPrice": 2182
}, {
  "Item Name": "MORPHEUS 180",
  "SellingPrice": 540
}, {
  "Item Name": "MORPHEUS 60",
  "SellingPrice": 191
}, {
  "Item Name": "MORPHEUS 30",
  "SellingPrice": 101
}, {
  "Item Name": "MANSION HOUSE 180",
  "SellingPrice": 292
}, {
  "Item Name": "MANSION HOUSE 90",
  "SellingPrice": 168
}, {
  "Item Name": "MANSION HOUSE 60",
  "SellingPrice": 90
}, {
  "Item Name": "MC BRANDY 60",
  "SellingPrice": 90
}, {
  "Item Name": "RED BULL ",
  "SellingPrice": 157
}, {
  "Item Name": "COKE",
  "SellingPrice": 45
}, {
  "Item Name": "SPRITE",
  "SellingPrice": 45
}, {
  "Item Name": "SODA",
  "SellingPrice": 33
}, {
  "Item Name": "DIET COKE",
  "SellingPrice": 56
}, {
  "Item Name": "TONIC WATER",
  "SellingPrice": 67
}, {
  "Item Name": "GINGER ALE",
  "SellingPrice": 67
}, {
  "Item Name": "LIME SODA",
  "SellingPrice": 45
}, {
  "Item Name": "LIME WATER",
  "SellingPrice": 45
}, {
  "Item Name": "PACKEGED WATER 1L",
  "SellingPrice": 39
}, {
  "Item Name": "MANSION HOUSE 650",
  "SellingPrice": 900
}, {
  "Item Name": "Chole Kulche",
  "SellingPrice": 80
}, {
  "Item Name": "Butter Nan",
  "SellingPrice": 65
}, {
  "Item Name": "Dhai",
  "SellingPrice": 20
}, {
  "Item Name": "Rice",
  "SellingPrice": 55
}, {
  "Item Name": "Plain rice",
  "SellingPrice": 30
}, {
  "Item Name": "MANSION HOUSE 650",
  "SellingPrice": 900
}, {
  "Item Name": "Chole Kulche",
  "SellingPrice": 80
}, {
  "Item Name": "Butter Nan",
  "SellingPrice": 65
}, {
  "Item Name": "Dhai",
  "SellingPrice": 20
}, {
  "Item Name": "Rice",
  "SellingPrice": 55
}, {
  "Item Name": "Plain rice",
  "SellingPrice": 30
}]

myFun();
window.setInterval(showRows, 5000);
showRows();

function myFun() {
  addTable(tableValue);
}

function showRows() {
  $(".hidden:lt(10)").removeClass("hidden");
}

function addTable(tableValue) {
  var $tbl = $("
", {
      "class": "table"
    }),

    $tb = $("
"),
    $trh = $("
");

  var split = Math.round(tableValue.length / 4);
  for (i = 0; i < split; i++) {
    $tr = $("
", {
      class: "hidden"
    });
    for (j = 0; j < 4; j++) {
      $.each(tableValue[split * j + i], function(key, value) {

        $("", {
          "class": "text-left color" + (j + 1)
        }).html(value).appendTo($tr);
      });
    }
    $tr.appendTo($tb);
  }
  $tbl.append($tb);
  $("#DisplayTable").html($tbl);
}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>tbody>tr>td {
  white-space: nowrap;
  border-collapse: collapse;
  font-family: Verdana;
  font-size: 8pt;
  font-weight: bold;
  white-space: nowrap;
}

.color1 {
  background: #4AD184;
}

.color2 {
  background: #EA69EF;
}

.color3 {
  background: #E1A558;
}

.color4 {
  background: #F4F065;
}</code>```

<link rel="stylesheet" href="//stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css">

```

Edit
I have tried @Void's solution but that is not removing the hidden class,when I inspect the element then there is no class applied to tr it is showing as class=""

答:
Create empty HTML table with 4 rows and give unique ID to each field "field0", "field1"...

Than you can make function to populate those field after specific time. At the end it would look something like this:

```<code>var data = [
    {
        name: "test data 0"
    },
    {
        name: "test data 1"
    }
]; //Your data
var currentField = 0; //Current offset for the field

$(function() { //When document loads
    showNext(); //Populate first 4 fields
    setInterval(showNext, 4000); //Set up "timer" to populate new ones on every 4 seconds
});

function showNext(){
    for(let i = 0; i < 4; i++){
        $("#column" + i + " #field0").text = data[i + currentField].name;
        $("#column" + i + " #field1").text = data[i + currentField].price;
        currentField++;
    }
}
</code>```

Body:
I am working on creating dynamic HTML table from JSON Data, I have already created the table dynamically but now I have to Change it with new Requirement

What I am doing

I have array of objects from which i am creating the table and spiting the table into four columns by dividing the length of JSON to 4

My table is rendering perfectly into 4 columns

What I am trying to Do

I want to show only 5 Rows in a single go then reloads the div and render the next five rows in same dive and so on until all data gets render

Currently I have 68 total data so i am populating it as 17 rows of 4 columns

Now on one go when page lodes I want to show 5 rows then after 5 seconds Next 5 rows in same div

In simple terms I want to split my JSON data into part of 5-5 rows and show only 5 rows at once then next five after 5 seconds

Spiting the Table into Four Columns I have done already,now just want to Show only five rows at a time

I am lacking with idea or approach how to do this, How can i divide my JSON in five-five rows and show them at each time interval of 5 seconds

What I am have done

var tableValue = [{
  "Item Name": "MANCHOW  V SOUP",
  "SellingPrice": 100
}, {
  "Item Name": "MANCHOW NV SOUP ",
  "SellingPrice": 125
}, {
  "Item Name": "CEASER SALAD V",
  "SellingPrice": 175
}, {
  "Item Name": "CEASER SALAD NV",
  "SellingPrice": 230
}, {
  "Item Name": "GAMBUS REBOZADAS",
  "SellingPrice": 350
}, {
  "Item Name": "PANCO FISH FINGER",
  "SellingPrice": 270
}, {
  "Item Name": "MUSHROOM DUPLEX",
  "SellingPrice": 160
}, {
  "Item Name": "FRENCH FRIES",
  "SellingPrice": 99
}, {
  "Item Name": "HONEY GARLIC PRAWN",
  "SellingPrice": 350
}, {
  "Item Name": "CHICKEN MANCHURIAN",
  "SellingPrice": 180
}, {
  "Item Name": "MUSHROOM CHILLY",
  "SellingPrice": 120
}, {
  "Item Name": "SALT N PEPPER BABY CORN",
  "SellingPrice": 120
}, {
  "Item Name": "SOUTHERN STYLE CHICKEN",
  "SellingPrice": 210
}, {
  "Item Name": "PANEER NAGGETS",
  "SellingPrice": 210
}, {
  "Item Name": "HARA BHARA KEBAB",
  "SellingPrice": 160
}, {
  "Item Name": "CHICKEN TIKKA",
  "SellingPrice": 210
}, {
  "Item Name": "KALMI KEBAB",
  "SellingPrice": 250
}, {
  "Item Name": "PIZZA MARGARITTA",
  "SellingPrice": 200
}, {
  "Item Name": "PIZZA VEG FARMHOUSE",
  "SellingPrice": 200
}, {
  "Item Name": "BBQ CHICKEN PIZZA",
  "SellingPrice": 225
}, {
  "Item Name": "CHICKEN TIKKA PIZZA",
  "SellingPrice": 225
}, {
  "Item Name": "PESTO SAUCE",
  "SellingPrice": 175
}, {
  "Item Name": "ARABIATA",
  "SellingPrice": 160
}, {
  "Item Name": "PINK SAUCE",
  "SellingPrice": 160
}, {
  "Item Name": "GARBANZO BEAN SALAD",
  "SellingPrice": 90
}, {
  "Item Name": "MASALA PAPAD",
  "SellingPrice": 50
}, {
  "Item Name": "PEANUT MASALA",
  "SellingPrice": 60
}, {
  "Item Name": "GAJAR KA HALWA",
  "SellingPrice": 90
}, {
  "Item Name": "WATERMELON MARTINI",
  "SellingPrice": 281
}, {
  "Item Name": "Kiwi martini",
  "SellingPrice": 281
}, {
  "Item Name": " Apple gin",
  "SellingPrice": 225
}, {
  "Item Name": "Cucumber  cooler ",
  "SellingPrice": 281
}, {
  "Item Name": "Martini",
  "SellingPrice": 225
}, {
  "Item Name": "Pink lady",
  "SellingPrice": 225
}, {
  "Item Name": " Bloody marry",
  "SellingPrice": 281
}, {
  "Item Name": "Cosmopolitan",
  "SellingPrice": 281
}, {
  "Item Name": "Sex on the beach",
  "SellingPrice": 281
}, {
  "Item Name": "Bull frog",
  "SellingPrice": 506
}, {
  "Item Name": "Long  island iced tea ",
  "SellingPrice": 393
}, {
  "Item Name": "Pinacolada",
  "SellingPrice": 225
}, {
  "Item Name": "Daiquiri",
  "SellingPrice": 225
}, {
  "Item Name": "Mojito ",
  "SellingPrice": 281
}, {
  "Item Name": "Whisky sour",
  "SellingPrice": 281
}, {
  "Item Name": "Hot toddy",
  "SellingPrice": 225
}, {
  "Item Name": "Margarita",
  "SellingPrice": 337
}, {
  "Item Name": "Tequila sunrise",
  "SellingPrice": 337
}, {
  "Item Name": "Red sangria",
  "SellingPrice": 225
}, {
  "Item Name": "White sangria",
  "SellingPrice": 247
}, {
  "Item Name": "Rose sangria",
  "SellingPrice": 247
}, {
  "Item Name": "By chance special ",
  "SellingPrice": 168
}, {
  "Item Name": "Made in heaven",
  "SellingPrice": 168
}, {
  "Item Name": "Strawberry delight",
  "SellingPrice": 168
}, {
  "Item Name": "DRAGON",
  "SellingPrice": 168
}, {
  "Item Name": "Mangochil ",
  "SellingPrice": 168
}, {
  "Item Name": "Cucumber cola",
  "SellingPrice": 168
}, {
  "Item Name": "Virgin mojito",
  "SellingPrice": 168
}, {
  "Item Name": "Virgin mary",
  "SellingPrice": 168
}, {
  "Item Name": "Virgin pinacolada",
  "SellingPrice": 168
}, {
  "Item Name": "CORONA",
  "SellingPrice": 438
}, {
  "Item Name": "CRAFT BEERS",
  "SellingPrice": 337
}, {
  "Item Name": "BIRA WHITE 330",
  "SellingPrice": 157
}, {
  "Item Name": "BIRA BLONDE 330",
  "SellingPrice": 135
}, {
  "Item Name": "BIRA STRONG 650",
  "SellingPrice": 213
}, {
  "Item Name": "KINGFISHER PREMIUM 330",
  "SellingPrice": 123
}, {
  "Item Name": "KINGFISHER PREMIUM 650",
  "SellingPrice": 202
}, {
  "Item Name": "KINGFISHER STRONG 330",
  "SellingPrice": 135
}, {
  "Item Name": "KINGFISHER STRONG 650",
  "SellingPrice": 213
}, {
  "Item Name": "KINGFISHER ULTRA 330",
  "SellingPrice": 146
}, {
  "Item Name": "KINGFISHER ULTRA 650",
  "SellingPrice": 281
}, {
  "Item Name": "KINGFISHER ULTRA MAX 330",
  "SellingPrice": 146
}, {
  "Item Name": "KINGFISHER ULTRA MAX 650",
  "SellingPrice": 281
}, {
  "Item Name": "BUDWIESER 330",
  "SellingPrice": 146
}, {
  "Item Name": "BUDWIESER 650",
  "SellingPrice": 270
}, {
  "Item Name": "BUDWIESER MAGNUM 330",
  "SellingPrice": 168
}, {
  "Item Name": "BUDWIESER MAGNUM 650",
  "SellingPrice": 281
}, {
  "Item Name": "TUBORG 330",
  "SellingPrice": 123
}, {
  "Item Name": "TUBORG 650",
  "SellingPrice": 191
}, {
  "Item Name": "TUBORG STRONG 330",
  "SellingPrice": 123
}, {
  "Item Name": "TUBORG STRONG 650",
  "SellingPrice": 213
}, {
  "Item Name": "CRANBERRY ",
  "SellingPrice": 157
}, {
  "Item Name": "ORANGE",
  "SellingPrice": 157
}, {
  "Item Name": "JAMICAN",
  "SellingPrice": 157
}, {
  "Item Name": "BLACK BERRY",
  "SellingPrice": 157
}, {
  "Item Name": "BLUE BERRY",
  "SellingPrice": 157
}, {
  "Item Name": "MOET CHANDON",
  "SellingPrice": 7875
}, {
  "Item Name": "SULA BRUT",
  "SellingPrice": 1687
}, {
  "Item Name": "MATEUS ROSE",
  "SellingPrice": 2137
}, {
  "Item Name": "HARDYS SIRAZ CABERNET 750",
  "SellingPrice": 1890
}, {
  "Item Name": "HARDYS SIRAZ CABERNET BY GLASS",
  "SellingPrice": 382
}, {
  "Item Name": "JACOB CREEK SIRAZ 750",
  "SellingPrice": 1800
}, {
  "Item Name": "JACOB CREEK SIRAZ BY GLASS",
  "SellingPrice": 360
}, {
  "Item Name": "BIG BANAYAN CHENNIN BLANC 750",
  "SellingPrice": 990
}, {
  "Item Name": "BIG BANAYAN CHENNIN BLANC BY GLASS",
  "SellingPrice": 202
}, {
  "Item Name": "SULA CHENIN BLANC 750 ",
  "SellingPrice": 1293
}, {
  "Item Name": "SULA CHENIN BLANC BY GLASS",
  "SellingPrice": 258
}, {
  "Item Name": "FOUR SEAZON CLASSIC CHENNIN BLANC 750",
  "SellingPrice": 1125
}, {
  "Item Name": "FOUR SEAZON CLASSIC CHENNIN BLANC BY GLASS",
  "SellingPrice": 225
}, {
  "Item Name": "BIG BANAYAN CARBINET SAUVIGNON 750",
  "SellingPrice": 1125
}, {
  "Item Name": "BIG BANAYAN CARBINET SAUVIGNON BY GLASS",
  "SellingPrice": 225
}, {
  "Item Name": "SULA SATORI MERLOT 750",
  "SellingPrice": 1237
}, {
  "Item Name": "SULA SATORI MERLOT BY GLASS",
  "SellingPrice": 247
}, {
  "Item Name": "GROVERS LA RESERVE 750",
  "SellingPrice": 1800
}, {
  "Item Name": "GROVERS LA RESERVE 100",
  "SellingPrice": 360
}, {
  "Item Name": "GLENFIDDICH 12 YEARS 700 ",
  "SellingPrice": 9225
}, {
  "Item Name": "GLENFIDDICH 12 YEARS 30",
  "SellingPrice": 405
}, {
  "Item Name": "TALISKER 750",
  "SellingPrice": 8775
}, {
  "Item Name": "TALISKER 30",
  "SellingPrice": 360
}, {
  "Item Name": "GLENNLIVET 750",
  "SellingPrice": 8887
}, {
  "Item Name": "GLENNLIVET 30",
  "SellingPrice": 360
}, {
  "Item Name": "THE SINGLETON 750",
  "SellingPrice": 7942
}, {
  "Item Name": "THE SINGLETON 30",
  "SellingPrice": 326
}, {
  "Item Name": "AMRUT FUSION 750",
  "SellingPrice": 5062
}, {
  "Item Name": "AMRUT FUSION 30",
  "SellingPrice": 202
}, {
  "Item Name": "JACK DANIELS 750",
  "SellingPrice": 7312
}, {
  "Item Name": "JACK DANIELS 30",
  "SellingPrice": 292
}, {
  "Item Name": "JIM BEAM WHITE 750",
  "SellingPrice": 4095
}, {
  "Item Name": "JIM BEAM WHITE 30",
  "SellingPrice": 168
}, {
  "Item Name": "JAMESON 750",
  "SellingPrice": 4950
}, {
  "Item Name": "JAMESON 30",
  "SellingPrice": 202
}, {
  "Item Name": "JW BLACK LABEL 750",
  "SellingPrice": 8212
}, {
  "Item Name": "JW BLACK LABEL 200",
  "SellingPrice": 2925
}, {
  "Item Name": "JW BLACK LABEL 30",
  "SellingPrice": 337
}, {
  "Item Name": "JW RED LABEL 200",
  "SellingPrice": 1158
}, {
  "Item Name": "BALLENTINSE FINEST BLENDED 750",
  "SellingPrice": 4545
}, {
  "Item Name": "BALLENTINSE FINEST BLENDED 30",
  "SellingPrice": 180
}, {
  "Item Name": "BLACK \u0026 WHITE 375",
  "SellingPrice": 1575
}, {
  "Item Name": "BLACK \u0026 WHITE 180",
  "SellingPrice": 787
}, {
  "Item Name": "BLACK \u0026 WHITE 60",
  "SellingPrice": 258
}, {
  "Item Name": "BLACK \u0026 WHITE 30",
  "SellingPrice": 135
}, {
  "Item Name": "100 PIPERS 180",
  "SellingPrice": 787
}, {
  "Item Name": "100 PIPERS 60",
  "SellingPrice": 258
}, {
  "Item Name": "100 PIPERS 30",
  "SellingPrice": 135
}, {
  "Item Name": "VAT 69 180",
  "SellingPrice": 675
}, {
  "Item Name": "VAT 69 60",
  "SellingPrice": 225
}, {
  "Item Name": "VAT 69 30",
  "SellingPrice": 112
}, {
  "Item Name": "TEACHERS HIGHLAND 180",
  "SellingPrice": 787
}, {
  "Item Name": "TEACHERS HIGHLAND 60",
  "SellingPrice": 258
}, {
  "Item Name": "TEACHERS HIGHLAND 30",
  "SellingPrice": 135
}, {
  "Item Name": "TEACHERS 50 60",
  "SellingPrice": 393
}, {
  "Item Name": "TEACHERS 50 30",
  "SellingPrice": 202
}, {
  "Item Name": "BLACK DOG TRIPPLE GOLD 180",
  "SellingPrice": 1215
}, {
  "Item Name": "BLACK DOG TRIPPLE GOLD 30",
  "SellingPrice": 213
}, {
  "Item Name": "BLACK DOG 8 YEARS 180",
  "SellingPrice": 731
}, {
  "Item Name": "BLACK DOG 8 YEARS 60",
  "SellingPrice": 247
}, {
  "Item Name": "BLACK DOG 8 YEARS 30",
  "SellingPrice": 123
}, {
  "Item Name": "BLENDERS PRIDE 750",
  "SellingPrice": 2283
}, {
  "Item Name": "BLENDERS PRIDE 375",
  "SellingPrice": 1147
}, {
  "Item Name": "BLENDERS PRIDE 180",
  "SellingPrice": 573
}, {
  "Item Name": "BLENDERS PRIDE 60",
  "SellingPrice": 191
}, {
  "Item Name": "BLENDERS PRIDE 30",
  "SellingPrice": 90
}, {
  "Item Name": "SIGNATURE 180",
  "SellingPrice": 450
}, {
  "Item Name": "SIGNATURE 60",
  "SellingPrice": 168
}, {
  "Item Name": "SIGNATURE 30",
  "SellingPrice": 90
}, {
  "Item Name": "GREY GOOSE 750",
  "SellingPrice": 8190
}, {
  "Item Name": "GREY GOOSE 30",
  "SellingPrice": 326
}, {
  "Item Name": "BELVEDERE 700",
  "SellingPrice": 8122
}, {
  "Item Name": "BELVEDERE 30",
  "SellingPrice": 360
}, {
  "Item Name": "CIROC 750",
  "SellingPrice": 7425
}, {
  "Item Name": "CIROC 30",
  "SellingPrice": 303
}, {
  "Item Name": "ABSOLUT 750",
  "SellingPrice": 4556
}, {
  "Item Name": "ABSOLUT 30",
  "SellingPrice": 191
}, {
  "Item Name": "SMIRNOFF RED 180",
  "SellingPrice": 551
}, {
  "Item Name": "SMIRNOFF RED 60",
  "SellingPrice": 202
}, {
  "Item Name": "SMIRNOFF RED30",
  "SellingPrice": 101
}, {
  "Item Name": "SMIRNOFF ORANGE 180",
  "SellingPrice": 551
}, {
  "Item Name": "SMIRNOFF ORANGE 60",
  "SellingPrice": 202
}, {
  "Item Name": "SMINOFF ORANGE30",
  "SellingPrice": 101
}, {
  "Item Name": "SMIRNOFF GREEN APPLE 180",
  "SellingPrice": 551
}, {
  "Item Name": "SMIRNOFF GREEN APPLE 60",
  "SellingPrice": 202
}, {
  "Item Name": "SMIRNOFF GREEN APPLE30",
  "SellingPrice": 101
}, {
  "Item Name": "BOMBAY SAPHIRE 750",
  "SellingPrice": 4725
}, {
  "Item Name": "BOMBAY SAPHIRE 30",
  "SellingPrice": 191
}, {
  "Item Name": "BLUE RIBBAND 750",
  "SellingPrice": 877
}, {
  "Item Name": "BLUE RIBBAND 60",
  "SellingPrice": 78
}, {
  "Item Name": "BACCARDI WHITE 750",
  "SellingPrice": 2418
}, {
  "Item Name": "BACCARDI WHITE 180",
  "SellingPrice": 585
}, {
  "Item Name": "BACCARDI WHITE 60",
  "SellingPrice": 202
}, {
  "Item Name": "BACCARDI WHITE 30",
  "SellingPrice": 101
}, {
  "Item Name": "BACCARDI LEMON 180",
  "SellingPrice": 585
}, {
  "Item Name": "BACCARDI LEMON 60",
  "SellingPrice": 202
}, {
  "Item Name": "BACCARDI LEMON 30",
  "SellingPrice": 101
}, {
  "Item Name": "BACCARDI ORANGE 180",
  "SellingPrice": 585
}, {
  "Item Name": "BACCARDI ORANGE 60",
  "SellingPrice": 202
}, {
  "Item Name": "BACCARDI LEMON 30",
  "SellingPrice": 101
}, {
  "Item Name": "BACCARDI BLACK 180",
  "SellingPrice": 393
}, {
  "Item Name": "BACCARDI BLACK 30",
  "SellingPrice": 67
}, {
  "Item Name": "BACCARDI GOLD 180",
  "SellingPrice": 585
}, {
  "Item Name": "BACCARDI GOLD30",
  "SellingPrice": 101
}, {
  "Item Name": "OLD MONK 180",
  "SellingPrice": 225
}, {
  "Item Name": "OLD MONK 90",
  "SellingPrice": 168
}, {
  "Item Name": "OLD MONK 60",
  "SellingPrice": 90
}, {
  "Item Name": "OLD MONK 30 ",
  "SellingPrice": 45
}, {
  "Item Name": "DON ANGEL 750",
  "SellingPrice": 4668
}, {
  "Item Name": "DON ANGEL 30",
  "SellingPrice": 191
}, {
  "Item Name": "SAUZA SILVER 700",
  "SellingPrice": 6153
}, {
  "Item Name": "SAUZA SILVER 30",
  "SellingPrice": 270
}, {
  "Item Name": "JAGERBOMB",
  "SellingPrice": 506
}, {
  "Item Name": "KAMAKAZI",
  "SellingPrice": 168
}, {
  "Item Name": "JAGERMASTER",
  "SellingPrice": 303
}, {
  "Item Name": "COINTTRAEU",
  "SellingPrice": 303
}, {
  "Item Name": "SAMBUCA",
  "SellingPrice": 258
}, {
  "Item Name": "KHALUA",
  "SellingPrice": 168
}, {
  "Item Name": "MARTINI BLANCO",
  "SellingPrice": 90
}, {
  "Item Name": "MARTINI ROSSO",
  "SellingPrice": 90
}, {
  "Item Name": "HENESSY VS 700",
  "SellingPrice": 7875
}, {
  "Item Name": "HENESSY VS 30",
  "SellingPrice": 348
}, {
  "Item Name": "MORPHEUS 750",
  "SellingPrice": 2182
}, {
  "Item Name": "MORPHEUS 180",
  "SellingPrice": 540
}, {
  "Item Name": "MORPHEUS 60",
  "SellingPrice": 191
}, {
  "Item Name": "MORPHEUS 30",
  "SellingPrice": 101
}, {
  "Item Name": "MANSION HOUSE 180",
  "SellingPrice": 292
}, {
  "Item Name": "MANSION HOUSE 90",
  "SellingPrice": 168
}, {
  "Item Name": "MANSION HOUSE 60",
  "SellingPrice": 90
}, {
  "Item Name": "MC BRANDY 60",
  "SellingPrice": 90
}, {
  "Item Name": "RED BULL ",
  "SellingPrice": 157
}, {
  "Item Name": "COKE",
  "SellingPrice": 45
}, {
  "Item Name": "SPRITE",
  "SellingPrice": 45
}, {
  "Item Name": "SODA",
  "SellingPrice": 33
}, {
  "Item Name": "DIET COKE",
  "SellingPrice": 56
}, {
  "Item Name": "TONIC WATER",
  "SellingPrice": 67
}, {
  "Item Name": "GINGER ALE",
  "SellingPrice": 67
}, {
  "Item Name": "LIME SODA",
  "SellingPrice": 45
}, {
  "Item Name": "LIME WATER",
  "SellingPrice": 45
}, {
  "Item Name": "PACKEGED WATER 1L",
  "SellingPrice": 39
}, {
  "Item Name": "MANSION HOUSE 650",
  "SellingPrice": 900
}, {
  "Item Name": "Chole Kulche",
  "SellingPrice": 80
}, {
  "Item Name": "Butter Nan",
  "SellingPrice": 65
}, {
  "Item Name": "Dhai",
  "SellingPrice": 20
}, {
  "Item Name": "Rice",
  "SellingPrice": 55
}, {
  "Item Name": "Plain rice",
  "SellingPrice": 30
}, {
  "Item Name": "MANSION HOUSE 650",
  "SellingPrice": 900
}, {
  "Item Name": "Chole Kulche",
  "SellingPrice": 80
}, {
  "Item Name": "Butter Nan",
  "SellingPrice": 65
}, {
  "Item Name": "Dhai",
  "SellingPrice": 20
}, {
  "Item Name": "Rice",
  "SellingPrice": 55
}, {
  "Item Name": "Plain rice",
  "SellingPrice": 30
}]

myFun();
window.setInterval(showRows, 5000);
showRows();

function myFun() {
  addTable(tableValue);
}

function showRows() {
  $(".hidden:lt(10)").removeClass("hidden");
}

function addTable(tableValue) {
  var $tbl = $("
", {
      "class": "table"
    }),

    $tb = $("
"),
    $trh = $("
");

  var split = Math.round(tableValue.length / 4);
  for (i = 0; i < split; i++) {
    $tr = $("
", {
      class: "hidden"
    });
    for (j = 0; j < 4; j++) {
      $.each(tableValue[split * j + i], function(key, value) {

        $("", {
          "class": "text-left color" + (j + 1)
        }).html(value).appendTo($tr);
      });
    }
    $tr.appendTo($tb);
  }
  $tbl.append($tb);
  $("#DisplayTable").html($tbl);
}

tbody>tr>td {
  white-space: nowrap;
  border-collapse: collapse;
  font-family: Verdana;
  font-size: 8pt;
  font-weight: bold;
  white-space: nowrap;
}

.color1 {
  background: #4AD184;
}

.color2 {
  background: #EA69EF;
}

.color3 {
  background: #E1A558;
}

.color4 {
  background: #F4F065;
}

<link rel="stylesheet" href="//stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css">

Edit
I have tried @Void's solution but that is not removing the hidden class,when I inspect the element then there is no class applied to tr it is showing as class=""

Body:
Create empty HTML table with 4 rows and give unique ID to each field "field0", "field1"...

Than you can make function to populate those field after specific time. At the end it would look something like this:

var data = [
    {
        name: "test data 0"
    },
    {
        name: "test data 1"
    }
]; //Your data
var currentField = 0; //Current offset for the field

$(function() { //When document loads
    showNext(); //Populate first 4 fields
    setInterval(showNext, 4000); //Set up "timer" to populate new ones on every 4 seconds
});

function showNext(){
    for(let i = 0; i < 4; i++){
        $("#column" + i + " #field0").text = data[i + currentField].name;
        $("#column" + i + " #field1").text = data[i + currentField].price;
        currentField++;
    }
}


来源: stackexchange

问:
How to find the number of days between two dates
I have a basic query:

```<code>SELECT dtCreated
    , bActive
    , dtLastPaymentAttempt
    , dtLastUpdated
    , dtLastVisit
FROM Customers
WHERE (bActive = 'true')
    AND (dtLastUpdated > CONVERT(DATETIME, '2012-01-0100:00:00', 102))
</code>```

I want to add another column to the output... lets call it "Difference" to find out the number of days between 'dtcreated' and 'dtlastupdated'  So for example if record 1 has a dtcreated of 1/1/11 and dtlastupdated is 1/1/12 the "Difference" column would be "365".

Can this be accomplished in a query?

答:
Get No of Days between two days

```<code>DECLARE @date1 DATE='2015-01-01',
 @date2 DATE='2019-01-01',
 @Total int=null

SET @Total=(SELECT DATEDIFF(DAY, @date1, @date2))
PRINT @Total
</code>```

ContentLicense: CC BY-SA 3.0

Body:
I have a basic query:

SELECT dtCreated
    , bActive
    , dtLastPaymentAttempt
    , dtLastUpdated
    , dtLastVisit
FROM Customers
WHERE (bActive = 'true')
    AND (dtLastUpdated > CONVERT(DATETIME, '2012-01-0100:00:00', 102))

I want to add another column to the output... lets call it "Difference" to find out the number of days between 'dtcreated' and 'dtlastupdated'  So for example if record 1 has a dtcreated of 1/1/11 and dtlastupdated is 1/1/12 the "Difference" column would be "365".

Can this be accomplished in a query?

Body:
Get No of Days between two days

DECLARE @date1 DATE='2015-01-01',
 @date2 DATE='2019-01-01',
 @Total int=null

SET @Total=(SELECT DATEDIFF(DAY, @date1, @date2))
PRINT @Total

ContentLicense: CC BY-SA 4.0


问:
how to change index directory of my laravel website
I want to create a website using Laravel Framework in my localhost laragon server

I uploaded the website files in a Web Hosting. and when I enter the url http://www.mywebsite.com. then I just get the files like

But when I enter the url http://www.mywebsite.com/public then it is working perfectly.

Can anyone suggest me that what's I'm doing wrong.

答:
Let suppose you uploaded your application to /var/www/html directory. and your public folder path looks like this /var/www/html/public.

Then your site-available file code should be like this

```<code>server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html/public;

    # Add index.php to the list if you are using PHP
    index index.php index.html index.htm index.nginx-debian.html;

    server_name www.mywebsite.com;

    location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.
            try_files $uri $uri/ =404;
    }

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ \.php$ {
            include snippets/fastcgi-php.conf;
    #
    #       # With php7.0-cgi alone:
    #       fastcgi_pass 127.0.0.1:9000;
    #       # With php7.0-fpm:
            fastcgi_pass unix:/run/php/php7.2-fpm.sock;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #       deny all;
    #}
}
</code>```

You just need to change root path. Then your site will work properly as expected.

Body:
Let suppose you uploaded your application to /var/www/html directory. and your public folder path looks like this /var/www/html/public.

Then your site-available file code should be like this

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html/public;

    # Add index.php to the list if you are using PHP
    index index.php index.html index.htm index.nginx-debian.html;

    server_name www.mywebsite.com;

    location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.
            try_files $uri $uri/ =404;
    }

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ \.php$ {
            include snippets/fastcgi-php.conf;
    #
    #       # With php7.0-cgi alone:
    #       fastcgi_pass 127.0.0.1:9000;
    #       # With php7.0-fpm:
            fastcgi_pass unix:/run/php/php7.2-fpm.sock;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #       deny all;
    #}
}

You just need to change root path. Then your site will work properly as expected.


问:
Ensure prize pool doesn't award tied participants less than participants who scored worse
If I had $1000(variable) and I want to split that amount up and give it to 20(variable) people, but rather than give it evenly to each person, I want to give more to the 1st person, and the 2nd person, etc.

So the 20th person gets the least, and the 5th person gets the 5th most.

People are sorted into a list by score, how could i check to make sure people with the same score are awarded the same amount of the prize while still giving out the prize total to all people?

Formula thus far:

```<code>int people = 20;
float prize = 1000;

List<int> list = new List<int>();

for( int i = 0; i < people; ++i )
{
    list.add(Random.Range(0,100));
}

list.Sort();

float k = (2 * prize) / ((people) * (people - 1));
float sum = 0;

for (int i = 1; i < list.Count-1; ++i)
{
    var personsPrize = i * k;
    sum += personsPrize;
    Console.WriteLine(personsPrize);
}
Console.WriteLine("sum = " + sum);
</code>```

First place would get 25% of the total prize pool. Second place gets 20% and third place gets 15% then the rest is divided between the remaining people, with people on the same score getting the same amount.

What should happen for people getting tied first equal? They shouldn't get less than anybody else, but shouldn't double the first prize value.

答:
This can be a solution :

```<code>class People
{
    public int ID { get; set; }
    public int Rank { get; set; }
    public float? Prize { get; set; }
}
</code>```

//Reserves 60% of the prize for the first, second and the third person.
//Imageine that there are 5 people have the highest rank 20 for exemple.
in this case the total of the first place makes 125%. It can't be possible.

For me, you should have another parameter to choose the first places.

Or, you should modify your rank logic: like if the total of percentages is over 100% or 90%, (or a percentage that you will decide), reduce the percentage of the first place, second and third places etc.

Imagene that you have 4 first place, 1 second place and 1 thirt place.

In this case you have (4 * 25%) + 20% + 15%  = 135%. It means you have to reduce your 25% to for exemple 15 %, second place to 10% and the third place to 5%.

in this case you will have (4 * 15%) + 10% + 5% = 75 percent for your highest places and you will distribute 25% to other users.

```<code>    private void CheckPrices()
    {
        float prize = 1000;
        Random rnd = new Random(1);
        var peopleList = new List<People>();
        for (int i = 0; i < 20; i++)
        {
            peopleList.Add(new Test.People() { ID = i + 1, Rank = rnd.Next(5, 100) });
        }

        var firstPrize = prize * 25 / 100;
        var secondPrize = prize * 20 / 100;
        var thirstPrize = prize * 15 / 100;

        int i = 0;
        //Sets first places prizes.
        foreach (var person in peopleList.OrderByDescending(ro => ro.Rank))
        {
            i++;
            if (i == 1)
                person.Prize = firstPrize;
            else if (i == 2)
                person.Prize = secondPrize;
            else if (i == 3)
                person.Prize = thirstPrize;
            else
                break;
        }

        var totalRank = peopleList.Sum(ro => ro.Rank);
        float prizePerRank = (prize - (firstPrize + secondPrize + thirstPrize)) / totalRank;

        foreach (var person in peopleList.Where( ro=> ro.Prize == null))
        {
            person.Prize = person.Rank * prizePerRank;
        }

        //
        var totalPrizeDistributed = peopleList.Sum(ro => ro.Prize); //= 1000
    }
}
</code>```

Body:
If I had $1000(variable) and I want to split that amount up and give it to 20(variable) people, but rather than give it evenly to each person, I want to give more to the 1st person, and the 2nd person, etc.

So the 20th person gets the least, and the 5th person gets the 5th most.

People are sorted into a list by score, how could i check to make sure people with the same score are awarded the same amount of the prize while still giving out the prize total to all people?

Formula thus far:

int people = 20;
float prize = 1000;

List<int> list = new List<int>();

for( int i = 0; i < people; ++i )
{
    list.add(Random.Range(0,100));
}

list.Sort();

float k = (2 * prize) / ((people) * (people - 1));
float sum = 0;

for (int i = 1; i < list.Count-1; ++i)
{
    var personsPrize = i * k;
    sum += personsPrize;
    Console.WriteLine(personsPrize);
}
Console.WriteLine("sum = " + sum);

First place would get 25% of the total prize pool. Second place gets 20% and third place gets 15% then the rest is divided between the remaining people, with people on the same score getting the same amount.

What should happen for people getting tied first equal? They shouldn't get less than anybody else, but shouldn't double the first prize value.

Body:
This can be a solution :

class People
{
    public int ID { get; set; }
    public int Rank { get; set; }
    public float? Prize { get; set; }
}

//Reserves 60% of the prize for the first, second and the third person.
//Imageine that there are 5 people have the highest rank 20 for exemple.
in this case the total of the first place makes 125%. It can't be possible.

For me, you should have another parameter to choose the first places.

Or, you should modify your rank logic: like if the total of percentages is over 100% or 90%, (or a percentage that you will decide), reduce the percentage of the first place, second and third places etc.

Imagene that you have 4 first place, 1 second place and 1 thirt place.

In this case you have (4 * 25%) + 20% + 15%  = 135%. It means you have to reduce your 25% to for exemple 15 %, second place to 10% and the third place to 5%.

in this case you will have (4 * 15%) + 10% + 5% = 75 percent for your highest places and you will distribute 25% to other users.

    private void CheckPrices()
    {
        float prize = 1000;
        Random rnd = new Random(1);
        var peopleList = new List<People>();
        for (int i = 0; i < 20; i++)
        {
            peopleList.Add(new Test.People() { ID = i + 1, Rank = rnd.Next(5, 100) });
        }

        var firstPrize = prize * 25 / 100;
        var secondPrize = prize * 20 / 100;
        var thirstPrize = prize * 15 / 100;

        int i = 0;
        //Sets first places prizes.
        foreach (var person in peopleList.OrderByDescending(ro => ro.Rank))
        {
            i++;
            if (i == 1)
                person.Prize = firstPrize;
            else if (i == 2)
                person.Prize = secondPrize;
            else if (i == 3)
                person.Prize = thirstPrize;
            else
                break;
        }

        var totalRank = peopleList.Sum(ro => ro.Rank);
        float prizePerRank = (prize - (firstPrize + secondPrize + thirstPrize)) / totalRank;

        foreach (var person in peopleList.Where( ro=> ro.Prize == null))
        {
            person.Prize = person.Rank * prizePerRank;
        }

        //
        var totalPrizeDistributed = peopleList.Sum(ro => ro.Prize); //= 1000
    }
}


问:
Current and Updating time in iOS?
i'm developing a tool for car driving which saves GPS Data, Accelerometer Data and Time for later use.

Acceleration is the least Priority, though.

All i need is a little code example so i can get the current system time printed as an updating clock in Xcode because i want it to save my data as fast and as often as possible :>

Thanks in advance for any answers :)

h4wkeye

答:
To get the current system time use

NSDate* currentDate = [NSDate date];

and To get the string representation of NSDate

```<code>- (NSString *)description
</code>```

Then Use below

```<code>NSString* dateInString = [currentDate description];
</code>```

Title: Current and Updating time in iOS?

Body:
To get the current system time use

NSDate* currentDate = [NSDate date];

and To get the string representation of NSDate

- (NSString *)description

Then Use below

NSString* dateInString = [currentDate description];


问:
Is there any way to get v-model value in computed property?
I have retrieved the value from the database. I want to calculate the the data before render and show in the modal (regarding that user). How I can calculate the data for each and every user and show in the modal? I used to calculate the data in v-model like 'v-model="2 * item.amount * 0.09"'. But problem is I can't calculate summation. It is concatenate. enter image description here</p>

答: Why don't you use a watcher on item.amount and calculate the amount you want to show in your modal? Or just use a computed to get the right amount</p>


问:
I can't query dynamodb table from AWS Fargate task
I'm setting up a new AWS Fargate task to query Dynamodb. The task is not public, so it doesn't have a public IP address and the subnet in which the task is placed doesn't have the access to the Internet. The Dynamodb table I'm trying to query uses the KMS encryption type.

I created:

a VPC endpoint gateway to allow the subnet to connect to Amazon Dynamodb

a VPC endpoint interface to allow the subnet to connect to AWS Secret Manager

I also updated the task's IAM role to be able to access the Dynamodb and the AWS Secret services.

The route tables associated with my VPC is:
and unfortunately, I can't update the table. If I click on Edit routes and Add route, it says: "No results found".

I'm trying to execute these lines of code:

```<code>session = boto3.Session()
dynamodb_client = session.client(service_name='dynamodb', region_name='us-east-1')
dynamodb_client.get_item(
    TableName='table_name', ConsistentRead=True, Key={'key': {'S': 'key'}}))
</code>```

I expect that the output is a dictionary containing the information fetched from Dynamodb. I can't fetch any type of data from Dynamodb because when I execute the query, the task is interrupted and AWS Fargate starts a new one.
I tried to download something from my S3 bucket and it's working (I also create the VPC endpoint gateway to allow the subnet to connect to AWS S3 and I updated the task's IAM role). I think that it's a problem of VPC endpoints but I don't know which other endpoints I need.

What am I doing wrong?

答:
I found the solution thanks to a StackOverflow user's comment. I don't know why when I created the VPC Endpoint Gateway to connect to Dynamodb, AWS didn't update automatically my route tables.

It's a VPC Endpoint Gateway so you have to be sure that the traffic to Dynamodb is redirected to the gateway created (with a VPC Endpoint Interface you don't have to update route tables because you set the subnets in which it's available).

Your route tables should be like this:

Body:
I'm setting up a new AWS Fargate task to query Dynamodb. The task is not public, so it doesn't have a public IP address and the subnet in which the task is placed doesn't have the access to the Internet. The Dynamodb table I'm trying to query uses the KMS encryption type.

I created:

a VPC endpoint gateway to allow the subnet to connect to Amazon Dynamodb

a VPC endpoint interface to allow the subnet to connect to AWS Secret Manager

I also updated the task's IAM role to be able to access the Dynamodb and the AWS Secret services.

The route tables associated with my VPC is:
and unfortunately, I can't update the table. If I click on Edit routes and Add route, it says: "No results found".

I'm trying to execute these lines of code:

session = boto3.Session()
dynamodb_client = session.client(service_name='dynamodb', region_name='us-east-1')
dynamodb_client.get_item(
    TableName='table_name', ConsistentRead=True, Key={'key': {'S': 'key'}}))

I expect that the output is a dictionary containing the information fetched from Dynamodb. I can't fetch any type of data from Dynamodb because when I execute the query, the task is interrupted and AWS Fargate starts a new one.
I tried to download something from my S3 bucket and it's working (I also create the VPC endpoint gateway to allow the subnet to connect to AWS S3 and I updated the task's IAM role). I think that it's a problem of VPC endpoints but I don't know which other endpoints I need.

What am I doing wrong?


问:
Axon - Easiest way to make projection at query time
I will usually have 5-6 events per aggregate and would like not to store projections in DB. What would be the easiest way always to make view projection at query time?</p>

答:
The short answer to this, is that there is no easy/quick way to do this.

However, it most certainly is doable to implement a 'replay given events at request time' set up.

What I would suggest you do exists in several steps:

Create the query model you would like to return, which can handle events (use @EventHandler annotated methods on the model)

Create a Component which can handle the query that'll return the query model in step one (use a @QueryHandler annotated method for this.

The Query-Handling-Component should be able to retrieve a stream of events from the EventStore. If this is based on an aggregateIdentifier, use the EventStore#readEvents(String) method. If you need the entire event stream, you need to use the StreamableMessageSource#openStream(TrackingToken) method (note: the EventStore interface implements StreamableMessageSource)

Upon query handling, create a AnnotationEventHandlerAdapter, giving it a fresh instance of your Query Model

For every event in the event stream you've created in point 3, call the AnnotationEventHandlerAdapter#handle(EventMessage) method. This method will call the @EventHandler annotated methods on your Query Model object

If the stream is depleted, you are ensured all necessary events for your Query Model have dealt with. Thus, you can now return the Query Model

So, again, I don't think this is overly trivial, easy or quick to set up.
Additionally, step 3 has quite a caveat in there. Retrieving the stream of a given  Aggregate based on the Aggregate Identifier is pretty fast/concise, as an Aggregate in general doesn't have a lot of events.

However, retrieving the Event Stream based on a TrackingToken, which you'd need if your Query Model spans several Aggregates, can ensure you pull in the entire event store for instantiating your models on the fly. Granted, you can fine tune the point in time you want the Event Stream to return events from as you're dealing with a TrackingToken, but the changes are pretty high you will be incomplete and relatively slow.

However, you stated you want to retrieve events for a given Aggregate Identifier.
I'd thus think this should be a workable solution in your scenario.

Hope this helps!


问:
open DataReader associated issue
I need to release the Production Order Maintenance document from other graph, and when am calling release.press(), am facing data reader issue, can some one please help me, Please have a look at below code</p>

```<code>using (new PXConnectionScope())
 {
   ProdMaintGraph.ProdItemSelected.Current = ProdItem;
   ProdMaintGraph.release.Press();
 }
</code>```

答:
You can call the Release(PXAdapter adapter) function!

```<code>AMProdItem prodItem = null;//your current record
ProdMaint prodMaint = PXGraph.CreateInstance<ProdMaint>();
prodMaint.ProdMaintRecords.Current =prodMaint.ProdMaintRecords.Search<AMProdItem.orderType, AMProdItem.prodOrdID>(prodItem?.OrderType, prodItem?.ProdOrdID);
var adapterProdMaint = new PXAdapter(prodMaint.ProdMaintRecords, new string[]
  {
     prodMaint.ProdMaintRecords.Current?.OrderType,
     prodMaint.ProdMaintRecords.Current?.ProdOrdID
  });
prodMaint.Release(adapter);//Run 'Release Order' action
prodMaint.ReleaseMaterial(adapter);//Run 'Release Material' action
</code>```

Title: open DataReader associated issue

Body:
I need to release the Production Order Maintenance document from other graph, and when am calling release.press(), am facing data reader issue, can some one please help me, Please have a look at below code

using (new PXConnectionScope())
 {
   ProdMaintGraph.ProdItemSelected.Current = ProdItem;
   ProdMaintGraph.release.Press();
 }

Body:
You can call the Release(PXAdapter adapter) function!

AMProdItem prodItem = null;//your current record
ProdMaint prodMaint = PXGraph.CreateInstance<ProdMaint>();
prodMaint.ProdMaintRecords.Current =prodMaint.ProdMaintRecords.Search<AMProdItem.orderType, AMProdItem.prodOrdID>(prodItem?.OrderType, prodItem?.ProdOrdID);
var adapterProdMaint = new PXAdapter(prodMaint.ProdMaintRecords, new string[]
  {
     prodMaint.ProdMaintRecords.Current?.OrderType,
     prodMaint.ProdMaintRecords.Current?.ProdOrdID
  });
prodMaint.Release(adapter);//Run 'Release Order' action
prodMaint.ReleaseMaterial(adapter);//Run 'Release Material' action


问:
How to render child components only in react
I am learning react, and is trying to plot a map with mapbox. I am stuck with how to render elements seperatly.

In the render part, there is a
 element and a component <CityWeather/> wrapped. div is a reference to map. The <Cityweather /> is an info  box which is supposed to display weather information based on lat and long. The app.js file render method is

```<code>render(){
    console.log(this.state);
    return(
        <section>
            <div className="map-container" ref={x => { this.mapContainer = x;}}/>
            <CityWeather lat={this.state.lat} lng={this.state.lng} />
        </section>
    );
</code>```

The componentDidMount() is

```<code>componentDidMount() {
    this.getLocation();
    mapboxgl.accessToken = "";

    const { lng, lat, zoom } = this.state;
    const map = new mapboxgl.Map({
        container: this.mapContainer,
        style: "mapbox://styles/mapbox/streets-v11",
        center: [lng, lat],
        zoom: zoom
    });
   map.on("moveend", () => {
       const { lng, lat } = map.getCenter();
       this.setState({
           lng: lng.toFixed(4),
           lat: lat.toFixed(4),
           zoom: map.getZoom().toFixed(2)
       });
   });
 }
</code>```

The <CityWeather /> component

```<code>class CityWeather extends Component {
    constructor(props) {
        super(props);
        this.state = {
        name: ""
    };
 }
 componentDidMount() {
     console.log(this.props); // this logs only 1 time when the page loads
    fetch("api?lat=" + this.props.lat +"&lon=" +this.props.lng +       "&appid=")
        .then(res => res.json())
        .then(data => {this.setState({ name: data.name });
    }); // get name from lat and long and store it in state
}

render() {
    return (
        <div className="city-weather">
            <p>
                City | <span className="city">
                {this.state.name}</span>
            </p>
       </div>
    );
}
}
</code>```

On each event the console is logging the updated latitude, longitude and zoom. Also the <CityWeather/> is also rendered for Ist time. After that the component is not rendered on state change.

答:
You have loaded weather data in componentDidMount. It will only run the first time that the component is rendered, Not on every state change.

This is the correct code:

```<code>class CityWeather extends Component {
    constructor(props) {
        super(props);
        this.state = {
            name: ""
        };
    }
    componentDidMount() {
        this.load();
    }

    load(){
        console.log(this.props); // this logs only 1 time when the page loads
        fetch("api?lat=" + this.props.lat + "&lon=" + this.props.lng + "&appid=")
            .then(res => res.json())
            .then(data => {
                this.setState({ name: data.name });
            }); // get name from lat and long and store it in state

    }

    componentDidUpdate(prevProps) {
        // Typical usage (don't forget to compare props):
        if (this.props.lat !== prevProps.lat || this.props.lng !== prevProps.lng) {
            this.load();
        }
    }

    render() {
        return (
            <div className="city-weather">
                <p>
                    City | <span className="city">
                        {this.state.name}</span>
                </p>
            </div>
        );
    }
}
</code>```

Body:
I am learning react, and is trying to plot a map with mapbox. I am stuck with how to render elements seperatly.

In the render part, there is a
 element and a component <CityWeather/> wrapped. div is a reference to map. The <Cityweather /> is an info  box which is supposed to display weather information based on lat and long. The app.js file render method is

render(){
    console.log(this.state);
    return(

 { this.mapContainer = x;}}/>
            <CityWeather lat={this.state.lat} lng={this.state.lng} />

    );

The componentDidMount() is

componentDidMount() {
    this.getLocation();
    mapboxgl.accessToken = "";

    const { lng, lat, zoom } = this.state;
    const map = new mapboxgl.Map({
        container: this.mapContainer,
        style: "mapbox://styles/mapbox/streets-v11",
        center: [lng, lat],
        zoom: zoom
    });
   map.on("moveend", () => {
       const { lng, lat } = map.getCenter();
       this.setState({
           lng: lng.toFixed(4),
           lat: lat.toFixed(4),
           zoom: map.getZoom().toFixed(2)
       });
   });
 }

The <CityWeather /> component

class CityWeather extends Component {
    constructor(props) {
        super(props);
        this.state = {
        name: ""
    };
 }
 componentDidMount() {
     console.log(this.props); // this logs only 1 time when the page loads
    fetch("api?lat=" + this.props.lat +"&lon=" +this.props.lng +       "&appid=")
        .then(res => res.json())
        .then(data => {this.setState({ name: data.name });
    }); // get name from lat and long and store it in state
}

render() {
    return (

                City |
                {this.state.name}

    );
}
}

On each event the console is logging the updated latitude, longitude and zoom. Also the <CityWeather/> is also rendered for Ist time. After that the component is not rendered on state change.

Body:
You have loaded weather data in componentDidMount. It will only run the first time that the component is rendered, Not on every state change.

This is the correct code:

class CityWeather extends Component {
    constructor(props) {
        super(props);
        this.state = {
            name: ""
        };
    }
    componentDidMount() {
        this.load();
    }

    load(){
        console.log(this.props); // this logs only 1 time when the page loads
        fetch("api?lat=" + this.props.lat + "&lon=" + this.props.lng + "&appid=")
            .then(res => res.json())
            .then(data => {
                this.setState({ name: data.name });
            }); // get name from lat and long and store it in state

    }

    componentDidUpdate(prevProps) {
        // Typical usage (don't forget to compare props):
        if (this.props.lat !== prevProps.lat || this.props.lng !== prevProps.lng) {
            this.load();
        }
    }

    render() {
        return (
            <div className="city-weather">
                <p>
                    City | <span className="city">
                        {this.state.name}</span>
                </p>
            </div>
        );
    }
}


问:
"Parameter does not exist or you do not have sufficient permissions" when running SSIS package in C#
I have a SSIS package with a bunch of variables, listed below:

I am trying to call the SSIS package from a C# Windows Form App using the code below:

```<code>// Create a connection to the server
string sqlConnectionString = "Data Source=BSQL_01;Initial Catalog=master;Integrated Security=SSPI;";
SqlConnection sqlConnection = new SqlConnection(sqlConnectionString);

// Create the Integration Services object
IntegrationServices integrationServices = new IntegrationServices(sqlConnection);

// Get the Integration Services catalog
Catalog catalog = integrationServices.Catalogs["SSISDB"];

// Get the folder
CatalogFolder folder = catalog.Folders["PORGPackages"];

// Get the project
ProjectInfo project = folder.Projects["PORGPackages"];

// Get the package
PackageInfo package = project.Packages["POHandler.dtsx"];

// Add project parameter
Collection<PackageInfo.ExecutionValueParameterSet> executionParameter = new Collection<PackageInfo.ExecutionValueParameterSet>();
executionParameter.Add(new PackageInfo.ExecutionValueParameterSet { ObjectType = 20, ParameterName = "SessionID", ParameterValue = "636943168325507712" });

// Run the package
long executionIdentifier = package.Execute(false, null, executionParameter);

ExecutionOperation executionOperation = integrationServices.Catalogs["SSISDB"].Executions[executionIdentifier];

while (!executionOperation.Completed) {
    System.Threading.Thread.Sleep(5000);
    executionOperation.Refresh();
    MessageBox.Show("Running...");
}

if (executionOperation.Status == Operation.ServerOperationStatus.Success) {
    Console.WriteLine("Success");
} else if (executionOperation.Status == Operation.ServerOperationStatus.Failed) {
    Console.WriteLine("Failed");
} else {
    Console.WriteLine("Something Went Really Wrong");
}
</code>```

I am getting the following error:

The parameter 'SessionID' does not exist or you do not have sufficient
  permissions.

Am I adding the parameter correctly?  I don't know I can watch to see if it's being set, or if I have permission.

答:
Am I adding the parameter correctly?

You have declared a variable called @SessionID not a parameter.

If you need to pass a variable value then you can refer to the following link:

How to pass variables to an SSIS package from a C# application

For more information about both objects (variables & parameters) you can refer to the following articles:

Getting Started with Parameters, Variables & Configurations in SSIS 2012

What's the difference between Variable and Parameters

SSIS Variables vs Parameters (SSIS Denali)

Body:
I have a SSIS package with a bunch of variables, listed below:

I am trying to call the SSIS package from a C# Windows Form App using the code below:

// Create a connection to the server
string sqlConnectionString = "Data Source=BSQL_01;Initial Catalog=master;Integrated Security=SSPI;";
SqlConnection sqlConnection = new SqlConnection(sqlConnectionString);

// Create the Integration Services object
IntegrationServices integrationServices = new IntegrationServices(sqlConnection);

// Get the Integration Services catalog
Catalog catalog = integrationServices.Catalogs["SSISDB"];

// Get the folder
CatalogFolder folder = catalog.Folders["PORGPackages"];

// Get the project
ProjectInfo project = folder.Projects["PORGPackages"];

// Get the package
PackageInfo package = project.Packages["POHandler.dtsx"];

// Add project parameter
Collection<PackageInfo.ExecutionValueParameterSet> executionParameter = new Collection<PackageInfo.ExecutionValueParameterSet>();
executionParameter.Add(new PackageInfo.ExecutionValueParameterSet { ObjectType = 20, ParameterName = "SessionID", ParameterValue = "636943168325507712" });

// Run the package
long executionIdentifier = package.Execute(false, null, executionParameter);

ExecutionOperation executionOperation = integrationServices.Catalogs["SSISDB"].Executions[executionIdentifier];

while (!executionOperation.Completed) {
    System.Threading.Thread.Sleep(5000);
    executionOperation.Refresh();
    MessageBox.Show("Running...");
}

if (executionOperation.Status == Operation.ServerOperationStatus.Success) {
    Console.WriteLine("Success");
} else if (executionOperation.Status == Operation.ServerOperationStatus.Failed) {
    Console.WriteLine("Failed");
} else {
    Console.WriteLine("Something Went Really Wrong");
}

I am getting the following error:

The parameter 'SessionID' does not exist or you do not have sufficient
  permissions.

Am I adding the parameter correctly?  I don't know I can watch to see if it's being set, or if I have permission.


问:
413 Payload Too Large on Django server
My team has been getting 413 errors whenever we try and upload large files to our Django back-end: 413 Payload too large

We can't exactly pin down the maximum acceptable file size - it seems to vacillate in the 1-3MB range.

Things we have excluded:

It's not a webserver configuration issue, because we're running the

Django server locally (without a webserver)

We believe it's not an app server configuration issue, because this happens on multiple app servers (./manage.py runserver and
daphne -p 8000 topknott.asgi:application)

It's not an issue with the field on the Django model, which looks
normal: photo = models.ImageField(blank=True)

Can anyone spot what we're missing?

答:
Django has a build in mechanism to prevent any suspicious activity.

In your settings.py file set the variable

```<code>DATA_UPLOAD_MAX_MEMORY_SIZE = 10*1024*1024  # your size limit in bytes
</code>```

See documentation: https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-DATA_UPLOAD_MAX_MEMORY_SIZE

Title: 413 Payload Too Large on Django server

Body:
Django has a build in mechanism to prevent any suspicious activity.

In your settings.py file set the variable

DATA_UPLOAD_MAX_MEMORY_SIZE = 10*1024*1024  # your size limit in bytes

See documentation: https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-DATA_UPLOAD_MAX_MEMORY_SIZE


问:
How to detect hand palm and its orientation (like facing outwards)?
I am working on a hand detection project. There are many good project on web to do this, but what I need is a specific hand pose detection. It needs a totally open palm and the whole palm face to outwards, like the image below:

The first hand faces to inwards, so it will not be detected, and the right one faces to outwards, it will be detected. Now I can detect hand with OpenCV. but how to tell the hand orientation?

答:
Problem of matching with the forehand belongs to the texture classification, it's a classic pattern recognition problem. I suggest you to try one of the following methods:

Gabor filters: it is good to detect the orientation and pixel intensities (as forehand has different features), opencv has getGaborKernel function, the very important params of this function is theta (orientation) and lambd: (frequencies). To make it simple you can apply this process on a cropped zone of palm (as you have already detected it, it would be easy to crop for example the thumb, or a rectangular zone around the gravity center..etc). Then you can convolute it with a small database of images of the same zone to get the a rate of matching, or you can use the SVM classifier, where you have to train your SVM on a set of images by constructing the training matrix needed for SVM (check this question), this paper

Local Binary Patterns (LBP): it's an important feature descriptor used for texture matching, you can apply it on whole palm image or on a cropped zone or finger of image, it's easy to use in opencv, a lot of tutorials with codes are available for this method. I recommend you to read this paper talking about Invariant Texture Classification
with Local Binary Patterns. here is a good tutorial

Haralick Texture: I've read that it works perfectly when a set of features  quantifies the entire image (Global Feature Descriptors). it's not implemented in opencv but easy to be implemented, check this useful tutorial

Training Models: I've already suggested a SVM classifier, to be coupled with some descriptor, that can works perfectly.
Opencv has an interesting  FaceRecognizer class for face recognition, it could be an interesting idea to use it replacing the face images by the palm ones, (do resizing and rotation to get an unique pose of palm), this class has three methods can be used, one of them is Local Binary Patterns Histograms, which is recommended for texture recognition. and why not to try the other models (Eigenfaces and Fisherfaces ) , check this tutorial