text:
Q: Issues with OpenGL on a remote Ubuntu 20.04 machine with NVIDIA GTX 1070 I have an Ubuntu 20.04 machine with an NVIDIA 1070 that I am connecting to with a laptop also running Ubuntu 20.04 with an NVIDIA GeForce MX150. OpenGL seems to work just fine on each individually, glxgears works fine when running using a monitor on the remote machine and it works fine on my laptop. However I can't get anything that needs openGL to work when connecting remotely.
My understanding is that I cannot simply X forward a window/GUI application that relies on opengl. When I ssh into the remote from the terminal, xclock and other x forwarding works just fine, but when I run glxgears I get the following error:
Major opcode of failed request:  152 (GLX)
Minor opcode of failed request:  3 (X_GLXCreateContext)
Value in failed request:  0x0
Serial number of failed request:  32
Current serial number in output stream:  33

When I use x2go to login to the remote and run glxgears on the remote terminal, it crashes the session and closes it out.
Also, my understanding is that x2go would forward the information to be rendered on the local machine, but VNC instead renders the graphics on the remote and then sends the image to the local machine, so I thought that would work better. I tried and still when connected to the remote using a VNC server and I run glxgears on the remote, it just crashes the connection and closes it.
Can someone assist in getting OpenGL graphics to work when connected to a remote machine? It's not even that I want it to run on the remote NVIDIA card, I don't even care if it runs on my local CPU, I just need it to not crash.
Additionally, it has been quite a pain to get all the proper CUDA versions and NVIDIA drivers installed such that they work well with various machine learning projects being used, i.e. projects requiring specific PyTorch versions, so ideally I can use the improved speed of x2go over VNC and just render the graphics on my local MX150 without messing around too much with the NVIDIA drivers/etc on the remote.
I've included below the glxinfo for both my local and remote machine, obtained when using an attached monitor since glxinfo also will not work when executed remotely. I deleted the trail end of some of the extensions and glxinfo command to fit it all in.
Local glxinfo:
$ glxinfo name of display: :1 display: :1 screen: 0 direct rendering: Yes server glx vendor string: NVIDIA Corporation server glx version string: 1.4 server glx extensions: GLX_ARB_context_flush_control, GLX_ARB_create_context, GLX_ARB_create_context_no_error, GLX_ARB_create_context_profile, GLX_ARB_create_context_robustness, GLX_ARB_fbconfig_float, GLX_ARB_multisample, GLX_EXT_buffer_age, GLX_EXT_create_context_es2_profile, GLX_EXT_create_context_es_profile, GLX_EXT_framebuffer_sRGB, GLX_EXT_import_context, GLX_EXT_libglvnd, GLX_EXT_stereo_tree, GLX_EXT_swap_control, GLX_EXT_swap_control_tear, GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_NV_copy_image, GLX_NV_delay_before_swap, GLX_NV_float_buffer, GLX_NV_multigpu_context, GLX_NV_robustness_video_memory_purge, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_SGI_swap_control, GLX_SGI_video_sync client glx vendor string: NVIDIA Corporation client glx version string: 1.4 client glx extensions: GLX_ARB_context_flush_control, GLX_ARB_create_context, GLX_ARB_create_context_no_error, GLX_ARB_create_context_profile, GLX_ARB_create_context_robustness, GLX_ARB_fbconfig_float, GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_buffer_age, GLX_EXT_create_context_es2_profile, GLX_EXT_create_context_es_profile, GLX_EXT_fbconfig_packed_float, GLX_EXT_framebuffer_sRGB, GLX_EXT_import_context, GLX_EXT_stereo_tree, GLX_EXT_swap_control, GLX_EXT_swap_control_tear, GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_NV_copy_buffer, GLX_NV_copy_image, GLX_NV_delay_before_swap, GLX_NV_float_buffer, GLX_NV_multigpu_context, GLX_NV_multisample_coverage, GLX_NV_robustness_video_memory_purge, GLX_NV_swap_group, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_SGI_swap_control, GLX_SGI_video_sync GLX version: 1.4 GLX extensions: GLX_ARB_context_flush_control, GLX_ARB_create_context, GLX_ARB_create_context_no_error, GLX_ARB_create_context_profile, GLX_ARB_create_context_robustness, GLX_ARB_fbconfig_float, GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_buffer_age, GLX_EXT_create_context_es2_profile, GLX_EXT_create_context_es_profile, GLX_EXT_framebuffer_sRGB, GLX_EXT_import_context, GLX_EXT_stereo_tree, GLX_EXT_swap_control, GLX_EXT_swap_control_tear, GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_NV_copy_image, GLX_NV_delay_before_swap, GLX_NV_float_buffer, GLX_NV_multigpu_context, GLX_NV_robustness_video_memory_purge, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_SGI_swap_control, GLX_SGI_video_sync Memory info (GL_NVX_gpu_memory_info): Dedicated video memory: 2048 MB Total available memory: 2048 MB Currently available dedicated video memory: 1417 MB OpenGL vendor string: NVIDIA Corporation OpenGL renderer string: NVIDIA GeForce MX150/PCIe/SSE2 OpenGL core profile version string: 4.6.0 NVIDIA 470.103.01 OpenGL core profile shading language version string: 4.60 NVIDIA OpenGL core profile context flags: (none) OpenGL core profile profile mask: core profile OpenGL core profile extensions: GL_AMD_multi_draw_indirect, GL_AMD_seamless_cubemap_per_texture, GL_AMD_vertex_shader_layer, GL_AMD_vertex_shader_viewport_index, GL_ARB_ES2_compatibility, GL_ARB_ES3_1_compatibility, GL_ARB_ES3_2_compatibility, GL_ARB_ES3_compatibility, GL_ARB_arrays_of_arrays, GL_ARB_base_instance, GL_ARB_bindless_texture, GL_ARB_blend_func_extended, GL_ARB_buffer_storage, GL_ARB_clear_buffer_object, GL_ARB_clear_texture, GL_ARB_clip_control, GL_ARB_color_buffer_float, GL_ARB_compressed_texture_pixel_storage, GL_ARB_compute_shader, GL_ARB_compute_variable_group_size,

OpenGL version string: 4.6.0 NVIDIA 470.103.01 OpenGL shading language version string: 4.60 NVIDIA OpenGL context flags: (none) OpenGL profile mask: (none) OpenGL extensions: GL_AMD_multi_draw_indirect, GL_AMD_seamless_cubemap_per_texture, GL_AMD_vertex_shader_layer, GL_AMD_vertex_shader_viewport_index, GL_ARB_ES2_compatibility, GL_ARB_ES3_1_compatibility, GL_ARB_ES3_2_compatibility, GL_ARB_ES3_compatibility, GL_ARB_arrays_of_arrays, GL_ARB_base_instance, GL_ARB_bindless_texture, GL_ARB_blend_func_extended, GL_ARB_buffer_storage, GL_ARB_clear_buffer_object, GL_ARB_clear_texture, GL_ARB_clip_control, GL_ARB_color_buffer_float, GL_ARB_compatibility, GL_ARB_compressed_texture_pixel_storage, GL_ARB_compute_shader, GL_ARB_compute_variable_group_size, GL_ARB_conditional_render_inverted, GL_ARB_conservative_depth, GL_ARB_copy_buffer, GL_ARB_copy_image, GL_ARB_cull_distance, GL_ARB_debug_output, GL_ARB_depth_buffer_float, GL_ARB_depth_clamp, GL_ARB_depth_texture, GL_ARB_derivative_control, GL_ARB_direct_state_access, GL_ARB_draw_buffers, GL_ARB_draw_buffers_blend, GL_ARB_draw_elements_base_vertex,

OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 470.103.01 OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20 OpenGL ES profile extensions: GL_ANDROID_extension_pack_es31a, GL_EXT_EGL_image_external_wrap_modes, GL_EXT_base_instance, GL_EXT_blend_func_extended, GL_EXT_blend_minmax, GL_EXT_buffer_storage, GL_EXT_clear_texture, GL_EXT_clip_control, GL_EXT_clip_cull_distance, GL_EXT_color_buffer_float, GL_EXT_color_buffer_half_float, GL_EXT_compressed_ETC1_RGB8_sub_texture, GL_EXT_conservative_depth, GL_EXT_copy_image, GL_EXT_debug_label, GL_EXT_depth_clamp, GL_EXT_discard_framebuffer, GL_EXT_disjoint_timer_query, GL_EXT_draw_buffers_indexed, GL_EXT_draw_elements_base_vertex, GL_EXT_draw_transform_feedback,

Remote glxinfo:
name of display: :0.0
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: NVIDIA Corporation
server glx version string: 1.4
server glx extensions:
GLX_ARB_context_flush_control, GLX_ARB_create_context,
GLX_ARB_create_context_no_error, GLX_ARB_create_context_profile,
GLX_ARB_create_context_robustness, GLX_ARB_fbconfig_float,
GLX_ARB_multisample, GLX_EXT_buffer_age,
GLX_EXT_create_context_es2_profile, GLX_EXT_create_context_es_profile,
GLX_EXT_framebuffer_sRGB, GLX_EXT_import_context, GLX_EXT_libglvnd,
GLX_EXT_stereo_tree, GLX_EXT_swap_control, GLX_EXT_swap_control_tear,
GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info, GLX_EXT_visual_rating,
GLX_NV_copy_image, GLX_NV_delay_before_swap, GLX_NV_float_buffer,
GLX_NV_multigpu_context, GLX_NV_robustness_video_memory_purge,
GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_SGI_swap_control,
GLX_SGI_video_sync
client glx vendor string: NVIDIA Corporation
client glx version string: 1.4
client glx extensions:
GLX_ARB_context_flush_control, GLX_ARB_create_context,
GLX_ARB_create_context_no_error, GLX_ARB_create_context_profile,
GLX_ARB_create_context_robustness, GLX_ARB_fbconfig_float,
GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_buffer_age,
GLX_EXT_create_context_es2_profile, GLX_EXT_create_context_es_profile,
GLX_EXT_fbconfig_packed_float, GLX_EXT_framebuffer_sRGB,
GLX_EXT_import_context, GLX_EXT_stereo_tree, GLX_EXT_swap_control,
GLX_EXT_swap_control_tear, GLX_EXT_texture_from_pixmap,
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_NV_copy_buffer,
GLX_NV_copy_image, GLX_NV_delay_before_swap, GLX_NV_float_buffer,
GLX_NV_multigpu_context, GLX_NV_multisample_coverage,
GLX_NV_robustness_video_memory_purge, GLX_NV_swap_group,
GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_SGI_swap_control,
GLX_SGI_video_sync
GLX version: 1.4

