text:
Q: Thunderbolt - Displayport Monitors not detected on reboot. XPS 13 Arch Linux (endeavourOS) I am running EndeavourOS (Arch) on a 2017 Dell XPS 13. Kernel 5.7.2-arch1-1
[Hardware name: Dell Inc. XPS 13 9360/02PG84, BIOS 2.13.0 11/14/2019]
I have a multi-monitor setup at my desk, that, when working has the following config:
xrandr:
eDP1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 290mm x 170mm
   1920x1080     59.93*+  59.93

DP1 disconnected (normal left inverted right x axis y axis)
DP1-1 connected 3840x2160+1920+0 (normal left inverted right x axis y axis) 600mm x 340mm
   3840x2160     60.00 +  30.00    25.00    24.00*   29.97    23.98    29.98

DP1-2 connected 1440x2560+5760+0 left (normal left inverted right x axis y axis) 520mm x 300mm
   2560x1440     59.95*+

I have deleted the inactive rows to keep this short(er).
DP1-1 and DP 1-2 are connected over a passive thunderbolt to dual display port adapter.
On restart (not on short reboot) the monitors are not detected and the only way I have found to have the OS detect them is to unplug both of them either at the monitor or the display port sockets on the adapter, then plug them back in one by one.  Unplugging the adapter at the thunderbolt/usbc port does not result in the monitors working or even showing up in the xrandr output (journal output below after unplugging and re-adding the adapter at the thunderbolt port.
Is there a way to have these monitors consistently detected on reboot, or failing that - a way to 'jolt' the os into detecting them?
Below is the output from lspic and journalctl just after plugging each monitor back in.
I have inspected the journal from boot and am not finding anything that looks (to me) like the system failing when trying to detect the monitors.
Any help appreciated.
lspci
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 620 (rev 07)
00:04.0 Signal processing controller: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem (rev 08)
00:14.0 USB controller: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller (rev 21)
00:14.2 Signal processing controller: Intel Corporation Sunrise Point-LP Thermal subsystem (rev 21)
00:15.0 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO I2C Controller #0 (rev 21)
00:15.1 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO I2C Controller #1 (rev 21)
00:16.0 Communication controller: Intel Corporation Sunrise Point-LP CSME HECI #1 (rev 21)
00:1c.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #1 (rev f1)

01:00.0 PCI bridge: Intel Corporation DSL6340 Thunderbolt 3 Bridge [Alpine Ridge 2C 2015]
02:00.0 PCI bridge: Intel Corporation DSL6340 Thunderbolt 3 Bridge [Alpine Ridge 2C 2015]
02:01.0 PCI bridge: Intel Corporation DSL6340 Thunderbolt 3 Bridge [Alpine Ridge 2C 2015]
02:02.0 PCI bridge: Intel Corporation DSL6340 Thunderbolt 3 Bridge [Alpine Ridge 2C 2015]
39:00.0 USB controller: Intel Corporation DSL6340 USB 3.1 Controller [Alpine Ridge]

Here is the output from the journal after plugging monitors back in:
Monitor 1
Jun 22 09:53:32 lvtu autorandr[7579]: Failed to load profile 'default': Profile not found (line 1413)
Jun 22 09:53:32 lvtu autorandr[7579]: autorandr running as user richardp (started from batch instance)
Jun 22 09:53:32 lvtu autorandr[7579]: home
Jun 22 09:53:32 lvtu autorandr[7573]: Running autorandr as richardp for display :0
Jun 22 09:53:32 lvtu systemd[1]: autorandr.service: Succeeded.
Jun 22 09:53:32 lvtu systemd[1]: Finished autorandr execution hook.
Jun 22 09:53:32 lvtu audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=autorandr comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Jun 22 09:53:32 lvtu audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=autorandr comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Jun 22 09:53:32 lvtu kernel: audit: type=1130 audit(1592790812.037:119): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=autorandr comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=?
res=success'
Jun 22 09:53:32 lvtu kernel: audit: type=1131 audit(1592790812.037:120): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=autorandr comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=?
res=success'
Jun 22 09:53:32 lvtu kernel: [drm:drm_dp_mst_dpcd_read [drm_kms_helper]] *ERROR* mstb 00000000c66618ae port 1: DPCD read on addr 0x4b0 for 1 bytes NAKed
Jun 22 09:53:33 lvtu systemd[1]: Starting autorandr execution hook...
Jun 22 09:53:33 lvtu /usr/lib/gdm-x-session[1857]: (II) intel(0): Output DP1-2 has no monitor section
Jun 22 09:53:33 lvtu /usr/lib/gdm-x-session[1857]: (II) intel(0): Enabled output DP1-2
Jun 22 09:53:33 lvtu systemd[1]: Condition check resulted in First Boot Wizard being skipped.
Jun 22 09:53:33 lvtu systemd[1]: Condition check resulted in File System Check on Root Device being skipped.
Jun 22 09:53:33 lvtu systemd[1]: Condition check resulted in Rebuild Dynamic Linker Cache being skipped.
Jun 22 09:53:33 lvtu systemd[1]: Condition check resulted in Store a System Token in an EFI Variable being skipped.
Jun 22 09:53:33 lvtu systemd[1]: Condition check resulted in Rebuild Hardware Database being skipped.
Jun 22 09:53:33 lvtu systemd[1]: Condition check resulted in Rebuild Journal Catalog being skipped.
Jun 22 09:53:33 lvtu systemd[1]: Condition check resulted in Commit a transient machine-id on disk being skipped.
Jun 22 09:53:33 lvtu systemd[1]: Condition check resulted in Create System Users being skipped.
Jun 22 09:53:33 lvtu systemd[1]: Condition check resulted in Update is Completed being skipped.
Jun 22 09:53:33 lvtu /usr/lib/gdm-x-session[1857]: (II) intel(0): resizing framebuffer to 3360x2560
Jun 22 09:53:33 lvtu /usr/lib/gdm-x-session[1857]: (II) intel(0): switch to mode 2560x1440@60.0 on DP1-2 using pipe 1, position (1920, 0), rotation left, reflection none
Jun 22 09:53:34 lvtu autorandr[7597]: Failed to load profile 'default': Profile not found (line 1413)
Jun 22 09:53:34 lvtu autorandr[7597]: autorandr running as user richardp (started from batch instance)
Jun 22 09:53:34 lvtu autorandr[7597]: home
Jun 22 09:53:34 lvtu autorandr[7588]: Running autorandr as richardp for display :0
Jun 22 09:53:34 lvtu systemd[1]: autorandr.service: Succeeded.
Jun 22 09:53:34 lvtu systemd[1]: Finished autorandr execution hook.
Jun 22 09:53:34 lvtu audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=autorandr comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Jun 22 09:53:34 lvtu audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=autorandr comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Jun 22 09:53:34 lvtu kernel: audit: type=1130 audit(1592790814.441:121): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=autorandr comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=?
res=success'
Jun 22 09:53:34 lvtu kernel: audit: type=1131 audit(1592790814.441:122): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=autorandr comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=?
res=success'
Jun 22 09:53:39 lvtu kernel: [drm:drm_dp_mst_dpcd_read [drm_kms_helper]] *ERROR* mstb 00000000c66618ae port 1: DPCD read on addr 0x4b0 for 1 bytes NAKed

Monitor 2:
Jun 22 09:55:18 lvtu autorandr[7949]: Failed to load profile 'default': Profile not found (line 1413)
Jun 22 09:55:18 lvtu autorandr[7949]: autorandr running as user richardp (started from batch instance)
Jun 22 09:55:18 lvtu autorandr[7949]: home
Jun 22 09:55:18 lvtu autorandr[7943]: Running autorandr as richardp for display :0
Jun 22 09:55:18 lvtu systemd[1]: autorandr.service: Succeeded.
Jun 22 09:55:18 lvtu systemd[1]: Finished autorandr execution hook.
Jun 22 09:55:18 lvtu audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=autorandr comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Jun 22 09:55:18 lvtu audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=autorandr comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Jun 22 09:55:18 lvtu kernel: audit: type=1130 audit(1592790918.282:123): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=autorandr comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=?
res=success'
Jun 22 09:55:18 lvtu kernel: audit: type=1131 audit(1592790918.282:124): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=autorandr comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=?
res=success'
Jun 22 09:55:18 lvtu /usr/lib/gdm-x-session[1857]: (--) intel(0): HDMI max TMDS frequency 600000KHz
Jun 22 09:55:35 lvtu fcitx.desktop[2664]: (WARN-2664 x11selection.c:309) Selection is too long.

journal output after plugging in adapter at the thunderbolt port:
richardp@lvtu: journalctl --follow
Jun 23 10:34:34 lvtu /usr/lib/gdm-x-session[1695]: (--) intel(0): HDMI max TMDS frequency 600000KHz
Jun 23 10:43:31 lvtu kernel: xhci_hcd 0000:39:00.0: xHCI host controller not responding, assume dead
Jun 23 10:43:31 lvtu kernel: xhci_hcd 0000:39:00.0: HC died; cleaning up
Jun 23 10:43:31 lvtu kernel: pcieport 0000:00:1c.0: EDR: ACPI event 0x0 received
Jun 23 10:43:31 lvtu kernel: hub 3-0:1.0: activate --> -19
Jun 23 10:43:31 lvtu kernel: usb 3-1: USB disconnect, device number 2
Jun 23 10:43:31 lvtu kernel: xhci_hcd 0000:39:00.0: remove, state 4
Jun 23 10:43:31 lvtu kernel: usb usb4: USB disconnect, device number 1
Jun 23 10:43:31 lvtu kernel: xhci_hcd 0000:39:00.0: USB bus 4 deregistered
Jun 23 10:43:31 lvtu kernel: xhci_hcd 0000:39:00.0: remove, state 1
Jun 23 10:43:31 lvtu kernel: usb usb3: USB disconnect, device number 1
Jun 23 10:43:31 lvtu kernel: xhci_hcd 0000:39:00.0: Host halt failed, -19
Jun 23 10:43:31 lvtu kernel: xhci_hcd 0000:39:00.0: Host not accessible, reset failed.
Jun 23 10:43:32 lvtu kernel: xhci_hcd 0000:39:00.0: USB bus 3 deregistered
Jun 23 10:43:32 lvtu kernel: pci_bus 0000:02: Allocating resources
Jun 23 10:43:32 lvtu kernel: pcieport 0000:02:02.0: bridge window [mem 0x00100000-0x000fffff 64bit pref] to [bus 39] add_size 200000 add_align 100000
Jun 23 10:43:32 lvtu kernel: pcieport 0000:02:02.0: BAR 15: no space for [mem size 0x00200000 64bit pref]
Jun 23 10:43:32 lvtu kernel: pcieport 0000:02:02.0: BAR 15: failed to assign [mem size 0x00200000 64bit pref]
Jun 23 10:43:32 lvtu kernel: pcieport 0000:02:02.0: BAR 15: no space for [mem size 0x00200000 64bit pref]
Jun 23 10:43:32 lvtu kernel: pcieport 0000:02:02.0: BAR 15: failed to assign [mem size 0x00200000 64bit pref]
Jun 23 10:43:32 lvtu kernel: ------------[ cut here ]------------
Jun 23 10:43:32 lvtu kernel: sysfs group 'power' not found for kobject 'i2c-10'
Jun 23 10:43:32 lvtu kernel: WARNING: CPU: 1 PID: 5822 at fs/sysfs/group.c:279 sysfs_remove_group+0x6f/0x80
Jun 23 10:43:32 lvtu kernel: Modules linked in: uinput xt_connmark nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c xt_mark iptable_mangle xt_comment xt_addrtype iptable_raw wireguard curve25519_x86_64 libchacha20poly1305 chacha_x86_64 poly1305_x86_64 libblake2s blake2s_x86_64 ip6_udp_tunnel udp_tunnel libcurve25519_generic libchacha libblake2s_generic tun thunderbolt fuse rfcomm uas hid_logitech_hidpp usb_storage hid_logitech_dj usbhid smsc75xx usbnet mii udl cmac algif_hash algif_skcipher af_alg bnep typec_displayport uvcvideo btusb videobuf2_vmalloc btrtl videobuf2_memops btbcm videobuf2_v4l2 btintel videobuf2_common bluetooth videodev mc ecdh_generic ecc snd_hda_codec_hdmi hid_multitouch hid_generic snd_hda_codec_realtek snd_hda_codec_generic joydev mousedev iTCO_wdt iTCO_vendor_support snd_soc_skl snd_soc_sst_ipc x86_pkg_temp_thermal intel_powerclamp snd_soc_sst_dsp snd_hda_ext_core coretemp snd_soc_acpi_intel_match snd_soc_acpi kvm_intel snd_soc_core snd_compress kvm ac97_bus irqbypass i915
Jun 23 10:43:32 lvtu kernel:  mei_hdcp snd_pcm_dmaengine mei_wdt intel_rapl_msr snd_hda_intel crct10dif_pclmul wmi_bmof snd_intel_dspcfg dell_wmi ath10k_pci intel_wmi_thunderbolt crc32_pclmul dell_laptop ghash_clmulni_intel ath10k_core mmc_block snd_hda_codec ledtrig_audio dell_smbios snd_hda_core nls_iso8859_1 dell_wmi_descriptor ath snd_hwdep nls_cp437 dcdbas aesni_intel i2c_algo_bit crypto_simd vfat squashfs cryptd glue_helper mac80211 fat drm_kms_helper snd_pcm intel_cstate cec snd_timer rc_core intel_uncore snd cfg80211 intel_rapl_perf intel_gtt psmouse pcspkr input_leds syscopyarea soundcore i2c_i801 intel_lpss_pci mei_me ucsi_acpi rfkill processor_thermal_device intel_xhci_usb_role_switch i2c_hid typec_ucsi intel_lpss intel_rapl_common libarc4 sysfillrect mei roles idma64 intel_soc_dts_iosf intel_pch_thermal typec hid sysimgblt fb_sys_fops wmi battery soc_button_array intel_vbtn evdev intel_hid int3403_thermal int3400_thermal int340x_thermal_zone sparse_keymap acpi_thermal_rel mac_hid ac drm loop sg
Jun 23 10:43:32 lvtu kernel:  crypto_user agpgart ip_tables x_tables ext4 crc32c_generic crc16 mbcache jbd2 rtsx_pci_sdmmc serio_raw mmc_core atkbd libps2 crc32c_intel xhci_pci rtsx_pci xhci_hcd i8042 serio
Jun 23 10:43:32 lvtu kernel: CPU: 1 PID: 5822 Comm: kworker/1:2 Tainted: G     U            5.7.2-arch1-1 #1
[Duplicated output]
Jun 23 10:43:32 lvtu kernel: Hardware name: Dell Inc. XPS 13 9360/02PG84, BIOS 2.13.0 11/14/2019
Jun 23 10:43:32 lvtu kernel: Workqueue: events drm_dp_delayed_destroy_work [drm_kms_helper]
Jun 23 10:43:32 lvtu kernel: RIP: 0010:sysfs_remove_group+0x6f/0x80
Jun 23 10:43:32 lvtu kernel: Code: ff 5b 48 89 ef 5d 41 5c e9 ae c1 ff ff 48 89 ef e8 96 ba ff ff eb d1 49 8b 14 24 48 8b 33 48 c7 c7 b8 be 77 97 e8 48 5c d0 ff <0f> 0b 5b 5d 41 5c c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00
Jun 23 10:43:32 lvtu kernel: RSP: 0018:ffffb25fc2f2bd38 EFLAGS: 00010282
Jun 23 10:43:32 lvtu kernel: RAX: 0000000000000000 RBX: ffffffff974ea4a0 RCX: 0000000000000000
Jun 23 10:43:32 lvtu kernel: RDX: 0000000000000001 RSI: 0000000000000086 RDI: 00000000ffffffff
Jun 23 10:43:32 lvtu kernel: RBP: 0000000000000000 R08: 0000000000000512 R09: 0000000000000001
Jun 23 10:43:32 lvtu kernel: R10: 0000000000000000 R11: 0000000000000001 R12: ffff9b04133e08a8
Jun 23 10:43:32 lvtu kernel: R13: ffff9b04133e0928 R14: dead000000000100 R15: ffff9b04133e0900
Jun 23 10:43:32 lvtu kernel: FS:  0000000000000000(0000) GS:ffff9b05ae440000(0000) knlGS:0000000000000000
Jun 23 10:43:32 lvtu kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Jun 23 10:43:32 lvtu kernel: CR2: 000055e38ec6d800 CR3: 000000014640a004 CR4: 00000000003606e0
Jun 23 10:43:32 lvtu kernel: Call Trace:
Jun 23 10:43:32 lvtu kernel:  device_del+0x97/0x3f0
Jun 23 10:43:32 lvtu kernel:  device_unregister+0x16/0x60
Jun 23 10:43:32 lvtu kernel:  i2c_del_adapter+0x23d/0x300
Jun 23 10:43:32 lvtu kernel:  drm_dp_port_set_pdt+0x98/0x2c0 [drm_kms_helper]
Jun 23 10:43:32 lvtu kernel:  drm_dp_delayed_destroy_work+0x235/0x320 [drm_kms_helper]
Jun 23 10:43:32 lvtu kernel:  process_one_work+0x1da/0x3d0
Jun 23 10:43:32 lvtu kernel:  worker_thread+0x4d/0x3e0
Jun 23 10:43:32 lvtu kernel:  ? rescuer_thread+0x3f0/0x3f0
Jun 23 10:43:32 lvtu kernel:  kthread+0x13e/0x160
Jun 23 10:43:32 lvtu kernel:  ? __kthread_bind_mask+0x60/0x60
Jun 23 10:43:32 lvtu kernel:  ret_from_fork+0x35/0x40
Jun 23 10:43:32 lvtu kernel: ---[ end trace 6d0f32557a6e8871 ]---
Jun 23 10:43:32 lvtu systemd[1]: Condition check resulted in First Boot Wizard being skipped.
Jun 23 10:43:32 lvtu systemd[1]: Condition check resulted in File System Check on Root Device being skipped.
Jun 23 10:43:32 lvtu systemd[1]: Condition check resulted in Rebuild Dynamic Linker Cache being skipped.
Jun 23 10:43:32 lvtu systemd[1]: Condition check resulted in Store a System Token in an EFI Variable being skipped.
Jun 23 10:43:32 lvtu systemd[1]: Condition check resulted in Rebuild Hardware Database being skipped.
Jun 23 10:43:32 lvtu systemd[1]: Condition check resulted in Rebuild Journal Catalog being skipped.
Jun 23 10:43:32 lvtu systemd[1]: Condition check resulted in Commit a transient machine-id on disk being skipped.
Jun 23 10:43:32 lvtu systemd[1]: Condition check resulted in Create System Users being skipped.
Jun 23 10:43:32 lvtu systemd[1]: Condition check resulted in Update is Completed being skipped.
Jun 23 10:43:32 lvtu systemd[1]: Starting autorandr execution hook...
Jun 23 10:43:32 lvtu /usr/lib/gdm-x-session[1695]: (II) intel(0): Disabled output DP1-2
Jun 23 10:43:33 lvtu /usr/lib/gdm-x-session[1695]: (II) intel(0): resizing framebuffer to 1920x1080
Jun 23 10:43:33 lvtu autorandr[14219]: Failed to load profile 'default': Profile not found (line 1413)
Jun 23 10:43:33 lvtu autorandr[14219]: autorandr running as user richardp (started from batch instance)
Jun 23 10:43:33 lvtu autorandr[14219]: home
Jun 23 10:43:33 lvtu autorandr[14213]: Running autorandr as richardp for display :0
Jun 23 10:43:33 lvtu systemd[1]: autorandr.service: Succeeded.
Jun 23 10:43:33 lvtu systemd[1]: Finished autorandr execution hook.
Jun 23 10:43:33 lvtu audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=autorandr comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Jun 23 10:43:33 lvtu audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=autorandr comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Jun 23 10:43:33 lvtu kernel: audit: type=1130 audit(1592880213.962:158): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=autorandr comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Jun 23 10:43:33 lvtu kernel: audit: type=1131 audit(1592880213.962:159): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=autorandr comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=?
res=success'
Jun 23 10:43:37 lvtu kernel: pcieport 0000:00:1c.0: AER: Corrected error received: 0000:00:1c.0
Jun 23 10:43:37 lvtu kernel: pcieport 0000:00:1c.0: AER: PCIe Bus Error: severity=Corrected, type=Physical Layer, (Receiver ID)
Jun 23 10:43:37 lvtu kernel: pcieport 0000:00:1c.0: AER:   device [8086:9d10] error status/mask=00002001/00002000
Jun 23 10:43:37 lvtu kernel: pcieport 0000:00:1c.0: AER:    [ 0] RxErr                  (First)
Jun 23 10:43:37 lvtu kernel: pcieport 0000:00:1c.0: EDR: ACPI event 0x0 received
Jun 23 10:43:37 lvtu kernel: pcieport 0000:02:00.0: can't change power state from D3cold to D0 (config space inaccessible)
Jun 23 10:43:37 lvtu kernel: pci_bus 0000:03: busn_res: [bus 03] is released
Jun 23 10:43:37 lvtu kernel: pci_bus 0000:04: busn_res: [bus 04-38] is released
Jun 23 10:43:37 lvtu kernel: pci_bus 0000:39: busn_res: [bus 39] is released
Jun 23 10:43:37 lvtu kernel: pci_bus 0000:02: busn_res: [bus 02-39] is released
Jun 23 10:43:37 lvtu boltd[2868]: probing: removing /sys/devices/pci0000:00/0000:00:1c.0/0000:01:00.0 from roots
Jun 23 10:43:42 lvtu kernel: pcieport 0000:00:1c.0: EDR: ACPI event 0x0 received
Jun 23 10:43:42 lvtu kernel: pci 0000:01:00.0: [8086:1576] type 01 class 0x060400
Jun 23 10:43:42 lvtu kernel: pci 0000:01:00.0: enabling Extended Tags
Jun 23 10:43:42 lvtu kernel: pci 0000:01:00.0: supports D1 D2
Jun 23 10:43:42 lvtu kernel: pci 0000:01:00.0: PME# supported from D0 D1 D2 D3hot D3cold
Jun 23 10:43:42 lvtu kernel: pci 0000:01:00.0: 15.752 Gb/s available PCIe bandwidth, limited by 8.0 GT/s PCIe x2 link at 0000:00:1c.0 (capable of 31.504 Gb/s with 8.0 GT/s PCIe x4 link)
Jun 23 10:43:42 lvtu kernel: pci 0000:02:00.0: [8086:1576] type 01 class 0x060400
Jun 23 10:43:42 lvtu kernel: pci 0000:02:00.0: enabling Extended Tags
Jun 23 10:43:42 lvtu kernel: pci 0000:02:00.0: supports D1 D2
Jun 23 10:43:42 lvtu kernel: pci 0000:02:00.0: PME# supported from D0 D1 D2 D3hot D3cold
Jun 23 10:43:42 lvtu kernel: pci 0000:02:01.0: [8086:1576] type 01 class 0x060400
Jun 23 10:43:42 lvtu kernel: pci 0000:02:01.0: enabling Extended Tags
Jun 23 10:43:42 lvtu kernel: pci 0000:02:01.0: supports D1 D2
Jun 23 10:43:42 lvtu kernel: pci 0000:02:01.0: PME# supported from D0 D1 D2 D3hot D3cold
Jun 23 10:43:42 lvtu kernel: pci 0000:02:02.0: [8086:1576] type 01 class 0x060400
Jun 23 10:43:42 lvtu kernel: pci 0000:02:02.0: enabling Extended Tags
Jun 23 10:43:42 lvtu kernel: pci 0000:02:02.0: supports D1 D2
Jun 23 10:43:42 lvtu kernel: pci 0000:02:02.0: PME# supported from D0 D1 D2 D3hot D3cold
Jun 23 10:43:42 lvtu kernel: pci 0000:01:00.0: PCI bridge to [bus 02-39]
Jun 23 10:43:42 lvtu kernel: pci 0000:01:00.0:   bridge window [mem 0xc4000000-0xda0fffff]
Jun 23 10:43:42 lvtu kernel: pci 0000:01:00.0:   bridge window [mem 0xa0000000-0xc1ffffff 64bit pref]
Jun 23 10:43:42 lvtu kernel: pci 0000:02:00.0: PCI bridge to [bus 03]
Jun 23 10:43:42 lvtu kernel: pci 0000:02:00.0:   bridge window [mem 0xda000000-0xda0fffff]
Jun 23 10:43:42 lvtu kernel: pci 0000:02:01.0: PCI bridge to [bus 04-38]
Jun 23 10:43:42 lvtu kernel: pci 0000:02:01.0:   bridge window [mem 0xc4000000-0xd9efffff]
Jun 23 10:43:42 lvtu kernel: pci 0000:02:01.0:   bridge window [mem 0xa0000000-0xc1ffffff 64bit pref]
Jun 23 10:43:42 lvtu kernel: pci 0000:39:00.0: [8086:15b5] type 00 class 0x0c0330
Jun 23 10:43:42 lvtu kernel: pci 0000:39:00.0: reg 0x10: [mem 0xd9f00000-0xd9f0ffff]
Jun 23 10:43:42 lvtu kernel: pci 0000:39:00.0: enabling Extended Tags
Jun 23 10:43:42 lvtu kernel: pci 0000:39:00.0: supports D1 D2
Jun 23 10:43:42 lvtu kernel: pci 0000:39:00.0: PME# supported from D0 D1 D2 D3hot D3cold
Jun 23 10:43:42 lvtu kernel: pci 0000:39:00.0: 8.000 Gb/s available PCIe bandwidth, limited by 2.5 GT/s PCIe x4 link at 0000:02:02.0 (capable of 31.504 Gb/s with 8.0 GT/s PCIe x4 link)
Jun 23 10:43:42 lvtu kernel: pci 0000:02:02.0: PCI bridge to [bus 39]
Jun 23 10:43:42 lvtu kernel: pci 0000:02:02.0:   bridge window [mem 0xd9f00000-0xd9ffffff]
Jun 23 10:43:42 lvtu kernel: pci_bus 0000:02: Allocating resources
Jun 23 10:43:42 lvtu kernel: pci 0000:02:01.0: bridge window [io  0x1000-0x0fff] to [bus 04-38] add_size 1000
Jun 23 10:43:42 lvtu kernel: pci 0000:02:02.0: bridge window [io  0x1000-0x0fff] to [bus 39] add_size 1000
Jun 23 10:43:42 lvtu kernel: pci 0000:02:02.0: bridge window [mem 0x00100000-0x000fffff 64bit pref] to [bus 39] add_size 200000 add_align 100000
Jun 23 10:43:42 lvtu kernel: pci 0000:01:00.0: bridge window [io  0x1000-0x0fff] to [bus 02-39] add_size 3000
Jun 23 10:43:42 lvtu kernel: pci 0000:01:00.0: BAR 13: assigned [io  0x2000-0x4fff]
Jun 23 10:43:42 lvtu kernel: pci 0000:02:02.0: BAR 15: no space for [mem size 0x00200000 64bit pref]
Jun 23 10:43:42 lvtu kernel: pci 0000:02:02.0: BAR 15: failed to assign [mem size 0x00200000 64bit pref]
Jun 23 10:43:42 lvtu kernel: pci 0000:02:01.0: BAR 13: assigned [io  0x2000-0x2fff]
Jun 23 10:43:42 lvtu kernel: pci 0000:02:02.0: BAR 13: assigned [io  0x3000-0x3fff]
Jun 23 10:43:42 lvtu kernel: pci 0000:02:02.0: BAR 15: no space for [mem size 0x00200000 64bit pref]
Jun 23 10:43:42 lvtu kernel: pci 0000:02:02.0: BAR 15: failed to assign [mem size 0x00200000 64bit pref]
Jun 23 10:43:42 lvtu kernel: pci 0000:02:00.0: PCI bridge to [bus 03]
Jun 23 10:43:42 lvtu kernel: pci 0000:02:00.0:   bridge window [mem 0xda000000-0xda0fffff]
Jun 23 10:43:42 lvtu kernel: pci 0000:02:01.0: PCI bridge to [bus 04-38]
Jun 23 10:43:42 lvtu kernel: pci 0000:02:01.0:   bridge window [io  0x2000-0x2fff]
Jun 23 10:43:42 lvtu kernel: pci 0000:02:01.0:   bridge window [mem 0xc4000000-0xd9efffff]
Jun 23 10:43:42 lvtu kernel: pci 0000:02:01.0:   bridge window [mem 0xa0000000-0xc1ffffff 64bit pref]
Jun 23 10:43:42 lvtu kernel: pci 0000:02:02.0: PCI bridge to [bus 39]
Jun 23 10:43:42 lvtu kernel: pci 0000:02:02.0:   bridge window [io  0x3000-0x3fff]
Jun 23 10:43:42 lvtu kernel: pci 0000:02:02.0:   bridge window [mem 0xd9f00000-0xd9ffffff]
Jun 23 10:43:42 lvtu kernel: pci 0000:01:00.0: PCI bridge to [bus 02-39]
Jun 23 10:43:42 lvtu kernel: pci 0000:01:00.0:   bridge window [io  0x2000-0x4fff]
Jun 23 10:43:42 lvtu kernel: pci 0000:01:00.0:   bridge window [mem 0xc4000000-0xda0fffff]
Jun 23 10:43:42 lvtu kernel: pci 0000:01:00.0:   bridge window [mem 0xa0000000-0xc1ffffff 64bit pref]
Jun 23 10:43:42 lvtu kernel: pcieport 0000:01:00.0: enabling device (0006 -> 0007)
Jun 23 10:43:42 lvtu kernel: pcieport 0000:02:01.0: enabling device (0006 -> 0007)
Jun 23 10:43:42 lvtu kernel: pcieport 0000:02:02.0: enabling device (0006 -> 0007)
Jun 23 10:43:42 lvtu kernel: xhci_hcd 0000:39:00.0: xHCI Host Controller
Jun 23 10:43:42 lvtu kernel: xhci_hcd 0000:39:00.0: new USB bus registered, assigned bus number 3
Jun 23 10:43:42 lvtu kernel: xhci_hcd 0000:39:00.0: hcc params 0x200077c1 hci version 0x110 quirks 0x0000000200009810
Jun 23 10:43:42 lvtu kernel: usb usb3: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.07
Jun 23 10:43:42 lvtu kernel: usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
Jun 23 10:43:42 lvtu kernel: usb usb3: Product: xHCI Host Controller
Jun 23 10:43:42 lvtu kernel: usb usb3: Manufacturer: Linux 5.7.2-arch1-1 xhci-hcd
Jun 23 10:43:42 lvtu kernel: usb usb3: SerialNumber: 0000:39:00.0
Jun 23 10:43:42 lvtu kernel: hub 3-0:1.0: USB hub found
Jun 23 10:43:42 lvtu kernel: hub 3-0:1.0: 2 ports detected
Jun 23 10:43:42 lvtu kernel: xhci_hcd 0000:39:00.0: xHCI Host Controller
Jun 23 10:43:42 lvtu kernel: xhci_hcd 0000:39:00.0: new USB bus registered, assigned bus number 4
Jun 23 10:43:42 lvtu kernel: xhci_hcd 0000:39:00.0: Host supports USB 3.1 Enhanced SuperSpeed
Jun 23 10:43:42 lvtu kernel: usb usb4: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.07


text:
Q: MVC5 jQuery ajax I want to select multiple rows and then click on a button to approve/deny those rows. I have successfully updated the rows I want to approve in db. But when ajax callback, I ran table.draw() and it doesn't show the saved result. I don't know how to take the saved result and refresh back to the DataTable.
Also I am new to MVC and jQuery, I was fumbling around to make it barely work. Could you help point out what do I need to improve/fix to make this work better?
Here are my codes:
View (table part):

                    Clearance Name
                    Approved
                    Approver
                    DateTime
                    Deny Reason

                @foreach (var item in Model.Request.RequestClearances)
                {

                        @item.Clearance.ClearanceName
                        @item.IsApproved
                        @item.ApprovedUser
                        @item.ModifiedDate
                        @item.DenialReason

                }

<input type="button" id="btnApprove" value="Approve" /><input type="button" id="btnDeny" value="Deny" />

View (jQuery part):

Control:
public JsonResult UpdateApproveDeny(string[] requestClearanceIDs, string isApproved)
        {
            if (requestClearanceIDs == null) return Json("fail",JsonRequestBehavior.AllowGet);
            int? requestID = 0;
            foreach (var requestClearanceID in requestClearanceIDs)
            {
                int id = 0;
                Int32.TryParse(requestClearanceID, out id);
                requestID = rc.RequestID;
                rc.IsApproved = Convert.ToBoolean(isApproved);
                rc.ModifiedBy = User.Identity.Name;
                rc.ModifiedDate = DateTime.Now;
                rc.ApprovedUser = User.Identity.Name;
                db.SaveChanges();
            }

            return Json("success",JsonRequestBehavior.AllowGet);
        }

A: Since you're using DataTables in a static fashion you'll need to replace your table content in the AJAX callback then rebind $("#myDataTable").DataTable() because the original table will be replaced.
Add a partial view
Adjust your main view to fill your table with a partial view.

    @Html.Partial("_ClearancesTable", Model.Request.RequestClearances)

    <input type="button" id="btnApprove" value="Approve" />
    <input type="button" id="btnDeny" value="Deny" />

_ClearancesTable.cshtml
@model IEnumerable<RequestClearances>

    @foreach (var item in Model)
    {
        ...
    }

You can either make a second AJAX call to retrieve new table data or alter your first response to return the new data.
Replace the JSON result to take advantage of the partial view and to reduce this to one server call.
public ActionResult UpdateApproveDeny(string[] requestClearanceIDs, string isApproved)
{
    ...
    db.SaveChanges();
    var clearances = db.GetClarances();
    return PartialView("_ClearancesTable", clearances);
}

Replace and Rebind
 success: function(partialResult) {
     $("#tableData").html(partialResult)
     $("#myDataTable").DataTable();
 }

redpajama_set_name: RedPajamaStackExchange


text:
Q: Struggling with a UnhandledPromiseRejectionWarning I'm struggling to see where the promise rejection is emerging in the following:
MongoClient.connect(mongourl)
    .then(db => {
        console.log("making promises:", typeof lib.getAllData)
        // let promises = packages.map(repo => lib.getAllData(db, repo));
        let promises = [];
        console.log("making promises2")
        // return getAllData(db, packages[0])
        return Promise.all(promises)
            .then(results => {
                console.log("RAW RES", results);
                let missing = results.filter(r => r.error).map(r => r.error)
                return (db, missing);
            })
            // Should never fail as getAllData always resolves
            .catch(err => {
                console.log("err1", err);
                return Promise.reject({db, err})
            });
    }).then(({db, results}) => {
        console.log("RES: ", results);
        db.close();
    }).catch(({db, err}) => {
        console.log("Final Err:", err);
        db.close();
    });

What I see in the console is
making promises: function
making promises2
RAW RES []
RES:  undefined
Final Err: undefined
(node:7026) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'close' of undefined
(node:7026) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I have two questions:

*

*why is RES undefined - I would expect it to be []

*why am I ending up at "Final Err" as there should be no rejections occuring in this script

A: I didn't go through the entire code but from a glance I think you got your deconstructing broken:
const test = () => {
    return ('one','two');
}

console.log( test() )

Will return two, not {'one', 'two'} as you suggest here.
So change your code like this:
MongoClient.connect(mongourl)
    .then(db => {
        console.log("making promises:", typeof lib.getAllData)
        // let promises = packages.map(repo => lib.getAllData(db, repo));
        let promises = [];
        console.log("making promises2")
        // return getAllData(db, packages[0])
        return Promise.all(promises)
            .then(results => {
                console.log("RAW RES", results);
                let missing = results.filter(r => r.error).map(r => r.error)

                return {db, missing};
                //      ^------- THE CHANGE

            })
            // Should never fail as getAllData always resolves
            .catch(err => {
                console.log("err1", err);
                return Promise.reject({db, err})
            });
    }).then(({db, results}) => {
        console.log("RES: ", results);
        db.close();
    }).catch(({db, err}) => {
        console.log("Final Err:", err);
        db.close();
    });

I also suggest to abstract these functions so that you get to a nice promise chain.
Your questions

why is RES undefined - I would expect it to be []

Well you return a single variable rather than an object so db and results is both undefined

why am I ending up at "Final Err" as there should be no rejections occuring in this script

Famous last words ;)
Always assume things will break.

