问:
Trying to create an elevation map, in R
I am quite new to using R - and i am currently trying to create an elevation diagram of a study site using the below code:

```<code>library(rnaturalearth)
library(rnaturalearthhires)
library(mapview)
library(mapedit)
library(elevatr)
library(tidyverse)
library(raster)

countries<-ne_countries(scale = 110, type = "countries", continent = NULL,
                        country = NULL, geounit = NULL, sovereignty = NULL,
                        returnclass = c("sf"))

admin<-ne_states(country = NULL, geounit = NULL, iso_a2 = NULL, spdf = NULL,
                 returnclass = c("sf"))

admin %>% filter(name=="Áncash") -> Áncash
countries %>% filter(name=="Peru") -> PER

mapview(Áncash) %>% editMap() -> d

poly<-d$drawn
elev1 <- get_elev_raster(poly, z = 14,clip="bbox")
</code>```

When I try to run this I run into the following error message:

```<code>Listening on http://my IP:8888 # For reasons I am not releasing my IP
createTcpServer: address not available
Error in .subset2(public_bind_env, "initialize")(...) :
  Failed to create server
>
> poly<-d$drawn
Error: object 'd' not found
> elev1 <- get_elev_raster(poly, z = 14,clip="bbox")
Error in if (attributes(class(locations)) %in% c("raster", "sp")) { :
  argument is of length zero
</code>```

There is probably something really simple I am missing, but after a couple of hours trying to do this on my own, I am at the point now of needing help!

Thanks in advance!

答:
Your code actually worked for me (eventually), once I had downloaded all the R packages which were required to run it:

```<code>library(rnaturalearth)
library(rnaturalearthhires)
library(mapview)
library(mapedit)
library(elevatr)
library(tidyverse)
library(raster)
</code>```

You seem to be getting an error when running editMap, which launches a shiny application that allows you to draw lines and polygons on a map. You have witheld your IP address in your question, but this IP address should be your home address, i.e. http://127.0.0.1.

I think you might just need to change the port that shiny is running on, so try this:

```<code>options(shiny.port = 7775)
</code>```

Then when you do

```<code>mapview(Áncash) %>% editMap() -> d
</code>```

It should say

```<code>#> Listening on http://127.0.0.1:7775
</code>```

And your viewer should show this:

You should then be able to draw a polygon on your map. I would advise that you only draw a tiny polygon, otherwise the elevation data will literally take hours to download.

When you are happy with the polygon, stop the application and d will contain your polygon. So now when you do

```<code>poly<-d$drawn
elev1 <- get_elev_raster(poly, z = 14, clip="bbox")
</code>```

The data will download to the raster elev1 which you can now plot:

plot(elev1)
```

Title: Trying to create an elevation map, in R

Body:
I am quite new to using R - and i am currently trying to create an elevation diagram of a study site using the below code:

library(rnaturalearth)
library(rnaturalearthhires)
library(mapview)
library(mapedit)
library(elevatr)
library(tidyverse)
library(raster)

countries<-ne_countries(scale = 110, type = "countries", continent = NULL,
                        country = NULL, geounit = NULL, sovereignty = NULL,
                        returnclass = c("sf"))

admin<-ne_states(country = NULL, geounit = NULL, iso_a2 = NULL, spdf = NULL,
                 returnclass = c("sf"))

admin %>% filter(name=="Áncash") -> Áncash
countries %>% filter(name=="Peru") -> PER

mapview(Áncash) %>% editMap() -> d

poly<-d$drawn
elev1 <- get_elev_raster(poly, z = 14,clip="bbox")

When I try to run this I run into the following error message:

Listening on http://my IP:8888 # For reasons I am not releasing my IP
createTcpServer: address not available
Error in .subset2(public_bind_env, "initialize")(...) :
  Failed to create server
>
> poly<-d$drawn
Error: object 'd' not found
> elev1 <- get_elev_raster(poly, z = 14,clip="bbox")
Error in if (attributes(class(locations)) %in% c("raster", "sp")) { :
  argument is of length zero

There is probably something really simple I am missing, but after a couple of hours trying to do this on my own, I am at the point now of needing help!

Thanks in advance!

Body:
Your code actually worked for me (eventually), once I had downloaded all the R packages which were required to run it:

library(rnaturalearth)
library(rnaturalearthhires)
library(mapview)
library(mapedit)
library(elevatr)
library(tidyverse)
library(raster)

You seem to be getting an error when running editMap, which launches a shiny application that allows you to draw lines and polygons on a map. You have witheld your IP address in your question, but this IP address should be your home address, i.e. http://127.0.0.1.

I think you might just need to change the port that shiny is running on, so try this:

options(shiny.port = 7775)

Then when you do

mapview(Áncash) %>% editMap() -> d

It should say

#> Listening on http://127.0.0.1:7775

And your viewer should show this:

You should then be able to draw a polygon on your map. I would advise that you only draw a tiny polygon, otherwise the elevation data will literally take hours to download.

When you are happy with the polygon, stop the application and d will contain your polygon. So now when you do

poly<-d$drawn
elev1 <- get_elev_raster(poly, z = 14, clip="bbox")

The data will download to the raster elev1 which you can now plot:

plot(elev1)


来源: stackexchange

问:
Three.JS and Firebase Hosting CORS Issue
I am trying to load a 3D model using the Three.js MT: / OBJ loader.

Example here: https://threejs.org/examples/#webgl_loader_obj_mtl

The problem is that the Three.js package needs the files and the code to have the same base path.

So if my model is at 3d.com and my files are at 3d.com/files, everything works great.

The thing is, when I use firebase storage to host my 3d files (that users upload), I get an error because the base path is not the same. Firebase storage files start with https://firebasestorage.googleapis.com/v0/... - So I'm getting the CORS issue.

Does anyone know how to get around this?

答:
Does anyone know how to get around this?

You have to ensure that the backend service is correctly configured and sets CORS headers in the HTTP response. For firebase, I suggest you study the following thread:

Firebase Storage and Access-Control-Allow-Origin

Note, this problem is unrelated to three.js and a pure hosting issue. You will run into this security error with each form of AJAX request.

ContentLicense: CC BY-SA 4.0


问:
help with memory issues on adding a UIImageView to a cell
I am adding an image to the first cell in a UITableView cellForRowAtIndexPath like so:

```<code>if (row == 0) {
        UIImage *image = [UIImage imageNamed:@"numberOneIcon.png"];
        //create a framework for the ui image view
        CGRect frame = CGRectMake(10, 37, image.size.width, image.size.height);
        //initialize the ui image view
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:frame];
        imageView.image = image;

        [cell.contentView addSubview:imageView];
        [image release];
        //[imageView release];
}
</code>```

If I uncomment out the [imageView release]; it will crash when you 'close' the app (press the home bttn) then return to the app and return to the view with the UITableView in it.

If I leave this commented it doesn't crash but am I not leaking memory here? If so is there another way to do this so as not to leak.

Many thanks

答:
You can also use:

```<code>    UIImageView *imageView = [[[UIImageView alloc] initWithFrame:frame] autorelease];
</code>```

for your convenience,

ContentLicense: CC BY-SA 3.0

Body:
I am adding an image to the first cell in a UITableView cellForRowAtIndexPath like so:

if (row == 0) {
        UIImage *image = [UIImage imageNamed:@"numberOneIcon.png"];
        //create a framework for the ui image view
        CGRect frame = CGRectMake(10, 37, image.size.width, image.size.height);
        //initialize the ui image view
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:frame];
        imageView.image = image;

        [cell.contentView addSubview:imageView];
        [image release];
        //[imageView release];
}

If I uncomment out the [imageView release]; it will crash when you 'close' the app (press the home bttn) then return to the app and return to the view with the UITableView in it.

If I leave this commented it doesn't crash but am I not leaking memory here? If so is there another way to do this so as not to leak.

Many thanks

Body:
You can also use:

    UIImageView *imageView = [[[UIImageView alloc] initWithFrame:frame] autorelease];

for your convenience,


问:
how to capture dask-worker console log in a file.?
def my_task():
  print("dask_worker_log_msg")
  ...

client = Client()

future = client.submit(my_task)
print("dask_client_log_msg")
...

I want to capture "dask_client_log_msg" and other task-logs in one file and "dask_worker_log_msg" and other client-logs in a separate file. As obviously client will run in a separate process altogether than the worker. so I need one process should log all its message in a separate file. Thanks.!

答:
Here's a solution if you're trying to implement a Dask cluster and need the logs from all jobs that it runs (including logs from your scripts from print or logger.info):

Add a redirect in your bash script starting the worker:
dask-worker >> dask_worker.log 2>&1

In your script, set your logger to dask.distributed, like so:
logger = logging.getLogger("distributed.worker")

Configure the log format in .config/dask/distributed.yaml

See also How to capture logs from workers from a Dask-Yarn job?


问:
Issue with the logo and its position using media queries
As the title states my logo for this assignment needs to be in certain areas of the screen in different screen sizes. I have the mobile positioning correctly implemented but I can't seem to find a solution the positioning of the logo for ipad and larger screens.

For large screens the logo needs to be centered directly above the first .product element, which in my case is the A as in Apple

For ipad screens the logo needs to be halfway between the left edge of the screen and the centered h1 element

No matter what I try the logo just stays fixed the left.

I realize that in css its position is set to float:left but I've changed it to display:flex and the various flexbox properties, but it ended up creating more of a problem. I've changed the logo position in each @media query but the logo always ended up staying in place or way off from where it needs to be.

I understand that google is my best friend but I've exhausted all possible methods and have reached my last resort. The last I wanted to do was get stuck and immediately post here without at least trying for several hours. Forgive me for the newbie and probably obvious question but I'm at my wits end and really need help . Thank you.

* {
  box-sizing: border-box;
  text-align: center;
}

body {
  font-family: "Roboto", sans-serif;
  margin: 0;
  padding: 0;
}

body>i> {
  flex-grow: 0;
}

body>header> {
  flex-grow: 1;
}

.logo>img {
  width: 50px;
}

p {
  text-align: left;
  padding: 15px;
}

.navbar {
  background-color: rgb(105, 105, 105);
  padding: 10px;
  color: white;
  width: 100%;
}

.hamburger {
  display: flex;
  flex-direction: row-reverse;
}

.social {
  display: flex;
  padding-top: 20px;
  flex-direction: row;
  justify-content: space-around;
  border-top: 2px solid #e2e2e2;
}

ul {
  list-style: none;
}

li {
  line-height: 5px;
  float: right;
  padding: 0 0 50px 0;
  margin-right: 30px;
  margin-top: -10px;
}

.product {
  border: 1px solid lightgray;
  border-radius: 10px;
  margin: 10px 30px;
  padding: 10px;
}

@media screen and (max-width: 700px) {
  .logo {
    float: left;
  }
  .menu {
    display: none;
  }
  .logo {
    float: left;
  }
}

@media screen and (max-width: 500px) {
  .logo {
    float: none;
  }
  .menu {
    display: none;
  }
}

@media screen and (min-width: 900px) {
  .hamburger {
    display: none;
  }
  .product {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid lightgray;
    border-radius: 10px;
    margin-left: 30px;
    margin-right: 30px;
    width: 50%;
    text-align: center;
    margin-top: -20px;
    margin-bottom: 0px;
  }
  main {
    display: inline-flex;
  }
  .logo {
    position: absolute;
    left: 0;
    top: 25;
  }
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html lang="en">

<head>
  <title>Parcel Sandbox</title>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css" integrity="sha384-5sAR7xN1Nv6T6+dT2mhtzEpVJvfS3NScPQTrOxhwjIuvcA67KV2R5Jz6kr4abQsz" crossorigin="anonymous">
  <link rel="stylesheet" href="style.css" />
</head>

<body>
  <header>
    <div class="logo"><img src="https://uploads.codesandbox.io/uploads/user/6eb75550-4d51-47fd-8ec1-d216b5da5e5c/M4sq-logo.jpeg" /></div>
    <h1>The ABC Company</h1>
  </header>
  <nav class="navbar">
    <div class="hamburger">☰</div>
    <ul class="menu">
      <li>Help</li>
      <li>Products</li>
      <li>About</li>
      <li>Home</li>
    </ul>
  </nav>
  <main>
    <section class="product">
      <i class="fas fa-apple-alt fa-5x"></i>
      <h2>A as in Apple</h2>
      <p>
        We take out fruit very seriously at ABC, that is why the A in ABC is for Apple. Try our new AppleBook App, the coolest new technology disrupting the fruit industry. This is the Uber of Apples!
      </p>
    </section>
    <section class="product">
      <i class="fas fa-money-bill-wave fa-5x"></i>
      <h2>B as in Bail</h2>
      <p>
        Do you need Bail! Our new BailFace app will provide you with lawyers and bail money at the push of a button. Its the Facebook of bail bonds!
      </p>
    </section>
    <section class="product">
      <i class="fas fa-utensils fa-5x"></i>
      <h2>C as in Curry</h2>

      <p>
        Fancy some curry! Our new HurryCurry app will provide curry cooked by Italian chefs right to your door. Its the AirBnB of curry!
      </p>
    </section>
  </main>
  <footer>
    <ul class="social">
      <li class="social_icon"><i class="fab fa-twitter"></i></li>
      <li class="social_icon"><i class="fab fa-facebook"></i></li>
      <li class="social_icon"><i class="fab fa-instagram"></i></li>
    </ul>
  </footer>
</body>

</html></code>```

