adamos@Asfodel:~$ cat /etc/default/keyboard
# Check /usr/share/doc/keyboard-configuration/README.Debian for
# documentation on what to do after having modified this file.
# The following variables describe your keyboard and can have the same
# values as the XkbModel, XkbLayout, XkbVariant and XkbOptions options
# in /etc/X11/xorg.conf.
XKBMODEL="pc105"
XKBLAYOUT="us,ru"
XKBVARIANT=","
XKBOPTIONS="grp:alt_shift_toggle,terminate:ctrl_alt_bksp,grp_led:scroll"
# If you don't want to use the XKB layout on the console, you can
# specify an alternative keymap. Make sure it will be accessible
# before /usr is mounted.
# KMAP=/etc/console-setup/defkeymap.kmap.gz
BACKSPACE="guess"
RewriteCond %{HTTP_HOST} !^192\.168\.100\.254
Можно ли с нуля обучится программированию, используя только интернет и не тратив деньги?
нужны люди, которым я смогу задать пару вопросов.
// В начале, когда Земля была безвидна и пуста, и все ковырялось через макросы
// #define BEGIN_EVENT_TABLE(a,b) wxBEGIN_EVENT_TABLE(a,b)
// #define EVT_PAINT(func) wx__DECLARE_EVT0(wxEVT_PAINT, wxPaintEventHandler(func))
BEGIN_EVENT_TABLE(wxImagePanel, wxPanel)
EVT_PAINT(wxImagePanel::paintEvent)
END_EVENT_TABLE()
// Ближе к цивилизации, макросы еще не вымерли
// #define wxPaintEventHandler(func) wxEVENT_HANDLER_CAST(wxPaintEventFunction, func)
Connect(wxEVT_PAINT, wxPaintEventHandler(paintEvent));
// А что, сразу вот так нельзя было?
// Bind - метод класса, wxEVT_PAINT - константа, никакой магии...
Bind(wxEVT_PAINT, &wxImagePanel::paintEvent, this);
const prices = [
{ diameter: 40, brick: 25, concrete: 30 },
{ diameter: 50, brick: 25, concrete: 30 },
{ diameter: 60, brick: 25, concrete: 30 },
];
const realDiameter = 55;
const material = 'brick';
let price = 0;
for(let n = 0; n < prices.length; ++n) {
if(realDiameter < prices[n].diameter) {
break;
}
price = prices[n][material];
}
public function getCards2024(): array
{
$cards = [];
$limit = 100;
$cursor = [
'limit' => $limit
];
do {
$res = $this->curlQuery(
self::API_SUPPLIERS,
self::METHOD_POST,
'content/v2/get/cards/list',
[
'settings' => [
'sort' => [
'ascending' => false
],
'cursor' => $cursor,
'filter' => ['withPhoto' => -1]
]
]
);
if(!is_array($res) || !isset($res['cards'])) {
throw new \ErrorException('WB returns wrong answer');
}
$cards = array_merge($cards, $res['cards']);
$cursor['updatedAt'] = $res['cursor']['updatedAt'];
$cursor['nmID'] = $res['cursor']['nmID'];
} while($res['cursor']['total'] >= $limit);
return $cards;
}
чтобы не делать такую процедуру вновь
private function makeLowIdList($array)
{
return array_flip(array_map(fn($value) => mb_convert_case($value, MB_CASE_LOWER), $array));
}
private function getId($idList, $title, $label)
{
$lowTitle = mb_convert_case($title, MB_CASE_LOWER);
if(!array_key_exists($lowTitle, $idList)) {
throw new Exception('wrong ' . $label . ': ' . $title);
}
return $idList[$lowTitle];
}
public function import($data)
{
$payerIds = $this->makeLowIdList(Payer::getTitles());
foreach(...) {
try {
...
$payerId = $this->getId($payerIds, $row['payer'], $row['orderNumber'] . ' payer');
...
} catch(Exception $e) {
$error = $e->getMessage();
if(!in_array($error, $errors)) {
$errors[] = $error;
}
}
}
return $errors;
}