问:
How to "host" SQL Server when deploying an ASP.Net site on the web
I'm about to deploy an ASP.NET web application for testing in production. Essentially, this is just a table that is linked to a SQL Server table/view that is obviously dynamic when the data in the tables are updated.
I have a hosting plan with a site that I'll be pushing the files to, which includes a SQL Server database in the hosting plan. I also host a SQL Server instance on the network.

My question is, what is the standard way of dealing with SQL Server in this deployment? I think I have the options below, but as someone who has only ever developed applications offline, this is new to me, so please excuse my novice ignorance.

Have the application connect via IP address in the connection string to my SQL Server instance, as specifying the server name (SQLDEVSRV01 for example) won't be on the "network" when it's sitting in the site's FTP. Am I to assume my connection string will only work on the network, and once deployed to a website, will cease to function unless connecting via TCP/IP?

Host the server on the web in the same site host location. So upload the site files to my website host and setup the SQL server there. Would I be able to just specify the Server name (SQLDEVSRV01 for example) in the connection string there, as whilst it wouldn't work in development as it wouldn't be on the same network, it would then work once deployed on the web?

Embed a SQL Server instance within the app using localdB or something similar to hold the background data. If this is the case, can the data be accessed from the backend, either using SSMS or some other method?

Essentially, my aim here is to have the web app retrieve the data live from a view/table hosted in SQL server, where the backend data can be amended, manipulated and updated independently of the app, so the app can just pull the data when refreshed.

答:
The standard way of doing this is to deploy your database to the hosting providers SQL Server instance and then connect your app to it using a connection string with their details. As it is normally a shared instance you do not have to normally worry about having the SQL instance machine patched etc.

Personally I would not be installing SQL Server myself unless I decided there was benefit to having an instance I wanted the control over nor would I be changing the structure or implementation of my application to suit a hosting providers setup.


来源: stackexchange

问:
Defining y-axis range and breaks in package sjPlot:: plot_model()
I am plotting the results of my GlmmTMB model with the sjplot package and the function plot_model (max.m3) in R. Here is the Code:

```<code>p=sjPlot::plot_model(max.m3, type="pred", grid = F)
</code>```

These are six graphics which are plotted than. However, I would like to define y-axis range (ranging from 0 to 10) and shown breaks (0,5,10 = so that tick marks appear at 0, 5, and 10).

Unfortunately, I did not find a solution to do this.

答:
If you plot marginal effects for all model terms, plot_model() returns a list of ggplot-objects. You can then modify each plot in the list, simply using ggplot-commands.

m <- lm(mpg ~ hp + gear + cyl + drat, data = mtcars)
p <- sjPlot::plot_model(m, type = "pred", grid = FALSE)
p[[1]] + scale_y_continuous(limits = c(15, 30), breaks = c(15, 25, 30))
p[[2]] + scale_y_continuous(limits = c(5, 40), breaks = c(15, 25, 40))
...
```

<p>If you want to apply the same y-limits and breaks to all plots, you can loop over the list, e.g.:</p>

<pre class="lang-r prettyprint-override"><code>library(ggplot2)
m <- lm(mpg ~ hp + gear + cyl + drat, data = mtcars)
p <- sjPlot::plot_model(m, type = "pred", grid = FALSE)
lapply(p, function(i) i + scale_y_continuous(limits = c(15, 30), breaks = c(15, 25, 30)))
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I am plotting the results of my GlmmTMB model with the sjplot package and the function plot_model (max.m3) in R. Here is the Code:

p=sjPlot::plot_model(max.m3, type="pred", grid = F)

These are six graphics which are plotted than. However, I would like to define y-axis range (ranging from 0 to 10) and shown breaks (0,5,10 = so that tick marks appear at 0, 5, and 10).

Unfortunately, I did not find a solution to do this.

Body:
If you plot marginal effects for all model terms, plot_model() returns a list of ggplot-objects. You can then modify each plot in the list, simply using ggplot-commands.

m <- lm(mpg ~ hp + gear + cyl + drat, data = mtcars)
p <- sjPlot::plot_model(m, type = "pred", grid = FALSE)
p[[1]] + scale_y_continuous(limits = c(15, 30), breaks = c(15, 25, 30))
p[[2]] + scale_y_continuous(limits = c(5, 40), breaks = c(15, 25, 40))
...

If you want to apply the same y-limits and breaks to all plots, you can loop over the list, e.g.:

library(ggplot2)
m <- lm(mpg ~ hp + gear + cyl + drat, data = mtcars)
p <- sjPlot::plot_model(m, type = "pred", grid = FALSE)
lapply(p, function(i) i + scale_y_continuous(limits = c(15, 30), breaks = c(15, 25, 30)))


问:
Working with more than one xml file in android
I am new to android development.

If I have more than one xml file, other than the main.xml, then how can I call the other files?

答:
You can either call the different xml files when needed, like so:

```<code> setContentView(R.layout.yourname.xml);
</code>```

If you need to load the contents of one xml, and put it in a view, then you can use an inflater to fetch a view from an xml that isn't 'loaded'. There is also an addContentView() command, but I don't think you'll need that for now :)

ContentLicense: CC BY-SA 3.0

Body:
You can either call the different xml files when needed, like so:

 setContentView(R.layout.yourname.xml);

If you need to load the contents of one xml, and put it in a view, then you can use an inflater to fetch a view from an xml that isn't 'loaded'. There is also an addContentView() command, but I don't think you'll need that for now :)


问:
Python HTML scraping cannot find attribute I know exists?
I am using the lxml and requests modules, and just trying to parse the article from a website. I tried using find_all from BeautifulSoup but still came up empty

from lxml import html
import requests

page = requests.get('https://www.thehindu.com/news/national/karnataka/kumaraswamy-congress-leaders-meet-to-discuss-cabinet-reshuffle/article27283040.ece')
tree = html.fromstring(page.content)

article = tree.xpath('//div[@class="article"]/text()')
```

Once I print article, I get a list of ['\n','\n','\n','\n','\n'], rather than the body of the article. Where exactly am I going wrong?

答:
I would use bs4 and the class name in css select_one

```<code>import requests
from bs4 import BeautifulSoup as bs
page = requests.get('https://www.thehindu.com/news/national/karnataka/kumaraswamy-congress-leaders-meet-to-discuss-cabinet-reshuffle/article27283040.ece')
soup = bs(page.content, 'lxml')
print(soup.select_one('.article').text)
</code>```

If you use

```<code>article = tree.xpath('//div[@class="article"]//text()')
</code>```

you get a list and still get all the \n but also the text which I think you can handle with re.sub or conditional logic.

Body:
I am using the lxml and requests modules, and just trying to parse the article from a website. I tried using find_all from BeautifulSoup but still came up empty