答:
This is a nice solution using flexbox or css grid:

Steps to resolve the problem:

Remove the class .logo from the media queries.

Implement the solution in the header element like this:

* {
  box-sizing: border-box;
  text-align: center;
}

body {
  font-family: "Roboto", sans-serif;
  margin: 0;
  padding: 0;
}

header {
  display: flex;
  justify-content: space-between;
  align-items:center;
  margin: 0 30px;
}

.logo>img {
  width: 50px;
}

p {
  text-align: left;
  padding: 15px;
}

.navbar {
  background-color: rgb(105, 105, 105);
  padding: 10px;
  color: white;
  width: 100%;
}

.hamburger {
  display: flex;
  flex-direction: row-reverse;
}

.social {
  display: flex;
  padding-top: 20px;
  flex-direction: row;
  justify-content: space-around;
  border-top: 2px solid #e2e2e2;
}

ul {
  list-style: none;
}

li {
  line-height: 5px;
  float: right;
  padding: 0 0 50px 0;
  margin-right: 30px;
  margin-top: -10px;
}

.product {
  border: 1px solid lightgray;
  border-radius: 10px;
  margin: 10px 30px;
  padding: 10px;
}

@media screen and (max-width: 700px) {
  .menu {
    display: none;
  }
}

@media screen and (max-width: 500px) {
  header {
      flex-flow: column
  }
  .menu {
    display: none;
  }
}

