问:
Error when checking model input: expected lstm_1_input to have 3 dimensions, but got array with shape (339732, 29)
My input is simply a csv file with 339732 rows and two columns :

the first being 29 feature values, i.e. X

the second being a binary label value, i.e. Y

I am trying to train my data on a stacked LSTM model:

```<code>data_dim = 29
timesteps = 8
num_classes = 2

model = Sequential()
model.add(LSTM(30, return_sequences=True,
               input_shape=(timesteps, data_dim)))  # returns a sequence of vectors of dimension 30
model.add(LSTM(30, return_sequences=True))  # returns a sequence of vectors of dimension 30
model.add(LSTM(30))  # return a single vector of dimension 30
model.add(Dense(1, activation='softmax'))

model.compile(loss='binary_crossentropy',
              optimizer='rmsprop',
              metrics=['accuracy'])

model.summary()
model.fit(X_train, y_train, batch_size = 400, epochs = 20, verbose = 1)
</code>```

This throws the error:

Traceback (most recent call last):
    File "first_approach.py", line 80, in
      model.fit(X_train, y_train, batch_size = 400, epochs = 20, verbose = 1)

ValueError: Error when checking model input: expected lstm_1_input to
  have 3 dimensions, but got array with shape (339732, 29)

I tried reshaping my input using X_train.reshape((1,339732, 29)) but it did not work showing error:

ValueError: Error when checking model input: expected lstm_1_input to
  have shape (None, 8, 29) but got array with shape (1, 339732, 29)

How can I feed in my input to the LSTM ?

Body:
My input is simply a csv file with 339732 rows and two columns :

the first being 29 feature values, i.e. X

the second being a binary label value, i.e. Y

I am trying to train my data on a stacked LSTM model:

data_dim = 29
timesteps = 8
num_classes = 2

model = Sequential()
model.add(LSTM(30, return_sequences=True,
               input_shape=(timesteps, data_dim)))  # returns a sequence of vectors of dimension 30
model.add(LSTM(30, return_sequences=True))  # returns a sequence of vectors of dimension 30
model.add(LSTM(30))  # return a single vector of dimension 30
model.add(Dense(1, activation='softmax'))

model.compile(loss='binary_crossentropy',
              optimizer='rmsprop',
              metrics=['accuracy'])

model.summary()
model.fit(X_train, y_train, batch_size = 400, epochs = 20, verbose = 1)

This throws the error:

Traceback (most recent call last):
    File "first_approach.py", line 80, in
      model.fit(X_train, y_train, batch_size = 400, epochs = 20, verbose = 1)

ValueError: Error when checking model input: expected lstm_1_input to
  have 3 dimensions, but got array with shape (339732, 29)

I tried reshaping my input using X_train.reshape((1,339732, 29)) but it did not work showing error:

ValueError: Error when checking model input: expected lstm_1_input to
  have shape (None, 8, 29) but got array with shape (1, 339732, 29)

How can I feed in my input to the LSTM ?

Body:
For timesteps != 1, you can use the below function (adapted from here)

import numpy as np
def create_dataset(dataset, look_back=1):
  dataX, dataY = [], []
  for i in range(len(dataset)-look_back+1):
    a = dataset[i:(i+look_back), :]
    dataX.append(a)
    dataY.append(dataset[i + look_back - 1, :])
  return np.array(dataX), np.array(dataY)

Examples

X = np.reshape(range(30),(3,10)).transpose()
array([[ 0, 10, 20],
       [ 1, 11, 21],
       [ 2, 12, 22],
       [ 3, 13, 23],
       [ 4, 14, 24],
       [ 5, 15, 25],
       [ 6, 16, 26],
       [ 7, 17, 27],
       [ 8, 18, 28],
       [ 9, 19, 29]])

create_dataset(X, look_back=1 )
(array([[[ 0, 10, 20]],
       [[ 1, 11, 21]],
       [[ 2, 12, 22]],
       [[ 3, 13, 23]],
       [[ 4, 14, 24]],
       [[ 5, 15, 25]],
       [[ 6, 16, 26]],
       [[ 7, 17, 27]],
       [[ 8, 18, 28]],
       [[ 9, 19, 29]]]),
array([[ 0, 10, 20],
       [ 1, 11, 21],
       [ 2, 12, 22],
       [ 3, 13, 23],
       [ 4, 14, 24],
       [ 5, 15, 25],
       [ 6, 16, 26],
       [ 7, 17, 27],
       [ 8, 18, 28],
       [ 9, 19, 29]]))

create_dataset(X, look_back=3)
(array([[[ 0, 10, 20],
        [ 1, 11, 21],
        [ 2, 12, 22]],
       [[ 1, 11, 21],
        [ 2, 12, 22],
        [ 3, 13, 23]],
       [[ 2, 12, 22],
        [ 3, 13, 23],
        [ 4, 14, 24]],
       [[ 3, 13, 23],
        [ 4, 14, 24],
        [ 5, 15, 25]],
       [[ 4, 14, 24],
        [ 5, 15, 25],
        [ 6, 16, 26]],
       [[ 5, 15, 25],
        [ 6, 16, 26],
        [ 7, 17, 27]],
       [[ 6, 16, 26],
        [ 7, 17, 27],
        [ 8, 18, 28]],
       [[ 7, 17, 27],
        [ 8, 18, 28],
        [ 9, 19, 29]]]),
array([[ 2, 12, 22],
       [ 3, 13, 23],
       [ 4, 14, 24],
       [ 5, 15, 25],
       [ 6, 16, 26],
       [ 7, 17, 27],
       [ 8, 18, 28],
       [ 9, 19, 29]]))


来源: stackexchange

问:
Timeout or duplicate return from reCAPTCHA on symfony 3
I added google's reCAPTCHA to my register page in my symfony 3 project via this bundle: github/EWZRecaptchaBundle. After submiting the register form I have this:

```<code>$api_url = "https://www.google.com/recaptcha/api/siteverify?";

$secret_key = "----my-key----";

$api_key = "&secret=" . $secret_key;

$g_recaptcha_response = $_POST['g-recaptcha-response'];

$api_response = "&response=" . $g_recaptcha_response;

$api_remote_ip = "&remoteip=" . $_SERVER['REMOTE_ADDR'];

$url = $api_url . $api_key . $api_response . $api_remote_ip;

$response = json_decode(file_get_contents($url), true);
</code>```