GLX extensions:
GLX_ARB_context_flush_control, GLX_ARB_create_context,
GLX_ARB_create_context_no_error, GLX_ARB_create_context_profile,
GLX_ARB_create_context_robustness, GLX_ARB_fbconfig_float,
GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_buffer_age,
GLX_EXT_create_context_es2_profile, GLX_EXT_create_context_es_profile,
GLX_EXT_framebuffer_sRGB, GLX_EXT_import_context, GLX_EXT_stereo_tree,
GLX_EXT_swap_control, GLX_EXT_swap_control_tear,
GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info, GLX_EXT_visual_rating,
GLX_NV_copy_image, GLX_NV_delay_before_swap, GLX_NV_float_buffer,
GLX_NV_multigpu_context, GLX_NV_robustness_video_memory_purge,
GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_SGI_swap_control,
GLX_SGI_video_sync
Memory info (GL_NVX_gpu_memory_info):
Dedicated video memory: 8192 MB
Total available memory: 8192 MB
Currently available dedicated video memory: 7729 MB
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce GTX 1070/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 470.42.01
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
GL_AMD_multi_draw_indirect, GL_AMD_seamless_cubemap_per_texture,
GL_AMD_vertex_shader_layer, GL_AMD_vertex_shader_viewport_index,
OpenGL version string: 4.6.0 NVIDIA 470.42.01
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:
GL_AMD_multi_draw_indirect, GL_AMD_seamless_cubemap_per_texture,
GL_AMD_vertex_shader_layer, GL_AMD_vertex_shader_viewport_index,
GL_ARB_ES2_compatibility, GL_ARB_ES3_1_compatibility,
GL_ARB_ES3_2_compatibility, GL_ARB_ES3_compatibility,
GL_ARB_arrays_of_arrays, GL_ARB_base_instance, GL_ARB_bindless_texture,
GL_ARB_blend_func_extended, GL_ARB_buffer_storage,
GL_ARB_clear_buffer_object, GL_ARB_clear_texture, GL_ARB_clip_control,
GL_ARB_color_buffer_float, GL_ARB_compatibility,
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 470.42.01
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:
GL_ANDROID_extension_pack_es31a, GL_EXT_EGL_image_external_wrap_modes,
GL_EXT_base_instance, GL_EXT_blend_func_extended, GL_EXT_blend_minmax,
GL_EXT_buffer_storage, GL_EXT_clear_texture, GL_EXT_clip_control,
GL_EXT_clip_cull_distance, GL_EXT_color_buffer_float,
GL_EXT_color_buffer_half_float, GL_EXT_compressed_ETC1_RGB8_sub_texture,
GL_EXT_conservative_depth, GL_EXT_copy_image, GL_EXT_debug_label,
GL_EXT_depth_clamp, GL_EXT_discard_framebuffer,
GL_EXT_disjoint_timer_query, GL_EXT_draw_buffers_indexed,
GL_EXT_draw_elements_base_vertex, GL_EXT_draw_transform_feedback,
GL_EXT_float_blend, GL_EXT_frag_depth, GL_EXT_geometry_point_size,
GL_EXT_geometry_shader, GL_EXT_gpu_shader5, GL_EXT_map_buffer_range,
GL_EXT_memory_object, GL_EXT_memory_object_fd, GL_EXT_multi_draw_indirect,
GL_EXT_multisample_compatibility, GL_EXT_multisampled_render_to_texture,
GL_EXT_multisampled_render_to_texture2,
GL_EXT_multiview_texture_multisample, GL_EXT_multiview_timer_query,
GL_EXT_occlusion_query_boolean, GL_EXT_polygon_offset_clamp,
GL_EXT_post_depth_coverage, GL_EXT_primitive_bounding_box,
GL_EXT_raster_multisample, GL_EXT_render_snorm, GL_EXT_robustness,
GL_EXT_sRGB, GL_EXT_sRGB_write_control, GL_EXT_semaphore,
GL_EXT_semaphore_fd, GL_EXT_separate_shader_objects,
GL_EXT_shader_group_vote, GL_EXT_shader_implicit_conversions,
GL_EXT_shader_integer_mix, GL_EXT_shader_io_blocks,
GL_EXT_shader_non_constant_global_initializers, GL_EXT_shader_texture_lod,
GL_EXT_shadow_samplers, GL_EXT_sparse_texture, GL_EXT_sparse_texture2,
GL_EXT_tessellation_point_size, GL_EXT_tessellation_shader,
GL_EXT_texture_border_clamp, GL_EXT_texture_buffer,
GL_EXT_texture_compression_bptc, GL_EXT_texture_compression_dxt1,
GL_EXT_texture_compression_rgtc, GL_EXT_texture_compression_s3tc,
GL_EXT_texture_cube_map_array, GL_EXT_texture_filter_anisotropic,
GL_EXT_texture_filter_minmax, GL_EXT_texture_format_BGRA8888,
GL_EXT_texture_mirror_clamp_to_edge, GL_EXT_texture_norm16,
GL_EXT_texture_query_lod, GL_EXT_texture_rg, GL_EXT_texture_sRGB_R8,
GL_EXT_texture_sRGB_decode, GL_EXT_texture_shadow_lod,
GL_EXT_texture_storage, GL_EXT_texture_view, GL_EXT_unpack_subimage,
GL_EXT_window_rectangles, GL_KHR_blend_equation_advanced,
GL_KHR_blend_equation_advanced_coherent, GL_KHR_context_flush_control,
GL_KHR_debug, GL_KHR_no_error, GL_KHR_parallel_shader_compile,
GL_KHR_robust_buffer_access_behavior, GL_KHR_robustness,
GL_KHR_shader_subgroup, GL_KHR_texture_compression_astc_hdr,
GL_KHR_texture_compression_astc_ldr,
GL_KHR_texture_compression_astc_sliced_3d,
GL_NVX_blend_equation_advanced_multi_draw_buffers, GL_NV_bgr,
GL_NV_bindless_texture, GL_NV_blend_equation_advanced,
GL_NV_blend_equation_advanced_coherent, GL_NV_blend_minmax_factor,
GL_NV_clip_space_w_scaling, GL_NV_conditional_render,
GL_NV_conservative_raster, GL_NV_conservative_raster_pre_snap_triangles,

x2go crash log:
I suppose most importantly, I've pasted below my .xsession-x2go-errors log file which seems to describe the crash.
XSession-x2go: X session started for user at Sun 10 Apr 2022 06:13:35 PM EDT
dbus-update-activation-environment: setting DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-OdqKZHPfkR,guid=aed0609654ccd7e5772d2df36253568f
dbus-update-activation-environment: setting DISPLAY=:50
dbus-update-activation-environment: setting XAUTHORITY=/home/user/.Xauthority
dbus-update-activation-environment: warning: error sending to systemd: org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.freedesktop.systemd1 exited with status 1
xhost:  must be on local machine to add or remove hosts.
localuser:user being added to access control list
xhost:  must be on local machine to add or remove hosts.
dbus-update-activation-environment: setting GTK_MODULES=gail:atk-bridge
dbus-update-activation-environment: warning: error sending to systemd: org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.freedesktop.systemd1 exited with status 1
dbus-update-activation-environment: setting QT_ACCESSIBILITY=1
dbus-update-activation-environment: warning: error sending to systemd: org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.freedesktop.systemd1 exited with status 1
dbus-update-activation-environment: setting SHELL=/bin/bash
dbus-update-activation-environment: setting QT_ACCESSIBILITY=1
dbus-update-activation-environment: setting SSH_AUTH_SOCK=/home/user/.x2go/C-user-50-1649628812_stDXFCE_dp24/ssh-agent.PID
dbus-update-activation-environment: setting STARTUP=/usr/bin/im-launch /usr/bin/env LD_LIBRARY_PATH= xfce4-session
dbus-update-activation-environment: setting GTK_MODULES=gail:atk-bridge
dbus-update-activation-environment: setting PWD=/home/user
dbus-update-activation-environment: setting LOGNAME=user
dbus-update-activation-environment: setting XDG_SESSION_TYPE=tty
dbus-update-activation-environment: setting GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1
dbus-update-activation-environment: setting XAUTHORITY=/home/user/.Xauthority
dbus-update-activation-environment: setting MOTD_SHOWN=pam
dbus-update-activation-environment: setting X2GO_SESSION=user-50-1649628812_stDXFCE_dp24
dbus-update-activation-environment: setting HOME=/home/user
dbus-update-activation-environment: setting IM_CONFIG_PHASE=1
dbus-update-activation-environment: setting LANG=en_US.UTF-8
dbus-update-activation-environment: setting PULSE_CLIENTCONFIG=/home/user/.x2go/C-user-50-1649628812_stDXFCE_dp24/.pulse-client.conf
dbus-update-activation-environment: setting SSH_CONNECTION=some_ip_address some_port some_ip_address some_port
dbus-update-activation-environment: setting QT_GRAPHICSSYSTEM=native
dbus-update-activation-environment: setting XDG_SESSION_CLASS=user
dbus-update-activation-environment: setting TERM=dumb
dbus-update-activation-environment: setting X2GO_AGENT_PID=7023
dbus-update-activation-environment: setting USER=user
dbus-update-activation-environment: setting DISPLAY=:50
dbus-update-activation-environment: setting SHLVL=2
dbus-update-activation-environment: setting XDG_RUNTIME_DIR=/run/user/1000
dbus-update-activation-environment: setting SSH_CLIENT=some_ip_address some_port some_port
dbus-update-activation-environment: setting XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
dbus-update-activation-environment: setting PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
dbus-update-activation-environment: setting DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-OdqKZHPfkR,guid=aed0609654ccd7e5772d2df36253568f
dbus-update-activation-environment: setting XSESSION_EXEC=xfce4-session
dbus-update-activation-environment: setting _=/usr/bin/dbus-update-activation-environment
dbus-update-activation-environment: warning: error sending to systemd: org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.freedesktop.systemd1 exited with status 1
dbus-update-activation-environment: warning: error sending to systemd: org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.freedesktop.systemd1 exited with status 1
gpg-agent[7362]: WARNING: "--write-env-file" is an obsolete option - it has no effect
gpg-agent: a gpg-agent is already running - not starting a new one

(xfce4-session:7218): xfce4-session-WARNING **: 18:13:35.832: gpg-agent returned no PID in the variables

(xfwm4:7364): xfwm4-WARNING **: 18:13:35.924: XSync extension too old (3.0).

(xfwm4:7364): xfwm4-WARNING **: 18:13:35.926: The display does not support the XComposite extension.

(xfwm4:7364): xfwm4-WARNING **: 18:13:35.927: The display does not support the XPresent extension.

(xfwm4:7364): xfwm4-WARNING **: 18:13:35.927: Compositing manager disabled.

(xfsettingsd:7373): xfsettingsd-CRITICAL **: 18:13:35.994: Your XI is too old (1.3) version 1.4 is required.

(xfsettingsd:7373): xfsettingsd-WARNING **: 18:13:35.994: Failed to create device filter

** (wrapper-2.0:7398): WARNING **: 18:13:36.301: No outputs have backlight property

(xfce4-session:7218): GLib-WARNING **: 18:13:36.304: GChildWatchSource: Exit status of a child process was requested but ECHILD was received by waitpid(). See the documentation of g_child_watch_source_new() for possible causes.

(wrapper-2.0:7399): GLib-GIO-CRITICAL **: 18:13:36.305: g_file_new_for_path: assertion 'path != NULL' failed

(wrapper-2.0:7399): GLib-GIO-CRITICAL **: 18:13:36.305: g_file_monitor_file: assertion 'G_IS_FILE (file)' failed

(wrapper-2.0:7399): GLib-GObject-WARNING **: 18:13:36.305: invalid (NULL) pointer instance

(wrapper-2.0:7399): GLib-GObject-CRITICAL **: 18:13:36.305: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(wrapper-2.0:7399): Gtk-WARNING **: 18:13:36.305: Attempting to add a widget with type GtkToggleButton to a container of type XfcePanelPlugin, but the widget is already inside a container of type XfcePanelPlugin, please remove the widget from its existing container first.

ERROR: Unable to load info from any available system

** (xiccd:7441): WARNING **: 18:13:36.364: EDID is empty

** (xiccd:7441): CRITICAL **: 18:13:36.366: unable to create profile: failed to obtain org.freedesktop.color-manager.create-profile auth

(wrapper-2.0:7398): Gtk-WARNING **: 18:13:36.373: Negative content width -3 (allocation 1, extents 2x2) while allocating gadget (node button, owner PowerManagerButton)

** (xiccd:7441): CRITICAL **: 18:13:36.376: unable to create profile: failed to obtain org.freedesktop.color-manager.create-profile auth

** (xiccd:7441): CRITICAL **: 18:13:36.376: unable to create profile: failed to obtain org.freedesktop.color-manager.create-profile auth

** (light-locker:7434): ERROR **: 18:13:36.379: Environment variable XDG_SESSION_PATH not set. Is LightDM running?

(wrapper-2.0:7399): Gtk-WARNING **: 18:13:36.382: Negative content width -3 (allocation 1, extents 2x2) while allocating gadget (node button, owner GtkToggleButton)

** (xiccd:7441): CRITICAL **: 18:13:36.385: failed to create colord device: failed to obtain org.freedesktop.color-manager.create-device auth