@media screen and (min-width: 900px) {
  .hamburger {
    display: none;
  }
  .product {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid lightgray;
    border-radius: 10px;
    margin-left: 30px;
    margin-right: 30px;
    width: 50%;
    text-align: center;
    margin-top: -20px;
    margin-bottom: 0px;
  }
  main {
    display: inline-flex;
  }
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html lang="en">

<head>
  <title>Parcel Sandbox</title>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css" integrity="sha384-5sAR7xN1Nv6T6+dT2mhtzEpVJvfS3NScPQTrOxhwjIuvcA67KV2R5Jz6kr4abQsz" crossorigin="anonymous">
  <link rel="stylesheet" href="style.css" />
</head>

<body>
  <header>
    <div class="logo"><img src="https://uploads.codesandbox.io/uploads/user/6eb75550-4d51-47fd-8ec1-d216b5da5e5c/M4sq-logo.jpeg" /></div>
    <h1>The ABC Company</h1>
  </header>
  <nav class="navbar">
    <div class="hamburger">☰</div>
    <ul class="menu">
      <li>Help</li>
      <li>Products</li>
      <li>About</li>
      <li>Home</li>
    </ul>
  </nav>
  <main>
    <section class="product">
      <i class="fas fa-apple-alt fa-5x"></i>
      <h2>A as in Apple</h2>
      <p>
        We take out fruit very seriously at ABC, that is why the A in ABC is for Apple. Try our new AppleBook App, the coolest new technology disrupting the fruit industry. This is the Uber of Apples!
      </p>
    </section>
    <section class="product">
      <i class="fas fa-money-bill-wave fa-5x"></i>
      <h2>B as in Bail</h2>
      <p>
        Do you need Bail! Our new BailFace app will provide you with lawyers and bail money at the push of a button. Its the Facebook of bail bonds!
      </p>
    </section>
    <section class="product">
      <i class="fas fa-utensils fa-5x"></i>
      <h2>C as in Curry</h2>

      <p>
        Fancy some curry! Our new HurryCurry app will provide curry cooked by Italian chefs right to your door. Its the AirBnB of curry!
      </p>
    </section>
  </main>
  <footer>
    <ul class="social">
      <li class="social_icon"><i class="fab fa-twitter"></i></li>
      <li class="social_icon"><i class="fab fa-facebook"></i></li>
      <li class="social_icon"><i class="fab fa-instagram"></i></li>
    </ul>
  </footer>
</body>

</html></code>```

If you need to keep the text in the middle of the header, just use css grid instead.

* {
  box-sizing: border-box;
  text-align: center;
}

body {
  font-family: "Roboto", sans-serif;
  margin: 0;
  padding: 0;
}

header {
  flex-grow: 1;
  display: grid;
  grid-template-columns: 0 2fr;
  grid-template-rows: 1fr;
  align-items:center;
  margin: 0 30px;
}

.logo>img {
  width: 50px;
}

p {
  text-align: left;
  padding: 15px;
}

.navbar {
  background-color: rgb(105, 105, 105);
  padding: 10px;
  color: white;
  width: 100%;
}

.hamburger {
  display: flex;
  flex-direction: row-reverse;
}

.social {
  display: flex;
  padding-top: 20px;
  flex-direction: row;
  justify-content: space-around;
  border-top: 2px solid #e2e2e2;
}

ul {
  list-style: none;
}

li {
  line-height: 5px;
  float: right;
  padding: 0 0 50px 0;
  margin-right: 30px;
  margin-top: -10px;
}

.product {
  border: 1px solid lightgray;
  border-radius: 10px;
  margin: 10px 30px;
  padding: 10px;
}

@media screen and (max-width: 700px) {
  .menu {
    display: none;
  }
}

@media screen and (max-width: 500px) {
  header {
    grid-template-columns: 1fr;
  }
  .menu {
    display: none;
  }
}

@media screen and (min-width: 900px) {
  .hamburger {
    display: none;
  }
  .product {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid lightgray;
    border-radius: 10px;
    margin-left: 30px;
    margin-right: 30px;
    width: 50%;
    text-align: center;
    margin-top: -20px;
    margin-bottom: 0px;
  }
  main {
    display: inline-flex;
  }
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html lang="en">

<head>
  <title>Parcel Sandbox</title>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css" integrity="sha384-5sAR7xN1Nv6T6+dT2mhtzEpVJvfS3NScPQTrOxhwjIuvcA67KV2R5Jz6kr4abQsz" crossorigin="anonymous">
  <link rel="stylesheet" href="style.css" />
</head>

<body>
  <header>
    <div class="logo"><img src="https://uploads.codesandbox.io/uploads/user/6eb75550-4d51-47fd-8ec1-d216b5da5e5c/M4sq-logo.jpeg" /></div>
    <h1>The ABC Company</h1>
  </header>
  <nav class="navbar">
    <div class="hamburger">☰</div>
    <ul class="menu">
      <li>Help</li>
      <li>Products</li>
      <li>About</li>
      <li>Home</li>
    </ul>
  </nav>
  <main>
    <section class="product">
      <i class="fas fa-apple-alt fa-5x"></i>
      <h2>A as in Apple</h2>
      <p>
        We take out fruit very seriously at ABC, that is why the A in ABC is for Apple. Try our new AppleBook App, the coolest new technology disrupting the fruit industry. This is the Uber of Apples!
      </p>
    </section>
    <section class="product">
      <i class="fas fa-money-bill-wave fa-5x"></i>
      <h2>B as in Bail</h2>
      <p>
        Do you need Bail! Our new BailFace app will provide you with lawyers and bail money at the push of a button. Its the Facebook of bail bonds!
      </p>
    </section>
    <section class="product">
      <i class="fas fa-utensils fa-5x"></i>
      <h2>C as in Curry</h2>

      <p>
        Fancy some curry! Our new HurryCurry app will provide curry cooked by Italian chefs right to your door. Its the AirBnB of curry!
      </p>
    </section>
  </main>
  <footer>
    <ul class="social">
      <li class="social_icon"><i class="fab fa-twitter"></i></li>
      <li class="social_icon"><i class="fab fa-facebook"></i></li>
      <li class="social_icon"><i class="fab fa-instagram"></i></li>
    </ul>
  </footer>
</body>

</html></code>```

Body:
As the title states my logo for this assignment needs to be in certain areas of the screen in different screen sizes. I have the mobile positioning correctly implemented but I can't seem to find a solution the positioning of the logo for ipad and larger screens.

For large screens the logo needs to be centered directly above the first .product element, which in my case is the A as in Apple

For ipad screens the logo needs to be halfway between the left edge of the screen and the centered h1 element

No matter what I try the logo just stays fixed the left.

I realize that in css its position is set to float:left but I've changed it to display:flex and the various flexbox properties, but it ended up creating more of a problem. I've changed the logo position in each @media query but the logo always ended up staying in place or way off from where it needs to be.

I understand that google is my best friend but I've exhausted all possible methods and have reached my last resort. The last I wanted to do was get stuck and immediately post here without at least trying for several hours. Forgive me for the newbie and probably obvious question but I'm at my wits end and really need help . Thank you.

* {
  box-sizing: border-box;
  text-align: center;
}

body {
  font-family: "Roboto", sans-serif;
  margin: 0;
  padding: 0;
}

body>i> {
  flex-grow: 0;
}

body>header> {
  flex-grow: 1;
}

.logo>img {
  width: 50px;
}

p {
  text-align: left;
  padding: 15px;
}

.navbar {
  background-color: rgb(105, 105, 105);
  padding: 10px;
  color: white;
  width: 100%;
}

.hamburger {
  display: flex;
  flex-direction: row-reverse;
}

.social {
  display: flex;
  padding-top: 20px;
  flex-direction: row;
  justify-content: space-around;
  border-top: 2px solid #e2e2e2;
}

ul {
  list-style: none;
}

li {
  line-height: 5px;
  float: right;
  padding: 0 0 50px 0;
  margin-right: 30px;
  margin-top: -10px;
}

.product {
  border: 1px solid lightgray;
  border-radius: 10px;
  margin: 10px 30px;
  padding: 10px;
}

@media screen and (max-width: 700px) {
  .logo {
    float: left;
  }
  .menu {
    display: none;
  }
  .logo {
    float: left;
  }
}

@media screen and (max-width: 500px) {
  .logo {
    float: none;
  }
  .menu {
    display: none;
  }
}

@media screen and (min-width: 900px) {
  .hamburger {
    display: none;
  }
  .product {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid lightgray;
    border-radius: 10px;
    margin-left: 30px;
    margin-right: 30px;
    width: 50%;
    text-align: center;
    margin-top: -20px;
    margin-bottom: 0px;
  }
  main {
    display: inline-flex;
  }
  .logo {
    position: absolute;
    left: 0;
    top: 25;
  }
}

<!DOCTYPE html>

  <title>Parcel Sandbox</title>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css" integrity="sha384-5sAR7xN1Nv6T6+dT2mhtzEpVJvfS3NScPQTrOxhwjIuvcA67KV2R5Jz6kr4abQsz" crossorigin="anonymous">
  <link rel="stylesheet" href="style.css" />

The ABC Company

☰

Help

Products

About

Home

A as in Apple

        We take out fruit very seriously at ABC, that is why the A in ABC is for Apple. Try our new AppleBook App, the coolest new technology disrupting the fruit industry. This is the Uber of Apples!

B as in Bail

        Do you need Bail! Our new BailFace app will provide you with lawyers and bail money at the push of a button. Its the Facebook of bail bonds!

C as in Curry

        Fancy some curry! Our new HurryCurry app will provide curry cooked by Italian chefs right to your door. Its the AirBnB of curry!

Body:
This is a nice solution using flexbox or css grid:

Steps to resolve the problem:

Remove the class .logo from the media queries.

Implement the solution in the header element like this:

* {
  box-sizing: border-box;
  text-align: center;
}

body {
  font-family: "Roboto", sans-serif;
  margin: 0;
  padding: 0;
}

header {
  display: flex;
  justify-content: space-between;
  align-items:center;
  margin: 0 30px;
}

.logo>img {
  width: 50px;
}

p {
  text-align: left;
  padding: 15px;
}

.navbar {
  background-color: rgb(105, 105, 105);
  padding: 10px;
  color: white;
  width: 100%;
}

.hamburger {
  display: flex;
  flex-direction: row-reverse;
}

.social {
  display: flex;
  padding-top: 20px;
  flex-direction: row;
  justify-content: space-around;
  border-top: 2px solid #e2e2e2;
}

ul {
  list-style: none;
}

li {
  line-height: 5px;
  float: right;
  padding: 0 0 50px 0;
  margin-right: 30px;
  margin-top: -10px;
}

.product {
  border: 1px solid lightgray;
  border-radius: 10px;
  margin: 10px 30px;
  padding: 10px;
}

@media screen and (max-width: 700px) {
  .menu {
    display: none;
  }
}

@media screen and (max-width: 500px) {
  header {
      flex-flow: column
  }
  .menu {
    display: none;
  }
}

@media screen and (min-width: 900px) {
  .hamburger {
    display: none;
  }
  .product {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid lightgray;
    border-radius: 10px;
    margin-left: 30px;
    margin-right: 30px;
    width: 50%;
    text-align: center;
    margin-top: -20px;
    margin-bottom: 0px;
  }
  main {
    display: inline-flex;
  }
}

<!DOCTYPE html>
<html lang="en">

<head>
  <title>Parcel Sandbox</title>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css" integrity="sha384-5sAR7xN1Nv6T6+dT2mhtzEpVJvfS3NScPQTrOxhwjIuvcA67KV2R5Jz6kr4abQsz" crossorigin="anonymous">
  <link rel="stylesheet" href="style.css" />
</head>

<body>
  <header>
    <div class="logo"><img src="https://uploads.codesandbox.io/uploads/user/6eb75550-4d51-47fd-8ec1-d216b5da5e5c/M4sq-logo.jpeg" /></div>
    <h1>The ABC Company</h1>
  </header>
  <nav class="navbar">
    <div class="hamburger">&#9776;</div>
    <ul class="menu">
      <li>Help</li>
      <li>Products</li>
      <li>About</li>
      <li>Home</li>
    </ul>
  </nav>
  <main>
    <section class="product">
      <i class="fas fa-apple-alt fa-5x"></i>
      <h2>A as in Apple</h2>
      <p>
        We take out fruit very seriously at ABC, that is why the A in ABC is for Apple. Try our new AppleBook App, the coolest new technology disrupting the fruit industry. This is the Uber of Apples!
      </p>
    </section>
    <section class="product">
      <i class="fas fa-money-bill-wave fa-5x"></i>
      <h2>B as in Bail</h2>
      <p>
        Do you need Bail! Our new BailFace app will provide you with lawyers and bail money at the push of a button. Its the Facebook of bail bonds!
      </p>
    </section>
    <section class="product">
      <i class="fas fa-utensils fa-5x"></i>
      <h2>C as in Curry</h2>

      <p>
        Fancy some curry! Our new HurryCurry app will provide curry cooked by Italian chefs right to your door. Its the AirBnB of curry!
      </p>
    </section>
  </main>
  <footer>
    <ul class="social">
      <li class="social_icon"><i class="fab fa-twitter"></i></li>
      <li class="social_icon"><i class="fab fa-facebook"></i></li>
      <li class="social_icon"><i class="fab fa-instagram"></i></li>
    </ul>
  </footer>
</body>

</html>

If you need to keep the text in the middle of the header, just use css grid instead.

* {
  box-sizing: border-box;
  text-align: center;
}

body {
  font-family: "Roboto", sans-serif;
  margin: 0;
  padding: 0;
}

header {
  flex-grow: 1;
  display: grid;
  grid-template-columns: 0 2fr;
  grid-template-rows: 1fr;
  align-items:center;
  margin: 0 30px;
}

.logo>img {
  width: 50px;
}

p {
  text-align: left;
  padding: 15px;
}

.navbar {
  background-color: rgb(105, 105, 105);
  padding: 10px;
  color: white;
  width: 100%;
}

.hamburger {
  display: flex;
  flex-direction: row-reverse;
}

.social {
  display: flex;
  padding-top: 20px;
  flex-direction: row;
  justify-content: space-around;
  border-top: 2px solid #e2e2e2;
}

ul {
  list-style: none;
}

li {
  line-height: 5px;
  float: right;
  padding: 0 0 50px 0;
  margin-right: 30px;
  margin-top: -10px;
}

.product {
  border: 1px solid lightgray;
  border-radius: 10px;
  margin: 10px 30px;
  padding: 10px;
}

@media screen and (max-width: 700px) {
  .menu {
    display: none;
  }
}

@media screen and (max-width: 500px) {
  header {
    grid-template-columns: 1fr;
  }
  .menu {
    display: none;
  }
}

@media screen and (min-width: 900px) {
  .hamburger {
    display: none;
  }
  .product {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid lightgray;
    border-radius: 10px;
    margin-left: 30px;
    margin-right: 30px;
    width: 50%;
    text-align: center;
    margin-top: -20px;
    margin-bottom: 0px;
  }
  main {
    display: inline-flex;
  }
}

<!DOCTYPE html>
<html lang="en">

<head>
  <title>Parcel Sandbox</title>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css" integrity="sha384-5sAR7xN1Nv6T6+dT2mhtzEpVJvfS3NScPQTrOxhwjIuvcA67KV2R5Jz6kr4abQsz" crossorigin="anonymous">
  <link rel="stylesheet" href="style.css" />
</head>

<body>
  <header>
    <div class="logo"><img src="https://uploads.codesandbox.io/uploads/user/6eb75550-4d51-47fd-8ec1-d216b5da5e5c/M4sq-logo.jpeg" /></div>
    <h1>The ABC Company</h1>
  </header>
  <nav class="navbar">
    <div class="hamburger">&#9776;</div>
    <ul class="menu">
      <li>Help</li>
      <li>Products</li>
      <li>About</li>
      <li>Home</li>
    </ul>
  </nav>
  <main>
    <section class="product">
      <i class="fas fa-apple-alt fa-5x"></i>
      <h2>A as in Apple</h2>
      <p>
        We take out fruit very seriously at ABC, that is why the A in ABC is for Apple. Try our new AppleBook App, the coolest new technology disrupting the fruit industry. This is the Uber of Apples!
      </p>
    </section>
    <section class="product">
      <i class="fas fa-money-bill-wave fa-5x"></i>
      <h2>B as in Bail</h2>
      <p>
        Do you need Bail! Our new BailFace app will provide you with lawyers and bail money at the push of a button. Its the Facebook of bail bonds!
      </p>
    </section>
    <section class="product">
      <i class="fas fa-utensils fa-5x"></i>
      <h2>C as in Curry</h2>

      <p>
        Fancy some curry! Our new HurryCurry app will provide curry cooked by Italian chefs right to your door. Its the AirBnB of curry!
      </p>
    </section>
  </main>
  <footer>
    <ul class="social">
      <li class="social_icon"><i class="fab fa-twitter"></i></li>
      <li class="social_icon"><i class="fab fa-facebook"></i></li>
      <li class="social_icon"><i class="fab fa-instagram"></i></li>
    </ul>
  </footer>
</body>

</html>


问:
Data/Contents are missing when using Python Selenium
I am testing how to use Selenium in python, and successfully open a page via this below code in Ubuntu 16.04:

```<code>#!/usr/bin/env python
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
firefox_options = Options()
firefox_options.binary_location = '/usr/bin/firefox'
driver= webdriver.Firefox(executable_path='/home/myname/geckodriver',firefox_options=firefox_options)
driver.get('https://www.toutiao.com')
</code>```

However, some data/contents are missing, comparing to open this page('https://www.toutiao.com') manually.

My Firefox version is '72.0.2' and geckodriver version is'0.26.0'. Could anybody help me on this issue please? Thanks in Advance!

答:
I took your code, simplified the script and while execution I have encountered the similar issue i.e. the data/contents are missing comparing to open this page as follows:

Code Block:

```<code>    from selenium import webdriver

    driver = webdriver.Firefox(executable_path=r'C:\Utility\BrowserDrivers\geckodriver.exe')
    driver.get('https://www.toutiao.com')
    print(driver.page_source)
</code>```

Console Output:

```<code>    <html><head><style class="vjs-styles-defaults">
          .video-js {
        width: 300px;
        height: 150px;
          }

          .vjs-fluid {
        padding-top: 56.25%
          }
        </style><meta charset="utf-8"><title>????</title><meta http-equiv="x-dns-prefetch-control" content="on"><meta name="renderer" content="webkit"><link rel="dns-prefetch" href="//s3.pstatp.com/"><link rel="dns-prefetch" href="//s3a.pstatp.com/"><link rel="dns-prefetch" href="//s3b.pstatp.com"><link rel="dns-prefetch" href="//p1.pstatp.com/"><link rel="dns-prefetch" href="//p3.pstatp.com/"><meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,minimal-ui"><meta name="360-site-verification" content="b96e1758dfc9156a410a4fb9520c5956"><meta name="360_ssp_verify" content="2ae4ad39552c45425bddb738efda3dbb"><meta name="google-site-verification" content="3PYTTW0s7IAfkReV8wAECfjIdKY-bQeSkVTyJNZpBKE"><meta name="shenma-site-verification" content="34c05607e2a9430ad4249ed48faaf7cb_1432711730"><meta name="baidu_union_verify" content="b88dd3920f970845bad8ad9f90d687f7"><meta name="domain_verify" content="pmrgi33nmfuw4ir2ej2g65lunfqw6ltdn5wselbcm52wszbchirdqyztge3tenrsgq3dknjume2tayrvmqytemlfmiydimddgu4gcnzcfqrhi2lnmvjwc5tfei5dcnbwhazdcobuhe2dqobrpu"><meta name="keywords" content="????,??,???,????,??????"><meta name="description" content="«????»(www.toutiao.com)????????????????,?????????????????,?????????????,??????????????????????"><link rel="alternate" media="only screen and (max-width: 640px)" href="//m.toutiao.com/"><link rel="shortcut icon" href="//s3a.pstatp.com/toutiao/resource/ntoutiao_web/static/image/favicon_5995b44.ico" type="image/x-icon"><link rel="stylesheet" href="//s3.pstatp.com/toutiao/player/dist/pc_vue2.css" media="screen" title="no title"><!--[if lt IE 9]>
      <p>?????????,?<a href="http://browsehappy.com/">?????</a></p>
    .
    .
    .
    <script>var imgUrl = '/c/9ubkblw9out4h9t6ya05r7h0uu7q2u341jhsdh7l4r4yphpuxlqgdm/';</script><script>tac='i+2gv2ch1tigds!i$1dmgs"yZl!%s"l"u&kLs#l l#vr*charCodeAtx0[!cb^i$1em7b*0d#>>>s j\uffeel  s#0,<8~z|\x7f@QGNCJF[\\^D\\KFYSk~^WSZhg,(lfi~ah`{md"inb|1d<,%Dscafgd"in,8[xtm}nLzNEGQMKAdGG^NTY\x1ckgd"inb<b|1d<g,&TboLr{m,(\x02)!jx-2n&vr$testxg,%@tug{mn ,%vrfkbm[!cb|'</script><script type="text/javascript" crossorigin="anonymous" src="//s3b.pstatp.com/toutiao/static/js/vendor.63b66d4280309ac2fb48.js"></script><script type="text/javascript" crossorigin="anonymous" src="//s3a.pstatp.com/toutiao/static/js/page/index_node/index.e6afc60a3a3f653cfdba.js"></script><script type="text/javascript" crossorigin="anonymous" src="//s3b.pstatp.com/toutiao/static/js/ttstatistics.a083f6cd9b1a9a970725.js"></script><script src="//s3.pstatp.com/inapp/lib/raven.js" crossorigin="anonymous"></script><script>;(function(window) {
        // sentry
        window.Raven && Raven.config('//key@m.toutiao.com/log/sentry/v2/96', {
          whitelistUrls: [/pstatp\.com/],
          shouldSendCallback: function(data) {
        var ua = navigator && navigator.userAgent;
        var isDeviceOK = !/Mobile|Linux/i.test(navigator.userAgent);
        return isDeviceOK;
          },
          tags: {
        bid: 'toutiao_pc',
        pid: 'index_new'
          },
          autoBreadcrumbs: {
        'xhr': false,
        'console': true,
        'dom': true,
        'location': true
          }
        }).install();
      })(window);</script><script>document.getElementsByTagName('body')[0].addEventListener('click', function(e) {
        var target = e.target,
        ga_event,
        ga_category,
        ga_label,
        ga_value;
        while(target && target.nodeName.toUpperCase() !== 'BODY') {
          ga_event = target.getAttribute('ga_event');
          ga_category = target.getAttribute('ga_category') || '/';
          ga_label = target.getAttribute('ga_label') || '';
          ga_value = target.getAttribute('ga_value') || 1;

          ga_event && window.ttAnalysis && ttAnalysis.send('event', { ev: ga_event });
          target = target.parentNode;
        }
      });</script><script src="https://xxbg.snssdk.com/websdk/v1/getInfo?q=YOsueEs6CjZquUQrQwttBa2p27c%2FmJBGcEmZKypwf%2Fh%2B%2FFzCVrIwzk9L3bo%2FZb2O8gVTNaA4L2Bk10qWfZ2s94e6qe8KRXlOEjnI%2FrONB4jQynV3bfJ9exD2E4QPsgydRGjRLlDXE9uYD7HU3IZ%2FOU2MJG2vMgfNU55%2FmsOAlVSrPQH2wo4Eor0lgghKHjRi28vVvBdKY7JT4gG7S7ThRFD2YBIc%2Fs4JYViQu1Ll1Bg5Xn5bKuD6jZRz3AzfFqzSOWguO6vUbzL0wBc4mpa22mdpmAXIvUNWtjg5MUfXh9rfWI0ti7saL%2B0r4%2BaBdN5y4lrmxAcQZq2oeAKl4WjOeJsN%2BePpYmisoxTzdBZ6TL8IGE0E7ZUUlFlPGyUWhU3E4IRbtbCCd0QdVaJajiSOIhg9cImqTZYI56kIao1yVnV%2Bxu4%2BhaC1kHu5xsk49%2BX%2FNdwGcel%2BlOUzagkE5s8X6jEswA7jzW%2ByD6%2FusfkNyyx8WOWCJmZlTGQ4SNQr%2FQHvmK2QscQ7KnTvKVqjedUd7IFcvyTyYz3iFFrmRkOMRN9042sLiQwerXsn0f%2Fc%2Bh46PNdeU1S6BsFKq%2BZhMDxw1vI2Y1C%2Fa0RBdZC%2BGZq%2BkbNaoVotfvslg05ahevHTainlZR9DHEiWawFBJbTwjMeYrmo4NZiL5eNBUvslFn%2BDPHk%2F6Oj0Nbb89Rx8Ihi2pRH04voRog9848H2o2LR9gx0N0i0o6%3D&callback=_8712_1581940674310"></script></body></html>