The responde giv me this:

```<code>array(4) { ["success"]=> bool(false) ["challenge_ts"]=> string(20) "2017-07-06T16:49:56Z" ["hostname"]=> string(14) "********.com" ["error-codes"]=> array(1) { [0]=> string(20) "timeout-or-duplicate" } }
</code>```

This timeout-or-duplicate isn't documented in their guide. I have no idea how to fix this or where does it come from.

答: Doesnt this bundle do this for you already (check captcha and set form to valid or invalid),   hence, making your custom call,   a duplicate or timeout ...  (since it is already done by the bundle on bindRequest (i think) )

ContentLicense: CC BY-SA 3.0

Body:
I added google's reCAPTCHA to my register page in my symfony 3 project via this bundle: github/EWZRecaptchaBundle. After submiting the register form I have this:

$api_url = "https://www.google.com/recaptcha/api/siteverify?";

$secret_key = "----my-key----";

$api_key = "&secret=" . $secret_key;

$g_recaptcha_response = $_POST['g-recaptcha-response'];

$api_response = "&response=" . $g_recaptcha_response;

$api_remote_ip = "&remoteip=" . $_SERVER['REMOTE_ADDR'];

$url = $api_url . $api_key . $api_response . $api_remote_ip;

$response = json_decode(file_get_contents($url), true);

The responde giv me this:

array(4) { ["success"]=> bool(false) ["challenge_ts"]=> string(20) "2017-07-06T16:49:56Z" ["hostname"]=> string(14) "********.com" ["error-codes"]=> array(1) { [0]=> string(20) "timeout-or-duplicate" } }

This timeout-or-duplicate isn't documented in their guide. I have no idea how to fix this or where does it come from.


问:
Multiple Selection tableView
A certain part of my app I want the user to be able to select locations in a table, multiple if they want, and have those locations be printed into a label so they can see what they have selected neatly and in front of them. What do I need to put into didSelectRowAt indexPath in order to do this? It's all on the same ViewController.

I don't want to go to another view controller when I select a table cell.

```<code>@IBOutlet weak var labelGifteeLocationsPreview: UILabel!
@IBOutlet weak var tableLocations: UITableView!
let itemsLocations: [String] = ["Pacific Northwest", "West Coast", "The West", "Midwest", "Great Lakes", "The South", "New England"]

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return itemsLocations.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cellLocations: UITableViewCell = UITableViewCell()
    cellLocations.textLabel?.text = itemsLocations[indexPath.row]
    return cellLocations
}
</code>```

EDIT

Now whenever I select an item that is farther down from the table, it brings the index out of range error. I don't know why it only happens when I select an item farther down from the table. Here's the code:

```<code>@IBOutlet weak var tableLocations: UITableView!
let itemsLocations: [String] = ["Pacific Northwest", "West Coast", "The West", "Midwest", "Great Lakes", "The South", "New England"]
@IBOutlet weak var labelGifteeLocationsPreview: UILabel!
var locationsPreviewtext = [String]()

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    locationsPreviewtext.append(itemsLocations[indexPath.row])
    labelGifteeLocationsPreview.text = "\(locationsPreviewtext)"
}

func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {
    if locationsPreviewtext.isEmpty {
        return
    }
    else {
        let ind = index(ofAccessibilityElement: locationsPreviewtext[indexPath.row])   //this is where I get the index out of range error
        if ind == NSNotFound {
            locationsPreviewtext.remove(at: indexPath.row)
        }
    }
    labelGifteeLocationsPreview.text = "\(locationsPreviewtext)"
</code>```

答:
```<code>func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: IndexPath){

        let cell = tableLocations.cellForRowAtIndexPath(indexPath)

        if (cell?.accessoryType == UITableViewCellAccessoryType.Checkmark){

            cell!.accessoryType = UITableViewCellAccessoryType.None;

        }else{

            cell!.accessoryType = UITableViewCellAccessoryType.Checkmark;

        }
    }
</code>```

Title: Multiple Selection tableView

Body:
A certain part of my app I want the user to be able to select locations in a table, multiple if they want, and have those locations be printed into a label so they can see what they have selected neatly and in front of them. What do I need to put into didSelectRowAt indexPath in order to do this? It's all on the same ViewController.

I don't want to go to another view controller when I select a table cell.

@IBOutlet weak var labelGifteeLocationsPreview: UILabel!
@IBOutlet weak var tableLocations: UITableView!
let itemsLocations: [String] = ["Pacific Northwest", "West Coast", "The West", "Midwest", "Great Lakes", "The South", "New England"]

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return itemsLocations.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cellLocations: UITableViewCell = UITableViewCell()
    cellLocations.textLabel?.text = itemsLocations[indexPath.row]
    return cellLocations
}

EDIT

Now whenever I select an item that is farther down from the table, it brings the index out of range error. I don't know why it only happens when I select an item farther down from the table. Here's the code:

@IBOutlet weak var tableLocations: UITableView!
let itemsLocations: [String] = ["Pacific Northwest", "West Coast", "The West", "Midwest", "Great Lakes", "The South", "New England"]
@IBOutlet weak var labelGifteeLocationsPreview: UILabel!
var locationsPreviewtext = [String]()

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    locationsPreviewtext.append(itemsLocations[indexPath.row])
    labelGifteeLocationsPreview.text = "\(locationsPreviewtext)"
}

