text:
Q: Bumblebee fail safe x after reboot [GTX 755M][Ubuntu 15.10] When I installed bumblebee and the nvidia-340 drivers Ubuntu booted into a normal session. On the next reboot, after running glmark2 with optirun in the previous session, the normal x session would not start up and I instead got a screen with the message "The system is running in low-graphics mode". If I lock the xorg.config that is generated to a blank file with
$ chattr +i /etc/X11/xorg.config

I get to the login screen but as soon as I log in something crashes and I am returned to the login screen once again.
The Xorg.0.log befor low graphics mode
[    21.150] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[    21.397] (==) No Layout section.  Using the first Screen section.
[    21.397] (==) No screen section available. Using defaults.
[    21.397] (**) |-->Screen "Default Screen Section" (0)
[    21.397] (**) |   |-->Monitor "<default monitor>"
[    21.398] (==) No monitor specified for screen "Default Screen Section".
    Using a default monitor configuration.
[    21.398] (==) Automatically adding devices
[    21.398] (==) Automatically enabling devices
[    21.398] (==) Automatically adding GPU devices
[    21.522] (WW) The directory "/usr/share/fonts/X11/cyrillic" does not exist.
[    21.522]    Entry deleted from font path.
[    21.522] (WW) The directory "/usr/share/fonts/X11/100dpi/" does not exist.
[    21.522]    Entry deleted from font path.
[    21.522] (WW) The directory "/usr/share/fonts/X11/75dpi/" does not exist.
[    21.522]    Entry deleted from font path.
[    21.534] (WW) The directory "/usr/share/fonts/X11/100dpi" does not exist.
[    21.534]    Entry deleted from font path.
[    21.534] (WW) The directory "/usr/share/fonts/X11/75dpi" does not exist.
[    21.534]    Entry deleted from font path.
[    21.534] (==) FontPath set to:
    /usr/share/fonts/X11/misc,
    /usr/share/fonts/X11/Type1,
    built-ins
[    21.534] (==) ModulePath set to "/usr/lib/x86_64-linux-gnu/xorg/extra-modules,/usr/lib/xorg/extra-modules,/usr/lib/xorg/modules"
[    21.534] (II) The server relies on udev to provide the list of input devices.
    If no devices become available, reconfigure udev or disable AutoAddDevices.
[    21.549] (II) Loader magic: 0x55a1d1724d40
[    21.549] (II) Module ABI versions:
[    21.549]    X.Org ANSI C Emulation: 0.4
[    21.549]    X.Org Video Driver: 19.0
[    21.549]    X.Org XInput driver : 21.0
[    21.549]    X.Org Server Extension : 9.0
[    21.549] (II) xfree86: Adding drm device (/dev/dri/card0)
[    21.551] (--) PCI:*(0:0:2:0) 8086:0416:17aa:3801 rev 6, Mem @ 0xc2000000/4194304, 0xb0000000/268435456, I/O @ 0x00005000/64
[    21.560] (WW) "glamoregl" will not be loaded unless you've specified it to be loaded elsewhere.
[    21.560] (II) "glx" will be loaded by default.
[    21.560] (II) LoadModule: "glx"
[    21.711] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[    22.171] (II) Module glx: vendor="X.Org Foundation"
[    22.171]    compiled for 1.17.2, module version = 1.0.0
[    22.171]    ABI class: X.Org Server Extension, version 9.0
[    22.171] (==) AIGLX enabled
[    22.171] (==) Matched intel as autoconfigured driver 0
[    22.171] (==) Matched intel as autoconfigured driver 1
[    22.171] (==) Matched modesetting as autoconfigured driver 2
[    22.171] (==) Matched fbdev as autoconfigured driver 3
[    22.171] (==) Matched vesa as autoconfigured driver 4
[    22.171] (==) Assigned the driver to the xf86ConfigLayout
[    22.171] (II) LoadModule: "intel"
[    22.171] (II) Loading /usr/lib/xorg/modules/drivers/intel_drv.so
[    22.311] (II) Module intel: vendor="X.Org Foundation"
[    22.312]    compiled for 1.17.2, module version = 2.99.917
[    22.312]    Module class: X.Org Video Driver
[    22.312]    ABI class: X.Org Video Driver, version 19.0
[    22.312] (II) LoadModule: "modesetting"
[    22.312] (II) Loading /usr/lib/xorg/modules/drivers/modesetting_drv.so
[    22.363] (II) Module modesetting: vendor="X.Org Foundation"
[    22.363]    compiled for 1.17.2, module version = 1.17.2
[    22.363]    Module class: X.Org Video Driver
[    22.363]    ABI class: X.Org Video Driver, version 19.0
[    22.363] (II) LoadModule: "fbdev"
[    22.363] (II) Loading /usr/lib/xorg/modules/drivers/fbdev_drv.so
[    22.376] (II) Module fbdev: vendor="X.Org Foundation"
[    22.376]    compiled for 1.17.1, module version = 0.4.4
[    22.376]    Module class: X.Org Video Driver
[    22.376]    ABI class: X.Org Video Driver, version 19.0
[    22.376] (II) LoadModule: "vesa"
[    22.376] (II) Loading /usr/lib/xorg/modules/drivers/vesa_drv.so
[    22.423] (II) Module vesa: vendor="X.Org Foundation"
[    22.423]    compiled for 1.17.1, module version = 2.3.4
[    22.423]    Module class: X.Org Video Driver
[    22.423]    ABI class: X.Org Video Driver, version 19.0
[    22.423] (II) intel: Driver for Intel(R) Integrated Graphics Chipsets:
    i810, i810-dc100, i810e, i815, i830M, 845G, 854, 852GM/855GM, 865G,
    915G, E7221 (i915), 915GM, 945G, 945GM, 945GME, Pineview GM,
    Pineview G, 965G, G35, 965Q, 946GZ, 965GM, 965GME/GLE, G33, Q35, Q33,
    GM45, 4 Series, G45/G43, Q45/Q43, G41, B43
[    22.423] (II) intel: Driver for Intel(R) HD Graphics: 2000-6000
[    22.423] (II) intel: Driver for Intel(R) Iris(TM) Graphics: 5100, 6100
[    22.423] (II) intel: Driver for Intel(R) Iris(TM) Pro Graphics: 5200, 6200, P6300
[    22.423] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[    22.423] (II) FBDEV: driver for framebuffer: fbdev
[    22.423] (II) VESA: driver for VESA chipsets: vesa
[    22.423] (++) using VT number 7

[    22.442] (II) intel(0): Using Kernel Mode Setting driver: i915, version 1.6.0 20150522
[    22.442] (II) intel(0): SNA compiled: xserver-xorg-video-intel 2:2.99.917+git20150808-0ubuntu4 (Robert Ancell <robert.ancell@canonical.com>)
[    22.442] (II) intel(0): SNA compiled for use with valgrind
[    22.466] (WW) Falling back to old probe method for modesetting
[    22.467] (WW) Falling back to old probe method for fbdev
[    22.467] (II) Loading sub module "fbdevhw"
[    22.467] (II) LoadModule: "fbdevhw"
[    22.467] (II) Loading /usr/lib/xorg/modules/libfbdevhw.so
[    22.494] (II) Module fbdevhw: vendor="X.Org Foundation"
[    22.494]    compiled for 1.17.2, module version = 0.0.2
[    22.494]    ABI class: X.Org Video Driver, version 19.0
[    22.494] (WW) Falling back to old probe method for vesa
[    22.505] (--) intel(0): Integrated Graphics Chipset: Intel(R) HD Graphics 4600
[    22.505] (--) intel(0): CPU: x86-64, sse2, sse3, ssse3, sse4.1, sse4.2, avx, avx2; using a maximum of 4 threads
[    22.505] (II) intel(0): Creating default Display subsection in Screen section
    "Default Screen Section" for depth/fbbpp 24/32