(wrapper-2.0:7397): Gtk-WARNING **: 18:13:36.429: Negative content width -3 (allocation 1, extents 2x2) while allocating gadget (node button, owner PulseaudioButton)
Tracker-Message: 18:13:36.433: Set scheduler policy to SCHED_IDLE
Tracker-Message: 18:13:36.433: Setting priority nice level to 19
Tracker-Message: 18:13:36.446: Set scheduler policy to SCHED_IDLE
Tracker-Message: 18:13:36.446: Setting priority nice level to 19
Failure: Module initialization failed

(polkit-gnome-authentication-agent-1:7476): GLib-CRITICAL **: 18:13:36.469: g_variant_new_string: assertion 'string != NULL' failed

(polkit-gnome-authentication-agent-1:7476): polkit-gnome-1-WARNING **: 18:13:36.470: Failed to register client: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files

** (xfce4-screensaver:7459): WARNING **: 18:13:36.488: screensaver already running in this session

(wrapper-2.0:7400): Gtk-WARNING **: 18:13:36.590: Negative content width -1 (allocation 1, extents 1x1) while allocating gadget (node button, owner XfceArrowButton)
blueman-applet 18.13.36 WARNING  PluginManager:147 __load_plugin: Not loading DhcpClient because its conflict has higher priority
blueman-applet 18.13.36 WARNING  PluginManager:147 __load_plugin: Not loading PPPSupport because its conflict has higher priority
Error executing command as another user: Not authorized

This incident has been reported.

(xfce4-panel:7383): Gtk-CRITICAL **: 18:13:44.327: gtk_icon_theme_load_icon: assertion 'icon_name != NULL' failed
(xfce4-panel:7383): Gtk-CRITICAL **: 18:13:44.328: gtk_icon_theme_load_icon: assertion 'icon_name != NULL' failed
(xfce4-panel:7383): Gtk-CRITICAL **: 18:13:44.348: gtk_icon_theme_load_icon: assertion 'icon_name != NULL' failed
X connection to :50.0 broken (explicit kill or server shutdown).
Gdk-Message: 18:13:44.458: blueman-tray: Fatal IO error 11 (Resource temporarily unavailable) on X server :50.0.
Gdk-Message: 18:13:44.458: polkit-gnome-authentication-agent-1: Fatal IO error 11 (Resource temporarily unavailable) on X server :50.0.
Gdk-Message: 18:13:44.458: wrapper-2.0: Fatal IO error 11 (Resource temporarily unavailable) on X server :50.0.
Gdk-Message: 18:13:44.458: blueman-applet: Fatal IO error 11 (Resource temporarily unavailable) on X server :50.0.
Gdk-Message: 18:13:44.458: nm-applet: Fatal IO error 11 (Resource temporarily unavailable) on X server :50.0.
Gdk-Message: 18:13:44.458: update-notifier: Fatal IO error 11 (Resource temporarily unavailable) on X server :50.0.
Gdk-Message: 18:13:44.458: wrapper-2.0: Fatal IO error 11 (Resource temporarily unavailable) on X server :50.0.
Gdk-Message: 18:13:44.458: evolution-alarm-notify: Fatal IO error 11 (Resource temporarily unavailable) on X server :50.0.
Gdk-Message: 18:13:44.458: wrapper-2.0: Fatal IO error 11 (Resource temporarily unavailable) on X server :50.0.
Gdk-Message: 18:13:44.458: xfwm4: Fatal IO error 11 (Resource temporarily unavailable) on X server :50.0.
Gdk-Message: 18:13:44.459: wrapper-2.0: Fatal IO error 11 (Resource temporarily unavailable) on X server :50.0.
Gdk-Message: 18:13:44.459: xfdesktop: Fatal IO error 11 (Resource temporarily unavailable) on X server :50.0.
Gdk-Message: 18:13:44.460: xfsettingsd: Fatal IO error 11 (Resource temporarily unavailable) on X server :50.0.
Gdk-Message: 18:13:44.461: xfce4-panel: Fatal IO error 25 (Inappropriate ioctl for device) on X server :50.0.
Gdk-Message: 18:13:44.461: wrapper-2.0: Fatal IO error 11 (Resource temporarily unavailable) on X server :50.0.
Gdk-Message: 18:13:44.462: Thunar: Fatal IO error 11 (Resource temporarily unavailable) on X server :50.
Gdk-Message: 18:13:44.463: xfce4-session: Fatal IO error 11 (Resource temporarily unavailable) on X server :50.
Gdk-Message: 18:13:44.463: wrapper-2.0: Fatal IO error 11 (Resource temporarily unavailable) on X server :50.0.
(tracker-miner-fs:7482): Tracker-CRITICAL **: 18:13:44.470:   (Sparql buffer) Error in array-update: The connection is closed
(tracker-miner-fs:7482): Tracker-CRITICAL **: 18:13:44.471: Could not execute sparql: The connection is closed
Received signal:15->'Terminated'
(tracker-miner-fs:7482): GLib-GIO-CRITICAL **: 18:13:44.471: Error while sending AddMatch() message: The connection is closed
(tracker-miner-fs:7482): GLib-GIO-CRITICAL **: 18:13:44.471: Error while sending AddMatch() message: The connection is closed
(tracker-miner-fs:7482): GLib-GIO-CRITICAL **: 18:13:44.472: Error while sending AddMatch() message: The connection is closed
Received signal:15->'Terminated'
OK


text:
Q: Ruby Rails attr_encrypted format encrypted attribute I am using attr_encrypted and I want to get formatted attribute whenever I access encrypted attribute - is there any way of doing this?
The model:
class User < ApplicationRecord
  attr_encrypted :balance, key: 'some super secret key', marshal: true
end

