uploads – The media library filter Downloaded in this article & # 39; lack in modal insertion of Gutenberg

Final goal: Retrieves the selection menu entry box to allow a user to filter the results. "Downloaded on this post", "Mine", "Images", "Video", etc. when inserting a Gutenberg image block; not a gallery.

I'm trying to hijack the click on this button to open my new modal.

I have been researching this for a while now and I see some possible solutions, but I do not understand how to apply them or they are incorrect.

enter the description of the image here

enter the description of the image here

Possible solutions:

  1. Replace A with B because A is the default UI stream when you click Add Image> Media Library. The MediaFrame.Select has the modal frame still has the input field of the selection menu.

A. var frame = new wp.media.view.MediaFrame.Select

B. var frame = new wp.media.view.MediaFrame.Post

  1. Extend wp.media.view.MediaFrame.Select with the attribute "filterable: all". Thus, when a user opens the modal field, the menu entry field will exist.
  2. Create a new custom Guten block that uses wp.media.view.MediaFrame.Post by default and leave the existing Guten-Image-existing block alone.

The last code I tried to get a solution

I'm currently using a hook to load the JavaScript code into my functions.php file.

function add_my_filter_please () {
?>

    <?
}
add_action (& # 39; admin_footer & # 39 ;, & gt; add_my_filter_please & # 39;);

c # – Can not display insertion lines in Postgresql

I've tried inserting the lines into the Postgresql table.

using(var connection = new NpgsqlConnection("Host=localhost;Port=5432;User ID=xxxx;Password=xxx;Database=database;Timeout=5"))
        {
            connection.Open();
            var result= connection.Execute("insert into xxx values() );

        }

The execute statement returns 1 (number of rows affected). But when I try to display the table from PgAdmin, the values ​​are not really inserted and the identity value is also increased by 1. But it works if I run the same query insertion from PgAdmin.

mac – How to disable the insertion of ASCII control characters with the help of [control]+[option]+[key]

I've spotted the source of minor annoyance in Xcode due to the inadvertent introduction of invisible ASCII control characters using the [control] + key combination [optional] ] + a touch. However, I do not know how to disable this feature. I would be totally ok if the [control] + [option] + whatever the combination does not do anything.

bulk insert – Slow down MySQL insertion with 3 indexes and 1 foreign key

I was working on a MySQL database with billions of rows of data.

My table has 16 fields, 3 indexes, 1 foreign key and 1 primary key. The size of my buffer pool is 47 GB.

When I tested inserting 10 million rows with indexes disabled, it took 100.

When the indexes are activated, as I continuously inserted billions of lines in blocks of 10 million lines, it was initially 150 … then 400 … then 1000 … and now it has increased to 2000 for 10 million lines (using the load data instruction).

I want to know how to speed up my insertion with these indexes needed for later use.

MySQL crashs several times during the insertion and I have to restart it … I wonder if the slowdown is correlated to crashes. Thank you!

sorting – C insertion sorting

I started studying algorithms using the classic CLRS book and I decided to hone my C skills at the same time.

I have written this function by implementing C insertion sorting. I have tested it and verified that it is working properly. I would like to know if it is legible and follows best practices.

Some points on which I would like to receive comments:

1) Are the variable names well chosen? I have the impression that the C convention is to use shorter names than in other languages ​​and to choose parameter names such as arr and n accordingly. Would names like array and array_size be better?

2) Instead of an array, the calling code could pass a null pointer to the function. I handle this by using an int return value. Is this the best answer?

3) Are the comments explaining the inner loop necessary?

#include 

#define INVALID_PARAMETER 1

/* Sorts an array of ints in-place using insertion sort.
 * Returns INVALID_PARAMETER if a null pointer is passed
 * as argument and 0 otherwise.
 */

