text:
Q: Watching videos with hardware acceleration enabled gives me sound but no image When trying to run mplayer2 with vdpau on a vdpau compatible laptop with Nvidia graphics driver, I only get audio from it.
My Nvidia card should be supported as far as I can see, so I wonder if the problem is that I don't have the right packages or configuration:
avilella@magneto:~$ vainfo
libva: VA-API version 0.32.0
libva: va_getDriverName() returns 0
libva: Trying to open /usr/lib/dri/i965_drv_video.so
libva: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit
avilella@magneto:~$ optirun vainfo
libva: VA-API version 0.32.0
libva: va_getDriverName() returns 0
libva: Trying to open /usr/lib/dri/i965_drv_video.so
libva: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit

mplayer -vo vdpau -ao alsa file.mkv
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
[vdpau] Error when calling vdp_device_create_x11: 1
Error opening/initializing the selected video_out (-vo) device.

lspci -vmk | grep -A 8 -B 2 VGA

Device: 00:02.0
Class:  VGA compatible controller
Vendor: Intel Corporation
Device: Core Processor Integrated Graphics Controller
SVendor:    ASUSTeK Computer Inc.
SDevice:    Device 1362
Rev:    18
Driver: i915
Module: i915

--

Device: 01:00.0
Class:  VGA compatible controller
Vendor: nVidia Corporation
Device: GT218 [GeForce 310M]
Rev:    ff
ProgIf: ff

I tried following the hybrid-dump instructions, and I get this:
avilella@magneto:~/hybrid_graphics/hybrid-windump$ git pull
Already up-to-date.
avilella@magneto:~/hybrid_graphics/hybrid-windump$ make clean && make
\rm -f windump.o windump *~ core
gcc -O2  -std=gnu99 -pedantic -Wall -Wextra -c windump.c -o windump.o
windump.c: In function âcapture_rootâ:
windump.c:56:9: warning: unused variable âallImageâ [-Wunused-variable]
windump.c:42:12: warning: unused variable âdummywinâ [-Wunused-variable]
windump.c:41:9: warning: variable âbwâ set but not used [-Wunused-but-set-variable]
windump.c:40:17: warning: variable âdheightâ set but not used [-Wunused-but-set-variable]
windump.c:40:9: warning: variable âdwidthâ set but not used [-Wunused-but-set-variable]
windump.c:35:10: warning: variable âgot_win_nameâ set but not used [-Wunused-but-set-variable]
windump.c:33:18: warning: unused variable âiâ [-Wunused-variable]
windump.c:33:9: warning: unused variable âncolorsâ [-Wunused-variable]
windump.c:32:9: warning: unused variable âheader_sizeâ [-Wunused-variable]
windump.c:31:9: warning: variable âwin_name_sizeâ set but not used [-Wunused-but-set-variable]
windump.c:30:14: warning: unused variable âbuffer_sizeâ [-Wunused-variable]
windump.c:29:13: warning: unused variable âcolorsâ [-Wunused-variable]
windump.c:28:19: warning: unused variable âswaptestâ [-Wunused-variable]
windump.c: In function âmainâ:
windump.c:280:17: warning: unused variable âymouseâ [-Wunused-variable]
windump.c:280:9: warning: unused variable âxmouseâ [-Wunused-variable]
gcc -o windump windump.o  -Wl,-O2 -Wall -Wextra -Werror -lX11 -lXext -lXfixes
avilella@magneto:~/hybrid_graphics/hybrid-windump$ ./windump
Usage: ./windump source target
where source and target are X11 display names.
Example: ./windump :0.0 :0.1
avilella@magneto:~/hybrid_graphics/hybrid-windump$ optirun glxinfo
name of display: :0.0
display: :0  screen: 0
direct rendering: Yes
server glx vendor string: VirtualGL
server glx version string: 1.4
server glx extensions:
    GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_visual_info,
    GLX_EXT_visual_rating, GLX_SGI_make_current_read, GLX_SGIX_fbconfig,
    GLX_SGIX_pbuffer, GLX_SUN_get_transparent_index, GLX_ARB_create_context
client glx vendor string: VirtualGL
client glx version string: 1.4
client glx extensions:
    GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_visual_info,
    GLX_EXT_visual_rating, GLX_SGI_make_current_read, GLX_SGIX_fbconfig,
    GLX_SGIX_pbuffer, GLX_SUN_get_transparent_index, GLX_ARB_create_context
GLX version: 1.4
GLX extensions:
    GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_visual_info,
    GLX_EXT_visual_rating, GLX_SGI_make_current_read, GLX_SGIX_fbconfig,
    GLX_SGIX_pbuffer, GLX_SUN_get_transparent_index, GLX_ARB_create_context
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce 310M/PCI/SSE2
OpenGL version string: 3.3.0 NVIDIA 290.10
OpenGL shading language version string: 3.30 NVIDIA via Cg compiler
OpenGL extensions:
    GL_ARB_base_instance, GL_ARB_blend_func_extended,
    GL_ARB_color_buffer_float, GL_ARB_compatibility,
    GL_ARB_compressed_texture_pixel_storage, GL_ARB_conservative_depth,
    GL_ARB_copy_buffer, GL_ARB_depth_buffer_float, GL_ARB_depth_clamp,
    GL_ARB_depth_texture, GL_ARB_draw_buffers, GL_ARB_draw_buffers_blend,
    GL_ARB_draw_elements_base_vertex, GL_ARB_draw_instanced,
    GL_ARB_ES2_compatibility, GL_ARB_explicit_attrib_location,
    GL_ARB_fragment_coord_conventions, GL_ARB_fragment_program,
    GL_ARB_fragment_program_shadow, GL_ARB_fragment_shader,
    GL_ARB_framebuffer_object, GL_ARB_framebuffer_sRGB,
    GL_ARB_geometry_shader4, GL_ARB_get_program_binary,
    GL_ARB_half_float_pixel, GL_ARB_half_float_vertex, GL_ARB_imaging,
    GL_ARB_instanced_arrays, GL_ARB_internalformat_query,
    GL_ARB_map_buffer_alignment, GL_ARB_map_buffer_range, GL_ARB_multisample,
    GL_ARB_multitexture, GL_ARB_occlusion_query, GL_ARB_occlusion_query2,
    GL_ARB_pixel_buffer_object, GL_ARB_point_parameters, GL_ARB_point_sprite,
    GL_ARB_provoking_vertex, GL_ARB_robustness, GL_ARB_sample_shading,
    GL_ARB_sampler_objects, GL_ARB_seamless_cube_map,
    GL_ARB_separate_shader_objects, GL_ARB_shader_bit_encoding,
    GL_ARB_shader_objects, GL_ARB_shading_language_100,
    GL_ARB_shading_language_420pack, GL_ARB_shading_language_include,
    GL_ARB_shading_language_packing, GL_ARB_shadow, GL_ARB_sync,
    GL_ARB_texture_border_clamp, GL_ARB_texture_buffer_object,
    GL_ARB_texture_compression, GL_ARB_texture_compression_rgtc,
    GL_ARB_texture_cube_map, GL_ARB_texture_cube_map_array,
    GL_ARB_texture_env_add, GL_ARB_texture_env_combine,
    GL_ARB_texture_env_crossbar, GL_ARB_texture_env_dot3,
    GL_ARB_texture_float, GL_ARB_texture_gather,
    GL_ARB_texture_mirrored_repeat, GL_ARB_texture_multisample,
    GL_ARB_texture_non_power_of_two, GL_ARB_texture_query_lod,
    GL_ARB_texture_rectangle, GL_ARB_texture_rg, GL_ARB_texture_rgb10_a2ui,
    GL_ARB_texture_storage, GL_ARB_texture_swizzle, GL_ARB_timer_query,
    GL_ARB_transform_feedback2, GL_ARB_transform_feedback_instanced,
    GL_ARB_transpose_matrix, GL_ARB_uniform_buffer_object,
    GL_ARB_vertex_array_bgra, GL_ARB_vertex_array_object,
    GL_ARB_vertex_buffer_object, GL_ARB_vertex_program, GL_ARB_vertex_shader,
    GL_ARB_vertex_type_2_10_10_10_rev, GL_ARB_viewport_array,
    GL_ARB_window_pos, GL_ATI_draw_buffers, GL_ATI_texture_float,
    GL_ATI_texture_mirror_once, GL_S3_s3tc, GL_EXT_texture_env_add,
    GL_EXT_abgr, GL_EXT_bgra, GL_EXT_bindable_uniform, GL_EXT_blend_color,
    GL_EXT_blend_equation_separate, GL_EXT_blend_func_separate,
    GL_EXT_blend_minmax, GL_EXT_blend_subtract, GL_EXT_compiled_vertex_array,
    GL_EXT_Cg_shader, GL_EXT_depth_bounds_test, GL_EXT_direct_state_access,
    GL_EXT_draw_buffers2, GL_EXT_draw_instanced, GL_EXT_draw_range_elements,
    GL_EXT_fog_coord, GL_EXT_framebuffer_blit, GL_EXT_framebuffer_multisample,
    GL_EXTX_framebuffer_mixed_formats, GL_EXT_framebuffer_object,
    GL_EXT_framebuffer_sRGB, GL_EXT_geometry_shader4,
    GL_EXT_gpu_program_parameters, GL_EXT_gpu_shader4,
    GL_EXT_multi_draw_arrays, GL_EXT_packed_depth_stencil,
    GL_EXT_packed_float, GL_EXT_packed_pixels, GL_EXT_pixel_buffer_object,
    GL_EXT_point_parameters, GL_EXT_provoking_vertex, GL_EXT_rescale_normal,
    GL_EXT_secondary_color, GL_EXT_separate_shader_objects,
    GL_EXT_separate_specular_color, GL_EXT_shadow_funcs,
    GL_EXT_stencil_two_side, GL_EXT_stencil_wrap, GL_EXT_texture3D,
    GL_EXT_texture_array, GL_EXT_texture_buffer_object,
    GL_EXT_texture_compression_dxt1, GL_EXT_texture_compression_latc,
    GL_EXT_texture_compression_rgtc, GL_EXT_texture_compression_s3tc,
    GL_EXT_texture_cube_map, GL_EXT_texture_edge_clamp,
    GL_EXT_texture_env_combine, GL_EXT_texture_env_dot3,
    GL_EXT_texture_filter_anisotropic, GL_EXT_texture_format_BGRA8888,
    GL_EXT_texture_integer, GL_EXT_texture_lod, GL_EXT_texture_lod_bias,
    GL_EXT_texture_mirror_clamp, GL_EXT_texture_object,
    GL_EXT_texture_shared_exponent, GL_EXT_texture_sRGB,
    GL_EXT_texture_sRGB_decode, GL_EXT_texture_storage,
    GL_EXT_texture_swizzle, GL_EXT_texture_type_2_10_10_10_REV,
    GL_EXT_timer_query, GL_EXT_transform_feedback2, GL_EXT_vertex_array,
    GL_EXT_vertex_array_bgra, GL_EXT_x11_sync_object,
    GL_EXT_import_sync_object, GL_IBM_rasterpos_clip,
    GL_IBM_texture_mirrored_repeat, GL_KTX_buffer_region, GL_NV_alpha_test,
    GL_NV_blend_minmax, GL_NV_blend_square, GL_NV_complex_primitives,
    GL_NV_conditional_render, GL_NV_copy_depth_to_color, GL_NV_copy_image,
    GL_NV_depth_buffer_float, GL_NV_depth_clamp, GL_NV_explicit_multisample,
    GL_NV_fbo_color_attachments, GL_NV_fence, GL_NV_float_buffer,
    GL_NV_fog_distance, GL_NV_fragdepth, GL_NV_fragment_program,
    GL_NV_fragment_program_option, GL_NV_fragment_program2,
    GL_NV_framebuffer_multisample_coverage, GL_NV_geometry_shader4,
    GL_NV_gpu_program4, GL_NV_gpu_program4_1, GL_NV_half_float,
    GL_NV_light_max_exponent, GL_NV_multisample_coverage,
    GL_NV_multisample_filter_hint, GL_NV_occlusion_query,
    GL_NV_packed_depth_stencil, GL_NV_parameter_buffer_object,
    GL_NV_parameter_buffer_object2, GL_NV_path_rendering,
    GL_NV_pixel_data_range, GL_NV_point_sprite, GL_NV_primitive_restart,
    GL_NV_register_combiners, GL_NV_register_combiners2,
    GL_NV_shader_buffer_load, GL_NV_texgen_reflection, GL_NV_texture_barrier,
    GL_NV_texture_compression_vtc, GL_NV_texture_env_combine4,
    GL_NV_texture_expand_normal, GL_NV_texture_lod_clamp,
    GL_NV_texture_multisample, GL_NV_texture_rectangle, GL_NV_texture_shader,
    GL_NV_texture_shader2, GL_NV_texture_shader3, GL_NV_transform_feedback,
    GL_NV_transform_feedback2, GL_NV_vdpau_interop, GL_NV_vertex_array_range,
    GL_NV_vertex_array_range2, GL_NV_vertex_buffer_unified_memory,
    GL_NV_vertex_program, GL_NV_vertex_program1_1, GL_NV_vertex_program2,
    GL_NV_vertex_program2_option, GL_NV_vertex_program3,
    GL_NVX_conditional_render, GL_NVX_gpu_memory_info, GL_OES_depth24,
    GL_OES_depth32, GL_OES_depth_texture, GL_OES_element_index_uint,
    GL_OES_fbo_render_mipmap, GL_OES_get_program_binary, GL_OES_mapbuffer,
    GL_OES_packed_depth_stencil, GL_OES_rgb8_rgba8,
    GL_OES_standard_derivatives, GL_OES_texture_3D, GL_OES_texture_float,
    GL_OES_texture_float_linear, GL_OES_texture_half_float,
    GL_OES_texture_half_float_linear, GL_OES_texture_npot,
    GL_OES_vertex_array_object, GL_OES_vertex_half_float,
    GL_SGIS_generate_mipmap, GL_SGIS_texture_lod, GL_SGIX_depth_texture,
    GL_SGIX_shadow, GL_SUN_slice_accum