And I want to be able to access balance and get Money object:
Money.new(balance, currency)
Is there possibility to make user.balance return this stright away (without additional methods like user.balance_to_money?
I have tried to somehow  "extend" attr_encrypted behaviour (defined attribute getters) but I am not sure how to achieve this.
I have tried using custom Marshal object, but It won't work since I have to access user's currency from the database (Marshaler won't have access to this)
  attr_encrypted :balance, key: 'some super secret key', marshal: true, marshaler: BalanceMarshaler
  module BalanceMarshaler
    extend self

    def dump(data)
      data.to_s
    end

    def load(data)
      number = Marshal.load(data)
      Money.new(number, currency)
    end
  end

A: If you need to maintain an accessor that treats balance as a Money constructor, you could sidestep the issue of overriding the behavior and just use a different column.
e.g. balance_new or whatever, and then create an accessor for .balance that creates a Money object from balance_new...

redpajama_set_name: RedPajamaStackExchange


text:
Q: What are event handles? I had a leaking handle problem ("Not enough quota available to process this command.") in some inherited C# winforms code, so I went and used Sysinternals' Handle tool to track it down.  Turns out it was Event Handles that were leaking, so I tried googled it (took a couple tries to find a query that didn't return "Did you mean: event handler?").  According to Junfeng Zhang, event handles are generated by the use of Monitor, and there may be some weird rules as far as event handle disposal and the synchonization primitives.
I'm not entirely sure that the source of my leaking handles are entirely due to simply long-lived objects calling lots of synchronization stuff, as this code is also dealing with HID interfaces and lots of win32 marshaling and interop, and was not doing any synchronization that I was aware of.  Either way, I'm just going to run this in windbg and start tracing down where the handles are originating from, and also spend a lot of time learning this section of the code, but I had a very hard time finding information about what event handles are in the first place.
The msdn page for the event kernel object just links to the generic synchronization overview... so what are event handles, and how are they different from mutexes/semaphores/whatever?

A: The NT kernel uses event objects to allow signals to transferred to entities that wait on the signal. A mutex and a semaphore are also waitable kernel objects (Kernel Dispatcher Objects), but with different semantics. The only time I ever came across them was when waiting for IO to complete in drivers.
So my theory on your problem is possibly a faulty driver, or are you relying on specialised hardware?
Edit: More info (from Windows Internals 5th Edition  - Chapter 3 System Mechanics)
Some Kernel Dispatcher Objects (e.g. mutex, semaphore) have the of concept ownership. So when signalled the released one waiting thread will be released will grab these resources. And others will have to continue to wait. Events are not owned hence are available to be reset by any thread.
Also there are three types of events:

*

*Notification    : On signalled all waiting threads are released

*Synchronisation : On signalled one waiting thread is released but the event is reset

*Keyed           : On signalled one waiting thread in the same process as the signaller is released.

Another interesting thing that I've learned is that critical sections (the lock primitive in c#) are actually not kernel objects, rather they are implemented out of a keyed event, or mutex or semaphore as required.

A: If you're talking about kernel Event Objects, then an event handle will be a handle (Int) that the system keeps on this object so other objects can reference it.  IE Keep a 'handle' on it.
Hope this helps!


text:
Q: ¿Cómo mostrar un listview dentro de una ventana modal bootstrap? Lo del modal yo se como colocarlo todo.El listview me funciona a la perfección,pero el modo en que sale en la pagina no me agrada del todo.Es algo poco estético en cuanto a la forma en que se proyecta.Quisiera saber como hacerlo que al presionar un boton asp.net entonces me salga el modal(bootstrap)con el listview con los resultados de la búsqueda realizada.¿Que debo hacer para cuando presione el botón "buscar" se abra el modal y me salga el listview con los datos de la consulta?
Este es el código del botón buscar:
    <asp:Button ID="btnbuscar" runat="server" Text="Buscar" OnClick="btnbuscar_Click"    />

Este es mi listview
<asp:ListView ID="ListView1" runat="server" DataKeyNames="Codigo" >

                       <ItemTemplate>

                               <asp:Image ID="imgPhoto" runat="server"
            ImageUrl='<%# "HttpImageHandler.ashx?ImID="+ Eval("Codigo") %>'
     Height="150px" Width="150px"/>

<%# Eval("Marca") %>

<%# Eval("Modelo") %>

<%# Eval("Subnombre") %>

<%# Eval("Año") %>

<%# Eval("Color") %>

<%# Eval("Precioxdia") %>

                                  <a href="DetailsCustomer.aspx?id=<%# Eval("Codigo") %>">Ver detalles

                       </ItemTemplate>
                         </asp:ListView>

Este es el codigo HTML del modal:

Modal Heading

      <button type="button" class="close" data-dismiss="modal">×</button>

      Modal body..

      <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>

Este es el codigo de mi archivo .aspx.cs:
protected void btnbuscar_Click(object sender, EventArgs e)
    {

        SqlConnection conn = new SqlConnection(@"Data Source = MEGATRON; Initial Catalog = RentCar; Integrated Security = True");
        try
        {

            SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM Autos WHERE Marca like '" + DropDownListMarcas.SelectedItem.Text + "%'" +
                          "AND Tipo like '" + DropDownListTipo.SelectedItem.Text + "%' ", conn);

            DataTable dt = new DataTable();

            da.Fill(dt);

            ListView1.DataSource = dt;
            ListView1.DataBind();
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }


text:
Q: Wordpress Nav Walker Anchor only in li I have a custom wordpress theme and would like my menu to be a little different than Wordpress standards like this:

            Home
            Gallery
            About Me
            Contact Me

I only manage to remove the
 in my walker class but can't manage to move the links inside the 1 li tag.
Is there any way to achieve this?
Thank you in advance.
EDIT :
This was achieved now by using wp_get_nav_menu_items.


text:
Q: why NONE shows after console asks to choose any options in PYTHON CODE
OUTPUT
In the output of  the program which I have attached in imaged 2 after console asks for option to choose before i enter anything to console None shows but my prog runs fine how to get rid of that None; plz refer the images i have attached.
from PIL import Image
image1=Image.open("chinu.jpg")
r,g,b=image1.split()

def red() :
    r.show()
def green() :
    g.show()
def blue() :
    b.show()

options = {1 : red,
           2 : green,
           3 : blue,
        }
while True:
    print(" 1-->  red   channel")
    print(" 2-->  green channel")
    print(" 3-->  blue  channel")
    num = int(input(print("enter your choice here = ")))
    options[num]()
    quits = str(input(print("IF YOU WANT TO CONTINUE PRESS Y  or press any key to quit")))
    if quits is "Y":
        continue
    else:
        break

A: input(x) will print x for you. You don't need to input(print(y)). In fact what that means is that it will also print x = print(y) = None which is what you're seeing.


text:
Q: Address of a reference to first item of an array I'm a bit confused about this:
I thought that if a pointer points to some object, assigning a dereference to some reference variable was a mere aliasing.
Example:
Object * p = &o;
Object & r = *p;
// r and o are the same object

I was aware there was some illegal cases, like:
Object * p = NULL;
Object & r = *p; // illegal

Now, what about the code below ?
const char * p = "some string";
const char & r = *p;

or
const char & r = *"some string";

I was said that this particular case involved temporary objects and, therefore I could'nt get the address of r and be sure it will point to a memory array containing my initial string.
What does C++ standard states about that case ? Is it another illegal case like the NULL provision, or is it allowed behavior.
In other words, is it legal or illegal (undefined behavior ?) to write something like ?
   char buffer[100];
   strcpy(buffer, &r);

A: That's fine.
The string literal's data buffer will exist for the duration of your program (usually in a special segment of the process memory).

[C++11: 2.14.5/8]: Ordinary string literals and UTF-8 string
  literals are also referred to as narrow string literals. A narrow
  string literal has type "array of n const char`", where n is the size
  of the string as defined below, and has static storage duration (3.7).
[C++11: 3.7.1/1]: All variables which do not have dynamic storage
  duration, do not have thread storage duration, and are not local have
  static storage duration. The storage for these entities shall last for
  the duration of the program (3.6.2, 3.6.3).

After all, that's how keeping a pointer to it works! Recall that pointers don't magically extend object lifetime any more than do references.


text:
Q: How do bitshifts work on the electrical layer? I'm a software developer and I understand how arithmetic and logical bitshifts work in principle.
But how do they work on the electrical layer?
I might have a completely wrong imagination;
Let's say we have the binary value 0000 1011 and left shift it by 2.
The outcome is 0010 1100, nothing special.
But how do the bits "jump" to their second neighbors?
Edit: Fixed a slip, where I wrote "right shift" while doing a left shift.
Edit: Added ALU and DIGITAL-LOGIC tags

A: In computers, arithmetic operations are performed by a specific integrated circuit that is placed inside the microprocessor, and is called "Arithmetic Logic Unit". You can have a look at the Wikipedia article on ALU ( https://en.wikipedia.org/wiki/Arithmetic_logic_unit ). As an example it mentions the 74181 ALU, which is a very simple Arithmetic logic unit, able to perform several types of operations, including the left shift, over 4 bits.
I've attached the logic schema of the 74181 ALU (see below). Inputs are A and B, and result is F. Each number is 4 bits long, so there is A3A2A1A0,  B3B2B1B0, and F3F2F1F0. The desired operation is selected with S3S2S1S0:

*

*F = A (op) B

*'op' is the desired operation.

*If S = S3S2S1S0 = 1100, then 'op' is left shifting.

This is how left shifting works in the particular case of the 74181:

*

*Look at the upper left group of five AND gates and 2 NOR gates.

*First AND gate is not exactly AND, because it has only one entry: /A0. Therefore its output is /A0.

*Second and third AND gates have 0 output because S1S0 = 00

*Fourth AND gate has output /A0*B0, because S2 = 1

*Fifth AND gate has output /A0*/B0, because S3 = 1

*First NOR gate has output A0.

*Second NOR gate has output A0, because /A0*B0 + /A0*/B0 = /A0.

In conclusion, when you have S3S2S1S0 = 1100, the ALU makes F = A + A, which is the same as left shifting.

A: One approach is a parellel in parallel out shift register.  The data is loaded into the shift register, then shifted left or right by the desired number of places.  The down-side of this is that it can only shift by one bit per clock cycle.
An alternative is a barrel shifter which can shift by an arbitrary number of places in one go.
It's worth realising that shifting need be nothing more than how you wire the input lines to the output lines on a data bus.  Wired straight through is no shift.  Wire each input line to the output line that is one place to the left is a left shift by 1, and so on.

A: Look up something called a shift register.  One way to think about these is a chain of flip-flops.  Let's say these flip-flops take a snapshot of whatever value is on their input on the low to high transition of the clock, then transfer that snapshot to their output on the next high to low transition of the clock.  You connect the output of one flip-flop to the input of the next, etc, then connect them all to the same clock signal.

A: Ones and zeros are represented inside the CPU integrated circuit as voltage levels. For example 0 volts is logic zero, and 5 volts is logic one. Logic values are typically held in circuits called "flip-flop"s.  A typical CPU chip has millions of flip-flops.
And a typical CPU chip also has millions of electrically-operated switches. So, in order to execute a shift function, the CPU turns on the appropriate switches to send the logic levels over to the NEXT flip-flop (or "bit position") in the register.
Basically all math and logic functions are implemented by simply connecting bit registers in particular ways depending on what you want to do. That is what the CPU chip is designed to do.

A: When you rotate the tires on your car how does that happen?  Well you take at least two off and swap them yes?
Bit storage be it individual flip-flops or gobzillions of them packed in a ram.  Each bit of storage is readable and writeable.  otherwise what is the point?  A bit shift is nothing more than an operation that takes the tires off, reads the bits out of a register or memory location, and then writes them back in a different location, just like moving one tire from the back to the front, you read it out, then write it back in a different location.
There is no magic in logic, it is all very very simple in concept.  zero, one, and, or, not is all that is required to understand.  It is just at times a massive amount of and, ors and nots in parallel and/or series.
Some processors shift one bit at a time and in pseudo hdl it is not really different than in software
alu_out[16] = (operand_a[14:0],0)

the 16 bit output is made of the lower 15 bits of the input re-positioned to the upper 15 bits of the output with a zero tacked on in the 0 position.
And that line of code may be in a switch like statement or tree of if then else statements that basically says if alu_operation = left_shift then do this.
And all of that is compiled into logic gates, the ifs and the assignments turn in to and, or, not gates or gates derived from and, or, not.  on a massive rats nest.
Some processors have a variable sized shifter that in one operation can rotate or shift however much you want (up to the whole word size obviously, otherwise what is the point) granted that takes a lot more gates, just that one operation each bit of the output for a 16 bit register has a 15, 16, or 17 to one mux depending, just for that one operation.


text:
Q: destroy a deezer Event Destroy (DZ.Event.subscribe('player_paused') etc I use the deezer api to build a web app and User a DZ.Event.subscribe('player_paused'). There is only a description to add a new Event, not to destroy. Now the simple Question is: How to destroy this Event?

A: You can use the following function: DZ.Event.unsubscribe('EVNT_NAME');


text:
Q: Aurelia tutorial stuck building out contact list I'm an experienced WPF developer, but new to web development.
I'm stuck at point where you replace the Contact List Placeholder
with the contact-list custom element.
When I run it the web page still shows the placeholder text instead of the contact list.  I assumed this was a cache issue, but I've tried everything I can think of to clear the cache. I have also tried deleting the app.html and running the site to see what kind of error I'd get, but still I get the template with Contact List Placeholder. I've tried reverting to the original  tag and changing the inner text, and I still get "Contact List Placeholder".


text:
Q: Retrieving a single Guid in CRM 4.0 I'm new to CRM (version 4.0) and i'm trying to return a 'yearid' guide based on a given year (which is also stored in the entity).So far i've got:
    public static Guid GetYearID(string yearName)
    {

        ICrmService service = CrmServiceFactory.GetCrmService();

        // Create the query object.
        QueryExpression query = new QueryExpression("year");
        ColumnSet columns = new ColumnSet();
        columns.AddColumn("yearid");
        query.ColumnSet = columns;

        FilterExpression filter = new FilterExpression();

        filter.FilterOperator = LogicalOperator.And;
        filter.AddCondition(new ConditionExpression
        {
            AttributeName = "yearName",
            Operator = ConditionOperator.Equal,
            Values = new object[] { yearName}
        });

        query.Criteria = filter;

    }

But my questions are:

A) What code do in addition to this to actually store the Guid?

B) Is using a QueryExpression the most efficient way to do this?

A: Re: B) Going to sql maybe faster (I don't know by how much or even if), but I would have thought in 99% of situtations a QueryExpression is perfectly acceptable in terms of performance.
Re: A) Your're pretty close, I have completed the code below.
public static Guid GetYearID(string yearName)
{
    ICrmService service = CrmServiceFactory.GetCrmService();

    // Create the query object.
    QueryExpression query = new QueryExpression("year");

    //No need to ask for the id, it is always returned
    //ColumnSet columns = new ColumnSet();
    //columns.AddColumn("yearid");
    //query.ColumnSet = columns;

    FilterExpression filter = new FilterExpression();

    filter.FilterOperator = LogicalOperator.And;
    filter.AddCondition(new ConditionExpression
    {
        AttributeName = "yearName",
        Operator = ConditionOperator.Equal,
        Values = new object[] { yearName}
    });

    query.Criteria = filter;

    //We have to use a retrieve multiple here
    //In theory we could get multiple results but we will assume we only ever get one
    BusinessEntityCollection years = service.RetrieveMultiple(query);

    DynamicEntity year = (DynamicEntity)years.BusinessEntities.First();

    return ((Guid)year["yearid"]);
}


text:
Q: How to vectorize a function for each ID# in pandas This method is time/cpu intensive and there's got to be a better way! Can someone help me vectorize the following code without using a loop?  Basically, I have a df where each subject has multiple rows, and each row has a value. I want to add a column that displays the highest value for every subject (will be the same for every row of the subject).
import pandas as pd
import numpy as np
from numpy import nan

compare_table = pd.DataFrame({
    'id': [1,1,1,2,2,3,3,3],
    'day#': [1, 2, 3, 1, 2, 1, 2, 3],
    'random#': [2,5,1,6, 4, 5, 9, 3],
     'highest_random#': [nan, nan, nan, nan, nan, nan, nan, nan]}, columns=[
    'id', 'day#','random#','highest_random#'])

for element in list(compare_table['id'].unique()):
        highest_random = max(compare_table.loc[compare_table.loc[:,'id']==element, 'random#'])
        compare_table.loc[compare_table.loc[:,'id']==element, 'highest_random#']= highest_random

A: Use GroupBy.transform by max or map aggregated Series:
compare_table['highest_random#1'] = compare_table.groupby('id')['random#'].transform('max')

#a bit slowier alternative
s = compare_table.groupby('id')['random#'].max()
compare_table['highest_random#2'] = compare_table['id'].map(s)
print (compare_table)
   id  day#  random#  highest_random#  highest_random#1  highest_random#2
0   1     1        2              5.0                 5                 5
1   1     2        5              5.0                 5                 5
2   1     3        1              5.0                 5                 5
3   2     1        6              6.0                 6                 6
4   2     2        4              6.0                 6                 6
5   3     1        5              9.0                 9                 9
6   3     2        9              9.0                 9                 9
7   3     3        3              9.0                 9                 9


text:
Q: R: split a data-frame, apply a function to all row-pairs in each subset I am new to R and am trying to accomplish the following task efficiently.
I have a data.frame, x, with columns: start, end, val1, val2, val3, val4. The columns are sorted/ordered by start.
For each start, first I have to find all the entries in x that share the same start. Because the list is ordered, they will be consecutive. If a particular start occurs only once, then I ignore it. Then, for these entries that have the same start, lets say for one particular start, there are 3 entries, as shown below:
entries for start=10
start end val1 val2 val3 val4
   10  25    8    9    0    0
   10  55   15  200    4    9
   10  30    4    8    0    1
Then, I have to take 2 rows at a time and perform a fisher.test on the 2x4 matrices of val1:4. That is,
row1:row2 => fisher.test(matrix(c(8,15,9,200,0,4,0,9), nrow=2))
row1:row3 => fisher.test(matrix(c(8,4,9,8,0,0,0,1), nrow=2))
row2:row3 => fisher.test(matrix(c(15,4,200,8,4,0,9,1), nrow=2))
The code I wrote is accomplished using for-loops, traditionally. I was wondering if this could be vectorized or improved in anyway.
f_start = as.factor(x$start) #convert start to factor to get count
tab_f_start = as.table(f_start) # convert to table to access count
o_start1 = NULL
o_end1   = NULL
o_start2 = NULL
o_end2   = NULL
p_val    = NULL
for (i in 1:length(tab_f_start)) {
    # check if there are more than 1 entries with same start
    if ( tab_f_start[i] > 1) {
        # get all rows for current start
        cur_entry = x[x$start == as.integer(names(tab_f_start[i])),]
        # loop over all combinations to obtain p-values
        ctr = tab_f_start[i]
        for (j in 1:(ctr-1)) {
            for (k in (j+1):ctr) {
                # store start and end values separately
                o_start1 = c(o_start1, x$start[j])
                o_end1   = c(o_end1, x$end[j])
                o_start2 = c(o_start2, x$start[k])
                o_end2   = c(o_end2, x$end[k])
                # construct matrix
                m1 = c(x$val1[j], x$val1[k])
                m2 = c(x$val2[j], x$val2[k])
                m3 = c(x$val3[j], x$val3[k])
                m4 = c(x$val4[j], x$val4[k])
                m = matrix(c(m1,m2,m3,m4), nrow=2)
                p_val = c(p_val, fisher.test(m))
            }
        }
    }
}
result=data.frame(o_start1, o_end1, o_start2, o_end2, p_val)
Thank you!

A: As @Ben Bolker suggested, you can use the plyr package to do this compactly. The first step is to create
a wider data-frame that contains the desired row-pairs. The row-pairs are generated using the combn function:
set.seed(1)
x <- data.frame( start = c(1,2,2,2,3,3,3,3),
                 end = 1:8,
                 v1 = sample(8), v2 = sample(8), v3 = sample(8), v4 = sample(8))

require(plyr)
z <- ddply(x, .(start), function(d) if (nrow(d) == 1) NULL
                                      else {
                                        row_pairs <- combn(nrow(d),2)
                                        cbind( a = d[ row_pairs[1,], ],
                                               b = d[ row_pairs[2,], ] )
                                      })[, -1]

The second step is to extract the p.value from applying the fisher.test to each row-pair:
result <- ddply(z, .(a.start, a.end, b.start, b.end),
                function(d)
                     fisher.test(matrix(unlist( d[, -c(1,2,7,8) ]),
                                        nrow=2, byrow=TRUE))$p.value  )

> result
  a.start a.end b.start b.end         V1
1       2     2       2     3 0.33320784
2       2     2       2     4 0.03346192
3       2     3       2     4 0.84192284
4       3     5       3     6 0.05175017
5       3     5       3     7 0.65218289
6       3     5       3     8 0.75374989
7       3     6       3     7 0.34747011
8       3     6       3     8 0.10233072
9       3     7       3     8 0.52343422


text:
Q: Google App Engine: getting "Max number of files and blobs is 10000." when deploying app with only 1000 files I am getting Max number of files and blobs is 10000. error when trying to deploy my application (it only contains 1000 files max) into Google App Engine.
Is there a typical bug that I am hitting here? My first guess was maybe that the fact that the mimetype error maybe throwing into a cyclical cloning of my files, but it is hard to say.
Appengine trackback...
03:44 PM Host: appengine.google.com
03:44 PM Application: fakeid (was: None); version: fakeversion (was: None)
03:44 PM Starting update of app: fakeid, version: fakeversion
03:44 PM Getting current resource limits.
03:44 PM Scanning files on local disk.
03:44 PM Scanned 14500 files.
Could not guess mimetype for datatools/pensieve/static/js/src/library/agGrid/CONTRIBUTING.md.  Using application/octet-stream.
Could not guess mimetype for datatools/pensieve/static/js/src/library/agGrid/README.md.  Using application/octet-stream.
03:45 PM Cloning 649 static files.
03:45 PM Cloning 14623 application files.
03:45 PM Cloned 10000 files.
03:45 PM Rolling back the update.
Error 400: --- begin server output ---
Max number of files and blobs is 10000.
--- end server output ---

A: If you're using git the number of 'files' in your project can explode. Add the following to your app.yaml
skip_files:
- .git

Make sure if you start to explicitly define the skip_files list, you also add in the old defaults outlined here: https://cloud.google.com/appengine/docs/standard/python/config/appref#skip_files


text:
Q: Bar cursor in Ymacs Ymacs editor has a block cursor, and, like my emacs setup, I wanted to have the same cursor; a vertical bar instead of block. I came up with this code:
.Ymacs-Theme-dark .Ymacs_Frame-focus .Ymacs-caret {
    background: transparent !important;
    border-left: 1px solid white;
    margin-left: -1px;
    color: inherit !important;
}

But this doesn't work when the cursor is the first character in line, because margin-left: -1px will make it outside of the page (it's needed because otherwise the border will move the cursor by one pixel).
Is there a way to make a vertical cursor that will work even as first character of the line?
You can test this on ymacs demo page and add my css using dev tools. I can create a CodePen demo if needed.