A: So the error was that I was returning - as Dominik stated:
return (db, missing);

That should have been
return {db, missing};

But in my .then I was pattern matching for
{db, results}

and results could not be found as I was returning a field called missing


text:
Q: RadioButton inside listview I am using RadioGroup as a row Item inside listview. RadioGroup has 5 radio buttons and I have like 1000 rows. I am not able to mange state of radio buttons.I have tried Map for storing position and checked state. I have even tried making Class and saving checked state and radio button id with setTag() & getTag(). No luck yet. Any suggestions?
Code
Adapter class
package com.example.adapters;

import java.util.List;
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.example.android.R;
import com.example.models.AnswerStateModel;

public class AnswerKeyAdapter extends ArrayAdapter<AnswerStateModel> {

    private Activity activity;
    private List<AnswerStateModel> test;
    Toast t = null;

    public AnswerKeyAdapter(Activity activity, List<AnswerStateModel> temp) {
        super(activity, R.layout.row_item_answer_key, temp);
        this.activity = activity;
        this.test = temp;
    }

    @Override
    public int getCount() {
        return test.size();
    }

    @Override
    public AnswerStateModel getItem(int position) {
        return test.get(position);
    }
    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        final int currentPosition=position;
        View view=null;
        if (convertView == null) {
            final ViewHolder holder = new ViewHolder();
            view = LayoutInflater.from(activity).inflate(
                    R.layout.row_item_answer_key, parent,false);
            holder.lblAnswerId = (TextView) view.findViewById(R.id.lblAnswerId);
            holder.rdGroup = (RadioGroup)view.findViewById(R.id.rdGroup);
            holder.btnA = (RadioButton) view.findViewById(R.id.btnA);
            holder.btnB = (RadioButton) view.findViewById(R.id.btnB);
            holder.btnC = (RadioButton) view.findViewById(R.id.btnC);
            holder.btnD = (RadioButton) view.findViewById(R.id.btnD);
            holder.btnE = (RadioButton) view.findViewById(R.id.btnE);
            holder.btnWhat = (Button) view.findViewById(R.id.btnWhat);

            view.setTag(holder);
            holder.rdGroup.setTag(test.get(position));

holder.rdGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group,
                    int checkedId) {
                    AnswerStateModel model=(AnswerStateModel) holder.rdGroup.getTag();

                    switch (checkedId) {
                    case R.id.btnA:
                        model.setChecked(holder.btnA.isChecked());
                        model.setBtnId(holder.btnA.getId());
                        break;
                    case R.id.btnB:
                        model.setChecked(holder.btnB.isChecked());
                        model.setBtnId(holder.btnB.getId());
                        break;
                    case R.id.btnC:
                        model.setChecked(holder.btnC.isChecked());
                        model.setBtnId(holder.btnC.getId());
                        break;
                    case R.id.btnD:
                        model.setChecked(holder.btnD.isChecked());
                        model.setBtnId(holder.btnD.getId());
                        break;
                    case R.id.btnE:
                        model.setChecked(holder.btnE.isChecked());
                        model.setBtnId(holder.btnE.getId());
                        break;
                    default:
                        break;
                    }
                }
            });

        } else{

            view=convertView;
            ((ViewHolder) view.getTag()).rdGroup.setTag(test.get(position));

        }

        final ViewHolder holder = (ViewHolder) view.getTag();

        AnswerStateModel model=(AnswerStateModel)getItem(currentPosition);

        holder.btnA.setChecked(false);
        holder.btnB.setChecked(false);
        holder.btnC.setChecked(false);
        holder.btnD.setChecked(false);
        holder.btnE.setChecked(false);

        switch (model.getBtnId()) {
        case R.id.btnA:
            holder.btnA.setChecked(test.get(position).isChecked());
            break;
        case R.id.btnB:
            holder.btnB.setChecked(test.get(position).isChecked());
            break;
        case R.id.btnC:
            holder.btnC.setChecked(test.get(position).isChecked());
            break;
        case R.id.btnD:
            holder.btnD.setChecked(test.get(position).isChecked());
            break;
        case R.id.btnE:
            holder.btnE.setChecked(test.get(position).isChecked());
            break;
        default:
            break;
        }

        holder.lblAnswerId.setText(position+1+"");

        holder.btnWhat.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (v.isSelected())
                    v.setSelected(false);
                else
                    v.setSelected(true);
            }
        });

        return view;
    }

    private static class ViewHolder {
        private TextView lblAnswerId;
        private RadioButton btnA;
        private RadioButton btnB;
        private RadioButton btnC;
        private RadioButton btnD;
        private RadioButton btnE;
        private RadioGroup rdGroup;
        private Button btnWhat;
    }

    void showToast(String text) {

        if (t != null)
            t.cancel();

        t = Toast.makeText(activity, text, Toast.LENGTH_SHORT);
        t.show();
    }
}