16 GLX Visuals
    visual  x   bf lv rg d st  colorbuffer  sr ax dp st accumbuffer  ms  cav
  id dep cl sp  sz l  ci b ro  r  g  b  a F gb bf th cl  r  g  b  a ns b eat
----------------------------------------------------------------------------
0x021 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  0 16 16 16 16  0 0 None
0x090 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  0 16 16 16 16  0 0 None
0x091 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  0 16 16 16 16  0 0 None
0x092 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  0 16 16 16 16  0 0 None
0x093 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  0 16 16 16 16  0 0 None
0x094 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  0 16 16 16 16  0 0 None
0x095 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  0 16 16 16 16  0 0 None
0x096 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  0 16 16 16 16  0 0 None
0x097 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  0 16 16 16 16  0 0 None
0x098 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  0 16 16 16 16  0 0 None
0x099 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  0 16 16 16 16  0 0 None
0x09a 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  0 16 16 16 16  0 0 None
0x09b 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  0 16 16 16 16  0 0 None
0x09c 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  0 16 16 16 16  0 0 None
0x09d 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  0 16 16 16 16  0 0 None
0x05f 32 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  0 16 16 16 16  0 0 None

167 GLXFBConfigs:
    visual  x   bf lv rg d st  colorbuffer  sr ax dp st accumbuffer  ms  cav
  id dep cl sp  sz l  ci b ro  r  g  b  a F gb bf th cl  r  g  b  a ns b eat
----------------------------------------------------------------------------
0x075 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  8 16 16 16 16  0 0 None
0x076 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x077 24 tc  0  32  0 r  y .   8  8  8  8 .  .  4 24  8 16 16 16 16  0 0 None
0x078 24 tc  0  32  0 r  y .   8  8  8  8 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x079 24 tc  0  32  0 r  . .   8  8  8  0 .  .  4 24  8 16 16 16 16  0 0 None
0x07a 24 tc  0  32  0 r  . .   8  8  8  0 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x07b 24 tc  0  32  0 r  . .   8  8  8  8 .  .  4 24  8 16 16 16 16  0 0 None
0x07c 24 tc  0  32  0 r  . .   8  8  8  8 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x07d 32 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  0 16 16 16 16  0 0 None
0x07e 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x07f 24 tc  0  32  0 r  y .   8  8  8  8 .  .  4 24  0 16 16 16 16  0 0 None
0x080 24 tc  0  32  0 r  y .   8  8  8  8 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x081 24 tc  0  32  0 r  . .   8  8  8  0 .  .  4 24  0 16 16 16 16  0 0 None
0x082 24 tc  0  32  0 r  . .   8  8  8  0 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x083 24 tc  0  32  0 r  . .   8  8  8  8 .  .  4 24  0 16 16 16 16  0 0 None
0x084 24 tc  0  32  0 r  . .   8  8  8  8 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x085 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4  0  0 16 16 16 16  0 0 None
0x086 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x087 24 tc  0  32  0 r  y .   8  8  8  8 .  .  4  0  0 16 16 16 16  0 0 None
0x088 24 tc  0  32  0 r  y .   8  8  8  8 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x089 24 tc  0  32  0 r  . .   8  8  8  0 .  .  4  0  0 16 16 16 16  0 0 None
0x08a 24 tc  0  32  0 r  . .   8  8  8  0 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x08b 24 tc  0  32  0 r  . .   8  8  8  8 .  .  4  0  0 16 16 16 16  0 0 None
0x08c 24 tc  0  32  0 r  . .   8  8  8  8 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x08d 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  0 16 16 16 16  2 1 Ncon
0x08e 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  0 16 16 16 16  2 1 Ncon
0x08f 24 tc  0  32  0 r  y .   8  8  8  8 .  .  4 24  0 16 16 16 16  2 1 Ncon
0x090 24 tc  0  32  0 r  y .   8  8  8  8 .  .  4 24  0 16 16 16 16  2 1 Ncon
0x091 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  0 16 16 16 16  4 1 Ncon
0x092 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  0 16 16 16 16  4 1 Ncon
0x093 24 tc  0  32  0 r  y .   8  8  8  8 .  .  4 24  0 16 16 16 16  4 1 Ncon
0x094 24 tc  0  32  0 r  y .   8  8  8  8 .  .  4 24  0 16 16 16 16  4 1 Ncon
0x095 24 tc  0  32  0 r  . .   8  8  8  0 .  .  4 24  0 16 16 16 16  2 1 Ncon
0x096 24 tc  0  32  0 r  . .   8  8  8  0 .  .  4 24  0 16 16 16 16  2 1 Ncon
0x097 24 tc  0  32  0 r  . .   8  8  8  8 .  .  4 24  0 16 16 16 16  2 1 Ncon
0x098 24 tc  0  32  0 r  . .   8  8  8  8 .  .  4 24  0 16 16 16 16  2 1 Ncon
0x099 24 tc  0  32  0 r  . .   8  8  8  0 .  .  4 24  0 16 16 16 16  4 1 Ncon
0x09a 24 tc  0  32  0 r  . .   8  8  8  0 .  .  4 24  0 16 16 16 16  4 1 Ncon
0x09b 24 tc  0  32  0 r  . .   8  8  8  8 .  .  4 24  0 16 16 16 16  4 1 Ncon
0x09c 24 tc  0  32  0 r  . .   8  8  8  8 .  .  4 24  0 16 16 16 16  4 1 Ncon
0x09d 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  8 16 16 16 16  2 1 Ncon
0x09e 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  8 16 16 16 16  2 1 Ncon
0x09f 24 tc  0  32  0 r  y .   8  8  8  8 .  .  4 24  8 16 16 16 16  2 1 Ncon
0x0a0 24 tc  0  32  0 r  y .   8  8  8  8 .  .  4 24  8 16 16 16 16  2 1 Ncon
0x0a1 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  8 16 16 16 16  4 1 Ncon
0x0a2 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  8 16 16 16 16  4 1 Ncon
0x0a3 24 tc  0  32  0 r  y .   8  8  8  8 .  .  4 24  8 16 16 16 16  4 1 Ncon
0x0a4 24 tc  0  32  0 r  y .   8  8  8  8 .  .  4 24  8 16 16 16 16  4 1 Ncon
0x0a5 24 tc  0  32  0 r  . .   8  8  8  0 .  .  4 24  8 16 16 16 16  2 1 Ncon
0x0a6 24 tc  0  32  0 r  . .   8  8  8  0 .  .  4 24  8 16 16 16 16  2 1 Ncon
0x0a7 24 tc  0  32  0 r  . .   8  8  8  8 .  .  4 24  8 16 16 16 16  2 1 Ncon
0x0a8 24 tc  0  32  0 r  . .   8  8  8  8 .  .  4 24  8 16 16 16 16  2 1 Ncon
0x0a9 24 tc  0  32  0 r  . .   8  8  8  0 .  .  4 24  8 16 16 16 16  4 1 Ncon
0x0aa 24 tc  0  32  0 r  . .   8  8  8  0 .  .  4 24  8 16 16 16 16  4 1 Ncon
0x0ab 24 tc  0  32  0 r  . .   8  8  8  8 .  .  4 24  8 16 16 16 16  4 1 Ncon
0x0ac 24 tc  0  32  0 r  . .   8  8  8  8 .  .  4 24  8 16 16 16 16  4 1 Ncon
0x0ad 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  8 16 16 16 16  0 0 None
0x0ae 24 tc  0  32  0 r  y .   8  8  8  8 .  .  4 24  8 16 16 16 16  0 0 None
0x0af 24 tc  0  32  0 r  . .   8  8  8  0 .  .  4 24  8 16 16 16 16  0 0 None
0x0b0 24 tc  0  32  0 r  . .   8  8  8  8 .  .  4 24  8 16 16 16 16  0 0 None
0x0b1 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  0 16 16 16 16  0 0 None
0x0b2 24 tc  0  32  0 r  y .   8  8  8  8 .  .  4 24  0 16 16 16 16  0 0 None
0x0b3 24 tc  0  32  0 r  . .   8  8  8  0 .  .  4 24  0 16 16 16 16  0 0 None
0x0b4 24 tc  0  32  0 r  . .   8  8  8  8 .  .  4 24  0 16 16 16 16  0 0 None
0x0b5 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4  0  0 16 16 16 16  0 0 None
0x0b6 24 tc  0  32  0 r  y .   8  8  8  8 .  .  4  0  0 16 16 16 16  0 0 None
0x0b7 24 tc  0  32  0 r  . .   8  8  8  0 .  .  4  0  0 16 16 16 16  0 0 None
0x0b8 24 tc  0  32  0 r  . .   8  8  8  8 .  .  4  0  0 16 16 16 16  0 0 None
0x0b9 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  0 16 16 16 16  2 1 Ncon
0x0ba 24 tc  0  32  0 r  y .   8  8  8  8 .  .  4 24  0 16 16 16 16  2 1 Ncon
0x0bb 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  0 16 16 16 16  4 1 Ncon
0x0bc 24 tc  0  32  0 r  y .   8  8  8  8 .  .  4 24  0 16 16 16 16  4 1 Ncon
0x0bd 24 tc  0  32  0 r  . .   8  8  8  0 .  .  4 24  0 16 16 16 16  2 1 Ncon
0x0be 24 tc  0  32  0 r  . .   8  8  8  8 .  .  4 24  0 16 16 16 16  2 1 Ncon
0x0bf 24 tc  0  32  0 r  . .   8  8  8  0 .  .  4 24  0 16 16 16 16  4 1 Ncon
0x0c0 24 tc  0  32  0 r  . .   8  8  8  8 .  .  4 24  0 16 16 16 16  4 1 Ncon
0x0c1 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  8 16 16 16 16  2 1 Ncon
0x0c2 24 tc  0  32  0 r  y .   8  8  8  8 .  .  4 24  8 16 16 16 16  2 1 Ncon
0x0c3 24 tc  0  32  0 r  y .   8  8  8  0 .  .  4 24  8 16 16 16 16  4 1 Ncon
0x0c4 24 tc  0  32  0 r  y .   8  8  8  8 .  .  4 24  8 16 16 16 16  4 1 Ncon
0x0c5 24 tc  0  32  0 r  . .   8  8  8  0 .  .  4 24  8 16 16 16 16  2 1 Ncon
0x0c6 24 tc  0  32  0 r  . .   8  8  8  8 .  .  4 24  8 16 16 16 16  2 1 Ncon
0x0c7 24 tc  0  32  0 r  . .   8  8  8  0 .  .  4 24  8 16 16 16 16  4 1 Ncon
0x0c8 24 tc  0  32  0 r  . .   8  8  8  8 .  .  4 24  8 16 16 16 16  4 1 Ncon
0x0c9 24 tc  0  16  0 r  y .   5  6  5  0 .  .  4 16  0 16 16 16 16  0 0 Ncon
0x0ca 24 tc  0  16  0 r  . .   5  6  5  0 .  .  4 16  0 16 16 16 16  0 0 Ncon
0x0cb 24 tc  0  16  0 r  y .   5  6  5  0 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x0cc 24 tc  0  16  0 r  . .   5  6  5  0 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x0cd 24 tc  0  16  0 r  y .   5  6  5  0 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x0ce 24 tc  0  16  0 r  . .   5  6  5  0 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x0cf 24 tc  0  16  0 r  y .   5  6  5  0 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x0d0 24 tc  0  16  0 r  . .   5  6  5  0 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x0d1 24 tc  0   0  0 r  . .   0  0  0  0 .  .  4 16  0 16 16 16 16  0 0 Ncon
0x0d2 24 tc  0   0  0 r  . .   0  0  0  0 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x0d3 24 tc  0   0  0 r  . .   0  0  0  0 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x0d4 32 tc  0  32  0 r  . .  16 16  0  0 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x0d5 24 tc  0  32  0 r  . .  16 16  0  0 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x0d6 32 tc  0  32  0 r  y .  16 16  0  0 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x0d7 24 tc  0  32  0 r  y .  16 16  0  0 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x0d8 32 tc  0  32  0 r  . .  32  0  0  0 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x0d9 24 tc  0  32  0 r  . .  32  0  0  0 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x0da 32 tc  0  32  0 r  y .  32  0  0  0 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x0db 24 tc  0  32  0 r  y .  32  0  0  0 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x0dc 24 tc  0  64  0 r  . .  16 16 16 16 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x0dd 24 tc  0  64  0 r  . .  16 16 16 16 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x0de 24 tc  0  64  0 r  y .  16 16 16 16 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x0df 24 tc  0  64  0 r  y .  16 16 16 16 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x0e0 24 tc  0 128  0 r  . .  32 32 32 32 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x0e1 24 tc  0 128  0 r  . .  32 32 32 32 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x0e2 24 tc  0 128  0 r  y .  32 32 32 32 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x0e3 24 tc  0 128  0 r  y .  32 32 32 32 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x0e4 32 tc  0  32  0 r  . .  16 16  0  0 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x0e5 24 tc  0  32  0 r  . .  16 16  0  0 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x0e6 32 tc  0  32  0 r  y .  16 16  0  0 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x0e7 24 tc  0  32  0 r  y .  16 16  0  0 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x0e8 32 tc  0  32  0 r  . .  16 16  0  0 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x0e9 24 tc  0  32  0 r  . .  16 16  0  0 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x0ea 32 tc  0  32  0 r  y .  16 16  0  0 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x0eb 24 tc  0  32  0 r  y .  16 16  0  0 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x0ec 32 tc  0  32  0 r  . .  32  0  0  0 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x0ed 24 tc  0  32  0 r  . .  32  0  0  0 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x0ee 32 tc  0  32  0 r  y .  32  0  0  0 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x0ef 24 tc  0  32  0 r  y .  32  0  0  0 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x0f0 32 tc  0  32  0 r  . .  32  0  0  0 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x0f1 24 tc  0  32  0 r  . .  32  0  0  0 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x0f2 32 tc  0  32  0 r  y .  32  0  0  0 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x0f3 24 tc  0  32  0 r  y .  32  0  0  0 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x0f4 24 tc  0  64  0 r  . .  16 16 16 16 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x0f5 24 tc  0  64  0 r  . .  16 16 16 16 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x0f6 24 tc  0  64  0 r  y .  16 16 16 16 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x0f7 24 tc  0  64  0 r  y .  16 16 16 16 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x0f8 24 tc  0  64  0 r  . .  16 16 16 16 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x0f9 24 tc  0  64  0 r  . .  16 16 16 16 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x0fa 24 tc  0  64  0 r  y .  16 16 16 16 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x0fb 24 tc  0  64  0 r  y .  16 16 16 16 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x0fc 24 tc  0 128  0 r  . .  32 32 32 32 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x0fd 24 tc  0 128  0 r  . .  32 32 32 32 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x0fe 24 tc  0 128  0 r  y .  32 32 32 32 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x0ff 24 tc  0 128  0 r  y .  32 32 32 32 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x100 24 tc  0 128  0 r  . .  32 32 32 32 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x101 24 tc  0 128  0 r  . .  32 32 32 32 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x102 24 tc  0 128  0 r  y .  32 32 32 32 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x103 24 tc  0 128  0 r  y .  32 32 32 32 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x104 24 tc  0  16  0 r  . .  16  0  0  0 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x105 24 tc  0  16  0 r  . .  16  0  0  0 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x106 24 tc  0  16  0 r  y .  16  0  0  0 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x107 24 tc  0  16  0 r  y .  16  0  0  0 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x108 24 tc  0  64  0 r  . .  32 32  0  0 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x109 24 tc  0  64  0 r  . .  32 32  0  0 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x10a 24 tc  0  64  0 r  y .  32 32  0  0 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x10b 24 tc  0  64  0 r  y .  32 32  0  0 .  .  4  0  0 16 16 16 16  0 0 Ncon
0x10c 24 tc  0  16  0 r  . .  16  0  0  0 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x10d 24 tc  0  16  0 r  . .  16  0  0  0 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x10e 24 tc  0  16  0 r  y .  16  0  0  0 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x10f 24 tc  0  16  0 r  y .  16  0  0  0 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x110 24 tc  0  16  0 r  . .  16  0  0  0 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x111 24 tc  0  16  0 r  . .  16  0  0  0 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x112 24 tc  0  16  0 r  y .  16  0  0  0 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x113 24 tc  0  16  0 r  y .  16  0  0  0 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x114 24 tc  0  64  0 r  . .  32 32  0  0 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x115 24 tc  0  64  0 r  . .  32 32  0  0 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x116 24 tc  0  64  0 r  y .  32 32  0  0 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x117 24 tc  0  64  0 r  y .  32 32  0  0 .  .  4 24  0 16 16 16 16  0 0 Ncon
0x118 24 tc  0  64  0 r  . .  32 32  0  0 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x119 24 tc  0  64  0 r  . .  32 32  0  0 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x11a 24 tc  0  64  0 r  y .  32 32  0  0 .  .  4 24  8 16 16 16 16  0 0 Ncon
0x11b 24 tc  0  64  0 r  y .  32 32  0  0 .  .  4 24  8 16 16 16 16  0 0 Ncon