from lxml import html
import requests

page = requests.get('https://www.thehindu.com/news/national/karnataka/kumaraswamy-congress-leaders-meet-to-discuss-cabinet-reshuffle/article27283040.ece')
tree = html.fromstring(page.content)

article = tree.xpath('//div[@class="article"]/text()')

Once I print article, I get a list of ['\n','\n','\n','\n','\n'], rather than the body of the article. Where exactly am I going wrong?

Body:
I would use bs4 and the class name in css select_one

import requests
from bs4 import BeautifulSoup as bs
page = requests.get('https://www.thehindu.com/news/national/karnataka/kumaraswamy-congress-leaders-meet-to-discuss-cabinet-reshuffle/article27283040.ece')
soup = bs(page.content, 'lxml')
print(soup.select_one('.article').text)

If you use

article = tree.xpath('//div[@class="article"]//text()')

you get a list and still get all the \n but also the text which I think you can handle with re.sub or conditional logic.


问:
Convert angle-axis angular velocity to euler angular velocity using Eigen
Given an angular velocity represented by the vector [x, y, z] where the magnitude of the vector represents the magnitude of the angular velocity in radians/s and the direction of the vector represents the axis in which the rotation is applied, how do I convert this vector into body-fixed euler angular velocity (roll_d, pitch_d, yaw_d)?

答:
For infinitesimally small timesteps body-fixed angular velocity and "Euler angular velocity" are the same.

To convert from world-frame angular velocity to body-fixed angular velocity you need to rotate the vector from the world frame to the body frame, using the current orientation of your vehicle.


问:
How to move text to New line of same row when text is bigger
I am working on HTML table and i am stuck here for very long now, I have a requirement of displaying table into four columns/grid which i have done

Now when i am rendering the table i am displaying first 17 rows in one go than next 17 after five seconds

What is the issue

some ItemNames are big like BIG BANAYAN CARBINET SAUVIGNON BY GLASS

So when page is refreshing after five seconds the the column which contains this long name gets very large width which is not good to see as on UI

I am trying to make the width of each column uniform all four will have same width

So when the long ITEM NAME is coming what I am trying to do is to use word-wrap: normal; to break it after some width,but it is not working

I am dividing the four columns into equal part, which ever screen it is rendering the table it should be divided into 4 parts and when ITEMNAME is large i want to display it into same row but in new line after that exceeds the width of column

I think i have to give some sort of height to all the rows when it can accept one single small item name then it will show in single row but when the name is large it should show in same row but in two lines with same font

$(document).ready(function() {

  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 7",
    "SellingPrice": 1125
  }, {
    "Item Name": "FOUR SEAZON CLASSIC CHENNIN BLANC B",
    "SellingPrice": 225
  }, {
    "Item Name": "BIG BANAYAN CARBINET SAUVIGNON 750",
    "SellingPrice": 1125
  }, {
    "Item Name": "BIG BANAYAN CARBINET SAUVIGNON BY G",
    "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() {
    // Any TRs that are not hidden and not already shown get "already-shown" applied
    $("tr:not(.hidden):not(.already-shown)").addClass("already-shown");
    // Then your previous code
    $(".hidden:lt(15)").removeClass("hidden"); // this one is to hide previous 5 rows and show next five
  }

  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"
      }); //ading class
      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: normal;
  border-collapse: collapse;
  font-family: Verdana;
  font-weight: bold;
  white-space: nowrap;
}

td {
  word-break: break-all;
}

.color1 {
  background: #4AD184;
}

.color2 {
  background: #EA69EF;
}

.color3 {
  background: #E1A558;
}

.color4 {
  background: #F4F065;
}

.hidden,
.already-shown {
  display: none;
}</code>```

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">

```

答:
You are getting the data in four rows using the for loop. I would suggest you should use bootstrap class="col-sm-3" in your html file table tag. This wraps the string how long it is and displays four rows with equal space. Also import

```<code> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
</code>```

Body:
I am working on HTML table and i am stuck here for very long now, I have a requirement of displaying table into four columns/grid which i have done

Now when i am rendering the table i am displaying first 17 rows in one go than next 17 after five seconds

What is the issue

some ItemNames are big like BIG BANAYAN CARBINET SAUVIGNON BY GLASS

So when page is refreshing after five seconds the the column which contains this long name gets very large width which is not good to see as on UI

I am trying to make the width of each column uniform all four will have same width

So when the long ITEM NAME is coming what I am trying to do is to use word-wrap: normal; to break it after some width,but it is not working

I am dividing the four columns into equal part, which ever screen it is rendering the table it should be divided into 4 parts and when ITEMNAME is large i want to display it into same row but in new line after that exceeds the width of column

I think i have to give some sort of height to all the rows when it can accept one single small item name then it will show in single row but when the name is large it should show in same row but in two lines with same font

$(document).ready(function() {

  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 7",
    "SellingPrice": 1125
  }, {
    "Item Name": "FOUR SEAZON CLASSIC CHENNIN BLANC B",
    "SellingPrice": 225
  }, {
    "Item Name": "BIG BANAYAN CARBINET SAUVIGNON 750",
    "SellingPrice": 1125
  }, {
    "Item Name": "BIG BANAYAN CARBINET SAUVIGNON BY G",
    "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() {
    // Any TRs that are not hidden and not already shown get "already-shown" applied
    $("tr:not(.hidden):not(.already-shown)").addClass("already-shown");
    // Then your previous code
    $(".hidden:lt(15)").removeClass("hidden"); // this one is to hide previous 5 rows and show next five
  }

  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"
      }); //ading class
      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: normal;
  border-collapse: collapse;
  font-family: Verdana;
  font-weight: bold;
  white-space: nowrap;
}

td {
  word-break: break-all;
}

.color1 {
  background: #4AD184;
}

.color2 {
  background: #EA69EF;
}

.color3 {
  background: #E1A558;
}

.color4 {
  background: #F4F065;
}

.hidden,
.already-shown {
  display: none;
}

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">

Body:
You are getting the data in four rows using the for loop. I would suggest you should use bootstrap class="col-sm-3" in your html file table tag. This wraps the string how long it is and displays four rows with equal space. Also import

 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>


问:
How to find all combinations in column and count occurrences in data
I am trying to find all actual combinations within my data of values in column 1.

I then want to count all occurrences of these by column 2.

It feels like R should be able to do this fairly quickly. I tried reading up on combn and expand.grid, but with no success. The main problem was I could not find any guidance on how to generate combinations within a column.

My data looks like:

```<code>Animal (n=57) | Person ID (n=1000)
Dog     | 0001
Cat     | 0004
Bird    | 0001
Snake   | 0002
Spider  | 0002
Cat     | 0003
Dog     | 0004
</code>```