</code>```

Analysis

While inspecting the DOM Tree of the webpage you will find that some of the

//s3a.pstatp.com/toutiao/picc_mig/dist/img.min.js

Which is a clear indication that the website is protected by Bot Management service provider Distil Networks and the navigation by ChromeDriver gets detected and subsequently blocked.

Distil

As per the article There Really Is Something About Distil.it...:

Distil protects sites against automatic content scraping bots by observing site behavior and identifying patterns peculiar to scrapers. When Distil identifies a malicious bot on one site, it creates a blacklisted behavioral profile that is deployed to all its customers. Something like a bot firewall, Distil detects patterns and reacts.

Further,

"One pattern with **Selenium** was automating the theft of Web content", Distil CEO Rami Essaid said in an interview last week. "Even though they can create new bots, we figured out a way to identify Selenium the a tool they're using, so we're blocking Selenium no matter how many times they iterate on that bot. We're doing that now with Python and a lot of different technologies. Once we see a pattern emerge from one type of bot, then we work to reverse engineer the technology they use and identify it as malicious".

Reference

You can find a couple of detailed discussion in:

Is there a way to use Selenium WebDriver without informing the document that it is controlled by WebDriver?

Selenium webdriver: Modifying navigator.webdriver flag to prevent selenium detection

Akamai Bot Manager detects WebDriver driven Chrome Browsing Context

Is there a version of selenium webdriver that is not detectable?

Body:
I am testing how to use Selenium in python, and successfully open a page via this below code in Ubuntu 16.04:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
firefox_options = Options()
firefox_options.binary_location = '/usr/bin/firefox'
driver= webdriver.Firefox(executable_path='/home/myname/geckodriver',firefox_options=firefox_options)
driver.get('https://www.toutiao.com')

However, some data/contents are missing, comparing to open this page('https://www.toutiao.com') manually.

My Firefox version is '72.0.2' and geckodriver version is'0.26.0'. Could anybody help me on this issue please? Thanks in Advance!

Body:
I took your code, simplified the script and while execution I have encountered the similar issue i.e. the data/contents are missing comparing to open this page as follows:

Code Block:

    from selenium import webdriver

    driver = webdriver.Firefox(executable_path=r'C:\Utility\BrowserDrivers\geckodriver.exe')
    driver.get('https://www.toutiao.com')
    print(driver.page_source)

Console Output:

    <html><head><style class="vjs-styles-defaults">
          .video-js {
        width: 300px;
        height: 150px;
          }

          .vjs-fluid {
        padding-top: 56.25%
          }
        </style><meta charset="utf-8"><title>????</title><meta http-equiv="x-dns-prefetch-control" content="on"><meta name="renderer" content="webkit"><link rel="dns-prefetch" href="//s3.pstatp.com/"><link rel="dns-prefetch" href="//s3a.pstatp.com/"><link rel="dns-prefetch" href="//s3b.pstatp.com"><link rel="dns-prefetch" href="//p1.pstatp.com/"><link rel="dns-prefetch" href="//p3.pstatp.com/"><meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,minimal-ui"><meta name="360-site-verification" content="b96e1758dfc9156a410a4fb9520c5956"><meta name="360_ssp_verify" content="2ae4ad39552c45425bddb738efda3dbb"><meta name="google-site-verification" content="3PYTTW0s7IAfkReV8wAECfjIdKY-bQeSkVTyJNZpBKE"><meta name="shenma-site-verification" content="34c05607e2a9430ad4249ed48faaf7cb_1432711730"><meta name="baidu_union_verify" content="b88dd3920f970845bad8ad9f90d687f7"><meta name="domain_verify" content="pmrgi33nmfuw4ir2ej2g65lunfqw6ltdn5wselbcm52wszbchirdqyztge3tenrsgq3dknjume2tayrvmqytemlfmiydimddgu4gcnzcfqrhi2lnmvjwc5tfei5dcnbwhazdcobuhe2dqobrpu"><meta name="keywords" content="????,??,???,????,??????"><meta name="description" content="«????»(www.toutiao.com)????????????????,?????????????????,?????????????,??????????????????????"><link rel="alternate" media="only screen and (max-width: 640px)" href="//m.toutiao.com/"><link rel="shortcut icon" href="//s3a.pstatp.com/toutiao/resource/ntoutiao_web/static/image/favicon_5995b44.ico" type="image/x-icon"><link rel="stylesheet" href="//s3.pstatp.com/toutiao/player/dist/pc_vue2.css" media="screen" title="no title"><!--[if lt IE 9]>
      <p>?????????,?<a href="http://browsehappy.com/">?????</a></p>
    .
    .
    .
    <script>var imgUrl = '/c/9ubkblw9out4h9t6ya05r7h0uu7q2u341jhsdh7l4r4yphpuxlqgdm/';</script><script>tac='i+2gv2ch1tigds!i$1dmgs"yZl!%s"l"u&kLs#l l#vr*charCodeAtx0[!cb^i$1em7b*0d#>>>s j\uffeel  s#0,<8~z|\x7f@QGNCJF[\\^D\\KFYSk~^WSZhg,(lfi~ah`{md"inb|1d<,%Dscafgd"in,8[xtm}nLzNEGQMKAdGG^NTY\x1ckgd"inb<b|1d<g,&TboLr{m,(\x02)!jx-2n&vr$testxg,%@tug{mn ,%vrfkbm[!cb|'</script><script type="text/javascript" crossorigin="anonymous" src="//s3b.pstatp.com/toutiao/static/js/vendor.63b66d4280309ac2fb48.js"></script><script type="text/javascript" crossorigin="anonymous" src="//s3a.pstatp.com/toutiao/static/js/page/index_node/index.e6afc60a3a3f653cfdba.js"></script><script type="text/javascript" crossorigin="anonymous" src="//s3b.pstatp.com/toutiao/static/js/ttstatistics.a083f6cd9b1a9a970725.js"></script><script src="//s3.pstatp.com/inapp/lib/raven.js" crossorigin="anonymous"></script><script>;(function(window) {
        // sentry
        window.Raven && Raven.config('//key@m.toutiao.com/log/sentry/v2/96', {
          whitelistUrls: [/pstatp\.com/],
          shouldSendCallback: function(data) {
        var ua = navigator && navigator.userAgent;
        var isDeviceOK = !/Mobile|Linux/i.test(navigator.userAgent);
        return isDeviceOK;
          },
          tags: {
        bid: 'toutiao_pc',
        pid: 'index_new'
          },
          autoBreadcrumbs: {
        'xhr': false,
        'console': true,
        'dom': true,
        'location': true
          }
        }).install();
      })(window);</script><script>document.getElementsByTagName('body')[0].addEventListener('click', function(e) {
        var target = e.target,
        ga_event,
        ga_category,
        ga_label,
        ga_value;
        while(target && target.nodeName.toUpperCase() !== 'BODY') {
          ga_event = target.getAttribute('ga_event');
          ga_category = target.getAttribute('ga_category') || '/';
          ga_label = target.getAttribute('ga_label') || '';
          ga_value = target.getAttribute('ga_value') || 1;

          ga_event && window.ttAnalysis && ttAnalysis.send('event', { ev: ga_event });
          target = target.parentNode;
        }
      });</script><script src="https://xxbg.snssdk.com/websdk/v1/getInfo?q=YOsueEs6CjZquUQrQwttBa2p27c%2FmJBGcEmZKypwf%2Fh%2B%2FFzCVrIwzk9L3bo%2FZb2O8gVTNaA4L2Bk10qWfZ2s94e6qe8KRXlOEjnI%2FrONB4jQynV3bfJ9exD2E4QPsgydRGjRLlDXE9uYD7HU3IZ%2FOU2MJG2vMgfNU55%2FmsOAlVSrPQH2wo4Eor0lgghKHjRi28vVvBdKY7JT4gG7S7ThRFD2YBIc%2Fs4JYViQu1Ll1Bg5Xn5bKuD6jZRz3AzfFqzSOWguO6vUbzL0wBc4mpa22mdpmAXIvUNWtjg5MUfXh9rfWI0ti7saL%2B0r4%2BaBdN5y4lrmxAcQZq2oeAKl4WjOeJsN%2BePpYmisoxTzdBZ6TL8IGE0E7ZUUlFlPGyUWhU3E4IRbtbCCd0QdVaJajiSOIhg9cImqTZYI56kIao1yVnV%2Bxu4%2BhaC1kHu5xsk49%2BX%2FNdwGcel%2BlOUzagkE5s8X6jEswA7jzW%2ByD6%2FusfkNyyx8WOWCJmZlTGQ4SNQr%2FQHvmK2QscQ7KnTvKVqjedUd7IFcvyTyYz3iFFrmRkOMRN9042sLiQwerXsn0f%2Fc%2Bh46PNdeU1S6BsFKq%2BZhMDxw1vI2Y1C%2Fa0RBdZC%2BGZq%2BkbNaoVotfvslg05ahevHTainlZR9DHEiWawFBJbTwjMeYrmo4NZiL5eNBUvslFn%2BDPHk%2F6Oj0Nbb89Rx8Ihi2pRH04voRog9848H2o2LR9gx0N0i0o6%3D&amp;callback=_8712_1581940674310"></script></body></html>