avilella@magneto:~/hybrid_graphics/hybrid-windump$ DISPLAY=:8 metacity --replace &
[1] 3775
avilella@magneto:~/hybrid_graphics/hybrid-windump$ Window manager error: Unable to open X display :8

[1]+  Exit 1                  DISPLAY=:8 metacity --replace

A: According to the information posted on your question you have a hybrid GPU solution that uses Intel + Nvidia at the same time.
To enable your Nvidia card you need to install Bumblebee or disable the Intel card in your BIOS (if possible).
If disabling your Intel card in your computer's BIOS is not an option you have no choice other than use Bumblebee.
If you need information about Bumblebee please have a look at this post, it explains in detail how to enable support to run Ubuntu with both the Intel and the Nvidia card activated

*

*Is a NVIDIA GeForce with Optimus Technology supported by Ubuntu?
If you are using Bumblebee already that does not mean that vdpau support is installed, you need to install vdpau support for your card as described here

*

*How to enable VDPAU on GStreamer?
After you have successfully managed run run bumblebee vainfo will still fail because the Intel card will still be the default card.
I have found a script that will switch the card from the Intel to the Nvidia and try to open the media player. The basic instructions to use this are described here, remember this is a script from outside sources, no warranties that this will work are given, you can test it yourself.
Here are the instructions taken from the bug report:

*

*Build hybrid-windump but don't use the included xorg.conf!
  https://github.com/harp1n/hybrid-windump (includes borders for entire dumped window)
  https://github.com/gebart/hybrid-windump (included better cursor support, but dumped window will cover portion of Intel desktop and can't be moved)

*Start the Bumblebee X server
  optirun glxinfo

*Run Compiz (or Metacity) on Nvidia display so the dumped window can be moved around. If you skip this, VDPAU playback will be green.
  DISPLAY=:8 compiz --replace &

*Run mplayer2
  DISPLAY=:8 mplayer -vo vdpau videofilename &

*Dump window
  ./windump :8 :0.0 &

*You now have VDPAU output!
NB: This also works with Ironhide.


text:
Q: NestJS Entity class - 'methodname' is not a function I'm tackling a NestJS course and it's just a bit outdated and at the moment the requirement is to have a "Create" method on the entity class, I can see that the instructor is able to have it functioning but I keep getting an error.
@Entity()
@Unique('task_index_uq', ['title'])
export class Task extends Repository<Task> {
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column()
  title: string;

  @Column()
  description: string;

  @Column()
  status: TaskStatus;

  async createTask(createTaskDto: CreateTaskDto): Promise<Task> {
    const { title, description } = createTaskDto;

    const task = this.create({
      title,
      description,
      status: TaskStatus.OPEN,
    });

    await this.save(task);
    return task;
  }
}

What could be the problem?

redpajama_set_name: RedPajamaStackExchange


text:
Q: c++ conversion operators no candidate is better     #include <iostream>
#include <string>

using namespace std;

class test {
    private:
        std::string strValue;
        int value;

    public:
        test():value(0) { };
        test(int a):value(a) { };
        test(std::string a):strValue(a) { };
        ~test(){};

        operator int () { return value; }
        operator const char* () { return strValue.c_str(); }
};

int main() {
    test v1(100);
    cout << v1  << endl;
    return 0;
}

When I run the above, with gcc I get an error saying no candidate is better for conversion.. Aren't they exclusive types?

A: std::ostream has numerous operator<< overloads, including both of the following:
std::ostream& operator<<(std::ostream&, const char*);
std::ostream& operator<<(std::ostream&, int);

Your test class is convertible to both const char* and to int.  The compiler can't select which conversion to use because both conversions would work equally well.  Thus, the conversion is ambiguous.

A: test v1(100);
cout << v1  << endl;
Since cout doesn't have operator << (ostream&, test) it tries conversions. You provided two, both types are defined with ostream, so you got ambiguity.


text: Q: Download files with custom filenames in Chrome I put download.default_directory property to prefs variable with path to directory where files should be saved after downloading. download.prompt_for_download is set to true in prefs, but dialog doesn't appear. I don't know, how to set custom filenames, because downloads are started automatically.


text:
Q: Do we still need to worry about long fat pipes? I am trying to settle a controversy we have at work.
A decade ago TCP used to have really bad performance over long fat pipes, i.e., network paths that feature high bandwidth-delay product. Sysadmins used to tune the TCP stack with some "golden" sysctl values that would magically increase iperf transfer rates to Gbps.
In the meantime, many things have happened. Looking at Linux, it added support for TCP timestamps, buffer auto-tuning, RTT measurement, CUBIC congestion control, SACK, to name a few that I am aware of.
Do we still need to tune the TCP stack for long fat pipes or do today's users get Gbps transfer rates out-of-the-box?

A: No need anymore, unless it's REALLY long (like satellite endpoints). This is all handled dynamically and effectively. In most cases all you might need is to use a large MTU for storage networks, etc.


text:
Q: Django WebTest - "Click" the first of two identical links I'm using Django-WebTest to test a page which contains two links, both with the same class and href, and no id. I'm reading through the WebTest docs and can't seem to find a nice way to click the first matching element.
I'd really like to avoid hackish things like checking an element's DOM parents or siblings because it will cause tests to break if the designers change the page layout.
This seems like it's a problem that should have a simple solution, especially with a well developed framework like WebTest. Am I just overlooking something obvious?
I can add an ID to one of the elements, but it would seem like a hack since it would be changing the code just to make a test work.

A: Really simple:
resp.click('link', index=0)


text:
Q: How to use params pass through template in Dustjs/Krakenjs I'm still new in Kraken.js and Dust, so need some help in this.
For example, I'm including a partial template like below:
{> "modal/modalDialog" type="assign" /}

