CREATE TEMPORARY TABLE all_ticker (`ticker` varchar(16) NOT NULL);
INSERT INTO all_ticker SELECT ticker FROM table1;
INSERT INTO all_ticker SELECT ticker FROM table2;
INSERT INTO all_ticker SELECT ticker FROM table3;
CREATE TEMPORARY TABLE uniq_ticker (`ticker` varchar(16) NOT NULL)
SELECT ticker FROM all_ticker GROUP BY ticker HAVING count(*) = 1;
SELECT * FROM table1 t1 JOIN uniq_ticker u ON t1.ticker = u.ticker;
SELECT * FROM table2 t2 JOIN uniq_ticker u ON t2.ticker = u.ticker;
SELECT * FROM table3 t3 JOIN uniq_ticker u ON t3.ticker = u.ticker;
DROP TEMPORARY TABLE all_ticker, uniq_ticker;
LIST="d-auth-service-5f5f466864-bdskb demodent-api-gateway-677bf48f98-gmn2n demomed-client-widget-6c58686f69-qvj9g"
for L in $LIST; do
echo "src: $L"
OIFS=$IFS; IFS="-"; N=($L); IFS=$OIFS; Z=${N[0]}
for ((I=1; $I < `expr ${#N[*]} - 2`; I=`expr $I + 1`)); do
Z=$Z-${N[$I]}
done
echo "result: $Z"
done
src: d-auth-service-5f5f466864-bdskb
result: d-auth-service
src: demodent-api-gateway-677bf48f98-gmn2n
result: demodent-api-gateway
src: demomed-client-widget-6c58686f69-qvj9g
result: demomed-client-widget
for L in $LIST; do
echo "src - $L"
Z=`echo $L | cut -f1-3 -d'-'`
echo "result - $Z"
done
$inputNumbers = [3279, 920, 4181, 8, 337, 13, 918, 4923, 1,
4448, 8, 4756, 4012, 7467, 89, 21, 9238, 2326, 6453, 89, 4606,
3413, 3, 9950, 2098, 8579, 4914, 7204, 8875
];
$max_val = max($inputNumbers);
$result_sum = 0;
$fib_prev_prev = 0;
$fib_prev = 1;
$fib_temp = $fib_prev_prev + $fib_prev;
for ($i = 0; $fib_temp <= $max_val; $i++) {
$found = 0;
$fib_temp = $fib_prev_prev + $fib_prev;
$fib_prev_prev = $fib_prev;
$fib_prev = $fib_temp;
if (array_search($fib_temp, $inputNumbers)) {
$found = 1;
$result_sum += $fib_temp;
}
echo $i," - ",$fib_temp, ($found==1 ? " found":""),"\n";
}
echo "Result sum ", $result_sum, "\n";
0 - 1 found
1 - 2
2 - 3 found
3 - 5
4 - 8 found
5 - 13 found
6 - 21 found
7 - 34
8 - 55
9 - 89 found
10 - 144
11 - 233
12 - 377
13 - 610
14 - 987
15 - 1597
16 - 2584
17 - 4181 found
18 - 6765
19 - 10946
Result sum 4316
<a href="delete.php?id=notesDelete=' . $row['id'] . '">
echo "<a href=delete.php?id=",$row['id'],"¬esDelete=1><button>delete</button></a>";
if (!isset($_GET['id'])) die("Error: not found id parameter");
$id = intval($_GET['id']);
if ($id == 0) die("Error: wrong id parameter value");
if (isset($_GET['notesDelete'])) {
$dbc = mysqli_connect('localhost', 'root', '', 'notes') or die('Connect error...');
$query = "DELETE FROM note WHERE id = ".$id;
$result = mysqli_query($dbc, $query);
mysqli_close($dbc);
} else {
die("Error: no any action found");
}
$id = intval("SELECT nothing"); var_dump($id);
$id = intval("1312; DELETE something"); var_dump($id);
$h = "DELETE FROM note WHERE id = '$id'";
var_dump($h);
$id = "10'; DROP DATABASE mysql; SELECT * FROM note WHERE id='1";
$h = "DELETE FROM note WHERE id = '$id'";
var_dump($h);
int(0)
int(1312)
string(34) "DELETE FROM note WHERE id = '1312'"
string(80) "DELETE FROM note WHERE id = '10'; DROP DATABASE mysql; SELECT * from note id='1'"
#include <stdio.h>
void print_line(int *a, int line) {
for (int j = 0; j < 4; j++) {
printf("%d\t", a[j]);
}
printf("\n");
}
int sum_line(int *a, int line) {
int sum = 0;
for (int j = 0; j < 4; j++) {
sum += a[j];
}
return sum;
}
int main() {
int a[4][4] = {{4, 5, 1, 0 },
{1, 8, 0, 2 },
{8, 5, 1, -5},
{6, 4, -3, 0 }};
for (int i = 0; i < 4; i++) {
print_line(&a[i][0], i);
}
for (int i = 0; i < 4; i++) {
printf("\nСтрока - %d сумма - %d",i, sum_line(&a[i][0], i));
}
}
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv) {
int opt_b = 0;
if (argc == 1) printf("No options\n");
if ((argc > 1) && (strcmp(argv[1],"b")==0)) {
opt_b = 1;
}
if (opt_b == 1) {
printf("Option b\n");
}
return 0;
}