A: Add this code to your custom styles as well:
.Ymacs-current-line {
    padding-left:1px;
}

It will add one pixel of padding to the left edge of the active line, enough to see the blinking cursor, and will shift the element right by 1px, leaving the left edge of the line in the same place, rather than giving you a scrollbar or shifting the cursor over.

A: You can use :before pseudo element like this:
.Ymacs-caret {
    position: relative;
}
.Ymacs-caret:before {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    border-left: 1px solid white;
    bottom: 0;
}


text:
Q: SQL SERVER: How to delete duplicate rows in one table having one-to-many mapping with other I have a SQL Server containing duplicate rows w.r.t a particular column of a table tableObj which I want to delete. The query I am using is:
DELETE tableObj
WHERE id NOT IN
(SELECT MIN(id)
FROM tableObj
GROUP BY column_name);

This column_name is duplicate and I want to remove all the other rows containing the same column. Now as I execute this query, i get following error:
The DELETE statement conflicted with the REFERENCE constraint "some_value". The conflict occurred in database "UH", table "Test.otherTable", column 'column_name'.

This otherTable is with which there is one-to-mapping of tableObj. Now how do I delete these references as well along with duplicate deletion.
This is how I find the duplicates:
SELECT column_name, COUNT(*)
FROM tableObj
GROUP BY column_name
HAVING
COUNT(*) > 1

which gives me result like:
column_name   (no-specific column)
12345              2
23414              3
...........
...........

The mapping is persisted in the mapping table like:
tableObjID         otherTableId

The desired result after executing the DELETE query is to get(COUNT=1):
column_name   (no-specific column)
12345              1
23414              1
...........
...........

A: You don't need to delete from the otherTable, if the ON DELETE CASCADE setting enabled in the Foreign Key constraint
Otherwise you first need to delete the referenced data from other table, and then delete the main data from the table.
Following query should work in your case.
--Delete the Referenced Data
DELETE FROM otherTable
WHERE ID IN
(
  SELECT ID FROM
   (
    SELECT ID, ROW_NUMBER() OVER( PARTITION BY column_name ORDER BY ID) RN
    FROM tableObj
   )T WHERE T.RN>1
)
GO
--DELETING THE DUPLICATE ROWS
WITH CTE AS
(
 SELECT ID, ROW_NUMBER() OVER( PARTITION BY column_name ORDER BY ID) RN
 FROM tableObj
)
DELETE  CTE WHERE RN > 1


text:
Q: who forks when the applications are double clicked on Linux? So I know when in shell and I run an executable then shell forks it into a child process and later exec's to get the program and data memory of my executable. So if my shell is now closed/exited then all its associated child processes get killed as well.
I read that in linux every process is created via fork() exec(). Am curious, and was wondering whenever an application is launched by double clicking its icon, which process forks() exec() it, I understand it is some OS process, i was wondering which
Thank you!
Answer
traced it to /sbin/upstart

A: First of all, a bit of terminology.
An executable is a simple file in your system. A process is the nutshell which executes the program embedded in an executable file.

You are right about the way an executable file is launched:

*

*The parent process (already living) forks itself, leading in two execution flows from that point. One living in the parent process and one living in a fresh new process.

*The new (child) process mutes itself to execute the program of the executable to run. This is done using a syscall of the exec family.

Taking the example of a graphical interface on which you double-clic an executable icon, you have your executable forked from the process showing the icon you clicked on with basically this source code:
const char *exe_path = taken_from_icon();
int pid = fork();
if(pid == 0)
{
    // I am the new child
    execl(exe_path, exe_path, NULL);
    // exec only return in case of failure
    exit(EXIT_FAILURE);
}
// I am the graphical interface,
// Continue and wait for another clic

But the death and parentship of the child is not exactly as you say.
Basically —and when the parent process is still alive— the child process is the child of its father (yes!-)  It has its PPID (parent process ID) set to the still-alive process which forked it.
Things changes when the parent process dies. Child process continues to live but its PPID is set to a still-alive gran-parent process. There is always one since init process never dies.

The fact that shell children dies when the shell itself dies is something specific. I see two reasons for that:

*

*The first one: a shell usually maintains a list of PIDs it forked. And when shell dies, it kills them all. Major shells have a disown built-in command to remove a child from this list and let it live when the shell dies. See bash man page:

The shell exits by default upon receipt of a SIGHUP.  Before exiting,
     an interactive shell resends the SIGHUP to all jobs, running or
     stopped.  Stopped jobs are sent SIGCONT to ensure that they receive
     the SIGHUP.  To prevent the shell from sending the signal to a
     particular job, it should be removed from the jobs table with the
     disown builtin (see SHELL BUILTIN COMMANDS below) or marked to not
     receive SIGHUP using disown -h.

*The second one: shell children usually have their stdin, stdout and stderr connected to the shell itself via pipes. If the shell stop consuming child stdout (often to to print it), or closes its pipe end, then the child may have failures when writing to its stdout which may block or kill it.


text:
Q: error in activation of django web application I have created a virtual env that I named "f". It has been working fine for the whole time until yesterday when it gave me an error.
The code is:
import _imp  # Just the builtin component, NOT the full Python module
import sys

try:
    import _frozen_importlib as _bootstrap
except ImportError:
    from . import _bootstrap
    _bootstrap._setup(sys, _imp)
else:
    # importlib._bootstrap is the built-in import, ensure we don't create
    # a second copy of the module.
    _bootstrap.__name__ = 'importlib._bootstrap'
    _bootstrap.__package__ = 'importlib'
    try:python manage.py makemigrations

        _bootstrap.__file__ = __file__.replace('__init__.py', '_bootstrap.py')
    except NameError:
        # __file__ is not guaranteed to be defined, e.g. if this code gets
        # frozen by a tool like cx_Freeze.
        pass
    sys.modules['importlib._bootstrap'] = _bootstrap

The result of python manage.py run server is:
File "C:\Users\hp\AppData\Local\Programs\Python\Python36\dj\f\lib\importlib\__init__.py", line 25
    try:python manage.py makemigrations
                    ^
SyntaxError: invalid syntax

Can someone help with the error?

A: You have (accidentally?) pasted in
python manage.py makemigrations

in that file after try:.
Remove that and you should be golden – and you should always be able to recreate your virtualenv from scratch anyway.


text:
Q: how to stop the native android service playing music I am developing a media app.
If a user plays a song with the native android application for playing a song and then opens my application then i want to stop playing that song in background before user opens my application. At present both songs are being played at a time.

A: You can have your program run the isPlaying() routine check if something is playing and take action against the media player if needed.

A: You do not "stop playing that song in background before user opens my application". You request the audio focus using AudioManager.


text:
Q: How to convert byte array to int/long I have these byte arrays:

I have to order to little endian before to convert.
In first case, I do the conversion easyly:
byte[] serial = {-91, -101, 62, 55};
int serialNumber = java.nio.ByteBuffer.wrap(serial).order(ByteOrder.LITTLE_ENDIAN).getInt();
//serialNumber == 926849957 //Nice, works!!!!

In second case, the conversion doesn't works:
byte[] serial = {-45, 12, 115, -28};
int serialNumber = java.nio.ByteBuffer.wrap(serial).order(ByteOrder.LITTLE_ENDIAN).getInt();
//serialNumber == -462222125 //Wrong conversion. The right answer is 3832745171.