Expected output is:

```<code>AnimalComb | CountbyID

Cat         | 1
DogBird     | 1
SnakeSpider | 1
CatDog      | 1
</code>```

EDIT deleted an erroneous entry for cat

答:
If I have understood you correctly, you need to group_by PersonID and paste the all the unique Animals in the group and count the number of occurrence of their combination which can be done counting the number of rows in the group (n()) and dividing it by number of distinct values (n_distinct).

```<code>library(dplyr)

df %>%
  group_by(PersonID) %>%
  summarise(AnimalComb = paste(unique(Animal), collapse = ""),
            CountbyID = n() / n_distinct(Animal))

#  PersonID AnimalComb  CountbyID
#     <int> <chr>           <dbl>
#1        1 DogBird             1
#2        2 SnakeSpider         1
#3        3 Cat                 1
#4        4 CatDog              1
</code>```

Body:
I am trying to find all actual combinations within my data of values in column 1.

I then want to count all occurrences of these by column 2.

It feels like R should be able to do this fairly quickly. I tried reading up on combn and expand.grid, but with no success. The main problem was I could not find any guidance on how to generate combinations within a column.

My data looks like:

Animal (n=57) | Person ID (n=1000)
Dog     | 0001
Cat     | 0004
Bird    | 0001
Snake   | 0002
Spider  | 0002
Cat     | 0003
Dog     | 0004

Expected output is:

AnimalComb | CountbyID

Cat         | 1
DogBird     | 1
SnakeSpider | 1
CatDog      | 1

EDIT deleted an erroneous entry for cat

Body:
If I have understood you correctly, you need to group_by PersonID and paste the all the unique Animals in the group and count the number of occurrence of their combination which can be done counting the number of rows in the group (n()) and dividing it by number of distinct values (n_distinct).

library(dplyr)

df %>%
  group_by(PersonID) %>%
  summarise(AnimalComb = paste(unique(Animal), collapse = ""),
            CountbyID = n() / n_distinct(Animal))

#  PersonID AnimalComb  CountbyID
#     <int> <chr>           <dbl>
#1        1 DogBird             1
#2        2 SnakeSpider         1
#3        3 Cat                 1
#4        4 CatDog              1


问:
How to get hours difference between now and next friday
I want to get hours difference between now and next friday 18:00 (weekend) using momentjs, I tried this but it doesn't work :

```<code>public getWeekend() {
    const nextFriday = moment().weekday(4)
    nextFriday.hours(18) // Weekend time: 18:00
    nextFriday.minutes(0)
    nextFriday.seconds(0)

    const diff = moment(nextFriday.diff(moment()))
    console.log(diff.days())
    if (diff.days() * 24 + diff.hours() <= 99) {
      return nextFriday.toString()
    } else {
      return 0
    }
  }
}
</code>```

console.log(diff.days()) is printing 6 days whereas we are Wednesday

答:
try this:</p>

```<code>function getWeekend() {

    const nextFriday = moment().weekday(4)
        nextFriday.hours(18) // Weekend time: 18:00
        nextFriday.minutes(0)
        nextFriday.seconds(0)

        const diffHours = moment.duration(nextFriday.diff(moment())).asHours()
        console.log(`${diffHours} hours`) // 31.7 hours
        if (diffHours <= 99) {
          return nextFriday.toString()
        } else {
          return 0
        }
      }
</code>```

Body:
I want to get hours difference between now and next friday 18:00 (weekend) using momentjs, I tried this but it doesn't work :

public getWeekend() {
    const nextFriday = moment().weekday(4)
    nextFriday.hours(18) // Weekend time: 18:00
    nextFriday.minutes(0)
    nextFriday.seconds(0)

    const diff = moment(nextFriday.diff(moment()))
    console.log(diff.days())
    if (diff.days() * 24 + diff.hours() <= 99) {
      return nextFriday.toString()
    } else {
      return 0
    }
  }
}

console.log(diff.days()) is printing 6 days whereas we are Wednesday

Body:
try this:

function getWeekend() {

    const nextFriday = moment().weekday(4)
        nextFriday.hours(18) // Weekend time: 18:00
        nextFriday.minutes(0)
        nextFriday.seconds(0)

        const diffHours = moment.duration(nextFriday.diff(moment())).asHours()
        console.log(`${diffHours} hours`) // 31.7 hours
        if (diffHours <= 99) {
          return nextFriday.toString()
        } else {
          return 0
        }
      }


问:
Regex to match all parameters in application packets
I have a list of parameters in many packets that I need to catch them all using regex.
Each parameter will start with = and will close with &
Example: addonName=CatchMe1&
All the parameters are variables and I cant know what they will contain (String, Integer etc.)

Thank You.

```<code>POST /stringos.txt?addonName=CatchMe1&application=CatchMe2&platform=CatchMe3&platformVersion=CatchMe4&lastVersion=CatchMe5&downloadCount=CatchMe6 HTTP/1.1
Host: Host.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
DNT: 1
Connection: close

addonName=CatchMe1&application=CatchMe2&platform=CatchMe3&platformVersion=CatchMe4&lastVersion=CatchMe5&downloadCount=CatchMe6
</code>```

答:
It's generally better to use an URL parser to get those parameters, but if you really want to use RegEx, you could try (?<==)[^&]+

See this working example: https://regex101.com/r/bzlYZ2/2

Explanation:

(?<==)[^&?]+ ⇒ the full RegEx

(?<==) ⇒ a look-behind (non-capturing), that matches a =

[^&?]+ ⇒ any character that is not & or ? (one or more)

This pattern matches the values of your parameters. If you need the keys and the values, you could use capturing groups: ([^&?]+)=([^&]+) so you have the key in group 1 ($1) and the value in group 2 ($2).

Body:
I have a list of parameters in many packets that I need to catch them all using regex.
Each parameter will start with = and will close with &
Example: addonName=CatchMe1&
All the parameters are variables and I cant know what they will contain (String, Integer etc.)

Thank You.

POST /stringos.txt?addonName=CatchMe1&application=CatchMe2&platform=CatchMe3&platformVersion=CatchMe4&lastVersion=CatchMe5&downloadCount=CatchMe6 HTTP/1.1
Host: Host.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
DNT: 1
Connection: close

addonName=CatchMe1&application=CatchMe2&platform=CatchMe3&platformVersion=CatchMe4&lastVersion=CatchMe5&downloadCount=CatchMe6


问:
Different selectors, same style, how to prevent duplicate output in less
I have the following less code, and it causes four code blocks to be generated, with three blocks having the same content.

Is there a way to ensure only two code blocks will be generated without having to use long chained selectors separated by comma for these elements?