Analysis

While inspecting the DOM Tree of the webpage you will find that some of the <script> tag refers to JavaScripts having keyword dist. As an example:

<link rel="stylesheet" href="//s3.pstatp.com/toutiao/player/dist/pc_vue2.css" media="screen" title="no title">

<script src="//unpkg.pstatp.com/byted/sec_sdk_build/1.1.12/dist/captcha.js"></script>

//s3a.pstatp.com/toutiao/picc_mig/dist/img.min.js

Which is a clear indication that the website is protected by Bot Management service provider Distil Networks and the navigation by ChromeDriver gets detected and subsequently blocked.

Distil

As per the article There Really Is Something About Distil.it...:

Distil protects sites against automatic content scraping bots by observing site behavior and identifying patterns peculiar to scrapers. When Distil identifies a malicious bot on one site, it creates a blacklisted behavioral profile that is deployed to all its customers. Something like a bot firewall, Distil detects patterns and reacts.

Further,

"One pattern with **Selenium** was automating the theft of Web content", Distil CEO Rami Essaid said in an interview last week. "Even though they can create new bots, we figured out a way to identify Selenium the a tool they're using, so we're blocking Selenium no matter how many times they iterate on that bot. We're doing that now with Python and a lot of different technologies. Once we see a pattern emerge from one type of bot, then we work to reverse engineer the technology they use and identify it as malicious".