func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {
    if locationsPreviewtext.isEmpty {
        return
    }
    else {
        let ind = index(ofAccessibilityElement: locationsPreviewtext[indexPath.row])   //this is where I get the index out of range error
        if ind == NSNotFound {
            locationsPreviewtext.remove(at: indexPath.row)
        }
    }
    labelGifteeLocationsPreview.text = "\(locationsPreviewtext)"


问:
Speed difference between Linq to XML and Excel with a OledbConnection?
On e of my current requirements is to take in an Excel spreadsheet that the user updates about once a week and be able to query that document for certain fields.

As of right now, I run through and push all the Excel (2007) data into an xml file (just once when they upload the file, then I just use the xml) that then holds all of the needed data (not all of the columns in the spreadsheet) for querying via Linq-to-XML; note that the xml file is smaller than the excel.

Now my question is, is there any performance difference between querying an XML file with Linq and an Excel file with OledbConnection?  Am I just adding another unneccesary step?
I suppose the followup question would be, is it worth it for ease of use to keep pushing it to xml.

The file has about 1000 rows.

答:
As I understand it the performance side of things stands like this for accessing Excel data.

Fastest to Slowest

1. Custom 3rd party vendor software using C++ directly on the Excel file type.

2. OleDbConnection method using a schema file if necessary for data types, treats Excel as a flatfile db.

3. Linq 2 XML method superior method for read/write data with Excel 2007 file formats only.

4. Straight XML data manipulation using the OOXML SDK and optionally 3rd party xml libraries. Again limited to Excel 2007 file formats only.

5. Using an Object[,] array to read a region of cells (using .Value2 prop), and passing an Object[,] array back again to a region of cells (again .Value2 prop) to write data.

6. Updating and reading from cells individually using the .Cells(x,y) and .Offset(x,y) prop accessors.

ContentLicense: CC BY-SA 2.5


问:
ARToolKit: Sample app not showing animation
it may be a quite dumb question. Please bear me, being novice to AR and touching android after an era.

I downloaded and did setup ARToolKit. I am followed this video for the setup.
Then, tried one of the examples, ARSimpleNativeCarsProj, in it.
But, not getting any cars animation on the screen. I tried with different flat surfaces on 2 devices.

Am I missing something any basic thing?

答:
This is a bit strange, when tried on flat surface the animation of the car was not shown... but, when tried on the keyboard of my macbook, it is showing the car. So basically, there was nothing wrong in my setup.

To find out why it is not showing animation on flat surface, will do some investigation, and will update the post.


问:
"Incorrect string value" when trying to insert UTF-8 into MySQL via JDBC?
This is how my connection is set:

Connection conn = DriverManager.getConnection(url + dbName + "?useUnicode=true&characterEncoding=utf-8", userName, password);

And I'm getting the following error when tyring to add a row to a table:

Incorrect string value: '\xF0\x90\x8D\x83\xF0\x90...' for column 'content' at row 1

I'm inserting thousands of records, and I always get this error when the text contains \xF0 (i.e. the the incorrect string value always starts with \xF0).

The column's collation is utf8_general_ci.

What could be the problem?

答: my solution is change the column type from varchar(255) to blob</p>


问:
Sending docker logs to AWS CloudWatch via Terraform
My goal is to send docker container logs to CloudWatch via terraform.
This is the ECS role that I am using for IAM:

```<code>{
  "Version": "2008-10-17",
  "Statement": [
    {
      "Action": "sts:AssumeRole",
      "Principal": {
        "Service": ["ecs.amazonaws.com", "ec2.amazonaws.com"]
      },
      "Effect": "Allow"
    }
  ]
}
</code>```

And here is the ECS service role policy:

```<code>{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "elasticloadbalancing:Describe*",
        "elasticloadbalancing:DeregisterInstancesFromLoadBalancer",
        "elasticloadbalancing:RegisterInstancesWithLoadBalancer",
        "ec2:Describe*",
        "ec2:AuthorizeSecurityGroupIngress",
        "logs:CreateLogStream",
        "logs:PutLogEvents"
      ],
      "Resource": [
        "*"
      ]
    }
  ]
}
</code>```

In my task definition for docker container, among other things I have this for cloudwatch logging:

```<code>  "logConfiguration": {
    "logDriver": "awslogs",
    "options": {
        "awslogs-group": "awslog-mylogs",
        "awslogs-region": "eu-west-1",
        "awslogs-stream-prefix": "awslogs-mylogs-stream"
    }
  }
</code>```

(I have the awslog-mylogs log group pre-created via AWS console).

The problem is if I spin up the AWS instance (via Terraform apply) without the above logging config for the container, everything works fine and my container is up and running (except of course, logs are not being sent to Cloudwatch). As soon as I have this logging config info in place, the EC2 instance spins up but the container does not start properly. After ssh-ing into the EC2 instance, I find that the docker container bailed out.

Any idea what's going wrong here? What might I be missing as far as configuring sending logs to Cloudwatch via terraform is concerned?

答:
Could you please check if you set all permissions and include  Cloudwatch as well in ECS service role policy?

```<code>  policy = <<EOF
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "cloudwatch:GetMetricStatistics",
        "cloudwatch:ListMetrics",
        "cloudwatch:PutMetricData",
        "ec2:DescribeTags",
        "logs:CreateLogGroup",
        "logs:CreateLogStream",
        "logs:DescribeLogStreams",
        "logs:PutSubscriptionFilter",
        "logs:PutLogEvents"
      ],
      "Resource": [
        "arn:aws:logs:*:*:*"
      ]
    }
  ]
}
EOF
</code>```

Body:
My goal is to send docker container logs to CloudWatch via terraform.
This is the ECS role that I am using for IAM:

{
  "Version": "2008-10-17",
  "Statement": [
    {
      "Action": "sts:AssumeRole",
      "Principal": {
        "Service": ["ecs.amazonaws.com", "ec2.amazonaws.com"]
      },
      "Effect": "Allow"
    }
  ]
}

And here is the ECS service role policy:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "elasticloadbalancing:Describe*",
        "elasticloadbalancing:DeregisterInstancesFromLoadBalancer",
        "elasticloadbalancing:RegisterInstancesWithLoadBalancer",
        "ec2:Describe*",
        "ec2:AuthorizeSecurityGroupIngress",
        "logs:CreateLogStream",
        "logs:PutLogEvents"
      ],
      "Resource": [
        "*"
      ]
    }
  ]
}

In my task definition for docker container, among other things I have this for cloudwatch logging:

  "logConfiguration": {
    "logDriver": "awslogs",
    "options": {
        "awslogs-group": "awslog-mylogs",
        "awslogs-region": "eu-west-1",
        "awslogs-stream-prefix": "awslogs-mylogs-stream"
    }
  }

(I have the awslog-mylogs log group pre-created via AWS console).

The problem is if I spin up the AWS instance (via Terraform apply) without the above logging config for the container, everything works fine and my container is up and running (except of course, logs are not being sent to Cloudwatch). As soon as I have this logging config info in place, the EC2 instance spins up but the container does not start properly. After ssh-ing into the EC2 instance, I find that the docker container bailed out.

Any idea what's going wrong here? What might I be missing as far as configuring sending logs to Cloudwatch via terraform is concerned?

