How to get a value-only flat array from $wpdb->get_results when selecting a single column, without foreach()?

My query is:

$  var = $  wpdb->get_results("SELECT field FROM {$  wpdb->prefix}table", ARRAY_A); var_dump($  var); 

it returns someting like array(2) { [0]=> array(1) { ["field"]=> string(5) "test1" } [1]=> array(1) { ["field"]=> string(t) "test2" }. I.e. each item is a row with a single name-value pair.

What I want is array(2) { [0]=> string(5) "test1" [1]=> string(5) "test2" }

Currently I achieve it like this:

$  var = $  wpdb->get_results("SELECT field FROM {$  wpdb->prefix}table"); foreach($  var as $  v_key => $  v_val) $  var[$  v_key] = $  v_val['field']; var_dump($  var); 

Is there a shorter way to do this?

Selecting a record based off conditions CLOB

I have a table with a column storing JSON data as a CLOB. The JSON has a ‘miscData’ field that is made up of an array of JSON objects. Each object has 2 keys which are always the same, but the values are different.

. . . "otherKeys" : "otherValues", "miscData": [         {             "miscType": "date",             "miscText": "2020-07-09T10:01:10.450Z"         },         {             "miscType": "Comment",             "miscText": "Comment body"         },         {             "miscType": "CORRECT_TYPE",             "miscText": "SELECT_ME"         }     ], "confirmationNumber" : "123456789qwerty", . . . 

I need to

SELECT      CLOB_COL.miscData.miscText  WHERE     CLOB_COL.miscData.miscType = 'CORRECT_TYPE'  AND      CLOB_COL.confirmationNumber = 'xxxx'; 

But I am having trouble since miscData is an array of objects which all contain miscType and miscData keys and I can’t guarantee the array will be the same size, or in the same order.

Unable to create dynamic button link after selecting product

This is my website- I used WPForms to create form across all the websites. After submitting information the user will redirect to this page- When the user selects a specific product he will redirect to the Amazon review page. The review link will be different for every product. My question is how can I add a dynamic button link for each product? I’m using the Elementor page builder to create this button. Thanks guys for your help!

Why is my view selecting hundreds of duplicates?

This view selects 696 entries. The CSV file has 48 entries.

CREATE OR REPLACE VIEW insert_3_char_abts AS SELECT     ext.construct_id,     n_term,     enz_name,     c_term,     cpp,     mutations,     ext.g_batch,     ext.p_batch,     emptycol,          c_batch,     abts5_mean,     abts5_SD,     abts5_n,     abts5_method,     abts5_study_id,     abts7_mean,     abts7_SD,     abts7_n,     abts7_method,     abts7_study_id,     pur.pk_purified_enz_id FROM EXTERNAL ((        construct_id NUMBER(10),       n_term VARCHAR2 (50),       enz_name VARCHAR2 (50),       c_term VARCHAR2 (50),       cpp VARCHAR2 (50),       mutations VARCHAR2 (50),       g_batch VARCHAR2 (50),       p_batch VARCHAR2 (50),       emptycol VARCHAR2(50),        c_batch VARCHAR2 (50),       abts5_mean NUMBER (5, 2),       abts5_SD NUMBER (5, 2),       abts5_n NUMBER (3),       abts5_method VARCHAR2 (50),       abts5_study_id VARCHAR2 (8),       abts7_mean NUMBER (5, 2),       abts7_SD NUMBER (5, 2),       abts7_n NUMBER (3),       abts7_method VARCHAR2 (50),       abts7_study_id VARCHAR2 (8))            TYPE ORACLE_LOADER     DEFAULT DIRECTORY data_to_input     ACCESS PARAMETERS (         RECORDS DELIMITED BY NEWLINE          SKIP 1         BADFILE bad_files:'badflie_view_before_insert_char_abts.bad'         FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'         MISSING FIELD VALUES ARE NULL          )      LOCATION ('CHAR_ABTS.CSV')     REJECT LIMIT UNLIMITED) ext  INNER JOIN purified_enz pur ON ext.p_batch = pur.p_batch INNER JOIN produced pr  ON pr.pk_produced_id = pur.fk_produced_id; ; 

If I finish this statement with

AND pr.fk_construct_id = ext.construct_id; 

It selects 46 out of 48 records, which is better, but not great.

Selecting n elements from array in sublinear time using indices?

Are GPUs or CPUs capable of selecting n elements from an array in sublinear time using indices? If so, what would be some good alternatives to achieve this?

Lets say I have an array A = {1, 5, 6, 3, 6, 2} and indices I = {2, 5, 2, 4, 1, 0}. The resulting array should be: B = {6, 2, 6, 6, 5, 1}. The time complexity for this should be sublinear with respect to the length of I.

header > img not selecting working

On my website, I can't select a particular image (in order to style it to width: 180px). Note that it is currently the right size because I was forced to use inline style, but I want it be controlled with CSS.

It is an img inside of a header parent, but:

header > img

doesn't select it. Neither does img#logo (an id I put on it).

Weirdly, this works perfectly both when directly opening the site from my C: drive and while opening it using my ampps local host, also on my…

header > img not selecting working

Selecting k rows and k columns from a matrix to maximize the sum of the k^2 elements

Suppose $ A$ is an $ n \times n$ matrix, and $ k \ge 1$ is an integer. We want to find $ k$ distinct indices from $ \{1, 2, \ldots, n\}$ , denoted as $ i_1, \ldots, i_k$ , such that

$ \sum_{p, q = 1}^k A_{i_p, i_q}$

is maximized. In words, we seek $ k$ rows and the corresponding $ k$ columns, such that the intersected $ k^2$ elements of $ A$ have the largest sum.

This problem can be formulated as a quadratic assignment problem, which is NP-hard and admits no polynomial time algorithm with constant approximation bound. I’m just wondering if for this specific problem (as a special case of quadratic assignment), there exists a poly-time algorithm with constant approximation bound. Thank you.

Selecting vertices in a graph in an order to keep the cut as small as possible

I am given an undirected graph. Initially all vertices are white. I need to color them black in such an order that the maximum number of vertices which are on the border between black and white regions is minimal. Is there an algorithm to find an optimal order for that?

More formally. We are given an undirected, connected graph $ G = (V,E)$ consisting of $ n$ vertices. I am looking for a sequence of increasing subsets of vertices $ V_0, V_1, …, V_n$ , where $ V_0 = \emptyset$ , $ V_{i+1} = V_i \cup \{v\}$ for some $ v\in V$ , and $ V_n = V$ . For any subset $ W \subset V$ we define a cost function $ c(W)$ as the number of “border” vertices, i.e. size of $ \{w\in W : \exists m\in V\setminus W: (w,m)\in E \}$ . I am looking for such a sequence where $ \max_i(c(V_i))$ is minimal.

I feel my problem is somehow related to maximum flow algorithms, the same way as minimum-cut problem is. I think there must be a name for this (or similar) problem. However, as I was mixing “minimal cut” in various ways in the search engines, I was unable to find it.

A bit of context: I have a series of tasks to perform (edges), each loading two files from a disk (vertices). In order to speed up the process, I don’t want the reload every pair of files every time. Instead, I want to keep some files in memory so that I can reuse them when another task uses the same file. But I cannot keep all files that there are because of memory constriants. The above sequence would help me select an optimal processing order, keeping the number of active files to minimum.