rest: compensations between RESTful GET and serialization of the query string

REST is intended for long-term network-based applications that span several organizations. If you do not see the need for restrictions, do not use them. – Fielding, 2008

Your can Use POST for everything, if you wish. SOAP did that, and more recently GraphQL also leans that way.

But what you abandon are the properties that arise from the most restrictive restrictions of GET. Two of these are that GET requests are secure and cacheable.

Insurance means that general purpose components may know that there is no danger when retrying a batch request; In an unreliable network, they can forward a request autonomously if the response is lost.

Caching, of course, means that we have broadly understood the semantics that not only describe if something can be cached, but for how long and when they should be invalidated.

Essentially, the use of POST for everything reduces HTTP from an application protocol to a transport protocol.

Dynamic SQL query for counting data

I am working on an application that counts the number of employees in each department.

Here is my code:

    count(case when (JS_TITLE = 'Accounting')then 1 end)as Accounting,
    count(case when (JS_TITLE = 'Management')then 1 end)as Management,
    count(case when(JS_TITLE = 'Marketing')then 1 end )as Marketing,
    count(case when(JS_TITLE = 'HR')then 1 end)as HR

But the point is that the user can add a new department.

Is there a better way to make this static code more dynamic?

wp query: Bootstrap grid while loop

I made a grid with bootstrap where I want to show 5 different posts, but for some reason it duplicates the grids and shows one post per grid. Here you can see how the grids begin to duplicate
This is how I would like it to work

The first image shows how the grids begin to duplicate and the second, how I would like it to work, shows one publication per column.


$ args = array (

post_type & # 39; => & # 39; post,
& # 39; posts_per_page & # 39; => 5,

$ blogposts = new WP_Query ($ args);

while ($ blogposts-> have_posts ()) {
$ blogposts-> the_post (); ?>

<a href = "
<img class = "card-img" src = ""alt =" Card image ">
Miika 16.2.2020 - Oppaat
<a href = "">
<img class = "card-img" src = ""alt =" Card image ">
Miika 16.2.2020 - Oppaat
<a href = "">
<img class = "card-img" src = ""alt =" Card image ">

Miika 16.2.2020 - Oppaat
<a href = "">
<img class = "card-img" src = ""alt =" Card image ">
Miika 16.2.2020 - Oppaat
<a href = "">
<img class = "card-img" src = ""alt =" Card image ">
Miika 16.2.2020 - Oppaat
<? php} wp_reset_query ();

php – SQL query where a condition would be to exclude records that are duplicated in a field

Good people I am developing a page where several queries are made to databases, I am using PHP and MySQL, the question is that I cannot conclude a query that has the condition (among others) to obtain the records that have in the field Status = pending , except those that are repeated in the file_number field.
I pass an image with the test database that I am using and the code of the query that in this case tells me that a subquery is repeated more than one row

enter image description here
The query code is as follows

$consulta = "SELECT seguimientos.*, usuarios.nombres, usuarios.apellidos FROM seguimientos, usuarios WHERE seguimientos.usuario_recepcion=(SELECT ID_usuarios FROM usuarios WHERE dni=".$_SESSION('sess_usuario').") AND usuarios.ID_usuarios=seguimientos.usuario_envio AND seguimientos.estado='pendiente' AND NOT(SELECT A.ID_seguimiento FROM seguimientos A, seguimientos B WHERE A.numero_expediente = B.numero_expediente AND A.estado <> B.estado)";

-I clarify that I have to parameterize this query later, I am open to advice by the way

This is what he tells me when I run that query

"Subquery returns more than 1 row"

Thank you!

url: AdSense doesn't show ads because Facebook links add a query parameter

Query parameters make different URLs. When Facebook adds parameters, it creates new URLs. AdSense has no way of knowing if the content will be different or not without crawling the URL.

To solve this problem, you can redirect to remove unwanted query parameters. See this question in StackOverflow: .htaccess: remove a query parameter from the URL.

When you redirect visitors to your canonical URL without the query parameter, the ads will be served from that canonical URL and AdSense can display the ads without additional tracking.

query – Get 2 meta values ​​from the key meta column

I want to select & # 39; name & # 39 ;, & # 39; SKU & # 39; and & # 39; price & # 39; of 2 WP tables: wp_posts and wp_postmeta.
I don't know how to get data from the column & # 39; meta_value & # 39; twice for & # 39; meta_key & # 39; = & # 39; _ price & # 39; and & # 39; meta_key & # 39; = & # 39; _ sku & # 39 ;, ex.
enter the description of the image here

My current query:

                    "SELECT a.post_title, m1.meta_value, m2.meta_value FROM wp_posts a, wp_postmeta m1, wp_postmeta m2
                WHERE a.post_type='product' AND m1.post_id = a.ID
                AND m1.meta_key='_sku'
                AND m2.meta_key='_price'"

csom: CAML query for secondary properties

I have a CSOM query like this:

   lis => lis.Include(
          i => i.RoleAssignments.Include(
               ra => ra.RoleDefinitionBindings,
               ra => ra.RoleDefinitionBindings.Include(
                     rdb => rdb.Name
                     rdb => rdb.Name != "Limited Access"
               ra => ra.Member.LoginName.StartsWith("SharingLink"))

I want to load all the elements that, in their Role Assignments, the Member's Login Name begins with the text "SharinLink". However, this is not possible because CSOM cannot use Start with function.

There is also the option of using BeginsWith from a CAML query. However, I don't know how to tell the query that you need to use a ListItem.RoleAssignments.Member.LoginName property. it's possible? Given that there are several RoleAssignments per ListItem.

Thanks in advance.

sql – How to number MySQL query results?

How can I number the results of a query on MySql?

Starting from that we have a table.


Nombre Edad Departamento 
User1   33    BD 
User2   34    BD 
User3   25    BI 
User4   45    BI 


Nombre Edad Departamento  Media_Dept  Ranking_empresa
User1   33     BD            33.5         3
User2   34     BD            33.5         2
User3   25     BI            35           4
User4   45     BI            35           1

I get the average age with:

SELECT Departamento, ROUND(AVG(EDAD),2) as Media_Depart FROM tabla_a GROUP BY Departamento

but I don't know how to number the results and give it a ranking

Thanks for your help

How can I improve this query form?

We have reduced the number of questions asked to users. Once the query form is clicked, we have a secondary layer for the form that is an overlay.
Is there any way to improve this better?

enter the description of the image here

enter the description of the image here

sql server: creating an index that is not used by a query (SELECT) reduces the performance of that query

I just saw this video of Pinal Dave.

He has a SELECT query that produces ~ 370k readings in tempdb and ~ 1200 readings of the table in which the query is made SELECTing of

Then create an index (let's call it, Index1) that eliminates the tempdb reel and therefore improves query performance. Everything is OK until now.

However, then create an additional index (we'll call it Index2) and leave the Index1 intact.

Then rerun your query and, despite Index2 not used, query performance returns to its original state, with the spool ~ 370k tempdb still in place.

Actually, it doesn't seem to describe what causes this (unless I missed it)

What would cause this behavior?