```<code>section.bmform {
    .thanks-for-requesting {
        .change-request {
            .highlight_bordered();
        }
    }
    .bmform-submit-container {
        .bmform_submit {
            .highlight_bordered();
        }
    }
    .btn {
        &.btn-danger {
            &.plus,
            &.minus {
                .highlight_bordered();
            }
        }
    }
}
.highlight_bordered() {
    border-radius: 0px;
    border: 2px solid #af2222;
    font-size: 1.2em;
    line-height: 1.2em;
    padding: 4px 6px 2px 6px;
    &:hover {
        border: 2px solid #8c2828;
        background-color: #bf0808;
    }
}
</code>```

The above generates the following code:

section.bmform .thanks-for-requesting .change-request {
    border-radius: 0;
    border: 2px solid #af2222;
    font-size: 1.2em;
    line-height: 1.2em;
    padding: 4px 6px 2px
}
section.bmform .bmform-submit-container .bmform_submit {
    border-radius: 0;
    border: 2px solid #af2222;
    font-size: 1.2em;
    line-height: 1.2em;
    padding: 4px 6px 2px
}

section.bmform .btn.btn-danger.minus,
section.bmform .btn.btn-danger.plus {
    border-radius: 0;
    border: 2px solid #af2222;
    font-size: 1.2em;
    line-height: 1.2em;
    padding: 4px 6px 2px
}

section.bmform .bmform-submit-container .bmform_submit:hover,
section.bmform .btn.btn-danger.minus:hover,
section.bmform .btn.btn-danger.plus:hover,
section.bmform .thanks-for-requesting .change-request:hover {
    border: 2px solid #8c2828;
    background-color: #bf0808
}
```

<p>This is the code I'd ideally wish to generate.</p>

<pre class="lang-css prettyprint-override"><code>section.bmform .thanks-for-requesting .change-request,
section.bmform .bmform-submit-container .bmform_submit,
section.bmform .btn.btn-danger.plus,
section.bmform .btn.btn-danger.minus {
    border-radius: 0px;
    border: 2px solid #af2222;
    font-size: 1.2em;
    line-height: 1.2em;
    padding: 4px 6px 2px 6px;
}
section.bmform .thanks-for-requesting .change-request:hover,
section.bmform .bmform-submit-container .bmform_submit:hover,
section.bmform .btn.btn-danger.plus:hover,
section.bmform .btn.btn-danger.minus:hover {
    border: 2px solid #8c2828;
    background-color: #bf0808;
}
</code>```

答:
A solution would be to use extend. By using extend it groups selectors that share the same style-rules, resulting in more compact code.

Instead of the selectors listed pulling the code from .highlight_bordered in it, it adds its own selector criteria to the .highlight_bordered style rules.

```<code>section.bmform {
    .thanks-for-requesting {
        .change-request {
            &:extend(.highlight_bordered);
        }
    }
    .bmform-submit-container {
        .bmform_submit {
            &:extend(.highlight_bordered);
        }
    }
    .btn {
        &.btn-danger {
            &.plus,
            &.minus {
                &:extend(.highlight_bordered);
            }
        }
    }
}
</code>```

Body:
I have the following less code, and it causes four code blocks to be generated, with three blocks having the same content.

Is there a way to ensure only two code blocks will be generated without having to use long chained selectors separated by comma for these elements?

section.bmform {
    .thanks-for-requesting {
        .change-request {
            .highlight_bordered();
        }
    }
    .bmform-submit-container {
        .bmform_submit {
            .highlight_bordered();
        }
    }
    .btn {
        &.btn-danger {
            &.plus,
            &.minus {
                .highlight_bordered();
            }
        }
    }
}
.highlight_bordered() {
    border-radius: 0px;
    border: 2px solid #af2222;
    font-size: 1.2em;
    line-height: 1.2em;
    padding: 4px 6px 2px 6px;
    &:hover {
        border: 2px solid #8c2828;
        background-color: #bf0808;
    }
}

The above generates the following code:

section.bmform .thanks-for-requesting .change-request {
    border-radius: 0;
    border: 2px solid #af2222;
    font-size: 1.2em;
    line-height: 1.2em;
    padding: 4px 6px 2px
}
section.bmform .bmform-submit-container .bmform_submit {
    border-radius: 0;
    border: 2px solid #af2222;
    font-size: 1.2em;
    line-height: 1.2em;
    padding: 4px 6px 2px
}

section.bmform .btn.btn-danger.minus,
section.bmform .btn.btn-danger.plus {
    border-radius: 0;
    border: 2px solid #af2222;
    font-size: 1.2em;
    line-height: 1.2em;
    padding: 4px 6px 2px
}

section.bmform .bmform-submit-container .bmform_submit:hover,
section.bmform .btn.btn-danger.minus:hover,
section.bmform .btn.btn-danger.plus:hover,
section.bmform .thanks-for-requesting .change-request:hover {
    border: 2px solid #8c2828;
    background-color: #bf0808
}

This is the code I'd ideally wish to generate.

section.bmform .thanks-for-requesting .change-request,
section.bmform .bmform-submit-container .bmform_submit,
section.bmform .btn.btn-danger.plus,
section.bmform .btn.btn-danger.minus {
    border-radius: 0px;
    border: 2px solid #af2222;
    font-size: 1.2em;
    line-height: 1.2em;
    padding: 4px 6px 2px 6px;
}
section.bmform .thanks-for-requesting .change-request:hover,
section.bmform .bmform-submit-container .bmform_submit:hover,
section.bmform .btn.btn-danger.plus:hover,
section.bmform .btn.btn-danger.minus:hover {
    border: 2px solid #8c2828;
    background-color: #bf0808;
}

Body:
A solution would be to use extend. By using extend it groups selectors that share the same style-rules, resulting in more compact code.

Instead of the selectors listed pulling the code from .highlight_bordered in it, it adds its own selector criteria to the .highlight_bordered style rules.

section.bmform {
    .thanks-for-requesting {
        .change-request {
            &:extend(.highlight_bordered);
        }
    }
    .bmform-submit-container {
        .bmform_submit {
            &:extend(.highlight_bordered);
        }
    }
    .btn {
        &.btn-danger {
            &.plus,
            &.minus {
                &:extend(.highlight_bordered);
            }
        }
    }
}


问:
Matching std::index_sequence by default argument
Is the following allowed by template argument deduction or is that an undeduced context?

#include <utility>
#include<tuple>

template<std::size_t... I>
auto make(std::index_sequence = std::make_index_sequence<2>())
{
    return;
}

int main() {
    make();
}