[    22.505] (==) intel(0): Depth 24, (--) framebuffer bpp 32
[    22.505] (==) intel(0): RGB weight 888
[    22.505] (==) intel(0): Default visual is TrueColor
[    22.505] (II) intel(0): Output eDP1 has no monitor section
[    22.516] (--) intel(0): Found backlight control interface intel_backlight (type 'raw') for output eDP1
[    22.516] (II) intel(0): Enabled output eDP1
[    22.516] (II) intel(0): Output VGA1 has no monitor section
[    22.516] (II) intel(0): Enabled output VGA1
[    22.516] (II) intel(0): Output HDMI1 has no monitor section
[    22.516] (II) intel(0): Enabled output HDMI1
[    22.516] (--) intel(0): Using a maximum size of 256x256 for hardware cursors
[    22.516] (II) intel(0): Output VIRTUAL1 has no monitor section
[    22.516] (II) intel(0): Enabled output VIRTUAL1
[    22.516] (--) intel(0): Output eDP1 using initial mode 1600x900 on pipe 0
[    22.516] (==) intel(0): TearFree disabled
[    22.516] (==) intel(0): DPI set to (96, 96)
[    22.516] (II) Loading sub module "dri2"
[    22.516] (II) LoadModule: "dri2"
[    22.516] (II) Module "dri2" already built-in
[    22.516] (II) Loading sub module "present"
[    22.516] (II) LoadModule: "present"
[    22.516] (II) Module "present" already built-in
[    22.516] (II) UnloadModule: "modesetting"
[    22.516] (II) Unloading modesetting
[    22.516] (II) UnloadModule: "fbdev"
[    22.516] (II) Unloading fbdev
[    22.516] (II) UnloadSubModule: "fbdevhw"
[    22.516] (II) Unloading fbdevhw
[    22.516] (II) UnloadModule: "vesa"
[    22.516] (II) Unloading vesa
[    22.516] (==) Depth 24 pixmap format is 32 bpp
[    22.581] (II) intel(0): SNA initialized with Haswell (gen7.5, gt2) backend
[    22.582] (==) intel(0): Backing store enabled
[    22.582] (==) intel(0): Silken mouse enabled
[    22.593] (II) intel(0): HW Cursor enabled
[    22.593] (II) intel(0): RandR 1.2 enabled, ignore the following RandR disabled message.
[    22.594] (==) intel(0): DPMS enabled
[    22.594] (==) intel(0): Display hotplug detection enabled
[    22.594] (II) intel(0): [DRI2] Setup complete
[    22.594] (II) intel(0): [DRI2]   DRI driver: i965
[    22.594] (II) intel(0): [DRI2]   VDPAU driver: va_gl
[    22.594] (II) intel(0): direct rendering: DRI2 enabled
[    22.594] (II) intel(0): hardware support for Present enabled
[    22.594] (--) RandR disabled
[    22.598] (II) SELinux: Disabled on system
[    22.938] (II) AIGLX: enabled GLX_MESA_copy_sub_buffer
[    22.938] (II) AIGLX: enabled GLX_ARB_create_context
[    22.938] (II) AIGLX: enabled GLX_ARB_create_context_profile
[    22.938] (II) AIGLX: enabled GLX_EXT_create_context_es2_profile
[    22.938] (II) AIGLX: enabled GLX_INTEL_swap_event
[    22.938] (II) AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control
[    22.938] (II) AIGLX: enabled GLX_EXT_framebuffer_sRGB
[    22.938] (II) AIGLX: enabled GLX_ARB_fbconfig_float
[    22.938] (II) AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects
[    22.938] (II) AIGLX: enabled GLX_ARB_create_context_robustness
[    22.938] (II) AIGLX: Loaded and initialized i965
[    22.938] (II) GLX: Initialized DRI2 GL provider for screen 0
[    22.941] (II) intel(0): switch to mode 1600x900@60.0 on eDP1 using pipe 0, position (0, 0), rotation normal, reflection none
[    22.941] (II) intel(0): Setting screen physical size to 423 x 238
[    23.043] (II) XKB: reuse xkmfile /var/lib/xkb/server-B20D7FC79C7F597315E3E501AEF10E0D866E8E92.xkm
[    23.075] (II) config/udev: Adding input device Power Button (/dev/input/event3)
[    23.075] (**) Power Button: Applying InputClass "evdev keyboard catchall"
[    23.075] (II) LoadModule: "evdev"
[    23.075] (II) Loading /usr/lib/xorg/modules/input/evdev_drv.so
[    23.114] (II) Module evdev: vendor="X.Org Foundation"
[    23.114]    compiled for 1.17.1, module version = 2.9.2
[    23.114]    Module class: X.Org XInput Driver
[    23.114]    ABI class: X.Org XInput driver, version 21.0
[    23.114] (II) Using input driver 'evdev' for 'Power Button'
[    23.114] (**) Power Button: always reports core events
[    23.114] (**) evdev: Power Button: Device: "/dev/input/event3"
[    23.115] (--) evdev: Power Button: Vendor 0 Product 0x1
[    23.115] (--) evdev: Power Button: Found keys
[    23.115] (II) evdev: Power Button: Configuring as keyboard
[    23.115] (**) Option "config_info" "udev:/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3"
[    23.115] (II) XINPUT: Adding extended input device "Power Button" (type: KEYBOARD, id 6)
[    23.115] (**) Option "xkb_rules" "evdev"
[    23.115] (**) Option "xkb_model" "pc105"
[    23.115] (**) Option "xkb_layout" "us"
[    23.115] (II) config/udev: Adding input device Video Bus (/dev/input/event6)
[    23.115] (**) Video Bus: Applying InputClass "evdev keyboard catchall"
[    23.115] (II) Using input driver 'evdev' for 'Video Bus'
[    23.115] (**) Video Bus: always reports core events
[    23.115] (**) evdev: Video Bus: Device: "/dev/input/event6"
[    23.115] (--) evdev: Video Bus: Vendor 0 Product 0x6
[    23.115] (--) evdev: Video Bus: Found keys
[    23.115] (II) evdev: Video Bus: Configuring as keyboard
[    23.115] (**) Option "config_info" "udev:/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/LNXVIDEO:01/input/input8/event6"
[    23.115] (II) XINPUT: Adding extended input device "Video Bus" (type: KEYBOARD, id 7)
[    23.115] (**) Option "xkb_rules" "evdev"
[    23.115] (**) Option "xkb_model" "pc105"
[    23.115] (**) Option "xkb_layout" "us"
[    23.116] (II) config/udev: Adding input device Power Button (/dev/input/event0)
[    23.116] (**) Power Button: Applying InputClass "evdev keyboard catchall"
[    23.116] (II) Using input driver 'evdev' for 'Power Button'
[    23.116] (**) Power Button: always reports core events
[    23.116] (**) evdev: Power Button: Device: "/dev/input/event0"
[    23.116] (--) evdev: Power Button: Vendor 0 Product 0x1
[    23.116] (--) evdev: Power Button: Found keys
[    23.116] (II) evdev: Power Button: Configuring as keyboard
[    23.116] (**) Option "config_info" "udev:/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:01/PNP0C0C:00/input/input0/event0"
[    23.116] (II) XINPUT: Adding extended input device "Power Button" (type: KEYBOARD, id 8)
[    23.116] (**) Option "xkb_rules" "evdev"
[    23.116] (**) Option "xkb_model" "pc105"
[    23.116] (**) Option "xkb_layout" "us"
[    23.116] (II) config/udev: Adding input device Sleep Button (/dev/input/event1)
[    23.116] (**) Sleep Button: Applying InputClass "evdev keyboard catchall"
[    23.116] (II) Using input driver 'evdev' for 'Sleep Button'
[    23.116] (**) Sleep Button: always reports core events
[    23.116] (**) evdev: Sleep Button: Device: "/dev/input/event1"
[    23.116] (--) evdev: Sleep Button: Vendor 0 Product 0x3
[    23.116] (--) evdev: Sleep Button: Found keys
[    23.116] (II) evdev: Sleep Button: Configuring as keyboard
[    23.116] (**) Option "config_info" "udev:/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:01/PNP0C0E:00/input/input1/event1"
[    23.116] (II) XINPUT: Adding extended input device "Sleep Button" (type: KEYBOARD, id 9)
[    23.116] (**) Option "xkb_rules" "evdev"
[    23.116] (**) Option "xkb_model" "pc105"
[    23.116] (**) Option "xkb_layout" "us"
[    23.117] (II) config/udev: Adding input device Video Bus (/dev/input/event5)
[    23.117] (**) Video Bus: Applying InputClass "evdev keyboard catchall"
[    23.117] (II) Using input driver 'evdev' for 'Video Bus'
[    23.117] (**) Video Bus: always reports core events
[    23.117] (**) evdev: Video Bus: Device: "/dev/input/event5"
[    23.117] (--) evdev: Video Bus: Vendor 0 Product 0x6
[    23.117] (--) evdev: Video Bus: Found keys
[    23.117] (II) evdev: Video Bus: Configuring as keyboard
[    23.117] (**) Option "config_info" "udev:/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:4c/LNXVIDEO:00/input/input7/event5"
[    23.117] (II) XINPUT: Adding extended input device "Video Bus" (type: KEYBOARD, id 10)
[    23.117] (**) Option "xkb_rules" "evdev"
[    23.117] (**) Option "xkb_model" "pc105"
[    23.117] (**) Option "xkb_layout" "us"
[    23.117] (II) config/udev: Adding input device Lid Switch (/dev/input/event2)
[    23.117] (II) No input driver specified, ignoring this device.
[    23.117] (II) This device may have been added with another device file.
[    23.117] (II) config/udev: Adding input device HDA Intel HDMI HDMI/DP,pcm=3 (/dev/input/event9)
[    23.117] (II) No input driver specified, ignoring this device.
[    23.117] (II) This device may have been added with another device file.
[    23.117] (II) config/udev: Adding input device HDA Intel HDMI HDMI/DP,pcm=7 (/dev/input/event10)
[    23.117] (II) No input driver specified, ignoring this device.
[    23.117] (II) This device may have been added with another device file.
[    23.118] (II) config/udev: Adding input device HDA Intel HDMI HDMI/DP,pcm=8 (/dev/input/event11)
[    23.118] (II) No input driver specified, ignoring this device.
[    23.118] (II) This device may have been added with another device file.
[    23.118] (II) config/udev: Adding input device Lenovo EasyCamera (/dev/input/event14)
[    23.118] (**) Lenovo EasyCamera: Applying InputClass "evdev keyboard catchall"
[    23.118] (II) Using input driver 'evdev' for 'Lenovo EasyCamera'
[    23.118] (**) Lenovo EasyCamera: always reports core events
[    23.118] (**) evdev: Lenovo EasyCamera: Device: "/dev/input/event14"
[    23.118] (--) evdev: Lenovo EasyCamera: Vendor 0x174f Product 0x1474
[    23.118] (--) evdev: Lenovo EasyCamera: Found keys
[    23.118] (II) evdev: Lenovo EasyCamera: Configuring as keyboard
[    23.118] (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/input/input15/event14"
[    23.118] (II) XINPUT: Adding extended input device "Lenovo EasyCamera" (type: KEYBOARD, id 11)
[    23.118] (**) Option "xkb_rules" "evdev"
[    23.118] (**) Option "xkb_model" "pc105"
[    23.118] (**) Option "xkb_layout" "us"
[    23.118] (II) config/udev: Adding input device HDA Intel PCH Mic (/dev/input/event12)
[    23.118] (II) No input driver specified, ignoring this device.
[    23.118] (II) This device may have been added with another device file.
[    23.118] (II) config/udev: Adding input device HDA Intel PCH Headphone (/dev/input/event13)
[    23.118] (II) No input driver specified, ignoring this device.
[    23.118] (II) This device may have been added with another device file.
[    23.119] (II) config/udev: Adding input device Ideapad extra buttons (/dev/input/event8)
[    23.119] (**) Ideapad extra buttons: Applying InputClass "evdev keyboard catchall"
[    23.119] (II) Using input driver 'evdev' for 'Ideapad extra buttons'
[    23.119] (**) Ideapad extra buttons: always reports core events
[    23.119] (**) evdev: Ideapad extra buttons: Device: "/dev/input/event8"
[    23.119] (--) evdev: Ideapad extra buttons: Vendor 0 Product 0
[    23.119] (--) evdev: Ideapad extra buttons: Found keys
[    23.119] (II) evdev: Ideapad extra buttons: Configuring as keyboard
[    23.119] (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:1f.0/PNP0C09:00/VPC2004:00/input/input9/event8"
[    23.119] (II) XINPUT: Adding extended input device "Ideapad extra buttons" (type: KEYBOARD, id 12)
[    23.119] (**) Option "xkb_rules" "evdev"
[    23.119] (**) Option "xkb_model" "pc105"
[    23.119] (**) Option "xkb_layout" "us"
[    23.119] (II) config/udev: Adding input device AT Translated Set 2 keyboard (/dev/input/event4)
[    23.119] (**) AT Translated Set 2 keyboard: Applying InputClass "evdev keyboard catchall"
[    23.119] (II) Using input driver 'evdev' for 'AT Translated Set 2 keyboard'
[    23.119] (**) AT Translated Set 2 keyboard: always reports core events
[    23.119] (**) evdev: AT Translated Set 2 keyboard: Device: "/dev/input/event4"
[    23.119] (--) evdev: AT Translated Set 2 keyboard: Vendor 0x1 Product 0x1
[    23.119] (--) evdev: AT Translated Set 2 keyboard: Found keys
[    23.119] (II) evdev: AT Translated Set 2 keyboard: Configuring as keyboard
[    23.119] (**) Option "config_info" "udev:/sys/devices/platform/i8042/serio0/input/input4/event4"
[    23.119] (II) XINPUT: Adding extended input device "AT Translated Set 2 keyboard" (type: KEYBOARD, id 13)
[    23.119] (**) Option "xkb_rules" "evdev"
[    23.119] (**) Option "xkb_model" "pc105"
[    23.119] (**) Option "xkb_layout" "us"
[    23.119] (II) config/udev: Adding input device ETPS/2 Elantech Touchpad (/dev/input/event7)
[    23.119] (**) ETPS/2 Elantech Touchpad: Applying InputClass "evdev touchpad catchall"
[    23.119] (**) ETPS/2 Elantech Touchpad: Applying InputClass "touchpad catchall"
[    23.119] (**) ETPS/2 Elantech Touchpad: Applying InputClass "Default clickpad buttons"
[    23.119] (II) LoadModule: "synaptics"
[    23.119] (II) Loading /usr/lib/xorg/modules/input/synaptics_drv.so
[    23.126] (II) Module synaptics: vendor="X.Org Foundation"
[    23.126]    compiled for 1.17.1, module version = 1.8.2
[    23.126]    Module class: X.Org XInput Driver
[    23.126]    ABI class: X.Org XInput driver, version 21.0
[    23.126] (II) Using input driver 'synaptics' for 'ETPS/2 Elantech Touchpad'
[    23.127] (**) ETPS/2 Elantech Touchpad: always reports core events
[    23.127] (**) Option "Device" "/dev/input/event7"
[    23.140] (II) synaptics: ETPS/2 Elantech Touchpad: found clickpad property
[    23.140] (--) synaptics: ETPS/2 Elantech Touchpad: x-axis range 0 - 2800 (res 33)
[    23.140] (--) synaptics: ETPS/2 Elantech Touchpad: y-axis range 0 - 1820 (res 33)
[    23.140] (--) synaptics: ETPS/2 Elantech Touchpad: pressure range 0 - 255
[    23.140] (--) synaptics: ETPS/2 Elantech Touchpad: finger width range 0 - 15
[    23.140] (--) synaptics: ETPS/2 Elantech Touchpad: buttons: left double triple
[    23.140] (--) synaptics: ETPS/2 Elantech Touchpad: Vendor 0x2 Product 0xe
[    23.140] (**) Option "SoftButtonAreas" "50% 0 82% 0 0 0 0 0"
[    23.140] (--) synaptics: ETPS/2 Elantech Touchpad: touchpad found
[    23.140] (**) ETPS/2 Elantech Touchpad: always reports core events
[    23.152] (**) Option "config_info" "udev:/sys/devices/platform/i8042/serio1/input/input6/event7"
[    23.152] (II) XINPUT: Adding extended input device "ETPS/2 Elantech Touchpad" (type: TOUCHPAD, id 14)
[    23.152] (**) synaptics: ETPS/2 Elantech Touchpad: (accel) MinSpeed is now constant deceleration 2.5
[    23.152] (**) synaptics: ETPS/2 Elantech Touchpad: (accel) MaxSpeed is now 1.75
[    23.152] (**) synaptics: ETPS/2 Elantech Touchpad: (accel) AccelFactor is now 0.060
[    23.152] (**) ETPS/2 Elantech Touchpad: (accel) keeping acceleration scheme 1
[    23.152] (**) ETPS/2 Elantech Touchpad: (accel) acceleration profile 1
[    23.152] (**) ETPS/2 Elantech Touchpad: (accel) acceleration factor: 2.000
[    23.152] (**) ETPS/2 Elantech Touchpad: (accel) acceleration threshold: 4
[    23.152] (--) synaptics: ETPS/2 Elantech Touchpad: touchpad found
[    23.152] (II) config/udev: Adding input device ETPS/2 Elantech Touchpad (/dev/input/mouse0)
[    23.152] (**) ETPS/2 Elantech Touchpad: Ignoring device from InputClass "touchpad ignore duplicates"
[    24.516] (II) intel(0): EDID vendor "AUO", prod id 8254
[    24.516] (II) intel(0): Printing DDC gathered Modelines:
[    24.516] (II) intel(0): Modeline "1600x900"x0.0  110.00  1600 1664 1706 2010  900 903 906 912 -hsync -vsync (54.7 kHz eP)
[    24.516] (II) intel(0): Modeline "1600x900"x0.0   73.33  1600 1664 1706 2010  900 903 906 912 -hsync -vsync (36.5 kHz e)
[    44.439] (II) XKB: reuse xkmfile /var/lib/xkb/server-B20D7FC79C7F597315E3E501AEF10E0D866E8E92.xkm
[    46.119] (II) XKB: reuse xkmfile /var/lib/xkb/server-B20D7FC79C7F597315E3E501AEF10E0D866E8E92.xkm
[    46.126] (II) XKB: reuse xkmfile /var/lib/xkb/server-B20D7FC79C7F597315E3E501AEF10E0D866E8E92.xkm
[    55.951] (II) XKB: reuse xkmfile /var/lib/xkb/server-7C75F152E85183199599C3E0B919739C0EE668AA.xkm

Xorg.0.log after low-graphics mode
[    50.337]
X.Org X Server 1.17.2
Release Date: 2015-06-16
[    50.337] X Protocol Version 11, Revision 0
[    50.337] Build Operating System: Linux 3.19.0-30-generic x86_64 Ubuntu
[    50.337] Current Operating System: Linux Io 4.2.0-16-generic #19-Ubuntu SMP Thu Oct 8 15:35:06 UTC 2015 x86_64
[    50.337] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.2.0-16-generic.efi.signed root=/dev/sdb5
[    50.337] Build Date: 30 September 2015  09:08:47AM
[    50.337] xorg-server 2:1.17.2-1ubuntu9 (For technical support please see http://www.ubuntu.com/support)
[    50.337] Current version of pixman: 0.32.6
[    50.337]    Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.
[    50.337] Markers: (--) probed, (**) from config file, (==) default setting,
    (++) from command line, (!!) notice, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[    50.337] (==) Log file: "/var/log/Xorg.0.log", Time: Tue Oct 27 20:08:20 2015
[    50.337] (==) Using config file: "/etc/X11/xorg.conf"
[    50.337] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[    50.337] Data incomplete in file /etc/X11/xorg.conf
    Undefined Screen "nvidia" referenced by ServerLayout "layout".
[    50.337] (EE) Problem parsing the config file
[    50.337] (EE) Error parsing the config file
[    50.337] (EE)
Fatal server error:
[    50.337] (EE) no screens found(EE)
[    50.337] (EE)
Please consult the The X.Org Foundation support
     at http://wiki.x.org
 for help.
[    50.337] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
[    50.337] (EE)
[    50.337] (EE) Server terminated with error (1). Closing log file.

My bumblebee.config
# Configuration file for Bumblebee. Values should **not** be put between quotes

## Server options. Any change made in this section will need a server restart
# to take effect.
[bumblebeed]
# The secondary Xorg server DISPLAY number
VirtualDisplay=:8
# Should the unused Xorg server be kept running? Set this to true if waiting
# for X to be ready is too long and don't need power management at all.
KeepUnusedXServer=false
# The name of the Bumbleblee server group name (GID name)
ServerGroup=bumblebee
# Card power state at exit. Set to false if the card shoud be ON when Bumblebee
# server exits.
TurnCardOffAtExit=false
# The default behavior of '-f' option on optirun. If set to "true", '-f' will
# be ignored.
NoEcoModeOverride=false
# The Driver used by Bumblebee server. If this value is not set (or empty),
# auto-detection is performed. The available drivers are nvidia and nouveau
# (See also the driver-specific sections below)
Driver=nvidia
# Directory with a dummy config file to pass as a -configdir to secondary X
XorgConfDir=/etc/bumblebee/xorg.conf.d

## Client options. Will take effect on the next optirun executed.
[optirun]
# Acceleration/ rendering bridge, possible values are auto, virtualgl and
# primus.
Bridge=auto
# The method used for VirtualGL to transport frames between X servers.
# Possible values are proxy, jpeg, rgb, xv and yuv.
VGLTransport=proxy
# List of paths which are searched for the primus libGL.so.1 when using
# the primus bridge
PrimusLibraryPath=/usr/lib/x86_64-linux-gnu/primus:/usr/lib/i386-linux-gnu/primus
# Should the program run under optirun even if Bumblebee server or nvidia card
# is not available?
AllowFallbackToIGC=false

# Driver-specific settings are grouped under [driver-NAME]. The sections are
# parsed if the Driver setting in [bumblebeed] is set to NAME (or if auto-
# detection resolves to NAME).
# PMMethod: method to use for saving power by disabling the nvidia card, valid
# values are: auto - automatically detect which PM method to use
#         bbswitch - new in BB 3, recommended if available
#       switcheroo - vga_switcheroo method, use at your own risk
#             none - disable PM completely
# https://github.com/Bumblebee-Project/Bumblebee/wiki/Comparison-of-PM-methods

## Section with nvidia driver specific options, only parsed if Driver=nvidia
[driver-nvidia]
# Module name to load, defaults to Driver if empty or unset
KernelDriver=nvidia-340
PMMethod=auto
# colon-separated path to the nvidia libraries
LibraryPath=/usr/lib/nvidia-340:/usr/lib32/nvidia-340
# comma-separated path of the directory containing nvidia_drv.so and the
# default Xorg modules path
XorgModulePath=/usr/lib/nvidia-340/xorg,/usr/lib/xorg/modules
XorgConfFile=/etc/bumblebee/xorg.conf.nvidia

## Section with nouveau driver specific options, only parsed if Driver=nouveau
[driver-nouveau]
KernelDriver=nouveau
PMMethod=auto
XorgConfFile=/etc/bumblebee/xorg.conf.nouveau

the xorg.config file that was generated on the boot after running optirun
Section "ServerLayout"
    Identifier "layout"
    Screen 0 "nvidia"
    Inactive "intel"
EndSection

Section "Device"
    Identifier "intel"
    Driver "modesetting"
    BusID "PCI:0@0:2:0"
    Option "AccelMethod" "None"
EndSection

Section "Screen"
    Identifier "intel"
    Device "intel"
EndSection


text:
Q: Ruby Foreign Key Constraints in Database vs Model I have the following models in a Rails app. This setup has worked fine since normally when I would like to add a new VendorPromo to a vendor, there's a dropdown in the view of available Promos to choose from. Now, I'm enabling the creation of new VendorPromos via an API. However, this current set up will allow the creation of a VendorPromo with any promo_id, even if it doesn't exist in Promo. I've seen the belongs_to :promo, foreign_key: :promo, and I know you can add a foreign key constraint via the DB as well. What I'd like to know is the difference between these two approaches and if one is better?
Edit: I recognize that application constraints are different than DB constraints, but when I apply the constraint in the app, i.e. the belongs_to :promo, foreign_key: :promo it doesn't actually seem to enforce the constraint at all. Specifically, I can create a new VendorPromo with a promo_id of, say, 13, even though Promo only has IDs between 1 and 8.
class Vendor
  has_many :vendor_promos
end

class VendorPromo
  belongs_to :vendor
  belongs_to :promo
end

class Promo
end

A: The foreign_key attribute in the belongs_to method is not actually defining a foreign key, it's specifying for rails's internals which field holds the foreign  key.
The Ruby on Rails Guide warns you about it here: https://guides.rubyonrails.org/association_basics.html#options-for-has-many-foreign-key

In any case, Rails will not create foreign key columns for you. You need to explicitly define them as part of your migrations.

A: Juan Carlos's answer was part of the way there. It's true that the foreign_key attribute in belongs_to does not enforce any database or application level foreign key. What I was looking for was the belongs_to :promo, optional: false flag does in fact enforces an application level foreign key. That flag, in addition to a DB level foreign key constraint resolved my issue.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Measuring floating gate potential with minimal leakage current I am working on a sensing device where the voltage of a floating node is dependent on the quantity to be sensed, as well as the net charge stored in the node. I would like the device to be only sensitive to the external physical quantity, and thereby reduce as much as possible the time-variation of charge on the floating node.
In a typical scenario with solid-state memory devices, you would have a MOSFET whose gate is insulated in all directions, and a control gate coupled capacitively to it (and possibly also charging it through tunneling). The floating gate potential induces a certain channel conductance which can be measured with additional circuitry around the MOSFET.
My problem is that the process I am using (TSMC 65nm) has very thin MOSFET gate dielectric, so there is a non-negligible leakage current (on the order of 100 pA) due to electron tunneling across the gate dielectric. The charge stored on the floating node would be on the order of pC so with such currents, the variation will be fairly large and this would provide very low retention.
Are there alternative known ways to measure a floating node potential while drawing as least current as possible from it? One possibility is of course to increase the dielectric thickness of the MOSFET (or its permittivity) but I am constrained with whatever values the process uses.

A: Maybe you can bootstrap the device so that the voltage across the gate is minimized. I don't recall the function relating current to voltage across a barrier, but I think it's at least exponential.

A: If this is for professional use, use an Electrometer such as this.

This type of meter has an input impedance of 10^14 which is adequate to measure voltage in the leakage environment you have.
There are a huge range of devices spanning low cost to high cost.
You could build an electrometer if you were willing, and here might give you a starting point using an LMC662.
If you are simply DIY experimenting then you can build/buy an electroscope. These are not easily calibrated, but can provide good comparative measurements of charge on a point. You could get something like this for $50 or less.


text:
Q: Reduce voltage from 220V DC to 30 - 50V DC without transformer I am trying search something which I can use to convert 220V-DC to about 30-50V DC. I don't want it to be a transformer. I found some voltage regulators providing required output but not having the required input, so all useless, but there may be some available which escaped me.
You can also suggest something, which I can make at home but not too advanced for a Senior High School student. Thanks.
Edit (Thanks to @Transistor, @Asmyldof)
I am trying to make a air cleaner, so trying to power an electric motor having the given range requirement, ie, 30-50V DC.
I am converting the 220v AC mains supply to 220v DC(slightly lower) using 'bridge rectifier', which I had already made and tested.
I will also use 'filter capacitor' in the circuit (parallel) before the regulator.

A: Producing 220V unregulated DC is actually making life harder for yourself.  Buck regulators aren't normally specified to take that high an input voltage.
If you are certain that nobody will be able to touch any live parts, then a simple capacitive dropper circuit may work.  But it's difficult to design properly without knowing the current that will be drawn by the motor.  If it's too high, then the thing may end up more bulky than just using a transformer.
In particular, you'd need to know the starting current of the motor, which is normally a lot higher than the running current.


text:
Q: HTTPS Get gives connection refused error while connecting to Bing API using nodejs I was able to connect to the Bing API end point using Chrome extension - Postman.
I am new to NodeJS and AWS Lambda.  Seeing the below error while connecting from an AWS Lambda function with nodejs 6.9.0
Error: connect ECONNREFUSED 127.0.0.1:443
at Object.exports._errnoException (util.js:1018:11)
at exports._exceptionWithHostPort (util.js:1041:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1086:14)

Code:

exports.handler = (event, context, callback) => {
var headers = {
'Ocp-Apim-Subscription-Key': '******************',
'Content-Type': 'application/json',
};
var options = {
url: 'https://api.cognitive.microsoft.com/bing/v5.0/search?
&q=hello',
method: 'GET',
headers: headers,
};
const https = require("https");
https.get(options);
};

Appreciate your help

A: You may require and use the package node-bing-api to search with Bing Api.
var Bing = require('node-bing-api')({ accKey: "your-account-key" });

Bing.web("hello", function(error, res, body){
   console.log(body);
 });


text:
Q: Generate clients from Swagger definition programmatically I have a Swagger JSON definition file. I would like to generate Python client binding for it. I would like to generate it as part of my development cycle, i.e., every time the definition changes I can run a script locally to regenerate my client
I am aware of Swagger Editor and Swagger Online Generators but they are no satisfying my needs:

*

*both methods rely on an external service I need to call

*as result I am getting .zip file I need to unzip - that makes whole process more complex.

I remember times when I could generate Java client binding for SOAP service running Apache CXF locally. Is there something like that for Swagger? I've seen there's an option to clone the whole swagger-codegen project, for all possible programming languages, but that seems like an overkill. Is there another option?
How companies are handling issue like mine?

A: I've used https://github.com/OpenAPITools/openapi-generator
You don't need to clone the whole repository, just download the JAR file and use it to generate the client/server.


text:
Q: Android MultiAutoCompleteTextView : Except values other than Adapter I am stuck with one problem that i have one MultiAutoCompleteTextView as shown in below image:
In that i am selecting city name from suggestion of MultiAutoCompleteTextView and adding that item in ListView (as below). I want to prevent to enter other entries rather than ADAPTER values.

I am binding code this way and onClick of Button I am separating values by comma:
private void initComp() { //              GET DATA FROM DATABASE

    multiSelectCities = (MultiAutoCompleteTextView) findViewById(R.id.activity_multiselect_city);
    btnGetCity = (Button) findViewById(R.id.activity_btn_slect_city);
    listCity = (ListView) findViewById(R.id.activity_get_city_list);
    btnGetCity.setOnClickListener(this);
    dbHelper = new DatabaseHelper(getApplicationContext());
    dbHelper.open();
    setName();
    // dbHelper.close();
}

public void setName() { // FOR SET THE NAME IN MULTISELECT TEXTVIEW
    final Cursor localcursor = dbHelper.getArea();

    if ((localcursor != null) && (localcursor.getCount() > 0)) {
        arrayOfString = new ArrayList < String > ();
        localcursor.moveToFirst();
        do {
            arrayOfString.add(localcursor.getString(localcursor.getColumnIndex(DatabaseHelper.CITY_NAME)) + "-" + localcursor.getString(localcursor.getColumnIndex(DatabaseHelper.CITY_COUNTRY)));
        } while (localcursor.moveToNext());

        this.multiSelectCities.setThreshold(3);
        adapter = new CityDataWithMultitextAdapter(this, arrayOfString);
        multiSelectCities.setAdapter(adapter);
        multiSelectCities.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());

        /* localcursor.close(); */

    }

    @Override
    public void onClick(View v) { //SEARCH BUTTON CLICK AND STORE THE DATA INTO LISTVIEW

        if (!Utils.isEmpty(multiSelectCities)) {
            arrayList = multiSelectCities.getText().toString().substring(0, multiSelectCities.length() - 1).split(",");
            for (int i = 0; i < arrayList.length; i++) {
                selectedItems.add(arrayList[i].trim());
            }
        } else {
            Utils.displayToast(this, "Please Enter City/Cities");
        }

        CityListAdapter adapter = new CityListAdapter(this, selectedItems);
        listCity.setAdapter(adapter);
        multiSelectCities.setText("");
        listCity.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView <? > parent, View view, int position, long id) {

                Intent i = new Intent(CityListDataActivity.this, CityListDetail.class);
                i.putExtra("CITY_NAME", selectedItems.get(position).toString());
                startActivity(i);

            }
        });

    }
}