The number 3832745171 is larger than Integer.MAX_VALUE, but if I try to convert to long I got a problem too.
How can I do this?
Thanks.
Try to convert byte arrays to int/long types.

A: byte[] serial = {-45, 12, 115, -28};
int serialNumber = java.nio.ByteBuffer.wrap(serial).order(ByteOrder.LITTLE_ENDIAN).getInt();

This gives you the only representable equivalent of that in a Java int.
If you want it as an unsigned value, it will only be able to fit in a long, but you can write
Integer.toUnsignedLong(serialNumber)

(That said, you can just store it in an int.  It's still the same value, it just does math differently and prints differently; you can convert it only when necessary.)

A: 3832745171 is the value if you could use unsigned integer, but it's not a valid value of a signed integer.
It differs from -462222125 by Math.pow(2,32)
From the example in http://www.java2s.com/example/java/java.nio/get-unsigned-int-from-bytebuffer.html it seems possible to use a value in "long" to store the "Unsigned Integer" value.
Combining the logic in the link with your code, it would be like
long serialNumber = ( java.nio.ByteBuffer.wrap(serial).order(ByteOrder.LITTLE_ENDIAN).getInt() & 0xFFFFFFFFL)


text:
Q: How to call a stored procedure from Informatica cloud data integration? I am new learner in Informatica cloud data integration. Currently I am trying to convert SSIS ETL to Informatica.
While conversion, at one point I need to call a SQL Server stored procedure inside Informatica data integration which mainly update some data in tables. I tried many things but not getting success.
Can anyone have any idea how we can call a SQL Server stored procedure using informatica cloud data integration?

A: Please use the SQL transformation.
refer to the following link : network.informatica.com/videos/1213
Accept this as the right answer if it helped you. This will help people in future

A: You need to use a pre- or post processing script and call it from the native system as part of an integration. If this is for Application Integration then call as a command (and enable commands).
HTH
Scott S Nelson


text:
Q: PostgreSQL Not Opening the port 5432 on Ubuntu I bought a VPS from DigitalOcean with applications Rails+Unicorn+Nginx. I installed Postgresql 9.1 and trying to accept remote connections from that. I read all of the solutions/problems about it (Googled much) and did exactly. The problem is the following:

psql: could not connect to server: Connection refused
      Is the server running on host "xxx.xxx.xxx.xxx" and accepting
      TCP/IP connections on port 5432?

I edited the postgresql.conf file with  listen_addresses='*'
I edited the pg_hba.conf file and added host all all 0.0.0.0/0 md5
I restarted postgresql service and even the VPS however still I cannot connected to the database. So I tried to check the server's listening ports:
netstat -an | grep 5432
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN
unix  2      [ ACC ]     STREAM     LISTENING     8356     /tmp/.s.PGSQL.5432

and then I nmap'ed the server:
Not shown: 996 closed ports
PORT    STATE SERVICE
21/tcp  open  ftp
22/tcp  open  ssh
80/tcp  open  http
554/tcp open  rtsp

But still I cannot understand why postgresql not serving at the port 5432 after the configurations. Need advice.
Thanks.


text:
Q: how to get Complex object with EFcore using foreign key? I am using asp net core 5 for developing web API!
I have a problem that i create my database with EFCORE and I want to query an object that has foreign key!
here is my code:
    public long RefreshTokenId { get; set; }
    public string JwtTokenId { get; set;}
    public User user { get; set; }
    public Int64 expirationTime { get; set; }
    public string Token { get; set; }
    public bool Revoked { get; set; }

in this class i use User Object as an object with foreign key in one to one relation according to efcore documentation!
here is my problem:
        public async Task<long> RefreshToken(RefreshRequest refreshRequest)
        {
        RefreshToken refreshToken = await Task.Run(() => {
            return _appContext.refreshTokens.SingleOrDefault(x => x.Token ==
                 refreshRequest.refreshToken);
        });

         return refreshToken.user.UserId;
         }

when i run this function the null pointer exception is thrown!
can anybody explain me how to retrive user object with efcore?

A: Try
 public async Task<long> RefreshToken(RefreshRequest refreshRequest)
        {
        RefreshToken refreshToken = await Task.Run(() => {
            return _appContext.refreshTokens.Where(x => x.Token ==
                 refreshRequest.refreshToken).SingleOrDefault();
        });

         return refreshToken.user.UserId;
         }

A: the main issue is that i wanted to load related data with foreign key and it has three methods and the following links would help you!
from MicroSoft Docs
from tutorials in internnt!


text:
Q: Menu Goes left side (approx 20px in chrome) when click on menu in bootstrap I have a problem in menu flickering in bootstrap when i click on any of the menu it goes left side 10-20px in chrome and then page loads so what is the issue in it. It's working perfectly in FIrefox and safari but in chrome it's not working. I didn't change any css or js of bootstrap so i share cdn link of bootstrap js and css. My live website's url is explained below.
Url : http://cmexpertiseinfotech.com/experttheme/index.html
CSS : https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css
Js : https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js
HTML Code of menu:

      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">

      </button>

Themes

Service

Blog

Support

Contact

Login

EDIT :
Css changes as of transition (I also Tried with change in all the transition but i have updated question only with -webkit-transition)
.navbar-nav li a:hover, .navbar-nav li.active a
 {
           color: #fff !important;
           background-color: #158fa1 !important;border-radius: 5px;
           -webkit-transition: color 0.4s ease, background 0.4s ease;
           -o-transition: all .4s ease-in-out;
           transition: all .4s ease-in-out
 }

A: Well, This flickering effect is because of Google and other fonts if there are any in your web page.
When your page loads, browser uses default web-safe fonts to show your content. Meanwhile it starts downloading fonts from Google and other servers. Each font has its own characteristics i.e width and height of each character is different in different fonts.
Default web-safe font in your case is taking more space so when fonts are completely downloaded and changed on your webpage, you see flickering effect.
To fix this issue, you can use a pre-loader that will be visible untill all your files are downloaded completely and your web page is fully ready to the users.


text:
Q: UWP - zooming image (with pinch zoom and double tap), with Flip View I need to show images (using Flip View controll) and allow users to zoom them (with pinch zoom and with double tap) and drag zoomed image.
I would like it to be compatible with Flip View (I mean it shouldn't ovveride draging gesture).
What is the best way to achieve that?

A:
I need to show images (using Flip View controll) and allow users to zoom them (with pinch zoom and with double tap) and drag zoomed image.

We can use the ScrollViewer control and UIElement.DoubleTapped event to allow users to zoom the images (with pinch zoom and with double tap) and drag zoomed image.
In order to zoom the image with pinch zoom and drag zoomed image. We can put the Image into the ScrollViewer.
We can add UIElement.DoubleTapped event in the ScrollViewer to zoom the image with double tap.
For example:
In XAML:
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <FlipView Name="MyFlipView">
            <FlipView.ItemTemplate>
                <DataTemplate x:DataType="local:MyImage">
                    <ScrollViewer  MinZoomFactor="1" DoubleTapped="scrollViewer_DoubleTapped"
                  ZoomMode="Enabled">
                        <Image Source="{Binding Path}" />
                    </ScrollViewer>
                </DataTemplate>
            </FlipView.ItemTemplate>
        </FlipView>
    </Grid>

In code behind:
public ObservableCollection<MyImage> MyImages;

public MainPage()
{
    this.InitializeComponent();
    MyImages = new ObservableCollection<MyImage>();
    MyImages.Add(new MyImage("ms-appx:///Assets/cliff.jpg"));
    MyImages.Add(new MyImage("ms-appx:///Assets/grapes.jpg"));
    MyImages.Add(new MyImage("ms-appx:///Assets/rainer.jpg"));
    MyImages.Add(new MyImage("ms-appx:///Assets/sunset.jpg"));
    MyImages.Add(new MyImage("ms-appx:///Assets/valley.jpg"));
    MyFlipView.ItemsSource = MyImages;
}

private async void scrollViewer_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
{
    var scrollViewer = sender as ScrollViewer;
    var doubleTapPoint = e.GetPosition(scrollViewer);

    if (scrollViewer.ZoomFactor != 1)
    {
        scrollViewer.ZoomToFactor(1);
    }
    else if (scrollViewer.ZoomFactor == 1)
    {
        scrollViewer.ZoomToFactor(2);

        var dispatcher = Window.Current.CoreWindow.Dispatcher;
        await dispatcher.RunAsync(CoreDispatcherPriority.High, () =>
      {
          scrollViewer.ScrollToHorizontalOffset(doubleTapPoint.X);
          scrollViewer.ScrollToVerticalOffset(doubleTapPoint.Y);
      });
    }
}

And the MyImage Class code:
public class MyImage
{
    public MyImage()
    {
    }

    public MyImage(string uri)
    {
        this.Path = uri;
    }

    public string Path { get; set; }
}


text:
Q: Wordpress or front end Developer I started learning HTML,CSS,then when l came to Javascript, l discovered that 40% of the web are made by Wordpress, so here l stopped learning, and my question is why l should continue learning other technologies when l have something else that l can make same job through

A: Wordpress website are made with HTML, CSS, Javascript, PHP.
Yes, with Wordpress it is possible to create professional websites without coding. However, it is easy to be limited when you don't know how to code and you have very specific requirements.
I'm a web developper and many clients want to customize the functionality and appearance of their site. The needs are often so specific that no plugin is suitable and only a custom development can satisfy their request. This is where knowing how to code comes in handy.

A: WordPress is a Content Management System which is built with HTML, CSS, JavaScript and PHP. If you don't want to learn these languages and just want to go for drag and drop builders like Elementor and WPBakery etc. then you will be limited to build certain type of websites only and you will be limited on their functionality & customzation too.
On the other hand with learning these languages you will be able to create custom themes, plugins of almost any kind. You will be able to develop from small websites to e-commerce, point of sales, school or laboratory management systems and so on...
I agree with @Kirk Beard as he said in his comment they are totally worth learning and keep in mind that as WordPress excels at some things, it is terrible at other things.


text:
Q: How to upload an image to node/mongodb backend from ios swift I am trying to upload an image from the iphone gallery onto a backend that is constructed using node and mongodb as the db. I am essentially very new to app development and have had 0 luck in finding any useful information. Any help would be much appreciated.

A: Here you can find some information about storing images with node.js in a mongodb.
Uploading and storing images
And uploading an image with swift:
Uploading file with parameters using Alamofire


text:
Q: von Neumann automorphisms: does convergence on a dense algebra imply $u$-convergence? Let $M$ be a separable von Neumann algebra and let $A$ be a (von Neumann-)dense *-subalgebra.
Suppose that $\alpha,\alpha_1,\alpha_2,\dots$ are automorphisms of $M$, such that for every $a \in A$,
$$ \alpha_n(a) = \alpha(a) $$
for all $n$ sufficiently large.
Does it follow that $\alpha_n$ converges to $\alpha$ in the $u$-topology?
(Also: what about if we weaken the hypothesis to just assuming that $\alpha_n(a)$ converges in norm to $\alpha(a)$, for all $a \in A$?)
This question is inspired by a  related MO question, where an explicit example was requested of a sequence of inner automorphisms on the hyperfinite $III_1$- (or $II_1$-) factor which converge to an outer automorphism.
An answer involved a sequence of inner automorphisms satisfying, in particular, the hypotheses of my question, although the proof of convergence uses more information.  Perhaps other examples answering that question would be available if the answer to my question is yes.

A: No. For an example, consider $M=L^\infty([0,1])$ with the Lebesgue measure, take $A$ to be the functions that are piecewise constant on dyadic intervals and $\alpha_n(f)=f\circ \phi_n^{-1}$ where $\phi_n(t)=k/2^n + (2^n t-k)^2/2^n$ if $t \in [k/2^n,(k+1)/2^n[$. In words, $\phi_n$ acts as some fixed transformation (here $t \mapsto t^2$, but it could be anything but the identity) but at a smaler and smaler scale.
Since $\phi_n$ preserves the intervals $[k/2^n,(k+1)/2^n[$, $\alpha_n(a)=a$ for all $a$ $\mathcal F_n$-measurable, where $\mathcal F_n = \sigma([k/2^n,(k+1)/2^n[, 0\leq k<2^n)$. So $\alpha_n$ satisfies your assumption with $\alpha=id$.
However, consider $1 \in L^1([0,1])=L^\infty([0,1])_*$. Then $(\alpha_n)_* 1= \phi_n'$, and $\|1 - \phi_n'\|_{L^1} = \|1 - \phi_0'\|_{L^1} = \int_0^1 |2u-1| dt=1/2$ does not converge to $0$.
But the answers to both your questions become yes if you assume that $M$ is finite and $\alpha_n$ preserves a trace (for example if $M$ is a $II_1$ factor). Or more generally if the $\alpha_n$'s preserve a normal faithful state $\phi$. Indeed, then on the one hand by Hahn-Banach $\{ \phi(a \cdot), a \in A\}$ forms a norm dense subspace of $M_*$, and on the other hand $(\alpha_n)_*(\phi(a \cdot)) = \phi(\alpha_n^{-1}(a) \cdot)$. Hence $(\alpha_n)_*$ converges pointwise in norm on a dense subspace of $M_*$, so it converges pointwise in norm on $M_*$.


text:
Q: Retrieving Hidden input value using java I have a requirment. I have placed a Hidden field  in my HTML. I want to retrieve that hidden text value from Java. Is there any way to do it? I know we can do it in javascript but i need to extract the value from java.
I have created a hidden text field like this:
<input type="HIDDEN" name="X" value="2356544">

I want to retrieve 2356544 through java.
Please let me know how to do this.

A: If you are using Servlets you can retrive the value of a parameter with
request.getParameter("X");

or if you have a JSP then use
Hello <c:out value="${param.X}" />

A: This has to be a web application since it is using html. So in a web application you have request object, so you can use
request.getParameter("X") from your servlet or action.

A: try like this
create id attribute in hidden field as id="X"  then in javascript take value using id
var value=document.getElementById('X').value;

or
using name
 var value=document.getElementsByName('X').value;


text:
Q: How to go around a truthy statement here? I was trying to implement a navbar functionality in my web app which should be switching the information rendered based on a boolean residing in my redux status. Now, when the user is not logged in, the object fetched using my used selector is an empty one which means that is a truthy value hence not enabling me to toggle the element on the navabr as i wish. Is there a way to do that without modifying my redux status ?
Thank you in advance.
import './App.css';
import { Route, Routes, Link, Redirect, Navigate } from "react-router-dom";
import { useEffect, useState } from 'react';
import { useSelector } from 'react-redux';
import SearchBar from "./components/searchBar";
import Main from './components/main';
import Login from './components/login';
import Register from './components/register';

let linkStyle = { textDecoration: "none", color: "white" };

function App() {

  // fetching redux status
  let user = useSelector(state => state.loginStatus.user)
  let loginStatus = useSelector(state => state.loginStatus.isLoggedIn)
  console.log(loginStatus)

  const [isActive, setIsActive] = useState(false);

  const [isLoggedIn, setIsLoggedIn] = useState(false);
  const [avatar, setAvatar] = useState({});

  useEffect(() => {
    if (loginStatus) {
      setIsLoggedIn(loginStatus)
      setAvatar(user)
    }
  }, [loginStatus, isLoggedIn, isActive, avatar])

  return (

<Link to={'/'} onClick={() => setIsActive(false)}></Link>

Travel.com

        {
          isLoggedIn && (

<Link style={linkStyle} to='/login' onClick={() => setIsActive(true)}>Log-in</Link>

<Link style={linkStyle} to='/register' onClick={() => setIsActive(true)}>Register</Link>

)
        }
        { /*
          isLoggedIn && (

 Hi avatar.user_name!

          ) */
        }

A: If I understand your question correctly then a simple solution could be to check if the object is empty using something like: Boolean(Object.keys(logInStatus).length)
this will return false if logInStatus is an empty object, and true if it has any properties. You would pass this as the argument into setIsLoggedIn() in your useEffect().
You said you don't want to change the Redux store, however I would call into question the naming of the isLoggedIn property. By starting a property with is the name implies that it is a boolean value, or at the very least that it will coerse into a boolean value which corresponds to its name. This is something to watch out for as someone who doesn't know the codebase well would most likely end up making an assumption based on conventions, resulting in a situation like this with code behaving the opposite way to how you would expect.


text:
Q: How to compute a minimal half-space representation? I have a convex polytope given as half-space representation
$$ A x \leq b $$
with matrix $A \in R^{M \times N}$,
vector $x \in R^{N}$,
vector $b \in R^{M}$
and $M>N$.
My question is:
How can I efficiently compute a minimal half-space representation (without computing the vertex-representation)?
In other words, I want to reformulate the above inequality without modifying the corresponding polytope in order to obtain
$$ A^{*} x \leq b^{*}$$
where $A^{*}$ and $b^{*}$ have the minimum number of required rows (less rows compared to the original $A$ and $b$).
Or, in other words, I want to get rid of halfplanes in $A$ that do not intersect with the polytope.


text:
Q: Unable to set cookie in React by using Django I created a React website that uses API to communicate with the Django backend. I use djangorestframework to create API. I need to set cookie to react but there is no update cookie on React site.
views.py
class Test(generics.CreateAPIView):
    def post(self,request, *args, **kwargs):
        response = Response()
        response.set_cookie('test_cookie', 'MY COOKIE VALUE')
        return response

How to fix this problem? What topic should I know to fix that problem?

A: Solution
first, I used Chatgpt to search "how to set Django setting.py file that allow Django to set cookie to React API "
First, make sure your request from React set credentials:'include' in request augument for example,
fetch(url, {
    method: 'POST',
    credentials:'include',
    body: JSON.stringify({payload:payload})
})

Second, in your setting file, you have to allow CORS in Django. You can use Chatgpt to ask How? and this is a little bit additional more code in setting.py
CORS_ALLOW_HEADERS = [
    "content-type",
    "X-CSRFToken"
]
CORS_EXPOSE_HEADERS =[
    "content-type",
    "X-CSRFToken"
]

CSRF_COOKIE_SAMESITE='Lax'
CSRF_COOKIE_HTTPONLY =True
CSRF_TRUSTED_ORIGINS = [
    "http://127.0.0.1:3000",
    "http://localhost:3000",
]

CORS_ORIGIN_WHITELIST = [
    'http://localhost:3000',
    'http://127.0.0.1:3000',
]
CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_CREDENTIALS = True

the code above is a bit messy and there is maybe unneccessary script that you have to remove&test
Third, after remove and test, 2 things you have to check is, when you remove&test after that make sure you logout django-admin 127.0.0.1:8000/admin website, and login,and make sure there is no problems with login because if you can't login, it mean you have a problem with CSRF so just set it back to the previous version CTRL-Z.


text:
Q: Flip the bits on the diagonal of a binary matrix The following code flips the bits of a binary-valued matrix.
I realise that the positions of diagonal elements (form {i,i}) can be easily generated with Table or another Mathematica function. I don't want to use this fact. I aim to learn about applying functions to elements in specific positions, using patterns to identify the positions.
The following code for flipping the bits on diagonal positions of a matrix has been written in that spirit:
Test to identify diagonal positions:
diagonalPositionTest[p_] := MatchQ[p, {i_, i_}]

Determining the positions of diagonal elements using MapIndexed:
helpMapIndexed[f_, m_] := MapIndexed[{#1, f[#2]} &, m, {2}]

matrixAnnotated = helpMapIndexed[diagonalPositionTest, M]

Flipping the diagonal-bits
matrixAnnotated /. {{x_, True} -> 1 - x, {x_, False} -> x}

The code can be tested on a binary-valued matrix:
M = IdentityMatrix[4] /. {0 :> RandomInteger[{0, 1}],
   1 :> RandomInteger[{0, 1}]}

Can the above solution be coded in a different way?
I don't mean using the fact that diagonal positions are of a trivial form (eliminating the pattern-test).
I mean: is there a more direct route (or more efficient code) to produce the same result using a Mathematica command that

*

*makes use a pattern to identify particular positions

*with the aim to replace the elements in those selected positions with new elements

*(where these new elements are computed via a function application).

Or is MapIndexed the "right" approach (given the above aims)?

A: This is another way to do it
SetAttributes[flip, Listable]
flip[x_, 0] := x
flip[x_, 1] := 1 - x
flipDiagonal[m_?SquareMatrixQ] := flip[m, IdentityMatrix[Length[m]]]

to test
M = RandomInteger[{0, 1}, {6, 6}];
MatrixForm /@ {M, flipDiagonal[M]}

A: The following seems reasonably clean:
M = RandomInteger[{0, 1}, {4, 4}]
(* {{0, 1, 1, 1}, {0, 1, 1, 0}, {1, 0, 0, 0}, {0, 0, 0, 0}} *)

ReplacePart[M, {i_, i_} :> 1 - M[[i, i]]]
(* {{1, 1, 1, 1}, {0, 0, 1, 0}, {1, 0, 1, 0}, {0, 0, 0, 1}} *)

My main issue with this is that ReplacePart doesn't give you access to the previous value at the affected position, so we have to extract it manually from M. (On the other side of the spectrum there is MapAt, which gets the previous value, but doesn't support pattern positions, so ReplacePart is definitely more suited)

A: And yet another method using BitXor[]:
SeedRandom[1234];
m = RandomInteger[{0, 1}, {8, 8}];
Imn = IdentityMatrix[Length[m]];

which gives:
m // MatrixForm
BitXor[m, Imn] // MatrixForm

Also here's a quick time comparison of the various methods for large matrices (apologies as my Mathematica v11.2 doesn't support all the commands shown by other users). Note the timings are in secs and the runs were made on Windows 10.
SeedRandom[1234];
m = RandomInteger[{0, 1}, {200, 200}];
Imn = IdentityMatrix[Length[m]];

BitXor[m, Imn] // RepeatedTiming // First
(* 0.000051 *)

Abs[m - Imn] // RepeatedTiming // First
(* 0.00011 *)

LinearAlgebra`Private`SetMatrixDiagonal[m, 1 - Diagonal@m] // RepeatedTiming // First
(* 2.56*10^-6 *)

ReplacePart[m, {i_, i_} :> 1 - m[[i, i]]]//RepeatedTiming//First
(* 0.0091 *)

SetAttributes[flip, Listable]
flip[x_, 0] := x
flip[x_, 1] := 1 - x
flipDiagonal[m_?SquareMatrixQ] := flip[m,IdentityMatrix[Length[m]]]
flipDiagonal[m] // RepeatedTiming // First
(* 0.013 *)

(Set[m[[#, #]], Abs@(1 - #) &@m[[#, #]]] & /@
    Range@First@Dimensions@m) // RepeatedTiming // First
(* 0.00046 *)

m - Imn (2 m - 1) // RepeatedTiming // First
(* 0.00019 *)

From the methods tested, naively I'd say the LinearAlgebra[] method by @MichaelE2 and then BitXor[] are by far the fastest (albeit with the caveat that I didn't test a few of the methods as mentioned).

A: Another way is by using a mask, which conveniently is now the IdentityMatrix:
SeedRandom[1234];
m = RandomInteger[{0, 1}, {8, 8}];
MatrixForm[m]
id = IdentityMatrix[Length[m]];
MatrixForm[m - id (2 m - 1)]

A: LinearAlgebra`Private`SetMatrixDiagonal does an in-place, non-functional-programming change (like a lot of LAPACK functions) and is quite speedy. Using @SHuisman's example:
SeedRandom[1234];
m = RandomInteger[{0, 1}, {8, 8}];

m // MatrixForm

LinearAlgebra`Private`SetMatrixDiagonal[m, 1 - Diagonal@m];
m // MatrixForm

In particular, it does not unpack the matrix, which Listable functions, ReplacePart, and SubsetMap† do (†SubsetMap is complicated: it unpacks something but perhaps not the whole matrix, and returns a packed matrix). Keeping the matrix packed can be an important factor in the performance of linear algebra applications; however, in small, short computations, it is not important.

A: You can use SubsetMap to apply a function to the diagonal only.
n = 6;
SeedRandom[1];
M = RandomInteger[{0, 1}, {n, n}];
f1 = SubsetMap[Abs@(# - 1) &, M, {#, #} & /@ Range[n]]
MatrixForm /@ {M, f1}

$$\left(
\begin{array}{cccccc}
 1 & 1 & 0 & 1 & 0 & 0 \\
 0 & 1 & 0 & 1 & 0 & 0 \\
 0 & 0 & 0 & 0 & 0 & 1 \\
 1 & 1 & 0 & 0 & 0 & 0 \\
 0 & 0 & 0 & 0 & 1 & 0 \\
 0 & 0 & 0 & 1 & 1 & 0 \\
\end{array}
\right),
\left(
\begin{array}{cccccc}
 0 & 1 & 0 & 1 & 0 & 0 \\
 0 & 0 & 0 & 1 & 0 & 0 \\
 0 & 0 & 1 & 0 & 0 & 1 \\
 1 & 1 & 0 & 1 & 0 & 0 \\
 0 & 0 & 0 & 0 & 0 & 0 \\
 0 & 0 & 0 & 1 & 1 & 1 \\
\end{array}
\right)
$$

EDIT
With M as defined above, evaluate to see the in-place change:
Dynamic[M // MatrixForm]

Set[M[[#, #]], Abs@(1 - #) & @M[[#, #]]] & /@
  Range@First@Dimensions@M;

A: This might be too simple for SE mathematica, but I would just use subtraction and absolute value:
m1 = RandomInteger[{0, 1}, {6, 6}];
m2 = m1 - IdentityMatrix[6];
m3 = Abs[m2];

m1 // MatrixForm
m2 // MatrixForm
m3 // MatrixForm

Here's the output:


text:
Q: A phrase that means "someone who used to be a servant but suddenly became the lord of the family" meaning A phrase that means "someone who used to be a servant but suddenly became the lord of the family" meaning. Someone who used to be of low ranking but due to certain factors, got promoted to a higher ranked person suddenly. Is there any phrase or words to describe that?
More emphasis on the difference in rank/status and less on the wealth part.

A: It's a Cinderella story

Used in reference to a situation in which a person, team, etc., of low status or importance unexpectedly achieves great success or public recognition.
'the team ended their Cinderella story with a 6–5 triumph'

[Oxford]
Also see: Cinderella Man


text:
Q: Convert from hex to int and vice versa in java I have next method for converting to int from hex:
public static byte[] convertsHexStringToByteArray2(String hexString) {
    int hexLength = hexString.length() / 2;
    byte[] bytes = new byte[hexLength];
    for (int i = 0; i < hexLength; i++) {
        int hex = Integer.parseInt(hexString.substring(2 * i, 2 * i + 2), 16);
        bytes[i] = (byte) hex;
    }

    return bytes;
}

when I use it for "80" hex string I get strange, not expected result:
public static void main(String[] args) {
    System.out.println(Arrays.toString(convertsHexStringToByteArray2("80"))); // gives -128
    System.out.println(Integer.toHexString(-128));
    System.out.println(Integer.toHexString(128));
}

the output:
[-128]
ffffff80
80

I expect that "80" will be 128. What is wrong with my method?

A:
I have next method for converting to int from hex

The method you posted converts a hex String to a byte array, and not to an int. That's why it is messing with its sign.
Converting from hex to int is easy:
Integer.parseInt("80", 16)
$1 ==> 128

But if you want to get a byte array for further processing by just casting:
(byte) Integer.parseInt("80", 16)
$2 ==> -128

It "changes" its sign. For further information on primitives and signed variable types take a look at Primitive Data Types, where it says:

The byte data type is an 8-bit signed two's complement integer. It has a minimum value of -128 and a maximum value of 127 (inclusive). The byte data type can be useful for saving memory in large arrays, where the memory savings actually matters. They can also be used in place of int where their limits help to clarify your code; the fact that a variable's range is limited can serve as a form of documentation.

One could easily invert the sign by just increasing the value to convert:
(byte) Integer.parseInt("80", 16) & 0xFF
$3 ==> 128

That gets you a byte with the value you expect. Technically that result isn't correct and you must to switch the sign again, if you want to get an int or a hex string back again. I'd suggest you to don't use a byte array if you only want to convert between hex and dec.

A: A byte in Java stores numbers from -128 to 127. 80 in hex is 128 as an integer, which is too large to be stored in a byte. So, the value wraps around. Use a different type to store your value (such as a short).


text:
Q: In Xcode, how do I simulate gyroscope for iPhone4? I want to test a web application URL which requires gyroscope.
I have installed xcode and simulated an iphone4 but if I try to access any gyroscope enabled web application it does not work. I searched and found I have to add some hardware capabilities for it. Can anyone tell me the process I can follow to simulate a gyroscope enabled iPhone using Xcode?
Currently I don't have a iphone with gyroscope and don't want to buy one just for testing.
I am running: Xcode Version 4.3.1 (4E1019)
and Mac mini with Mac OS X Lion 10.7.3 (11D50d)

A: You can't check gyroscope functionality in simulator using xcode.. you'll have to test on real device..


text:
Q: How to style select with form-control style so that it aligns on the left with input with form-control style? I notice that if I use flexbox with a select and input, both with form-control style, that they do not align on the left (I have put that text in bold as people do not seem to understand the problem). The left side of the top input is not aligned with the left side of the select. They align if I remove the padding of the input.
Edit: This problem appears on Chrome and Safari. Firefox is okay.
Plunker

Markup

    Input default
    <input class="input form-control">

    Input no padding
    <input class="input form-control no-padding">

    Select
    <select class="input form-control">
          <option>Hello</option>
          <option>World</option>
        </select>

CSS
.all {
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.container {
  display: flex;
  flex: 1;
  align-items: center;
}

.input {
  flex: 1
}

.label {
  flex: 1;
  background: yellow;
  text-align: right;
  padding-right: 10px;
  margin-bottom: 0;
}

.no-padding {
  padding: 0;
}

How can I style the select only or use flexbox so that it aligns with the input?
Please do not edit this question so that it runs a code snippet unless the output is exactly as shown in the image.

A: Please try this.

.all {
  display: flex;
  flex-direction: column;
  padding: 20px;
}
.col-form-label {
  background: yellow;
  text-align: right;
}
.container {
  width: 100%;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.4/css/bootstrap.min.css" rel="stylesheet"/>

      Input default

        <input class="input form-control">

      Input no padding

        <input class="input form-control">

    Select

      <select class="input form-control">
        <option>Hello</option>
        <option>World</option>
      </select>

A: You can't add padding to select element because is generated by the user agent so you can use appearance: none; to reset browser default and add your style.
Unfortunately not all browser support it: https://caniuse.com/#search=appearance

.all {
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.container {
  display: flex;
  flex: 1;
  align-items: center;
}

.input {
  flex: 1
}

.label {
  flex: 1;
  background: yellow;
  text-align: right;
  padding-right: 10px;
  margin-bottom: 0;
}

.no-padding {
  padding: 0;
}

select.form-control {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding: 6px 12px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>

    Input default
    <input class="input form-control">

    Input no padding
    <input class="input form-control no-padding">

    Select
    <select class="input form-control">
          <option>Hello</option>
          <option>World</option>
        </select>

A: A solution is to put the various elements within a flex wrapper. This example shows the principle.

Working Plunker
Markup

      Input default

      <input class="form-control">

      Select

      <select class="form-control">
        <option>Hello</option>
        <option>World</option>
      </select>

CSS
.all {
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.container {
  display: flex;
  align-items: center;
}

.input {
  flex: 1
}

.label {
  flex: 1;
  background: yellow;
  text-align: right;
  padding-right: 10px;
  margin-bottom: 0;
}

.no-padding {
  padding: 0;
}

.wrapper {
  display: flex;
  flex: 1;
}


text:
Q: Получение данных из mysql в php Пишу программу на C++, есть работа с PhP частью
Нужно вывести число из Базы Данных.
При корректном подключении идёт такое окно:

в php прописывал echo 'true'; для проверки работы
Щас решил вывести количество оставшихся дней в программу
Закоменчиваю echo 'true';, и прописываю следующий код:
        $sql = mysqli_query($db, 'SELECT `date` FROM `keyact`');
        while ($result = mysqli_fetch_array($sql))
        {
            echo "{$result['date']}<br>";
        }

Но теперь программа не может соединиться с сервером, и выводит Error Key (по типу ошибки подключения)
Полный код
https://pastebin.com/7GztFz67


text:
Q: gltf-model not working with aframe-extras I need to use aframe-extras to be able to teleport. But if I use aframe-extras gltf-model do not show.
<html>
 <head>
   <script src="assets/lib/aframe-extras.js"></script>
   <!-- <script src="assets/lib/aframe.min.js"></script> -->
 </head>
 <body>
   <a-scene>
     <a-assets>
       <a-asset-item id="yoda" src="assets/models/sgp24_yoda_master/scene.gltf"></a-asset-item>
     </a-assets>

     <a-entity gltf-model="#yoda" position="0 1.25 -5"></a-entity>
   </a-scene>
 </body>
</html>

A: You have to import both a-frame and a-frame-extras. One of the script tags is commented out in your snippet. a-frame has to also load first:
<html>
 <head>
   <script src="assets/lib/aframe.min.js"></script>
   <script src="assets/lib/aframe-extras.js"></script>
 </head>
 <body>
   <a-scene>
     <a-assets>
       <a-asset-item id="yoda" src="assets/models/sgp24_yoda_master/scene.gltf"></a-asset-item>
     </a-assets>

     <a-entity gltf-model="#yoda" position="0 1.25 -5"></a-entity>
   </a-scene>
 </body>
</html>


text:
Q: How to map rotate, pan, zoom to manipulate controls I am wondering if there is a way to restrict the motion of the rotate mouse cursor in when moving around a 3d plot.
For example, I want the y direction of the cursor to correspond to pulling the z axis toward or away from me (the camera), and the x direction to rotate the graphic around the z axis.
I can do something similar using,
Manipulate[
 Graphics3D[{Sphere[{1, 0, 0}, 0.05], Sphere[{0, 0, 0}, 0.2],
 {Arrow[{{0, 0, 0}, {1.1, 0, 0}}], Text["x", {1.2, 0, 0}],
  Arrow[{{0, 0, 0}, {0, 1.1, 0}}], Text["y", {0, 1.2, 0}],
  Arrow[{{0, 0, 0}, {0, 0, 1.1}}], Text["z", {0, 0, 1.2}]}},
 ViewVector -> {40 {Cos[a] Sin[b], Sin[a] Sin[b], Cos[b]}, {0, 0, 0}},
 ViewAngle -> 4 Degree ,
SphericalRegion -> True,
Boxed -> False
],
{{a, 0.3}, -2 \[Pi], 2 \[Pi]},
{{b, 1.347}, -2 \[Pi], 2 \[Pi]}
]

where sliding $a$ rotates the graphic around the z axis (or rather the viewpoint) and sliding $b$ pulls the z axis in or out.
Edit to make description clearer
The 3 dimensional ViewVector seems to be changed somehow by the 2 dimensional "double arrow Rotation" cursor when clicking and dragging on the plot.
I am not even sure how this is possible, but is it possible to restrict it so that only 2 of the 3 Euler angles (e.g. rotation about the z axis and inclination of the x-y plane) are changed?
The third Euler angle is natively controlled by the "additional rotation" cursor, which is available when you put the cursor in the corner.

A: OP has said:

For example, I want the y direction of the cursor to correspond to pulling the z axis toward or away from me (the camera), and the x direction to rotate the graphic around the z axis.

I don't know in which version it was introduced but "RotationControl" -> "Globe" does exactly what you are asking for.
Graphics3D[Cuboid[], Method -> {"RotationControl" -> "Globe"}]

This is not the answer to the general question about the 3rd Euler angle etc. Unfortunatelly  I don't have time to play with this now.
If someone has time, here is my answer which shows how to play with mouse related events over Graphics3D:
Changing the Actions in EventHandler