```

Compile warning is pretty weird

答:
For what it's worth, this compiles:

```<code>template<std::size_t... I>
auto make(std::index_sequence<I...> = std::make_index_sequence<sizeof... (I)>())
</code>```

but probably doesn't do what you want.

Body:
Is the following allowed by template argument deduction or is that an undeduced context?

#include <utility>
#include<tuple>

template<std::size_t... I>
auto make(std::index_sequence = std::make_index_sequence<2>())
{
    return;
}

int main() {
    make();
}

Compile warning is pretty weird

Body:
For what it's worth, this compiles:

template<std::size_t... I>
auto make(std::index_sequence<I...> = std::make_index_sequence<sizeof... (I)>())

but probably doesn't do what you want.


问:
Hide filenames for product images
Is there any way that I can hide the image filenames for all products on a website so that, even if someone chooses to view the page source or image properties, they can't?
I need a way to hide the filenames because in some cases they contain information that i dont want to display to the public.</p>

答:
You can make a PHP script that takes an opaque image ID, finds the corresponding image, and writes it out to the response stream.

Thus, the image URLs on the client would look like ../Image.php?ID=<something useless>.

Remember to set the Content-Type.

Title: Hide filenames for product images


问:
Angular 8: "could not find implementation for builder" when running ng serve
I just installed Angular 8. When I try to run a project with "ng serve --open" it gives me the following error:

```<code>
Could not find the implementation for builder @angular-devkit/build-angular:dev-server
Error: Could not  find the implementation for builder @angular-devkit/build-angular:dev-server
    at WorkspaceNodeModulesArchitectHost.resolveBuilder (C:\Users\manus\project\space-estate\webshop\frontend\client\node_modules\@angular\cli\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js:49:19)
    at ServeCommand.initialize (C:\Users\manus\project\space-estate\webshop\frontend\client\node_modules\@angular\cli\models\architect-command.js:72:63)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
    at startup (internal/bootstrap/node.js:285:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)

</code>```

when I check the versions it gives me the following:

```<code>Angular CLI: 8.0.1
Node: 10.13.0
OS: win32 x64
Angular: 8.0.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.13.9
@angular-devkit/build-angular     0.13.9
@angular-devkit/build-optimizer   0.13.9
@angular-devkit/build-webpack     0.13.9
@angular-devkit/core              8.0.1
@angular-devkit/schematics        8.0.1 (cli-only)
@ngtools/webpack                  7.3.9
@schematics/angular               8.0.1 (cli-only)
@schematics/update                0.800.1 (cli-only)
rxjs                              6.5.2
typescript                        3.4.5
webpack                           4.29.0
</code>```

答:
use this command

npm install --save-dev @angular-devkit/build-angular

Body:
I just installed Angular 8. When I try to run a project with "ng serve --open" it gives me the following error:

Could not find the implementation for builder @angular-devkit/build-angular:dev-server
Error: Could not  find the implementation for builder @angular-devkit/build-angular:dev-server
    at WorkspaceNodeModulesArchitectHost.resolveBuilder (C:\Users\manus\project\space-estate\webshop\frontend\client\node_modules\@angular\cli\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js:49:19)
    at ServeCommand.initialize (C:\Users\manus\project\space-estate\webshop\frontend\client\node_modules\@angular\cli\models\architect-command.js:72:63)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
    at startup (internal/bootstrap/node.js:285:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)

when I check the versions it gives me the following:

Angular CLI: 8.0.1
Node: 10.13.0
OS: win32 x64
Angular: 8.0.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.13.9
@angular-devkit/build-angular     0.13.9
@angular-devkit/build-optimizer   0.13.9
@angular-devkit/build-webpack     0.13.9
@angular-devkit/core              8.0.1
@angular-devkit/schematics        8.0.1 (cli-only)
@ngtools/webpack                  7.3.9
@schematics/angular               8.0.1 (cli-only)
@schematics/update                0.800.1 (cli-only)
rxjs                              6.5.2
typescript                        3.4.5
webpack                           4.29.0


问:
Holding tournament, how to store all player scores
I'm looking to add a tournament to my app, where:

Tournament runs for 24 hours

Players can keep playing and store just their highest score

When the tournament ends, I want to tell the player where they ranked out of all players that entered.

Players will be competing in a simple game with themselves on their mobile device, but the leaderboard will be global (worldwide).

Where can I store the players scores during the tournament and access them once it's over?

答:
There are a few ways to go about this, and the 24h reset might make things a bit complicated:

1. Probably the easiest one is to use the platform specific gaming features through Unity's social API. Some docs on this here: https://docs.unity3d.com/Manual/net-SocialAPI.html
This allows you to use e.g. GameCenter on iOS or Google Play Games

[+] easy to implement

[+] free

[-] you might not be able to access every platform specific feature

[-] normally not cross-platform

2. Implement the platform specific gaming features yourself natively. With this solution you can definitely access all platform specific features.

[+] free

[-] normally not cross-platform

3. Use some 3rd party cross-platform leaderboard service, I'm sure a simple search will yield a few of these, most probably have Unity plugins as well.

[+] should be easy to implement

[-] probably not free

[-] features might be limited

4. Make your own. You can write a simple web API that connects to some database and deploy it to a cloud provider. This is complicated as you suddenly have another thing to develop, secure and maintain... plus pay for the hosting. But as it's your design it can do anything you want - for example your 24h tournament feature might be one of these things.

[+] can do anything

[-] not free to host

[-] you have to write/maintain your own

I think you could get away with for example creating a separately named leaderboard for every day as a way around resetting the leaderboard every day, but you'll have to look into the specific capabilities of all the platforms.


答:
You can take hours difference using (now - next Friday) / 60*60*1000 method, Try it:

```<code>const nextFriday = moment().day(5)
var hours = Math.abs(new Date() - nextFriday) / 36e5;
console.log(hours);
</code>```

Note: 36e5 is the scientific notation for 60*60*1000

Title: How to get hours difference between now and next friday

Body:
You can take hours difference using (now - next Friday) / 60*60*1000 method, Try it:

const nextFriday = moment().day(5)
var hours = Math.abs(new Date() - nextFriday) / 36e5;
console.log(hours);

Note: 36e5 is the scientific notation for 60*60*1000


问:
Semantic UI React dropdown does not set the value onChange: React+ Typescript
I am implementing a semantic-ui-react dropdown and I am unable to set the value of this dropdown on change event.

Help would be appreciated

```<code>//options object
const options =  [
  {name: "val1" , label: "val1"},
  {name: "val2" , label: "val2"},
  {name: "val3" , label: "val3"}
]

this.state= {location: ''} //state object

//onchange event
dropdownChange = (event: React.SyntheticEvent<HTMLElement>, data:any) => {
    this.setState({[data.name]:data.value})
}