Reference

You can find a couple of detailed discussion in:

Is there a way to use Selenium WebDriver without informing the document that it is controlled by WebDriver?

Selenium webdriver: Modifying navigator.webdriver flag to prevent selenium detection

Akamai Bot Manager detects WebDriver driven Chrome Browsing Context

Is there a version of selenium webdriver that is not detectable?


问:
How can I test LibreOffice Writer's accessible PDF output?
LibreOffice Writer can export to Tagged PDF. How should I test the accessibility of the resulting document? Maybe something like inspecting the tags that have been added to check they reflect the intended document structure, or perhaps simulating the experience of a user consuming the document through accessibility software?

I'm aware that Adobe Acrobat Pro has relevant features, but I'm looking for a solution using Free/Libre/Opensource software.

答:
There's a free (as in beer) Windows-only tool called PAC which is ruthlessly good: https://support.axes4.com/hc/en-us/articles/201957988-PDF-Accessibility-Checker-PAC-

I am not aware of any Libre software that does this.


问:
EPi find get all variants if search hit on product
A EPi find question coming up, We have WebProducts and WebVariants and when showing a simple product listing on the category page I'm showing the following result correctly

If a WebProduct doesn't have any variants - show the WebProduct on the result

If a WebProduct has variants - show the WebVariants and hide the WebProduct

But when I'm trying to use the same functionality for the site-search it gets complicated.
The WebProduct has a property named Brand while the WebVariants doesn't have that property. So when I search for "My brand" and I get a hit on a WebProduct that has WebVariants, it won't show the WebProduct because point 2 is true in that case.

I on the other hand don't want to show the product, but I want to get the variants for that product... It might sound confusing :grimacing:

I'll add a code snippet of the code that makes point 1 and 2 to work.

```<code>                .SearchAndFilterFor(q)
                .Filter(x =>
                    (x.MatchType(typeof(WebVariant))) |
                    (x.MatchType(typeof(WebProduct)) & ((WebProduct)x).HasVariants().Match(false)))```

```

答:
I would say that you have a couple of options to choose from.

Either:

1: Change the way your variants are indexed so that they include some of the key info (in this case brand) that they currently lack and as such, appear in the search results.

OR

2: Just do the search for WebProduct and then loop through those results afterward to do the processing for ones that do/don't have variants.

Body:
A EPi find question coming up, We have WebProducts and WebVariants and when showing a simple product listing on the category page I'm showing the following result correctly

If a WebProduct doesn't have any variants - show the WebProduct on the result

If a WebProduct has variants - show the WebVariants and hide the WebProduct

But when I'm trying to use the same functionality for the site-search it gets complicated.
The WebProduct has a property named Brand while the WebVariants doesn't have that property. So when I search for "My brand" and I get a hit on a WebProduct that has WebVariants, it won't show the WebProduct because point 2 is true in that case.

I on the other hand don't want to show the product, but I want to get the variants for that product... It might sound confusing :grimacing:

I'll add a code snippet of the code that makes point 1 and 2 to work.

                .SearchAndFilterFor(q)
                .Filter(x =>
                    (x.MatchType(typeof(WebVariant))) |
                    (x.MatchType(typeof(WebProduct)) & ((WebProduct)x).HasVariants().Match(false)))```


问:
how to disable the append value in a angular form
I have scenario where iam having the forms  with the name field, where i will pass the default value and i need to make this as read only or disabled  and also i can able to append the value with this.
eg: Room-123
Room-is the default value need to read only or disabled
123-can be append with the room and it can be editable.can anyone give a solution for this.

```<code>public  RoomValue: string='Room';
 public roomDiagForm = this.formBuilder.group({
    id:this.formBuilder.control(''),
    name: this.formBuilder.control(this.RoomValue, Validators.required),
    type: this.formBuilder.control('', Validators.required),
    locationId: this.formBuilder.control(this.location, Validators.required),
  });
</code>```

this is my code.

答:
You can try this one.

Call a function when you find value can change and check your conditions

.ts file

```<code>import { Component } from "@angular/core";
import { FormGroup, FormBuilder } from "@angular/forms";

@Component({
  selector: "my-app",
  templateUrl: "./app.component.html",
  styleUrls: ["./app.component.css"]
})
export class AppComponent {
  contactForm: FormGroup;
  defaultName = "Room";

  constructor(private formBuilder: FormBuilder) {
    this.createContactForm();
  }

  createContactForm() {
    this.contactForm = this.formBuilder.group({
      fullName: [this.defaultName]
    });
  }

  checkFullname(event) {
    let readOnlyLength = this.defaultName.length;
    let enteredValue = this.contactForm.controls["fullName"].value;
    let keypressed = event.which; // 8 => backspace, 46 => delete
    if (
      (keypressed == 8 && enteredValue.length <= readOnlyLength) ||
      (keypressed == 46 && enteredValue.length <= readOnlyLength)
    ) {
      event.preventDefault();
    }
    if (keypressed != 0 && event.target.selectionStart < readOnlyLength) {
      event.preventDefault();
    }
  }
}
</code>```

.html

```<code><form [formGroup]="contactForm" (ngSubmit)="onSubmit()">
    <input type = "text" name = "fullName" placeholder = "Your full name" formControlName="fullName" (keydown)="checkFullname($event)" (keyup)="checkFullname($event)" (paste)="checkFullname($event)" (cut)="checkFullname($event)">
    <br/>
    <input type = "submit" value = "Send">
</form>
</code>```

working link

https://stackblitz.com/edit/angular-yub6rf?embed=1&file=src/app/app.component.html

Note: I was also searching to club possible events together as all are calling same function but I am not able to do it.

I found a github link check this as well if you can find a way

https://github.com/angular/angular/issues/6675

Body:
I have scenario where iam having the forms  with the name field, where i will pass the default value and i need to make this as read only or disabled  and also i can able to append the value with this.
eg: Room-123
Room-is the default value need to read only or disabled
123-can be append with the room and it can be editable.can anyone give a solution for this.

public  RoomValue: string='Room';
 public roomDiagForm = this.formBuilder.group({
    id:this.formBuilder.control(''),
    name: this.formBuilder.control(this.RoomValue, Validators.required),
    type: this.formBuilder.control('', Validators.required),
    locationId: this.formBuilder.control(this.location, Validators.required),
  });

this is my code.

Body:
You can try this one.

Call a function when you find value can change and check your conditions

.ts file

import { Component } from "@angular/core";
import { FormGroup, FormBuilder } from "@angular/forms";

@Component({
  selector: "my-app",
  templateUrl: "./app.component.html",
  styleUrls: ["./app.component.css"]
})
export class AppComponent {
  contactForm: FormGroup;
  defaultName = "Room";

  constructor(private formBuilder: FormBuilder) {
    this.createContactForm();
  }

  createContactForm() {
    this.contactForm = this.formBuilder.group({
      fullName: [this.defaultName]
    });
  }

  checkFullname(event) {
    let readOnlyLength = this.defaultName.length;
    let enteredValue = this.contactForm.controls["fullName"].value;
    let keypressed = event.which; // 8 => backspace, 46 => delete
    if (
      (keypressed == 8 && enteredValue.length <= readOnlyLength) ||
      (keypressed == 46 && enteredValue.length <= readOnlyLength)
    ) {
      event.preventDefault();
    }
    if (keypressed != 0 && event.target.selectionStart < readOnlyLength) {
      event.preventDefault();
    }
  }
}

.html