Pojo class
package com.example.models;

public class AnswerStateModel {

    private boolean isChecked=false;
    private int btnId=0;
    private int currentPosition=0;
    private String correctAns="";
    private int btnPosition=0;

    public int getBtnPosition() {
        return btnPosition;
    }
    public void setBtnPosition(int btnPosition) {
        this.btnPosition = btnPosition;
    }
    public String getCorrectAns() {
        return correctAns;
    }
    public void setCorrectAns(String correctAns) {
        this.correctAns = correctAns;
    }
    public boolean isChecked() {
        return isChecked;
    }
    public void setChecked(boolean isChecked) {
        this.isChecked = isChecked;
    }
    public int getBtnId() {
        return btnId;
    }
    public void setBtnId(int btnId) {
        this.btnId = btnId;
    }
    public int getCurrentPosition() {
        return currentPosition;
    }
    public void setCurrentPosition(int currentPosition) {
        this.currentPosition = currentPosition;
    }

}

A: Solved it! Used SparseIntArray
Here is the complete code.
/**
 *
 */

package com.example.adapters;

import java.util.ArrayList;

import android.app.Activity;
import android.util.SparseIntArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.widget.TextView;
import android.widget.Toast;
import com.example.android.R;
import com.example.models.AnswerStateModel;
import com.example.utils.Config;