//select component
<Select options={options}
  name="location"
  value={this.state.location}
  onChange={this.dropdownChange}
/>
</code>```

答:
You can try like this.</p>

```<code>//onchange event
dropdownChange = (event: React.SyntheticEvent<HTMLElement>, data:any) => {
    this.setState({[event.target.name]:data.value})
}
</code>```

Body:
I am implementing a semantic-ui-react dropdown and I am unable to set the value of this dropdown on change event.

Help would be appreciated

//options object
const options =  [
  {name: "val1" , label: "val1"},
  {name: "val2" , label: "val2"},
  {name: "val3" , label: "val3"}
]

this.state= {location: ''} //state object

//onchange event
dropdownChange = (event: React.SyntheticEvent<HTMLElement>, data:any) => {
    this.setState({[data.name]:data.value})
}

//select component
<Select options={options}
  name="location"
  value={this.state.location}
  onChange={this.dropdownChange}
/>

Body:
You can try like this.

//onchange event
dropdownChange = (event: React.SyntheticEvent<HTMLElement>, data:any) => {
    this.setState({[event.target.name]:data.value})
}


问:
HTML file input accept only .zip files (not .exe)
using this for the accept field in my file input:

```<code>application/zip,application/x-zip,application/x-zip-compressed,application/octet-stream
</code>```

Result:

Internet Explorer: Only shows .zip. Yay.

FireFox: shows all files, but I can change dropdown to only show .zip. Can I change .zip to be the default view somehow?

Chrome: shows .zip and .exe. How do I exclude .exe?

I know chrome is technically right, but I'm trying to be user friendly here.

答:
try

<input type="file" accept=".zip,.rar,.7zip" />```
</div>
</div>
</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><input type="file" accept="zip,application/octet-stream,application/zip,application/x-zip,application/x-zip-compressed"></code>```

Body:
using this for the accept field in my file input:

application/zip,application/x-zip,application/x-zip-compressed,application/octet-stream

Result:

Internet Explorer: Only shows .zip. Yay.

FireFox: shows all files, but I can change dropdown to only show .zip. Can I change .zip to be the default view somehow?

Chrome: shows .zip and .exe. How do I exclude .exe?

I know chrome is technically right, but I'm trying to be user friendly here.

Body:
try

<!-- (IE 10+, Edge, Chrome, Firefox 42+) -->
<input type="file" accept=".zip,.rar,.7zip" />

<input type="file" accept="zip,application/octet-stream,application/zip,application/x-zip,application/x-zip-compressed">


问:
Clicking submit button indirectly wont set $_POST['submit']
I'm trying to get an image to insert into my filesystem:
When a user clicks a button it triggers the file input of a form, when a file is selected it triggers the clicking of the forms submit button, which posts it to the PHP processing script.

Currently the script is not recognising $_POST['submit'] as being set. I can't figure out why?

HTML:

```<code><div id="toolbar">
            <!-- custom toolbar: linking all buttons to Quill -->
            <span class="ql-formats">
                 <button class="ql-clean"></button>
                 <button class="ql-upload"><i class="fas fa-images"></i></button>
            </span>
</div>

<form action="upload.php" method="post" enctype="multipart/form-data" id="form1" runat="server" name="imageForm">
    <input type="file" name="file" id="imgInp">
    <button type="submit" id="sub2" name="submit">Save</button>
    <span id="result"></span>
</form>
</code>```

JS:

```<code>//linking button to input field
$('.ql-upload').click(function()
{
    $("#imgInp").trigger("click");
});

// submitting form when file is chosen
$(document).ready(function()
{
    document.getElementById("imgInp").onchange = function()
    {
        $("#sub2").trigger("click");
    };
});
</code>```

PHP:

```<code>session_start();
require_once('db.php');

if (isset($_POST['submit'])) {
    $file = $_FILES['file'];

    $fileName = $_FILES['file']['name'];
    $fileTmpName = $_FILES['file']['tmp_name'];
    $fileSize = $_FILES['file']['size'];
    $fileError = $_FILES['file']['error'];
    $fileType = $_FILES['file']['type'];
........ etc
</code>```

答:
Instead of checking if $_POST['submit'] is set. I recommend checking if the request is a POST.

```<code>if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    // ... Handle your form
}
</code>```

Body:
I'm trying to get an image to insert into my filesystem:
When a user clicks a button it triggers the file input of a form, when a file is selected it triggers the clicking of the forms submit button, which posts it to the PHP processing script.

Currently the script is not recognising $_POST['submit'] as being set. I can't figure out why?

HTML:

                 <button class="ql-clean"></button>
                 <button class="ql-upload"></button>

<form action="upload.php" method="post" enctype="multipart/form-data" id="form1" runat="server" name="imageForm">
    <input type="file" name="file" id="imgInp">
    <button type="submit" id="sub2" name="submit">Save</button>

</form>

JS:

//linking button to input field
$('.ql-upload').click(function()
{
    $("#imgInp").trigger("click");
});

// submitting form when file is chosen
$(document).ready(function()
{
    document.getElementById("imgInp").onchange = function()
    {
        $("#sub2").trigger("click");
    };
});

PHP:

session_start();
require_once('db.php');

if (isset($_POST['submit'])) {
    $file = $_FILES['file'];

    $fileName = $_FILES['file']['name'];
    $fileTmpName = $_FILES['file']['tmp_name'];
    $fileSize = $_FILES['file']['size'];
    $fileError = $_FILES['file']['error'];
    $fileType = $_FILES['file']['type'];
........ etc

Body:
Instead of checking if $_POST['submit'] is set. I recommend checking if the request is a POST.

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    // ... Handle your form
}


问:
Nested if-conditions vs multiple separated if-conditions with return statement in each one
What is the most professional code-style in the below two functions ?

And what if the function become more complex & larger such as to have 20 checks ?

Note: i need to do some stuff after each check, so i can't concatenate all in one if-statement like:

if (vehicle.isBus) && (vehicle.numberOfWheels == 6) && (vehicle.motorVersion == 2019)

```<code>//first alternative
public bool validate(Vehicle vehicle)
{
    if(vehicle.isBus)
    {
        //do some stuff here related to vehicle.isBus
        if (vehicle.numberOfWheels == 6)
        {
            //do some stuff here related to vehicle.numberOfWheels
            if (vehicle.motorVersion == 2019)
            {
                //do some stuff here related to vehicle.motorVersion
                return true;
            }
        }
    }
    return false;
}

