mysql – How to perform a strictly SQL query that uses multiple values ​​and searches in all fields

I am trying to create what I would call an "inclusive" search and, therefore, I do not mean "between". I have a code snippet and it does what I need it to do, but it's intrepid and inefficient, so I want to know if I can do it with just SQL. I'm using a third-party library called MysqliDb, but if you want to skip writing your answer in that format, that's fine.

                                if ($ this-> data! = & # 39; & # 39;) {
$ searchParams = explode (& # 39; & # 39 ;, trim ($ this-> data));
foreach ($ searchParams as $ s) {
$ this-> db-> orWhere (& # 39; customer_name & # 39 ;, & # 39;% & # 39 ;. $ s. & # 39;% & # 39 ;, & # 39; like & # 39;) ;
$ this-> db-> orWhere (& # 39; customer_address & # 39 ;, & # 39;. $ s. & # 39;% & # 39 ;, & # 39; like & # 39;) ;
$ this-> db-> orWhere (& # 39; customer_city & # 39 ;, & # 39 ;. $ s. & # 39;% & # 39 ;, & # 39; like & # 39;) ;
$ this-> db-> orWhere (& # 39; customer_zip & # 39 ;, & # 39;% & # 39 ;. $ s. & # 39;% & # 39 ;, & # 39; like & # 39;) ;
$ this-> db-> orWhere (& # 39; customer_email1 & # 39 ;, & # 39;. $ s. & # 39;% & # 39 ;, & # 39; like & # 39;) ;
}
$ this-> db-> having (& # 39; customer_status & # 39 ;, & # 39; Active & # 39;);
$ this-> db-> having (& # 39; owner_id & # 39 ;, $ this-> owner_id);
$ binaryArray = array_fill (0, sizeof ($ searchParams), 0);
$ results = $ this-> db-> get (& # 39; tblcustomers & # 39;);
$ filtered = [];
foreach ($ results as $ r) {
$ binaryArray = array_fill (0, sizeof ($ searchParams), 0);
foreach ($ binaryArray as $ key => $ b) {
if (strpos (strtolower ($ r)['customer_name']), strtolower ($ searchParams[$key]))! == false ||
strpos (strtolower ($ r['customer_address']), strtolower ($ searchParams[$key]))! == false ||
strpos ($ r['customer_city'], strtolower ($ searchParams[$key]))! == false ||
strpos ($ r['customer_zip'], strtolower ($ searchParams[$key]))! == false ||
strpos ($ r['customer_email1'], strtolower ($ searchParams[$key]))! == false
) {
$ binaryArray[$key] = 1;
}
}
if (! in_array (0, $ binaryArray)) {
$ filtered[] = $ r;
}
}
} else {
$ this-> db-> where (& # 39; owner_id & # 39 ;, $ this-> owner_id);
$ this-> db-> having (& # 39; customer_status & # 39 ;, & # 39; Active & # 39;);
$ filter = $ this-> db-> get (& # 39; tblcustomers & # 39;);
}

$ this-> data is an entry box with possible search words separated by spaces, so my intention is to divide the value of the input box based on that and make a query that have to include all the parameters. By that I mean, I can easily make a query where it retrieves each row with $ this-> data[0] or $ this-> data[1] but I want to exclude the rows that do not really have all the words in $ this-> data in one column or another.

What I have does that, but it uses a lot of PHP and I prefer to keep the db query exclusively to SQL.

c # – Convert configuration values ​​repetitively

Looking for design suggestions for this problem. I have a set of values ​​of a sensor that becomes a bitmap of 640 x 512. The sensor always generates a buffer composed of a range of integers between 6205 and 10205. I need to convert them into a list or array of bytes (0, 0.0 – 255,255,255 for gray scale or three bytes representing the color, example 3). , 56, 243) for a BW or color image.

Currently I am:

  1. iterating the buffer and converting two bytes to a short

  2. Iterating the short matrix and converting those values ​​to temperature

  3. Get maximum and minimum temperatures and then iterate the temperatures and convert them to 0 – 255.

I get a buffer every 30 ms from the sensor and do the whole loop and the previous calculation takes all 30 ms. I would like to lower this time to 5 – 10 ms.

I was thinking about doing the calculations once and placing them in a dictionary, doing a search for each value and returning the result. Hoping to lower the iteration to once do it this way.

Ultimately, I will apply custom colors to the temperature image instead of grayscale.

Is there a better (faster) way to do this? I'm working on C #.

How can I divide the values ​​of two queries?

enter the description of the image here

Basically I want the result as (B / A) * 3600

How to upload values ​​to the variable $ V {REPORT_COUNT} in JasperSoft?

Very good! I'm novatillo with this from the Jaspers and I'm desperate to add a value to the variable $ V {REPORT_COUNT}. Nor with the sum () function can I add the value. If anyone has an idea how to do it, I would appreciate it.

PHP recreates an array if it contains certain values

I have $ fruits_arr:

Training
(
    [0] => Array
(
            https://codereview.stackexchange.com/q/224167 => 213
            [fruit] => banana
)

    [1] => Array
(
            https://codereview.stackexchange.com/q/224167 => 438
            [fruit] => apple
)

    [2] => Array
(
            https://codereview.stackexchange.com/q/224167 => 154
            [fruit] => peach
)
)

Y $ ids_arr:

Array 
  [0] => 213
  [1] => 154
)

I want to recreate $ fruits_arr have only matrix elements where I.D is equal to a value of $ ids_arr. I also want to maintain the order of the index / matrix of $ fruits_arr.

I am using the following:

$ selected_fruits = array ();

foreach ($ fruits_arr as $ fruit):
if (in_array ($ fruit)['id'], $ ids_arr)):
$ selected_fruits[] = $ fruit;
it will end yes;
endforeach

print_r ($ selected_fruits);

It seems to work, but I wonder if there is a better and shorter way to achieve this in the latest version of PHP.

plotted: 3D graph with an inequality condition for parameter values

I'm trying to ListPlot3D the next function

$ f = frac {- frac {(t-1) (ds) left (2 cd (d (q-1) + s) -s left (-2 d ^ 2 + d (s + 2) + s ^ 2 right) right)} {2 s ^ 2} + d ^ 2-d sd t + st} {s} $

against $ c in [0,1]$ Y $ q in [1,2]$ under the conditions of $ s = 2 $, $ d = 0.8 $, $ t = 0 $, $ 0 leq c leq 1 $Y $ 1 leq q leq frac {1} {c} $.

I'm struggling with how to reflect the last condition, that is, $ 1 leq q leq frac {1} {c} $ in my Mathematica code. used to Assumption But it does not work

Here is the code that I tried:

To block[{s=2d=08t=0}f=(d^2-ds-((ds)(2cd(d(-1+q)+s)-s(-2d^2+s^2+d(2+s)))(-1+t))/(2s^2)-dt+st)/s;maxn=Flat[Table[{cqf}{c011}{q121}Assumptions->{0<c<=11[{s=2d=08t=0}f=(d^2-ds-((d-s)(2cd(d(-1+q)+s)-s(-2d^2+s^2+d(2+s)))(-1+t))/(2s^2)-dt+st)/s;maxn=Aplanar[Mesa[{cqf}{c011}{q121}Suposiciones->{0{0 <c <= 11 <= q<= 1/c}], 1];] {ListPlot3D[maxn, AxesLabel -> {"c", "q", "V"}]}

seo – URL parameters in GSC contain strange values ​​for recently crawled URLs

I have been fighting the algorithm error of the canonical Google page for quite some time. One tip I received is to set the parameters of the GSC URL in "Each URL", since we use a page generation script with a "page" parameter and we do not use "Let Googlebot decide". When I set it up, if I click on "Show example URL", GSC shows something like that for recently crawled URLs:

index.pl?page=nhcuofak
index.pl?page=mgiwznbsiwhmbh
index.pl?page=cbmtogqjbgakj
index.pl?page=kzktuwhan
index.pl?page=uxuatqqr
:
:

I have also attached a screenshot: screenshot Of course, none of these pages exists on our web server. As far as I can tell, our GSC account has not been hacked, at least I do not see any evidence that someone has sent indexing requests other than me. Entering any of these parameters causes our site to return a 404. Why would Google be tracking with random page parameter values? And a corollary question, could this affect the canonical selection of Google pages?

pandas – Add and remove grouped values

I have the following problem I have a data frame with the fields "Unique ID", "Name", "Heading" and "Value". When the Rubric field has codes other than 240 and 245, the corresponding sales charge is calculated (added) in the "Value" field. If the heading is 352, subtract the amount of the commission in the "Value" field. The result must be grouped by the employee's enrollment. And a filter should be applied to know which employees, at the end of this process, have earned more than 30,000. The code you tried is below:

`f0219_grouped = f0219[~f0219['Código Rubrica'].isin (['240','245'])].groupby (['Identificação Única', 'Nome','Código Rubrica'])['Valor'].sum (). reset_index ()
f0219_group['Valor2']= (f0219_grouped['Valor'] - (f0219_grouped['Valor'].where (f0219_grouped['Código Rubrica']= 352)) fillna (0))
f0219_group[f0219_grouped["Valor"]> 30000]`

Apparently, the code is correct. But for some reason I do not know yet, it's not adding all the different rubrics of 240 and 245, although I've inserted this rule after groupby, that is, ['valor'].sum (). When it is executed, it returns the first value of the "Value" field, but does not sum with some values ​​below (whose rubric is not 240,245 or 352). I do not know what could be wrong. The example data frame is found in the following figure:

Insert the description of the image here.

SQL server: replace values ​​in the table with the values ​​of another table where both tables do not have the same number of rows

I have two tables at this time.

Table 1
+ ----- + ---- +
id val
1 a
2 b
3 c
4 d
5 e
+ ----- + ---- +
Table 2
+ ---- + ----- +
id val
1 aa
2 bb
3 cc
+ ---- + ----- +


I want a resulting table to look like this replacing the values ​​in table 1 of table 2 as well and keeping the name change intact

Resulting table
+ ----- + ----- +
id val
1 aa
2 bb
3 cc
4 d
5 e
+ ----- + ----- +

I have tried the following code

UPDATE Table1
SET Table1.val = Table2.val
where Table1.id = Table2.id

but I get an error that

table2.id can not be linked

Is there any other solution? Note that both tables do not have the same length.

blockchain – Why did repeated "R" values ​​occur in Bitcoin transactions before?

the R value is the result of the multiplication of EC points between k value (known as nonce) and the generating point of the secp256k1 curve. It is effectively the public key to k. The only way in which a R the value can be repeated is yes k It is also the same. Given the k is a 256-bit number and is supposed to be chosen completely randomly, k it should not be repeated unless the random number generator is broken.

Taking into account that k is generated at the time of signing and must be random, we can conclude that who chose k for those transactions you have a defective random number generator that is generating a fixed value or a small value that increases the probability of k being repeated. There is no good reason for this to happen, so this error comes from a faulty RNG or a misinterpretation of how ECDSA works.