int insertion_sort(int arr(), size_t n)
{
    if (arr == NULL) {
        return INVALID_PARAMETER;
    }

    for(size_t i = 1; i < n; i++) {
        int key = arr(i);

        /* Look through the array backwards until finding where key must be
         * inserted. If the element we are looking at now is bigger than key,
         * it is displaced forward. Stop when an element smaller than key is
         * found or the start of the array is reached. */
        size_t j;
        for(j = i; j > 0 && arr(j - 1) > key; j--) {
            arr(j) = arr(j - 1);
        }

        /* After the loop, j is either 0, what means that no element smaller
         * than key was found and it must be the first element in the sorted
         * array, or j is the position after the first element found that was
         * smaller than key and so it is where key must be inserted. */
        arr(j) = key;
    }

    return 0;
}
```

sql – selection and insertion in store

I have two selections in "cascade":
select 1:

SELECT a.cod_almacen, a.id_almacen
D & # 39; Almacen has
INNER JOIN groups g ON a.cod_almacen = g.centro_costo
ORDER BY a.id_almacen 

For all stores:
select 2:

SELECT SUBSTRING (p.begins, 0, 9) at the beginning,
u.group_identifier,
u.identifiant,
u.user_profile,
u.user_scheduler,
e.cargo,
t.description,
t.start_hour,
t.end_hour,
t.break_minutes,
ROUND (md.meta_diaria, 2) as a meta_diaria
From users like you
INNER JOIN planning as p ON u.identifier = p.identifier
INNER JOIN turnos_ like t ON t.id_shift = p.hashed_shift_id
INNER JOIN used as e ON REPLACE (e.cod_employed, & # 39; - & # 39;) & gt; = u.identifier

OUTER APPLY (SELECT sum (sale) as meta_diaria
Selling as v
WHERE v.id_calendar = SUBSTRING (p.begins, 0, 9)
- AND v.id_almacen = a.id_almacen
AND v.id_almacen = select1.id_almacen
AND type = & # 39; PPTO & # 39;) AS md
WHERE p.begins> = 20190701000000 AND p.begins <= 20190705000000
AND u.group_identifier = & # 39; select1.cod_almacen & # 39;
AND u.enabled = 1
ORDER BY starts, ASC identifier;

From this second selection, I get the fields to insert in a new table:

    INSERT IN the objectives (id_calendario, cod_almacen, carga, horas_turno, monto_meta_dia, monto_meta_cargo, total_horas)
VALUES (select2.begins, select2.ident_group, select2.cargo, select2.horas, select2.meta_daily, select2.meta, select2.total_horas_d)

I'm doing all this now in php, but it takes too much time and I have to put all this process into a store procedure, but I do not quite understand how to do that.
I have separate queries because I have to group the results of select 2 for each store.

mysql – The result of a query with two joins results in repeated rows whose number increases exponentially with each new insertion in the join tables

I'm trying to figure out what the calculation behind repeated lines is at two joins in the same query – it kills my backend running Sequelize:

SELECT 'history`.`id`,
`Story`.`title`,
`Story`.`themeid`,
`Industries`.`id` AS` Industries.id`,
`Industries`.`s_sub_sector` AS` Industries.sub_sector`,
`Regulators`.`id` AS` Regulators.id`,
`Regulators`.``country_or_area` AS` Regulators.country_or_area`
From story AS AS Story
LEFT OUTER JOIN (`storyindustry` AS & # 39; Industries -> StoryIndustry`
INNER JOIN 'industry` AS' Industries`
ON `Industries`.`id` =
`Industries-> StoryIndustry`.`industryid`)
ON `story`.`id` = & # 39; Industries-> StoryIndustry`.`storyid`
LEFT OUTER JOIN (`storyregulator` AS & # 39; Regulators-> StoryRegulator`
INNER JOIN & # 39; regulator & # 39; AS `Regulators`
ON `Regulators`.`id` =
`Regulators-> StoryRegulator`.`regulatorid`)
ON `story`.`id` =` Regulators-> StoryRegulator`.`storyid`
ORDER BY `story`.`id` DESC;

The query above gives the result below, where history with id 177 is repeated each time a new entry is inserted into one of the two join tables – that's the is like a Cartesian product.

