Hotfix release available: 2026-07-14b "Mort".
upgrade now! [57.2] (what's this?)
onny:notizen:programmierung
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| onny:notizen:programmierung [2023/03/24 14:48] – [javascript] 10.100.0.1 | onny:notizen:programmierung [2026/08/18 11:23] (current) – [mariadb / mysql] fdc9:281f:4d7:9ee9::1 | ||
|---|---|---|---|
| Line 205: | Line 205: | ||
| </ | </ | ||
| ===== javascript ===== | ===== javascript ===== | ||
| + | |||
| + | conditional properties in object | ||
| + | <code javascript> | ||
| + | cont my_object = { | ||
| + | ...(version >= 33 ? { iconSvgInline: | ||
| + | } | ||
| + | </ | ||
| split up javascript files | split up javascript files | ||
| Line 514: | Line 521: | ||
| } | } | ||
| </ | </ | ||
| - | ===== css ===== | + | |
| - | sweet font styling | + | ===== php ===== |
| - | < | + | |
| - | font-family: consolas,Menlo-Regular, | + | printf string |
| - | font-size: 125%; | + | |
| - | line-height: | + | < |
| + | printf(" | ||
| </ | </ | ||
| - | media queries, page greater than 600px | + | |
| - | < | + | print array |
| - | | + | |
| - | article { | + | < |
| - | min-width: 600px; | + | $a = array (' |
| - | } | + | print_r($a); |
| - | } | + | |
| </ | </ | ||
| - | popover menu | ||
| - | <code css> | ||
| - | .main-navigation ul li ul.sub-menu { | ||
| - | opacity: 0; | ||
| - | position: absolute; | ||
| - | box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26); | ||
| - | transition: | ||
| - | padding: 20px; | ||
| - | z-index: 2; | ||
| - | left: 17px; | ||
| - | background: | ||
| - | } | ||
| - | .main-navigation ul li:hover ul.sub-menu { | + | filter array only unique items |
| - | opacity: 1; | + | |
| - | transition: | + | <code php> |
| - | } | + | $userIds = array_unique($userIds); |
| </ | </ | ||
| - | responsive grid layout | + | append to array |
| - | < | + | |
| - | ul { | + | < |
| - | display: grid; | + | $fruits = [' |
| - | grid-gap: 50px 40px; | + | $fruits[] = ' |
| - | grid-template-columns: | + | |
| - | } | + | |
| </ | </ | ||
| - | ===== php ===== | + | |
| + | assosiative array / dictionary | ||
| + | |||
| + | <code php> | ||
| + | $myResult[" | ||
| + | </ | ||
| + | |||
| + | datetime object, convert to string | ||
| + | |||
| + | < | ||
| + | $date = new \DateTime(' | ||
| + | $dateString | ||
| + | </ | ||
| enable debugging / error log | enable debugging / error log | ||
| + | |||
| <file - / | <file - / | ||
| display_startup_errors = true | display_startup_errors = true | ||
| Line 570: | Line 577: | ||
| chmod a+w+r / | chmod a+w+r / | ||
| </ | </ | ||
| + | |||
| foreach loop | foreach loop | ||
| + | |||
| <code php> | <code php> | ||
| foreach($this-> | foreach($this-> | ||
| Line 580: | Line 589: | ||
| } | } | ||
| </ | </ | ||
| + | |||
| get array length | get array length | ||
| + | |||
| <code php> | <code php> | ||
| var_dump(count($a)); | var_dump(count($a)); | ||
| Line 586: | Line 597: | ||
| get type of variable | get type of variable | ||
| + | |||
| <code php> | <code php> | ||
| foreach($data as $episode) { | foreach($data as $episode) { | ||
| Line 593: | Line 605: | ||
| convert string to int | convert string to int | ||
| + | |||
| <code php> | <code php> | ||
| intval(" | intval(" | ||
| Line 603: | Line 616: | ||
| </ | </ | ||
| + | |||
| + | define class, create object | ||
| + | |||
| + | <code php> | ||
| + | class Calendar { | ||
| + | private array $data; | ||
| + | |||
| + | public function __construct(array $data) { | ||
| + | $this-> | ||
| + | } | ||
| + | |||
| + | public function getUserId(): | ||
| + | $principalUri = $this-> | ||
| + | $principalUriParts = explode('/', | ||
| + | $user = end($principalUriParts); | ||
| + | return $user; | ||
| + | } | ||
| + | |||
| + | public function getDisplayName(): | ||
| + | return $this-> | ||
| + | } | ||
| + | |||
| + | public function __debugInfo(): | ||
| + | // keeps print_r() useful | ||
| + | return $this-> | ||
| + | } | ||
| + | } | ||
| + | |||
| + | private function fetchCalendarById(int $calendarId) { | ||
| + | $query = $this-> | ||
| + | $query-> | ||
| + | -> | ||
| + | -> | ||
| + | $result = $query-> | ||
| + | $calendar = $result-> | ||
| + | $result-> | ||
| + | |||
| + | if (empty($calendar)) { | ||
| + | return false; | ||
| + | } | ||
| + | |||
| + | return new Calendar($calendar); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | print and debug php database queries | ||
| + | |||
| + | <code php> | ||
| + | $query-> | ||
| + | -> | ||
| + | -> | ||
| + | |||
| + | printf(" | ||
| + | printf(" | ||
| + | </ | ||
| + | |||
| + | check if array key exists (avoid undefined warning) via "null casting" | ||
| + | |||
| + | <code php> | ||
| + | if ($config[' | ||
| + | </ | ||
| ==== nextcloud app dev ==== | ==== nextcloud app dev ==== | ||
| logging, available methods: emergency, alert, critical, error, warning, notice, info, debug | logging, available methods: emergency, alert, critical, error, warning, notice, info, debug | ||
| Line 635: | Line 709: | ||
| </ | </ | ||
| + | logging | ||
| + | |||
| + | <code php> | ||
| + | $this-> | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ]); | ||
| + | </ | ||
| ==== wordpress ==== | ==== wordpress ==== | ||
| registering menus | registering menus | ||
| Line 787: | Line 870: | ||
| </ | </ | ||
| ===== sql ===== | ===== sql ===== | ||
| - | Update field: | ||
| - | <code sql> | ||
| - | update forwardings set destination=' | ||
| - | </ | ||
| - | Insert field: | ||
| - | <code sql> | ||
| - | insert into forwardings (source, destination) VALUES (' | ||
| - | insert into forwardings VALUES (' | ||
| - | </ | ||
| - | Delete row: | ||
| - | <code sql> | ||
| - | delete from domains where domain=' | ||
| - | </ | ||
| <code sql> | <code sql> | ||
| mysql> \P / | mysql> \P / | ||
| Line 819: | Line 889: | ||
| </ | </ | ||
| - | ==== mysql ==== | + | ==== mariadb / mysql ==== |
| + | |||
| + | select column and sort alphabetically | ||
| + | |||
| + | < | ||
| + | SELECT user_id | ||
| + | FROM oc_user_oidc | ||
| + | ORDER BY user_id ASC; | ||
| + | </ | ||
| delete specific row | delete specific row | ||
| + | |||
| < | < | ||
| delete from oc_storages where numeric_id=58; | delete from oc_storages where numeric_id=58; | ||
| Line 827: | Line 906: | ||
| remove user | remove user | ||
| + | |||
| <code sql> | <code sql> | ||
| DROP USER ' | DROP USER ' | ||
| Line 832: | Line 912: | ||
| adjust permissions to table | adjust permissions to table | ||
| + | |||
| <code sql> | <code sql> | ||
| CREATE USER ' | CREATE USER ' | ||
| Line 845: | Line 926: | ||
| </ | </ | ||
| + | sort column by timestamp and convert to datetime | ||
| + | |||
| + | <code sql> | ||
| + | SELECT | ||
| + | `id`, | ||
| + | `calendarid`, | ||
| + | FROM_UNIXTIME(`firstoccurence`) AS firstoccurence, | ||
| + | FROM_UNIXTIME(`lastoccurence`) | ||
| + | FROM `oc_calendarobjects` | ||
| + | WHERE (`lastoccurence` < 1606694400) | ||
| + | AND (`firstoccurence` > 0) | ||
| + | AND (`componenttype` = ' | ||
| + | ORDER BY `lastoccurence` DESC; | ||
| + | </ | ||
onny/notizen/programmierung.1679669336.txt.gz · Last modified: by 10.100.0.1