Body:
Could you please check if you set all permissions and include  Cloudwatch as well in ECS service role policy?

  policy = <<EOF
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "cloudwatch:GetMetricStatistics",
        "cloudwatch:ListMetrics",
        "cloudwatch:PutMetricData",
        "ec2:DescribeTags",
        "logs:CreateLogGroup",
        "logs:CreateLogStream",
        "logs:DescribeLogStreams",
        "logs:PutSubscriptionFilter",
        "logs:PutLogEvents"
      ],
      "Resource": [
        "arn:aws:logs:*:*:*"
      ]
    }
  ]
}
EOF


问:
ANGULAR JS ng-if
I am trying to learning angular JS and I am an absolute beginner.I tried using ng-if directives to print 'Mr or Mrs or Ms' according to the their gender and relationship  status.When I bind the married model within the div tag it is giving out the correct value .But the binding after that prints true every time. Are there any other ways to check conditions ?
Moreover I tried checking conditions with the controller , why doesn't that work? Please help!</p>

```<code><body ng-app="myApp" ng-controller="myFirstController" ng- init="first='';last='';gender='Male';married='true'">
    <input type="text" data-ng-model="first">
    <input type="text" data-ng-model="last">

    <label for="gender">GENDER </label>
    <input type="radio" name="gender" data-ng-model="gender" value="Male" /> MALE
    <input type="radio" name="gender" data-ng-model="gender" value="Female" /> FEMALE
    <br>
    <br>

    <div ng-if="gender==='Female'">
        <input type="radio" name="married" data-ng-model="married" value="true" /> MARRIED
        <input type="radio" name="married" data-ng-model="married" value="false" /> UNMARRIED
        <br>
        <br> {{married}}

    </div>
    <span ng-if="gender==='Male'">MR.</span>
    <span ng-if="gender!=='Male'">
    <span ng-if="married=='true'">MRS.</span>
    <span ng-if="married=='false'">MS.</span> </span>{{first }} {{last}} {{married}}
    <div ng-app="" ng-init="myCol='lightblue'">
</code>```

答:
Replace your ng-if="gender==='Female'" by ng-show="gender==='Female'", and it will work fine.

The reason is that ng-if creates its own child scope, and the married property is thus set on this child scope rather than the controller scope.

The appropriate fix would be to avoid binding directly to properties of the scope, but to bind to properties of an object in the scope:

In your controller:

```<code>$scope.model = {};
</code>```

In your view:

```<code><input type="radio" name="married" data-ng-model="model.married" value="true"/>
</code>```

(and same for all your properties, of course).

You should also never use ng-init. Just initialize your model from your controller:

```<code>$scope.model = {
  gender: 'Male',
  married: 'false'
};
</code>```

Finally, a boolean would be a much better choice for the value of married that a string containing 'true' or 'false'. You can achieve that using ng-value rather than value:

```<code><input type="radio" name="married" data-ng-model="married" ng-value="true"/>
MARRIED
<input type="radio" name="married" data-ng-model="married" ng-value="false"/>
UNMARRIED

<span ng-if="married">MRS.</span>
<span ng-if="!married">MS.</span>
</code>```

Complete demo

Title: ANGULAR JS ng-if

Body:
I am trying to learning angular JS and I am an absolute beginner.I tried using ng-if directives to print 'Mr or Mrs or Ms' according to the their gender and relationship  status.When I bind the married model within the div tag it is giving out the correct value .But the binding after that prints true every time. Are there any other ways to check conditions ?
Moreover I tried checking conditions with the controller , why doesn't that work? Please help!

    <input type="text" data-ng-model="first">
    <input type="text" data-ng-model="last">

    GENDER
    <input type="radio" name="gender" data-ng-model="gender" value="Male" /> MALE
    <input type="radio" name="gender" data-ng-model="gender" value="Female" /> FEMALE

        <input type="radio" name="married" data-ng-model="married" value="true" /> MARRIED
        <input type="radio" name="married" data-ng-model="married" value="false" /> UNMARRIED

 {{married}}

    MR.

    MRS.
    MS. {{first }} {{last}} {{married}}

Body:
Replace your ng-if="gender==='Female'" by ng-show="gender==='Female'", and it will work fine.

The reason is that ng-if creates its own child scope, and the married property is thus set on this child scope rather than the controller scope.

The appropriate fix would be to avoid binding directly to properties of the scope, but to bind to properties of an object in the scope:

In your controller:

$scope.model = {};

In your view:

<input type="radio" name="married" data-ng-model="model.married" value="true"/>

(and same for all your properties, of course).

You should also never use ng-init. Just initialize your model from your controller:

$scope.model = {
  gender: 'Male',
  married: 'false'
};

Finally, a boolean would be a much better choice for the value of married that a string containing 'true' or 'false'. You can achieve that using ng-value rather than value:

<input type="radio" name="married" data-ng-model="married" ng-value="true"/>
MARRIED
<input type="radio" name="married" data-ng-model="married" ng-value="false"/>
UNMARRIED

<span ng-if="married">MRS.</span>
<span ng-if="!married">MS.</span>

Complete demo


问:
My Header Div is not working
My header doesn't work, as in when I give it a

```<code>background: #XXXXXX
</code>```

it doesn't fill the whole header just 2 sides and when I add a width of say 90% and margin of 0 auto the colour disappears completely.

```<code>body{
 font-family: Trebuchet, Arial, Helvetica;
 font-size:15px;
line-height:1.5;
padding:0;
margin:0;
background-color:#0a1612

}
/* Global */
.container{
width:80%;
margin:auto;
overflow:hidden;
background:#c5c1c0

}
/* Header */
header {
 background:#f7ce3e
 width: 90%;
 margin: 0 auto;

  }
</code>```

答:
In header section after background:#f7ce3e ; semicolon is missing. that's why all the styles that goes after it isn't being applyed.
Here is fixed example.

body{
font-family: Trebuchet, Arial, Helvetica;
font-size:15px;
line-height:1.5;
padding:0;
margin:0;
background-color:#0a1612;

}
/* Global */
.container{
width:80%;
margin:auto;
overflow:hidden;
background:#c5c1c0;
}
/* Header */
header {
 background:#f7ce3e;
 width: 90%;
 margin: 0 auto;
padding: 0 5%;
  }```
<pre class="snippet-code-html lang-html prettyprint-override"><code><header> Lorem ipsum dolor sit amet consectetur, adipisicing elit. Repudiandae consectetur voluptas reiciendis officiis nisi, eius recusandae odio voluptatum quod modi aliquid iste distinctio accusamus placeat maiores quam possimus! Eius, animi. </header>
<div class="container">Lorem ipsum, dolor sit amet consectetur adipisicing elit. Quis iste quam unde omnis ex debitis assumenda atque, quae voluptatibus temporibus. Ratione perspiciatis incidunt fuga laudantium magnam tempora eligendi nesciunt quis.</div></code>```