<form [formGroup]="contactForm" (ngSubmit)="onSubmit()">
    <input type = "text" name = "fullName" placeholder = "Your full name" formControlName="fullName" (keydown)="checkFullname($event)" (keyup)="checkFullname($event)" (paste)="checkFullname($event)" (cut)="checkFullname($event)">
    <br/>
    <input type = "submit" value = "Send">
</form>

working link

https://stackblitz.com/edit/angular-yub6rf?embed=1&file=src/app/app.component.html

Note: I was also searching to club possible events together as all are calling same function but I am not able to do it.

I found a github link check this as well if you can find a way

https://github.com/angular/angular/issues/6675


问:
I am unable to import Selenium Webdriver in the Step definition File in Intellij
I am trying to create a web driver object but I am unable to do it.
I have added the below dependency in POM.xml.

```<code>    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.141.59</version>
    </dependency>
</code>```

答:
Please add cucumber dependency also</p>

```<code><dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>1.2.5</version>
    </dependency>

    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-jvm</artifactId>
        <version>1.2.5</version>
        <type>pom</type>
    </dependency>

    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>1.2.5</version>
    </dependency>
    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-picocontainer</artifactId>
        <version>1.2.5</version>
        <scope>test</scope>
    </dependency>
</code>```

Body:
I am trying to create a web driver object but I am unable to do it.
I have added the below dependency in POM.xml.

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.141.59</version>
    </dependency>

Body:
Please add cucumber dependency also

<dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>1.2.5</version>
    </dependency>

    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-jvm</artifactId>
        <version>1.2.5</version>
        <type>pom</type>
    </dependency>

    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>1.2.5</version>
    </dependency>
    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-picocontainer</artifactId>
        <version>1.2.5</version>
        <scope>test</scope>
    </dependency>


问:
Python Script Written - GUI options?
I really am lost.

I've written a python script which takes two files, converts one to the same format as the second and outputs the differences.

I now need to create some kind of GUI?

I'm thinking a relatively simple HTML page which allows users to click on two separate boxes to upload each of the files and then submit them - resulting in the output being offered as file which the user can download to the PC.

Any help of direction would be really appreciated. It's only really a guess that HTML will be my best/simplest choice. Working from the command line isn't really an option I can go with. The PC that this will sit on will not have internet access. I intend to have this installed on the PC as an application.

I accept I'll need to make some changes to my Python code. Posted this here as I'm not sure Python questions would have been the best place but I'll move it if suggested.

Please, any help at all will be useful. First timer

答:
I don't suggest you use the Django Framework for such a small application.

You should definitely use Flask for this. Flask is more lightweight

Title: Python Script Written - GUI options?


问:
How do i differentiate different subclasses in a array of the superclass?
My setup is the following.
I have a superclass called "bottles" and 2 different subclasses, "water" and "soda". There's an array filled with countless of both of these and my goal is to write a method that returns the total liter values of only one of these subclasses. What would be the best way to accomplish that? As far as i understand 'instanceof' has no use here.

To clarify i only want to know what operator/method is used to compare:

```<code>if (bottles[0]==soda){
      ...
}
</code>```

答:
Generally if you have control over Bottle classes and you still need to use instanceof in your code, you have problems with your design.

```<code>interface Bottle{
  void addLiters(LiterCalculator calculator);
}
</code>```

LiterCalculator will look something like this,

```<code>interface LiterCalculator{
   public addWater(int liters);
   public addSoda(int liters);
   //so on
}
</code>```

And SodaBottle is responsible of adding itself;

```<code>class SodaBottle implements Bottle {
private int liters;

public void addLiters(LiterCalculator calculator) { calculator.addSoda(liters); }
}
</code>```

So your flow is no longer responsible of different calculations of Bottle instances.

Body:
My setup is the following.
I have a superclass called "bottles" and 2 different subclasses, "water" and "soda". There's an array filled with countless of both of these and my goal is to write a method that returns the total liter values of only one of these subclasses. What would be the best way to accomplish that? As far as i understand 'instanceof' has no use here.

To clarify i only want to know what operator/method is used to compare:

if (bottles[0]==soda){
      ...
}

Body:
Generally if you have control over Bottle classes and you still need to use instanceof in your code, you have problems with your design.

interface Bottle{
  void addLiters(LiterCalculator calculator);
}

LiterCalculator will look something like this,

interface LiterCalculator{
   public addWater(int liters);
   public addSoda(int liters);
   //so on
}

And SodaBottle is responsible of adding itself;

class SodaBottle implements Bottle {
private int liters;

public void addLiters(LiterCalculator calculator) { calculator.addSoda(liters); }
}

So your flow is no longer responsible of different calculations of Bottle instances.


问:
How to Handle 500 internal error while mapping JSON to POJO If one of attribute of POJO class is empty
Hi I am working on Rest API written in java and have come through the below doubt.

I have already written the code which takes post data and maps to pojo class and sends back the data in JSON form.

Correct Format:-

```<code>{
    "Name":"Rahul",
    "Address":"Mumbai",
    "Age": 27
}
</code>```

Output:

```<code>{
    "Pkid":"1",
    "Name":"Rahul",
    "Address":"Mumbai",
    "Age": 27
}
</code>```

But when I am passing empty value to one of the attribute I am getting 500 internal error can someone help me how to handle it and return the value in json format after handling it:

```<code>{
    "Name":,
    "Address":"Mumbai",
    "Age": 27
}
</code>```

Output:

```<code>500 Internal error
</code>```

答:
You can use Jackson library and set the below property while creating object.

```<code>val mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
</code>```

Add the below maven dependency :

```<code>        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.9.7</version>
        </dependency>
</code>```

You can see the answer here also.

EDIT 1:
Deserialize your jsonObject as :

```<code>objectMapper.readValue(jsonString,POJO.class)
</code>```

Body:
Hi I am working on Rest API written in java and have come through the below doubt.

I have already written the code which takes post data and maps to pojo class and sends back the data in JSON form.

Correct Format:-

{
    "Name":"Rahul",
    "Address":"Mumbai",
    "Age": 27
}

Output:

{
    "Pkid":"1",
    "Name":"Rahul",
    "Address":"Mumbai",
    "Age": 27
}

But when I am passing empty value to one of the attribute I am getting 500 internal error can someone help me how to handle it and return the value in json format after handling it:

{
    "Name":,
    "Address":"Mumbai",
    "Age": 27
}

Output:

500 Internal error

Body:
You can use Jackson library and set the below property while creating object.

val mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

Add the below maven dependency :

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.9.7</version>
        </dependency>

You can see the answer here also.

EDIT 1:
Deserialize your jsonObject as :

objectMapper.readValue(jsonString,POJO.class)


问:
Grafana Image Renderer, timeout error when rendering complex dashboard
I am using URL link to get a whole grafana dashboard png report however for some complex dashboard I am getting timeout error.

Link to get report

```<code>http://HOST_IP:3000/render/d/ybG8WXyZz/dashboard-1?orgId=1&width=1800&height=900&kiosk=tv&from=now-1h&to=now&var-machine=&var-ideal=12
</code>```

Error details

```<code>"stack":"TimeoutError: Navigation timeout of 30000 ms exceeded\n at /usr/src/app/node_modules/puppeteer/lib/LifecycleWatcher.js:142:21\n -- ASYNC --\n at Frame.<anonymous> (/usr/src/app/node_modules/puppeteer/lib/helper.js:111:15)\n at Page.goto (/usr/src/app/node_modules/puppeteer/lib/Page.js:675:49)\n at Page.<anonymous> (/usr/src/app/node_modules/puppeteer/lib/helper.js:112:23)\n at Browser.<anonymous> (/usr/src/app/build/browser/browser.js:154:28)\n at Generator.next (<anonymous>)\n at /usr/src/app/build/browser/browser.js:7:71\n at new Promise (<anonymous>)\n at __awaiter (/usr/src/app/build/browser/browser.js:3:12)\n at /usr/src/app/build/browser/browser.js:152:47\n at NoOpBrowserTiming.<anonymous> (/usr/src/app/build/browser/browser.js:27:26)\n -- ASYNC --\n at Page.<anonymous> (/usr/src/app/node_modules/puppeteer/lib/helper.js:111:15)\n at Browser.<anonymous> (/usr/src/app/build/browser/browser.js:154:28)\n at Generator.next (<anonymous>)\n at /usr/src/app/build/browser/browser.js:7:71\n at new Promise (<anonymous>)\n at __awaiter (/usr/src/app/build/browser/browser.js:3:12)\n at /usr/src/app/build/browser/browser.js:152:47\n at NoOpBrowserTiming.<anonymous> (/usr/src/app/build/browser/browser.js:27:26)\n at Generator.next (<anonymous>)\n at /usr/src/app/build/browser/browser.js:7:71","level":"error","message":"Request failed"}
</code>```

Can someone help me to understand where to change default 30000ms timeout ? I am using docker version of image renderer.

Github: Docker version

答:
You need to increase the timeout for puppeteer.

I would start altering following line 144 in browser.ts which currently states

```<code>await page.goto(options.url, { waitUntil: 'networkidle0' });
</code>```

to

```<code>await page.goto(options.url, { waitUntil: 'networkidle0', timeout: 3000000 });
</code>```

Rebuild the grafana image renderer, deploy it and see if that fixed it.

Source

https://github.com/puppeteer/puppeteer/issues/782

Body:
I am using URL link to get a whole grafana dashboard png report however for some complex dashboard I am getting timeout error.

Link to get report

http://HOST_IP:3000/render/d/ybG8WXyZz/dashboard-1?orgId=1&width=1800&height=900&kiosk=tv&from=now-1h&to=now&var-machine=&var-ideal=12

Error details