I am thinking to check entered values with Database by SELECT Query but i have 75000+ records so its difficult solution for this.

Any Help? It will be Appreciated.

A: One way is to remove the possibility to write inside the AutoCompleteTextView with:
<AutoCompleteTextView
            android:editable="false"
            android:inputType="none"
    ..../>

And onTouch call show adapter, that will show the list of cities.
 private AutoCompleteTextView mAutoText;

 mAutoText.setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                mAutoText.showDropDown();
                mAutoText.setListSelection(mPos);
                return false;
            }

        });
mAutoText.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            mAdapter.setSelection(position);
            mPos = position;

        }
    });


text:
Q: Surface area of a solid of revolution, general approach To calculate the surface area of a solid of revolution I have the following formulae for "4 cases" I've observed
1-When the curve rotates around the X-axis
i) When the limit of integration is in the X-axis
$S = \int 2 \pi f(x) \sqrt{1+(f'(x))^2}dx\ $ |Where $f(x)=function$
ii) When the limit of integration is in the Y-axis
$S = \int 2 \pi y \sqrt{1+(f'(y))^2}dy$ |Where $y = a\ number\ on\ the\ Y-axis$

2-When the curve rotates around the Y-axis
i) When the limit of integration is in the X-axis
$S = \int 2 \pi x \sqrt{1+(f'(x))^2}dx $ |Where $x = a\ number\ on\ the\ X-axis$
ii) When the limit of integration is in the Y-axis
$S = \int 2 \pi f(y) \sqrt{1+(f'(y))^2}dy$ |Where $f(y)=function$
I was wondering if my assessment of the math was correct since I still get confused when working on exercises.

A: The general approach you seek expressed quite succinctly in Pappus's $(1^{st})$ Centroid Theorem.
This theorem states that the surface area $A$ of a surface of revolution generated by rotating a plane curve $C$ about an axis external to $C$ and on the same plane is equal to the product of the arc length $s$ of $C$ and the distance $d$ traveled by its geometric centroid. Simply put, $S=2\pi RL$, where $R$ is the normal distance of the centroid to the axis of revolution and $L$ is curve length. The centroid of a curve is given by
$$\mathbf{R}=\frac{\int \mathbf{r}ds}{\int ds}=\frac{1}{L} \int \mathbf{r}ds$$


text:
Q: Chrome DevTools Timeline: New charts In the current Chrome version (46) the DevTools Timeline contains a bunch of new charts. The meaning of most of those charts is not obvious to me. Unfortunatly I could not find any documentation on them either. Can someone explain the meaning of those charts?

A: This is the overview bar on Chrome DevTools Timeline panel.
From top to bottom:

*yellow/green ticks are input activity, e.g. mouse moves/click, key press. Each has it's own color. Btw you have to enable a Chrome DevTools experiment to see this bar.

*red stripes bar is page responsiveness indicator. If you have a particular issue at some point it shows a red bars. The problems detected include long frames, excessive or forced layouts, etc.

*green chart is current frame rate. The higher -- the better. Max is 60fps.

*next bar is CPU utilization. The full bar height means 100% CPU is busy. Colors correspond to the type of activity: yellow is JavaScript, purple is style recalc or page layout, green is rendering/painting, blue is html parsing or blocking network interactions.

*thin stripes below CPU are network requests currently in flight. Colors depict content type: blue is html, green is media (images, fonts etc), purple is css, yellow is JavaScript, grey is for all others.


text:
Q: (PHP - Session) How can user restrict to access direcly to controller.php , only allow access from view.php? I am a beginner in PHP.
How can I restrict user access to controller.php and allow access to it only via view.php?

My proposal:
I don't know if this is proper, or how to avoid robots accessing it directly.

view.php:
  <?php
    session_start();
    $_SESSION['isFromView'] = true;
    ?>

  <html>
   <body>
    <form action="controller.php">
    <input type="submit"/>
    </form>
   </body>
  </html>

controller.php
<?php
   session_start();
   if(!isset($_SESSION['isFromView'])||!$_SESSION['isFromView']){exit();}
   else{

   //code here

   $_SESSION['isFromView']=false;
   }
?>

Please write what do I miss and in which way my controller can be access directly or other security problem (if you can examples please).

Edit:
In case that I dont have user login it can be secured by killing the session it controller.php after code executed, then when the user return to view.php new session ID will be created.
In most cases, though, we cannot kill the session because of other components of the site.
Thanks

A: The solution proposed is fine. Alternative solutions:

*

*use some hash in some hidden field in view.php form (in view.php create some md5('secret') and then check that in controller.php). This solution is the most secure approach.

*check the referral url (I strongly disagree because it's security issues) - $_SERVER['HTTP_REFERER']. This variable can easily be spoofed (changed by the client) so it's a security risk to rely on it.

A: First thing of note is that it appears your usage of 'Controller' and 'view' seems to be radically different from mine - I would have interpreted this as being part of an MVC pattern - in which case the browser would never request 'view.php' it should be an include file invoked via include/require from the controller file. Also, as an include file, it should not contain any inline code - so even if it were directly accessible from a browser - it would not do anything when called from a browser.
If you simply mean that you have two scripts, and the second should only ever be called by the first, then the issue is one of Cross-site request forgery - there's lots and lots of discussions about how to avoid this on the internet, most of which will explain why using $_SERVER['HTTP_REFERER'] is a complete waste of time.
Passing transaction-related data via the session should be avoided at all costs - not least because of the problem of session aliasing.
C.


text:
Q: Angular 2 - Component variable from service is not changed in the view I have MainMenuComponent with some navigation links.
Some links are for signed members, some for guests, and some for everyone.
My master template (master.html) looks like this:

<router-outlet></router-outlet>

inside my router-outlet, I have a login component. When I login, I change my JwtService.jwtToken variable to the user token. (a service variable)
That means that after login, I can still see the "Login" and "Register" menu links:

Login

Register

Fight

Log Out

Why does JwtService.getToken() is changed in my <router-outlet> but outside it, in my main menu component, its not updating? (unless I refresh the page manually)
**In other words: When my service variable is changed after login using jwtService.setToken("MY_TOKEN");
,The following expression in my view is not changed:
JwtService.getToken()

and it remains null until I refresh my browser/route **

A: I had the same issue with components outside the router-outlet in Angular2 caused by zones and change detection strategy.
You can force Angular2 to check the full component tree by using the ApplicationRef.tick() method.
In your login component:
Add the reference to ApplicationRef
import {ApplicationRef} from 'angular2/core';

inject the ApplicationRef into the constructor:
constructor(public appRef: ApplicationRef)

then when you receive the response from the authentication service force the Angular2 app to go through the change detection again:
this.appRef.tick(); // this will refresh the bindings

Your main-menu component should get updated as expected.


text:
Q: Converting Vignette Portlets to Liferay Portlets As the title states, i'm trying to convert these Vignette portlets into Liferay portlets.
Is there any documentation on this anywhere? I've searched the entire Internet
-When trying to deploy my WARs right off the bat, I'm getting a "missing liferay.plugin.packet.xml" which tells me the entire portlet must be reconfigured to work with Liferay.
-Running Liferay 6.1.1 ga2 on Web Logic 12c server
Cheers!

A: You mean "liferay-plugin-package.xml", don't you?
You will find such a file in the source of Liferay at /portal-web/docroot/WEB-INF/liferay-plugin-package.xml. For other examples just download sources from other Portlets (Github or Liferay-Marketplace).
Besides some other values, this file defines how Liferay should handle your war (layout-template, portlet, theme).
EDIT: As the marketplace does not allow (plz see the comment in: liferay-plugin-package_6_1_0.dtd) portlets having an liferay-plugin-package.xml, I would recommend to use the corresponding properties file.
Reference file (in the portal sources): /definitions/liferay-plugin-package_6_1_0.properties


text:
Q: Network Card (NIC RTL8111HS) Driver installation 18.04 I just installed Ubuntu Server (Bionic Beaver) on a new PC.
It seems like my internet connection does not work at all (pinging Google does not work and the orange LED on the ethernet port lights constantly), so I did some research on Google (via another PC...).
I found out that this could be an incompatible driver version.
Ubuntu 18.04 LTS comes with Linux Kernel 4.15 (https://wiki.ubuntuusers.de/Bionic_Beaver/).
My NIC: Realtek 8111HS
As I have absolutely no experience with drivers and that kind of things, I visited some webpages and found the following:

*

*https://launchpad.net/ubuntu/bionic/+package/r8168-dkms
which seems to be an older driver version as it says "This driver should only be used for devices not yet supported by the
in-kernel driver r8169."

*https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/ethernet/realtek?h=v4.15 Indeed, (I think) this shows that Kernel 4.15 comes with the newer 8169 driver version

*https://medium.com/@lgobinath/no-ethernet-connection-in-ubuntu-16-04-linux-mint-18-with-realtek-rtl8111-8168-8411-7ae2779dc9b8 This article is about the same problem (more or less)

*https://www.realtek.com/en/component/zoo/advanced-search/72?Itemid=276 This is the Realtek Software Download site, unfortunately, my NIC is not listed there, but only some others like RTL8111F, RTL8111G and RTL8111GUS. However, the software button takes me to this download site:

*https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-pci-express-software So I chose Unix (Linux) -> LINUX driver for kernel up to 4.15 and downloaded the software. What did I get? Driver version r8168-8.046.00. Strange, as this version does not appear on the site above. Instead, the launchpad site (link above) shows me several versions of which the latest are r8168-dkms 8.045.08-2 in amd64 (Proposed)/(Released). So I also downloaded the (Released) version there by clicking on it -> Downloadable files -> downloading the .deb file. I don't think that that's the right file though, because the folder structure is weird: it contains two directories 'control' and 'data'. So I assume this is for Debian only, not for Ubuntu and consequently not for me. So I also downloaded the source file from here:

*https://launchpad.net/ubuntu/+source/r8168/8.045.08-2 I chose the largest file which is about 1.2MB (fortunately, because the other file I downloaded, the 8.046 file, has about the same size, so I feel confirmed).
One thing that I still don't understand is why the included README file lists a ton of NICs: This is the Linux device driver released for RealTek RTL8168B/8111B, RTL8168C/8111C, RTL8168CP/8111CP, RTL8168D/8111D, RTL8168DP/8111DP, and RTL8168E/8111E Gigabit Ethernet controllers with PCI-Express interface., but my Realtek 8111HS is not included although the launchpad site again explicitly lists my NIC.
So the steps I would take to resolve my problem are the following:

*

*Take the 'r8168_8.045.08.orig.tar.bz2' file from here, put it onto a USB stick, plug the stick into the Ubuntu PC, copy the file to the root folder (extract) and execute autorun.sh with root rights (or basically, do everything as mentioned in the README).

Is that correct? Will everything work after that? Do I still have to patch anything or uninstall the old driver or reload anything? Will it work? Are my assumptions correct?
I know, this question might be a little long, however I think it was more important to be accurate than keeping the answer short and (maybe) forgetting something.
Edit: Just found out that v8.046 is part of Ubuntu Cosmic.
Also, I configured my network by editing the yaml file in /etc/netplan with DHCPv4 as described here.(and with correct indentation!)
The result of lspci -nnk | grep 0200 -A3:
02:00:0 Ethernet controller [<red>0200</red>]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 15)
    Subsystem: Gigabyte Technology Co., Ltd. Onboard Ethernet [1458:e000]
    Kernel driver in use: 8169
    Kernel modules: r8169

The Netplan configuration file (YAML):
network:
  version: 2
  renderer: networkd
    ethernets:
        enp3s0:
            addresses: []
            dhcp4: true

A: I don't believe the indentation is correct. Please try:
network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
      dhcp4: true

Follow with:
sudo netplan generate
sudo netplan apply

Assuming there are no errors or warnings, reboot and you should be connected.
Reference: /usr/share/doc/netplan.io/examples/dhcp.yaml


text:
Q: how do i pass props to next screen using Navigate <Navigate to={"/plans"} />;
I am using this to navigate to plans page but i want to send some data with it any idea how can I do it? new to programming

A: Pass data in route state on the Navigate component's state prop.
Navigate

declare function Navigate(props: NavigateProps): null;

interface NavigateProps {
  to: To;
  replace?: boolean;
  state?: State;
}

Usage:
<Navigate to={"/plans"} state={{ data }} />

And to access the route state on the target routed component use the useLocation hook access it.
const { state } = useLocation();

...

const { data } = state;

A: you can read here https://reactnavigation.org/docs/params. you can pass some props using navigate and route.
for example in screen 1
      <Button
        title="Go to Details"
        onPress={() => {
          navigation.navigate('Details', {
            itemId: 86,
            otherParam: 'anything you want here',
          });
        }}
      />

in screen 2
function DetailsScreen({ route, navigation }) {
  const { itemId, otherParam } = route.params;
  return (
  );
}

you can navigate using the name of screen
import { createStackNavigator } from '@react-navigation/stack';

const Stack = createStackNavigator();

function MyStack() {
  return (
    <Stack.Navigator>
      <Stack.Screen name="Home" component={HomeScreen} />
      <Stack.Screen name="Details" component={DetailsScreen} />
    </Stack.Navigator>
  );
}


text:
Q: writeData on a syncsocket always blocks on iPhone I use the asyncsocket sample as a starting point to learn more about wlan communication on iPhone.
On the Mac I start a sample server opening port 0. This works, since I can write data with a test client running on the mac.
On the iPhone I think I managed to connect since "streams connected" returns YES.
Then I would like to send data with a syncsocket: (EDITED VERSION WITH COMPLETE CODE)

import "InterfaceTestAppDelegate.h"
import "InterfaceTestViewController.h"
import "AsyncSocket.h"
import "SyncSocket.h"

@implementation InterfaceTestAppDelegate

@synthesize window;
@synthesize viewController;

*

*(void)onSocket:(AsyncSocket *)sock didConnectToHost:(NSString *)remoteHost port:(UInt16)remotePort
{
NSLog(@"Socket is connected!");

NSLog(@"Remote Address: %@:%hu", remoteHost, remotePort);

NSString *localHost = [sock localHost];
UInt16 localPort = [sock localPort];

NSLog(@"Local Address: %@:%hu", localHost, localPort);
}

*(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSLog(@"application:didFinishLaunchingWithOptions:");

/*
        asyncSocket = [[AsyncSocket alloc] initWithDelegate:self];

        NSError *err = nil;
            if (![asyncSocket connectToHost: @"192.168.0.30" onPort: 1234 error: &err])
            {
                NSLog(@"Error connecting: %@", err);
            }
    NSData *data = [@"testxyz" dataUsingEncoding:NSUTF8StringEncoding];

    NSLog(@"trace 1");
    [asyncSocket writeData:data withTimeout:10 tag:0];
    NSLog(@"trace 2");

*/
                    syncSocket = [[SyncSocket alloc] initWithTimeout: 10];
        syncSocket.nsLog = YES;
        if (![syncSocket connectToHost: @"192.168.0.30" onPort: 12345])
        {
            NSLog(@"Error connecting syncSocket:");
        }
        NSData *data = [@"testxyz" dataUsingEncoding:NSUTF8StringEncoding];

    NSLog(@"syncSocket trace 1");
    [syncSocket writeData:data];
    NSLog(@"syncSocket trace 2");

[window addSubview:viewController.view];
[window makeKeyAndVisible];
return YES;
}
It never continues to send the data, the writeData always blocks.
The IP 192.168.0.30 is my Mac's IP. I just used any port 12345 now as you suggested above.
But I don't really know what I have to do on the Mac to receive??
As you can see I actually use syncsocket, then it blocks.
I also tried asyncSocket, then I get the message in the asyncsocket class: writeStream Can NOT Accept Bytes
Maybe its that I don't setup the Mac correctly,ie what app do I need to run on the Mac to test?
Many thank!

A: For what it's worth,  this is specifically how you typically read in some data using AsyncSocket:
-(void)onSocket:(AsyncSocket *)sock
        didReadData:(NSData*)data withTag:(long)tag
    {
    [data getBytes:&getMe length:sizeof(CommProt)];
    // now, you must roll in the next read...
    [sock readDataToLength:sizeof(CommProt) withTimeout:-1 tag:0];

    // CommProt is your communications protocol, so sizeof(CommProt)
    // is how much to read at a chunk.

    // you can now simply access the fields of getMe,
    // for example getMe.x, getMe.y, getMe.latestValue etc etc.

    // hope it helps!
    }

Of course, you would have previously rolled in the first "primer" read command:
You do that when you connect to a host, hence:
-(void)onSocket:(AsyncSocket *)sock
        didConnectToHost:(NSString *)host port:(UInt16)port
    {
    if ( yourAppSaysItsOkToConnectAtThisMoment == NO )
        {
        [sock disconnect];  // (so easy, AsyncSockets is a masterpiece)
        return;
        }

    // .. blah blah

    // the critical 'primer' read command
    [sock readDataToLength:sizeof(CommProt) withTimeout:-1 tag:0];

    // .. blah blah
    }

Don't forget you must roll in the next read in two places, (a) when you first connect and (b) of course, after each read!
In the example your communications protocol would look like this ...
typedef struct _CommProt        // v.3
    {
    BOOL        pressExplosionButton;
    BOOL        pressFireworksButton;
    float       usersSteering;
    float       usersTemperature;
    float       usersAltitude;
    float       usersAngle;
    }
    CommProt;

Variable like "getMe" in the example would simply look like this:
    CommProt                getMe;
    CommProt                sendMe;

If you are struggling to understand this type of communications protocol, also try this long answer:
Tablet(iPad/Android)-Server Communication Protocol
AsyncSocket is incredibly beautiful, it was written by the mysterious Justin Voss who seemed to drop off the internet after giving it to the world - it's one of the best libraries ever written, it's a masterpiece.
Hope it helps.


text:
Q: Facebook\WebDriver\Exception\NoSuchElementException: no such element: Unable to locate element I have this code
@forelse($companies as $company)

                        <input class="custom-control-input" type="radio" id="company-{{$company->id}}" value="{{$company->id}}" name="company_id" >
                          id}}">
                                            {{$company->name}}

how I can test it using laravel dusk ???
I tried this
      $emailparts=explode('@',$userEmail);
      $companies=Company::select('companies.*')->whereRaw("SUBSTRING_INDEX(companies.email,'@',-1)='{$emailparts[1]}'")->get();
                ->select("company-".$companies->random()->id)

but its give me this error
Facebook\WebDriver\Exception\NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"body select[name='company-16']"}

How to fix it ??


text:
Q: ffmpeg mov to mp4 plays fine on linux no video on windows I am using the cmd ffmpeg -i MAG.mov -c:a aac -strict -2 MAG.mp4
On my linux box playback video & audio is fine. On Windows there is audio only. Any idea how to fix?

A: Actually your question should be more like "why is the player x on my operating system y not able to play the file".
On the other hand you tagged the question "ffmpeg", so here comes the ffmpeg related answer:
ffmpeg -i MAG.mov -c:a aac -strict -2 MAG.mp4

You do not specify most possible base parameters in this command, so ffmpeg copies whatever can be copied to the output format (except the codec, this will be decided based on the extension).
Interpolating the little information you gave us i have to assume that you used windows "media player" on a windows 7 box without addtional directshow codecs installed.  If it was like this, the answer would be like "please install a h264 compatible directshow decoder and some mp4 demuxing directshow filter on your box.
If you want to guarantee the playback on windows, you best just force your output to be wmv:
ffmpeg -i MAG.mov -strict -2 MAG.wmv


text:
Q: Conversion: uid_t to string, off_t to string I am currently writing a systems programming homework and in one part i need to get some information of a file in a directory.
for the stat of file, we have ctime() function which converts time_t type to string and returns a pointer to it.
but how about the uid_t and off_t types? I searched through to internet and couldnt find any function.. Or if there does not exist any function, can you tell me how to implement such a function please?

A: Both are defined as arithmetic types (http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/types.h.html), and in practice are positive and integral.  So you can just cast to unsigned long long, and use sprintf with "%llu" to convert to string.

A: size_t and off_t are just unsigned integral types. (Edit: off_t is a long? See, the lesson is, check your headers!)
So use sprintf (or whatever) to convert them using the "%i" format specifier.
On edit: crap, you changed size_t to uid_t while I was answering. uid_t is defined in types.h; look there. (It's also an unsigned integral type, but an unsigned short.)

A: Linux' snprintf() supports the 'z' format specifier for values of type size_t. Not sure how portable this is, you'll need to inspect the "CONFORMS TO" section closely.
For off_t, you might need to cast to the largest unsigned integer type, i.e. unsigned long and use a "lu" specifier.

A: off_t is a long int: format = "%ld"
size_t is an unsigned int: format = "%u"
You can use these format in sprintf function to convert into a char*.

A: Using gcc 5.4.0 the following line:
printf("user #%ld did this or that!\n", uid);

raised the following warning:
..main.c:133:9: warning: format '%ld' expects argument of type 'long int', but argument 2 has type 'uid_t {aka unsigned int}' [-Wformat=]

I would suggest you to do the same and check your compiler's output. =)


text:
Q: Delete certain text pattern in python I'm trying to get rid of a certain pattern of text in my .txt file, which looks something like:

mystring = '''

example deletion words
in the first block

First sentence to keep.

example deletion words
in the second block

Second sentence to keep.

example deletion words
in the third block

Third sentence to keep.

example deletion words
in the fourth block'''

My desired output would look like:

"First sentence to keep.
Second sentence to keep.
Third sentence to keep."

So what I'm trying to do is get rid of all text between the strings "example" and "block", including the strings themselves. Any idea how I would go about that in either R or Python?

Sorry for forgetting to include my attempt with regex and just asking out of the blue and thanks to the people who took the effort to answer regardless. My working solution using regex and re package in python:
import re

cleanedtext = re.sub('\nexample.*?block','',mystring, flags=re.DOTALL)

print(cleanedtext)

A: In R, you can use str_remove_all from stringr
stringr::str_remove_all(string, "example.*block")
 #[1] " First sentence to keep.\nSecond sentence to keep.\nThird sentence to keep.\n"

which is shorthand for
stringr::str_replace_all(string, "example.*block", "")

data
string <- "example deletion words in the first block First sentence to keep.
           example deletion words in the second blockSecond sentence to keep.
           example deletion words in the third blockThird sentence to keep.
           example deletion words in the fourth block"

A: Do you already know the pattern ahead of time or does the pattern ever change? If not then you could read the text file, go line by line, split the sentence to easily manipulate, and then look for the pattern. For lines that don't have it, you can concatenate it to a new string. What I had below seemed to work:
f = open("mytext.txt", "r")
final = ""
for line in f:
    words = line.split(" ")
    if(words[0] == "example" or words[len(words) - 1] == "block\n"):
        continue
    else:
        final = final + line
print(final)

And the output I got was:
First sentence to keep.

Second sentence to keep.

Third sentence to keep.


text:
Q: c# Expander content is not on the left I have the problem that the content of the expander does not start at the left, how can I solve this?
As you can see on the picture, the contents of my expander are not shown to the far left. I have tried many settings, unfortunately I do not come to the solution. The expander itself also seems to have an edge opposite the stackpanel, which I also want to avoid.
Above the expander you can see a grid, which contains a text block with content. This grid has the right mass within the higher-level stack panel.
Expander exp = new Expander
        {
            Header = "TestExpander",
            Width = spStackPanel.Width,
            ExpandDirection = ExpandDirection.Down,
            IsExpanded = true,
            BorderBrush = Brushes.Yellow,
            BorderThickness = new Thickness(1),
            HorizontalAlignment = HorizontalAlignment.Left,
            HorizontalContentAlignment = HorizontalAlignment.Left,
            VerticalAlignment = VerticalAlignment.Top,
            VerticalContentAlignment = VerticalAlignment.Top,
        };

        TextBox tx = new TextBox
        {
            Text = "testText"
        };

        exp.Content = tx;

        spStackPanel.Children.Add(exp);

A: I can't comment so apologies for the somewhat vague answer, but it might help to share the styling and XAML used to create your screenshot. By default that isn't how an Expander looks, so my guess is that something in your styling or one of the higher level controls (e.g. StackPanel or Grid) is affecting the layout of the Expander.
Example being possibly a keyless style for TextBox that applies padding and/or horizontal alignment, which would then affect the content you're adding by creating a new TextBox in your snippet to give it that odd alignment.

A: I have written a test here, directly in a .cs file WITHOUT XML:
buttonGrid = new Grid();
        buttonGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(50) });
        buttonGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(50) });

        Expander exp = new Expander()
        {
            Header = "Test Expander",
            HorizontalAlignment = HorizontalAlignment.Left,
            Margin = new Thickness(0),
            IsExpanded = true
        };

        TextBlock label = new TextBlock()
        {
            HorizontalAlignment = HorizontalAlignment.Left,
            Margin = new Thickness(0),
            Text = "Test Text"
        };
        exp.Content = label;
        Grid.SetRow(exp, 0);
        buttonGrid.Children.Add(exp);

        TextBlock text = new TextBlock()
        {
            HorizontalAlignment = HorizontalAlignment.Left,
            Margin = new Thickness(0),
            Text = "Test Text",
            Foreground = Brushes.White
        };
        Grid.SetRow(text, 1);
        buttonGrid.Children.Add(text);

