text:
Q: Why does my Kali Linux system suddenly restart at odd times? My Kali Linux system suddenly rebooted at 19:05. It used to be rebooted at certain times.
Where does the problem come from? Why does this happen?
/var/log/syslog:
Jun 22 19:00:11 sz dbus-daemon[1107]: [session uid=1000 pid=1107] Activating service name='org.freedesktop.thumbnails.Thumbnailer1' requested by ':1.20' (uid=1000 pid=1267 comm="Thunar --sm-client-id 2907171bc-383e-4913-98ef-4e2")
Jun 22 19:00:11 sz dbus-daemon[1107]: [session uid=1000 pid=1107] Successfully activated service 'org.freedesktop.thumbnails.Thumbnailer1'
Jun 22 19:00:11 sz org.freedesktop.thumbnails.Thumbnailer1[8466]: Registered thumbnailer atril-thumbnailer -s %s %u %o
Jun 22 19:00:11 sz org.freedesktop.thumbnails.Thumbnailer1[8466]: Registered thumbnailer /usr/bin/gdk-pixbuf-thumbnailer -s %s %u %o
Jun 22 19:00:11 sz org.freedesktop.thumbnails.Thumbnailer1[8466]: Registered thumbnailer /usr/bin/gdk-pixbuf-thumbnailer -s %s %u %o
Jun 22 19:00:26 sz kernel: [ 8967.611430] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=38238 DF PROTO=2
Jun 22 19:01:26 sz kernel: [ 9027.732329] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=38520 DF PROTO=2
Jun 22 19:02:26 sz kernel: [ 9087.763352] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=38802 DF PROTO=2
Jun 22 19:03:26 sz kernel: [ 9147.764475] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=39084 DF PROTO=2
Jun 22 19:03:44 sz kernel: [ 9165.351804] r8169 0000:02:00.0 eth0: Link is Down
Jun 22 19:03:50 sz NetworkManager[781]: <info>  [1655908430.3035] device (eth0): state change: activated -> unavailable (reason 'carrier-changed', sys-iface-state: 'managed')
Jun 22 19:03:50 sz NetworkManager[781]: <info>  [1655908430.3192] dhcp4 (eth0): canceled DHCP transaction
Jun 22 19:03:50 sz NetworkManager[781]: <info>  [1655908430.3193] dhcp4 (eth0): activation: beginning transaction (timeout in 45 seconds)
Jun 22 19:03:50 sz NetworkManager[781]: <info>  [1655908430.3193] dhcp4 (eth0): state changed no lease
Jun 22 19:03:50 sz NetworkManager[781]: <info>  [1655908430.3197] dhcp6 (eth0): canceled DHCP transaction
Jun 22 19:03:50 sz NetworkManager[781]: <info>  [1655908430.4049] manager: NetworkManager state is now DISCONNECTED
Jun 22 19:03:50 sz dbus-daemon[658]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service' requested by ':1.4' (uid=0 pid=781 comm="/usr/sbin/NetworkManager --no-daemon")
Jun 22 19:03:50 sz systemd[1]: Starting Network Manager Script Dispatcher Service...
Jun 22 19:03:50 sz dbus-daemon[658]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Jun 22 19:03:50 sz systemd[1]: Started Network Manager Script Dispatcher Service.
Jun 22 19:03:51 sz NetworkManager[781]: <info>  [1655908431.1817] device (eth0): carrier: link connected
Jun 22 19:03:51 sz NetworkManager[781]: <info>  [1655908431.1818] device (eth0): state change: unavailable -> disconnected (reason 'carrier-changed', sys-iface-state: 'managed')
Jun 22 19:03:51 sz NetworkManager[781]: <info>  [1655908431.1822] policy: auto-activating connection 'SZ' (9a20cc84-47c0-44bd-90e4-36e369b8da15)
Jun 22 19:03:51 sz NetworkManager[781]: <info>  [1655908431.1825] device (eth0): Activation: starting connection 'SZ' (9a20cc84-47c0-44bd-90e4-36e369b8da15)
Jun 22 19:03:51 sz NetworkManager[781]: <info>  [1655908431.1825] device (eth0): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Jun 22 19:03:51 sz NetworkManager[781]: <info>  [1655908431.1828] manager: NetworkManager state is now CONNECTING
Jun 22 19:03:51 sz NetworkManager[781]: <info>  [1655908431.1828] device (eth0): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Jun 22 19:03:51 sz NetworkManager[781]: <info>  [1655908431.1830] device (eth0): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Jun 22 19:03:51 sz kernel: [ 9172.235665] r8169 0000:02:00.0 eth0: Link is Up - 100Mbps/Full - flow control rx/tx
Jun 22 19:03:51 sz NetworkManager[781]: <info>  [1655908431.1832] dhcp4 (eth0): activation: beginning transaction (timeout in 45 seconds)
Jun 22 19:03:53 sz NetworkManager[781]: <info>  [1655908433.1016] dhcp6 (eth0): activation: beginning transaction (timeout in 45 seconds)
Jun 22 19:03:55 sz NetworkManager[781]: <info>  [1655908435.5297] dhcp4 (eth0): state changed new lease, address=192.168.1.4
Jun 22 19:03:55 sz NetworkManager[781]: <info>  [1655908435.5332] device (eth0): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'managed')
Jun 22 19:03:55 sz NetworkManager[781]: <info>  [1655908435.5382] device (eth0): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
Jun 22 19:03:55 sz NetworkManager[781]: <info>  [1655908435.5386] device (eth0): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')
Jun 22 19:03:55 sz NetworkManager[781]: <info>  [1655908435.5394] manager: NetworkManager state is now CONNECTED_LOCAL
Jun 22 19:03:55 sz NetworkManager[781]: <info>  [1655908435.5401] manager: NetworkManager state is now CONNECTED_SITE
Jun 22 19:03:55 sz NetworkManager[781]: <info>  [1655908435.5403] policy: set 'SZ' (eth0) as default for IPv4 routing and DNS
Jun 22 19:03:55 sz NetworkManager[781]: <info>  [1655908435.5408] policy: set 'SZ' (eth0) as default for IPv6 routing and DNS
Jun 22 19:03:55 sz NetworkManager[781]: <info>  [1655908435.6221] device (eth0): Activation: successful, device activated.
Jun 22 19:03:55 sz NetworkManager[781]: <info>  [1655908435.6232] manager: NetworkManager state is now CONNECTED_GLOBAL
Jun 22 19:05:13 sz systemd[1]: Finished Load Kernel Modules.
Jun 22 19:05:13 sz systemd[1]: Starting Apply Kernel Variables...
Jun 22 19:05:13 sz kernel: [    0.000000] microcode: microcode updated early to revision 0xf0, date = 2021-11-16
Jun 22 19:05:13 sz systemd[1]: Finished Remount Root and Kernel File Systems.
Jun 22 19:05:13 sz systemd[1]: Starting Create System Users...
Jun 22 19:05:13 sz systemd[1]: Finished Apply Kernel Variables.
Jun 22 19:05:13 sz systemd[1]: Finished Coldplug All udev Devices.
Jun 22 19:05:13 sz systemd[1]: Starting Helper to synchronize boot up for ifupdown...
Jun 22 19:05:13 sz kernel: [    0.000000] Linux version 5.17.0-kali3-amd64 (devel@kali.org) (gcc-11 (Debian 11.3

sudo apt-get update && sudo apt-get autoclean && sudo apt-get clean && sudo apt-get autoremove
I ran this command on Kali Linux but the system restarted again at 22:51.
/var/log/syslog:
Jun 22 22:33:47 sz kernel: [ 1659.113575] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=32512 DF PROTO=2
Jun 22 22:34:47 sz kernel: [ 1719.224457] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=33050 DF PROTO=2
Jun 22 22:35:01 sz CRON[2501]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 22 22:35:47 sz kernel: [ 1779.325362] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=33332 DF PROTO=2
Jun 22 22:36:47 sz kernel: [ 1839.426261] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=33614 DF PROTO=2
Jun 22 22:37:47 sz kernel: [ 1899.517183] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=33896 DF PROTO=2
Jun 22 22:38:47 sz kernel: [ 1959.628058] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=34178 DF PROTO=2
Jun 22 22:39:01 sz CRON[2506]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jun 22 22:39:35 sz systemd[1]: Starting Clean php session files...
Jun 22 22:39:35 sz systemd[1]: phpsessionclean.service: Deactivated successfully.
Jun 22 22:39:35 sz systemd[1]: Finished Clean php session files.
Jun 22 22:39:47 sz kernel: [ 2019.728968] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=34460 DF PROTO=2
Jun 22 22:40:47 sz kernel: [ 2079.839856] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=34742 DF PROTO=2
Jun 22 22:41:47 sz kernel: [ 2139.940752] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=35024 DF PROTO=2
Jun 22 22:42:48 sz kernel: [ 2200.051640] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=35306 DF PROTO=2
Jun 22 22:43:02 sz dbus-daemon[663]: [system] Activating via systemd: service name='org.bluez' unit='dbus-org.bluez.service' requested by ':1.57' (uid=1000 pid=2551 comm="/opt/google/chrome/chrome --enable-crashpad")
Jun 22 22:43:02 sz dbus-daemon[663]: [system] Activation via systemd failed for unit 'dbus-org.bluez.service': Unit dbus-org.bluez.service not found.
Jun 22 22:43:03 sz gnome-keyring-d[1058]: asked to register item /org/freedesktop/secrets/collection/Default_5fkeyring/2, but it's already registered
Jun 22 22:43:48 sz kernel: [ 2260.162534] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=35588 DF PROTO=2
Jun 22 22:44:48 sz kernel: [ 2320.273418] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=35870 DF PROTO=2
Jun 22 22:45:01 sz CRON[3116]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 22 22:45:48 sz kernel: [ 2380.384298] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=36152 DF PROTO=2
Jun 22 22:46:48 sz kernel: [ 2440.475218] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=36434 DF PROTO=2
Jun 22 22:47:48 sz kernel: [ 2500.566132] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=36716 DF PROTO=2
Jun 22 22:48:48 sz kernel: [ 2560.667036] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=36998 DF PROTO=2
Jun 22 22:49:48 sz kernel: [ 2620.757926] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=37280 DF PROTO=2
Jun 22 22:50:48 sz kernel: [ 2680.868826] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=37562 DF PROTO=2
Jun 22 22:52:08 sz systemd[1]: Mounted Huge Pages File System.
Jun 22 22:52:08 sz kernel: [    0.000000] microcode: microcode updated early to revision 0xf0, date = 2021-11-16
Jun 22 22:52:08 sz kernel: [    0.000000] Linux version 5.17.0-kali3-amd64 (devel@kali.org) (gcc-11 (Debian 11.3.0-3) 11.3.0, GNU ld (GNU Binutils for Debian) 2.38) #1 SMP PREEMPT Debian 5.17.11-1kali1 (2022-05-30)
Jun 22 22:52:08 sz kernel: [    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.17.0-kali3-amd64 root=UUID=c41cc0d2-7e41-4de3-a3e5-5c9096fdd4a6 ro quiet splash

The system was restarted for the third time at 23:56.
/var/log/syslog:
Jun 22 23:53:07 sz dbus-daemon[1054]: [session uid=1000 pid=1054] Activating via systemd: service name='org.gtk.vfs.Metadata' unit='gvfs-metadata.service' requested by ':1.20' (uid=1000 pid=1214 comm="Thunar --sm-client-id 2907171bc-383e-4913-98ef-4e2")
Jun 22 23:53:07 sz systemd[1032]: Starting Virtual filesystem metadata service...
Jun 22 23:53:07 sz dbus-daemon[1054]: [session uid=1000 pid=1054] Successfully activated service 'org.gtk.vfs.Metadata'
Jun 22 23:53:07 sz systemd[1032]: Started Virtual filesystem metadata service.
Jun 22 23:53:07 sz dbus-daemon[1054]: [session uid=1000 pid=1054] Activating service name='org.freedesktop.thumbnails.Thumbnailer1' requested by ':1.20' (uid=1000 pid=1214 comm="Thunar --sm-client-id 2907171bc-383e-4913-98ef-4e2")
Jun 22 23:53:07 sz org.freedesktop.thumbnails.Thumbnailer1[6957]: Registered thumbnailer atril-thumbnailer -s %s %u %o
Jun 22 23:53:07 sz org.freedesktop.thumbnails.Thumbnailer1[6957]: Registered thumbnailer /usr/bin/gdk-pixbuf-thumbnailer -s %s %u %o
Jun 22 23:53:07 sz org.freedesktop.thumbnails.Thumbnailer1[6957]: Registered thumbnailer /usr/bin/gdk-pixbuf-thumbnailer -s %s %u %o
Jun 22 23:53:07 sz dbus-daemon[1054]: [session uid=1000 pid=1054] Successfully activated service 'org.freedesktop.thumbnails.Thumbnailer1'
Jun 22 23:53:56 sz kernel: [ 3725.083054] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=55328 DF PROTO=2
Jun 22 23:54:56 sz kernel: [ 3785.184010] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=55610 DF PROTO=2
Jun 22 23:55:01 sz CRON[7275]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 22 23:56:51 sz systemd[1]: Finished Coldplug All udev Devices.
Jun 22 23:56:51 sz systemd[1]: Starting Helper to synchronize boot up for ifupdown...
Jun 22 23:56:51 sz kernel: [    0.000000] microcode: microcode updated early to revision 0xf0, date = 2021-11-16
Jun 22 23:56:51 sz systemd[1]: Finished Helper to synchronize boot up for ifupdown.
Jun 22 23:56:51 sz systemd[1]: Finished Apply Kernel Variables.
Jun 22 23:56:51 sz systemd[1]: Finished Create System Users.
Jun 22 23:56:51 sz systemd[1]: Starting Create Static Device Nodes in /dev...
Jun 22 23:56:51 sz kernel: [    0.000000] Linux version 5.17.0-kali3-amd64 (devel@kali.org) (gcc-11 (Debian 11.3.0-3) 11.3.0, GNU ld (GNU Binutils for Debian) 2.38) #1 SMP PREEMPT Debian 5.17.11-1kali1 (2022-05-30)
Jun 22 23:56:51 sz kernel: [    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.17.0-kali3-amd64 root=UUID=c41cc0d2-7e41-4de3-a3e5-5c9096fdd4a6 ro quiet splash
Jun 22 23:56:51 sz kernel: [    0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
Jun 22 23:56:51 sz kernel: [    0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
Jun 22 23:56:51 sz kernel: [    0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
Jun 22 23:56:51 sz kernel: [    0.000000] x86/fpu: Supporting XSAVE feature 0x008: 'MPX bounds registers'
Jun 22 23:56:51 sz systemd[1]: Finished Create Static Device Nodes in /dev.
Jun 22 23:56:51 sz kernel: [    0.000000] x86/fpu: Supporting XSAVE feature 0x010: 'MPX CSR'
Jun 22 23:56:51 sz kernel: [    0.000000] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256
Jun 22 23:56:51 sz kernel: [    0.000000] x86/fpu: xstate_offset[3]:  832, xstate_sizes[3]:   64
Jun 22 23:56:51 sz kernel: [    0.000000] x86/fpu: xstate_offset[4]:  896, xstate_sizes[4]:   64
Jun 22 23:56:51 sz kernel: [    0.000000] x86/fpu: Enabled xstate features 0x1f, context size is 960 bytes, using 'compacted' format.
Jun 22 23:56:51 sz kernel: [    0.000000] signal: max sigframe size: 2032
Jun 22 23:56:51 sz systemd[1]: Reached target Preparation for Local File Systems.
Jun 22 23:56:51 sz systemd[1]: Starting Rule-based Manager for Device Events and Files...
Jun 22 23:56:51 sz systemd[1]: Started Rule-based Manager for Device Events and Files.
Jun 22 23:56:51 sz kernel: [    0.000000] BIOS-provided physical RAM map:
Jun 22 23:56:51 sz kernel: [    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009c3ff] usable
Jun 22 23:56:51 sz kernel: [    0.000000] BIOS-e820: [mem 0x000000000009c400-0x000000000009ffff] reserved
Jun 22 23:56:51 sz kernel: [    0.000000] BIOS-e820: [mem 0x00000000000e0000-0x00000000000fffff] reserved
Jun 22 23:56:51 sz kernel: [    0.000000] BIOS-e820: [mem 0x0000000000100000-0x00000000b3a23fff] usable
Jun 22 23:56:51 sz kernel: [    0.000000] BIOS-e820: [mem 0x00000000b3a24000-0x00000000b3a5afff] ACPI data
Jun 22 23:56:51 sz kernel: [    0.000000] BIOS-e820: [mem 0x00000000b3a5b000-0x00000000b3e0ffff] usable
Jun 22 23:56:51 sz kernel: [    0.000000] BIOS-e820: [mem 0x00000000b3e10000-0x00000000b3e10fff] ACPI NVS
Jun 22 23:56:51 sz kernel: [    0.000000] BIOS-e820: [mem 0x00000000b3e11000-0x00000000b3e11fff] reserved
Jun 22 23:56:51 sz kernel: [    0.000000] BIOS-e820: [mem 0x00000000b3e12000-0x00000000c0b30fff] usable
Jun 22 23:56:51 sz kernel: [    0.000000] BIOS-e820: [mem 0x00000000c0b31000-0x00000000c241efff] reserved
Jun 22 23:56:51 sz kernel: [    0.000000] BIOS-e820: [mem 0x00000000c241f000-0x00000000c2433fff] ACPI data
Jun 22 23:56:51 sz kernel: [    0.000000] BIOS-e820: [mem 0x00000000c2434000-0x00000000c253afff] usable
Jun 22 23:56:51 sz systemd[1]: Starting Show Plymouth Boot Screen...

Reboot time 23:56
journalctl --since "2022-06-22 23:30"
Jun 22 23:34:54 sz kernel: [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PR>
Jun 22 23:35:01 sz CRON[4920]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Jun 22 23:35:01 sz CRON[4921]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 22 23:35:01 sz CRON[4920]: pam_unix(cron:session): session closed for user root
Jun 22 23:35:54 sz kernel: [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PR>
Jun 22 23:36:54 sz kernel: [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PR>
Jun 22 23:37:54 sz kernel: [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PR>
Jun 22 23:38:54 sz kernel: [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PR>
Jun 22 23:39:01 sz CRON[5176]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Jun 22 23:39:01 sz CRON[5177]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; >
Jun 22 23:39:01 sz CRON[5176]: pam_unix(cron:session): session closed for user root
Jun 22 23:39:16 sz systemd[1]: Starting Clean php session files...
Jun 22 23:39:16 sz systemd[1]: phpsessionclean.service: Deactivated successfully.
Jun 22 23:39:16 sz systemd[1]: Finished Clean php session files.
Jun 22 23:39:54 sz kernel: [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PR>
Jun 22 23:40:54 sz kernel: [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PR>
Jun 22 23:41:54 sz kernel: [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PR>
Jun 22 23:42:54 sz kernel: [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PR>
Jun 22 23:43:54 sz kernel: [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PR>
Jun 22 23:44:55 sz kernel: [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PR>
Jun 22 23:45:01 sz CRON[6064]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Jun 22 23:45:01 sz CRON[6065]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 22 23:45:01 sz CRON[6064]: pam_unix(cron:session): session closed for user root
Jun 22 23:45:55 sz kernel: [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PR>
Jun 22 23:46:55 sz kernel: [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PR>
Jun 22 23:47:55 sz kernel: [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PR>
Jun 22 23:48:55 sz kernel: [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PR>
Jun 22 23:49:55 sz kernel: [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PR>
Jun 22 23:50:55 sz kernel: [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PR>
Jun 22 23:51:55 sz kernel: [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PR>
Jun 22 23:52:55 sz kernel: [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PR>
Jun 22 23:53:07 sz dbus-daemon[1054]: [session uid=1000 pid=1054] Activating via systemd: service name='org.gtk.vfs.Metadata' unit='gvfs-metadata.>
Jun 22 23:53:07 sz systemd[1032]: Starting Virtual filesystem metadata service...
Jun 22 23:53:07 sz dbus-daemon[1054]: [session uid=1000 pid=1054] Successfully activated service 'org.gtk.vfs.Metadata'
Jun 22 23:53:07 sz systemd[1032]: Started Virtual filesystem metadata service.
Jun 22 23:53:07 sz dbus-daemon[1054]: [session uid=1000 pid=1054] Activating service name='org.freedesktop.thumbnails.Thumbnailer1' requested by '>
Jun 22 23:53:07 sz org.freedesktop.thumbnails.Thumbnailer1[6957]: Registered thumbnailer atril-thumbnailer -s %s %u %o
Jun 22 23:53:07 sz org.freedesktop.thumbnails.Thumbnailer1[6957]: Registered thumbnailer /usr/bin/gdk-pixbuf-thumbnailer -s %s %u %o
Jun 22 23:53:07 sz org.freedesktop.thumbnails.Thumbnailer1[6957]: Registered thumbnailer /usr/bin/gdk-pixbuf-thumbnailer -s %s %u %o
Jun 22 23:53:07 sz dbus-daemon[1054]: [session uid=1000 pid=1054] Successfully activated service 'org.freedesktop.thumbnails.Thumbnailer1'
Jun 22 23:53:56 sz kernel: [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PR>
Jun 22 23:54:56 sz kernel: [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:e8:d0:b9:fc:e0:e0:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PR>
Jun 22 23:55:01 sz CRON[7274]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Jun 22 23:55:01 sz CRON[7275]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 22 23:55:01 sz CRON[7274]: pam_unix(cron:session): session closed for user root
-- Boot 4722e23160a94d92a7717e1d63c3f81c --
Jun 22 23:56:38 sz kernel: microcode: microcode updated early to revision 0xf0, date = 2021-11-16
Jun 22 23:56:38 sz kernel: Linux version 5.17.0-kali3-amd64 (devel@kali.org) (gcc-11 (Debian 11.3.0-3) 11.3.0, GNU ld (GNU Binutils for Debian) 2.>
Jun 22 23:56:38 sz kernel: Command line: BOOT_IMAGE=/boot/vmlinuz-5.17.0-kali3-amd64 root=UUID=c41cc0d2-7e41-4de3-a3e5-5c9096fdd4a6 ro quiet splash
Jun 22 23:56:38 sz kernel: x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'

The system restarted for the fourth time at 01:54.
I checked the logs after the system was completely booted
There are several errors in the log.
journalctl --since "2022-06-23 01:30" -p 3 -xb
Jun 23 01:55:36 sz kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_PR.PR00._CPC], AE_NOT_FOUND (20211217/psargs-330)
Jun 23 01:55:36 sz kernel: ACPI Error: Aborting method \_PR.PR01._CPC due to previous error (AE_NOT_FOUND) (20211217/psparse-529)
Jun 23 01:55:36 sz kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_PR.PR00._CPC], AE_NOT_FOUND (20211217/psargs-330)
Jun 23 01:55:36 sz kernel: ACPI Error: Aborting method \_PR.PR02._CPC due to previous error (AE_NOT_FOUND) (20211217/psparse-529)
Jun 23 01:55:36 sz kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_PR.PR00._CPC], AE_NOT_FOUND (20211217/psargs-330)
Jun 23 01:55:36 sz kernel: ACPI Error: Aborting method \_PR.PR03._CPC due to previous error (AE_NOT_FOUND) (20211217/psparse-529)
Jun 23 01:55:36 sz kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_PR.PR00._CPC], AE_NOT_FOUND (20211217/psargs-330)
Jun 23 01:55:36 sz kernel: ACPI Error: Aborting method \_PR.PR04._CPC due to previous error (AE_NOT_FOUND) (20211217/psparse-529)
Jun 23 01:55:36 sz kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_PR.PR00._CPC], AE_NOT_FOUND (20211217/psargs-330)
Jun 23 01:55:36 sz kernel: ACPI Error: Aborting method \_PR.PR05._CPC due to previous error (AE_NOT_FOUND) (20211217/psparse-529)
Jun 23 01:55:36 sz kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_PR.PR00._CPC], AE_NOT_FOUND (20211217/psargs-330)
Jun 23 01:55:36 sz kernel: ACPI Error: Aborting method \_PR.PR06._CPC due to previous error (AE_NOT_FOUND) (20211217/psparse-529)
Jun 23 01:55:36 sz kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_PR.PR00._CPC], AE_NOT_FOUND (20211217/psargs-330)
Jun 23 01:55:36 sz kernel: ACPI Error: Aborting method \_PR.PR07._CPC due to previous error (AE_NOT_FOUND) (20211217/psparse-529)
Jun 23 01:55:36 sz kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_PR.PR00._CPC], AE_NOT_FOUND (20211217/psargs-330)
Jun 23 01:55:36 sz kernel: ACPI Error: Aborting method \_PR.PR08._CPC due to previous error (AE_NOT_FOUND) (20211217/psparse-529)
Jun 23 01:55:36 sz kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_PR.PR00._CPC], AE_NOT_FOUND (20211217/psargs-330)
Jun 23 01:55:36 sz kernel: ACPI Error: Aborting method \_PR.PR09._CPC due to previous error (AE_NOT_FOUND) (20211217/psparse-529)
Jun 23 01:55:36 sz kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_PR.PR00._CPC], AE_NOT_FOUND (20211217/psargs-330)
Jun 23 01:55:36 sz kernel: ACPI Error: Aborting method \_PR.PR10._CPC due to previous error (AE_NOT_FOUND) (20211217/psparse-529)
Jun 23 01:55:36 sz kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_PR.PR00._CPC], AE_NOT_FOUND (20211217/psargs-330)
Jun 23 01:55:36 sz kernel: ACPI Error: Aborting method \_PR.PR11._CPC due to previous error (AE_NOT_FOUND) (20211217/psparse-529)
Jun 23 01:55:36 sz kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_PR.PR00._CPC], AE_NOT_FOUND (20211217/psargs-330)
Jun 23 01:55:36 sz kernel: ACPI Error: Aborting method \_PR.PR12._CPC due to previous error (AE_NOT_FOUND) (20211217/psparse-529)
Jun 23 01:55:36 sz kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_PR.PR00._CPC], AE_NOT_FOUND (20211217/psargs-330)
Jun 23 01:55:36 sz kernel: ACPI Error: Aborting method \_PR.PR13._CPC due to previous error (AE_NOT_FOUND) (20211217/psparse-529)
Jun 23 01:55:36 sz kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_PR.PR00._CPC], AE_NOT_FOUND (20211217/psargs-330)
Jun 23 01:55:36 sz kernel: ACPI Error: Aborting method \_PR.PR14._CPC due to previous error (AE_NOT_FOUND) (20211217/psparse-529)
Jun 23 01:55:36 sz kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_PR.PR00._CPC], AE_NOT_FOUND (20211217/psargs-330)
Jun 23 01:55:36 sz kernel: ACPI Error: Aborting method \_PR.PR15._CPC due to previous error (AE_NOT_FOUND) (20211217/psparse-529)

Jun 23 01:55:39 sz systemd-udevd[501]: could not read from '/sys/module/pcc_cpufreq/initstate': No such device

Jun 23 01:56:22 sz pulseaudio[950]: GetManagedObjects() failed: org.freedesktop.systemd1.NoSuchUnit: Unit dbus-org.bluez.service not found.

Jun 23 01:56:36 sz lightdm[1033]: gkr-pam: unable to locate daemon control file

Jun 23 01:56:36 sz pulseaudio[950]: Error opening PCM device front:0: No such file or directory

PC hardware : Intel Core i9-9900K , GIGABYTE 8GB 2666MHz , Asus PRIME H310M-K R2.0 Motherboard , TOSHIBA MK3265GSX
Previously, the operating system was on Western Digital 1TB Black , This problem already existed. Changing the hard drive did not solve the problem.

A: The fact that there are no log messages related to the imminent shutdown just before it happens suggests this could be a hardware-triggered reboot.
The cause might be an intermittent hardware fault, or something like a hardware/firmware emergency measure against overheating. Or if your power supply is old, it might be just barely capable of keeping up with the rapid changes of input current of a modern i9-9900K processor, and ther reboots might be caused by the PSU being unable to keep the voltages at the correct levels and removing the Power Good signal as a result. And whenever the Power Good signal is lost, the motherboard will trigger an immediate reset to avoid random faults and data corruption.
(Pairing a motherboard using a non-overclockable home/economy H310 chipset with an overclock-ready i9-9900K processor seems kind of a mismatched choice to me, but I guess if the system was built during the COVID chip shortage, you may have picked whatever was available?)
My suggestions:

*

*Evaluate your power supply: if it's older than the rest of the system, it might be at the end of its useful life, or unable to react to the rapidly changing power requirements of modern processors. If either seems likely, buy a new power supply. Otherwise, see if you can borrow a known good power supply and see if the problem repeats with that.

*If replacing the power supply won't remove the problem, it might be a problem with the motherboard.
If the shutdowns don't happen under Windows, then it might be a firmware problem for which Windows "knows" a workaround but Linux doesn't.
Is your system firmware ("BIOS" according to ASUS) up to date?
In Linux, run sudo dmidecode -s bios-version; in Windows, start a Command Prompt as an administrator and run wmic bios get smbiosbiosversion.
The most recent version is 2208, but version 1605 and several older versions before that are described only as "improve system stability", which just might be relevant to the issue.


text:
Q: How to pass an object having a list type property in a ajax call I know This type of question is asked before but i don't understand how to solve the problem with the answers that is already provided. don't even understand where to write those ModelBinder code. so i will just describe my problem.
I have a view which is strongly typed to a model that has a list property(association relationship).
public class Sales
{
    public int SalesSl { get; set; }
    public double TotSalAmt { get; set; }
    public double TotCashRec { get; set; }
    public double TotVat { get; set; }
    public double TotDiscnt { get; set; }
    public int CustomerSupplyId { get; set; }
    public int ProductId { get; set; }
    public double SalesRt { get; set; }
    public double SalesQty { get; set; }
    public double PurchaseRt { get; set; }
    public double ProductDisAmt { get; set; }
    public double ProductVat { get; set; }
    public double LaborCost { get; set; }
    public string SalesNote { get; set; }
    public int SalesIndex { get; set; }
    public List<AddedProductView> AddedProductViews { get; set; }

    public Sales()
    {
        AddedProductViews = new List<AddedProductView>();
    }
}
  [Serializable]
public class AddedProductView
{
    public int ProductId { get; set; }
    public string ProductName { get; set; }
    public double Quantity { get; set; }
    public double Unit { get; set; }
    public string UnitDescription { get; set; }
    public double Rate { get; set; }
    public double Vat { get; set; }
    public double Discount { get; set; }
    public double NetAmount { get; set; }
    public double Total { get; set; }
    public int SalesIndex { get; set; }
}

Now, i have no problem when i pass the sales model to the view. it shows all of the product that is already contained in the AddedProductViews.
The view:
<form id="SalesModForm">

                Purchase Product

                @Html.HiddenFor(model => model.IndexSl)

                        @Html.TextBoxFor(model => model.SalesSl, null, new { style = "width:120px" })

                        @Html.LabelFor(model => model.CustSupplyId)

                        @Html.TextBoxFor(model => model.CustSupplyId, null, new { style = "width:120px" })

                        @Html.LabelFor(model => model.ProductId)

                        @Html.TextBoxFor(model => model.ProductId, null, new { style = "width:120px" })

                        @Html.Label("Qty")
                        @Html.TextBoxFor(model => model.SalesQty, null, new { style = "width:60px" })

                        @Html.Label("Rate")
                        @Html.TextBoxFor(model => model.SalesRt, null, new { style = "width:60px" })

                        <input type="button" value="Add" id="btnAddToCartMod" style="width:100px" />

                        Product Name
                        Quantity
                        Unit
                        Rate
                        Total
                        Vat
                        Discount
                        Net Amount
                        Action

                    @foreach (AddedProductView sIAM in Model.AddedProductViews)
                    {

                                @sIAM.ProductName

                                @sIAM.Quantity

                                @sIAM.Unit

                                @sIAM.Rate

                                @sIAM.Total

                                @sIAM.Vat

                                @sIAM.Discount

                                @sIAM.NetAmount

                                @Html.ActionLink("Remove", "UpdateProductInfo", new { salesSl = @Model.SalesSl, productId = @sIAM.ProductId, salesDt = @Model.SalesDt })

                    }

  <input type="submit" value="Sale" class="btn btn-success" id="btnSalesMod" />

When I click on the Remove AcionLink the model data(sales.AddedProductViews) is changed. Now When I click on btnSalesMod i expect the modified Sales data will be saved with help of the following script.

But while i  debug all of the sales data is received to the controller's ActionResult parameter except the count of sales.AddedProductViews count is 0, means the parameter is not receiving any value for AddedProductViews property.
In controller:
[HttpPost]
    public ActionResult Index(Sales sales)
    {
        //no data in sales.AddedProductViews
        //sales.AddedProductViews count = 0;
        return View();
    }

So, now my question is how can I get the data that is in AddedProductViews has in the view.
Or is there any other way to pass the AddedProductViews data to the controller??
Any help is appreciated.

A: You need to take a look at how model binding works in MVC. When you use any HTML Helper, the name of that control is set to used model property. For example
@Html.TextBoxFor(model => model.SalesSl, null, new { style = "width:120px" })

will render an input element with type="text" and name="SalesSl" and when you will post the form back to server, the value of the control with name="SalesSl" will get bound to your Model's property named SalesSl.
But when you use something like the following:
@sIAM.ProductName

there is no control created with the name set to Model Property name.
You need to use for loop instead of foreach loop, and in the loop you need to do something like this for each of your AddedProductView properties that you want to submit back to server:

    @Html.Hidden("AddedProductViews[@index].ProductName", @Model.AddedProductViews[index].ProductName);
    @Model.AddedProductViews[index].ProductName

These links should be helpful:

*

*Manually binding complex model array to controller action

*Model Binding To A List

*MVC .NET Model Binding to Array on the fly

redpajama_set_name: RedPajamaStackExchange


text:
Q: highlight row after edit in datatables I new to Jquery and Javascript.
I am using datatables to show some data
I am trying to highlight specific rows, ie : rows that have been edited after inline edit. I am using the inline edit (from https://github.com/ejbeaty/CellEdit). The code that I have modified in " Advanced.js" is as follows :
    function myCallbackFunction (updatedCell, updatedRow, oldValue) {

   if (updatedCell.data() == "Bradley")
        {
            console.log("highlight required for Name Bradley")
            $(updatedRow).css( "background-color", "Orange" )

        }

    console.log("The new value for the cell is: " + updatedCell.data());
    console.log("The old value for that cell was: " + oldValue);
    console.log("The values for each cell in that row are: " + updatedRow.data());
}

In the callback function I am trying to change the background color for a specific name. I can see the console.log but the color changes seem to have not taken up.

A: Did not knew this CellEdit plugin before, but it looks to be really nice, decent and straight forward. Instead of copying an example it is sometimes better to produce a small minimal example from scratch. Look at this
var table = $('#example').DataTable({
}).MakeCellsEditable({
  onUpdate: function(cell, row, oldValue) {
    if (cell.data() != oldValue) {
      row.nodes().to$().addClass('highlight')
    }
  }
})

I forgot .nodes() in the comment, sorry for that - but the above works -> http://jsfiddle.net/Lccju5bq/

A: try this `
  if (updatedCell.data() == "Bradley")
    {
        console.log("highlight required for Name Bradley")
        var updatedRow = document.getElementbyId("updatedRow);
        updatedRow.style.background = 'black';

    }


text:
Q: Constraint based on a FK relationship Structure of two tables with fields that are of importance:
TableA: Id (PK), Type
TableB: Id (PK), TableAId (FK), ReferenceId (Self-reference key)

I need to have a constraint which will say:
TableB ReferenceId column CAN and MUST contain a value ONLY IF TableAId value points to a record whose Type value > 1.
How can I do this?

A: One method that doesn't require triggers had data redundancy.
Put the type column in TableB, along with a constraint there.  And add an additional unique key to TableA for the foreign key:
create table tableA (
    id int primary key,
    type int,
    constraint unq_type_id unique (type, id)
);

create table tableB (
    id int primary key,
    type int,
    tableAID int,
    constraint fk_tableB_type_tableAID foreign key (type, tableAID) references tableA(type, id),
    constraint chk_type check (type > 1)
);

This is a hack, but it does accomplish what you want without triggers.
A variation on this method doesn't require repeating type in both tables, but it does require additional columns:
create table tableA (
    id int primary key,
    type int,
    typeIsValid as (case when type > 1 then 1 else 0 end) persisted,
    constraint unq_type_id unique (typeIsValid, id)
);

create table tableB (
    id int primary key,
    tableAID int,
    typeIsValid as (1),
    constraint fk_tableB_typeIsValid_tableAID foreign key (typeIsValid, tableAID) references tableA(type, id) persisted
);

This even works in SQL Fiddle.


text:
Q: How can I craft a csv from multi level json in powershell? I am trying to parse a JSON response that looks like
{
"Objects":  [
                     {
                         "Name":  "FirstName",
                         "Type":  "XXXX",
                     },
                     {
                         "Name":  "SecondName",
                         "Type":  "YYYY",
                     },
                     {
                     "Name":  "ThirdName",
                         "Type":  "ZZZZ",
                     },
            ],
 "TotalCount":  127
 }

I want a CSV formatted like
"Name","Type"
"FirstName","XXXX"
"SecondName","YYYY"

and so on.
I tried creating a PSCustomObject and using Select-Object with it to generate the CSV but it does not give me the desired output.
My code:
$report=$null
foreach($obj in $json){
$item=$obj | ConvertFrom-Json
$report=[pscustomobject]@{
Name=($item.Objects.Name | Out-String).Trim()
Type=($item.Objects.Type | Out-String).Trim()
}
$report | Select-Object Name,Type | Export-Csv "PATH"`

Gives me CSV that looks like:
"Name","Type"
"FirstName
 SecondName
 ThirdName",
"XXXX
 YYYY
 ZZZZ"

A: if you really want the total count in the csv as well, here is one thing you could do:
$psobjarray = ($json | convertfrom-json)
$psobjarray.objects | Select-Object Name,Type | Export-Csv $Path
"Total Count: $($psobjarray.totalcount)" | out-file $Path -append


text:
Q: Why do these two seemingly equivalent scripts take significantly different times to run? I was doing some experiments in the interpreter and at some point I had to load a huge line-separated file and concat its line together. I first tried this:
strand = ['', '']
for i in range(1, 3):
    for line in open('chr2_strand_' +str(i) + '.fa').readlines()[1:]:
        strand[i] += line.strip()

Which was still running when I killed it after a few minutes. Next I tried this:
strand = ['', '']
for i in range(1, 3):
    s = ''
    for line in open('chr2_strand_' +str(i) + '.fa').readlines()[1:]:
        s += line.strip()
    strand[i - 1] = s

Which took less than a minute to run.
There are two files being read in the script and both are nearly 300MB each with each line having a 100 characters.
The difference is in directly updating the strand array rather than assigning the final concatenated result to it. I don't understand why this should affect the runtime as the array's size remains constant (two references to strings) which means it doesn't need to be relocated.
Python version is Python 2.7.12 (default, Dec  4 2017, 14:50:18).
Any ideas?


text:
Q: Вопросы по тестированию Symfony 3.4 Есть старый проект, нужно покрыть его тестами. База и сущности рассинхронны. Миграция сделана из дампа базы с помощью доктрины. Возникли сложности с интеграционными тестами, а именно с рефрешем тестовой базой и миграциями.
1) Как рефрешить тестовую БД?. Хотелось бы рефрешить базу перед каждым тестом. Как сделать это адекватно? Нашел такое решение, оно рабочее, но выглядит "так себе": https://stackoverflow.com/questions/14752930/best-way-to-create-a-test-database-and-load-fixtures-on-symfony-2-webtestcase
После Ларавел, где для рефреша достаточно трейт прописать, выглядит немного адово. Неужели нет ничего из коробки для такой тривиальной задачи?
2) Как подключить в тесты sqlite? С помощью ссылки из п.1 смог дропать и заного создавать базу, потом миграции, но на mysql это выходит дико долго. Чисто выполнение миграции схемы базы - секунд 5. И так на каждый тест.  Думал перевести тесты на sqlite in memory. Но возникла проблема, прямо в миграциях присутствует такой код:
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

Что не дает выполнить миграции на sqlite. Естественно, я попробовал его убрать - но тогда ошибки синтаксиса.
Ради интесера сделал миграцию через doctrine:migrations:diff  - но и там присутстсвует такой код. Погуглил, и вроде как DBAL что-то там не коннектит с sqlite. И тут у меня когнитивный диссонанс - в доке по тестам симфони прописан sqlite, а DBAL не может с ней что-то и как-то работать.
Собственно вопрос: как вывести тесты и миграции на sqlite?

A: Обратите внимание вот сюда
Насколько я помню суть там в  том, что есть хуки, которые дергаются в момент изменений БД, а суть хуков в том что все  изменения заворачиваются в транзацкии и после выполнения выполняется RollBack
А вот собственно сам бандл.
Выглядит это по крайней мере достаточно неплохо на первый взгляд. Я не пользовал сам но кто то  говорил мне что они применяют это на практике достаточно успешно.


text:
Q: Fetching data from a JSON file on my PC and using it in React I have an input field in my React app where I can select/drag'n'drop files from my PC. The file data looks like this:
{
  path: "/test/metadata.json",
  lastModified: 1657787087977,
  name: "metadata.json",
  size: 10,
  type: "application/json",
  webkitRelativePath: ""
}

Having selected a file, I'm trying to perform a fetch request if the file is of type JSON in order to extract the contents.
acceptedFiles.forEach(file => {
      if (file.path.includes('.json')) {
        fetch(file.path)
          .then(res => res.json())
          .then(data => console.log(data));
      }
    });

The output of the fetch request above is this:
Uncaught (in promise) SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON

And the request URL looks like it's trying to fetch the file from localhost:3000 and fails.
http://localhost:3000/test/metadata.json

My question: Is it possible to select some JSON file for upload and performs a fetch request on it in order to get its' contents? Can this be done in a React app or will I need Node.js for this?

A: Seems like the JSON data is not valid. JSON data should be like this:
    {
      "path": "/test/metadata.json",
      "lastModified": 1657787087977,
      "name": "metadata.json",
      "size": 10,
      "type": "application/json",
      "webkitRelativePath": ""
    }


text:
Q: How can I read breaks in downloaded text? I'm using the Last.fm Java library that's listed in the "Downloads" section on the API. When I call "getWikiText()" and set it to my TextView, all the data is returned; however, the html isn't formatted correctly. Rather than showing separate paragraphs, the data is shown as one large text. To illustrate what I mean, here is a picture of what is being returned and then a link to the artist page of how things should look.
Picture - http://i.imgur.com/ameTO.jpg
How things should look - http://www.last.fm/music/Bon+Iver
This is what I'm calling to get the artist info, but what am I missing as to the paragraph spacing? I've search around quite a bit, but there's not much information on this in particular. I'm basically shooting in the dark at this point, so I need a little help.
artistInfo = Artist.getInfo("Bon Iver",key);
artistText = artistInfo.getWikiText();
info.setText("");
info.append(Html.fromHtml((artistText)));

A: Do a simple replaceAll() call is enough:
String artistText = artistInfo.getWikiText();
artistText = artistText.replaceAll("\n", "<br />");
info.setText(Html.fromHtml(artistText));


text:
Q: how to quickly download multiple github projects from single author There are github authors with great many little or big projects. How could i download them quickly without clicking every project in my browser, like bulk download?

A: Use the shell. The command for checking out a repository is git clone <repourl>. You can write a loop which runs git clone multiple times, once for each element in a list. If the list contains the names of the repositories, then the loop is very simple:
for repo in foo bar baz; do git clone git@github.com:username/${repo}.git; done

The result will be a clone of each of the named repositories.
Note: I've assumed that you're using the bash shell. Virtually all operating systems use bash by default, but Windows does not. This is why when you install Git on windows you're also installing a bash shell; it's called "Git Bash" in the start menu.

A: I found this useful: http://www.aheritier.net/clone-all-repositories-from-a-github-organization/
Summarising:
Type either of the following into terminal on OSX
Using ssh:
curl -s https://api.github.com/orgs/googlesamples/repos | ruby -rjson -e 'JSON.load(STDIN.read).each {|repo| %x[git clone #{repo["ssh_url"]} ]}'

using clone url (if you don't have your ssh keys setup or if you have ssh issues) :
curl -s https://api.github.com/orgs/googlesamples/repos | ruby -rjson -e 'JSON.load(STDIN.read).each {|repo| %x[git clone #{repo["clone_url"]} ]}'

In the above example, I download all the repositories from the "googlesamples" page (https://github.com/googlesamples).
So you should replace the url with the author's url whose repos you are trying to get.
EDIT:
For more than 30 repositories you must specify the page and number of repos per page:
https://api.github.com/orgs/googlesamples/repos?page=1&per_page=100

EDIT: So to download the first page of 100 repos:
curl -s 'https://api.github.com/orgs/googlesamples/repos?page=1&per_page=100' | ruby -rjson -e 'JSON.load(STDIN.read).each {|repo| %x[git clone #{repo["clone_url"]} ]}'

While the link I specified above was useful, just visiting the github api pages is worth it..


text:
Q: Difference between initializing array length and assign to index vs repeatedly pushing While working on building a list of sheet names, I came across this question:
List names of sheets in Google Sheets and skip the first two
Saving you the click, this person's solution is: (Stripped down, pseudo code)
getSheets() // Get all the sheets in spreadsheet workbook
  var out = new Array( sheets.length+1 ) ;

  for (var i = 1 ; i < sheets.length+1 ; i++ )
    out[i] = [sheets[i-1].getName()];
  return out

My solution would have leveraged:
...
var sheetName = sheet[i].getName();
out.push(sheetName);

The first solution seems to dynamically create empty array values, then later declare their value. While I have always just pushed new values into the array.
What is the difference?
In which situations is one better than the other?
In which situations should either be avoided?

A: Your code and the original code do quite different things.
Assuming sheets has objects in it that return the names "sheet1", "sheet2", and "sheet3" from getName, the original code creates an array that looks like this:
[
    (missing),
    ["sheet1"],
    ["sheet2"],
    ["sheet3"]
]

Note two things:

*

*There is no entry at index 0. (It literally doesn't exist at all, which is subtly different from existing and containing the value undefined.)

*The other entries are single-element arrays, each containing its sheet name.

Your code creates this instead:
[
    "sheet1",
    "sheet2",
    "sheet3"
]

Presumably the author had a reason for skipping index 0 and creating subordinate arrays (I'd guess because they were passing that result array into some API function that expects something in that form).
So there's no really a "better" or "worse" here, just different.
If your fundamental question is whether this:
var original = ["one", "two", "three"];
var updated = [];
for (var i = 0; i < original.length; ++i) {
    updated[i] = original[i].toUpperCase(); // Or whatever
}

is better/worse than this:
var original = ["one", "two", "three"];
var updated = [];
for (var i = 0; i < original.length; ++i) {
    updated.push(original[i].toUpperCase()); // Or whatever
}

the answer is: It's really a matter of style. Performance isn't markedly different between the two (and rarely matters), and amusingly one way is faster on some JavaScript engines and the other way is faster on others.
Both of those can probably be better expressed using map:
var original = ["one", "two", "three"];
var updated = original.map(function(entry) { return entry.toUpperCase(); });

I think Google Sheets has map, even though it mostly has only ES3-level features otherwise.

Side note: new Array is almost never the right way to create an array.


text:
Q: Error when signing an apk with PKCS12 key When I tried to "Generate a signed bundle / APK" with Android Studio 4.0.1, I got the warning 'It is recommended to migrate to PKCS12 which is an industry standard format using "keytool -importkeystore -srckeystore -destkeystore -deststoretype pkcs12".
After converting my keystore to PKCS12 type, I got the following error :
"Given final block not properly padded. Such issues can arise if a bad key is used during decryption."
I tried first to convert my JKS keystore, then to create a PKCS12 keystore from scratch. Both methods lead to the same error.
As described in this post, it seems we can currently go with both PKCS12 or JKS keystore types.
Actually, I'm publishing new app with JKS keystore type, but how long Google will permit it ? The warning message makes me doubt...
Does anyone find a solution to it ?
Thanks


text:
Q: Trying to understand binary number equation I'm reading a book called "The Elements of Computing Systems" by Noam Nisan/Shimon Schoken.
There's an excerpt which includes some math that I'm struggling to understand (limited math background; I was hoping someone might be able to "hold my hand" through it.
My main questions:
What exactly does this mean?  $
(\mathit{x_{n},x_{n-1}}...x_{0})_{b}= \sum_{\mathit{i=0}}^{n}x_i\cdot b^{i}
$
It says (full excerpt for context):

"Unlike the decimal system, which is founded on base 10, the binary system is founded on base 2.  When we are given a certain binary pattern, say "10011," and we are told that this pattern is supposed to represent an integer number, the equivalent decimal value of this number is computed by convention as follows:
$$
(10011)\mathit{_2}=1\cdot2^4+0\cdot2^3+0\cdot2^2+1\cdot2^1+1\cdot2^0=19
$$
  In general, let $\mathit{x=x_{n}x_{n-1}}...\mathit{x_{0}}$ be a string of digits.  The value of x in base b, denoted $(\mathit{x})_{b}$, is defined as follows:
  $$
(\mathit{x_{n},x_{n-1}}...x_{0})_{b}= \sum_{\mathit{i=0}}^{n}x_i\cdot b^{i}
$$
The reader can verify that in the case of (10011)$_{two}$, rule (2) reduces to calculation (1).
The result of calculation (1) happens to be 19.  Thus, when we press the keyboard keys labeled '1', '9' and 'ENTER' while running, say, a spreadsheet program, what ends up in some register in the computer's memory is the binary code 10011.  More precisely, if the computer happens to be a 32-bit machine, what gets stored in the register is the bit pattern (00000000000000000000000000010011).

A: Base Conversion
$$ (x_n\dots x_1 x_0)_b=\sum_{i=0}^n x_i\cdot b^i $$
This is how we can convert a number from base $b$ to base $10$. Each $x$ represents a digit at position $i$ in base $b$.
So for binary numbers, we have $b=2$ because there are only $2$ unique digits in the binary numeral system. So we have
$$ (x_n\dots x_1 x_0)_2=\sum_{i=0}^n x_i\cdot 2^i $$
Summation
The symbol $\sum$, denotes a summation. If we want to add the integers $1$ through $5$, we would write
$$ \sum_{k=1}^5 k=1+2+3+4+5=15 $$
Binary to Decimal Conversion
Let's try to convert $(1011)_2$ to its base $10$ equivalent
$$ x_3=1,\quad x_2=0,\quad x_1=1,\quad x_0=1 $$
And
$$ \sum_{i=0}^3 x_i\cdot 2^i =1\cdot 2^3+ 0\cdot 2^2+ 1\cdot 2^1+ 1\cdot 2^0 $$
$$ = 2^3+ 2^1+ 2^0 =8+2+1=11 $$

A: The following is an example:-
$(9,7,4,5)_{10}$
$= 9×〖10〗^3+7×〖10〗^2+ 4×〖10〗^1+ 5×10^0$
$= 9×1000+7×100+4×10+5$
$=9745$


text:
Q: How to add class designating seen/unseen items on page? I want to display an icon that indicates whether or not a visitor to a homepage with a feed of articles has already seen an item or not. So, for example, if you went to the homepage for the first time, all articles in the feed would have an icon that said "NEW". Then, if you navigated away from the homepage and came back, only the new articles since your last visit would have the icon, and all others would have disappeared.
I'm using Rails 4, but it seems like this should be pretty easy to do on the client side with Jquery/javascript using cookies or localStorage.
What's a good solution for this?
For reference, I have a page that displays a feed of articles, each with a unique id as shown below. I'd like to have a class such as new-item that would be removed from all seen elements when the page unloads and persist (until the user clears the local storage or the cookie expires). So, in the example below, the first two items would have a "new" tag, whereas the second two were previously seen, and the tag has been hidden.

starNEW

    ...

starNEW

    ...

starNEW

    ...

starNEW

    ...


text:
Q: Request Dispatcher deletes all word from form but first this is my JSP:

  ${reply}

<form action="runCommand" method="post" name="myform">
  File:<input name="commandfile" type="text" size="10" value=${commandfile}> </input>

  Command:<input name="commandinput" type="text" size="10" value=${commandinput}> </input>

  No delete File: <input type="checkbox" name="no_del_file" value=${no_del_file} >

  <input name="submit" type="submit" value="Submit" />
  <input name="Reset" type="reset" value="Reset" />
</form>

And this is my java servlet code:
 public class RunCommand extends HttpServlet {

/**
 *
 */
private static final long serialVersionUID = 5711290708294275382L;
String commands = null;
File dir = null;
BufferedReader is = null;
BufferedReader es = null;
boolean retval = false;
int testwin = 0;
int fileok = 0;
String completefilename = null;
File filecheck = null;
private BufferedReader outfile;

protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws IOException, ServletException {
    request.setAttribute("commandfile", "commandfile");
    request.setAttribute("commandinput", "commandinput");
    request.setAttribute("no_del_file", "no_del_file");
    HttpSession session = request.getSession();
    ServletContext application = getServletContext();
    performTask(request, response);
}

protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws IOException, ServletException {

    performTask(request, response);
}

    private int getWin() {
    Process Checkprocess;
    try {
        String Checkcommand = "cmd /c tasklist /V /FI \"WINDOWTITLE eq Administrator:*\"";
        Checkprocess = Runtime.getRuntime().exec(Checkcommand);
        String Checkline;
        String Checkval = "Administrator:";

        is = new BufferedReader(new InputStreamReader(Checkprocess.getInputStream()));
        while ((Checkline = is.readLine()) != null) {
            retval = Checkline.contains(Checkval);
            if (retval = true) {
                testwin = 1;
                break;
            } else
                testwin = 0;
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
    return testwin;
    }

    private int getFile() {

    filecheck = new File(completefilename);

    while (fileok == 0) {
        if (filecheck.exists()) {
            fileok = 1;
            break;
        }

    }
    return fileok;

     }

    private void performTask(HttpServletRequest request, HttpServletResponse response)
        throws IOException, ServletException {
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    try {
        String commandbuild = request.getParameter("commandinput");
        String commandfilename = request.getParameter("commandfile");
        String[] no_del_file = request.getParameterValues("no_del_file");

        final SimpleDateFormat datefor = new SimpleDateFormat("ddMMyyyy_HHmmss");
        Timestamp timestamp = new Timestamp(System.currentTimeMillis());
        String timeadd = datefor.format(timestamp);

        completefilename = "C:\\tmp\\" + commandfilename + "_" + timeadd + ".txt ";

        String commandfull = "db2 -tvz " + completefilename + commandbuild;

        commands = "cmd /c db2cwadmin.bat " + commandfull;

        Process process;
            process = Runtime.getRuntime().exec(commands);
        String line;
        StringBuilder data = new StringBuilder();

        is = new BufferedReader(new InputStreamReader(process.getInputStream()));
        data.append("Befehl: " + commands);
        data.append("\n\n\n");

        while ((line = is.readLine()) != null) {

            data.append(line);
            data.append("\n");

        }
        es = new BufferedReader(new InputStreamReader(process.getErrorStream()));
        while ((line = es.readLine()) != null)
            System.err.println(line);

        int exitCode = -100;
        exitCode = process.waitFor();
        if (exitCode == 0) {
            System.out.println("It worked");

            while (testwin != 1) {
                getWin();
                if (testwin == 1) {
                    break;
                }
            }

            while (fileok != 1) {
                getFile();
                if (fileok == 1) {
                    break;
                }
            }

            Process EndProcess;
            String Endcommands = "taskkill /F /FI \"WINDOWTITLE eq Administrator:*\"";
            EndProcess = Runtime.getRuntime().exec(Endcommands);
            int exitCodeEnd = -100;
            exitCodeEnd = EndProcess.waitFor();

            while (exitCodeEnd != 0) {
                EndProcess = Runtime.getRuntime().exec(Endcommands);
                exitCodeEnd = EndProcess.waitFor();
                if (exitCodeEnd == 0) {
                    break;
                }
            }

            // TimeUnit.SECONDS.sleep(10);

            data.append("Fenster wurde geschlossen!");
            data.append("\n");
            data.append("\n");

            File filecheck = new File(completefilename);
            if (filecheck.exists())
                outfile = new BufferedReader(new FileReader(completefilename));
            String outfilelines;

            while ((outfilelines = outfile.readLine()) != null) {
                data.append(outfilelines);
                data.append("\n");

            }

            request.setAttribute("data", data);
            out.append(data);

            outfile.close();

            if (no_del_file == null) {
            filecheck.delete();
            }

            request.setAttribute("commandfile", commandfilename);
            System.out.println(commandbuild);
            request.setAttribute("commandinput", commandbuild);
            request.setAttribute("no_del_file", no_del_file);
            HttpSession session = request.getSession();
            ServletContext application = getServletContext();
            RequestDispatcher dispatcher = request.getRequestDispatcher("/runCommand.jsp");
            dispatcher.forward(request, response);

        } else
            System.out.println("Something bad happend. Exit code: " + exitCode);

    } // try
    catch (Exception e) {
        System.out.println("Something when wrong: " + e.getMessage());
        e.printStackTrace();

    } // catch

    finally {

        if (is != null)
            try {
                is.close();
            } catch (IOException e) {
            }
        if (es != null)
            try {
                es.close();
            } catch (IOException e) {
            }

    } // finally

    retval = false;
    testwin = 0;
    fileok = 0;
    completefilename = null;

}

}
The problem is that only the first word is set. So if the command (I fill out the Command input with this) is:
 list applications

I only get
 list

back to command field and the checkbox is not set either when it was set before submiting.
So in the command input field the forward cuts away all words after the first blank and the checkbox is not set again (the check is not preserved). I need the form to be filled out the way it was before submit.
Any idea?
Thanks

A: Okay, from what i understand... when you enter the text "list applications" in your form field it gets submitted to your servlet, but it only returns "list".
Looking at your servlet code, the problem isn't in your backend. So it has to do with something in the frontend which is altering the input.
Let's check this by looking to see what your form is actually sending to your servlet. You can do this by viewing the network tab in chrome developer tools / or firefox developer tools.
The process for chrome developer tools is this:
Right click on your page and click Inspect.

*

*Go to the Network tab.

*Check the box that says "Preserve log". (at the top)

*Now submit your form while keeping this window open.

*Look for your servlet url in those requests ("RunCommand"), when you click on it another window will open, here you will see Headers, Preview, Response, Cookies, Timing.

*Make sure you are viewing the Headers tab, then scroll all the way down to "Form Data". Here you will be able to see what your form is submitting to your servlet, it's a very useful debugging tool. Please let me know what you see there.

Also another thing worth trying is removing size="10" from your input field. This limits the text field width and could have something to do with your problem.


text:
Q: AVCaptureVideoDataOutputSampleBufferDelegate.CaptureOutput not called in Swift Can anyone please advise why this solution works? I have same question using Swift, when I define my 'Scanner' in a standalone swift file, the AVCaptureVideoDataOutputSampleBufferDelegate.CaptureOutput not called but, when I move the Scanner in the same file when I call session.addOutput(videoOutput) and videoOutput.setSampleBufferDelegate it works.
I am binginer to Swift/iOS dev, this issue drives me crazy, finally this solution works. thank you for sharing this!
just clarify and add my code:

*

*I have a CamService.swift which I have a method to setup the AVCaptureSession:
session.beginConfiguration()
// ...
//add AVCaptureVideoDataOutput
if session.canAddOutput(videoOutput) {
session.addOutput(videoOutput)
videoOutput.alwaysDiscardsLateVideoFrames = true
videoOutput.setSampleBufferDelegate(self, queue:DispatchQueue.global(qos: .userInteractive) )
videoOutput.connections.first?.videoOrientation = .landscapeLeft
} else {
//fatalError("could not add video output")
print("Couldn't add video output to the session.")
session.commitConfiguration()
return
}
// ...
session.commitConfiguration()

*when I extension CamService as below, it works, the  captureOutput can be called
extension CamService: AVCaptureVideoDataOutputSampleBufferDelegate {
public func captureOutput(_ output: AVCaptureOutput,
didOutput sampleBuffer: CMSampleBuffer, from connection:
AVCaptureConnection) {
print("sampleBuffer")
}
}
But, if I create a new swift file say,
MyDalegate: AVCaptureVideoDataOutputSampleBufferDelegate,

and config
videoOutput.setSampleBufferDelegate(MyDalegate(),
queue:DispatchQueue.global(qos: .userInteractive) )

this won't work captureOutput never get called.


text:
Q: how to check some links that have downloadable file or not (about 1mil links) i had e big challenge...
how can i check link is have a downloadable file or not
example :
http://d88b.ir/upload/jozve-files/1498505490.zip is downloadable
and
http://d88b.ir/upload/jozve-files/1498505489.zip is empty
i must check links from 1498505490 to 1498000000
just i know android studio and webview ...

A: Use the HTTP HEAD command. It will show you the Content-Length header which will tell you the size, Content-type which will show you the file type, and the HTTP status code (40x for errors such as not found, 20x for success).
https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.4

The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information sent in response to a GET request. This method can be used for obtaining metainformation about the entity implied by the request without transferring the entity-body itself. This method is often used for testing hypertext links for validity, accessibility, and recent modification.


text:
Q: Azure Function Url doesn't include authentication code when using azurerm_runction_app_function in Terraform When you setup a Function in Azure, it lets you get the default function Url with the function key. It looks sort of like:
https://my-function-app.azurewebsites.net/api/my-function-name?code=[authentication-code]
This lets me call that function from an API endpoint without using any other authentication. I am trying to get access to that key via the azurerm provider somehow.   UPDATE:  I am using version 1.1.7 of Terraform and v3.0.2 of azurerm provider.
I can get the main Url (not including the authentication code) using azurerm_function_app_function.my-function.url. I can get the host key using data.azurerm_function_app_host_keys.default_function_key.
data "azurerm_function_app_host_keys" "function-host-keys" {
  name                = azurerm_windows_function_app.function-app.name
  resource_group_name = azurerm_resource_group.resource-group.name
}

resource "azurerm_function_app_function" "my-function" {
  name            = my-function
  function_app_id = azurerm_windows_function_app.function-app.id
  language        = "CSharp"

  file {
    name    = "MyFunc.cs"
    content = file("../../MyFunc.cs")
  }

  config_json = jsonencode({
    "bindings" = [
      {
        "authLevel" = "function"
        "direction" = "in"
        "methods" = [
          "get",
          "post",
        ]
        "name" = "req"
        "type" = "httpTrigger"
      },
      {
        "direction" = "out"
        "name"      = "$return"
        "type"      = "http"
      }
    ]
  })
}

locals {
  # This gets the host key but I need the function key
  host-key = data.azurerm_function_app_host_keys.function-host-keys.default_function_key

  # This gets the url, but without the "?code=######"
  url = azurerm_function_app_function.my-function.url

  # How do I get the function key for the ?code=#### part of the Url?
  code = data.azurerm_some_function_resource.function_key
}

But I can't seem to find anything that gives me the default function key for my specific function, as is available in the Azure portal. Please help.

A: Could you use a data source with a depends_on for the newly created FunctionApp?
data "azurerm_function_app_host_keys" "item" {
  name                = azurerm_function_app.item.name
  resource_group_name = azurerm_function_app.item.resource_group_name

  depends_on = [
    azurerm_function_app.item
  ]
}

https://github.com/hashicorp/terraform-provider-azurerm/issues/8515#issuecomment-694515657


text:
Q: Trigonometric system and orthogonality
I'm having trouble understanding the 2nd line. So, just looking at the 3rd line (4.9), I can see that this is true, ie, each term in the series will $= 1$ if $j=k$ by orthogonality of the trig system, and summing that N times gives N if $j = k$, but all terms 0 if $j \neq k$
But then, using the partial sum equation in line 2, if $j = k$, the partial sum is $\frac{0}{0}$?

A: In the given proof, there were two minor omissions, which may have been the source of your doubts about the proof.

First omission . . .

The line in the proof which started with
$$
\text{For}\;\,0\le j\le N-1\;\text{. . .}
\qquad\qquad\qquad\;
$$
should have been
$$
\text{For}\;\,0\le j,k\le N-1\;\text{. . .}
\qquad\qquad\;\;\;\;\;
$$

Second omission . . .

Let $N$ be a positive integer, and let $r\in\mathbb{C}$.

The stated formula should have been
$$
\sum_{n=0}^{N-1}r^n
=
\begin{cases}
{\Large{\frac{1-r^N}{1-r}}}&&\text{if}\;r\ne 1\\[4pt]
N&&\text{if}\;r=1\\
\end{cases}
\qquad\;\;\;
$$
With those corrections, let
$$
r=e^{2i\pi(j-k)/N}
\qquad\qquad\qquad\qquad\qquad
$$
Then for the case $j=k$, we have $r=1$, so the identity
$$
\sum_{n=0}^{N-1}\left[e^{2i\pi(j-k)/N}\right]^n=N
\qquad\qquad\qquad\;\;\;
$$
is immediate.

For the case $j\ne k$, since $0\le j,k\le N-1$, it follows that $2\pi(j-k)/N$
is not an integer multiple of $2\pi$.

Hence $r\ne 1$, so
\begin{align*}
&\sum_{n=0}^{N-1}\left[e^{2i\pi(j-k)/N}\right]^n\\[4pt]
=&\sum_{n=0}^{N-1}r^n\\[4pt]
=&\frac{1-r^N}{1-r}\\[4pt]
=&\;0\;\;\;\text{[since $r^N=e^{2i\pi(j-k)}=1$, and $1-r\ne 0$]}\\[4pt]
\end{align*}

A: Well large part of the issue seems that the first line is completly false. The identity does not hold when r=1 and also does not seem to hold when r is negative. Since this is a proof such information about r should be contained in hypothesis, and in that case the case of j=k has to be treated separately.

A: You have to handle the case $j=k$ separately. It is obvious that the sum is $N$ when $j=k$ because each term is just $1$.
The line just above (4.9) is not valid when $j=k$.


text:
Q: 64bit property sheets are using 32bit winapi dlls I converted an old visual studio project with vs2015 and added a 64bit platform configuration.
I wonder why the linker attributes does contain 32bit libs (like kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib).
First i thought this is a mistake by me, since i selected to copy the settings from the win32 platform settings but then I saw that this settings are imported by a property sheet that was inserted by the studio: "Microsoft.Cpp.x64.user"
Is this really the way how this should work? I read somewhere (here on SO: Can a 64 bit EXE link against 32-bit DLLs?) that a 64bit app cannot link against 32bit dlls.
Can somone enlighten me?

A: These DLL names date back 23 years ago when the first 32-bit version of Windows was released.  Windows versions 1 to 3 were 16-bit and used kernel.dll, user.dll, etcetera.  They glued "32" after the DLL name to distinguish them from the 16-bit versions and ensure that a 32-bit process can't load a 16-bit DLL by accident.
They did not do that again when they released the 64-bit version of Windows.  Too many programs hard-coded these names by then, typically in a LoadLibrary() call, and changing the names would have made it too difficult to port such programs to 64-bit.  Not even the directory where those DLLs are stored was renamed, it is still "system32".
So a machine now has two copies of kernel32.dll et al, the 64-bit version is located in c:\windows\system32 and the 32-bit version in c:\windows\syswow64.  It is still very important that a 32-bit process never attempts to load a 64-bit DLL, and the other way around, just like it was important 23 years ago.  So they came up with another trick, the File System Redirector ensures that a 32-bit process can only ever see the copy in syswow64.
Do note the oddity of having 64-bit DLLs in a directory named "system32" and 32-bit DLLs in "syswow64".  Trips up many programmers at first, now you know how that happened.
Much the same for the .lib files, the SDK directory has an x86 and a x64 directory to store these files.  Also pretty much automatic, where the linker looks for the .lib file is configured in Project > Properties > VC++ Directories > Library Directories.  A Win32/x86 platform target uses $(WindowsSDK_LibraryPath_x86) and an x64 target uses $(WindowsSDK_LibraryPath_x64).


text:
Q: Why are planets not torn apart? There are two forces we know, Centripetal force (or Gravity) and Centrifugal force. Both are applied to all the planets including earth. Planets are kind of spherical due to gravitational force but also not perfectly round due to this centrifugal force (or any other force idk) applied.
I read a lil before asking this question here and found, centrifugal force (or whatever) is not really great on earth but obviously it's enough to cause bend to it. But, I found this about Altair

A significant percentage of stars in the sky rotate much faster and
bulge noticeably at their equators. Like
Altair is notable for spinning very, very rapidly and completes a
full rotation on its axis every 10.4 earth hours. Accordingly,
astronomers estimate that Altair is at least 14 percent wider at the
equator than it is from pole to pole.

I'm sure there must be many stars and planets with greater centrifugal force on them like Altair. But why then none of the planet or star is torn apart till now ? I mean less or more a force is applied and that force is making an impact and huge impact maybe in many cases. Then why none of such planet is torn apart till now ?
If you say Gravity or centripetal force keeping it together and maybe canceling out other forces then why even this bend ? that means other forces have an impact (if i understood it correctly).
I'm not a physicist but have interest in physics. Would be thankful if someone can explain in simple words.

A: If I am understanding your questions correctly, just because the force of gravity and the centrifugal force are at equilibrium, it doesn't mean the shape has to be spherical. Think for instance of a water balloon flying through the vacuum that is also spinning. The internal force of the water trying to scape and the force of the rubber are at equilibrium but the shape of the balloon is definitely not spherical!
The point is, provided both forces balance, there is no reason to expect the body to burst into pieces. Of course if you were to add more mass without increasing the angular momentum of the planet then it would become more spherical as the force of gravity just became greater. On the contrary, if you make the planet spin faster without adding any additional mass you are solely increasing the centrifugal force making it look more like a disk.
A word of caution is in order. Your notion of bursting into pieces has to do with the fact that you correctly perceive a planet such as earth as a somewhat compact dirt sphere while the picture we were discussing doesn't take any of this into account. All we have talked so far would only apply for a rotating "ball of dust", which is of course unable to burst into anymore pieces!

A:
Then why none of such planet is torn apart till now ?

Any planets and stars that would have or could have rotated themselves into pieces have presumably already done so (which practically means that they would never have been formed in the first place.) What we see around us today is from a human time scale a more or less stable state of the universe.
Chances are that everything that inevitably happens to celestial bodies, already has happened a looong time ago or will happen a looong time from now. Our human lifetimes are simply too short, too negligible, for us to experience celestial changes. We are the blink of an eye in the astronomical thunder storm.
All the planets and stars that exist today with all the various rotations are thus presumably those that have managed since their creation to hold on to themselves. The centrifugal effects on them may have deformed them, but they have ended out with a new and strong enough shape to not be torn apart (a structure strong enough to overcome the centrifugal effect).
Since then, the centrifugal effect and gravity have counteracted each other for billions of years and will continue doing so into eternity, at least from a human perspective.
Those celestial objects that are very large while rotating very fast, may be closer to the limit of what their material structures can bear. Nevertheless they are just below the limit, because anything above the limit has already fallen apart a long time ago (or was never formed in the first place).

A: The Yarkovsky–O'Keefe–Radzievskii–Paddack effect, or YORP effect for short, can make the rotation rate of small astronomical bodies increase over time. This increasing or decreasing rotation rate is a side effect of the Yarkovsky effect, in which solar radiation on the small body and thermal radiation by the small body can make the orbit of the small body very slowly spiral toward or away from Sun.
The asteroid 54509 YORP has been named after this effect. Radar observations show that the rotation rate of 54509 YORP  is slowly increasing over time. Simulations show that the increasing rotation rate cannot be attributed to interactions with the Earth and with other planets. The increasing rotation rate is consistent with the YORP effect.
A good number of binary asteroids (pairs of asteroids that orbit one another) have been discovered. While inelastic collisions can account for some of these binary asteroids, the YORP effect is posited to be responsible for at least some of these binary asteroids: They tore themselves apart as their rotation rate increased.
Radiation pressure is proportional to cross sectional area, which is proportional to the square of an object's radius, while thermal radiation is proportional to mass, which is proportional to the cube of an object's radius. The square-cube law means that the Yarkovsky and YORP effects apply only to smallish bodies. What about larger bodies, such as stars and planets?
One of the key unresolved problems in star formation is the so-called angular momentum problem. As a protostar collapses its rotation rate increases due to conservation of angular momentum. The collapsing protostar will eventually reach a state where it can no longer gain mass unless there is a mechanism by which the collapsing protostar can shed angular momentum without losing mass. While a number of mechanisms have been proposed, the angular momentum problem remains unsolved.


text:
Q: resources for ffll free fuzzy logic library following the recommendation at which fuzzy logic library?
I also have chosen to use this library, ffll. However, it seems the community for this library does not exist or too few programmers using this library and it's hard to get simple support.
For example, to write the FCL language to define (.fcl) fuzzy model, the language reference have to be purchased. Now, I simply want to write a model with two outputs but have no idea how to (the old reference guide don't compile). Or even to define some constants in that .fcl file
I've googled but failed.
Anyone's experience and comment is a big help to me!
Thank you


text:
Q: What GPU is active and how to switch between them? I installed linux mint yesterday and I have some choppy scrolling issues that I think, that is because of the graphic card.
I want to know which graphic card is in use.
I tested a lot of commands and tools. Let's have a look at some of them:
glxinfo, lspci, nvidia-smi
neofetch result
system info
Another command I used is lshow:
ehsan@ehsan-Lenovo:~$ sudo lshw -c display
  *-display
       description: VGA compatible controller
       product: Skylake GT2 [HD Graphics 520]
       vendor: Intel Corporation
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 07
       width: 64 bits
       clock: 33MHz
       capabilities: pciexpress msi pm vga_controller bus_master cap_list rom
       configuration: driver=i915 latency=0
       resources: irq:128 memory:92000000-92ffffff memory:a0000000-afffffff ioport:5000(size=64) memory:c0000-dffff
  *-display
       description: 3D controller
       product: GM108M [GeForce 920MX]
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:03:00.0
       version: a2
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list
       configuration: driver=nvidia latency=0
       resources: irq:131 memory:93000000-93ffffff memory:80000000-8fffffff memory:90000000-91ffffff ioport:3000(size=128)

As you can see glxinfo shows that NVIDIA is installed.
lspi and my system info shows that intel skylake is running.
neofetch shows that I have 3 GPUs!
It is confusing for me. I have three questions.

*

*Which GPU is active right now?

*How could I switch between them? For example how could I use NVIDIA all the time?

*Which GPU is better to use?

A: I can see NVIDIA driver is running. So you could check which GPU you are using with prime-select:
prime-select query

This tells you if you are using NVIDIA (nvidia), integrated graphics (intel), or a combination of both (on-demand). You can choose one of them by running prime-select with one of those keywords. For using always nvidia:
prime-select nvidia

Which one is best for you depends on how do you want to use the GPU. I personally choose on-demand for not loading too much the GPU and use it for training Deep Learning models. If I would use the computer for gaming or stuff like Google Chrome with GPU acceleration, I would set it to nvidia.


text:
Q: Extension shows up in the extensions page but not in the user data directory I am creating a chrome extension. It is showing up in the chrome://extensions/ page but not in the user data dir/Default/Extensions directory. All the other extensions (installed from the app store) are showing.

A: Okay, only packed extensions show up in the {user data dir}/Default/Extensions.
First pack the extension, by clicking on Pack extension on the chrome://extensions page.
Then load that extension, by clicking on Load extension.
Now the packed (not the other unpacked one) will show up in {user data dir}/Default/Extensions.


text:
Q: How to get CherryPy version I'm very new to CherryPy. I want to know which CherryPy version is installed in my machine. How to get CherryPy version in terminal?
Thank you for educate me.

A: python -c "import cherrypy;print cherrypy.__version__"

A: Python 3 syntax:
python -c "import cherrypy;print(cherrypy.__version__)"

A: In ubuntu, you just need to check the package version:
apt-cache policy python-cherrypy3

For example, in my system:
python-cherrypy3:
  Installed: 3.1.2-1
  Candidate: 3.1.2-1
  Version table:
 *** 3.1.2-1 0
        500 http://archive.ubuntu.com/ubuntu/ oneiric/universe amd64 Packages
        100 /var/lib/dpkg/status

A: is
dpkg -l | grep -i cherrypy

what you are looking for?


text:
Q: MVC - Controller - Action - Friendly URL i am searching the net non-stop.
Can pls someonw point me in the rigth direction?
My Problem:
Normally mvc display: {Controller}/{Action}
and it gives us => Home/Index
What i want:
I want different URL without changing action or controller name like =>
MyPage/MyIndex
Should i be looking into the routing or is there an other way.

A: try this:
routes.MapRoute(
            name: "CustomRoute",
            url: "MyPage/MyAbout",
            defaults: new { controller = "Home", action = "About"}
        );


text:
Q: How to set cooldown to all commands in a Cog discord.py I have a discord bot with a Cog and I want to add a cooldown to all commands on this Cog.
I know I can add the cooldown by adding a decorator in the command function
@commands.command()
@commands.cooldown(1, 5, commands.BucketType.user)
async def ping(self, ctx):
    await ctx.send('Pong!')

but I don't want to add this decorator to all my functions manually because I have too many functions.
is there any way to add a cooldown to all these functions at once? maybe using something like the cog_before_invoke function?
I've even tried to create my own decorator for this, but I didn't manage to add it to the cog_before_invoke function or any other way to do this to multiple commands without add the code manually to each command
def my_cooldown(rate, per, type=commands.BucketType.default):
        def decorator(func):
            if isinstance(func, commands.Command):
                func._buckets = commands.CooldownMapping(commands.Cooldown(rate, per, type))
            else:
                func.__commands_cooldown__ = commands.Cooldown(rate, per, type)
            return func
        return decorator

A: You can use the sleep() method of the built-in time module.
import time

# The regular stuff

@commands.command()
async def your_func(self, ctx):
    # The code
    time.sleep(5)

This will pause the execution of your code completely so no other command can be called either.


text:
Q: Ant unresolved dependencies (hsqldb#hsqldb;1.8.0.10: not found) when building solr My solr was building fine last week, but all of a sudden, the build is failing with the following:
[ivy:retrieve] Entry is found in the ModuleDescriptorCache : .ivy2/cache/org.apache.derby/derby/ivy-10.9.1.0.xml
[ivy:retrieve]  found ivy file in cache for org.apache.derby#derby;10.9.1.0 (resolved by public): .ivy2/cache/org.apache.derby/derby/ivy-10.9.1.0.xml
[ivy:retrieve] main: module revision found in cache: org.apache.derby#derby;10.9.1.0
[ivy:retrieve]  found org.apache.derby#derby;10.9.1.0 in public
[ivy:retrieve] Nbr of module to sort : 1
[ivy:retrieve] Sort dependencies of : org.apache.derby#derby;10.9.1.0 / Number of dependencies = 0
[ivy:retrieve] Sort done for : org.apache.derby#derby;10.9.1.0
[ivy:retrieve] storing dependency org.apache.derby#derby;10.9.1.0 in props
[ivy:retrieve]  resolved ivy file produced in cache
[ivy:retrieve] :: downloading artifacts ::
[ivy:retrieve]  [NOT REQUIRED] org.apache.derby#derby;10.9.1.0!derby.jar
[ivy:retrieve] :: resolution report :: resolve 1202730ms :: artifacts dl 0ms
[ivy:retrieve] WARN:    ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] WARN:    ::          UNRESOLVED DEPENDENCIES         ::
[ivy:retrieve] WARN:    ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] WARN:    :: hsqldb#hsqldb;1.8.0.10: not found
[ivy:retrieve] WARN:    ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] Nbr of module to sort : 1
[ivy:retrieve] Sort dependencies of : org.apache.derby#derby;10.9.1.0 / Number of dependencies = 0
[ivy:retrieve] Sort done for : org.apache.derby#derby;10.9.1.0
[ivy:retrieve]  report for org.apache.solr#example-DIH;working@L-SB80BEFFT4-M.local compile produced in work/projects/main/solr/solr-4.10.2/trunk-for-proactive-down/lucene-solr/lucene/build/ivy-resolution-cache/org.apache.solr-example-DIH-compile.xml
[ivy:retrieve]  resolve done (1202730ms resolve - 0ms download)
[ivy:retrieve]
[ivy:retrieve] :: problems summary ::
[ivy:retrieve] :::: WARNINGS
[ivy:retrieve]      module not found: hsqldb#hsqldb;1.8.0.10
[ivy:retrieve]  ==== local: tried
[ivy:retrieve]    .ivy2/local/hsqldb/hsqldb/1.8.0.10/ivys/ivy.xml
[ivy:retrieve]    -- artifact hsqldb#hsqldb;1.8.0.10!hsqldb.jar:
[ivy:retrieve]    .ivy2/local/hsqldb/hsqldb/1.8.0.10/jars/hsqldb.jar
[ivy:retrieve]  ==== shared: tried
[ivy:retrieve]    .ivy2/shared/hsqldb/hsqldb/1.8.0.10/ivys/ivy.xml
[ivy:retrieve]    -- artifact hsqldb#hsqldb;1.8.0.10!hsqldb.jar:
[ivy:retrieve]    .ivy2/shared/hsqldb/hsqldb/1.8.0.10/jars/hsqldb.jar
[ivy:retrieve]  ==== public: tried
[ivy:retrieve]    http://repo1.maven.org/maven2/hsqldb/hsqldb/1.8.0.10/hsqldb-1.8.0.10.pom
[ivy:retrieve]  ==== maven.restlet.org: tried
[ivy:retrieve]    http://maven.restlet.org/hsqldb/hsqldb/1.8.0.10/hsqldb-1.8.0.10.pom
[ivy:retrieve]    -- artifact hsqldb#hsqldb;1.8.0.10!hsqldb.jar:
[ivy:retrieve]    http://maven.restlet.org/hsqldb/hsqldb/1.8.0.10/hsqldb-1.8.0.10.jar
[ivy:retrieve]  ==== sonatype-releases: tried
[ivy:retrieve]    https://oss.sonatype.org/content/repositories/releases/hsqldb/hsqldb/1.8.0.10/hsqldb-1.8.0.10.pom
[ivy:retrieve]    -- artifact hsqldb#hsqldb;1.8.0.10!hsqldb.jar:
[ivy:retrieve]    https://oss.sonatype.org/content/repositories/releases/hsqldb/hsqldb/1.8.0.10/hsqldb-1.8.0.10.jar
[ivy:retrieve]  ==== releases.cloudera.com: tried
[ivy:retrieve]    http://repository.cloudera.com/content/repositories/releases/hsqldb/hsqldb/1.8.0.10/hsqldb-1.8.0.10.pom
[ivy:retrieve]    -- artifact hsqldb#hsqldb;1.8.0.10!hsqldb.jar:
[ivy:retrieve]    http://repository.cloudera.com/content/repositories/releases/hsqldb/hsqldb/1.8.0.10/hsqldb-1.8.0.10.jar
[ivy:retrieve]  ==== working-chinese-mirror: tried
[ivy:retrieve]    http://uk.maven.org/maven2/hsqldb/hsqldb/1.8.0.10/hsqldb-1.8.0.10.pom
[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]      ::          UNRESOLVED DEPENDENCIES         ::
[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]      :: hsqldb#hsqldb;1.8.0.10: not found
[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] :::: ERRORS
[ivy:retrieve]  impossible to acquire lock for hsqldb#hsqldb;1.8.0.10
[ivy:retrieve]  impossible to acquire lock for hsqldb#hsqldb;1.8.0.10
[ivy:retrieve]  impossible to acquire lock for hsqldb#hsqldb;1.8.0.10
[ivy:retrieve]  impossible to acquire lock for hsqldb#hsqldb;1.8.0.10
[ivy:retrieve]  impossible to acquire lock for hsqldb#hsqldb;1.8.0.10
[ivy:retrieve]  impossible to acquire lock for hsqldb#hsqldb;1.8.0.10
[ivy:retrieve]  impossible to acquire lock for hsqldb#hsqldb;1.8.0.10
[ivy:retrieve]  impossible to acquire lock for hsqldb#hsqldb;1.8.0.10
[ivy:retrieve]  impossible to acquire lock for hsqldb#hsqldb;1.8.0.10
[ivy:retrieve]  impossible to acquire lock for hsqldb#hsqldb;1.8.0.10
[ivy:retrieve]
[ivy:retrieve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
      [ant] Exiting work/projects/main/solr/solr-4.10.2/trunk-for-proactive-down/lucene-solr/solr/example/example-DIH/build.xml.
      [ant] Exiting work/projects/main/solr/solr-4.10.2/trunk-for-proactive-down/lucene-solr/solr/solrj/build.xml.
      [ant] Exiting work/projects/main/solr/solr-4.10.2/trunk-for-proactive-down/lucene-solr/solr/core/build.xml.
      [ant] Exiting work/projects/main/solr/solr-4.10.2/trunk-for-proactive-down/lucene-solr/solr/test-framework/build.xml.
  [antcall] Exiting work/projects/main/solr/solr-4.10.2/trunk-for-proactive-down/lucene-solr/solr/solrj/build.xml.

BUILD FAILED
work/projects/main/solr/solr-4.10.2/trunk-for-proactive-down/lucene-solr/solr/common-build.xml:510: The following error occurred while executing this line:
work/projects/main/solr/solr-4.10.2/trunk-for-proactive-down/lucene-solr/solr/common-build.xml:421: The following error occurred while executing this line:
work/projects/main/solr/solr-4.10.2/trunk-for-proactive-down/lucene-solr/solr/common-build.xml:376: The following error occurred while executing this line:
work/projects/main/solr/solr-4.10.2/trunk-for-proactive-down/lucene-solr/solr/common-build.xml:396: The following error occurred while executing this line:
work/projects/main/solr/solr-4.10.2/trunk-for-proactive-down/lucene-solr/solr/common-build.xml:436: The following error occurred while executing this line:
work/projects/main/solr/solr-4.10.2/trunk-for-proactive-down/lucene-solr/lucene/common-build.xml:411: impossible to resolve dependencies:
    resolve failed - see output for details
    at org.apache.ivy.ant.IvyResolve.doExecute(IvyResolve.java:333)
    at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:277)
    at org.apache.ivy.ant.IvyPostResolveTask.ensureResolved(IvyPostResolveTask.java:231)
    at org.apache.ivy.ant.IvyPostResolveTask.prepareAndCheck(IvyPostResolveTask.java:178)
    at org.apache.ivy.ant.IvyRetrieve.doExecute(IvyRetrieve.java:87)
    at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:277)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)

I did do a git merge with the trunk to get my code up-to-date with the latest and no conflicts happened.
I have searched online for possible solutions and as suggested at some place, there is nothing wrong with my internet connection.
Any help would be appreciated.

A: Removing ~/.ivy2 resolved this issue.
rm -rf ~/.ivy2

A: Well you don't need to remove whole ivy2 folder. Removing the lock file will do the magic.

find ~/.ivy -name '*.lck' -exec rm -f {} \;


text:
Q: JAXB Tag Wrapping Lets say I have a Java class as follows
public class Foo {

   public ... getKitchen(){}

   public ... getRoom(){}

   public ... getInnerPart(){}

   public ... getUpperPart(){}

   public ... getBasement(){}

   ...
   ...
}

and I want XML output like this
<foo>
   <house>
     <kitchen>value<kitchen>
     <basement>value<basement>
     <room>value<room>
   <house>
   <innerPart>value<innerPart>
   <upperPart>value<upperPart>
<foo>

What would the JAXB annotations look like on my class?
Thanks.

A: Note:  I'm the EclipseLink JAXB (MOXy) lead and a member of the JAXB 2 (JSR-222) expert group.
You can use MOXy's @XmlPath extension to achieve this mapping:
import javax.xml.bind.annotation.*;
import org.eclipse.persistence.oxm.annotations.XmlPath;

@XmlRootElement
@XmlType(propOrder={"kitchen", "basement", "room", "innerPart", "upperPart"})
public class Foo {

   @XmlPath("house/kitchen/text()")
   public ... getKitchen(){}

   @XmlPath("house/room/text()")
   public ... getRoom(){}

   public ... getInnerPart(){}

   public ... getUpperPart(){}

   @XmlPath("house/basement/text()")
   public ... getBasement(){}

   ...
   ...
}

For More Information

*

*http://blog.bdoughan.com/2010/09/xpath-based-mapping-geocode-example.html

*http://blog.bdoughan.com/2011/03/map-to-element-based-on-attribute-value.html

*http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as-your.html


text:
Q: Could not parse the remainder: '[cat_id]' from 'menu[cat_id]' I am new to django and jinja template.
I am getting below error:
Could not parse the remainder: '[cat_id]' from 'menu[cat_id]'

I am trying to create dynamic tabs in my header for product categories, below is my code where error is happening:
{% for cat_id in menu %}
    <span class="navbar-item {% if 'sub_cat' in menu[cat_id] %} has-dropdown is-hoverable{% endif %}" style="{% if 'sub_cat' in menu[cat_id] %}align-items:center{% endif %}" >

menu is the dictionary and below is the sample structure for the same:
menu = {
1: {
    'category': 'Jewellery',
    'slug': 'abc',
    'sub_cat': {
        3: {
            'category': 'Earrings',
            'slug': 'def'
        }
    }
},
2: {
    'category': 'Apparel',
    'slug': 'ghi'
}
}

I am using python version 3.8, I tried degrading it to 3.7 as well, but error is still coming.
I am not sure if changing python version helps or not.
Thanks in advance