public class AnswerKeyAdapter extends ArrayAdapter<AnswerStateModel> {

    private Activity activity;
    private ArrayList<AnswerStateModel> mAnswerList;
    Toast t = null;
    private SparseIntArray mSpCheckedState=new SparseIntArray();

    public AnswerKeyAdapter(Activity activity, ArrayList<AnswerStateModel> mAnswerList) {
        super(activity, R.layout.row_item_answer_key, mAnswerList);
        this.activity = activity;
        this.mAnswerList = mAnswerList;
    }

    @Override
    public int getCount() {
        return mAnswerList.size();
    }

    @Override
    public AnswerStateModel getItem(int position) {
        return mAnswerList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        ViewHolder holder=null;
        if (convertView == null) {
            holder = new ViewHolder();
            convertView = LayoutInflater.from(activity).inflate(
                    R.layout.row_item_answer_key, parent, false);
            holder.lblAnswerId = (TextView) convertView.findViewById(R.id.lblAnswerId);
            holder.rdGroup = (RadioGroup) convertView.findViewById(R.id.rdGroup);
            holder.btnA = (RadioButton) convertView.findViewById(R.id.btnA);
            holder.btnB = (RadioButton) convertView.findViewById(R.id.btnB);
            holder.btnC = (RadioButton) convertView.findViewById(R.id.btnC);
            holder.btnD = (RadioButton) convertView.findViewById(R.id.btnD);
            holder.btnE = (RadioButton) convertView.findViewById(R.id.btnE);
            holder.btnWhat = (Button) convertView.findViewById(R.id.btnWhat);
            convertView.setTag(holder);

        } else {
            holder=(ViewHolder)convertView.getTag();
        }

        holder.rdGroup.setOnCheckedChangeListener(null);
        holder.rdGroup.clearCheck();

        Config.error("Spars "+mSpCheckedState.get(position));
        if(mSpCheckedState.indexOfKey(position)>-1){
            holder.rdGroup.check(mSpCheckedState.get(position));
        }else{
            holder.rdGroup.clearCheck();
        }

        holder.rdGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                if(checkedId>-1){
                    mSpCheckedState.put(position, checkedId);
                }else{
                    if(mSpCheckedState.indexOfKey(position)>-1)
                        mSpCheckedState.removeAt(mSpCheckedState.indexOfKey(position));
                }
            }
        });

        Config.error("Current Position " + position);
        holder.lblAnswerId.setText(position + 1 + "");

        holder.btnWhat.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (v.isSelected())
                    v.setSelected(false);
                else
                    v.setSelected(true);
            }
        });

        return convertView;
    }

    private static class ViewHolder {
        private TextView lblAnswerId;
        private RadioButton btnA;
        private RadioButton btnB;
        private RadioButton btnC;
        private RadioButton btnD;
        private RadioButton btnE;
        private RadioGroup rdGroup;
        private Button btnWhat;
    }

    void showToast(String text) {

        if (t != null)
            t.cancel();

        t = Toast.makeText(activity, text, Toast.LENGTH_SHORT);
        t.show();
    }
}


text:
Q: How to Display "No Items found" in a Datagrid                <dg:DataGrid.Resources>
                        <ViewModel:SmartMessenger  x:Key="Noitemsfound">
                        </ViewModel:SmartMessenger>
                      </dg:DataGrid.Resources>
                 <dg:DataGrid.RowDetailsTemplate>
                        <DataTemplate>
                          <StackPanel>`enter code here`
                            <TextBlock Text="{Binding Source={StaticResource         Noitemsfound }, Path=pNorecords,Mode=TwoWay}" />
                          </StackPanel>
                        </DataTemplate>
                 </dg:DataGrid.RowDetailsTemplate>

Here i am trying to bind  a textblock that will display a message when there are no items in the datagrid . I am using VS 2008 Express edition.
The problem is am not able to bind the property Noitemsfound with a code behind class  SmartMessenger  ... Whats missing here???

A: if you just want to display a message in your datagrid when there are no items - you can do this with a style. Put this style in your App.xaml Resources or at least in your datagrid Resources.
    <Style x:Key="{x:Type ItemsControl}" TargetType="{x:Type ItemsControl}">
    <Style.Triggers>
        <DataTrigger Binding="{Binding Items.Count, RelativeSource={RelativeSource Self}}" Value="0">
            <Setter Property="Background">
                <Setter.Value>
                    <VisualBrush Stretch="None">
                        <VisualBrush.Visual>
                            <TextBlock Text="no items"
                                       FontFamily="{StaticResource FontFamily}"
                                       FontSize="{StaticResource FontSize}"/>
                        </VisualBrush.Visual>
                    </VisualBrush>
                </Setter.Value>
            </Setter>
        </DataTrigger>
        <DataTrigger Binding="{Binding Items, RelativeSource={RelativeSource Self}}" Value="{x:Null}">
            <Setter Property="Background">
                <Setter.Value>
                    <VisualBrush Stretch="None">
                        <VisualBrush.Visual>
                            <TextBlock Text="no items"
                                       FontFamily="{StaticResource FontFamily}"
                                       FontSize="{StaticResource FontSize}"/>
                        </VisualBrush.Visual>
                    </VisualBrush>
                </Setter.Value>
            </Setter>
        </DataTrigger>
    </Style.Triggers>
</Style>
<Style x:Key="{x:Type DataGrid}" TargetType="{x:Type DataGrid}" BasedOn="{StaticResource {x:Type ItemsControl}}">
</Style>

A: Check output window. WPF dumps binding error/exception occurred to output windows. There you gets the chance to verify if it is binding to right source, if path is correct etc.
You can also try adding dummy converter in the binding expression. Converter provides you chance to debug binding expression


