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 [2026/07/24 14:16] – [php] fdc9:281f:4d7:9ee9::1 | onny:notizen:programmierung [2026/10/06 19:56] (current) – [php] fdc9:281f:4d7:9ee9::1 | ||
|---|---|---|---|
| Line 535: | Line 535: | ||
| $a = array (' | $a = array (' | ||
| print_r($a); | print_r($a); | ||
| + | </ | ||
| + | |||
| + | filter array only unique items | ||
| + | |||
| + | <code php> | ||
| + | $userIds = array_unique($userIds); | ||
| </ | </ | ||
| Line 652: | Line 658: | ||
| return new Calendar($calendar); | 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[' | ||
| + | </ | ||
| + | |||
| + | check if string in array | ||
| + | |||
| + | <code php> | ||
| + | if (in_array(' | ||
| + | // trashbin was requested | ||
| } | } | ||
| </ | </ | ||
| Line 686: | Line 717: | ||
| </ | </ | ||
| + | logging | ||
| + | |||
| + | <code php> | ||
| + | $this-> | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ]); | ||
| + | </ | ||
| ==== wordpress ==== | ==== wordpress ==== | ||
| registering menus | registering menus | ||
| Line 894: | Line 934: | ||
| </ | </ | ||
| + | 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; | ||
| + | </ | ||
| + | |||
| + | ==== django ==== | ||
| + | |||
| + | admin, searchable dropdown. plan field will be searchable. | ||
| + | |||
| + | <code python> | ||
| + | class GovernmentPlanUpdateAdmin(admin.ModelAdmin): | ||
| + | [...] | ||
| + | autocomplete_fields = [" | ||
| + | | ||
| + | [...] | ||
| + | |||
| + | class GovernmentPlanAdmin(admin.ModelAdmin): | ||
| + | form = GovernmentPlanForm | ||
| + | [...] | ||
| + | search_fields = (" | ||
| + | </ | ||
| + | |||
| + | ===== nix ===== | ||
| + | |||
| + | ====== lib ====== | ||
| + | |||
| + | remove prefix | ||
| + | |||
| + | <code nix> | ||
| + | stripped = | ||
| + | lib.removePrefix " | ||
| + | (lib.removePrefix " | ||
| + | </ | ||
onny/notizen/programmierung.1784902569.txt.gz · Last modified: by fdc9:281f:4d7:9ee9::1