Title: My Header Div is not working

Body:
My header doesn't work, as in when I give it a

background: #XXXXXX

it doesn't fill the whole header just 2 sides and when I add a width of say 90% and margin of 0 auto the colour disappears completely.

body{
 font-family: Trebuchet, Arial, Helvetica;
 font-size:15px;
line-height:1.5;
padding:0;
margin:0;
background-color:#0a1612

}
/* Global */
.container{
width:80%;
margin:auto;
overflow:hidden;
background:#c5c1c0

}
/* Header */
header {
 background:#f7ce3e
 width: 90%;
 margin: 0 auto;

  }

Body:
In header section after background:#f7ce3e ; semicolon is missing. that's why all the styles that goes after it isn't being applyed.
Here is fixed example.

body{
font-family: Trebuchet, Arial, Helvetica;
font-size:15px;
line-height:1.5;
padding:0;
margin:0;
background-color:#0a1612;

}
/* Global */
.container{
width:80%;
margin:auto;
overflow:hidden;
background:#c5c1c0;
}
/* Header */
header {
 background:#f7ce3e;
 width: 90%;
 margin: 0 auto;
padding: 0 5%;
  }

<header> Lorem ipsum dolor sit amet consectetur, adipisicing elit. Repudiandae consectetur voluptas reiciendis officiis nisi, eius recusandae odio voluptatum quod modi aliquid iste distinctio accusamus placeat maiores quam possimus! Eius, animi. </header>
<div class="container">Lorem ipsum, dolor sit amet consectetur adipisicing elit. Quis iste quam unde omnis ex debitis assumenda atque, quae voluptatibus temporibus. Ratione perspiciatis incidunt fuga laudantium magnam tempora eligendi nesciunt quis.</div>


问:
Illegal string offset on heroku deployment
I am configuring my postgresql driver in Laravel 5.4 for deployment to Heroku. Here is my config/database.php, the default is already set to pgsql

```<code>'pgsql' => [
        'driver' => 'pgsql',
        'host' => parse_url(getenv("DATABASE_URL"))['host'],
        'database' => substr(parse_url(getenv("DATABASE_URL"))['path'], 1),
        'username' => parse_url(getenv("DATABASE_URL")['username']),
        'password' => parse_url(getenv("DATABASE_URL")['password']),
        'charset' => 'utf8',
        'prefix' => '',
        'schema' => 'public',
    ],
</code>```

When I commit I see this warning

```<code>PHP Warning: Illegal string offset 'username' in app/config/database.php on line 62
</code>```

When run heroku run php artisan serveI am getting an error

```<code>[Symfony\Component\Debug\Exception\FatalThrowableError]
Type error: PDO::__construct() expects parameter 2 to be string, array given
</code>```

Here is my .env

```<code>DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=forge
DB_USERNAME=postgres
DB_PASSWORD=
</code>```

答:
Your configuration array should look like the following if you want to get correct data from the .env provided.</p>

```<code>'pgsql' => [
            'driver' => 'pgsql',
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '5432'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'charset' => 'utf8',
            'prefix' => '',
            'schema' => 'public',
            'sslmode' => 'prefer',
        ]
</code>```

Body:
I am configuring my postgresql driver in Laravel 5.4 for deployment to Heroku. Here is my config/database.php, the default is already set to pgsql

'pgsql' => [
        'driver' => 'pgsql',
        'host' => parse_url(getenv("DATABASE_URL"))['host'],
        'database' => substr(parse_url(getenv("DATABASE_URL"))['path'], 1),
        'username' => parse_url(getenv("DATABASE_URL")['username']),
        'password' => parse_url(getenv("DATABASE_URL")['password']),
        'charset' => 'utf8',
        'prefix' => '',
        'schema' => 'public',
    ],

When I commit I see this warning

PHP Warning: Illegal string offset 'username' in app/config/database.php on line 62

When run heroku run php artisan serveI am getting an error

[Symfony\Component\Debug\Exception\FatalThrowableError]
Type error: PDO::__construct() expects parameter 2 to be string, array given

Here is my .env

DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=forge
DB_USERNAME=postgres
DB_PASSWORD=

Body:
Your configuration array should look like the following if you want to get correct data from the .env provided.

'pgsql' => [
            'driver' => 'pgsql',
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '5432'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'charset' => 'utf8',
            'prefix' => '',
            'schema' => 'public',
            'sslmode' => 'prefer',
        ]


问:
HIVE : External Table - how do you clean-up the files in loaded in the user/hive/warehouse/db/table directory
According to the documentation, when we create an EXTERNAL table in HIVE, and then DROP the table, the metadata is updated and the data that was loaded in the HDFS directory /user/hive/warehouse//> still exists?

I have two questions :
1. How do you do clean-up of the files in the /user/hive/warehouse//>?
2. When I tried to create the table again and the files are the same name but the data is different,  HIVE warehoouse files did not get updated
Should it be?? (I asked this since I am not sure if this is a set-up issue or an expected behavior)

答:
To delete EXTERNAL table data, you need to delete it manually from HDFS location, Hive only deletes metadata in this case.
To delete HDFS files, you can use simply rm command:

```<code>hadoop fs -rm /location_of_data
</code>```

and use -rm -R if want to delete recursively.

Body:
To delete EXTERNAL table data, you need to delete it manually from HDFS location, Hive only deletes metadata in this case.
To delete HDFS files, you can use simply rm command:

hadoop fs -rm /location_of_data

and use -rm -R if want to delete recursively.


问:
How do I pause a loop with a button in PyGObject?
I have a button that runs a loop and updates the window accordingly. I want another "pause" button that pauses this loop but it doesn't seem like I can do that while the loop is running. Perhaps threading is the solution (I tried GLib.timeout_add_seconds without success) - what is the easiest way to make this work?
I have attached my faulty code:</p>