"stack":"TimeoutError: Navigation timeout of 30000 ms exceeded\n at /usr/src/app/node_modules/puppeteer/lib/LifecycleWatcher.js:142:21\n -- ASYNC --\n at Frame.<anonymous> (/usr/src/app/node_modules/puppeteer/lib/helper.js:111:15)\n at Page.goto (/usr/src/app/node_modules/puppeteer/lib/Page.js:675:49)\n at Page.<anonymous> (/usr/src/app/node_modules/puppeteer/lib/helper.js:112:23)\n at Browser.<anonymous> (/usr/src/app/build/browser/browser.js:154:28)\n at Generator.next (<anonymous>)\n at /usr/src/app/build/browser/browser.js:7:71\n at new Promise (<anonymous>)\n at __awaiter (/usr/src/app/build/browser/browser.js:3:12)\n at /usr/src/app/build/browser/browser.js:152:47\n at NoOpBrowserTiming.<anonymous> (/usr/src/app/build/browser/browser.js:27:26)\n -- ASYNC --\n at Page.<anonymous> (/usr/src/app/node_modules/puppeteer/lib/helper.js:111:15)\n at Browser.<anonymous> (/usr/src/app/build/browser/browser.js:154:28)\n at Generator.next (<anonymous>)\n at /usr/src/app/build/browser/browser.js:7:71\n at new Promise (<anonymous>)\n at __awaiter (/usr/src/app/build/browser/browser.js:3:12)\n at /usr/src/app/build/browser/browser.js:152:47\n at NoOpBrowserTiming.<anonymous> (/usr/src/app/build/browser/browser.js:27:26)\n at Generator.next (<anonymous>)\n at /usr/src/app/build/browser/browser.js:7:71","level":"error","message":"Request failed"}

Can someone help me to understand where to change default 30000ms timeout ? I am using docker version of image renderer.

Github: Docker version

Body:
You need to increase the timeout for puppeteer.

I would start altering following line 144 in browser.ts which currently states

await page.goto(options.url, { waitUntil: 'networkidle0' });

to

await page.goto(options.url, { waitUntil: 'networkidle0', timeout: 3000000 });

Rebuild the grafana image renderer, deploy it and see if that fixed it.

Source

https://github.com/puppeteer/puppeteer/issues/782


问:
VBA code to delete rows based on cell value that update dynamically
I have a sheet where i need to delete rows based on index value of a column which output of formula.

This is the data im working on:

Here's what the data has:

Each Job ID (Column A) has 2 values: True and False assigned to different owners

Now the column F has data that is specified to satisfy certain conditions

Each time a job ID is deleted (both rows of the job), the last values in F column keep updating to "Yes/No" based on the condition

What im trying to achieve:

To check the rows one at a time and shift/delete two rows (a job) to the bottom when the last column has the value "No"

The data updates in the last column as these deletions or shifts happen

So the macro should be dynamic

Here's the code i've tried:

```<code>Sub delete()

    Dim i As Integer
    Dim LastRow As Integer
    LastRow = Range("A").End(xlUp).Row

    For i = 2 To LastRow
        If Range("F" & i).Value = "No" And Range("A" & i).Value = Range("A" & i + 1).Value Then
            Rows(i & ":" & (i + 1)).Cut
            Range("A").End(xlDown).Offset(1, 0).EntireRow.Insert
            Application.CutCopyMode = False
        End If
    Next

End Sub
</code>```

This doesn't seem to work. Deletion part has worked partially where i've used the following lines of code:

```<code> Rows(i & ":" & (i+1)).Select
        Selection.delete Shift:=x1Up
</code>```

答:
I don't mean to offend but I don't see the benefits of your system. Please consider this instead.

Create a helper column and enter this formula in row 2 of it.=SUM(INDIRECT(ADDRESS(ROW()-MOD(ROW(),2),5)&":"&ADDRESS(ROW()+1-MOD(ROW(),2),5)))*(IF(AND(INDIRECT(J2)>50,INDIRECT(K2)>50),2,1))+(ROW()/10000)

Copy down to the end of your sheet.

Sort on this column.

Hide the helper.

Note that the formula is designed to evaluate two consecutive rows of which the first is in a row with an even number, the second having an uneven number. If your row 2 is used for something else the formula needs to be tweaked to start in row 3 or tweaked differently to start in row 4.

And this is how it works.
It adds the two repetitions (column E). If both of them are above 50 it will multiply the result by two. This will ensure that all rows with two valuations above 50 will be sorted above all others. Finally, the row number / 10000 is added. If you have more than 10000 rows in your data make this number 100,000. The point is that the result of this division must always be less than 1 so as not to interfere with the valuations. This addition will work as a tiebreaker when the other valuations are identical and it will ensure that the sequence of your two rows will remain the same after sorting.

Of course, this sort will create a list that is much more sensitive than simply moving worse performers to the end. It will also leave your formula in column F undisturbed.
It's final advantage is that the criteria in the helper column can be fine tuned to even better serve your purposes.

Body:
I have a sheet where i need to delete rows based on index value of a column which output of formula.

This is the data im working on:

Here's what the data has:

Each Job ID (Column A) has 2 values: True and False assigned to different owners

Now the column F has data that is specified to satisfy certain conditions

Each time a job ID is deleted (both rows of the job), the last values in F column keep updating to "Yes/No" based on the condition

What im trying to achieve:

To check the rows one at a time and shift/delete two rows (a job) to the bottom when the last column has the value "No"

The data updates in the last column as these deletions or shifts happen

So the macro should be dynamic

Here's the code i've tried:

Sub delete()

    Dim i As Integer
    Dim LastRow As Integer
    LastRow = Range("A").End(xlUp).Row

    For i = 2 To LastRow
        If Range("F" & i).Value = "No" And Range("A" & i).Value = Range("A" & i + 1).Value Then
            Rows(i & ":" & (i + 1)).Cut
            Range("A").End(xlDown).Offset(1, 0).EntireRow.Insert
            Application.CutCopyMode = False
        End If
    Next

End Sub

This doesn't seem to work. Deletion part has worked partially where i've used the following lines of code:

 Rows(i & ":" & (i+1)).Select
        Selection.delete Shift:=x1Up


问:
How to force a WPF application to run in Administrator mode
I have an WPF application which access windows services, task schedulers on the local machine.
When I deploy this WPF application and run it without "Run as Administrator" , it fails as it is not able to access the windows services and task schedulers on the local machine. If I run it with "Run as Administrator", it works correctly.

How do I make my application by default run in admin mode when it is deployed in production?

答:
Steps to Make the WPF application to Run in Administrator Mode

1.Open the Solution Explorer

2.Right CLick on the solution--->Add---->New Item---->App.Manifest---->OK

3.Edit the Manifest file as follows:

```<code><requestedExecutionLevel level="asInvoker" uiAccess="false" />
</code>```

(TO)

```<code> <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</code>```

4.After editing the Manifest file,Goto Solution project(RightCLick)------>properties------->Security

Turn out the Checkbox of "Enable ClickOnce Security Settings"

Run the Application, and Take setup, Now the application with Run as Administrator mode is acheived.

ContentLicense: CC BY-SA 2.5

Body:
Steps to Make the WPF application to Run in Administrator Mode

1.Open the Solution Explorer

2.Right CLick on the solution--->Add---->New Item---->App.Manifest---->OK

3.Edit the Manifest file as follows:

<requestedExecutionLevel level="asInvoker" uiAccess="false" />

(TO)

 <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

4.After editing the Manifest file,Goto Solution project(RightCLick)------>properties------->Security

Turn out the Checkbox of "Enable ClickOnce Security Settings"

Run the Application, and Take setup, Now the application with Run as Administrator mode is acheived.


问:
Something like margin or padding except where background doesn't draw
Is there something that will do what margin does but without the background drawing in that area? For instance, when you give an element margin: 1em you get a 1em border of blank space around the element, but the background draws in that area. Is there something similar to that except where the background doesn't draw?

My problem is I'm trying to put something below three float: lefted divs and right now I can't get any spacing between that and the floated divs above it. They just abut directly against each other.

The div that is going below the float: lefted divs has the property clear: both. If there was something that made that div have space between it and that floated div above it then that would work too.

答:
Maybe this example will help explain (and solve) your problem?</p>

```<code><!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8" />

    <style>
        * { margin: 0; padding: 0; }
        h1, p { background-color: #eee; margin: 10px 0; }
        div { background-color: pink; float: left; width: 100px; height: 100px; margin-right: 1px; }
        br { clear: both; display: block; }
    </style>
</head>

<body>

<h1>Hello, World!</h1>

<div></div>
<div></div>
<div></div>

<br />

<p>Lorem ipsum dolor set amit...</p>

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

Body:
Maybe this example will help explain (and solve) your problem?

<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8" />

    <style>
        * { margin: 0; padding: 0; }
        h1, p { background-color: #eee; margin: 10px 0; }
        div { background-color: pink; float: left; width: 100px; height: 100px; margin-right: 1px; }
        br { clear: both; display: block; }
    </style>
</head>

<body>

<h1>Hello, World!</h1>

<div></div>
<div></div>
<div></div>

<br />

<p>Lorem ipsum dolor set amit...</p>

</body>
</html>


问:
How to deploy the REST server in hyperledger composer since all the containers in Docker Hub have been removed?
as we can see in https://hub.docker.com/r/hyperledger/composer-rest-server/tags all the docker containers in Hyperledger composer rest server images are removed. how are we supposed to deploy the rest server,as the official documentation says doing so this way. </p>

答:
Composer has been sunset (it's been deprecated for a while) and it looks like all the docker hub images have been removed now.
Any documentation referring to using the docker images (rest server, cli, playground) won't work.

The source code for composer https://github.com/hyperledger/composer contains the Dockerfile's so you can always use them to build your own local docker image.