I know that an expander doesn't usually look like this, so I ask my question ;-)
maybe someone has me a tip to look for.


text:
Q: How to efficiently compare two sets of unordered vectors (`np.ndarray`)? I tried to make my question clearer. The old digression can still be found at the end of this.
PROBLEM: I have an n by 3 matrix A (np.ndarray) of n points in three dimensions. We say those points are symmetric in relation to a transformation R (3 by 3 matrix) if they are stationary as an unordered set.
This means that A and A @ R.T differ by 1. at most a permutation and 2. after corrected for permutation, both matrices might differ by a numerical tolerance parameter: np.allclose(A, permuted(A @ R.T)) == True (I don't know permuted() beforehand and this surely depends on R).
QUESTION: how do I create the following function:
def is_symmetric(A, R, atol=1e-5) -> bool:
    # checks symmetry as defined above, considering both numerical noise
    # and permutation of vectors.

(Some discussion on possible ways and my doubts and attempts are to be found below.)

OLD DIGRESSION:
I want to check for symmetries in a collection of points, represented as vectors. That means checking whether those points are invariant regarding the application of a matrix transform in space, e.g., rotation or plane mirroring.
import numpy as np
R = np.array([[0, -1, 0],  # 90° rotation around z as an example
              [1,  0, 0],
              [0,  0, 1]])

The point is that I accept a permutation of the vectors: as long as some initial position gets transformed to some other, preexisting, location, I'm fine. That means checking for transformed pairs of vectors from one to the other.
The naïve solution would be looping over the rows of A @ R.T (where A is a matrix whose rows are point positions) and try to match a transformed vector for each initial row of A, which seems to grow quadratically with the number of columns.
Another possibility would be preordering the vectors (say, by their coordinate values):
A = np.array([[1,   0,   0],  # some points
              [0,   1,   0],
              [0,   0,   1],
              [0.5, 0.5, 0]])
A = np.array(sorted(A, key=lambda v: (v[2], v[1], v[0])))  # sort by z, y, x values
# array([[1. , 0. , 0. ],
#        [0.5, 0.5, 0. ],
#        [0. , 1. , 0. ],
#        [0. , 0. , 1. ]])

A_rotated = np.array(sorted(A @ R.T, key=lambda v: (v[2], v[1], v[0])))
# array([[-1. ,  0. ,  0. ],   # no match
#        [-0.5,  0.5,  0. ],   # no match
#        [ 0. ,  1. ,  0. ],   # match
#        [ 0. ,  0. ,  1. ]])  # match

(This approach does two sorts so O(n ln(n))?)
The third idea would be to compare sets created from the original and rotated vectors. I have a gut feeling that this is as good as comparing sorted vectors.
But one thing remains: how to deal with approximate comparison? I want to accept two vectors v and w being equal if e.g. np.allclose(v, w) == True or equivalent (i.e., abs(v - w) < eps or similar):
np.allclose([1, 0, 0], [1, 0, 0])
# True
np.allclose([1, 0, 0], [1 + 1e-5, 0, 0], atol=1e-5)
# True
np.allclose([1, 0, 0], [1 + 1e-4, 0, 0], atol=1e-5)
# False

So here is the question: how do I (efficiently) compare two (unordered) sets of vectors for equality, taking numerical approximation (e.g. np.allclose) into account?

A: It is simple, you transform all the values of your vectors which are <atol to 0. You can do that using numpy.vectorize, look for the doc here.
import numpy as np

def transform(x, atol):
    if x>0 and x-1<atol:
        return 1
    else:
        return x

myarray = np.array([[1, 0, 0], [1 + 1e-4, 0, 0]])
vf = np.vectorize(transform)
new_array = vf(myarray, atol=1e-5)

Now you can make your symetry verification.
Please tell me if I answered to your question.
UPDATE
I see you already have the function isclose() in numpy, you SHOULD use it, rather than my funcion from scratch.
Nevertheless, I shall not delete my answer, in order to keep the comments related to it.

A: Here's a function that works using np.lexsort:
def is_symmetric(A, R, *args, **kwargs):
    A = np.asanyarray(A)
    A = A[np.lexsort(A.T)]

    A_t = A @ np.asanyarray(R).T
    A_t = A_t[np.lexsort(A_t.T)]
    return np.allclose(A, A_t, *args, **kwargs)

Some results:
R = np.array([[0, -1, 0],  # 90° rotation as an example
              [1,  0, 0],
              [0,  0, 1]])

is_symmetric([[0, 0, 0]], R)
# True
is_symmetric([[1, 0, 0],
              [0, 1, 0],
              [0, 0, 0]], R)
# False
is_symmetric([[1, 0, 0],
              [0, 1, 0],
              [0, 0, 0],
              [-1, 0, 0]], R)
# False
is_symmetric([[1, 0, 0],
              [0, 1, 0],
              [0, 0, 0],
              [-1, 0, 0],
              [0, -1, 0]], R)
# True

Performance seems fine for 100000 random vectors:
A = np.random.rand(100000, 3)
%timeit is_symmetric(A, R)
# 82.2 ms ± 75.4 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)


text:
Q: Amazon Product API with R I would like to use R to send requests to the Amazon Product API service.
Is there a way to authenticate and query the Amazon Product API with R without getting the following error:
"The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details."

A: Try this
This should perform a search using the Product Advertising API, which I think you mean.
You need to supply the AWSAccessKeyId and AWSsecretkey,
which can be acquired on: http://docs.amazonwebservices.com/AWSECommerceService/2011-08-01/GSG/
search.amazon <- function(Keywords, SearchIndex = 'All', AWSAccessKeyId, AWSsecretkey, AssociateTag, ResponseGroup = 'Small', Operation = 'ItemSearch'){
     library(digest)
     library(RCurl)

 base.html.string <- "http://ecs.amazonaws.com/onca/xml?"
 SearchIndex <- match.arg(SearchIndex, c('All',
                                             'Apparel',
                                             'Appliances',
                                             'ArtsAndCrafts',
                                             'Automotive',
                                             'Baby',
                                             'Beauty',
                                             'Blended',
                                             'Books',
                                             'Classical',
                                             'DigitalMusic',
                                             'DVD',
                                             'Electronics',
                                             'ForeignBooks',
                                             'Garden',
                                             'GourmetFood',
                                             'Grocery',
                                             'HealthPersonalCare',
                                             'Hobbies',
                                             'HomeGarden',
                                             'HomeImprovement',
                                             'Industrial',
                                             'Jewelry',
                                             'KindleStore',
                                             'Kitchen',
                                             'Lighting',
                                             'Magazines',
                                             'Marketplace',
                                             'Miscellaneous',
                                             'MobileApps',
                                             'MP3Downloads',
                                             'Music',
                                             'MusicalInstruments',
                                             'MusicTracks',
                                             'OfficeProducts',
                                             'OutdoorLiving',
                                             'Outlet',
                                             'PCHardware',
                                             'PetSupplies',
                                             'Photo',
                                             'Shoes',
                                             'Software',
                                             'SoftwareVideoGames',
                                             'SportingGoods',
                                             'Tools',
                                             'Toys',
                                             'UnboxVideo',
                                             'VHS',
                                             'Video',
                                             'VideoGames',
                                             'Watches',
                                             'Wireless',
                                             'WirelessAccessories'))
 Operation <- match.arg(Operation, c('ItemSearch',
                                             'ItemLookup',
                                             'BrowseNodeLookup',
                                             'CartAdd',
                                             'CartClear',
                                             'CartCreate',
                                             'CartGet',
                                             'CartModify',
                                             'SimilarityLookup'))
 ResponseGroup <- match.arg(ResponseGroup, c('Accessories',
                                             'AlternateVersions',
                                             'BrowseNodeInfo',
                                             'BrowseNodes',
                                             'Cart',
                                             'CartNewReleases',
                                             'CartTopSellers',
                                             'CartSimilarities',
                                             'Collections',
                                             'EditorialReview',
                                             'Images',
                                             'ItemAttributes',
                                             'ItemIds',
                                             'Large',
                                             'Medium',
                                             'MostGifted',
                                             'MostWishedFor',
                                             'NewReleases',
                                             'OfferFull',
                                             'OfferListings',
                                             'Offers',
                                             'OfferSummary',
                                             'PromotionSummary',
                                             'RelatedItems',
                                             'Request',
                                             'Reviews',
                                             'SalesRank',
                                             'SearchBins',
                                             'Similarities',
                                             'Small',
                                             'TopSellers',
                                             'Tracks',
                                             'Variations',
                                             'VariationImages',
                                             'VariationMatrix',
                                             'VariationOffers',
                                             'VariationSummary'),
                            several.ok = TRUE)
 version.request = '2011-08-01'
 Service = 'AWSECommerceService'
 if(!is.character(AWSsecretkey)){
  message('The AWSsecretkey should be entered as a character vect, ie be qouted')
 }

 pb.txt <- Sys.time()

 pb.date <- as.POSIXct(pb.txt, tz = Sys.timezone)

 Timestamp = strtrim(format(pb.date, tz = "GMT", usetz = TRUE, "%Y-%m-%dT%H:%M:%S.000Z"), 24)

 str = paste('GET\necs.amazonaws.com\n/onca/xml\n',
        'AWSAccessKeyId=', curlEscape(AWSAccessKeyId),
             '&AssociateTag=', AssociateTag,
             '&Keywords=', curlEscape(Keywords),
             '&Operation=', curlEscape(Operation),
             '&ResponseGroup=', curlEscape(ResponseGroup),
             '&SearchIndex=', curlEscape(SearchIndex),
             '&Service=AWSECommerceService',
             '&Timestamp=', gsub('%2E','.',gsub('%2D', '-', curlEscape(Timestamp))),
             '&Version=', version.request,
             sep = '')

 ## signature test
 Signature = curlEscape(base64(hmac( enc2utf8((AWSsecretkey)), enc2utf8(str1), algo = 'sha256', serialize = FALSE,  raw = TRUE)))

 AmazonURL <- paste(base.html.string,
             'AWSAccessKeyId=', AWSAccessKeyId,
             '&AssociateTag=', AssociateTag,
             '&Keywords=', Keywords,
             '&Operation=',Operation,
             '&ResponseGroup=',ResponseGroup,
             '&SearchIndex=', SearchIndex,
             '&Service=AWSECommerceService',
             '&Timestamp=', Timestamp,
             '&Version=', version.request,
             '&Signature=', Signature
             sep = '')
 AmazonResult <- getURL(AmazonURL)
 return(AmazonResult)
}

The URL which we get from running this code wont give a signature address. To get a signature address use the following web address and paste the URL over there and click on Display Signed URL.
http://associates-amazon.s3.amazonaws.com/signed-requests/helper/index.html

A: See this post as well as Amazon's Signed Requests Helper. This posting, as well as the two links I've shared helped me get up and running with Amazon's Product Advertising API.

A: I am new and I don't have enough "rep" to comment, but in Micha's answer there needs to be a comma after Signature in this area (I have added the comma):
AmazonURL <- paste(base.html.string,
         'AWSAccessKeyId=', AWSAccessKeyId,
         '&AssociateTag=', AssociateTag,
         '&Keywords=', Keywords,
         '&Operation=',Operation,
         '&ResponseGroup=',ResponseGroup,
         '&SearchIndex=', SearchIndex,
         '&Service=AWSECommerceService',
         '&Timestamp=', Timestamp,
         '&Version=', version.request,
         '&Signature=', Signature,
         sep = '')

A: Check  http://www.omegahat.org/ . There are several Amazon-related packages there, and even if Product API might not be among these, you should be able to copy the basic functions.

A: which Amazon Product API you are interested in?
I never saw an interface for the "Product Advertising API"! For AWS you can use the package AWS tools package at CRAN: http://cran.r-project.org/web/packages/AWS.tools/index.html


text:
Q: Python list comparison numpy optimization I basically have a dataframe (df1) with columns 7 columns. The values are always integers.
I have another dataframe (df2), which has 3 columns. One of these columns is a list of lists with a sequence of 7 integers. Example:
import pandas as pd
df1 = pd.DataFrame(columns = ['A','B','C','D','E','F','G'],
         data = np.random.randint(1,5,(100,7)))

df2 = pd.DataFrame(columns = ['Name','Location','Sequence'],
         data = [['Alfred','Chicago',
                  np.random.randint(1,5,(100,7))],
                ['Nicola','New York',
                  np.random.randint(1,5,(100,7))]])

I now want to compare the sequence of the rows in df1 with the 'Sequence' column in df2 and get a percentage of overlap. In a primitive for loop this would look like this:
df2['Overlap'] = 0.
for i in range(len(df2)):
    c = sum(el in list(df2.at[i, 'Sequence']) for el in df1.values.tolist())
    df2.at[i, 'Overlap'] = c/len(df1)

Now the problem is that my df2 has 500000 rows and my df1 usually around 50-100. This means that the task easily gets very time consuming. I know that there must be a way to optimize this with numpy, but I cannot figure it out. Can someone please help me?

A: By default engine used in pandas cython, but you can also change engine to numba or use njit decorator to speed up. Look up enhancingperf.
Numba converts python code to optimized machine codee, pandas is highly integrated with numpy and hence numba also. You can experiment with parallel, nogil, cache, fastmath option for speedup. This method shines for huge inputs where speed is needed.
Numba you can do eager compilation or first time execution take little time for compilation and subsequent usage will be fast
import pandas as pd
df1 = pd.DataFrame(columns = ['A','B','C','D','E','F','G'],
         data = np.random.randint(1,5,(100,7)))

df2 = pd.DataFrame(columns = ['Name','Location','Sequence'],
         data = [['Alfred','Chicago',
                  np.random.randint(1,5,(100,7))],
                ['Nicola','New York',
                  np.random.randint(1,5,(100,7))]])

a = df1.values
# Also possible to add `parallel=True`
f = nb.njit(lambda x: (x == a).mean())

# This is just illustration, not correct logic. Change the logic according to needs
# nb.njit((nb.int64,))
# def f(x):
#     sum = 0
#     for i in nb.prange(x.shape[0]):
#         for j in range(a.shape[0]):
#             sum += (x[i] == a[j]).sum()
#     return sum

# Experiment with engine
print(df2['Sequence'].apply(f))

A: You can use direct comparison of the arrays and sum the identical values. Use apply to perform the comparison per row in df2:
df2['Sequence'].apply(lambda x: (x==df1.values).sum()/df1.size)

output:
0    0.270000
1    0.298571

To save the output in your original dataframe:
df2['Overlap'] = df2['Sequence'].apply(lambda x: (x==df1.values).sum()/df1.size)


text:
Q: Return record or null I have the following query, what this does it return a conversation history between two users as well as their profile picture.
SELECT m.Id, p.Id [SenderId], mr.RecipientId, p.Username, m.[Message], p.LastLoggedIn, p.LoggedIn, up.PhotoId, @UserId [UserId], m.SentDate
FROM [User].[User_Profile] p
INNER JOIN [User].[User_Details] d on p.Id = d.UserId
INNER JOIN [User].[User_Photos] up on p.Id = up.UserId
INNER JOIN [MailBox].[Message] m on p.Id = m.SenderId
INNER JOIN [MailBox].[MessageRecipient] mr on m.Id = mr.MessageId
WHERE
   (p.id = @UserId or p.id = @SenderId)
AND
    up.IsProfilePic = 1

AND (mr.RecipientId = @UserId and m.SenderId = @SenderId or m.SenderId = @UserId and mr.RecipientId = @SenderId)

AND p.ProfileStatus = 4

AND NOT EXISTS(SELECT UserId FROM [User].[Block_List]
                                      WHERE DateBlocked is not null
                                           AND(
                                              (BlockedById = @UserId and UserId = p.Id)
                                           OR
                                              (BlockedById = p.Id and UserId = @UserId)
                                           ))

AND mr.DeletedDate is null

order by m.Id

As you can see I have specified where up.IsProfilePic = 1 this works fine if both user's have set a profile picture but if either of them do not set a profile picture then I need to return null for that particular user if not both, because at present it will only return 1 user due to the other not having a profile picture set.
Now the user photo table could consist of 10+ photos per user or even 0 if they haven't uploaded any.  The photoId I'm interested in is where IsProfilePic = 1 if this isn't set or no photos exist for that particular user then return null for PhotoId but I can think for the life of me how to achieve this, I did try saying
isnull(up.PhotoId, 'NoPhoto')

Within the select statement but that didn't seem to work either, any help would be greatly appreciated.

A: Make a left join on the photos table and put the condition in the on clause:
LEFT JOIN [User].[User_Photos] up ON p.Id = up.UserId AND up.IsProfilePic = 1

This will match the profile picture if there is one, otherwise you get null values for the fields of that table for that record.
By putting the condition in the on clause it will limit the records that are joined instead or limiting the entire result.

A: why on earth do you have both @UserId and @SenderId?  you should have 1 and rename the alias p to pSender, and rename up to upSender (because you have joined it on m.SenderId, you should make the alias table name clear that its the photo for your sender.
also your User_Photos table could be LEFT JOIN not inner join, else when there are zero records your query will return nothing.
INNER JOIN [User].[User_Photos]
and put [MailBox].[Message] m  as your first FROM item, because it is the most important.
try those things, and then see how you go.


text:
Q: Removing ShipFree coupon is one product in cart matches specific category First post so bare with me. We have an issue with the logic on our Shipfree coupon code. What we want is to invalidate the shipfree coupon code if any one product in the cart is assigned to a specific category. We'll call this category "over-sized items".
Right now if a customer has one item in the "over-sized items" category and one item that is not, Magento will still apply the coupon. How can we get it to invalidate the coupon based on that one item in the "over-sized items" category?

A: I would try adding a condition to the coupon's Cart Price Rule.


text:
Q: How can I change notification sounds on iOS? When I get a notification, my phone has the standard "message received" sound for e.g. Twitter.
iOS 5 has sound settings for Text, Voicemail, Mail Received, Sent, and Tweet.
However, the Tweet sound seems to only apply to outgoing tweets, not received ones. In Notification Center settings, I can turn on "Sound" for each application, but is it possible to change the sound for app notifications globally, or better yet, per-application?

A: This is one of the bigger changes in iOS 5. Under Settings -> Sounds you can change quite a few tones including Twitter, Mail and Sent Mail. It's not everything but the major one's are covered and a huge improvement from the previous versions.
They've also added a considerable amount of new tones, and you can now assign custom tones to all of them which previously didn't work.

If you are referring to the notification beep you hear when you are inside the application itself, that will depend on each application if the developer has setup an option to change it. These aren't notifications as such, but rather built into the application and triggered by events inside the application.
Some applications, for example, What's App, will allow you to change the notification in it's own settings.
The short answer to this therefore is that it depends on the application, some can be globally controlled, and others need to have the ability enabled inside the application.

A: Not so far. You can do decide whether to turn on the sound or not for particular app (if it enables user to turn off the notification sound). But you cannot change the notification sound globally or per-app (not at least in iOS 5).

A: If you don't like the alert sounds that came with that new app you just downloaded, they're actually pretty easy to change—and you don't even need to jailbreak your phone.
Unfortunately, this only works with non-Apple apps that use their own alert tones. If the app is using a tone that came with the iPhone (like Google Voice's app does), you'll need to be jailbroken to change it. Jailbreaking isn't that hard though. If you don't want to jailbreak, here's how to change an alert tone.


text:
Q: SSH Permission denied (using right password) I am having troubles setting an ssh connection between two laptops of mine. I tried different solutions posted on-line, but nothing worked. Since I am pretty new with SSH, I might be missing something important. I am using Ubuntu 14.04 LTS on the client, and Ubuntu 16.04 LTS on the server.
Here are the steps that I followed:
On the client:

*

*Specified host configuration options in ~/.ssh/config:
Host [hostname]
  User [username]
  Hostname [IP address of host]
  ServerAliveInterval 10

*Generated RSA key by running:
ssh-keygen -t rsa -b 4096 -o -a 100

*

*I supplied a password to ssh-keygen. Private key was saved in ~/.ssh/id_rsa, whereas public key was saved in ~/.ssh/id_rsa.pub

*I manually copied ~/.ssh/id_rsa.pub to a USB key.

*At this point, file modes are as follows:
In ~/.ssh:
   -rw-rw-r--    config
   -rw-------    id_rsa
   -rw-r--r--    id_rsa.pub

On the server:

*

*installed openssh-server;

*created a new file  ~/.ssh/authorized_keys by doing as follows
cat /media/daniele/disk/id_rsa.pub >> ~/.ssh/authorized_keys

*

*set file mode of ~/.ssh/authorized_keys to

-rw-rw-r--

*

*manually edited /etc/ssh/sshd_config to have

in /etc/ssh/sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile     %h/.ssh/authorized_keys
PasswordAuthentication yes

Finally, on the client, when I try:
ssh [username]@[hostname]

the server asks for the password
[username]@[hostname]'s password:

but, even if I enter the correct one, the server does not accept it:
Permission denied, please try again

and, after three attempts, it closes the connection. Please find here a more descriptive output I get by using
ssh -v -v -v [username]@[hostname]

Any help would be greatly appreciated.
Thank you very much for your time

A: Instead of using the hostname of the server, try using the ip-adres.
I ran into the same problem when setting up my server and this seemed to resolve the problem.
ssh [username]@[host_ip-adres]
If you want to use the hostname you might need to set up a dns-server.
but you can do without.

A: You should decide whether you want connection authentication by key/id or by password then focus on that to find the issue.  I recommend using key/id since when managed correctly, it is the more secure method.
SSH will always fall back to asking for a password even in cases where it will never work.  To avoid this use -o 'batchmode yes' (these quotes are needed) on the client ssh command making the connection.  Then if the key cannot be accepted, it bypasses the password prompt (this is normally for use of ssh in a script that needs to avoid getting stuck at the password prompt).  SSH will only try 3 keys at one time, so if the valid key is the 4th, it will not be tried and the connection will be aborted.  It is best to try only one key per connection attempt if you are certain that it is the correct one.  Then you can repeat the connection attempts while making changes at the server.  It will help to have log file information from the server.  Do grep sshd /var/log/auth.log to see what sshd is trying to tell you.

A: When you define Host with Host [hostname] you have to use ssh [hostname]
Permission is denieed because you're not actually using the keyfile when ssh [user]@[hostname]

A: If you didn't load your private key (the one without .pub) into the ssh-agent then you need to specify it in your ssh connection.
SSH -i ~/.ssh/id_rsa user@host

It looks like it isn't asking you for your ssh key pass, but your user pass which is why your password is failing

A: You may try adding your user to the /etc/ssh/sshd_config:
...
AllowUsers ... <username>
...