```<code>import sys
from time import sleep
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk

class LoopButton(Gtk.Box):

    def __init__(self, GUI):
        Gtk.Box.__init__(self)

        self.GUI = GUI
        self.set_border_width(10)
        self.message = "1"

        button = Gtk.Button.new_with_label("Run")
        button.connect("clicked", self.on_click)
        self.pack_start(button, True, True, 0)

    def on_click(self, widget):
        msg = int(self.message)
        while self.GUI.is_paused == False:
            self.GUI.restart_window(str(msg))
            msg += 1
            while Gtk.events_pending():
                Gtk.main_iteration()
            sleep(1)
        self.GUI.is_paused = True

class PauseButton(Gtk.Box):
    def __init__(self, GUI):
        Gtk.Box.__init__(self)

        self.GUI = GUI
        self.set_border_width(10)

        button = Gtk.Button.new_with_label("Pause")
        button.connect("clicked", self.on_click)
        self.pack_start(button, True, True, 0)

    def on_click(self, widget):
        self.GUI.is_paused = True

class GUI:

    def __init__(self):
        self.is_paused = False
        self.win = Gtk.Window()
        self.window_grid = Gtk.Grid()
        self.box = Gtk.Box(spacing=10)
        self.label = Gtk.Label("Default label")
        self.win.connect("delete-event", Gtk.main_quit)
        self.start_window()

    def start_window(self):
        self.box.pack_start(LoopButton(self), True, True, 0)
        self.box.pack_start(PauseButton(self), True, True, 0)
        self.window_grid.add(self.box)
        self.window_grid.add(self.label)
        self.win.add(self.window_grid)
        self.win.show_all()

    def restart_window(self, label="Default label"):
        self.window_grid.destroy()
        self.window_grid = Gtk.Grid()
        self.box = Gtk.Box(spacing=10)
        self.label = Gtk.Label(label)
        self.start_window()

def main():
    app = GUI()
    Gtk.main()

if __name__ == "__main__":
    sys.exit(main())
</code>```

答:
Depending on what you really do in the loop there may be more necessary details, but below is an example of how looping is normally avoided in GLib/Gtk. The caveats of this method are: A) one iteration must be fast enough to not affect UI updates (a few milliseconds at most). B) The timing is not exact: the timeout function might not be called exactly 2 seconds after the previous call.

```<code>import gi
from gi.repository import GLib

class GUI:
    def __init__(self):
        # initialize the UI here...

        # setup updates every two seconds
        GLib.timeout_add_seconds(2, self.timeout_update)

    def timeout_update(self):
        # update your widgets here
        print ("Updating UI now...")

        # yes, we want to be called again
        return True
</code>```

Body:
I have a button that runs a loop and updates the window accordingly. I want another "pause" button that pauses this loop but it doesn't seem like I can do that while the loop is running. Perhaps threading is the solution (I tried GLib.timeout_add_seconds without success) - what is the easiest way to make this work?
I have attached my faulty code:

import sys
from time import sleep
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk

class LoopButton(Gtk.Box):

    def __init__(self, GUI):
        Gtk.Box.__init__(self)

        self.GUI = GUI
        self.set_border_width(10)
        self.message = "1"

        button = Gtk.Button.new_with_label("Run")
        button.connect("clicked", self.on_click)
        self.pack_start(button, True, True, 0)

    def on_click(self, widget):
        msg = int(self.message)
        while self.GUI.is_paused == False:
            self.GUI.restart_window(str(msg))
            msg += 1
            while Gtk.events_pending():
                Gtk.main_iteration()
            sleep(1)
        self.GUI.is_paused = True

class PauseButton(Gtk.Box):
    def __init__(self, GUI):
        Gtk.Box.__init__(self)

        self.GUI = GUI
        self.set_border_width(10)

        button = Gtk.Button.new_with_label("Pause")
        button.connect("clicked", self.on_click)
        self.pack_start(button, True, True, 0)

    def on_click(self, widget):
        self.GUI.is_paused = True

class GUI:

    def __init__(self):
        self.is_paused = False
        self.win = Gtk.Window()
        self.window_grid = Gtk.Grid()
        self.box = Gtk.Box(spacing=10)
        self.label = Gtk.Label("Default label")
        self.win.connect("delete-event", Gtk.main_quit)
        self.start_window()

    def start_window(self):
        self.box.pack_start(LoopButton(self), True, True, 0)
        self.box.pack_start(PauseButton(self), True, True, 0)
        self.window_grid.add(self.box)
        self.window_grid.add(self.label)
        self.win.add(self.window_grid)
        self.win.show_all()

    def restart_window(self, label="Default label"):
        self.window_grid.destroy()
        self.window_grid = Gtk.Grid()
        self.box = Gtk.Box(spacing=10)
        self.label = Gtk.Label(label)
        self.start_window()

def main():
    app = GUI()
    Gtk.main()

if __name__ == "__main__":
    sys.exit(main())

Body:
Depending on what you really do in the loop there may be more necessary details, but below is an example of how looping is normally avoided in GLib/Gtk. The caveats of this method are: A) one iteration must be fast enough to not affect UI updates (a few milliseconds at most). B) The timing is not exact: the timeout function might not be called exactly 2 seconds after the previous call.

import gi
from gi.repository import GLib

class GUI:
    def __init__(self):
        # initialize the UI here...

        # setup updates every two seconds
        GLib.timeout_add_seconds(2, self.timeout_update)

    def timeout_update(self):
        # update your widgets here
        print ("Updating UI now...")

        # yes, we want to be called again
        return True


问:
Why doesn't WebGL allow binding the same buffer to Array_Buffer and Element_Array_Buffer?
Reference: https://github.com/tmpvar/WebGL-standalone/blob/master/test/khronos-tests/conformance/buffers/buffer-bind-test.html

Why doesn't WebGL allow the same buffer to be bound to Array and Index targets?

答:
Because WebGL needs to be secure since it runs in a web browser an any random site or ad can run WebGL code.

To be secure it has to check that all usages don't read or write any data out of bounds. A simple input example would be calling gl.texImage2D with a large width and height but a buffer too small. Normal C OpenGL will happily read past the end of the buffer but WebGL will not and will give an error. A simple output example would be calling gl.readPixels with a buffer to small for the given width and height. OpenGL would just happily trash memory past the buffer. WebGL will generate an error.

So, similarly, when you call gl.drawElements you're using an index buffer to access data in other buffers. If any of those indices are too large they would access out of bounds data. For example you have a buffer on an attribute that has 3 vertices but you have an index of 3. The only in range indices are 0, 1, and 2. OpenGL doesn't care about this but WebGL does.