+ ----- + --------------- + --------- + --------------- + - ---------------------- + --------------- + ----------- ------------------ +
| id | title | themeid | Industries.id | Industries.sub_sector | Regulators.id | Regulators.country_or_area |
+ ----- + --------------- + --------- + --------------- + - ---------------------- + --------------- + ----------- ------------------ +
| 177 | Test history 1. | 63 | 1 | Plant production | 539 | United Nations |
| 177 | Test history 1. | 63 | 1 | Plant production | 540 | United Nations |
| 177 | Test history 1. | 63 | 1 | Plant production | 541 | United Republic of Tanzania |
| 177 | Test history 1. | 63 | 2 | Plant production | 539 | United Nations |
| 177 | Test history 1. | 63 | 2 | Plant production | 540 | United Nations |
| 177 | Test history 1. | 63 | 2 | Plant production | 541 | United Republic of Tanzania |
| 177 | Test history 1. | 63 | 3 | Plant production | 539 | United Nations |
| 177 | Test history 1. | 63 | 3 | Plant production | 540 | United Nations |
| 177 | Test history 1. | 63 | 3 | Plant production | 541 | United Republic of Tanzania |
+ ----- + --------------- + --------- + --------------- + - ---------------------- + --------------- + ----------- ------------------ +

With more than 300,000 lines resulting from my complete query, MySQL moves quite fast, but the ORM, Sequelize crashes after a few seconds while trying to analyze all these lines and condense them into a single result nested.

Are you wondering if there is a way to optimize the query? Running them separately only takes a few milliseconds, but together, an eternity.

Thank you!

algorithms – Right insertion analysis

I am reading N. Wirths: Algorithms + Data Structures = Programs. I am not sure, but I think that there could be an error in the analysis of the type of direct insertion provided. The screenshot of the corresponding paragraph is here: screen capture

                type index = 0..n
var a: table[0..n] of the article

straightinsertion procedure
var i, j: index; x: article;
to start
for i: = 2 to n do
start x: = a[i]; a[0] : = x; j: = i-1;
while x.key <a[j]. key do
start a[j+1] : = a[j]; j: = j-1;
end;
a[j+1] : = x
end
end

I think the analysis of the number of comparisons may be wrong. He claims that the number This key comparisons in the I-The sieve is at most i-1. But should not it be I? In the worst case, since we use Sentinel, we must also make an additional comparison with it. I claim that:

  • C_min = n-1
  • C_ave = 1/4 * (n ^ 2 + 3n - 4)
  • C_max = 1/2 * (n ^ 2 + n) -1

The number of moves Mid should then be (i-1) +2. M_min, M_ave, M_max are, I believe, correct in the text (screenshot).

Could you please confirm if I am right or there is something missing? Thank you all!

postgresql – will this insertion request take too much time to execute?

I'm bulk inserting from a node server to a psql database by building the query as

let query = `INSERT INTO $ {table} (timestamp, lattitude, longitude, type) VALUES;
locationData.forEach (location => {
query + = `($ {location.timestamp}, $ {location.lattitude}, $ {location.longitude} & # 39; # 39;, & # 39; $ {type} & # 39;), `;
});

this api is called every 3 minutes by a device that records the location every second, which means that at least 180 lines will be inserted into each request. will it be a bottleneck?

php – Problem of product insertion and user detail

I use PHP 7.2 MySQL Add to Cart. insert a product as a detail of the user's gest. and product detail all data is inserted, but not product data. I want to insert detailed product data. data inserted as

productImage, productName, product_qty, price) inserted by extraction
foreach buckle impload function of database
PHP code here …

<? php
$ msg = & # 39;
if (isset ($ _ POST['submit'])) {
$ address = mysqli_real_escape_string ($ conn, $ _POST['address'])
$ total = mysqli_real_escape_string ($ conn, $ _POST['total'])
            
        foreach ($ _SESSION["products"] as $ product) {
$ productName = $ product["productName"];
$ productPrice = $ product["productPrice"];
$ product_qty = $ product["product_qty"];
$ productImage1 = $ product["productImage1"];
}
$ productImage = implode (& # 39 ;, $ productImage);
$ productName = implode (& # 39 ;, $ productName);
$ product_qty = implode (& # 39 ;, $ product_qty);
$ price = implode (& # 39;, & # 39 ;, $ price);
                      
            $ query = "INSERT INTO commands
(address, productImage, productName, product_qty, total, price,)
VALUES (& # 39; $ address & # 39; $, productImage & # 39;
& # 39; $ productName & # 39;, & quot; $ product_qty & # 39; $ total & # 39;, & quot; $ price & # 39;) & quot;
$ run = mysqli_query ($ conn, $ query);
not defined ($ _SESSION["products"])
echo "";
}
?>