Then I have that template looks like below, which placed in some other folder, and I want to do conditional checking, if the type is "assign", I want to show some text, else, do something else. I tried using {@eq} like below, but its not working.
<div id="{type}" class="modal">
  {@eq key=type value="assign"}Assign this{/eq}
  {@eq key=type value="user"}Introduce us{/eq}
</div>

I know I can define the value in the JS model etc, but thinking there must be a way to do without the need to define in controller. Or

A: Offhand that looks correct. My guess is that you have managed to get two versions of dust loaded and the helpers have registered with one and you are using the other one. That would mean the eq helper is not being found and silently failing. You can confirm this by setting dust.debugLevel='WARN'.
If that is the problem, try explicitly using the 1.1.1 version of dustjs-helpers in your package.json. This all ought to be ironed out once a recent change to dustjs-helpers to make dust a peer dependency gets published.


text:
Q: is my schematic correct? (Optocoupler with triac) I designed a pcb that contains an optocoupler and a triac to work as a dimmer for AC
But when I give a high value to the GPIO corresponding the triac doesnt fire
So I am looking for the mistake I did ...
Is my schematic wrong ??

if its correct , what could be the problem on the pcb leading to this problem ??
How can I check it ??
I want to search for the problem but I dont know where to look

A: It appears that you do not have sufficient current through the opto LED. 15 to 50 mA is recommended to meet the transfer function.
First check that your uP can drive at least 15 mA from its output. If so, then a series resistor of ~ 220 ohms should be used. If the output cannot drive that much current, add a simple NPN or FET driver to control the higher drive current.

A: About the schematic, at the first look, you should (at least) add a snubber circuit in parallel to the TRIAC, to prevent a quickly slew-rate to turn it on (turn the TRIAC or the MOC!). You can find more info in this application note from Fairchild Semiconductors about the MOC30XX family that I share with you: https://www.dropbox.com/s/hwek0h4thuyi5go/MOC30XX_AN-3003.pdf?dl=0
About the firing problem I think Glenn has answered it in part. Can you supply the minimum current needed? I would activate the moc with a signal in low connected to the pin number 2, so you can connect the pin 1 to Vcc (5V) through a pull-up resistor of 220 ohms.

A: Yes, the optocoupler resistor should drop to approx 220 ohms, since it needs to turn on harder than what the 470 ohm resistor will do. Also, you should have a snubber circuit on the Triac for any inductive load, such as a motor. or compressor. You might not need it with a resistive load, like a heating coil, but It can't hurt.


text:
Q: Lightbox gallery getting concatenated I have 3 divs implemented as lightbox gallery (3 separate galleries), which are being triggered by clicking on a button. The div is thus set to display:none initially.
I've tried to trigger the div via button click by the below method, which is just working correctly. But, all the 3 galleries are getting concatenated i.e in the modal that opens, its showing images of other divs. What could possibly be wrong?
Script
    $('#button1').on('click', function() {
         $('#div1').show();
    });
    $('#button2').on('click', function() {
         $('#div2').show();
    });
    $('#button3').on('click', function() {
         $('#div3').show();
    });

A: Used data-gallery="example-gallery" for every box.
like div1 boxes images should have  data-gallery="example-gallery1" attribute.
div2 boxes images should have data-gallery="example-gallery2" attribute.
div3 boxes images should have data-gallery="example-gallery3" attribute.

Like:
data-gallery="example-gallery1"
data-gallery="example-gallery2"
data-gallery="example-gallery3"


text:
Q: Parameter value [6] did not match expected type [java.lang.Long (n/a)] in Spring Boot I am a beginner in Spring Boot and I have two table which having One to One relationship. The problem is when I am trying to get user record by its user-id I am getting an exception like below.
I pasted all my code. What is the mistake in my code?
Users
@Entity
@Table(name = "users")
public class User implements Serializable {
    @Id
    //@GeneratedValue(strategy = GenerationType.IDENTITY)
    @GeneratedValue(strategy= GenerationType.AUTO)
    private Long id;

    @NotNull
    @Size(max = 65)
    @Column(name = "first_name")
    private String firstName;

    @Size(max = 65)
    @Column(name = "last_name")
    private String lastName;

    @NotNull
    @Email
    @Size(max = 100)
    @Column(unique = true)
    private String email;

    @NotNull
    @Size(max = 128)
    private String password;

    @OneToOne(fetch = FetchType.LAZY,
            cascade =  CascadeType.ALL,
            mappedBy = "user")
    private UserProfile userProfile;

    // Hibernate requires a no-arg constructor
    public User() {

    }

    public User(String firstName, String lastName, String email, String password) {
        this.firstName = firstName;
        this.lastName = lastName;
        this.email = email;
        this.password = password;
    }

    // Getters and Setters (Omitted for brevity)

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public UserProfile getUserProfile() {
        return userProfile;
    }

    public void setUserProfile(UserProfile userProfile) {
        this.userProfile = userProfile;
    }
}

UsersProfile
@Entity
@Table(name = "user_profiles")
public class UserProfile implements Serializable{

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name = "phone_number")
    @Size(max = 15)
    private String phoneNumber;

    @Enumerated(EnumType.STRING)
    @Column(length = 10)
    private Gender gender;

    @Temporal(TemporalType.DATE)
    @Column(name = "dob")
    private Date dateOfBirth;

    @Size(max = 100)
    private String address1;

    @Size(max = 100)
    private String address2;

    @Size(max = 100)
    private String street;

    @Size(max = 100)
    private String city;

    @Size(max = 100)
    private String state;

    @Size(max = 100)
    private String country;

    @Column(name = "zip_code")
    @Size(max = 32)
    private String zipCode;

    @OneToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "user_id", nullable = false)
    private User user;

    public UserProfile() {

    }

    public UserProfile(String phoneNumber, Gender gender, Date dateOfBirth,
                       String address1, String address2, String street, String city,
                       String state, String country, String zipCode) {
        this.phoneNumber = phoneNumber;
        this.gender = gender;
        this.dateOfBirth = dateOfBirth;
        this.address1 = address1;
        this.address2 = address2;
        this.street = street;
        this.city = city;
        this.state = state;
        this.country = country;
        this.zipCode = zipCode;
    }
    // Getters and Setters (Omitted for brevity)

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public Gender getGender() {
        return gender;
    }

    public void setGender(Gender gender) {
        this.gender = gender;
    }

    public Date getDateOfBirth() {
        return dateOfBirth;
    }

    public void setDateOfBirth(Date dateOfBirth) {
        this.dateOfBirth = dateOfBirth;
    }

    public String getAddress1() {
        return address1;
    }

    public void setAddress1(String address1) {
        this.address1 = address1;
    }

    public String getAddress2() {
        return address2;
    }

    public void setAddress2(String address2) {
        this.address2 = address2;
    }

    public String getStreet() {
        return street;
    }

    public void setStreet(String street) {
        this.street = street;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public String getZipCode() {
        return zipCode;
    }

    public void setZipCode(String zipCode) {
        this.zipCode = zipCode;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

}

UserRepository
public interface UserRepository extends JpaRepository<User, Long> {
   User findById(int id);
}

Controller
@PostMapping(value = "/getUser")
@ResponseBody
public User getUSer(@RequestParam int userID) {
     User user = userRepository.findById(userID);
     return user;
}

Error
java.lang.IllegalArgumentException: Parameter value [6] did not match expected type [java.lang.Long (n/a)]
    at org.hibernate.query.spi.QueryParameterBindingValidator.validate(QueryParameterBindingValidator.java:54) ~[hibernate-core-5.3.9.Final.jar:5.3.9.Final]
    at org.hibernate.query.spi.QueryParameterBindingValidator.validate(QueryParameterBindingValidator.java:27) ~[hibernate-core-5.3.9.Final.jar:5.3.9.Final]
    at org.hibernate.query.internal.QueryParameterBindingImpl.validate(QueryParameterBindingImpl.java:90) ~[hibernate-core-5.3.9.Final.jar:5.3.9.Final]
    at org.hibernate.query.internal.QueryParameterBindingImpl.setBindValue(QueryParameterBindingImpl.java:55) ~[hibernate-core-5.3.9.Final.jar:5.3.9.Final]
    at org.hibernate.query.internal.AbstractProducedQuery.setParameter(AbstractProducedQuery.java:493) ~[hibernate-core-5.3.9.Final.jar:5.3.9.Final]
    at org.hibernate.query.internal.AbstractProducedQuery.setParameter(AbstractProducedQuery.java:106) ~[hibernate-core-5.3.9.Final.jar:5.3.9.Final]
    at org.hibernate.query.criteria.internal.compile.CriteriaQueryTypeQueryAdapter.setParameter(CriteriaQueryTypeQueryAdapter.java:385) ~[hibernate-core-5.3.9.Final.jar:5.3.9.Final]
    at org.hibernate.query.criteria.internal.compile.CriteriaQueryTypeQueryAdapter.setParameter(CriteriaQueryTypeQueryAdapter.java:59) ~[hibernate-core-5.3.9.Final.jar:5.3.9.Final]
    at org.springframework.data.jpa.repository.query.QueryParameterSetter$NamedOrIndexedQueryParameterSetter.lambda$setParameter$3(QueryParameterSetter.java:111) ~[spring-data-jpa-2.1.6.RELEASE.jar:2.1.6.RELEASE]
    at org.springframework.data.jpa.repository.query.QueryParameterSetter$ErrorHandling$1.execute(QueryParameterSetter.java:175) ~[spring-data-jpa-2.1.6.RELEASE.jar:2.1.6.RELEASE]
    at org.springframework.data.jpa.repository.query.QueryParameterSetter$NamedOrIndexedQueryParameterSetter.setParameter(QueryParameterSetter.java:111) ~[spring-data-jpa-2.1.6.RELEASE.jar:2.1.6.RELEASE]
    at org.springframework.data.jpa.repository.query.ParameterBinder.lambda$bind$0(ParameterBinder.java:79) ~[spring-data-jpa-2.1.6.RELEASE.jar:2.1.6.RELEASE]
    at java.util.ArrayList.forEach(Unknown Source) ~[na:1.8.0_191]

A: Check your Database and Check the datatype of the Id if it's int you can't send long


text:
Q: Virtual inheritance and move constructors I'm observing strange behaviour with clang++ (3.5-1ubuntu1).
If virtual inheritance is used, the copy constructor of
the 'Base' class appears to be skipped.  Please see the sample
and results below.
The complicated inheritance hierarchy is needed,
it comes from an application using std streams and streambufs.
Questions:

*

*What should the value of foo.x be after foo's initialisation?

*Why does the result change when normal instead of virtual inheritance
is used?  Notice that there's no multiple inheritance involved, so I'd
expect no difference.

*Am I invoking undefined behavior?  If yes, where?  If yes, could the
compiler warn about it?

#include <iostream>

struct Base {
  int x;
  Base() : x(0) {}

  Base(Base const& other) : x(other.x) {
    std::cout << "Base::Base(Base const&)" << std::endl;
  }
};

// If virtual is removed, it works.
   struct Derived1 : virtual Base {
// struct Derived1 :         Base {
  Derived1(Derived1&& other) : Base(static_cast<const Base&>(other)) {
    std::cout << "MOVE constructor: other.x = " << other.x
              << ", this->x = " << x << std::endl;
  }

  Derived1() {
    x = 4711;
    std::cout << "DEFAULT constructor: x = " << x << std::endl;
  }
} ;

template< typename B >
struct Derived2 : B {
  // Deliberately invoke move constructor
  Derived2() : B( B() ) { }
} ;

int main() {
  Derived2<Derived1> foo ;

  // Expected: 4711, actual: 0
  std::cout << "foo.x = " << foo.x << std::endl;

  std::cout << "sizeof(Base) = " << sizeof(Base) << std::endl;
  std::cout << "sizeof(Derived1) = " << sizeof(Derived1) << std::endl;
  std::cout << "sizeof(foo) = " << sizeof(foo) << std::endl;

  // As expected, all addresses are equal, regardless whether virtual
  // inheritance is used or not.
  std::cout << "&Derived2::x = " << &foo.x << std::endl;
  std::cout << "&Derived1::x = " << &static_cast<Derived1 const&>(foo).x << std::endl;
  std::cout << "&Base::x = " << &static_cast<Base const&>(foo).x << std::endl;
}

The result I'm getting:
DEFAULT constructor: x = 4711
MOVE constructor: other.x = 4711, this->x = 0
foo.x = 0
sizeof(Base) = 4
sizeof(Derived1) = 16
sizeof(foo) = 16
&Derived2::x = 0x7fff7a445338
&Derived1::x = 0x7fff7a445338
&Base::x = 0x7fff7a445338


text: Q: Flutter get device uptime I'm building a flutter application, which needs some sort of session expiry system which will log out the user from the account. Problem is, I need it to be offline compatible. One of the solutions I've found is using device's uptime, basically I want to store when was the last time user connected to the internet, save the timestamp. And when the user opens the app while offline, calculate the difference between current timestamp, and the stored timestamp. If it has exceeded the given limit, the user will be logged out. I tried using DateTime.now() for this, however, it seems like DateTime.now() is affected by the user's device time, meaning that the user can possibly exploit the system by changing his device's date and time. Which is why I came to device's uptime, however I haven't found any methods/ways/packages to get the device's uptime (which won't be affected by changes in device's date and time). Are there any ways I could do this? Any help would be greatly appreciated!


text:
Q: Error: Java GSS-API with SPNEGO: Server not found in Kerberos database (7) I'm trying to get this tutorial to work: https://docs.oracle.com/javase/8/docs/technotes/guides/security/jgss/lab/part5.html
I'm running a Kerberos KDC on a VM and used this guide for setting it up: http://techpubs.spinlocksolutions.com/dklar/kerberos.html
I have set up two princripals: jessica@REALM.COM and host/jessica-ThinkPad-X220@REALM.COM and the key for the 2nd one is saved in a keytab which I copied from the VM to my test machine.
I can ping the KDC and get tickets with kinit.
I compiled all code examples (Jaas.java GssSpNegoServer.java and GssSpNegoClient.java) without changes from the tutorial.
This is my jaas-krb5.conf:
client {
com.sun.security.auth.module.Krb5LoginModule required
principal="jessica";
};

server {
com.sun.security.auth.module.Krb5LoginModule required
useKeyTab=true
storeKey=true
keyTab=krb5.keytab
principal="host/jessica-ThinkPad-X220";
};

I am starting the server with java -Djava.security.auth.login.config=jaas-krb5.conf GssSpNegoServer
Then, in another window, I am starting the client with
java -Djava.security.auth.login.config=jaas-krb5.conf GssSpNegoClient host hostname which gives me the following error:
$ java -Djava.security.auth.login.config=jaas-krb5.conf GssSpNegoClient host jessica-ThinkPad-X220
Kerberos-Password for jessica:
Authenticated principal: [jessica@REALM.COM]
Connected to address jessica-ThinkPad-X220/192.168.178.78
Exception in thread "main" java.security.PrivilegedActionException: GSSException: No valid credentials provided (Mechanism level: No valid  credentials provided (Mechanism level: Server not found in Kerberos database (7) - LOOKING_UP_SERVER))
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at Jaas.loginAndAction(Jaas.java:53)
at GssSpNegoClient.main(GssSpNegoClient.java:56)
Caused by: GSSException: No valid credentials provided (Mechanism level: No valid credentials provided (Mechanism level: Server not found in Kerberos database (7) - LOOKING_UP_SERVER))
at sun.security.jgss.spnego.SpNegoContext.initSecContext(SpNegoContext.java:454)
at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:248)
at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:179)
at GssSpNegoClient$GssClientAction.run(GssSpNegoClient.java:129)
... 4 more
Caused by: GSSException: No valid credentials provided (Mechanism level: Server not found in Kerberos database (7) - LOOKING_UP_SERVER)
at sun.security.jgss.krb5.Krb5Context.initSecContext(Krb5Context.java:770)
at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:248)
at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:179)
at sun.security.jgss.spnego.SpNegoContext.GSS_initSecContext(SpNegoContext.java:882)
at sun.security.jgss.spnego.SpNegoContext.initSecContext(SpNegoContext.java:317)
... 7 more
Caused by: KrbException: Server not found in Kerberos database (7) - LOOKING_UP_SERVER
at sun.security.krb5.KrbTgsRep.<init>(KrbTgsRep.java:73)
at sun.security.krb5.KrbTgsReq.getReply(KrbTgsReq.java:259)
at sun.security.krb5.KrbTgsReq.sendAndGetCreds(KrbTgsReq.java:270)
at sun.security.krb5.internal.CredentialsUtil.serviceCreds(CredentialsUtil.java:302)
at sun.security.krb5.internal.CredentialsUtil.acquireServiceCreds(CredentialsUtil.java:120)
at sun.security.krb5.Credentials.acquireServiceCreds(Credentials.java:458)
at sun.security.jgss.krb5.Krb5Context.initSecContext(Krb5Context.java:693)
... 11 more
Caused by: KrbException: Identifier doesn't match expected value (906)
at sun.security.krb5.internal.KDCRep.init(KDCRep.java:140)
at sun.security.krb5.internal.TGSRep.init(TGSRep.java:65)
at sun.security.krb5.internal.TGSRep.<init>(TGSRep.java:60)
at sun.security.krb5.KrbTgsRep.<init>(KrbTgsRep.java:55)
... 17 more