//second alternative
public bool validate(Vehicle vehicle)
{
    if (!vehicle.isBus)
    {
        return false;
    }
    //do some stuff here related to vehicle.isBus

    if (vehicle.numberOfWheels != 6)
    {
        return false;
    }
    //do some stuff here related to vehicle.numberOfWheels

    if (vehicle.motorVersion != 2019)
    {
        return false;
    }
    //do some stuff here related to vehicle.motorVersion

    return true;
}
</code>```

答:
The second example should require less cognitive overhead while reading the code.

In the first example, you need to keep a mental "stack" of the program state. In the second example, you just need to keep a list of things that you already know to be true.

The second example is also less likely to be confounded by a misplaced brace; in fact it doesn't require any braces at all in this example.

Body:
What is the most professional code-style in the below two functions ?

And what if the function become more complex & larger such as to have 20 checks ?

Note: i need to do some stuff after each check, so i can't concatenate all in one if-statement like:

if (vehicle.isBus) && (vehicle.numberOfWheels == 6) && (vehicle.motorVersion == 2019)

//first alternative
public bool validate(Vehicle vehicle)
{
    if(vehicle.isBus)
    {
        //do some stuff here related to vehicle.isBus
        if (vehicle.numberOfWheels == 6)
        {
            //do some stuff here related to vehicle.numberOfWheels
            if (vehicle.motorVersion == 2019)
            {
                //do some stuff here related to vehicle.motorVersion
                return true;
            }
        }
    }
    return false;
}

//second alternative
public bool validate(Vehicle vehicle)
{
    if (!vehicle.isBus)
    {
        return false;
    }
    //do some stuff here related to vehicle.isBus

    if (vehicle.numberOfWheels != 6)
    {
        return false;
    }
    //do some stuff here related to vehicle.numberOfWheels

    if (vehicle.motorVersion != 2019)
    {
        return false;
    }
    //do some stuff here related to vehicle.motorVersion

    return true;
}


问:
Mirror a public site using Nginx server
At work some websites are blocked (oa. Netflix) using some kind of blacklist for prohibited sites. I think the mechanism for blocking these sites is due a custom DNS server. Computers at work are fully locked down and no software can be installed.

I have a private public facing NGINX webserver (Debian) which I can fully customise. My private server is accessible from work.

Is there a way to mirror a site like Netflix through my NGINX server so I can acces it at work?

I have tried to create an extra custom .conf like:

```<code>location /netflix {
    proxy_pass http://netflix.com/;
    proxy_redirect off;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
</code>```

But this does not work. How can I mirror sites through my NGINX webserver?

答:
Try to replace it with this:

```<code>     location /netflix {
        # internal;
         proxy_pass http://netflix.com/;
         proxy_set_header X-SERVER-PORT $server_port;
         proxy_set_header X-SERVER-ADDR $server_addr;
         proxy_set_header HOST $http_host;
         proxy_set_header X-REAL-IP $remote_addr;
}
</code>```

I don't know if you still need it but i noticed your post today so at least i tried to help.

EDIT: I changed URL to match yours. (netflix)

Title: Mirror a public site using Nginx server

Body:
At work some websites are blocked (oa. Netflix) using some kind of blacklist for prohibited sites. I think the mechanism for blocking these sites is due a custom DNS server. Computers at work are fully locked down and no software can be installed.

I have a private public facing NGINX webserver (Debian) which I can fully customise. My private server is accessible from work.

Is there a way to mirror a site like Netflix through my NGINX server so I can acces it at work?

I have tried to create an extra custom .conf like:

location /netflix {
    proxy_pass http://netflix.com/;
    proxy_redirect off;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

But this does not work. How can I mirror sites through my NGINX webserver?

Body:
Try to replace it with this:

     location /netflix {
        # internal;
         proxy_pass http://netflix.com/;
         proxy_set_header X-SERVER-PORT $server_port;
         proxy_set_header X-SERVER-ADDR $server_addr;
         proxy_set_header HOST $http_host;
         proxy_set_header X-REAL-IP $remote_addr;
}

I don't know if you still need it but i noticed your post today so at least i tried to help.

EDIT: I changed URL to match yours. (netflix)


问:
Extracting single words from entries with multiple words from a column in Postgresql
I have a table with multiple columns which has a column named categories. Each entry in a column is consisted of multiple words. Each row has a different number of words. How can I create another table with one column in which each entry would be a single word from the categories column from the previous table?

The table i have and the column i would like to target:

categories

Golf, Active Life

Specialty Food, Restaurants, Dim Sum, Imported Food, Food, Chinese, Ethnic Food, Seafood

I would like another table with one column:

categories

Golf

Active Life

Specialty Food

Restaurants

Dim Sum

...

EDIT: For anyone in the future, I needed a permanent table. Check the comments for full answer.

答:
OK, it's easy to implement this in PG, just use string_to_array and unnest function, like below:

```<code>select
    unnest(string_to_array(categories,',')) as word
into my_new_table
from
    table
</code>```

The example as below:

```<code>select unnest(string_to_array('Specialty Food, Restaurants, Dim Sum, Imported Food, Food, Chinese, Ethnic Food',','));
     unnest
----------------
 Specialty Food
  Restaurants
  Dim Sum
  Imported Food
  Food
  Chinese
  Ethnic Food
(7 rows)
</code>```

Hope it works for you.

Body:
OK, it's easy to implement this in PG, just use string_to_array and unnest function, like below:

select
    unnest(string_to_array(categories,',')) as word
into my_new_table
from
    table

The example as below:

select unnest(string_to_array('Specialty Food, Restaurants, Dim Sum, Imported Food, Food, Chinese, Ethnic Food',','));
     unnest
----------------
 Specialty Food
  Restaurants
  Dim Sum
  Imported Food
  Food
  Chinese
  Ethnic Food
(7 rows)

Hope it works for you.


问:
Issue in oracle query execution
```<code>    Below is the module in sybase.

   sub execute_query{
    $connect = "isql  -S $SERVER-U $USER -P $PASS -D $DBNAME";
    $pid = open2(\*Rder, \*Wrter, "$connect");
    Writer->autoflush();
    print Write qq!
    set transaction isolation level 0
    go
    Select * from remtrench
    go
    !;
    Wrter->close();
    while(<Rder>)
     {
      Parse data
      }
</code>```

The above code made changes to support oracle below.
I was able to connect to oracle.But selecting database query and other query ther than connection doesnt work.Please guide me

```<code>    sub execute_query{
    $connect = "sqlplus  $USER/PASS@SERVER
    $pid = open2(\*Rder, \*Wrter, "$connect");
    Writer->autoflush();
    alter session set current_schema = $DBNAME;
    Select * from remtrench;
    Writer->close();
     ....
     }
</code>```

The above change of mine does not work for alter session the other query (select).Googled on how to execute multiple queries.But still this doesnt help me.
Thanks.

答:
Is it the missing closing quotation mark on the second line?

Alternatively, why are you interacting with databases using their command line programs? You should be using something like DBI or DBIx::Class.

Title: Issue in oracle query execution

Body:
    Below is the module in sybase.

   sub execute_query{
    $connect = "isql  -S $SERVER-U $USER -P $PASS -D $DBNAME";
    $pid = open2(\*Rder, \*Wrter, "$connect");
    Writer->autoflush();
    print Write qq!
    set transaction isolation level 0
    go
    Select * from remtrench
    go
    !;
    Wrter->close();
    while(<Rder>)
     {
      Parse data
      }

The above code made changes to support oracle below.
I was able to connect to oracle.But selecting database query and other query ther than connection doesnt work.Please guide me

    sub execute_query{
    $connect = "sqlplus  $USER/PASS@SERVER
    $pid = open2(\*Rder, \*Wrter, "$connect");
    Writer->autoflush();
    alter session set current_schema = $DBNAME;
    Select * from remtrench;
    Writer->close();
     ....
     }

The above change of mine does not work for alter session the other query (select).Googled on how to execute multiple queries.But still this doesnt help me.
Thanks.


问:
Mysql data encryption
I have a mobile app that sends data to the MySQL database using PHP. I want to use  AES_ENCRYPT function in the PHP file to encrypt my data at the MySQL server. I do not have much experience in data encryption.

Is this method will protecting my data? If not what other methods can I use to secure my data?

I read a tutorial saying the key will be stored in the PHP file, is this method secure and is there any way I can protect my key from being hacked?

答:
This question ultimately leads back to key management - the key has to be stored somewhere.  Where you store the key depends on the amount of security required.

In your scenario (you mention university), I would argue that storing the key on your PHP server (not the database server) would be "enough".

Protection of the key then comes back to how well protected that PHP server is.

I recommend you do your encryption in your PHP code, not using AES_ENCRYPT - this prevents the database server ever knowing what the key is and means that a breach to the database server will not expose any information.

You may also be interested in this repository that demonstrates how to securely encrypt and decrypt data in PHP.

Title: Mysql data encryption


问:
How to count employees who are involved in a proct and list there names in one cell?
I try to write a query which shows me the number of employees who are involved in a project and also list there names in just one cell.

```<code>select p.projectname, count(main.projectnr) "Involved employees" from projects_karl p
join mainpro_karl main
on main.projectnr = p.projectnr
join employees_karl m
on m.employeenr = main.employeenr
group by p.beschreibung
;
</code>```

This query counts the amount of employees who are working in a certain project.
But I also want to list the names of the involved employees.

```<code>select p.projectname, count(main.projectnr) "Anzahl beteiligter MAs", m.firstname || ' ' || m.surname "Name" from projects_karl p
join mainpro_karl main
on main.projectnr = p.projectnr
join Employees_karl m
on m.employeenr = main.employeenr
group by p.projectname, m.firstname || ' ' || m.surname
;
</code>```

This query list involved employees but not in a cell but in a own row. And the count function does not works anymore. It just counts '1' in every row.

答:
use listagg()

```<code>select p.projectname, count(main.projectnr) "Anzahl beteiligter MAs",
listagg(m.firstname || ' ' || m.surname, ',') within group (order by p.projectname) "Name"
from projects_karl p join mainpro_karl main on main.projectnr = p.projectnr
join Employees_karl m on m.employeenr = main.employeenr
group by p.projectname
</code>```

Body:
I try to write a query which shows me the number of employees who are involved in a project and also list there names in just one cell.

select p.projectname, count(main.projectnr) "Involved employees" from projects_karl p
join mainpro_karl main
on main.projectnr = p.projectnr
join employees_karl m
on m.employeenr = main.employeenr
group by p.beschreibung
;

This query counts the amount of employees who are working in a certain project.
But I also want to list the names of the involved employees.

select p.projectname, count(main.projectnr) "Anzahl beteiligter MAs", m.firstname || ' ' || m.surname "Name" from projects_karl p
join mainpro_karl main
on main.projectnr = p.projectnr
join Employees_karl m
on m.employeenr = main.employeenr
group by p.projectname, m.firstname || ' ' || m.surname
;

This query list involved employees but not in a cell but in a own row. And the count function does not works anymore. It just counts '1' in every row.

Body:
use listagg()

select p.projectname, count(main.projectnr) "Anzahl beteiligter MAs",
listagg(m.firstname || ' ' || m.surname, ',') within group (order by p.projectname) "Name"
from projects_karl p join mainpro_karl main on main.projectnr = p.projectnr
join Employees_karl m on m.employeenr = main.employeenr
group by p.projectname


问:
How to implement AOP for someone else's bundles in OSGI (Apache Felix)?
I want to add AOP for classes of different bundles in OSGI (Apache Felix)

I need to create Aspect and to add crosscutting functionality into methods of each implementation specific interface. (prefered with help aspectj)

Problems:

All implementations of aimed interface in different bundles

Each of bundles have self classpath.

We do not know witch bundles have implementation of interface

please help 8)

答: OSGi has a Weavinghook that allows you to intercept class loading. This hook allows you to inspect the byte code and modify it before it becomes a class. It also allows you to add imports.</p>


答:
The OSGi weavinghooks specification that covers weaving of classes for adding aspects.

Here is an example of how to use it. The example uses asm but I am pretty sure you can adapt it for aspectj.

Another example uses aspectj but does not have much doc and also misses a command line build.

Title: How to implement AOP for someone else's bundles in OSGI (Apache Felix)?

Body:
I want to add AOP for classes of different bundles in OSGI (Apache Felix)

I need to create Aspect and to add crosscutting functionality into methods of each implementation specific interface. (prefered with help aspectj)

Problems:

All implementations of aimed interface in different bundles

Each of bundles have self classpath.

We do not know witch bundles have implementation of interface

please help 8)


问:
TabBarItem image appears stretched
I have TabBarViewController in my application, and when I run the application on iOS 11, TabBarItem appears fine, but when I run it on iOS 10, the images are stretched.
Also when I select TabBarItem, the image getting smaller and bigger in very strange way.

Here's screen shot on how it appears on iOS 11

And here how it appears on iOS 10

What to do in this case?

答:
It's because you probably set unbalanced imageInsets. (.top or .bottom alone)

Try to balance it like this:

```<code>item.imageInsets.top = 5
item.imageInsets.bottom = -5
</code>```

Settings just one side works in iOS +11 but not below.

Title: TabBarItem image appears stretched

Body:
It's because you probably set unbalanced imageInsets. (.top or .bottom alone)

Try to balance it like this:

item.imageInsets.top = 5
item.imageInsets.bottom = -5

Settings just one side works in iOS +11 but not below.