text:
Q: Is possible to use ActAs on other binding than ws2007FederationHttpBinding I have a web server and an application server. I need to populate "claim identiy" from web server to application server. Both servers are in my control and in same network.
I use CreateChannelWithIssuedToken method to populate claims. When I can use ws2007FederationHttpBinding and everything works fine.
But is it possible to use net.tcp or net.pipe for this?
I cannot figure how to configure bindings for these two.


text:
Q: I need an AS3 function that checks if I'm clicking on Text field My goal is:

*

*When I click on stage and text field do function.

*but I click on stage without text field do other function.

A: Subscribe for stage click events, and check, if target is your TextField:
private function setup():void {
    //For testing, some textField
    _textField = new TextField();
    _textField.text = "Some text here";
    _textField.x = _textField.y = 100;
    stage.addChild(_textField);
    //Your Event Listener
    stage.addEventListener(MouseEvent.CLICK, onClick);
}

private function onClick(e:MouseEvent):void {
    if (e.target == _textField) {
        trace("Clicked TextField");
    } else {
        trace("Clicked Somewhere");
    }
}


text:
Q: trying to get array back to list in a table Jquery - I am getting undefined but in the php is giving the response with my table information.
function formfill(dblist) {
    var tableheader = "

Database Nick	Database IP

";

    $('#table2').empty();
    $('#table2').append(tableheader);

    $.each(dblist, function (key, value) {
        $('#table2').append('
'
        + dblist['DBNick']
        + '	'
        + dblist['DBIP']
        + '	<input class="add" id="add" name="add" value="add" type="submit"></input>
');

    });
}

$('#userlist').on('change', function () {
    var selected = $('#userlist').val();

    console.log(selected);

    $.ajax({
        url: '/php/user/userdbtable.php',
        type: 'POST',
        data: { user: selected },
        success: function (data) {
            formfill(data)
        },
        error: function (xhr, status, err) { console.log(xhr, status, err); }
    });
});

Here is the php it is sending out the correct data but i cant figure out how to pull it from the object.
<?php
session_start();

include '../connect/anonconnect.php';

$myusername= $_POST['user'];

$useridsql = $dbh->prepare("SELECT * FROM Users WHERE UserLogin= :login");
$useridsql->execute(array(':login' => $myusername));
$useridsql = $useridsql->fetch();

$userid = $useridsql['idUser'];

$query = 'SELECT * FROM DBList  INNER JOIN UserDBList
    ON DBList.idDatabase = UserDBList.idDatabase ';//WHERE UserDBList.idUser = '.$userid;
$sql = $dbh->prepare($query);
$sql->bindParam(':username', $myusername, PDO::PARAM_STR, 12);
$sql->execute();
$user = $sql->fetchAll(PDO::FETCH_ASSOC);

if($sql->rowCount() == 1){
    header('Content-type: application/json');
    echo json_encode($user,JSON_FORCE_OBJECT);
}
else {
    echo 0;
}
?>

A: I think that your loop has an error.  It should look like this:
$.each(dblist, function (index, item) {
    $('#table2').append('
'
        + item['DBNick']
        + '	'
        + item['DBIP']
        + '	<input class="add" id="add" name="add" value="add" type="submit"></input>
');

});


text:
Q: How to convert a string containing a number into GB/s I wanted to convert a byte value into GB/s using C. For instance, value in bytes is "11,584,000,000".
Tried this convert it to MB/s using the following:
   (11,584,000,000 >> 20) to convert to MB/s .i.e 11047 MB/s

but as per an online calculator, it should be 11584 MB/S or 11.584 GB/s, what is the right to do it?

A: There are two types of sizes.
Gigabyte (power of ten) and gibibyte (power of two).
You have created the power of two with the bit shift, which is also the technical size.
1000MB are 1GB but 1024MiB are 1GiB.
Disk drive (SSD) manufacturers like to quote GB because it makes their disks seem bigger.


text:
Q: Using a PeriodIndex to slice a pandas series I have a few pandas series with PeriodIndex of varying frequency. I'd like to filter these based on another PeriodIndex of which the frequency is in principle unknown (specified directly in the example below as selectionA or selectionB, but in practice stripped from another series).
I've found 3 approaches, each with its own downside, shown in the example below. Is there a better way?
import numpy as np
import pandas as pd

y = pd.Series(np.random.random(4),  index=pd.period_range('2018', '2021', freq='A'), name='speed')
q = pd.Series(np.random.random(16), index=pd.period_range('2018Q1', '2021Q4', freq='Q'), name='speed')
m = pd.Series(np.random.random(48), index=pd.period_range('2018-01', '2021-12', freq='M'), name='speed')

selectionA = pd.period_range('2018Q3', '2020Q2', freq='Q') #subset of y, q, and m
selectionB = pd.period_range('2014Q3', '2015Q2', freq='Q') #not subset of y, q, and m

#Comparing some options:
#1: filter method
#2: slicing
#3: selection based on boolean comparison

#1: problem when frequencies unequal: always returns empty series
yA_1 = y.filter(selectionA, axis=0) #Fail: empty series
qA_1 = q.filter(selectionA, axis=0)
mA_1 = m.filter(selectionA, axis=0) #Fail: empty series
yB_1 = y.filter(selectionB, axis=0)
qB_1 = q.filter(selectionB, axis=0)
mB_1 = m.filter(selectionB, axis=0)

#2: problem when frequencies unequal: wrong selection and error instead of empty result
yA_2 = y[selectionA[0]:selectionA[-1]]
qA_2 = q[selectionA[0]:selectionA[-1]]
mA_2 = m[selectionA[0]:selectionA[-1]] #Fail: selects 22 months instead of 24
yB_2 = y[selectionB[0]:selectionB[-1]] #Fail: error
qB_2 = q[selectionB[0]:selectionB[-1]]
mB_2 = m[selectionB[0]:selectionB[-1]] #Fail: error

#3: works, but very verbose
yA_3 =y[(y.index >= selectionA[0].start_time) & (y.index <= selectionA[-1].end_time)]
qA_3 =q[(q.index >= selectionA[0].start_time) & (q.index <= selectionA[-1].end_time)]
mA_3 =m[(m.index >= selectionA[0].start_time) & (m.index <= selectionA[-1].end_time)]
yB_3 =y[(y.index >= selectionB[0].start_time) & (y.index <= selectionB[-1].end_time)]
qB_3 =q[(q.index >= selectionB[0].start_time) & (q.index <= selectionB[-1].end_time)]
mB_3 =m[(m.index >= selectionB[0].start_time) & (m.index <= selectionB[-1].end_time)]

Many thanks

A: I've solved it by adding start_time and end_time to the slice range:
yA_2fixed = y[selectionA[0].start_time: selectionA[-1].end_time]
qA_2fixed = q[selectionA[0].start_time: selectionA[-1].end_time]
mA_2fixed = m[selectionA[0].start_time: selectionA[-1].end_time] #now has 24 rows
yB_2fixed = y[selectionB[0].start_time: selectionB[-1].end_time] #doesn't fail; returns empty series
qB_2fixed = q[selectionB[0].start_time: selectionB[-1].end_time]
mB_2fixed = m[selectionB[0].start_time: selectionB[-1].end_time] #doesn't fail; returns empty series

But if there's a more concise way to write this, I'm still all ears. I especially would like to know if it's possible to do this filtering in a way that is more 'native' to the PeriodIndex, i.e., not converting it into datetime instances first with the start_time and end_time attributes.


text:
Q: Shiny reactivity with unused argument I'm new to R/Shiny, and am trying to get my head around reactivity. Both this article and this video have been helpful resources so far, but I've bumped up against something I don't quite understand.
Here's a simplified version of the code I was running.
library(shiny)

some_func <- function(some_input, unused_argument) {
  print("Running - you changed something")
  if (some_input) {1} else {-1}
}

ui <- fluidPage(
  checkboxInput("negative", "Clicking makes all values negative"),
  checkboxInput("negative_pt2", "I thought clicking would not change results
                                 other than writing to the console,
                                 but it does not even do that."),
  plotOutput("graphs")
)

server <- function(input, output) {
  library(ggplot2)

  output$graphs <- renderPlot({
    dataset2 <- reactive({mtcars * some_func(input$negative, input$negative_pt2)})
    ggplot(dataset2(), aes(x = mpg, y = hp)) + geom_line()
  })
}

shinyApp(ui = ui, server = server)

Checking the first box has the expected results. But viewing the console when checking the second one shows that Shiny is clever enough to realize that my unused argument is useless. This is great, but how does it know to do this?
Thanks!

A: You are not calling the second argument within your function, therefore it will not do anything
I can write a function that requires the user to input a million variables, but If I do not call them whitin the function itself, they will never be used
some_func <- function(some_input, unused_argument) {
  print("Running - you changed something")
  if (some_input) {1} else {-1}
  }

.....
some_func(input$negative, input$negative_pt2)

Yes, the variable is placed in the function in the unused argument spot, but then it's never used, so it just sits around.
If we change our function to do something with the variable it collects, then we would have a change.
some_func <- function(some_input, unused_argument) {
  print("Running - you changed something")
  if (some_input) {1} else {**unused_argument**}

  }

Shiny is assigning a value to negative_pt2, but you never say, "hey, do something based off that variable", so it just sits around.
Moral of the story, you not only need to take in variables, but also use them in the function for them to have an effect.


text:
Q: Codeigniter Category and Sub Categories Only Show Last Category and Sub Categories I want to show room type and rooms number inside it
example:
room type #1

*

*room number 1

*room number 2

*room number 3

*room number 4

room type #2

*

*room number 1

*room number 2

*room number 3

*room number 4

and so on.
this is my table
room_type
-------
room_type_id (int)
room_type_name (varchar)
room_price (float)
room_detail (text)

room
-------
room_e_id (int)
room_type_id (int)
room_number (int)
room_status (varchar)

Here's my Model
function get_room_type() {
    $query = $this->db->get('room_type');
    $return = array();
    foreach ($query->result() as $room) {
        $return['$room->room_type_id'] = $room;
        $return['$room->room_type_id'] -> subs = $this->get_room_list($room->room_type_id);
    } return $return;
}

public function get_room_list($room_type_id) {
    $this->db->where('room_type_id', $room_type_id);
    $query = $this->db->get('room');
    return $query->result();
}

And this is my Controller
$data['room_list'] = $this->m_fo->get_room_type();

And view

<?php foreach ($room_list as $row) { ?>

  <?php echo $row->room_type; ?> <?php
   if (!empty($row->subs)) {
   echo '
';
   foreach ($row->subs as $sub) {
    echo '
' . $sub->room_no . ' - ' . $sub->room_status . '
';
    } echo '
';
   }
  ?>

 <?php } ?>

but it's only show the last room type and room number in my page as you can see here -- screenshot
is anything wrong or less?
Thanks You

A: Inside the single quotes everything consider as string so you should change these two lines like this .
 $return[$room->room_type_id]->rooms = $room;
 $return[$room->room_type_id]->subs = $this->get_room_list($room->room_type_id);


text:
Q: How to correct labels for boxplot get the p-values at each pair in in R I have a sample of the data as follows:

df <- tribble(
    ~capacity1, ~capacity2, ~capacity3, ~capacity4, ~capacity5, ~capacity6, ~capacity7, ~capapcity8,
    75, 88, 85, 71, 98, 76, 71, 57,
    80, 51, 84, 72, 59, 81, 70, 64,
    54, 65, 90, 66, 93, 88, 77, 59,
    59, 87, 94, 75, 74, 53, 56, 87,
    52, 55, 64, 77, 50, 64, 83, 87,
    33,22,66,67,99,87,40,90,)

I want to get the following graph.

As you can see, capacity 1 goes with capacity2 and produce one label as Capacity1. capacity 3 with capacity4= Capapcity2, capacity5 and capacity6=Capaccity3 and capacity 7 with capacity8= Capacity4. Next, I would like to get p-values. That would be good if we could order each pair of boxes ( e.g., capacity1 with capacity2= Capacity1).

A: If we need pairwise plots, we can split into a list of datasets for each pair of columns, then use ggboxplot from ggpubr
library(dplyr)
library(tidyr)
library(purrr)
library(patchwork)
library(rstatix)
library(ggpubr)
lst1 <- df %>%
        # // split every 2 columns
        split.default(as.integer(gl(ncol(.), 2, ncol(.)))) %>%
        # // loop over the list
        map(~ {
          # // reshape to long format
           dat <- pivot_longer(.x, everything())
           # // get the t.test p value
           stat_test <- dat %>%
                         t_test(value ~ name)%>%
                         adjust_pvalue(method = "bonferroni") %>%
                         add_significance("p.adj") %>%
                         add_xy_position(x = "name")
        # // create the boxplot
        ggboxplot(dat, x = 'name', y = 'value')+
                   stat_pvalue_manual(stat_test,
                        label = "p.adj", tip.length = 0.01)
        })

Now, we wrap the list of plots with wrap_plots from patchwork
wrap_plots(lst1)

-output

A: Try this approach. Your data is in wide format. First you have to transform to long using pivot_longer(). After that you can use ggplot2 to sketch the plot with geom_boxplot(). In order to add p-values you need to define the proper test and using stat_compare_means(). Here the code using t.test:
library(ggplot2)
library(dplyr)
library(tidyr)
#Code
df %>% pivot_longer(everything()) %>%
  ggplot(aes(x=name,y=value,fill=name,group=name))+
  geom_boxplot()+
  stat_compare_means(label = "p", method = "t.test",
                     ref.group = ".all.")+
  labs(fill='Variable')

Output:

For grouping:
#Data for groups
groups <- data.frame(name=c("capacity1", "capacity2", "capacity3", "capacity4", "capacity5",
                            "capacity6", "capacity7", "capapcity8"),
                     group=paste0('Group.',c(1,1,2,2,3,3,4,4)),stringsAsFactors = F)
    #Code
    df %>% pivot_longer(everything()) %>%
      left_join(groups) %>%
      ggplot(aes(x=name,y=value,fill=name,group=name))+
      geom_boxplot()+
      facet_wrap(.~group,scales = 'free',nrow = 1,strip.position = 'bottom')+
      labs(fill='Variable')+
      theme(strip.placement = 'outside',strip.background = element_blank(),
            legend.position = 'none')

Output:


text:
Q: Avoid ImageView from scaling inside a TableRow Ive got a ImageView inside a TableRow as shown in the xml below. My problem is when ever the row height changes the image would scale up. How do I avoid this ?
I have tried programmatically setting LinearLayout.LayoutParams to no avail. Also tried setting the maxWidth of ImageView as well.
I should also mention I have fixed the header of the table by using the class (using onLayout) as given below.
<?xml version="1.0" encoding="utf-8"?>
<TableRow
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/trTransationTableRow"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <com.ui.components.CustomTextView
        android:id="@+id/tvTRCol1"
        style="@style/transaction_table_row"
        android:layout_width="0dp"
        android:gravity="left|center_vertical"
        android:layout_weight="0.2"/>

    <com.ui.components.CustomTextView
        android:id="@+id/tvTRCol2"
        style="@style/transaction_table_row"
        android:layout_width="0dp"
        android:singleLine="false"
        android:layout_weight="0.4"/>

    <ImageView
        android:id="@+id/ivTRCol3"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        android:paddingTop="5dp"
        android:paddingBottom="5dp"
        android:layout_weight="0.2"
        android:maxWidth="10dp"
        android:adjustViewBounds="true"
        android:background="@drawable/table_row_border"/>

    <com.ui.components.CustomTextView
        android:id="@+id/tvTRCol4"
        style="@style/transaction_table_row"
        android:layout_width="0dp"
        android:gravity="right|center_vertical"
        android:layout_weight="0.2"/>

</TableRow>

Scrollable table layout class:
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {

    super.onLayout(changed, l, t, r, b);

    List<Integer> colWidths = new LinkedList<Integer>();

    TableLayout header = (TableLayout) findViewById(R.id.tlScrollingTableHeader);
    TableLayout body = (TableLayout) findViewById(R.id.tlScrollingTableBody);

    // Measure content width first
    for (int rownum = 0; rownum < body.getChildCount(); rownum++) {
        TableRow row = (TableRow) body.getChildAt(rownum);
        int countCells = 0;
        for (int cellnum = 0; cellnum < row.getChildCount(); cellnum++) {
            View cell = row.getChildAt(cellnum);
            if (cell.getVisibility() == VISIBLE) {
                Integer cellWidth = cell.getWidth();
                if (colWidths.size() <= countCells) {
                    colWidths.add(cellWidth);
                } else {
                    Integer current = colWidths.get(countCells);
                    if (cellWidth > current) {
                        colWidths.remove(countCells);
                        colWidths.add(countCells, cellWidth);
                    }
                }
                countCells++;
            }
        }
    }

    // Figure out if header needs resizing first based on widths
    TableRow headerRow = (TableRow) header.getChildAt(0);
    for (int count = 0; count < colWidths.size(); count++) {
        if (headerRow.getChildAt(count).getWidth() >= colWidths.get(count)) {
            colWidths.remove(count);
            colWidths.add(count, headerRow.getChildAt(count).getWidth());
        }
    }

    // Then apply to header
    if (colWidths.size() == 4) {
        for (int cellnum = 0; cellnum < headerRow.getChildCount(); cellnum++) {
            View cell = headerRow.getChildAt(cellnum);
            TableRow.LayoutParams params = (TableRow.LayoutParams) cell.getLayoutParams();
            params.width = colWidths.get(cellnum);
        }
    }
}

A: After a little bit of trial and error I found the solution as below. The magic is behind scaleType="centerInside" but need to make sure both layout_width and layout_height are set to wrap_content. I also have LinearLayout to get stuff like background working. Hope this helps someone
<LinearLayout
    android:id="@+id/llTRCol3"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="0.2"
    android:gravity="center"
    android:visibility="gone"
    android:background="@drawable/table_row_border">
    <ImageView
        android:id="@+id/ivTRCol3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:paddingTop="5dp"
        android:paddingBottom="5dp"
        android:scaleType="centerInside"/>
</LinearLayout>


text:
Q: Conduct multivariate regression on every nth row of dataframe in R I have a dataframe with 376 columns and 2700 rows, with 270 rows corresponding to each subject (hence, there are 10 subjects in this case). Every 270 rows are a single subject's data (i.e 1:270 - subject 1; 271:540 - subject 2).
I have a separate dataframe (2700 x 8) with my independent variables, once again 270 rows per subject.
I'm looking to regress out the 8 IVs from my 376 DVs and obtain the residuals. The tricky part for me here is that I want to conduct the regression separately per subject (i.e a separate regression for every 270 rows). Here is some simulated data below:
DV = matrix(rnorm(2700*376),ncol=376) #construct matrix for dependent variables

IV =  matrix(rnorm(2700*8),ncol=8) #matrix for independent variables

To obtain the residuals from the data as a whole, I would simply do
resid = residuals(lm(DV~IV))

But how would I adapt this to make it so that the regression is done per subject (for every 270 rows)? Is it easier if my IV and DV data frames were combined?
I'm new to R and any help is much appreciated, thank you.

A: A suggestion using a for loop and base R:
result_list <- NULL
first <- 1
for (i in 1:10) {
  last <- i * 270
  this_subjects_results <- residuals(lm(DV[first:last,] ~ IV[first:last,]))
  result_list <- list(result_list, this_subjects_results)
  first <- last + 1
}


text:
Q: Are the primitive groups linearly primitive? A transitive permutation group $G \subset S_n$ is primitive if $G_1 \subset G$ is a maximal subgroup.
A finite group $G$ is linearly primitive if it has a faithful complex irreducible representation.
Question: Are the primitive finite groups linearly primitive?
Remark: I've checked by a GAP computation that it's true for $n=[G:G_1] \le 200$ and $\vert G \vert \le 10^4$.

A: Yes. The O'Nan-Scott Theorem classifies finite primitive groups into a number of different types, such as affine type, almost simple type, product type, etc. The groups in all but one of these types have a unique minimal normal subgroup $N$, which implies that they are linearly primitive, since the kernel of any unfaithful representation must contain $N$, and so any faithful representation must have an irreducible constituent whose kernel does not contain $N$ and is consequently faithful.
The groups $G$ in the remaining type have two isomorphic minimal normal subgroups $N_1$ and $N_2$, both of which are direct products of one or more isomorphic nonabelian simple groups. The smallest such example is $A_5 \times A_5$ acting on the cosets of a diagonal subgroup.
But direct products of nonabelian simple groups are linearly primitive, because the tensor product of nontrivial irreducible representations of their direct factors is a faithful irreducible representation. So $N_1 \times N_2$ has a faithful irreducible representation $\rho$ and any irreducible constituent of the induced representation $\rho^G$ is faithful for $G$.

A: Yes, the following is a short self-contained proof:
Let $G \subset S_n$ be a primitive permutation group; by definition $G_1$ is a core-free maximal subgroup of $G$.  Let $V$ be a non-trivial irreducible complex representation of $G$ such that the fixed point subspace  $V^{G_1} \neq 0$ (such a $V$ exists, see the comment).  By construction $G_1 \subset G_{(V^{G_1})} $ but by maximality $G_{(V^{G_1})} = G_1$ or $G$, if it is $G$ then $V^{G_1} = 0$ contradiction, so it is $G_1$.  Now $K=ker(\pi_V) \subset G_{(V^{G_1})} = G_1$, but $G_1$ is core-free in $G$ and $K$ is a normal subgroup of $G$. It follows that $K=\{ e \}$ and so $G$ is linearly primitive.  $\square$


text:
Q: img, empty src make influance on php working in IE? i hate situations, when i can't explain the behavior of compiler. So help me please to understand, how it possible...
i have two php files - index.php, and admin.php. in index.php i make registration, and captcha checking, and if they are correct, i set the value of session variable to somevalue,(at first it has anothervalue) and redirect client to admin.php where the CMS is!
And now, what is the problem, i have a module in admin.php which has an img element, src of which i generate when it clicked(using jquery...), but at first it has src empty
 and due to it, i lose the new value of session variable(it becomes anothervalue again). IT happens only in IE!!!
BUT if i set any value to src attribute, it works fine!!!
 works fine
help me please to understund such behavior

A: The URI "" resolves to the current URI. So the browser tries to load the page it is currently on as an image (and all the associated PHP is run again).
Don't set images with an empty src attribute.

A: If the src attribute is empty, IE makes a request to the directory in which the current page is located. Since this is probably handled by index.php, it would seem that that's the script responsible for changing the session variable.
Long story short: don't use an emptry src attribute.


text:
Q: Turn on Anonymous blog comments I've created an anonymous blog subsite.  My root site is also anonymous.  I can access default.aspx anonymously, but not /Lists/Posts/Post.aspx?ID=1
I've tried breaking permission inheritance and have tried toggling on all anonymous access options within the Comments list and even the Posts list.  When navigating to these lists, I get a 401 Unauthorized error message.
Am I missing something?

A: Below is the solution, however the issue of anonymous users being able to see draft items has cropped up...
SPList list = curWeb.Lists["Comments"];
// check if it has unique permissions
if (!list.HasUniqueRoleAssignments)
{
    list.BreakRoleInheritance(true);
}
// make sure people logged in can edit their own items
list.WriteSecurity = 2;
// turn on moderation
list.EnableModeration = true;
list.DraftVersionVisibility = DraftVisibilityType.Approver;
// grant permissions to anonymous users
list.AnonymousPermMask64 =
  (SPBasePermissions.Open |
   SPBasePermissions.OpenItems |
   SPBasePermissions.ViewFormPages |
   SPBasePermissions.ViewListItems |
   SPBasePermissions.AddListItems);
list.Update();


text:
Q: How do I add class to sidebar on $_GET I got a problem to get correct class to my sidebar.
function sidebar_class($var)
{
    if (isset($_GET['page']) == $var )
    echo ' class="selected"';
}

My URL will looks like
http://domain.com/index.php?go=users
http://domain.com/index.php?go=settings
http://domain.com/index.php?go=backup

My sidebar

 <li<?php sidebar_class('users'); ?>>Users

 <li<?php sidebar_class('settings'); ?>>Settings

 <li<?php sidebar_class('backup'); ?>>Backup

Now all my sidebar class being
. How to fix it?

A: wrong function... try:
function sidebar_class($var)
{
    if (isset($_GET['go']) && $_GET['go'] == $var )
        echo ' class="selected"';
}

A: Do you want to check value of go instead of page. right?
function sidebar_class($var)
{
    if (isset($_GET['go']) == $var )
    echo ' class="selected"';
}


text:
Q: why SqlDataAdapter.InsertCommand needs another SqlConnection? If I create a
SqlDataAdapter adapterSales = new SqlDataAdapter (mySelectCommand, connString)

and then I create the insert command for the adapter lets say
adapterSales.InsertCommand = new SqlCommand (myInsertCommand);

Why do I need to pass another connection to the last constructor? I mean if I already passed the connection string why the adapter doesn't work with that to create the sql connection that I'm going to be working with?

A: It is the command objects (select, insert, update, delete) that need the connection.  The data adapter itself doesn't actually have a specific connection directly associated with it.  Using Reflector, I see that the following are the members of SqlDataAdapter (no connection object directly in it):
// Fields
private SqlCommandSet _commandSet;
private SqlCommand _deleteCommand;
private SqlCommand _insertCommand;
private SqlCommand _selectCommand;
private int _updateBatchSize;
private SqlCommand _updateCommand;
private static readonly object EventRowUpdated;
private static readonly object EventRowUpdating;

So, in theory, you could use a different connection with each command associated with the data adapter, but it is not obvious that there would be many uses for that scenario (maybe dealing with two database where one is read only and updates are sent to the other).

A: It's the parameter needed by SqlCommand constructor, AFAIR InsertCommand could be created automatically from select command then you don't need this duplication even for defining the InsertCommand.
From MSDN

if primary key information is present in the DataSet, the InsertCommand
  can be generated automatically if you set the SelectCommand property
  and use the SqlCommandBuilder.

A: as MSDN states it   SqlDataAdapter

the InsertCommand can be generated automatically if you set the SelectCommand property and use the SqlCommandBuilder.
When InsertCommand is assigned to a previously created SqlCommand, the
SqlCommand is not cloned. The InsertCommand maintains a reference to
the previously created SqlCommand object.

Ecah command object, associated with connection, so every time it needs info about the command object to perform operation.


text:
Q: Can NSProxy stand in for NSView subclasses? I've tried a simple test which results in EXC_BAD_ACCESS error:
#import "AppDelegate.h"

@interface CrashingProxy : NSProxy
@property (strong) id target;
- (instancetype)initWithTarget:(id)targetObj;
@end

@implementation CrashingProxy
@synthesize target;
- (instancetype)initWithTarget:(id)targetObj {
    [self setTarget:targetObj];
    return self;
}
- (void)forwardInvocation:(NSInvocation *)invocation {
    [invocation invokeWithTarget:[self target]];
}
- (NSMethodSignature *)methodSignatureForSelector:(SEL)selector {
    return [[self target] methodSignatureForSelector:selector];
}
@end

@interface AppDelegate ()
@property (weak) IBOutlet NSWindow *window;
@end

@implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
    NSButton *button = [[NSButton alloc] initWithFrame:NSMakeRect(20.0, 20.0, 100.0, 32.0)];
    [button setButtonType:NSButtonTypeMomentaryLight];
    [button setTitle:@"Hello"];
    [[[self window] contentView] addSubview:[[CrashingProxy alloc] initWithTarget:button]];
}
@end

Is there something wrong with this test, or is there a fundamental reason why NSView subclasses cannot be used with NSProxy?
Error details:
Thread 1: EXC_BAD_ACCESS (code=1, address=0xc)
at [NSView addSubview:]


text:
Q: ILPlotPanel Component in UserControl I'm having a problem trying to embed an ILPlotPanel inside a
UserControl which will be used as a COM Component, and will be imported by
a third part software.
I can put the ILPanel, but it don't render nothing (keeps the design mode visualization).
In another hand the ILPlotPanel gives me a error while trying do click and drag it (VS2010) to
a empty UserControl.
Here's the given error:

So the problems are:
1°. ILPanel don't render scenes while hosted by another application.
2º. In VS2010, can't click and drag the ILPlotPanel to a UserControl.
So anyone have a clue on this issues?
Thanks.

A: Try the ILNumerics.Settings.IsHosted property! You can set it via code (if your Host allows it early enough) or via configuration (by using the key ILNIsHosted).


text:
Q: MetaPost vardef: how to declare a variable of type 'expr'? I want to make a macro swap:
vardef swap(expr a, b) =
save tmp;
expr tmp;
tmp := a;
a := b;
b := tmp;
enddef;

But there is an error when compilating:
! A statement can't begin with `expr'.

I thought I could declare a tmp variable of type expr... I intended to swap variables of different types.

A: There is no expr variable type. You want suffix a,b, not expr. And you need to declare tmp to be the same type as a (or b, of course).
vardef swap(suffix a,b)=
  save tmp;
  if numeric a: numeric tmp;
  elseif pair a: pair tmp;
  elseif path a: pair tmp;
  elseif transform a: transform tmp;
  elseif color a: color tmp;
  elseif cmykcolor a: cmykcolor tmp;
  elseif string a: string tmp;
  elseif boolean a: boolean tmp;
  elseif picture a: picture tmp;
  elseif pen a: pen tmp;
  fi
  tmp:=b;
  b:=a;
  a:=tmp;
enddef;

pair u;u=(1,0);
pair v;v=(0,1);

swap(u,v);

show u;show v;

end

Console output:
This is MetaPost, version 2.01 (TeX Live 2021) (kpathsea version 6.3.3)
(/usr/local/texlive/2021/texmf-dist/metapost/base/mpost.mp
(/usr/local/texlive/2021/texmf-dist/metapost/base/plain.mp
Preloading the plain mem file, version 1.005) ) (./swap.mp
>> (0,1)
>> (1,0) )
Transcript written on swap.log.


text:
Q: ScriptResource.axd with MbCompression I'm using MbCompression library and I'm want to know - does MbCompression minifies ScriptResource.axd? And are there any tools that can minimify ScriptResource.axd at runtime with minimum changes to web.config?

A: I'm not familiar with MbCompression, but do take a look at RequestReduce. This is an OSS project of mine and I believe it does exactly what you want: minifies/combines css and javascript at runtime. Unlike other frameworks, RequestReduce requires no code changes, no rearrangement of scripts and css and VERY little config. All the config necessary is to add the module. Here is all you really need in your config:
<system.web>
 <httpModules>
  <add name="RequestReduce" type="RequestReduce.Module.RequestReduceModule, RequestReduce"/>
 </httpModules>
</system.web>
<system.webServer>
 <modules>
  <validation validateIntegratedModeConfiguration="false"/>
  <add name="RequestReduce" type="RequestReduce.Module.RequestReduceModule, RequestReduce"/>
 </modules>
</system.webServer>

That's it and no extra code. There are a bunch of options you have access to to turn various things on and off and configure cache syncing across multiple servers or include a CDN host in your urls. But for an out of the box solution, just the above should be necessary.
It will look for any script url and will minify it and merge it with adjacent script tag contents as long as the following are true:

*

*The mime type of the url is a valid javascript mime type. So ScriptResources and WebResources should be caught.

*The url does not have a no-cache or no-store cache-control header.

*The url does not have a max-age or expires header less than a week.

I have heard accounts of people complaining that webresource.axd or scriptresource.axd get sent to the browser with no-cache set. This may not be an issue for you but if you see this happening and the lack of caching is not intentional, you can add this to your web.config:
<staticContent>
      <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="180.00:00:00" cacheControlCustom="public" />
</staticContent>

In addition, it can automatically sprite any background images, optimize their PNG compression and it uses best practices when serving cache headers for its cached css/javascript/sprites.
This framework is currently used at Microsoft by MSDN and Technet galleries.
You can either install via Nuget (suggested) or download from http://www.requestreduce.com.


text:
Q: PDFs included by XeLaTeX are rotated When I include an image in pdf format, the image in the file is normal when compiling with pdfLaTeX, but it is rotated counterclockwise 90 degree when using XeLaTeX. The questions are:

*

*Why?

*How to avoid this? I don't mean using the option of angle=-90 of the command \includegraphics.

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics{impact1}
\end{document}

A: Some softwares produce PDF images including Rotate PDF primitive. But XeTeX doesn't support Rotate PDF primitive now. That's the prolem.
Solution: Just do some preprocessing. e.g.
pdfcrop foo.pdf foo-new.pdf

and include the foo-new.pdf.


text:
Q: Page Title Search SharePoint 2013 How can Page titles of the pages across the site collection become search key so that the result shows only matching pages and no other content? Can be done by merging two result sources, or how can I achieve this?

A: If I understand your situation correctly you can add a filter to the Search Results webpart on your search page.

*

*Put the page in Edit mode, then Click the upper right corner of the Search Results Webpart and click "Edit WebPart"

*Click "Change Query" in the properties section

*In the "Query text" box, copy paste this: (contentclass:"STS_ListItem_850" OR contentclass:"STS_ListItem_WebPageLibrary" OR contentclass:"STS_Web") Title:{SearchBoxQuery}

*Click OK, Save, And Publish the page.
If you do a search now your webpart will show you publishing pages and webs that has a title matching the text put in the search box.
If you want to get hits on all properties, replace Title:{SearchBoxQuery} with {SearchBoxQuery}, it will still only show you pages and webs


text:
Q: Unable to read PDF using itextpdf I am using itextpdf-5.5.4 jar to merge or add two pdf into one PDF.
I did not get any error or exception while running code but displayed below text in Merged PDF. I did not get below text when i open individual PDF's.

The document you are trying to load requires Adobe Reader 8 or higher.
  You may not have the Adobe Reader installed or your viewing
  environment may not be properly configured to use Adobe Reader.
For information on how to install Adobe Reader and configure your
  viewing environment please see
  http://www.adobe.com/go/pdf_forms_configure.

void mergePdfFiles(List<InputStream> inputPdfList, OutputStream outputStream) throws Exception {
    // Create document and pdfReader objects.
    Document document = new Document();
    List<PdfReader> readers = new ArrayList<PdfReader>();
    int totalPages = 0;
    // Create pdf Iterator object using inputPdfList.
    Iterator<InputStream> pdfIterator = inputPdfList.iterator();

    // Create reader list for the input pdf files.
    while (pdfIterator.hasNext()) {
        InputStream pdf = pdfIterator.next();
        PdfReader pdfReader = new PdfReader(pdf);
        readers.add(pdfReader);
        totalPages = totalPages + pdfReader.getNumberOfPages();
    }

    // Create writer for the outputStream
    PdfWriter writer = PdfWriter.getInstance(document, outputStream);

    // Open document.
    document.open();

    // Contain the pdf data.
    PdfContentByte pageContentByte = writer.getDirectContent();

    PdfImportedPage pdfImportedPage;
    int currentPdfReaderPage = 1;
    Iterator<PdfReader> iteratorPDFReader = readers.iterator();

    // Iterate and process the reader list.
    while (iteratorPDFReader.hasNext()) {
        PdfReader pdfReader = iteratorPDFReader.next();
        // Create page and add content.
        while (currentPdfReaderPage <= pdfReader.getNumberOfPages()) {
            document.newPage();
            pdfImportedPage = writer.getImportedPage(pdfReader, currentPdfReaderPage);
            pageContentByte.addTemplate(pdfImportedPage, 0, 0);
            currentPdfReaderPage++;
        }
        currentPdfReaderPage = 1;
    }

    // Close document and outputStream.
    outputStream.flush();
    document.close();
    outputStream.close();

    System.out.println("Pdf files merged successfully.");
}

public static void main(String args[]) {
    try {
        List<InputStream> inputPdfList = new ArrayList<InputStream>();
        inputPdfList.add(new FileInputStream("pdf1.pdf"));
        inputPdfList.add(new FileInputStream("pdf2.pdf"));
        OutputStream outputStream = new FileOutputStream("Merge-PDF.pdf");
        ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
        mergePdfFiles(inputPdfList, byteStream);
        byte[] byteS = byteStream.toByteArray();
        outputStream.write(byteS);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

Please help me out on this.


text:
Q: Difference in seconds between two TDateTime variables Looking for a code sample that returns the difference in seconds between two TDateTime values.    Specifically, I am trying to compare two TDateTime values and if greater than a second threshold it will run a specific method.
Thanks!

A: Try the SecondsBetween function which is part of the DateUtils unit.
Sample of use
SecondsBetween(Now, IncSecond(Now,10))

Will return 10

A: Call SecondsBetween from the DateUtils unit. For example:
Assert(SecondsBetween(MyAnswer, RRUZsAnswer)=7)


text:
Q: Python List of random number with difference of 2 between them Help me creating a python list of random numbers between 0 to 100, with every succeeding number having a difference of 2 between them.

A: You have an Explanation here:
Create random sequence of integers within a range and with a minimum distance between them
Just modify these parameters to match your case:
n = 5
limit = 20
mingap = 3
slack = 20 - mingap * (n - 1)


text:
Q: Get hex colors of discrete colorbar I have the following colorbar :
from matplotlib import cm

cmap = matplotlib.cm.Blues
bounds = [0, 500, 1000, 1500, 2000, 2500]
norm = matplotlib.colors.BoundaryNorm(bounds, cmap.N , extend = 'max')
plt.colorbar(matplotlib.cm.ScalarMappable(norm=norm, cmap=cmap), orientation='vertical')

Is there a way to get the hex codes of the six colors generated?
Thanks!

A: The norm object has a property boundaries - normalise those to the original cmap range, then cmap can convert those to RGBA 4-tuples, and then you can call matplotlib.colors.rgb2hex. Putting it all into a list comprehension gets you:
[matplotlib.colors.rgb2hex(cmap(norm(c))) for c in norm.boundaries]

Result:
['#f7fbff', '#d0e1f2', '#94c4df', '#4a98c9', '#1764ab', '#08306b']

A: You could save the file as a JPG or PNG using the savefig() function in matplotlib. To find the hex codes, you can input the PIL library. The function PIL.ImageColor.getrgb() could then be used. (Of course, you first would have to use from PIL import ImageColor).


text:
Q: Find all vectors orthogonal to two parallel vectors
Find all vectors $\vec{v}=\begin{bmatrix}x\\y\\z\end{bmatrix}$ orthogonal to both $\vec{u_1}=\begin{bmatrix}2\\0\\-1\end{bmatrix}$ and $\vec{u_2}=\begin{bmatrix}-4\\0\\2\end{bmatrix}$

$\vec{u_1}$ and $\vec{u_2}$ are parallel, so the cross product will be $\vec{0}$. This won't help. The other thing I tried was based on the dot product, so:
$\vec{u_1}\cdot\vec{v}=0\\
\vec{u_2}\cdot\vec{v}=0$
leading to the system of equations:
$2x-z=0\\-4x+2z=0$
and then
$\vec{v}=s\begin{bmatrix}1\\0\\2\end{bmatrix}+t\begin{bmatrix}0\\1\\0\end{bmatrix}$
which makes sense to me because the orthogonal vectors would "rotate" around $\vec{u_1}$ and $\vec{u_2}$ in infinitely many directions.

A: Here, it's sufficient to use the triple product equal to 0. However, your method should be satisfying.

A: Note that actually your two equations are the same equation. (Divide the second one by $-4$.) So you have
$$ 2x-z=0 $$
as your constraint, so any vector parallel to
$$ \begin{pmatrix} 1 \\ 0 \\ 2 \end{pmatrix} $$
will be orthogonal to both vectors (as will any with just a $y$ component, and by linearity, any linear combination thereof).


text:
Q: How to create byte[] with length 16 using FromBase64String I have a requirement to create a byte[] with length 16. (A byte array that has 128 bit to be used as Key in AES encryption).
Following is a valid string
"AAECAwQFBgcICQoLDA0ODw=="

What is the algorithm that determines whether a string will be 128 bit? Or is trial and error the only way to create such 128 bit strings?
CODE
    static void Main(string[] args)
    {
        string firstString = "AAECAwQFBgcICQoLDA0ODw=="; //String Length = 24
        string secondString = "ABCDEFGHIJKLMNOPQRSTUVWX"; //String Length = 24
        int test = secondString.Length;

        byte[] firstByteArray = Convert.FromBase64String((firstString));
        byte[] secondByteArray = Convert.FromBase64String((secondString));

        int firstLength = firstByteArray.Length;
        int secondLength = secondByteArray.Length;

        Console.WriteLine("First Length: " + firstLength.ToString());
        Console.WriteLine("Second Length: " + secondLength.ToString());

        Console.ReadLine();
    }

Findings:
For 256 bit, we need 256/6 = 42.66 chars. That is rounded to 43 char. [To make it divisible by 4 add =]
For 512 bit, we need 512/6 = 85.33 chars. That is rounded to 86 char. [To make it divisible by 4 add ==]
For 128 bit, we need 128/6 = 21.33 chars. That is rounded to 22 char. [To make it divisible by 4 add ==]

A: A base64 string for 16 bytes will always be 24 characters and have == at the end, as padding.
(At least when it's decodable using the .NET method. The padding is not always inlcuded in all uses of base64 strings, but the .NET implementation requires it.)

A: In Base64 encoding '=' is a special symbol that is added to end of the Base64 string to indicate that there is no data for these chars in original value.
Each char is equal to 6 original bits of data, so to produce 8 bit values the string length has to be dividable by 4 without remainder. (6 bits * 4 = 8 bits * 3). When the resulting BASE64 string is shorter than 4n then '=' are added at the end to make it valid.
Update
Last char before '==' encodes only 2 bits of information, so by replacing it with all possible Base64 chars will give you only 4 different keys out of 64 possible combinations. In other words, by generating strings in format "bbbbbbbbbbbbbbbbbbbbbb==" (where 'b' is valid Base64 character) you'll get 15 duplicate keys per each unique key.

A: You can use PadRight() to pad the string to the end of it with a char that you will later remove once decrypted.


text:
Q: InvalidRowLocation Smartsheet C# Can't seem to set indentation level of a row to 1. AddRows results in an InvalidRowLocation exception.
    static string[] DeserializeJson(string json)
    {
        try
        {
            SortedDictionary<string, string> values = JsonConvert.DeserializeObject<SortedDictionary<string, string>>(json);
            return new string[] { values["Status"], values["ServerIP"], values["ClientIP"], values["Date"] };
        }
        catch
        {
            return new string[] { json };
        }
    }

    static Row MakeRow(Sheet sheet, string[] values)
    {
        List<Cell> cells = new List<Cell>();
        Cell cell;
        IEnumerator<Column> cols = sheet.Columns.GetEnumerator();
        DateTime date;
        for (int n = 0; n < values.Length; n++)
        {
            cols.MoveNext();
            Column col = cols.Current;
            if (col.Type == ColumnType.DATE)
            {
                date = DateTime.ParseExact(values[n], dateFormat, CultureInfo.InvariantCulture);
                cell = new Cell.AddCellBuilder(col.Id, DateTime.Now).Build();
            }
            else
                cell = new Cell.AddCellBuilder(col.Id, values[n]).Build();
            cells.Add(cell);
        }
        Row row = new Row.AddRowBuilder(null, true, null, null, null).SetCells(cells).Build();
        if (values.Length > 1)
            row.Indent = 1;    // Results in an exception
        return row;
    }

    static void AddRows(SmartsheetClient client, Sheet sheet, string[] lines)
    {
        List<Row> rows = new List<Row>();
        foreach (string line in lines)
            rows.Add(MakeRow(sheet, DeserializeJson(line)));
        client.SheetResources.RowResources.AddRows(sheetId, rows);
    }

A: Indenting in Smartsheet creates a "parent-child" relationship between the rows. So, to indent a new row you'll need to give it the rowId of its parent row as the parentId.
It would look something like this
 Row row = new Row.AddRowBuilder(null, true, 7531436244775314, null, null).SetCells(cells).Build();

A: You can only use the Indent property when updating existing rows. Since you are adding new rows, you need to set the ParentId property instead. See docs: http://smartsheet-platform.github.io/api-docs/#row-location


text:
Q: How Do I Create New Pandas Column Based On Word In A List So I have a list and a dataframe.  I want to take the the word from the list and make it the title of the column.  if the word is the row its added to the newly created column.  If its not in the row leave blank or NA.
Should I use iloc?
import pandas as pd
wordlist = [['this is sentence 1'],['this is sentence 2'],['this is not a sentence'],['ok who is this']]
query=['is','not']
df = pd.DataFrame(wordlist, columns = ['Name'])

for word in query:
    if word in df['Name']:
        df[word] = word
df

Output

Name                       is     not  <<column titles
0   this is sentence 1     is     NA
1   this is sentence 2     is     NA
2   this is not a sentence is     not
3   ok who is this         is     NA

A: Create a search pattern then use Series.str.extractall to get the words. Then turn each unique word into a dummy and aggregate back to the original row index, and join back to the original DataFrame.
import pandas as pd

pat = f'({"|".join(query)})'
#(is|not)

df_dummies = pd.get_dummies(df['Name'].str.extractall(pat)[0]).max(level=0)

df = pd.concat([df, df_dummies], axis=1)

#                     Name  is  not
#0      this is sentence 1   1    0
#1      this is sentence 2   1    0
#2  this is not a sentence   1    1
#3          ok who is this   1    0

If instead of dummies you really want the words repeated then we can multiply the dummy DataFrame by the columns.
df_dummies = pd.get_dummies(df['Name'].str.extractall(pat)[0]).max(level=0)
df_dummies = df_dummies.mul(df_dummies.columns).replace('', np.NaN)
df = pd.concat([df, df_dummies], axis=1)

#                     Name  is  not
#0      this is sentence 1  is  NaN
#1      this is sentence 2  is  NaN
#2  this is not a sentence  is  not
#3          ok who is this  is  NaN

Finally as a word of caution the word 'this' itself contains the match 'is', and so the basic pattern above matches both to the separate word 'is' and the last two characters of 'this'. If you want to exclude matches that are parts of longer words then modify the search pattern to contain word boundaries around every element in query:
pat = '(\\b' + '\\b|\\b'.join(query) + '\\b)'
#'(\\bis\\b|\\bnot\\b)'


text:
Q: Как спарсить ссылки с помощью jsoup с сайта? public class NewThread extends AsyncTask<String, Void, String> {

    @Override
    protected String doInBackground(String... arg) {

        try {

            doc = Jsoup.connect("http://www.novostiit.net/category/company").get();

            add = doc.select("li.cat-item");
            link = doc.select("li.cat-item a");
            String linkHref = link.attr("abs:href");
            titleList.clear();

            for (Element content : add) {
                titleList.add(content.text());
                titleList.add(linkHref);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }

Получилось лишь спарсить первую ссылку, но мне надо каждую. Что я упустил?

A:
Что я упустил?

Перед циклом Вы получаете:
String linkHref = link.attr("abs:href");

и далее в цикле нигде не изменяете эту переменную, следовательно, она везде дублируется.

Данную задачу можно решить несколько проще:
Смотрим исходный код этих элементов:

IT технологии (407)

Видео (484)

...

У всех элементов атрибут class начинается с cat-item cat-item (и на данной странице нет других элементов с подобными атрибутами), следовательно, получить их можно так:
Document page = Jsoup.connect("http://www.novostiit.net/category/company").get();
Elements categories = page.select("li[class^='cat-item cat-item']");

А получить название и ссылку, так:
for (Element category : categories) {
    System.out.println(category.select("a").text());
    System.out.println(category.select("a").attr("href") + "\n");
}

Вывод на консоль:
IT технологии
http://www.novostiit.net/category/it

Видео
http://www.novostiit.net/category/video

Все новости
http://www.novostiit.net/category/novosti

Гаджеты
http://www.novostiit.net/category/gadgety

Игры
http://www.novostiit.net/category/igry

...

PS. У Jsoup есть очень удобный инструмент.