rest – POSTing a nested object – returning the created nested object inside the parent

Suppose that we have a Post resource (this is just a dummy example):

GET /api/posts/1

{
  "id": 1,
  "header": null,
  "content": null
}

And now we’d like to create a Header inside the Post#1.

POST /api/posts/1/header

{
  "color": "blue",
  "title": "Some title"
}

Now, is it okay for the POST request above to return the following response?

{
  "id": 1,
  "header": {
    "id": 1,
    "color": "blue",
    "title": "Some title"
  },
  "content": null
}

So, basically, a Header was created inside the Post and returned as part of the Post.

Also, if we need to GET the header for Post#1:

GET api/posts/1/header

 {
   "id": 1,
   "color": "blue",
   "title": "Some title"
}

So here only the Header is returned.

In Google bigquery, where to find the returning user variable for visitor?

In Google BigQuery, I am trying to find if there is a variable, which tells if the visitor is returning visitor or not. In other words, I want to find out if a visitor already had a cookie placed in his browser or it is a new visitor?

Is it possible to do so? Does such a variable exist in Google BigQuery. In Google Analytics dashboard, I can see that such a variable exists.

Thanks!

8 – Any idea why view->field is empty when executing a view returning user emails?

We are using Business Rules to execute a view (users) that returns a list of email addresses. It works fine when rule is triggered by admin, but does not work when triggered by other users. In debugging it I found the following:

  1. as both users the view returns the correct result rows, ie. $view->result is identical for both users.
  2. as admin the view object contains a list of the fields which business_rules uses, ie. $fields = $view->field is an array keyed on ‘mail’;
  3. as any other user $view->field is empty UNLESS I turn on administer users permissions for that user’s role!

I am thinking that in views a permission to view the mail field is being checked when the ‘fields’ are populated into the view object. But, oddly enough that permission does not effect the view result as mentioned in #1.

Any thoughts on how to debug this further?

windows – WSL export returning error while exporting docker-desktop-data

I am trying to free some space on my C driver by moving Docker For Desktop images and data to another driver. I’ve found out, that due to me using wsl2 compability I cannot simply move directory through settings->advanced, and I need to do this by exporting docker-desktop-data image to another drive and then importing it again. It’s supposed to be as simple as

wsl --export docker-desktop-data place_of_delivery/file.tar

But when I’am trying to run this command I am getting error:

Exporting the distribution failed.
: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socketbsdtar: (null)

I was also trying with different combinations of path, file formats etc, but it’s always returning error

Those are my containers running on wsl:

 wsl -l -v
  NAME                   STATE           VERSION
* Ubuntu                 Stopped         2
  Ubuntu-20.04           Stopped         2
  docker-desktop         Stopped         2
  docker-desktop-data    Stopped         2
  kali-linux             Stopped         2

Also I cannot find any similar case, so does anybody know how can I resolve this?

count function on json file not returning correct value (php)

I have a JSON file which contains reviews that I want to access. it looks like this:

"rating" : 4.3,
      "reference" : "ChIJ88iCe5inYUgRdeXmfCtuvu4",
      "reviews" : (
         {
            "author_name" : "Karen Hoad",
            "author_url" : "https://www.google.com/maps/contrib/103129952317107981705/reviews",
            "language" : "en",
            "profile_photo_url" : "https://lh6.googleusercontent.com/-OkGM8wAyHz8/AAAAAAAAAAI/AAAAAAAAAAA/AMZuucn55YdMQZ1BX6ods-S34cieMQODrg/s128-c0x00000000-cc-rp-mo-ba5/photo.jpg",
            "rating" : 4,
            "relative_time_description" : "6 months ago",
            "text" : "Great place just not good when raining as the animals stay in",
            "time" : 1599236033
         },
         {
            "author_name" : "John Lee Ashworth",
            "author_url" : "https://www.google.com/maps/contrib/116452096322094109908/reviews",
            "language" : "en",
            "profile_photo_url" : "https://lh3.googleusercontent.com/-_ZpK7cdK1NI/AAAAAAAAAAI/AAAAAAAAAAA/AMZuuclmcdFSQNilc5MfhJ3m8rRqzAXO_A/s128-c0x00000000-cc-rp-mo/photo.jpg",
            "rating" : 3,
            "relative_time_description" : "6 months ago",
            "text" : "Love zoos, love animals, hate nothing but steep hills though",
            "time" : 1598880406.....

it continues, but I want to loop through the number of reviews there are, so I can grab all of them and post it onto my website.

I am getting the count like this :

$json = json_decode($place_id, true);
reviewCount = count($json);

and then I have my for loop:

for ($i = 0; $i < $elementCount; $i++){
...
}

What I’ve realised is my count always returns 3. I used var_dump to see what it actually counts, and its not the reviews.

I’m not sure how I would actually count the number of reviews, so I’m stuck as this point.

Any help or even info would be massively appriciated, thanks!

pathfinder 1e – Can i get full number of attacks with a thrown returning weapon

Thanks for contributing an answer to Role-playing Games Stack Exchange!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.

To learn more, see our tips on writing great answers.

sharepoint online – Form returning Numerical answer on the form

Stack Exchange Network


Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Form returning numerial answer on the form

How can I create a form which returns the answer on the form itself in either Sharepoint or Microsoft Teams? It should calculate a numerical answer from a prespecified formula based on the inputs on the form.

magento2.4.0 – Magento 2.4 installation on local returning elasticsearch error

I have installed elasticsearch on local (xampp) and on http://localhost:9200/ is showing it is running.
But when I trying to install magento 2.4 getting elasticsearch error.

Magento installation command –

php bin/magento setup:install --base-url="http://127.0.0.1/magento2" --db-host="localhost" --db-name="magento2" --db-user="root" --db-password="" --admin-firstname="Test" --admin-lastname="Test" --admin-email="test@gamil.com" --admin-user="admin" --admin-password="admin123" --language="en_US" --currency="INR" --timezone="Asia/Kolkata" --use-rewrites="1" --backend-frontname="admin" --elasticsearch-host=elasticsearch --elasticsearch-port=9200

And getting below error –

Installing search configuration...

In SearchConfig.php line 81:

  Could not validate a connection to Elasticsearch. No alive nodes found in your cluster

What should I try to install magento 2.4?

Problem returning result

Hello,
I have this query:

select e.quantity, rl.quantity
from logistics_inout.reception r
left join logistics_inout.reception_line rl on
rl.reception_id = r.id
left join logistics_inout.reception_documents rd on
r.id = rd.reception_id
left join logistics_inout.document_line e on
rd.documents_id = e.document_id
where rl.reception_id = 5738
and rl.product_id = 20992
and e.product_id = 20992

the result is:

quantity quantity_1
16.00 1.00
4.00 1.00
16.00 1.00
4.00 1.00
16.00 1.00
4.00 1.00
16.00 1.00
4.00 1.00
16.00 1.00
4.00 1.00
16.00 1.00
4.00 1.00
16.00 1.00
4.00 1.00
16.00 1.00
4.00 1.00
16.00 1.00
4.00 1.00
16.00 1.00
4.00 1.00
16.00 1.00
4.00 1.00
16.00 1.00
4.00 1.00
16.00 1.00
4.00 1.00
16.00 1.00
4.00 1.00
16.00 1.00
4.00 1.00
16.00 1.00
4.00 1.00
16.00 1.00
4.00 1.00
16.00 1.00
4.00 1.00
16.00 1.00
4.00 1.00
16.00 1.00
4.00 1.00
16.00 1.00
4.00 1.00

And it should be:
20 21

The product code is just for testing the result, when it all goes well with the query i will remove it
Please help me
SEMrush

Thank you