I don't know what I am doing wrong, can anybody help?

A: First check what server it is looking for in Kerberos logs (for me located in /var/log/auth.log). You'll see corresponding log in there:
krb5kdc[5157]: TGS_REQ (3 etypes {18 17 16}) x.x.x.x: LOOKING_UP_SERVER: authtime 0,  ex/admin@EXAMPLE for ex2/y.y.y.y@EXAMPLE, Server not found in Kerberos database

Make sure to change y.y.y.y to the hostname of corresponding system and also add the hostname into the hosts (i.e. /etc/hosts)


text:
Q: Selenium Python refreshing a page with proxies until is fully loaded I want to monitor a page to get changes.
So I use proxies. Not all this proxies work (some maybe are banned some are to slow etc.) so I want to refresh page, and I want to change the proxy every refresh and if the page do not load until 2 seconds make a refresh.
options = webdriver.ChromeOptions()
options.add_argument('--proxy-server=http://%s' % PROXY['http'])

        while True:
                try:
                    browser = webdriver.Chrome(executable_path=path, options=options)
                    browser.implicitly_wait(1)
                    browser.get(links)
                    break
                except:
                    browser.close()
                    PROXY = proxy_reader.proxies_call(3)  #this function return a new proxy each time

    source = browser.page_source

I don't know how to make every session during 2 seconds...
I hope someone can help me.

A: If you want to create sessions with new Proxy each time until page loaded within 2 seconds, try below solution
from selenium.common.exceptions import TimeoutException

while True:
    PROXY = proxy_reader.proxies_call(3)
    options = webdriver.ChromeOptions()
    options.add_argument('--proxy-server=http://%s' % PROXY['http'])
    browser = webdriver.Chrome(executable_path=path, options=options)
    # Set page load timeout: if page not loaded within 2 seconds - raise TimeoutException
    browser.set_page_load_timeout(2)
    try:
        browser.get(links)
        break
    except TimeoutException:
        browser.quit()