So, to make sure you can't do that WebGL has to validate your indices. In other words it has to read through your ELEMENT_ARRAY_BUFFER and check that no indices are would reference out of bounds data. To do that it has to keep of a copy of the data in the ELEMENT_ARRAY_BUFFER (since OpenGL ES 2.0 provides no way to read data from a buffer and even if it did it would be too slow). WebGL's copies of the data in the buffer use memory so in order not to waste memory only buffers that are made with ELEMENT_ARRAY_BUFFER have a copy of their data kept. Other buffers don't need to have a copy of their data.

Because of that the 2 types buffers are incompatible in WebGL hence you can't bind one to both ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER. To do so would require both kinds of buffers to keep a copy of the data.

NOTE: WebGL implementations cache the info related to the indies in an ELEMENT_ARRAY_BUFFER. That means the first time you draw with the buffer for a given range WebGL will scan the copy of the data to make sure no indices are out of range. The next time you draw with that same buffer using the same range, if you haven't changed any data in the buffer then WebGL already knows the highest index and does not have to scan the buffer again.


问:
polymer build: Warning [unknown-superclass] - Unable to resolve superclass superClass
Trying to build my polymer 2.0 project, but every time I try no matter the preset (es5-bundled, es6-bundled) or separate flags, I get the following warning for the one mixin I have:

```<code>EdmMac: public vedtam$ polymer build
info:    Clearing build/ directory...
info:    (default) Building...

    const DatastoreMixin = (superClass) => class extends superClass {
                                                         ~~~~~~~~~~
src/mixins/datastore-mixin.html(1,57) warning [unknown-superclass] - Unable to resolve superclass superClass
info:    (default) Build complete!
</code>```

build object:

```<code>  "builds": [{
    "name": "default",
    "bundle": true,
    "js": {"compile": true},
    "css": {"minify": true},
    "html": {"minify": true},
    "addServiceWorker": true
  }]
</code>```

Caller: app-main.html:

```<code>class MyApp extends Polymer.GestureEventListeners(DatastoreMixin(ReduxMixin(Polymer.Element))) {
</code>```

DatastoreMixin:

```<code><script>
    DatastoreMixin = function(superClass) {
      return class extends superClass {
        constructor() {
          super();
        }

        static get properties() {
          return {
            bar: {
              type: Object
            }
          };
        }

      }
    }
</script>
</code>```

Versions & Environment

Polymer CLI: 1.1.0

node: v6.10.3

Operating System: OSX 10.10.5

What could be wrong?

答:
that's the code I have and I do not get any warning I know of :p</p>

```<code>const GrainUpdateInlineStyleBehavior = subclass => class extends subclass {
</code>```

Body:
Trying to build my polymer 2.0 project, but every time I try no matter the preset (es5-bundled, es6-bundled) or separate flags, I get the following warning for the one mixin I have:

EdmMac: public vedtam$ polymer build
info:    Clearing build/ directory...
info:    (default) Building...

    const DatastoreMixin = (superClass) => class extends superClass {
                                                         ~~~~~~~~~~
src/mixins/datastore-mixin.html(1,57) warning [unknown-superclass] - Unable to resolve superclass superClass
info:    (default) Build complete!

build object:

  "builds": [{
    "name": "default",
    "bundle": true,
    "js": {"compile": true},
    "css": {"minify": true},
    "html": {"minify": true},
    "addServiceWorker": true
  }]

Caller: app-main.html:

class MyApp extends Polymer.GestureEventListeners(DatastoreMixin(ReduxMixin(Polymer.Element))) {

DatastoreMixin:

Versions & Environment

Polymer CLI: 1.1.0

node: v6.10.3

Operating System: OSX 10.10.5

What could be wrong?

Body:
that's the code I have and I do not get any warning I know of :p

const GrainUpdateInlineStyleBehavior = subclass => class extends subclass {


问:
Upload files Using Ajax, Jquery and Struts2
Hi can any one please tell me how to upload files using ajax, jquery and Struts2. I have gone through the lot of tutorials in the net but i didn't get any possible solution. The requirement is when ever we click on the button the javascript function need to be called.The javascript(jquery) initiate the Ajax engine and ajax need to call the struts action to get the response. Here the request and response is without refresh the page and without using the IFrames.  </p>

答:
Hi the below code is working for me. I hope it will help you.

JSP Code:

```<code><div id="uploadImg">
     <s:form id="uploadImgForm" action="strutsaction" method="post" enctype="multipart/form-data">
            <s:file name="imgFileUpload" label="Choose file to upload" accept="image/*"></s:file>
            <s:submit value="Upload" align="center" id="uploadImgSubmitBtn"></s:submit>
     </s:form>
<div>
</code>```

JQuery:

```<code>$("#uploadImgSubmitBtn").click(function(e){

    // Get form
    var form = $('#uploadImgForm')[0];

    // Create an FormData object
    var data = new FormData(form);

    $.ajax({
        type: "POST",
        enctype: 'multipart/form-data',
        url: "strutsaction.action",
        data : data,
        cache: false,
        processData: false,
        contentType: false,
        success: function(data){
            $('#uploadImg').html(data);
        }
    });
});
</code>```

Body:
Hi the below code is working for me. I hope it will help you.

JSP Code:

<div id="uploadImg">
     <s:form id="uploadImgForm" action="strutsaction" method="post" enctype="multipart/form-data">
            <s:file name="imgFileUpload" label="Choose file to upload" accept="image/*"></s:file>
            <s:submit value="Upload" align="center" id="uploadImgSubmitBtn"></s:submit>
     </s:form>
<div>

JQuery:

$("#uploadImgSubmitBtn").click(function(e){

    // Get form
    var form = $('#uploadImgForm')[0];

    // Create an FormData object
    var data = new FormData(form);

    $.ajax({
        type: "POST",
        enctype: 'multipart/form-data',
        url: "strutsaction.action",
        data : data,
        cache: false,
        processData: false,
        contentType: false,
        success: function(data){
            $('#uploadImg').html(data);
        }
    });
});


问:
I don't know why this while loop doesn't stop iterating
It's a challenge on codewars.com, but I can't figure out why this while loop doesn't work

def digital_root(n):
    # Creating variable combine to have the sum
    combine = 0
    # as long as n is more than two numbers.
    while n > 10:
        # converting n to string to iterate
        for i in str(n):
            # getting the sum each element in n
            combine += int(i)
        # reset n to be equal to the combined result
        n = combine
    return combine
```

also, any solutions will be appreciated, here is the link to the challenge
https://www.codewars.com/kata/sum-of-digits-slash-digital-root

答: It is nice that you are updating n, but what about combine. Perhaps a a reset is needed at the end of every iteration?

Body:
It's a challenge on codewars.com, but I can't figure out why this while loop doesn't work

def digital_root(n):
    # Creating variable combine to have the sum
    combine = 0
    # as long as n is more than two numbers.
    while n > 10:
        # converting n to string to iterate
        for i in str(n):
            # getting the sum each element in n
            combine += int(i)
        # reset n to be equal to the combined result
        n = combine
    return combine

also, any solutions will be appreciated, here is the link to the challenge
https://www.codewars.com/kata/sum-of-digits-slash-digital-root


问:
Ajax and PHP - unexpected behaviour
I'm using ajax to send a request to a php page which sets a cookie and sends a message back to the browser using the echo function. But the problem is that php sets the cookie successfully but I don't get the message in echo.
I've console logged the XMLHTTPRequest Object to confirm that.

Here's the php code :

```<code>    <?php header("Access-Control-Allow-Origin: *");
    session_start();
    // echo "true"; - If I put the echo here , I get the response.
    if(isset($_POST['init'])){
        $x00 = universe::decode($_POST['init']);// Just a static function call of object Universe.
        $_SESSION['id'] = $x00['id'];
        echo "true"; // This echo does not appear in the response.
    }
    ?>
</code>```

The responseText is however not undefined , it's an empty string. Take a look at the Pic.

答:
Found the problem , thanks for helping, guys.

What I did intinally was stringify the json data and sent it as a normal post request and expected it to work , but it didn't for some reason.

I wrote a function that sends a post request to the server.

```<code>ajax.send(x); //Send is a function of the object ajax , x is the payload.

param = {"id": "qbcd"} //json data
param=JSON.stringify(ajax.param); // converted to string.
ajax.send("init="+param); // This will send a post request to the server.
</code>```

I thought it will send the post request with init being a string and then I can access the string with $_POST['init'] and use json_decode on it . But for some reason the payload contains the stringyfied json only( checked it with Chrome Dev Tools) , so now we have to access it with $_POST[0] i.e., access the first element of the post array and then parse it . Post is now not an associative array ( idk why).

Thanks for commenting :)
Love stackoverflow.

Title: Ajax and PHP - unexpected behaviour

Body:
I'm using ajax to send a request to a php page which sets a cookie and sends a message back to the browser using the echo function. But the problem is that php sets the cookie successfully but I don't get the message in echo.
I've console logged the XMLHTTPRequest Object to confirm that.

Here's the php code :

    <?php header("Access-Control-Allow-Origin: *");
    session_start();
    // echo "true"; - If I put the echo here , I get the response.
    if(isset($_POST['init'])){
        $x00 = universe::decode($_POST['init']);// Just a static function call of object Universe.
        $_SESSION['id'] = $x00['id'];
        echo "true"; // This echo does not appear in the response.
    }
    ?>

The responseText is however not undefined , it's an empty string. Take a look at the Pic.

Body:
Found the problem , thanks for helping, guys.

What I did intinally was stringify the json data and sent it as a normal post request and expected it to work , but it didn't for some reason.

I wrote a function that sends a post request to the server.

ajax.send(x); //Send is a function of the object ajax , x is the payload.

param = {"id": "qbcd"} //json data
param=JSON.stringify(ajax.param); // converted to string.
ajax.send("init="+param); // This will send a post request to the server.

I thought it will send the post request with init being a string and then I can access the string with $_POST['init'] and use json_decode on it . But for some reason the payload contains the stringyfied json only( checked it with Chrome Dev Tools) , so now we have to access it with $_POST[0] i.e., access the first element of the post array and then parse it . Post is now not an associative array ( idk why).

Thanks for commenting :)
Love stackoverflow.


问:
How to pass Body Parameters to Post operation using API Management Action in Logic App?
I need to consume API in Logic App using API Management Action. I added API Management Action to Logic App with Echo Create Resource (POST) operation. According to the screenshot below I can pass Authentication object and Subscription key only.

I figure out how to add Query Parameters in Swagger API description and use them in Logic App.

How can I pass Body Parameters to API Post operation using API Management Action in Logic App?

答:
You seem to consume the Echo API - I was able to reproduce. In this the POST operation has no body defined.
When I integrate one of my own APIs with a body definition I can see and use it in Logic App Designer

Sample

```<code>  /mail:
    post:
      operationId: Send Email
      parameters:
        - name: mailMessage v3
          in: body
          schema:
            $ref: '#/definitions/MailMessage v3'
      consumes:
        - application/json
      responses:
        '202':
          description: ''
</code>```

Body:
You seem to consume the Echo API - I was able to reproduce. In this the POST operation has no body defined.
When I integrate one of my own APIs with a body definition I can see and use it in Logic App Designer

Sample

  /mail:
    post:
      operationId: Send Email
      parameters:
        - name: mailMessage v3
          in: body
          schema:
            $ref: '#/definitions/MailMessage v3'
      consumes:
        - application/json
      responses:
        '202':
          description: ''


问:
C++: how to build my own utility library?
I am starting to be proficient enough with C++ so that I can write my own C++ based scripts (to replace bash and PHP scripts I used to write before).

I find that I am starting to have a very small collection of utility functions and sub-routines that I'd like to use in several, otherwise unrelated C++ scripts.

I know I am not supposed to reinvent the wheel and that I could use external libraries for some of the utilities I'm creating for myself. However, it's fun to create my own utility functions, they are perfectly tailored to the job I have in mind, and it's for me a large part of the learning process. I'll see about using more polished external libraries when I am proficient enough to work on more serious, long term projects.

So, the question is: how do I manage my personal utility library in a way that the functions can be easily included in my various scripts?

I am using linux/Kubuntu, vim, g++, etc. and mostly coding CLI scripts.

Don't assume too much in terms of experience! ;) Links to tutorials or places where relevant topics are properly documented are welcome.

答:
"Shared objects for the object disoriented!"

"Dissecting shared libraries"