text:
Q: Keycloak reauthenticate an Authenticated user with a different client If I have a user that has authenticated with keycloak with public client C1 under realm R is there an endpoint I can hit in keycloak that will generate a new access token for a different public client C2 under the same realm R?
[Update #1]
I tried using the refresh token to obtain a new access token for C2 client but I get the following error:
Invalid refresh token. Token client and authorized client don't match
[Update #2]
So, the above gave me the idea of trying to use the exchange token grant type and I have it working now.
curl --request POST \
  'https://myhost.com.au/auth/realms/<my realm>/protocol/openid-connect/token' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'grant_type=urn:ietf:params:oauth:grant-type:token-exchange' \
  --data-urlencode 'subject_token=<c1 access token>' \
  --data-urlencode 'subject_token_type=urn:ietf:params:oauth:token-type:access_token' \
  --data-urlencode 'requested_token_type=urn:ietf:params:oauth:token-type:refresh_token' \
  --data-urlencode 'client_id=<c2 client id>'

A: Your question makes sense. Unfortunately the role scope mapping documentation is elusive about how to generate a new access token when switching to a different client.
There is an Oauth2 RFC about token exchange. As of Keycloak 11.0.2 token exchange is documented as a technology preview and has to be enabled with -Dkeycloak.profile.feature.token_exchange=enabled
You can exchange tokens this way (actually taken from the question):
Method: POST
URL: https://<keycloak.host>/auth/realms/myrealm/protocol/openid-connect/token
Body type: x-www-form-urlencoded
Form fields:
. grant_type: urn:ietf:params:oauth:grant-type:token-exchange
. subject_token: <C1-access-token>
. subject_token_type: urn:ietf:params:oauth:token-type:access_token
. requested_token_type=urn:ietf:params:oauth:token-type:refresh_token
. client_id: <C2-client-id>

Here is some context from the "role scope mapping" documentation intended for other readers.

When an OIDC access token or SAML assertion is created, all the user
role mappings of the user are, by default, added as claims within the
token or assertion. [...] access tokens are digitally signed and can
actually be re-used by the application to invoke on other remotely
secured REST services. This means that if an application gets
compromised or there is a rogue client registered with the realm,
attackers can get access tokens that have a broad range of permissions
and your whole network is compromised. This is where role scope
mappings becomes important.
Role Scope Mappings is a way to limit the roles that get declared
inside an access token. When a client requests that a user be
authenticated, the access token they receive back will only contain
the role mappings you've explicitly specified for the client's scope.
[...] To change this default behavior, you must explicitly turn off
the Full Scope Allowed switch and declare the specific roles you want
in each individual client. Alternatively, you can also use client
scopes to define the same role scope mappings for a whole set of
clients.


text:
Q: If a PCB is inspected to an IPC-A-600 class higher than specified what are the negative impacts? I have received several parts from a PCB manufacturer which should have been inspected to IPC-A-600 Class 2 but were instead inspected to IPC-A-600 Class 3.
I believe I have received PCBs inspected to a higher degree of accuracy, meaning potentially less defects. But I'd like to know the potential negative impacts of excessive inspection.
I think I have identified a few below:

*

*Increased cost due to higher accuracy inspection techniques (it may be the techniques used are identical but with more stringent inspection criteria applied to Class 3 than 1 and 2)

*Increased costs due to greater amount of scrappage.

*Increased costs due to larger quantities of solder used.

Are the above reasonable? Are there any others?
FYI, I was only charged for Class 2. So Happy Days…I think?

A: It could be that your contractor's production line is tuned for construction and testing to Class 3, and for some reason it's less trouble and/or less expensive for them to simply bill you for Class 2 and build and test to a higher spec than to build and test to Class 2.

A: I very much doubt there's a significant downside to class 3 inspection when you specified class 2.  After all, class 3 is for critical equipment so your boards were inspected to tighter tolerances, etc.  I obviously was not a party to your conversation with the manufacturer but I think that what you are interpreting as "caginess" is really just them not seeing it as a problem that requires much extra thought or explanation.
As for your points: a lot of the class 2 vs class 3 differences are pretty straightforward "50% overhang vs 25% overhang" type tolerances and it's entirely possible that they inspect to class 3 automatically since that also satisfies class 2 criteria without having to worry about mixing up two sets of criteria.  Also some of the class 2 criteria - while more permissive - are trickier to inspect.  As a (made up) example: class 3 might specify 100% solder coverage on a terminal but class 2 might allow 75% coverage on a vertical portion if the terminal height is 1mm or less and 50% coverage if the terminal height is more than 1mm but then also requires horizontal coverage of more than 75%, etc.
Increased costs due to scrapping defective boards could be there, but they didn't get passed along to you and I think you'd be as likely to see rework costs.  And unless you're going by some really fly-by-night place I doubt they're scrapping a bunch.
Increased solder cost: unlikely, unless you've specified some exotic solder.  The standard itself doesn't really translate into class 3 = more solder.  In fact, excessive solder that obscures inspection of a joint could be a failure condition.


text:
Q: Undo or override Apache "Require" directives Suppose in our core Apache 2.4 config, we have
<Directory "/">
    AuthType foo
    Require bar
    AllowOverride AuthConfig Limit
</Directory>

But... Require foo is actually too permissive for one particular directory.
We can add a .htaccess file to a subdirectory, but we cannot be more restrictive than Require foo because that's already been applied.
Is there a way to un-apply it? For the .htaccess file to say "please disregard Require directives given earlier and let me start again from scratch"?
In my specific situation I have AuthType shibboleth with Require shibboleth (which merely enables Shibboleth without limiting access to any particular criteria), so there is perhaps a Shibboleth-specific answer here as well.


text:
Q: Securing files stored on cdn I am using 2 servers to complete my system, a cdn server used to store large protected documents, video, etc. And a .NET server for the website. I would like to know what is the best way to to have the cdn authenticate or validate a user before sending down a file for download.
Right now users log into the website and an Cookie is stored. Not sure how to go about protecting assets on cdn though. I don't want anonymous/visitors to use a link from their buddies to retrieve the file.

A: You will need to ask the CDN what authentication possibilities exist, and how to use them. This will  vary from provider to provider.
See e.g. the Security section in Amazon S3's FAQ


text:
Q: How does beforeShowDay method work? (Jquery UI datepicker) I have been trying to find a clear explanation for a significant amount of time now but I just can't seem to understand how this method works. Below is the official documentation from the Jquery UI API. It may be clear to others but I find it a bit vague. I simply want to take an array of dates and disable them. I am able to make all dates not selectable but not the ones I want.

beforeShowDayType: Function( Date date )
Default: null
A function that takes a date as a parameter and must return an array with:
[0]: true/false indicating whether or not this date is selectable
     [1]: a CSS class name to add to the date's cell or "" for the default presentation
     [2]: an optional popup tooltip for this date
The function is called for each day in the datepicker before it is displayed.

This is my (incomplete) code so far.
$(document).ready(function() {
    var array = ["2014-01-03","2014-01-13","2014-01-23"];
    $('#fromDate').datepicker({
        dateFormat: "yy-mm-dd",
        beforeShowDay: function(date) {
            {
                return [false, "", "Booked out"];
            } else {
                return [true, "", "available"];
            }
        }
    });
});

A: Try this:
beforeShowDay: function(date) {
    if($.inArray($.datepicker.formatDate('yy-mm-dd', date ), array) > -1)
    {
        return [false,"","Booked out"];
    }
    else
    {
        return [true,'',"available"];
    }
}


text:
Q: Number of events within each elevation class I'm trying to model how elevation affects fire events for an AOI, I have run my cluster analysis for the fire events and right now I'm trying to calculate how many fire events fall within each elevation class.
I have used the zonal histogram tool in ArcGIS, but I'm not sure I trust the output. Is there a better tool for which to achieve this?

A: I assume you use ArcGIS.
You can extract the elevation value for each point using "extract value to points". You can then work on the attribute tabe to create your categories (field calculator with a linear transformation, e.g. !field!/10), then you summarize the table to have the count of event.
As a remark, zonal histogram should work fine but you need to set up the raster analysis environment to make sure that the cell size for the anlysis is the same as your DEM.


text:
Q: C++ 2D vector sorting I want to sort the numbers within a 2D vector (10x100).
My idea is to sort it first by rows, and then find the smallest number in the first column and save it in a new 1D vector, then delete the smallest one in the column, and so on till the last number.
My code goes like this but it doesn't work.
vector <vector <int> > vec(10, vector <int> (0));// already sorted by rows.
vector <int> datafinal;

for( int row=0; row < vec.size(); row++){
    int mini = vec[0][0];
    if (vec[row][0]< mini) {
        datafinal.push_back(mini);
        vec[row].erase(vec[row].begin());
    }
}

for (int k=0; k< datafinal.size(); k++){
    cout << datafinal[k] << endl;
}

A: Based on your question and logic example, I feel like this is what you're trying to do:

*

*You desire to sort the entire matrix/2d vector such that reading from left to right and top to bottom the martix/2d vector will read in ascending/descending order.

In this case, you could treat the entire matrix/2d vector as though its a set of N elements for sorting, but you will have to ensure that you properly place/replace your data in a 2d format.
An example of this would be:
[3, 5, 1]
[1, 3, 1]
[12, 4, 1]
This could be handled as standard array/vector if you represent it as: [3, 5, 1, 1, 3, 1, 12, 4, 1]
By treating it as a standard array/vector, you could perform a normal sorting function on the set.
Then to convert it back into a matrix/2d format you'd be able to iterate through the set and each time you've read the number of elements that make up the size of a row N, you'd move to a new row.


text:
Q: Private npm registry with fallback to global registry Installing the npm package from the global registry( https://registry.npmjs.com ), if that package does not exist, install it from Azure Artifacts.
To do this:
First I create .npmrc in the root directory where the package.json file is.
registry=http://server/DefaultCollection/CMP/_packaging/Frontend-Feed/npm/registry/
//https://registry.npmjs.com/

always-auth=true

; begin auth token
//server/DefaultCollection/CMP/_packaging/Frontend-Feed/npm/registry/:username=DefaultCollection
//server/DefaultCollection/CMP/_packaging/Frontend-Feed/npm/registry/:_password=[XXXXXXX==]
//server/DefaultCollection/CMP/_packaging/Frontend-Feed/npm/registry/:email=npm requires email to be set but doesn't use the value
//server/DefaultCollection/CMP/_packaging/Frontend-Feed/npm/:username=DefaultCollection
//server/DefaultCollection/CMP/_packaging/Frontend-Feed/npm/:_password=[XXXXXXX==]
//server/DefaultCollection/CMP/_packaging/Frontend-Feed/npm/:email=npm requires email to be set but doesn't use the value
; end auth token

NOTE: We have to replace XXXXXXX  with token.
I run the following command to install the express package
npm install express

What I expect is : It has to install the express package from the global registry
When run the following command
npm install cac-common

I expect to install package above from Azure Artifacts(this is my private pakcage.)
But It does not work. where I'm wrong?
Any help would be appreciated.
Thanks in advance.

A: There is one possible solution.
If you set your company/organization packages to have a scope like @mycompany. You can define an .npmrc like this
@mycompany:registry=http://server/DefaultCollection/CMP/_packaging/Frontend-Feed/npm/registry/
//https://registry.npmjs.com/

always-auth=true

; begin auth token
//server/DefaultCollection/CMP/_packaging/Frontend-Feed/npm/registry/:username=DefaultCollection
//server/DefaultCollection/CMP/_packaging/Frontend-Feed/npm/registry/:_password=[XXXXXXX==]
//server/DefaultCollection/CMP/_packaging/Frontend-Feed/npm/registry/:email=npm requires email to be set but doesn't use the value
//server/DefaultCollection/CMP/_packaging/Frontend-Feed/npm/:username=DefaultCollection
//server/DefaultCollection/CMP/_packaging/Frontend-Feed/npm/:_password=[XXXXXXX==]
//server/DefaultCollection/CMP/_packaging/Frontend-Feed/npm/:email=npm requires email to be set but doesn't use the value
; end auth token

That way, when you install @mycompany/mypackage; npm will get it from Azure and the rest from the public npm registry.
I hope that works for you...


text:
Q: Can not connect to SQL DB: Lost connection to MySQL server at 'handshake: reading inital communication packet', system error: 0uery I am trying to connect with HeidiSQL to the SQL DB which is running on the remote server to which I connect through the VPN. I am receiving an error message:

Lost connection to MySQL server at 'handshake: reading inital
communication packet', system error: 0uery

I can ping host and telnet to it. Any advice where to dig next?


text:
Q: Не работает выборка из массива сессий PHP такой код работает, выдаёт массив:
var_dump($_SESSION['logged_user']);

выдает он:
object(__PHP_Incomplete_Class)#1 (11) { ["__PHP_Incomplete_Class_Name"]=> string(19) "RedBeanPHP\OODBBean" ["properties":protected]=> array(4) { ["id"]=> string(1) "1" ["login"]=> string(7) "Likel0v" ["email"]=> string(20) "likel0vsky@gmail.com" ["password"]=> string(60) "$2y$10$P107YiTgSWDkifFN7B/Bxe7xWnE06MY1WnnRup/2fPSV0UFtOOaT2" } ["__info":protected]=> array(8) { ["type"]=> string(5) "users" ["sys.id"]=> string(2) "id" ["sys.orig"]=> array(4) { ["id"]=> string(1) "1" ["login"]=> string(7) "Likel0v" ["email"]=> string(20) "likel0vsky@gmail.com" ["password"]=> string(60) "$2y$10$P107YiTgSWDkifFN7B/Bxe7xWnE06MY1WnnRup/2fPSV0UFtOOaT2" } ["tainted"]=> bool(false) ["changed"]=> bool(false) ["changelist"]=> array(0) { } ["model"]=> NULL ["data.bundle"]=> array(0) { } } ["beanHelper":protected]=> object(__PHP_Incomplete_Class)#2 (1) { ["__PHP_Incomplete_Class_Name"]=> string(44) "RedBeanPHP\BeanHelper\SimpleFacadeBeanHelper" } ["fetchType":protected]=> NULL ["withSql":protected]=> string(0) "" ["withParams":protected]=> array(0) { } ["aliasName":protected]=> NULL ["via":protected]=> NULL ["noLoad":protected]=> bool(false) ["all":protected]=> bool(false) }

а такой не работает:
var_dump($_SESSION['logged_user']->login);

выдает:
NULL

В чем проблема?
Версия PHP: 7.1
Для БД юзал redbeanphp.


text:
Q: $\bigcup X$ = $\sup(X)$ for a set $X$ of ordinals Let $X$ be a set of ordinals. Prove that $\bigcup X$ = $\sup(X)$(which is the least ordinal
$\ge$ every ordinal in $X$).

A: Suppose first that $X$ has a maximal element $\mu$; then $\alpha\subseteq\mu$ for all $\alpha\in X$, so $\bigcup X=\mu$, and clearly $\mu=\sup X$.
Now assume that $X$ has no maximal element, and let $\mu=\sup X$. If $\xi\in\bigcup X$, there must be some $\alpha\in X$ such that $\xi\in\alpha$; and $\alpha\le\mu$, so $\alpha\subseteq\mu$, and therefore $\xi\in\mu$. Thus, $\bigcup X\subseteq\mu$. Now suppose that $\xi\in\mu$. Then $\xi<\mu$, so there is an $\alpha\in X$ such that $\xi<\alpha$, and hence $\xi\in\alpha\subseteq\bigcup X$. Thus, $\mu\subseteq\bigcup X$, and we have $\bigcup X=\mu$ in this case as well.

A: First we will check that $\bigcup X$ is also ordinal. To check this fact, we will prove that $\bigcup X$ is transitive and well-ordered with respect to $\in$.
If $y\in \bigcup X$ for all $y\in Y$, then there is some $x\in X$ satisfy that $y\in x$. By transitivity of $x$, we get $\bigcup y\in x$ so $\bigcup y  \in\bigcup X$ (because $x\subset \bigcup X$.) Therefore $\bigcup X$ is transitive.
Let $y,z\in\bigcup X$, then there is $x\in X$ such that $y,z\in x$ (because for every ordinal $\alpha$ and $\beta$ satisfy $\alpha\subset\beta$ or $\beta\subset \alpha$.) Since $y$ and $z$ are elements of ordinal so $x\in y$ or $x=y$ or $y\in x$ holds.
Finally, we will check that $\bigcup X$ is well-ordered by respect to $\in$. Let $A$ be a nonempty subset of $\bigcup X$. Since $A$ is nonempty, there is = $x\in X$ that intersects to $x$ (that is, $A\cap x\neq\varnothing$.) Consider $\alpha=\min (A\cap x)$ (this minimum exists because $A\cap x\subset x$ and $x$ is ordinal.)
Let $\beta \in A$. If $\beta\in x$ then definition of $\alpha$ we get $\alpha=\beta$ or $\alpha=\beta$. If not, we get $x\in\beta$ or $x=\beta$ (because $x$ and $\beta$ are ordinal.) In that cases we get $x\subset \beta$, so $\alpha\in\beta$. So $\alpha$ is the minimal element of $A$.
Therefore $\bigcup X$ is ordinal and $x \subset \bigcup X$ for all $x\in X$. If $x\subset y$ for all $x\in X$, then by transitivity of $y$ we get $\bigcup X\subset y$. Therefore $\bigcup X=\sup X$.


text:
Q: Using 3 Pipes(FIFO) to communicate in c , blocking when I tried to communicate with third I have the following issue. I have two clients each one has one pipe for reading called .name_of_client and I have a pipe for writing to the server with constant name.
When client 1 sends a message to the server then sends a message to same client (possible success message) but when I tried to send to client 2 the server gets trapped , it can't receive another message  , and client2 must only read a pipe if have something on them I tried while(!feof(fd)) but it doesn't appear to work. Am I using the wrong function for the job?
My code only necessary to get more information of what I'm doing:
It's only a essential part of my code
server:
void  process_msg(char* s){
 char* from;
 char* to;
 char* msg;

 strtok(s,":");
 from = strtok(NULL,",");
 strtok(NULL,":");
 to = strtok(NULL,",");
 strtok(NULL,":");
 msg = strtok(NULL,";");

 char path[50];
 char path2[50];

 sprintf(path,".%s",from);
 sprintf(path2,".%s",to);

 char buffer[250];

 if((fp = fopen(path, "w")) == NULL) {
    perror("fopen");
    exit(1);
 }

 if(strcmp(from,to)==0){
  sprintf(buffer,"não podes enviar uma mensagem a ti proprio");
  fputs(buffer,fp);
  fclose(fp);
  return;
 }
 int is_online =0;
 int i=0;
 for(i=0;i<tamanho;i++)
 if(strcmp(list[i].user,to)==0)
  is_online =1;

 if(!is_online){
  sprintf(buffer,"%s nao esta online!\n",to);
  fputs(buffer,fp);
  fclose(fp);
  return;
 }
 else
  printf("-> %s mandou uma mensagem a %s\n",from,to);
  fputs("ENVIADO",fp);
  fclose(fp);
  printf("%s",path2);

  if((fp = fopen(path2, "w")) == NULL) {
    perror("fopen");
    exit(1);
  }
  sprintf(buffer,"%s > %s\n",from,msg);
  fputs(buffer,fp);
  fclose(fp);

 }

client:
 int main(int argc, char *argv[])
 {
  FILE *fp;

  if(argc==1){
   printf("Não escolheu utilizador\n");
   exit(0);
  }
  char* password;
  sprintf(user,"%s",argv[1]);
  printf("Password:\n");
  password = get_password();

  char mensagem[250];

  if((fp = fopen(FIFO_FILE, "w")) == NULL) {
    perror("fopen");
    exit(1);
  }

  strcpy(path,".");
  strcat(path,user);
  umask(0);
  mknod(path, S_IFIFO|0666, 0);

  sprintf(mensagem,"U:%s,%s;",user,password);
  fputs(mensagem, fp);
  fclose(fp);
  if((fp = fopen(path, "r")) == NULL) {
      perror("fopen");
      exit(1);
  }
  fgets(mensagem,250,fp);
  fclose(fp);

  if(strcmp(mensagem,"SUCCESS")==0){
   printf("\n\nUtilizador %s autenticado. Pode começar a usar o sistema!\n\n",user);
  }
  else if(strcmp(mensagem,"FAIL!")==0){
   printf("Password incorrecta!\n");
   exit(1);
  }

  while(1){
      printf("name\n"); //DEBUG
      if((fp = fopen(path, "r")) == NULL) {
          perror("fopen");

          exit(1);
        }

        printf("name2");//DEBUG
      while(fgets(mensagem,250,fp)!=NULL){
        printf("%s",mensagem);
      }

      fclose(fp);

   printf("**Menu**\n1) Listar utilizadores online\n2) Mandar SMS a um utilizador\n3) Logout\n\n");

   char opcao;
   op:deactivate_input();
   scanf("%c",&opcao);
   activate_input();

   if(opcao!='1' && opcao!='2' && opcao!='3')
     goto op;
   if(opcao=='1'){
    if((fp = fopen(FIFO_FILE, "w")) == NULL) {
     perror("fopen");
     exit(1);
    }
    sprintf(mensagem,"W:%s;",user);
    fputs(mensagem, fp);
    fclose(fp);

    if((fp = fopen(path, "r")) == NULL) {
     perror("fopen");
     exit(1);
    }
    printf("////ONLINE LIST\\\\\\\\");
    while(!feof(fp)){
     fgets(mensagem, 250, fp);
     printf("%s\n",mensagem);
    }
    printf("////  END\\\\\\\\\n");
    fflush(fp);
    fclose(fp);

    }
    else if(opcao=='2'){

    if((fp = fopen(FIFO_FILE, "w")) == NULL) {
        perror("fopen");
        exit(1);
    }
    char tmp[50];
    printf("Para quem vais mandar a mensagem?\n");
    scanf("%s",tmp);
    getchar();
    printf("Escreve a mensagem?\n");
    //scanf("%s",mensagem);
    strcpy(mensagem,"");
    char s[50];
    fgets(mensagem,250,stdin);

    char buffer[500];
    sprintf(buffer,"F:%s,T:%s,M:%s;",user,tmp,mensagem);
    fputs(buffer, fp);
    fclose(fp);

    if((fp = fopen(path, "r")) == NULL){
     perror("fopen");
     exit(1);
    }
    fgets(mensagem, 250, fp);
    fclose(fp);
    if(strcmp(mensagem,"ENVIADO")==0){

    }else{
     printf("%s\n",mensagem);
    }

}
else if(opcao=='3'){
 if((fp = fopen(FIFO_FILE, "w")) == NULL) {
    perror("fopen");
    exit(1);
}
sprintf(mensagem,"R:%s;",user);
fputs(mensagem, fp);
fclose(fp);
break;
}

}

return(0);
}

UPDATE: I used two strings to debug but name2 is never printed. I am sure the fp is not busy but it never enters on f((fp = fopen(path, "r")) == NULL)
Does someone know why it stops before it enters on while cause prints name1 but I have nothing in between.


text:
Q: Get value from JPA subentities How can I retrieve the value from childofchild  entity using Spring-data-jpa?
eg. Person Entity ->Account Entity ->Debit_Account Entity
Debit Account Entity contains value dbtAmount that I want to retrieve.
I am new in spring and spring-data-jpa repository using find method I cannot get details from childofchild entity.

A: We have to implement the relationships between the entities properly. Such as,

*

*one to one

*one to many

*many to many

If you have configured this properly you should be able to get person entity, from that get the Account entity using getAccounts method and from that get the DebitAccount using the getDebitAccounts methods.
JPA Relationship Mapping Concept
https://www.mkyong.com/hibernate/hibernate-one-to-many-relationship-example/
Assuming the relationship are one to many, i have added more explanation,

import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToMany;

@Entity
public class Person {

@Column
private String username;

@Column
private String email;

@OneToMany(mappedBy="user")
private Set<Account> accounts;

public String getUsername() {
    return username;
}

public void setUsername(String username) {
    this.username = username;
}

public String getEmail() {
    return email;
}

public void setEmail(String email) {
    this.email = email;
}

public Set<Account> getAccounts() {
    return accounts;
}

public void setAccounts(Set<Account> accounts) {
    this.accounts = accounts;
}
}

import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToMany;

@Entity
public class Account {

@Column
String name;

@OneToMany(mappedBy="account")
private Set<DebitAccount> debitAccounts;

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public Set<DebitAccount> getDebitAccounts() {
    return debitAccounts;
}

public void setDebitAccounts(Set<DebitAccount> debitAccounts) {
    this.debitAccounts = debitAccounts;
}

}

import javax.persistence.Column;
import javax.persistence.Entity;

@Entity
public class DebitAccount {

@Column
String name;

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}
}

Hope this helps.


text:
Q: Message "Call to lnusertemp failed (temporary directories full?). Check your installation?" displayed in X before KDM This has started to happen after I encrypted my home folder (this was done after the installation, not as a part of it)... This was in 11.10.
I have since upgraded to 12.04 and after first reboot everything worked well. However since reboot after this, the messages started to pop up again before the actual KDM login prompt.
I am using Kubuntu 12.04 and I have tried different things such as permissions 777 for /tmp, removing everythign from /tmp or even deleeting ~/.kde or ~/.Xauthority etc.
Any ideas?

A: I had the same issue and found that my /home/USER/.kde folder was owned by root, which was causing permissions issues. After fixing the ownership issues with 'chown', things worked as expected.
Do this in terminal:
cd ~/
sudo chown -R <user> .kde

A: I could login after renaming my ~/.kde folder. Apparently something was corrupted and renaming the folder causes creation of a clean version. You will probably loose settings but at least you can login.

A: Logon with gnome, and try create another user, for some reason that I don't know, the config files for kde are invalid.
That worked for me.

A: I found this while searching for this very same problem when a RHEL7 VM that had worked for over a year, suddenly developed this problem. Every reboot and subsequent login as root displayed a small white popup stating: "Call to lnusertemp failed (temp directories full)". Other user accounts could login without a problem.  I do not believe the problem is 'ubuntu'-specific based on this research.
With careful experimentation, I found that, for good reason, I'd recently added the following to /root/.bashrc:
export TMPDIR=~/tmp
The problem with doing that, was /root/tmp did not exist. Either adding the target directory or commenting that line out immediately solved the problem on subsequent boots. Other testing proved that the same problem could be foisted upon plain user-accounts too.
So, either create the target directory, or don't put that in .bashrc for the applicable user.
Good luck!


text:
Q: out of line sql index creation issue Oracle Can someone explain me what wrong with the syntax. I want to add constraints primary key and unique but also want to use the same index (composite index).
create table val (
val1 number, val2 number,
constraint val_pk primary key(val1) using index(create index val_index on val(val1,val2)),
constraint val_unique unique (val2) using index val_index);

its giving me an error
create table val (
val1 number, val2 number,
constraint val_pk primary key(val1) using index(create index val_index on val(val1,val2)),
constraint val_unique unique (val2) using index val_index)
Error report -
SQL Error: ORA-14196: Specified index cannot be used to enforce the constraint.
14196. 00000 -  "Specified index cannot be used to enforce the constraint."
*Cause:    The index specified to enforce the constraint is unsuitable
           for the purpose.
*Action:   Specify a suitable index or allow one to be built automatically.

Thanks for the answers.

A: The error message is quite clear.  A unique condition on val2 cannot be enforced by a compound index on (val1, val2).
Why do you feel the need to specify indexes anyway?  Why not just use:
contraint unq_table_val2 unique(val2)

A: To enforce primary key or unique constraints, Oracle uses an index.
By default, if a suitable index doesn't already exist, Oracle will automatically create a unique index with the same columns and in the same order as the constraint definition.
However, Oracle is also capable of using non-unique indexes, and the columns don't need to be identical to the ones in the constraint.
However, for an index to be usable, the leading columns of the index need to include all the columns defined in the constraint.
So in your case, if you have an index defined as:
create index val_index on val(val1,val2)

... it can be used to enforce the primary key on val1, because val1 is the leading column in the index.
But it cannot be used to enforce the unique constraint on val2, because val2 is the 2nd column in the index.
On the other hand, it you defined a unique constraint on (val1, val2) or (val2, val1), both of those combinations can use the index successfully, because they are both covered by the leading columns of the index (the 1st and 2nd columns of the index). Of course, having both constraints is redundant, so it doesn't make sense to do that.
In your case, having what are essentially 2 different unique constraints on 2 different columns will require at least 2 indexes. You will not be able to enforce both constraints with a single index.


text:
Q: JQGrid : restoring toolbar values and operators from filter I am using JQGrid (version 5.3.0) to display values from a dynamic table (that I don't know the column number and columns names in advance). I retreive the columns schema from an ajax call to the server, as well as a filter that needs to be applied to the grid, and create the JQGrid from there.
The problem I am facing is that I find no way to repopulate the filter toolbar correctly from the filter that is passed to the table.
The code is the following :
$.ajax({
    url: {url to get columns and filter},
    type: 'POST',
    postData: { productID: 98 }
    success: function (result) {
        if (result) {
            $('#grid').jqGrid({
                url: {url to get data},
                datatype: 'json',
                search: true,
                postData: { productID: 98, filters: result.filter },
                myType: 'GET',
                colModel: result.columns,
                jsonReader: {
                    root: 'Data',
                    page: 'Page',
                    total: 'Total',
                    records: 'PageSize'
                },
                pager: $('#gridpager'),
                rowNum: 25,
                gridview: false,
                afterInsertRow: function (rowid, rowdata, rowelem) {
                    var color = rowelem.Color;
                    if (color != 'white') {
                        $("tr.jqgrow#" + rowid).addClass("color-" + color);
                    }
                },
            }).filterToolbar({
                groupOp: 'AND',
                defaultSearch: "cn",
                searchOnEnter: true,
                searchOperators: true,
                stringResult: true,
            });
        }
    }
});

Here is an example of the Columns model:
[
    {
        "name":"DESCRIPTION",
        "label":"Description",
        "searchoptions":
        {
            "sopt": ["bw","cn","nc","ew","eq","ne","in"],
            "attr":{"class":"glyphicon glyphicon-filter"}
        }
    },
    {
        "name":"SKU_CODE",
        "label":"SKU Code",
        "searchoptions":
        {
            "sopt":["bw","cn","nc","ew","eq","ne","in"],
            "attr":{"class":"glyphicon glyphicon-filter"}
        }
    },
    {...}
]

And here is the filter :
"{\"groupOp\":\"AND\",\"rules\":[{\"field\":\"DESCRIPTION\",\"op\":\"bw\",\"data\":\"D\"}]}"

When executing this code, the data is loaded from my data source, the filter is applied, but the filter bar stays empty.

Is there a way to populate automatically the filter toolbar with values from the filter passed in parameter? I've already tried parsing the filter rules, and filling the inputs with matching values, but I could not find a way to restore the operator.

A: *

*Since a Guriddo jGrid version 5.3 is used it is good to know that we have rewrite our documentation.  Here you can find answer of a lot of your questions. In your case you should know that there is a method which do exactly what you want. The name of the method refreshFilterToolbar. Since in the current implementation of the method the serchOperator are not take into account we have fixed the method in GitHub in order to support them.

If you use the existing method without support for searchOperators your code should like this:
$("#grid").jqGrid({
...
}).filterToolbar({
    groupOp: 'AND',
    defaultSearch: "cn",
    searchOnEnter: true,
    searchOperators: true,
    stringResult: true
}).refreshFilterToolbar({"filters": result.filter});

and if you use the version from github with support for searchOperators your code should be like this
$("#grid").jqGrid({
...
}).filterToolbar({
    groupOp: 'AND',
    defaultSearch: "cn",
    searchOnEnter: true,
    searchOperators: true,
    stringResult: true
}).refreshFilterToolbar();

Note that we do not pass the filter parameter, which is get automatically.

*I see you use afterInsertRow event to set some class of the row based on condition. This event should be used only if there is no other way to do this. The use of this event in relative big data sets causes a slow reading and in some cases hanging. It should be used very carfully.

In your case you can use rowattr  event for this purpose. Please read more about it in the same documentation page. Do not forget to set gridview to true or with other words
...
rowNum: 25,
gridview: true,
rowattr: function (rowdata, rowelem) {
    var color = rowelem.Color;
    if (color != 'white') {
        return { "class" : "color-" + color};
    }
},


text:
Q: Execute SQL task to Insert Date with Parameter Bypass Set to True and Issue ResolvedI am Using Execute SQL task to Insert Date into Staging Table and I am facing the below error:
[Execute SQL Task] Error: Executing the query
DECLARE @Counter VARCHAR(15)=?
INSERT INTO tblFor..." failed with the following error: "Syntax error, permission violation, or other nonspecific error". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

A: if you want to manage your variables better use expressions :

and here how to declare your variables from

ones there you can create your variables with type and value if you want


text:
Q: dialing a ussd code via URL on iPhone (iOS) Is it possible to dial a USSD code via URL on iPhone using Safari or email (via hyperlink).
I am able to dial a normal phone number but it seems apple doesn't allow us to use * or # in the url? is it really like this?
This is what I am dialing via URL (hyperlink):
Dial

A: Apparently it is not possible without the use of private API in the objective c code (which apple won't accept on Apple store).
Please see the below mentioned URL:
http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/Articles/PhoneLinks.html
This is what they have mentioned: "Specifically, if a URL contains the * or # characters, the Phone application does not attempt to dial the corresponding phone number".
Hope it helps someone else.
Regards,
Reno Jones

A: Try to
replace:   #     to     %23

this one:
Dial

or this one:
Dial


text:
Q: How to change the color of cursor balloon (I don't know what it is called) in Flutter I am creating this application in flutter where I have this text field. I want to change the color of this cursor balloon but I'm not sure how can I. Any help will be appreciated.

A: Wrap your textfield widget with a Theme widget and set the textSelectionHandleColor parameter to your desired color.
Theme(
   data: Theme.of(context).copyWith(
     textSelectionTheme: TextSelectionThemeData(
      cursorColor: Colors.red,
      selectionColor: Colors.green,
      selectionHandleColor: Colors.black,
    ),
   ),
   child: TextFormField(),
);

Or you can make it uniform across you app by setting the theme parameter of the MaterialApp widget like so:
return MaterialApp(
        title: 'App Name',
        debugShowCheckedModeBanner: false,
        theme: ThemeData(
          textSelectionTheme: const TextSelectionThemeData(
            cursorColor: Colors.red,
                  selectionColor: Colors.blue,
                  selectionHandleColor: Colors.purple,
          ),

          //...Other theme color configurations here
        ),
         home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );


text:
Q: Rails Models for multiple revisions of a type of document I am trying to model this scenario with Rails

*

*There are three types of ApplicationForms- FormA, FormB and FormC

This scenario is modeled using Single Table inheritance. And each form has a method tranform_to_pdf overwritten, which returns a map(header-->value).
application_forms(id, name, type)

Now it is possible to have multiple revisions for each form, for example, FormA has Rev1, Rev2, etc. Each revision might have modifications to the number of fields present etc.
What would be the best way to modify existing rails model to reflect revisions?
Thanks in Advance!

A: I would delegate the work to a second set of objects. Assuming you have a forms table with 3 fields (id,  the polymorphic type and the revision (version) ). I would write something like:
class Form < ActiveRecord::Base
end

class FormA < Form
  def transform_to_pdf
  end

  private

  REVISION_TO_IMPLEMENTATION_MAP = {
    1 => FormAImplementationV1,
    2 => FormAImplementationV2
  }

  def implementation
    klass = REVISION_TO_IMPLEMENTATION_MAP[revision]
    klass.new(self)
  end

end

class FormAImplementation
  def initialize(model)
  end
end
class FormAImplementationV1 < FormAImplementation
  def transform_to_pdf
  end
end
class FormAImplementationV2 < FormAImplementation
  def transform_to_pdf
  end
end

However I think this could quickly become unwieldy and it would quickly make sense to implement another solution, either with meta-data or by storing revision and field in your database. I would need to see more code though...


text:
Q: Time Capsule and multiple Macs Does the Time Capule support Time Machine backups from multiple macs out of the box?

A: Yes. Each Mac get's it's own sparse bundle disk image.

A: And to support gentmatt's answer, here is the official documentation of Apple:


text:
Q: Spring-boot remote JMX using embedded undertow I have a spring-boot application using undertow as the embedded container. I am trying to enable remote JMX access. The application is deployed as an executable jar, if that makes any difference.
So far, I have tried starting the jar with the -Dcom.sun.management.jmxremote family of properties set, as mentioned here How to access Spring-boot JMX remotely.
It doesn't work.
Since undertow is a "sibling" project to WildFly and JBoss AS, I have also tried connecting to jmx endpoint using the http-remoting-jmx protocol (with jboss-cli-client.jar in jconsole's classpath) using a link like this:
service:jmx:http-remoting-jmx://<host>:<port>
as mentioned in https://dzone.com/articles/remote-jmx-access-wildfly-or.
This also doesn't work.
I have specified all the spring.jmx properties in the application.properties file like this:
# JMX config
spring.jmx.default-domain=host
spring.jmx.enabled=true
spring.jmx.server=mbeanServer

Running jconsole or visualvm locally works and I can see all the registered JMX Mbeans I care about.
So, my guess is that I am missing something regarding the remote JMX configuration but what is it?
Bear in mind, the port I am using for JMX access is available, since I have another application (deployed on tomcat using spring boot) where remote JMX connection is possible.
Thanks in advance for any hints.


text:
Q: How does ArrayList.get return its objects? Context: I'm making a mini-interpreter-ish calculator thing. I figured that the best way to hold the symbol table was to make an ArrayList of an Object that I've defined (name of the object is WiP). Setting up the ArrayList looks like.
ArrayList<miniVariable> vList = new ArrayList<miniVariable>();

Simple enough, and the miniVariable Object contains the following variables
    public String name;
    public double value;
    public boolean initialized;

They are public because I already made setter/getters in the class with the ArrayList, when I didn't realize you could make one of Objects, and I don't want to move everything over. I probably should.
Question: If I were to call vList.get(index) .value = 5; would it actually change the value being stored in the vList(index)'s value variable? Or does .get(index)just return a copy  of the data, and so changing this copy doesn't actually do anything?

A: What you are storing in the ArrayList is not the object itself, but reference to object.
So when you do vList.get(i) it is returning you the reference that you previous put in.  Which means you are going to access the same object that you previous put in the list, instead of a copy of it.
Get yourself familiar with one of the basic concept of Java, which is Reference and Primitive types.
Some off-topic suggestions:

*

*Make sure you are aware of Java's naming convention. For example, for the class name, it should be MiniVariable instead of miniVariable.

*Just to be more accurate: "and the miniVariable Object contains the following variable", MiniVariable is a class, but not an object.  You may say "and a MiniVariable object (instance) contains these member fields", or "in MiniVariable class defined the following member fields"

A: It changes the value on the original instance, as one would expect.
Creating a copy of an object in Java only happens explicitly (and usually with some difficulty at that).
A few other notes:

*

*Class names in should be CapitalCase.

*Implementing getters and setters on an object holding a list of objects is bad practice as it violates encapsulation. If you're implementing getters and setters, it's best to put them on the class they apply to.

A: All collections objects stores reference to object , if you change any thing on  object directly(accessing through collection) or indirectly ( already have reference of it) it will change the state of the object stored in collection


text:
Q: How do I change the html on the page using vue.js? I have a div that holds a lot of html. I need to entirely change the content of that div to another totally different set of html. I also have to accomplish all this with Vue.js and without refreshing the page.
I tried making the div on another page, but the problem is that the data gets lost, so I have to do it without the page changing.

       [[ topic ]] |  [[ subTopic ]]

      [[ question ]]

      <button id='1' v-on:click='validateAnswer(option1,1)' v-bind:disabled = 'isDisabled' class="btn btn-primary btn-block">
        [[ option1 ]]
      </button>
      <button id='2' v-on:click='validateAnswer(option2,2)' v-bind:disabled = 'isDisabled' class="btn btn-primary btn-block">
        [[ option2 ]]
      </button>
      <button id='3' v-on:click='validateAnswer(option3,3)' v-bind:disabled = 'isDisabled' class="btn btn-primary btn-block">
        [[ option3 ]]
      </button>
      <button id='4' v-on:click='validateAnswer(option4,4)' v-bind:disabled = 'isDisabled' class="btn btn-primary btn-block">
        [[ option4 ]]
      </button>

      Authored by [[author]] on [[date]]

    <button class='btn btn-success' id='Previous' v-on:click='previous' :disabled = 'previousDisabled'>Previous</button>
    <button class="btn btn-danger" id='endTest' v-on:click="endTest" >End Test</button>
    <button class='btn btn-success' id='Next' v-on:click="next">Next</button>

I expect to be able to change the content of the div questions when I click on the button 'end test'.

A: You could add multiple sections and toggle between them.
For example your markup could be:

       [[ topic ]] |  [[ subTopic ]]

        foo questions

        bar questions

      Authored by [[author]] on [[date]]

    <button class='btn btn-success' id='Previous' v-on:click='previous' :disabled = 'previousDisabled'>Previous</button>
    <button class="btn btn-danger" id='endTest' v-on:click="endTest" >End Test</button>
    <button class='btn btn-success' id='Next' v-on:click="next">Next</button>

var app = new Vue({
  el: '#questions',
  data: {
    sectionOne: true,
    sectionTwo: false
  },
  methods: {
    nextButton: function () {
        this.sectionOne = false;
        this.sectionTwo = true;
    }
  }
})