问:
using SHAP with Inception V3
I am trying to run GradientExplainer method of SHAP on a trained Inception V3 model. I could do it without a problem on a VGG16 and MobileNet. The difference between Inception and those two models is the input dimension shape being 299 instead of 224.

But when I try SHAP on Inception I receive a long, confusing error that I cannot figure out and wasn't able to find an answer for here or elsewhere. Here is the error. Has someone here been able to visualize Inception V3 results using SHAP's GradientExplainer?

```'''
---------------------------------------------------------------------------
InvalidArgumentError                      Traceback (most recent call last)
/usr/local/lib/python3.8/dist-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args)
   1376     try:
-> 1377       return fn(*args)
   1378     except errors.OpError as e:

9 frames
InvalidArgumentError: 2 root error(s) found.
  (0) INVALID_ARGUMENT: You must feed a value for placeholder tensor 'input_1' with dtype float and shape [?,299,299,3]
     [[{{node input_1}}]]
     [[dense_2/Softmax/_34069]]
  (1) INVALID_ARGUMENT: You must feed a value for placeholder tensor 'input_1' with dtype float and shape [?,299,299,3]
     [[{{node input_1}}]]
0 successful operations.
0 derived errors ignored.

During handling of the above exception, another exception occurred:

InvalidArgumentError                      Traceback (most recent call last)
/usr/local/lib/python3.8/dist-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args)
   1394                     '\nsession_config.graph_options.rewrite_options.'
   1395                     'disable_meta_optimizer = True')
-> 1396       raise type(e)(node_def, op, message)  # pylint: disable=no-value-for-parameter
   1397
   1398   def _extend_graph(self):

InvalidArgumentError: Graph execution error:

Detected at node 'input_1' defined at (most recent call last):
    File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
      return _run_code(code, main_globals, None,
    File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
      exec(code, run_globals)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel_launcher.py", line 16, in <module>
      app.launch_new_instance()
    File "/usr/local/lib/python3.8/dist-packages/traitlets/config/application.py", line 992, in launch_instance
      app.start()
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelapp.py", line 612, in start
      self.io_loop.start()
    File "/usr/local/lib/python3.8/dist-packages/tornado/platform/asyncio.py", line 149, in start
      self.asyncio_loop.run_forever()
    File "/usr/lib/python3.8/asyncio/base_events.py", line 570, in run_forever
      self._run_once()
    File "/usr/lib/python3.8/asyncio/base_events.py", line 1859, in _run_once
      handle._run()
    File "/usr/lib/python3.8/asyncio/events.py", line 81, in _run
      self._context.run(self._callback, *self._args)
    File "/usr/local/lib/python3.8/dist-packages/tornado/ioloop.py", line 690, in <lambda>
      lambda f: self._run_callback(functools.partial(callback, future))
    File "/usr/local/lib/python3.8/dist-packages/tornado/ioloop.py", line 743, in _run_callback
      ret = callback()
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 787, in inner
      self.run()
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 748, in run
      yielded = self.gen.send(value)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 365, in process_one
      yield gen.maybe_future(dispatch(*args))
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 209, in wrapper
      yielded = next(result)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 268, in dispatch_shell
      yield gen.maybe_future(handler(stream, idents, msg))
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 209, in wrapper
      yielded = next(result)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 543, in execute_request
      self.do_execute(
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 209, in wrapper
      yielded = next(result)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/ipkernel.py", line 306, in do_execute
      res = shell.run_cell(code, store_history=store_history, silent=silent)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/zmqshell.py", line 536, in run_cell
      return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 2854, in run_cell
      result = self._run_cell(
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 2881, in _run_cell
      return runner(coro)
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/async_helpers.py", line 68, in _pseudo_sync_runner
      coro.send(None)
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 3057, in run_cell_async
      has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 3249, in run_ast_nodes
      if (await self.run_code(code, result,  async_=asy)):
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 3326, in run_code
      exec(code_obj, self.user_global_ns, self.user_ns)
    File "<ipython-input-28-2966d0b0f166>", line 2, in <module>
      model = tf.keras.models.load_model(f'/content/drive/MyDrive/Colab Notebooks/models/{model_name}')
    File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 64, in error_handler
      return fn(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/saving/save.py", line 209, in load_model
      return saved_model_load.load(filepath_str, compile, options)
    File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 135, in load
      keras_loader.load_layers(compile=compile)
    File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 399, in load_layers
      self.loaded_nodes[node_metadata.node_id] = self._load_layer(
    File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 441, in _load_layer
      obj, setter = self._revive_from_config(identifier, metadata, node_id)
    File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 459, in _revive_from_config
      self._revive_layer_or_model_from_config(metadata, node_id))
    File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 523, in _revive_layer_or_model_from_config
      obj = layers_module.deserialize(
    File "/usr/local/lib/python3.8/dist-packages/keras/layers/serialization.py", line 205, in deserialize
      return generic_utils.deserialize_keras_object(
    File "/usr/local/lib/python3.8/dist-packages/keras/utils/generic_utils.py", line 686, in deserialize_keras_object
      deserialized_obj = cls.from_config(cls_config)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/base_layer_v1.py", line 515, in from_config
      return cls(**config)
    File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 64, in error_handler
      return fn(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/input_layer.py", line 200, in __init__
      input_tensor = backend.placeholder(
    File "/usr/local/lib/python3.8/dist-packages/keras/backend.py", line 1386, in placeholder
      x = tf.compat.v1.placeholder(dtype, shape=shape, name=name)
Node: 'input_1'
Detected at node 'input_1' defined at (most recent call last):
    File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
      return _run_code(code, main_globals, None,
    File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
      exec(code, run_globals)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel_launcher.py", line 16, in <module>
      app.launch_new_instance()
    File "/usr/local/lib/python3.8/dist-packages/traitlets/config/application.py", line 992, in launch_instance
      app.start()
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelapp.py", line 612, in start
      self.io_loop.start()
    File "/usr/local/lib/python3.8/dist-packages/tornado/platform/asyncio.py", line 149, in start
      self.asyncio_loop.run_forever()
    File "/usr/lib/python3.8/asyncio/base_events.py", line 570, in run_forever
      self._run_once()
    File "/usr/lib/python3.8/asyncio/base_events.py", line 1859, in _run_once
      handle._run()
    File "/usr/lib/python3.8/asyncio/events.py", line 81, in _run
      self._context.run(self._callback, *self._args)
    File "/usr/local/lib/python3.8/dist-packages/tornado/ioloop.py", line 690, in <lambda>
      lambda f: self._run_callback(functools.partial(callback, future))
    File "/usr/local/lib/python3.8/dist-packages/tornado/ioloop.py", line 743, in _run_callback
      ret = callback()
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 787, in inner
      self.run()
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 748, in run
      yielded = self.gen.send(value)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 365, in process_one
      yield gen.maybe_future(dispatch(*args))
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 209, in wrapper
      yielded = next(result)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 268, in dispatch_shell
      yield gen.maybe_future(handler(stream, idents, msg))
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 209, in wrapper
      yielded = next(result)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 543, in execute_request
      self.do_execute(
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 209, in wrapper
      yielded = next(result)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/ipkernel.py", line 306, in do_execute
      res = shell.run_cell(code, store_history=store_history, silent=silent)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/zmqshell.py", line 536, in run_cell
      return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 2854, in run_cell
      result = self._run_cell(
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 2881, in _run_cell
      return runner(coro)
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/async_helpers.py", line 68, in _pseudo_sync_runner
      coro.send(None)
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 3057, in run_cell_async
      has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 3249, in run_ast_nodes
      if (await self.run_code(code, result,  async_=asy)):
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 3326, in run_code
      exec(code_obj, self.user_global_ns, self.user_ns)
    File "<ipython-input-28-2966d0b0f166>", line 2, in <module>
      model = tf.keras.models.load_model(f'/content/drive/MyDrive/Colab Notebooks/models/{model_name}')
    File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 64, in error_handler
      return fn(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/saving/save.py", line 209, in load_model
      return saved_model_load.load(filepath_str, compile, options)
    File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 135, in load
      keras_loader.load_layers(compile=compile)
    File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 399, in load_layers
      self.loaded_nodes[node_metadata.node_id] = self._load_layer(
    File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 441, in _load_layer
      obj, setter = self._revive_from_config(identifier, metadata, node_id)
    File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 459, in _revive_from_config
      self._revive_layer_or_model_from_config(metadata, node_id))
    File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 523, in _revive_layer_or_model_from_config
      obj = layers_module.deserialize(
    File "/usr/local/lib/python3.8/dist-packages/keras/layers/serialization.py", line 205, in deserialize
      return generic_utils.deserialize_keras_object(
    File "/usr/local/lib/python3.8/dist-packages/keras/utils/generic_utils.py", line 686, in deserialize_keras_object
      deserialized_obj = cls.from_config(cls_config)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/base_layer_v1.py", line 515, in from_config
      return cls(**config)
    File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 64, in error_handler
      return fn(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/input_layer.py", line 200, in __init__
      input_tensor = backend.placeholder(
    File "/usr/local/lib/python3.8/dist-packages/keras/backend.py", line 1386, in placeholder
      x = tf.compat.v1.placeholder(dtype, shape=shape, name=name)
Node: 'input_1'
2 root error(s) found.
  (0) INVALID_ARGUMENT: You must feed a value for placeholder tensor 'input_1' with dtype float and shape [?,299,299,3]
     [[{{node input_1}}]]
     [[dense_2/Softmax/_34069]]
  (1) INVALID_ARGUMENT: You must feed a value for placeholder tensor 'input_1' with dtype float and shape [?,299,299,3]
     [[{{node input_1}}]]
0 successful operations.
0 derived errors ignored.

Original stack trace for 'input_1':
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.8/dist-packages/ipykernel_launcher.py", line 16, in <module>
    app.launch_new_instance()
  File "/usr/local/lib/python3.8/dist-packages/traitlets/config/application.py", line 992, in launch_instance
    app.start()
  File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelapp.py", line 612, in start
    self.io_loop.start()
  File "/usr/local/lib/python3.8/dist-packages/tornado/platform/asyncio.py", line 149, in start
    self.asyncio_loop.run_forever()
  File "/usr/lib/python3.8/asyncio/base_events.py", line 570, in run_forever
    self._run_once()
  File "/usr/lib/python3.8/asyncio/base_events.py", line 1859, in _run_once
    handle._run()
  File "/usr/lib/python3.8/asyncio/events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.8/dist-packages/tornado/ioloop.py", line 690, in <lambda>
    lambda f: self._run_callback(functools.partial(callback, future))
  File "/usr/local/lib/python3.8/dist-packages/tornado/ioloop.py", line 743, in _run_callback
    ret = callback()
  File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 787, in inner
    self.run()
  File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 748, in run
    yielded = self.gen.send(value)
  File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 365, in process_one
    yield gen.maybe_future(dispatch(*args))
  File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 209, in wrapper
    yielded = next(result)
  File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 268, in dispatch_shell
    yield gen.maybe_future(handler(stream, idents, msg))
  File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 209, in wrapper
    yielded = next(result)
  File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 543, in execute_request
    self.do_execute(
  File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 209, in wrapper
    yielded = next(result)
  File "/usr/local/lib/python3.8/dist-packages/ipykernel/ipkernel.py", line 306, in do_execute
    res = shell.run_cell(code, store_history=store_history, silent=silent)
  File "/usr/local/lib/python3.8/dist-packages/ipykernel/zmqshell.py", line 536, in run_cell
    return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 2854, in run_cell
    result = self._run_cell(
  File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 2881, in _run_cell
    return runner(coro)
  File "/usr/local/lib/python3.8/dist-packages/IPython/core/async_helpers.py", line 68, in _pseudo_sync_runner
    coro.send(None)
  File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 3057, in run_cell_async
    has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
  File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 3249, in run_ast_nodes
    if (await self.run_code(code, result,  async_=asy)):
  File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 3326, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-28-2966d0b0f166>", line 2, in <module>
    model = tf.keras.models.load_model(f'/content/drive/MyDrive/Colab Notebooks/models/{model_name}')
  File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 64, in error_handler
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/keras/saving/save.py", line 209, in load_model
    return saved_model_load.load(filepath_str, compile, options)
  File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 135, in load
    keras_loader.load_layers(compile=compile)
  File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 399, in load_layers
    self.loaded_nodes[node_metadata.node_id] = self._load_layer(
  File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 441, in _load_layer
    obj, setter = self._revive_from_config(identifier, metadata, node_id)
  File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 459, in _revive_from_config
    self._revive_layer_or_model_from_config(metadata, node_id))
  File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 523, in _revive_layer_or_model_from_config
    obj = layers_module.deserialize(
  File "/usr/local/lib/python3.8/dist-packages/keras/layers/serialization.py", line 205, in deserialize
    return generic_utils.deserialize_keras_object(
  File "/usr/local/lib/python3.8/dist-packages/keras/utils/generic_utils.py", line 686, in deserialize_keras_object
    deserialized_obj = cls.from_config(cls_config)
  File "/usr/local/lib/python3.8/dist-packages/keras/engine/base_layer_v1.py", line 515, in from_config
    return cls(**config)
  File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 64, in error_handler
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/keras/engine/input_layer.py", line 200, in __init__
    input_tensor = backend.placeholder(
  File "/usr/local/lib/python3.8/dist-packages/keras/backend.py", line 1386, in placeholder
    x = tf.compat.v1.placeholder(dtype, shape=shape, name=name)
  File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/ops/array_ops.py", line 3346, in placeholder
    return gen_array_ops.placeholder(dtype=dtype, shape=shape, name=name)
  File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 6893, in placeholder
    _, _, _op, _outputs = _op_def_library._apply_op_helper(
  File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/framework/op_def_library.py", line 797, in _apply_op_helper
    op = g._create_op_internal(op_type_name, inputs, dtypes=None,
  File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/framework/ops.py", line 3754, in _create_op_internal
    ret = Operation(
  File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/framework/ops.py", line 2133, in __init__
    self._traceback = tf_stack.extract_stack_for_node(self._c_op)
'''
```

Title: using SHAP with Inception V3

Body:
I am trying to run GradientExplainer method of SHAP on a trained Inception V3 model. I could do it without a problem on a VGG16 and MobileNet. The difference between Inception and those two models is the input dimension shape being 299 instead of 224.

But when I try SHAP on Inception I receive a long, confusing error that I cannot figure out and wasn't able to find an answer for here or elsewhere. Here is the error. Has someone here been able to visualize Inception V3 results using SHAP's GradientExplainer?

'''
---------------------------------------------------------------------------
InvalidArgumentError                      Traceback (most recent call last)
/usr/local/lib/python3.8/dist-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args)
   1376     try:
-> 1377       return fn(*args)
   1378     except errors.OpError as e:

9 frames
InvalidArgumentError: 2 root error(s) found.
  (0) INVALID_ARGUMENT: You must feed a value for placeholder tensor 'input_1' with dtype float and shape [?,299,299,3]
     [[{{node input_1}}]]
     [[dense_2/Softmax/_34069]]
  (1) INVALID_ARGUMENT: You must feed a value for placeholder tensor 'input_1' with dtype float and shape [?,299,299,3]
     [[{{node input_1}}]]
0 successful operations.
0 derived errors ignored.

During handling of the above exception, another exception occurred:

InvalidArgumentError                      Traceback (most recent call last)
/usr/local/lib/python3.8/dist-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args)
   1394                     '\nsession_config.graph_options.rewrite_options.'
   1395                     'disable_meta_optimizer = True')
-> 1396       raise type(e)(node_def, op, message)  # pylint: disable=no-value-for-parameter
   1397
   1398   def _extend_graph(self):

InvalidArgumentError: Graph execution error:

Detected at node 'input_1' defined at (most recent call last):
    File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
      return _run_code(code, main_globals, None,
    File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
      exec(code, run_globals)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel_launcher.py", line 16, in <module>
      app.launch_new_instance()
    File "/usr/local/lib/python3.8/dist-packages/traitlets/config/application.py", line 992, in launch_instance
      app.start()
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelapp.py", line 612, in start
      self.io_loop.start()
    File "/usr/local/lib/python3.8/dist-packages/tornado/platform/asyncio.py", line 149, in start
      self.asyncio_loop.run_forever()
    File "/usr/lib/python3.8/asyncio/base_events.py", line 570, in run_forever
      self._run_once()
    File "/usr/lib/python3.8/asyncio/base_events.py", line 1859, in _run_once
      handle._run()
    File "/usr/lib/python3.8/asyncio/events.py", line 81, in _run
      self._context.run(self._callback, *self._args)
    File "/usr/local/lib/python3.8/dist-packages/tornado/ioloop.py", line 690, in <lambda>
      lambda f: self._run_callback(functools.partial(callback, future))
    File "/usr/local/lib/python3.8/dist-packages/tornado/ioloop.py", line 743, in _run_callback
      ret = callback()
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 787, in inner
      self.run()
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 748, in run
      yielded = self.gen.send(value)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 365, in process_one
      yield gen.maybe_future(dispatch(*args))
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 209, in wrapper
      yielded = next(result)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 268, in dispatch_shell
      yield gen.maybe_future(handler(stream, idents, msg))
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 209, in wrapper
      yielded = next(result)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 543, in execute_request
      self.do_execute(
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 209, in wrapper
      yielded = next(result)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/ipkernel.py", line 306, in do_execute
      res = shell.run_cell(code, store_history=store_history, silent=silent)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/zmqshell.py", line 536, in run_cell
      return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 2854, in run_cell
      result = self._run_cell(
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 2881, in _run_cell
      return runner(coro)
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/async_helpers.py", line 68, in _pseudo_sync_runner
      coro.send(None)
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 3057, in run_cell_async
      has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 3249, in run_ast_nodes
      if (await self.run_code(code, result,  async_=asy)):
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 3326, in run_code
      exec(code_obj, self.user_global_ns, self.user_ns)
    File "<ipython-input-28-2966d0b0f166>", line 2, in <module>
      model = tf.keras.models.load_model(f'/content/drive/MyDrive/Colab Notebooks/models/{model_name}')
    File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 64, in error_handler
      return fn(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/saving/save.py", line 209, in load_model
      return saved_model_load.load(filepath_str, compile, options)
    File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 135, in load
      keras_loader.load_layers(compile=compile)
    File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 399, in load_layers
      self.loaded_nodes[node_metadata.node_id] = self._load_layer(
    File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 441, in _load_layer
      obj, setter = self._revive_from_config(identifier, metadata, node_id)
    File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 459, in _revive_from_config
      self._revive_layer_or_model_from_config(metadata, node_id))
    File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 523, in _revive_layer_or_model_from_config
      obj = layers_module.deserialize(
    File "/usr/local/lib/python3.8/dist-packages/keras/layers/serialization.py", line 205, in deserialize
      return generic_utils.deserialize_keras_object(
    File "/usr/local/lib/python3.8/dist-packages/keras/utils/generic_utils.py", line 686, in deserialize_keras_object
      deserialized_obj = cls.from_config(cls_config)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/base_layer_v1.py", line 515, in from_config
      return cls(**config)
    File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 64, in error_handler
      return fn(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/input_layer.py", line 200, in __init__
      input_tensor = backend.placeholder(
    File "/usr/local/lib/python3.8/dist-packages/keras/backend.py", line 1386, in placeholder
      x = tf.compat.v1.placeholder(dtype, shape=shape, name=name)
Node: 'input_1'
Detected at node 'input_1' defined at (most recent call last):
    File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
      return _run_code(code, main_globals, None,
    File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
      exec(code, run_globals)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel_launcher.py", line 16, in <module>
      app.launch_new_instance()
    File "/usr/local/lib/python3.8/dist-packages/traitlets/config/application.py", line 992, in launch_instance
      app.start()
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelapp.py", line 612, in start
      self.io_loop.start()
    File "/usr/local/lib/python3.8/dist-packages/tornado/platform/asyncio.py", line 149, in start
      self.asyncio_loop.run_forever()
    File "/usr/lib/python3.8/asyncio/base_events.py", line 570, in run_forever
      self._run_once()
    File "/usr/lib/python3.8/asyncio/base_events.py", line 1859, in _run_once
      handle._run()
    File "/usr/lib/python3.8/asyncio/events.py", line 81, in _run
      self._context.run(self._callback, *self._args)
    File "/usr/local/lib/python3.8/dist-packages/tornado/ioloop.py", line 690, in <lambda>
      lambda f: self._run_callback(functools.partial(callback, future))
    File "/usr/local/lib/python3.8/dist-packages/tornado/ioloop.py", line 743, in _run_callback
      ret = callback()
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 787, in inner
      self.run()
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 748, in run
      yielded = self.gen.send(value)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 365, in process_one
      yield gen.maybe_future(dispatch(*args))
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 209, in wrapper
      yielded = next(result)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 268, in dispatch_shell
      yield gen.maybe_future(handler(stream, idents, msg))
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 209, in wrapper
      yielded = next(result)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 543, in execute_request
      self.do_execute(
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 209, in wrapper
      yielded = next(result)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/ipkernel.py", line 306, in do_execute
      res = shell.run_cell(code, store_history=store_history, silent=silent)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/zmqshell.py", line 536, in run_cell
      return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 2854, in run_cell
      result = self._run_cell(
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 2881, in _run_cell
      return runner(coro)
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/async_helpers.py", line 68, in _pseudo_sync_runner
      coro.send(None)
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 3057, in run_cell_async
      has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 3249, in run_ast_nodes
      if (await self.run_code(code, result,  async_=asy)):
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 3326, in run_code
      exec(code_obj, self.user_global_ns, self.user_ns)
    File "<ipython-input-28-2966d0b0f166>", line 2, in <module>
      model = tf.keras.models.load_model(f'/content/drive/MyDrive/Colab Notebooks/models/{model_name}')
    File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 64, in error_handler
      return fn(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/saving/save.py", line 209, in load_model
      return saved_model_load.load(filepath_str, compile, options)
    File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 135, in load
      keras_loader.load_layers(compile=compile)
    File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 399, in load_layers
      self.loaded_nodes[node_metadata.node_id] = self._load_layer(
    File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 441, in _load_layer
      obj, setter = self._revive_from_config(identifier, metadata, node_id)
    File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 459, in _revive_from_config
      self._revive_layer_or_model_from_config(metadata, node_id))
    File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 523, in _revive_layer_or_model_from_config
      obj = layers_module.deserialize(
    File "/usr/local/lib/python3.8/dist-packages/keras/layers/serialization.py", line 205, in deserialize
      return generic_utils.deserialize_keras_object(
    File "/usr/local/lib/python3.8/dist-packages/keras/utils/generic_utils.py", line 686, in deserialize_keras_object
      deserialized_obj = cls.from_config(cls_config)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/base_layer_v1.py", line 515, in from_config
      return cls(**config)
    File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 64, in error_handler
      return fn(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/input_layer.py", line 200, in __init__
      input_tensor = backend.placeholder(
    File "/usr/local/lib/python3.8/dist-packages/keras/backend.py", line 1386, in placeholder
      x = tf.compat.v1.placeholder(dtype, shape=shape, name=name)
Node: 'input_1'
2 root error(s) found.
  (0) INVALID_ARGUMENT: You must feed a value for placeholder tensor 'input_1' with dtype float and shape [?,299,299,3]
     [[{{node input_1}}]]
     [[dense_2/Softmax/_34069]]
  (1) INVALID_ARGUMENT: You must feed a value for placeholder tensor 'input_1' with dtype float and shape [?,299,299,3]
     [[{{node input_1}}]]
0 successful operations.
0 derived errors ignored.

Original stack trace for 'input_1':
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.8/dist-packages/ipykernel_launcher.py", line 16, in <module>
    app.launch_new_instance()
  File "/usr/local/lib/python3.8/dist-packages/traitlets/config/application.py", line 992, in launch_instance
    app.start()
  File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelapp.py", line 612, in start
    self.io_loop.start()
  File "/usr/local/lib/python3.8/dist-packages/tornado/platform/asyncio.py", line 149, in start
    self.asyncio_loop.run_forever()
  File "/usr/lib/python3.8/asyncio/base_events.py", line 570, in run_forever
    self._run_once()
  File "/usr/lib/python3.8/asyncio/base_events.py", line 1859, in _run_once
    handle._run()
  File "/usr/lib/python3.8/asyncio/events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.8/dist-packages/tornado/ioloop.py", line 690, in <lambda>
    lambda f: self._run_callback(functools.partial(callback, future))
  File "/usr/local/lib/python3.8/dist-packages/tornado/ioloop.py", line 743, in _run_callback
    ret = callback()
  File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 787, in inner
    self.run()
  File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 748, in run
    yielded = self.gen.send(value)
  File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 365, in process_one
    yield gen.maybe_future(dispatch(*args))
  File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 209, in wrapper
    yielded = next(result)
  File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 268, in dispatch_shell
    yield gen.maybe_future(handler(stream, idents, msg))
  File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 209, in wrapper
    yielded = next(result)
  File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 543, in execute_request
    self.do_execute(
  File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 209, in wrapper
    yielded = next(result)
  File "/usr/local/lib/python3.8/dist-packages/ipykernel/ipkernel.py", line 306, in do_execute
    res = shell.run_cell(code, store_history=store_history, silent=silent)
  File "/usr/local/lib/python3.8/dist-packages/ipykernel/zmqshell.py", line 536, in run_cell
    return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 2854, in run_cell
    result = self._run_cell(
  File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 2881, in _run_cell
    return runner(coro)
  File "/usr/local/lib/python3.8/dist-packages/IPython/core/async_helpers.py", line 68, in _pseudo_sync_runner
    coro.send(None)
  File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 3057, in run_cell_async
    has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
  File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 3249, in run_ast_nodes
    if (await self.run_code(code, result,  async_=asy)):
  File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 3326, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-28-2966d0b0f166>", line 2, in <module>
    model = tf.keras.models.load_model(f'/content/drive/MyDrive/Colab Notebooks/models/{model_name}')
  File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 64, in error_handler
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/keras/saving/save.py", line 209, in load_model
    return saved_model_load.load(filepath_str, compile, options)
  File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 135, in load
    keras_loader.load_layers(compile=compile)
  File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 399, in load_layers
    self.loaded_nodes[node_metadata.node_id] = self._load_layer(
  File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 441, in _load_layer
    obj, setter = self._revive_from_config(identifier, metadata, node_id)
  File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 459, in _revive_from_config
    self._revive_layer_or_model_from_config(metadata, node_id))
  File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 523, in _revive_layer_or_model_from_config
    obj = layers_module.deserialize(
  File "/usr/local/lib/python3.8/dist-packages/keras/layers/serialization.py", line 205, in deserialize
    return generic_utils.deserialize_keras_object(
  File "/usr/local/lib/python3.8/dist-packages/keras/utils/generic_utils.py", line 686, in deserialize_keras_object
    deserialized_obj = cls.from_config(cls_config)
  File "/usr/local/lib/python3.8/dist-packages/keras/engine/base_layer_v1.py", line 515, in from_config
    return cls(**config)
  File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 64, in error_handler
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/keras/engine/input_layer.py", line 200, in __init__
    input_tensor = backend.placeholder(
  File "/usr/local/lib/python3.8/dist-packages/keras/backend.py", line 1386, in placeholder
    x = tf.compat.v1.placeholder(dtype, shape=shape, name=name)
  File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/ops/array_ops.py", line 3346, in placeholder
    return gen_array_ops.placeholder(dtype=dtype, shape=shape, name=name)
  File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 6893, in placeholder
    _, _, _op, _outputs = _op_def_library._apply_op_helper(
  File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/framework/op_def_library.py", line 797, in _apply_op_helper
    op = g._create_op_internal(op_type_name, inputs, dtypes=None,
  File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/framework/ops.py", line 3754, in _create_op_internal
    ret = Operation(
  File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/framework/ops.py", line 2133, in __init__
    self._traceback = tf_stack.extract_stack_for_node(self._c_op)
'''


来源: stackexchange

问:
Javascript ReferenceError while using jest.mock method
I am trying to understand the jest unit testing framework in Javascript and specifically mocking modules part by following this article: https://medium.com/@rickhanlonii/understanding-jest-mocks-f0046c68e53c However, when I try to use jest.mock() to mock my module, I get this error: ReferenceError: require is not defined

This is my math module that I am trying to mock:

```<code>export function add(a, b) {
  return a + b;
}

export function subtract(a, b) {
  return a - b;
}
</code>```

Here's my test file:

```<code>import * as mathlib from '../mathlib';
import * as math from '../math';
import {jest, describe, test, expect} from '@jest/globals';

jest.mock('../math.js');

describe('math', () => {
  test('adds numbers', () => {
    mathlib.doAdd(1,2);
    expect(math.add).toHaveBeenCalledWith(1,2);
  })
})
</code>```

Here's the package.json file:

```<code>{
  "name": "sample",
  "version": "1.0.0",
  "description": "sample package to learn jest",
  "main": "index.js",
  "scripts": {
    "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
  },
  "author": "rakesh",
  "license": "ISC",
  "devDependencies": {
    "jest": "^29.3.1"
  },
  "type": "module"
}
</code>```

Can someone help me fix this issue?

ContentLicense: CC BY-SA 4.0

Body:
I am trying to understand the jest unit testing framework in Javascript and specifically mocking modules part by following this article: https://medium.com/@rickhanlonii/understanding-jest-mocks-f0046c68e53c However, when I try to use jest.mock() to mock my module, I get this error: ReferenceError: require is not defined

This is my math module that I am trying to mock:

export function add(a, b) {
  return a + b;
}

export function subtract(a, b) {
  return a - b;
}

Here's my test file:

import * as mathlib from '../mathlib';
import * as math from '../math';
import {jest, describe, test, expect} from '@jest/globals';

jest.mock('../math.js');

describe('math', () => {
  test('adds numbers', () => {
    mathlib.doAdd(1,2);
    expect(math.add).toHaveBeenCalledWith(1,2);
  })
})

Here's the package.json file:

{
  "name": "sample",
  "version": "1.0.0",
  "description": "sample package to learn jest",
  "main": "index.js",
  "scripts": {
    "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
  },
  "author": "rakesh",
  "license": "ISC",
  "devDependencies": {
    "jest": "^29.3.1"
  },
  "type": "module"
}

Can someone help me fix this issue?


问:
Remote extensions do not show through VSCode+RemoteSSH
I have a remote server on which I connect using the RemoteSSH extension.

I connect to remote from two different computers, say A (home) and B (work).
The remote has various extensions (eg, Python, Julia, Jupyter, etc) installed.

When I work on remote from A, everything is ok. I can for example select Python interpreters.

When I connect to remote using B, VSCode no longer finds interpreters. Indeed I cannot even find the settings extensions (see picture). But it is the same remote I connect to.


问:
how to http post from clicking dropdown menu item and get response to screen in flutter
I have fetched dropdown menuitem from the serve, and now i have successfully post id when item is clicked and the response is shown in console window. the problem is how to display those console data(json data) to flutter screen

To get the data from console window to flutter screen


问:
Table cell click which will redirect to an updated table?
I have an API which has a bunch of data in it. I should be able to click the first column with the header "Symbol" which then goes to a completely new, updated table. This is how it looks before the cell click. This is what happens though after I click a cell. The page goes blank even though the URL has updated based on my code. What I want to happen is after the cell click, the table updates with new column headers and row values, based on the "symbol" I clicked, with data filling the table from the API.

When I click on a cell, it goes to a brand new page based on that cell (so like /history/A), but how am I supposed to create a .js file for 500 different cell values?

I am using a useTable hook with react-table-v7, and I have a separate Table.js file for the layout.

```<code>function Stocks() {
  const [data, setData] = useState([]);

useEffect(() => {
  axios(`http://localhost:3000/all`)
    .then((res) => {
      setData(res.data);
    })
    .catch((err) => console.log(err))
}, []);

const columns = useMemo(
  () => [
    {
      Header: "Stock search",
      columns: [
        {
          Header: "Symbol",
          accessor: "symbol",
          Cell: ({ row }) => (<Link to={{ pathname: `/history/${row.original.symbol} `}}>{row.original.symbol}</Link>)
        },
        {
          Header: "Name",
          accessor: "name",
        },
        {
          Header: "Industry",
          accessor: "industry",
        },
      ],
    },
  ],
  []
)

return (
  <div className="Stocks">
    <Table
    columns={columns}
    data={data}
    />
  </div>
);
}
</code>```

I have no errors, warnings or issues on my dev tools either.

Body:
I have an API which has a bunch of data in it. I should be able to click the first column with the header "Symbol" which then goes to a completely new, updated table. This is how it looks before the cell click. This is what happens though after I click a cell. The page goes blank even though the URL has updated based on my code. What I want to happen is after the cell click, the table updates with new column headers and row values, based on the "symbol" I clicked, with data filling the table from the API.

When I click on a cell, it goes to a brand new page based on that cell (so like /history/A), but how am I supposed to create a .js file for 500 different cell values?

I am using a useTable hook with react-table-v7, and I have a separate Table.js file for the layout.

function Stocks() {
  const [data, setData] = useState([]);

useEffect(() => {
  axios(`http://localhost:3000/all`)
    .then((res) => {
      setData(res.data);
    })
    .catch((err) => console.log(err))
}, []);

const columns = useMemo(
  () => [
    {
      Header: "Stock search",
      columns: [
        {
          Header: "Symbol",
          accessor: "symbol",
          Cell: ({ row }) => (<Link to={{ pathname: `/history/${row.original.symbol} `}}>{row.original.symbol}</Link>)
        },
        {
          Header: "Name",
          accessor: "name",
        },
        {
          Header: "Industry",
          accessor: "industry",
        },
      ],
    },
  ],
  []
)

return (

);
}

I have no errors, warnings or issues on my dev tools either.


问:
What is the most efficency way to find index in large dataframe
I have a large dataframe(6M rows) and it's like below

Column A
Column B

000001
AB1234

000002
CD1234

The Column A is unique but Column B is not
I have some index list to query this large df and I want to get the Column B value for every index as my result.
index list is like below and I have 4K such lists and the length of each list is big.
query_list = ['000002', '000003', '000014', '000101']

Running on Python3.x, Jupyter Notebook, Pandas 1.3.x

I have tried df.query() and df[df["column name"].str.contain.()] but both of them take many time.

df.query() cost 57x s

df[df["column name"].str.contain.()] cost 7xx s

And I have also tried to run this code with Pool.map() but it didn't work.

Is there any solution?


问:
Add an array object to c3 library as a data (c3 - chart library)
I need help with c3.js library,
It's about the input of "data"

Thank in advance!!!

I had an array:  Arr = [[1, 2, 3], [4, 5, 6], [7, 8 ,9]]
How can I draw 3 different lines for 3 element of Arr?

```<code>var chart = c3.generate({
    bindto: '#chart',
    data: {
      columns: [
        **Arr**
      ],
})
</code>```

And also want to change the tooltip's title, every point has a different content, for example:
when I hover the point: Arr[0][1], its content is [no2]
Arr[0][2], its content is [no3], Arr[1][0], its content is [no4],...

Body:
I need help with c3.js library,
It's about the input of "data"

Thank in advance!!!

I had an array:  Arr = [[1, 2, 3], [4, 5, 6], [7, 8 ,9]]
How can I draw 3 different lines for 3 element of Arr?

var chart = c3.generate({
    bindto: '#chart',
    data: {
      columns: [
        **Arr**
      ],
})

And also want to change the tooltip's title, every point has a different content, for example:
when I hover the point: Arr[0][1], its content is [no2]
Arr[0][2], its content is [no3], Arr[1][0], its content is [no4],...


问:
What are LMD files in flow cytometry?
I'm currently working with flow cytometry data and have files with the FCS 2.0, 3.0 and 3.1 standard. For those I found the specifications online. But I came across some .lmd files. They behave like fcs files, so I don't have a problem reading them, but I couldn't find a specification nor what the LMD stands for. Maybe someone knows what they are or where to get the specification from.

Thx and best wishes
Max

Title: What are LMD files in flow cytometry?


问:
My trained model return the same predict for all input images
I'm very new to this. I just trained a model following instruction from kaggle and another website. The trained model works fine with train images but whenever i try to input a new image to predict, the result is always the same.
The accuracy is 0.9975000023841858
`

```<code>X_train = np.array(X_train)
X_test = np.array(X_test)

X_train = np.expand_dims(X_train, axis=3)
X_test = np.expand_dims(X_test, axis=3)

</code>```

Here is the model

```<code>weight_decay = 1e-4

num_classes = 12

model = Sequential()

model.add(Conv2D(64, (4,4), padding='same', kernel_regularizer=regularizers.l2(weight_decay), input_shape=(128,128,1)))
model.add(Activation('elu'))
model.add(BatchNormalization())
model.add(Conv2D(64, (4,4), padding='same', kernel_regularizer=regularizers.l2(weight_decay)))
model.add(Activation('elu'))
model.add(BatchNormalization())
model.add(MaxPooling2D(pool_size=(2,2)))
model.add(Dropout(0.2))

model.add(Conv2D(128, (4,4), padding='same', kernel_regularizer=regularizers.l2(weight_decay)))
model.add(Activation('elu'))
model.add(BatchNormalization())
model.add(Conv2D(128, (4,4), padding='same', kernel_regularizer=regularizers.l2(weight_decay)))
model.add(Activation('elu'))
model.add(BatchNormalization())
model.add(MaxPooling2D(pool_size=(2,2)))
model.add(Dropout(0.3))

model.add(Conv2D(128, (4,4), padding='same', kernel_regularizer=regularizers.l2(weight_decay)))
model.add(Activation('elu'))
model.add(BatchNormalization())
model.add(Conv2D(128, (4,4), padding='same', kernel_regularizer=regularizers.l2(weight_decay)))
model.add(Activation('elu'))
model.add(BatchNormalization())
model.add(MaxPooling2D(pool_size=(2,2)))
model.add(Dropout(0.4))

model.add(Flatten())
model.add(Dense(128, activation="linear"))
model.add(Activation('elu'))
model.add(Dense(num_classes, activation='softmax'))

model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])

model.fit(X_train, y_train,
                    epochs=5,
                    validation_data=(X_test,y_test),
                    verbose = 1,
                    initial_epoch=0)

</code>```

`

When i tried to test the train image

`

```<code>predicted_classes = model.predict(X_train[:,:,:,:])
predicted_classes = np.argmax(np.round(predicted_classes), axis=1)

k = X_train.shape[0] #18000
r = np.random.randint(k) #random in 18000
print("Prediction:", predicted_classes[4])

</code>```

 Prediction: 8`

My input image

`

```<code>imgTest = tf.keras.utils.load_img('/content/drive/My Drive/Colab Notebooks/finger.jpg')
imgTest = np.array(imgTest)
imgTest = cv2.cvtColor(imgTest, cv2.COLOR_BGR2GRAY)
imgTest = cv2.resize(imgTest, (128, 128))
imgTest = np.expand_dims(imgTest, axis=0)
# imgTest = imgTest.reshape((1, 128, 128, 1, 1, 1))
# imgTest = imgTest/255
print(imgTest.shape)
predicted_classes_test = model.predict(imgTest)
predicted_classes_test = np.argmax(np.round(predicted_classes_test), axis=1)
print("Prediction:", predicted_classes_test)
</code>```

 Prediction: [7]`

I tried changing the shape of the input image so that it's the same as the train images but doesn't work
I looked for people having the same mistake to see if i can find any solutions but nothing works
Can somebody tell me what's wrong with the model? Why is it return the same value for all the images that i input?

Body:
I'm very new to this. I just trained a model following instruction from kaggle and another website. The trained model works fine with train images but whenever i try to input a new image to predict, the result is always the same.
The accuracy is 0.9975000023841858
`

X_train = np.array(X_train)
X_test = np.array(X_test)

X_train = np.expand_dims(X_train, axis=3)
X_test = np.expand_dims(X_test, axis=3)

Here is the model

weight_decay = 1e-4

num_classes = 12

model = Sequential()

model.add(Conv2D(64, (4,4), padding='same', kernel_regularizer=regularizers.l2(weight_decay), input_shape=(128,128,1)))
model.add(Activation('elu'))
model.add(BatchNormalization())
model.add(Conv2D(64, (4,4), padding='same', kernel_regularizer=regularizers.l2(weight_decay)))
model.add(Activation('elu'))
model.add(BatchNormalization())
model.add(MaxPooling2D(pool_size=(2,2)))
model.add(Dropout(0.2))

model.add(Conv2D(128, (4,4), padding='same', kernel_regularizer=regularizers.l2(weight_decay)))
model.add(Activation('elu'))
model.add(BatchNormalization())
model.add(Conv2D(128, (4,4), padding='same', kernel_regularizer=regularizers.l2(weight_decay)))
model.add(Activation('elu'))
model.add(BatchNormalization())
model.add(MaxPooling2D(pool_size=(2,2)))
model.add(Dropout(0.3))

model.add(Conv2D(128, (4,4), padding='same', kernel_regularizer=regularizers.l2(weight_decay)))
model.add(Activation('elu'))
model.add(BatchNormalization())
model.add(Conv2D(128, (4,4), padding='same', kernel_regularizer=regularizers.l2(weight_decay)))
model.add(Activation('elu'))
model.add(BatchNormalization())
model.add(MaxPooling2D(pool_size=(2,2)))
model.add(Dropout(0.4))

model.add(Flatten())
model.add(Dense(128, activation="linear"))
model.add(Activation('elu'))
model.add(Dense(num_classes, activation='softmax'))

model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])

model.fit(X_train, y_train,
                    epochs=5,
                    validation_data=(X_test,y_test),
                    verbose = 1,
                    initial_epoch=0)

`

When i tried to test the train image

`

predicted_classes = model.predict(X_train[:,:,:,:])
predicted_classes = np.argmax(np.round(predicted_classes), axis=1)

k = X_train.shape[0] #18000
r = np.random.randint(k) #random in 18000
print("Prediction:", predicted_classes[4])

 Prediction: 8`

My input image

`

imgTest = tf.keras.utils.load_img('/content/drive/My Drive/Colab Notebooks/finger.jpg')
imgTest = np.array(imgTest)
imgTest = cv2.cvtColor(imgTest, cv2.COLOR_BGR2GRAY)
imgTest = cv2.resize(imgTest, (128, 128))
imgTest = np.expand_dims(imgTest, axis=0)
# imgTest = imgTest.reshape((1, 128, 128, 1, 1, 1))
# imgTest = imgTest/255
print(imgTest.shape)
predicted_classes_test = model.predict(imgTest)
predicted_classes_test = np.argmax(np.round(predicted_classes_test), axis=1)
print("Prediction:", predicted_classes_test)

 Prediction: [7]`

I tried changing the shape of the input image so that it's the same as the train images but doesn't work
I looked for people having the same mistake to see if i can find any solutions but nothing works
Can somebody tell me what's wrong with the model? Why is it return the same value for all the images that i input?


问:
Typeorm synchronize throws QueryFailedError: Could not drop constraint. See previous errors
I'm trying to connect to a Microsoft SQL DB having synchronize: true option within TypeORM but it seems it doesn't work for some reason and I can't figure out why.

main.module.ts

```<code>providers: [
{
      provide: "OMS_DB",
      useFactory: async () => {
        const connection = new DatabaseConnection(
          new DatabaseConfiguration("OMS_DATABASE"),
          [OMSOrderDto, OMSOrderLinesDto],
            false
        );
        if (await connection.connect()) {
          return connection;
        }
        return null;
      },
    },
]
</code>```

database.connection.ts

```<code>constructor(
    private configuration: DatabaseConfiguration,
    private entities?: any,
    private synchronize = false
  ) {}

  /**
   * Creates the actual connection
   */
  async connect(): Promise<boolean> {
    const config: DataSourceOptions = {
      name: this.configuration.name,
      type: "mssql",
      host: this.configuration.hostname || "localhost",
      port: this.configuration.port || 1433,
      username: this.configuration.username,
      password: this.configuration.password,
      database: this.configuration.database,
      entities: this.entities,
      synchronize: false,
      //logging: "all",
      extra: {
        trustServerCertificate: true,
      },
    };

    this.logger.debug(
      `Connecting to MSSQL Database ${this.configuration.hostname} / ${this.configuration.database}`
    );
    try {
      this.connection = new DataSource(config);
      await this.connection.initialize();
      this.logger.log(`Conected to DB: ${this.configuration.hostname} / ${this.configuration.database}!`);
      return true;
    } catch (ex) {
      this.logger.error(`Failed to connect to the database: ${this.configuration.name}`);
      this.logger.error(ex);
    }

    return false;
  }
</code>```

Throwing Error:

Could not drop constraint. See previous errors.

I don't see any other errors.

Body:
I'm trying to connect to a Microsoft SQL DB having synchronize: true option within TypeORM but it seems it doesn't work for some reason and I can't figure out why.

main.module.ts

providers: [
{
      provide: "OMS_DB",
      useFactory: async () => {
        const connection = new DatabaseConnection(
          new DatabaseConfiguration("OMS_DATABASE"),
          [OMSOrderDto, OMSOrderLinesDto],
            false
        );
        if (await connection.connect()) {
          return connection;
        }
        return null;
      },
    },
]

database.connection.ts

constructor(
    private configuration: DatabaseConfiguration,
    private entities?: any,
    private synchronize = false
  ) {}

  /**
   * Creates the actual connection
   */
  async connect(): Promise<boolean> {
    const config: DataSourceOptions = {
      name: this.configuration.name,
      type: "mssql",
      host: this.configuration.hostname || "localhost",
      port: this.configuration.port || 1433,
      username: this.configuration.username,
      password: this.configuration.password,
      database: this.configuration.database,
      entities: this.entities,
      synchronize: false,
      //logging: "all",
      extra: {
        trustServerCertificate: true,
      },
    };

    this.logger.debug(
      `Connecting to MSSQL Database ${this.configuration.hostname} / ${this.configuration.database}`
    );
    try {
      this.connection = new DataSource(config);
      await this.connection.initialize();
      this.logger.log(`Conected to DB: ${this.configuration.hostname} / ${this.configuration.database}!`);
      return true;
    } catch (ex) {
      this.logger.error(`Failed to connect to the database: ${this.configuration.name}`);
      this.logger.error(ex);
    }

    return false;
  }

Throwing Error:

Could not drop constraint. See previous errors.

I don't see any other errors.


问:
how to update an existed data using spingboot and thymeleaf?
Using Kotlin.
I'm trying to update a User object by:

send old user to update page;

```<code>@GetMapping("/update/{id}")
    fun updateUser(@PathVariable(value = "id") id: Int, model: Model): String {
        val user = userService.findUserByUid(id)
        model.addAttribute("user", user)
        if (user.uid != 1)
            model.addAttribute("allRoles", userService.addUserRole())
        else
            model.addAttribute("allRoles", userService.adminRole())
        return "updateUser"
    }
</code>```

change some vars of that user in html page;

```<code> <form action="#" th:action="@{/userManagement/update}" th:object="${user}" method="POST">
        <label>昵称</label>
        <input type ="text" th:field = "*{usernickname}" placeholder="usernickname" class="form-control mb-4 col-4">
        <br>
        <label>密码</label>
        <input type ="password" th:field = "*{password}" placeholder="password" class="form-control mb-4 col-4">
        <div>
            <label>职位:
                <input type="radio" name="roles"
                       th:each="myRole : ${allRoles}"
                       th:text="${myRole.name()}"
                       th:value="${myRole}"
                       th:field="*{usertype}"
                       th:attr ="checked=${myRole.ordinal()==0?true:false}"
                />
            </label>
        </div>
        <br>
        <button type="submit" class="btn btn-update">更新员工</button>
    </form>
</code>```

update user data.

```<code> @PostMapping(path = ["/update"])
    fun updateEmployee(@ModelAttribute("user") user: User, model: Model): String {
        try {
            user.password = passwordConfig.passwordEncoder().encode(user.password)
            userService.updateUser(user)
        } catch (ex: RuntimeException) {
            model.addAttribute("error", ex.message)
            if (user.uid != 1)
                model.addAttribute("allRoles", userService.addUserRole())
            else
                model.addAttribute("allRoles", userService.adminRole())
            return "updateUser"
        }
        return "redirect:/userManagement/"
    }
</code>```

The problem is, at phase 3, the user object i recieved have only usernickname, password and role, other vars becomes null.

For example, at phase 1, the user object is like{uid=5,username=aaa,usernickname=bbb,password=****,usertype=MANAGER,usergroup=DEFAULT,bugList={}}

and when i changed nickname and password at updateUser page, then push that commit btn, the user object at phase 3 will be{uid=0,username=null,usernickname=ccc,password=*****,usertype=MANAGER,usergroup=null,bugList=null}

it seems like phase 1 didnot run correctly, the user object i want to transmit didnot transmited.

I think it is caused by wrong syntax, but i cannot find how to solve it.

update:
User entity:

```<code>@Entity
class User {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    var uid = 0

    lateinit var password: String

    lateinit var username: String

    lateinit var usernickname: String

    lateinit var usertype: UserRole

    @ManyToOne(fetch= FetchType.EAGER, optional = true)
    @JoinColumn(name="groupid")
    lateinit var usergroup: UserGroup

    @OneToMany(mappedBy = "bid")
    lateinit var bugList: List<Bug>

    constructor(
        password: String,
        username: String,
        usernickname: String,
        usertype: UserRole,
        usergroup: UserGroup
    ) {
        this.password = password
        this.username = username
        this.usernickname = usernickname
        this.usertype = usertype
        this.usergroup = usergroup
    }

    constructor()
}
</code>```

UserRole:

```<code>enum class UserRole {
    ADMIN, PROGRAMMER, TESTER, MANAGER;

    val roleAuthority: GrantedAuthority
        get() = SimpleGrantedAuthority("ROLE_$name")
}
</code>```

Body:
Using Kotlin.
I'm trying to update a User object by:

send old user to update page;

@GetMapping("/update/{id}")
    fun updateUser(@PathVariable(value = "id") id: Int, model: Model): String {
        val user = userService.findUserByUid(id)
        model.addAttribute("user", user)
        if (user.uid != 1)
            model.addAttribute("allRoles", userService.addUserRole())
        else
            model.addAttribute("allRoles", userService.adminRole())
        return "updateUser"
    }

change some vars of that user in html page;

 <form action="#" th:action="@{/userManagement/update}" th:object="${user}" method="POST">
        昵称
        <input type ="text" th:field = "*{usernickname}" placeholder="usernickname" class="form-control mb-4 col-4">

        密码
        <input type ="password" th:field = "*{password}" placeholder="password" class="form-control mb-4 col-4">

            职位:
                <input type="radio" name="roles"
                       th:each="myRole : ${allRoles}"
                       th:text="${myRole.name()}"
                       th:value="${myRole}"
                       th:field="*{usertype}"
                       th:attr ="checked=${myRole.ordinal()==0?true:false}"
                />

        <button type="submit" class="btn btn-update">更新员工</button>
    </form>

update user data.

 @PostMapping(path = ["/update"])
    fun updateEmployee(@ModelAttribute("user") user: User, model: Model): String {
        try {
            user.password = passwordConfig.passwordEncoder().encode(user.password)
            userService.updateUser(user)
        } catch (ex: RuntimeException) {
            model.addAttribute("error", ex.message)
            if (user.uid != 1)
                model.addAttribute("allRoles", userService.addUserRole())
            else
                model.addAttribute("allRoles", userService.adminRole())
            return "updateUser"
        }
        return "redirect:/userManagement/"
    }

The problem is, at phase 3, the user object i recieved have only usernickname, password and role, other vars becomes null.

For example, at phase 1, the user object is like{uid=5,username=aaa,usernickname=bbb,password=****,usertype=MANAGER,usergroup=DEFAULT,bugList={}}

and when i changed nickname and password at updateUser page, then push that commit btn, the user object at phase 3 will be{uid=0,username=null,usernickname=ccc,password=*****,usertype=MANAGER,usergroup=null,bugList=null}

it seems like phase 1 didnot run correctly, the user object i want to transmit didnot transmited.

I think it is caused by wrong syntax, but i cannot find how to solve it.

update:
User entity:

@Entity
class User {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    var uid = 0

    lateinit var password: String

    lateinit var username: String

    lateinit var usernickname: String

    lateinit var usertype: UserRole

    @ManyToOne(fetch= FetchType.EAGER, optional = true)
    @JoinColumn(name="groupid")
    lateinit var usergroup: UserGroup

    @OneToMany(mappedBy = "bid")
    lateinit var bugList: List<Bug>

    constructor(
        password: String,
        username: String,
        usernickname: String,
        usertype: UserRole,
        usergroup: UserGroup
    ) {
        this.password = password
        this.username = username
        this.usernickname = usernickname
        this.usertype = usertype
        this.usergroup = usergroup
    }

    constructor()
}

UserRole:

enum class UserRole {
    ADMIN, PROGRAMMER, TESTER, MANAGER;

    val roleAuthority: GrantedAuthority
        get() = SimpleGrantedAuthority("ROLE_$name")
}


问:
Google Recaptcha Serverside validation V3 Not getting response
Error Message We detected that your site is not verifying reCAPTCHA solutions. This is required for the proper use of reCAPTCHA on your site. Please see our developer site for more information. I created this reCaptcha code, it works well but I don not know how can I validate it, I thought it was validating with the function grecaptcha.getResponse(); but it was not so. Then I check the server side validation API call on POSTMAN but it is not getting Success message . Any one know the solution please help. If i miss any parameter to pass through the API call.

```<code>$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.google.com/recaptcha/api/siteverify");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
'secret'   => 6LcIwEwjAAAAAM7KEVDbW4Q6DCWBz_ErUc1l5sYPssggfdfdfdfdf,
 'response' => 'user response token',]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);
$response = @json_decode($data);
if ($response && $response->success)
{ // validation succeeded, user input is correct
}
</code>```

Please help and Please check the image attached

Image2

Body:
Error Message We detected that your site is not verifying reCAPTCHA solutions. This is required for the proper use of reCAPTCHA on your site. Please see our developer site for more information. I created this reCaptcha code, it works well but I don not know how can I validate it, I thought it was validating with the function grecaptcha.getResponse(); but it was not so. Then I check the server side validation API call on POSTMAN but it is not getting Success message . Any one know the solution please help. If i miss any parameter to pass through the API call.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.google.com/recaptcha/api/siteverify");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
'secret'   => 6LcIwEwjAAAAAM7KEVDbW4Q6DCWBz_ErUc1l5sYPssggfdfdfdfdf,
 'response' => 'user response token',]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);
$response = @json_decode($data);
if ($response && $response->success)
{ // validation succeeded, user input is correct
}

Please help and Please check the image attached

Image2


问:
filter on multiple selected columns and one condition
Working with a larga dataset I am using dplyr and the tidyverse. Regarding subsetting based on conditions the following problem came up. Working conditions are:

```<code>filter_if(is.numeric, all_vars(. > 0 & .< 1)
</code>```

or

```<code>mutate_at(vars(starts_with("x")), ~na_if(., 0))
</code>```

but what to do, if I want to combine the two "types":

```<code>filter_at(vars(starts_with("x")), any_vars(. < 10))
</code>```

or

```<code>filter_at(vars(starts_with("x")), all_vars(. < 10))
</code>```

does not work. How to solve this? Thanks!

Body:
Working with a larga dataset I am using dplyr and the tidyverse. Regarding subsetting based on conditions the following problem came up. Working conditions are:

filter_if(is.numeric, all_vars(. > 0 & .< 1)

or

mutate_at(vars(starts_with("x")), ~na_if(., 0))

but what to do, if I want to combine the two "types":

filter_at(vars(starts_with("x")), any_vars(. < 10))

or

filter_at(vars(starts_with("x")), all_vars(. < 10))

does not work. How to solve this? Thanks!


问:
Nginx routing with hashtag and to different pages
I need to update my nginx .conf file for a site that will be moved on another domain and to another platform.
My conf looks like this:

```<code>server
{
  listen       443;
  server_name  site1.domain.com;
  return 301 https://site2.com$request_uri;
}
</code>```

plus certificates etc.

The specific question is that i need to forward/rewrite 4 specific page, with the hashtag, to 4 different links.

site1.domain.com/request/#/ -> site2.com

site1.domain.com/request/#/ordering -> site2.com/ordering

site1.domain.com/request/#/products -> site2.com/products

site1.domain.com/request/#/distribution -> site2.com/distribution

What's the best method to achieve this?

Thanks,

Mvrck

i've tried different regex, but i'm not so skilled in that.

Body:
I need to update my nginx .conf file for a site that will be moved on another domain and to another platform.
My conf looks like this:

server
{
  listen       443;
  server_name  site1.domain.com;
  return 301 https://site2.com$request_uri;
}

plus certificates etc.

The specific question is that i need to forward/rewrite 4 specific page, with the hashtag, to 4 different links.

site1.domain.com/request/#/ -> site2.com

site1.domain.com/request/#/ordering -> site2.com/ordering

site1.domain.com/request/#/products -> site2.com/products

site1.domain.com/request/#/distribution -> site2.com/distribution

What's the best method to achieve this?

Thanks,

Mvrck

i've tried different regex, but i'm not so skilled in that.


问:
Parse server unsubscribe all users from a channel
I have a Parse server where user can do a one-time subscription to a few events.

Some Installations will be subscribed to a few channels like: ["Event1", "Event2"].
Some installations will subscribed to one channel like ["Event1"]

When a specific event happens, users subscribed to that event should be notified once only. They have to subscribe again to get notification when that Event1 happens.

How should I bulk update all installations, so that, let's say when "Event1" happened, I can remove "Event1" from thousands of installations?

I am worried that if I do something like these:

```<code>var query = new Parse.Query(Parse.Installation);
query.equalTo('channels', channel);
query.limit(1000);
const installations = await query.find({useMasterKey:true});
...for loop to update these installations individually
</code>```

I will easily hit a the find limit, and that means if I have 20k installations with Event1 I can't really clean them up easily in one shot.

Is there any other simple method to unsubscribe all users from one channel?

Body:
I have a Parse server where user can do a one-time subscription to a few events.

Some Installations will be subscribed to a few channels like: ["Event1", "Event2"].
Some installations will subscribed to one channel like ["Event1"]

When a specific event happens, users subscribed to that event should be notified once only. They have to subscribe again to get notification when that Event1 happens.

How should I bulk update all installations, so that, let's say when "Event1" happened, I can remove "Event1" from thousands of installations?

I am worried that if I do something like these:

var query = new Parse.Query(Parse.Installation);
query.equalTo('channels', channel);
query.limit(1000);
const installations = await query.find({useMasterKey:true});
...for loop to update these installations individually

I will easily hit a the find limit, and that means if I have 20k installations with Event1 I can't really clean them up easily in one shot.

Is there any other simple method to unsubscribe all users from one channel?


问:
What is Laravel Sanctum supposed to be able to do?
To be honest, I don't understand the concept of Laravel Sanctum. Before there was Sanctum, people used JWT. That always worked very well. In other frameworks in the Node context, I only use JWT. I am very confused by the paragraph about the SPA Auth (https://laravel.com/docs/9.x/sanctum#how-it-works-spa-authentication). It talks about Sanactum also using the web auth. Does that mean that if I log in via the web route (auth), I can also use the api route (auth:sanctum)?

Thanks! Max


问:
PLS-306: wrong number or types of arguments in call to 'SDO_NN'
I'm trying to SDO_NN or Oracle SQL Developer. I've run the query on one server and it worked fine. I then copied it to a different server and changed just the table names since the second server has the same tables but slightly different names, the columns are the same but in the new server it is throwing an error.

Apart from changing the table names everything else is the same in the query. The only thing I can thing of is different versions of Oracle on the two servers. It is working on a server running Oracle 19c EE but failing on the server running 11g EE.

Query:

select WBAN,
       STATION_NAME,
       EXCH_NAME,
       sdo_nn_distance (1) distance_in_km,
       GEOM_LAT_LON
FROM   SCHEMA.WEATHER_DATA,
       SCHEMA.EXCH_GEOM
WHERE  SDO_NN(WEATHER_DATA.GEOM_LAT_LON, EXCH_GEOM.GEOM, 'sdo_num_res=1 distance=40 unit=kilometer') ='TRUE'
ORDER BY EXCH_NAME
```
<p>Error:</p>
<pre class="lang-none prettyprint-override"><code>ORA-29900: operator binding does not exist
ORA-06553: PLS-306: wrong number or types of arguments in call to 'SDO_NN'
29900. 00000 -  "operator binding does not exist"
*Cause:    There is no binding for the current usage of the operator.
*Action:   Change the operator arguments to match any of the existing
           bindings or add a new binding to the operator.
Error at Line: 221 Column: 7
</code>```

I'm trying a spatial query to identify the nearest entry in the EXCH_GEOM table to the WEATHER_DATA table within 40km.

Body:
I'm trying to SDO_NN or Oracle SQL Developer. I've run the query on one server and it worked fine. I then copied it to a different server and changed just the table names since the second server has the same tables but slightly different names, the columns are the same but in the new server it is throwing an error.

Apart from changing the table names everything else is the same in the query. The only thing I can thing of is different versions of Oracle on the two servers. It is working on a server running Oracle 19c EE but failing on the server running 11g EE.

Query:

select WBAN,
       STATION_NAME,
       EXCH_NAME,
       sdo_nn_distance (1) distance_in_km,
       GEOM_LAT_LON
FROM   SCHEMA.WEATHER_DATA,
       SCHEMA.EXCH_GEOM
WHERE  SDO_NN(WEATHER_DATA.GEOM_LAT_LON, EXCH_GEOM.GEOM, 'sdo_num_res=1 distance=40 unit=kilometer') ='TRUE'
ORDER BY EXCH_NAME

Error:

ORA-29900: operator binding does not exist
ORA-06553: PLS-306: wrong number or types of arguments in call to 'SDO_NN'
29900. 00000 -  "operator binding does not exist"
*Cause:    There is no binding for the current usage of the operator.
*Action:   Change the operator arguments to match any of the existing
           bindings or add a new binding to the operator.
Error at Line: 221 Column: 7

I'm trying a spatial query to identify the nearest entry in the EXCH_GEOM table to the WEATHER_DATA table within 40km.


问:
How to write Test case for mouseleave event
I wrote a testcase for the mouseout event, however it does not cover the entire function, instead stopping in the if condition.

Functionality
While hovering the mouse over the State Change in the picture. I'll display the submenu below; mouseleave should hide the submenu. I simply need to write a testcase for the mouseout method.

I believe the fake object onMouseOut(event) is incorrect. Could you possibly assist me in resolving the issue?

HTML

```<code><li class="dropdown-item option-value" (mouseleave)="onMouseOut($event)">
</code>```

TS

```<code>  onMouseOut(event): void {
    this.pageDividerActionOption.forEach(element => {
      if (event.target.innerText === element.option) {
        this.pageActionSubOption = [];
      }
    })
  }
</code>```

Spec.ts

```<code>it(' mouse leave hide the suboption list', fakeAsync(() => {
  const data = { target: { innerText: 'Change State' }};
  const div = fixture.debugElement.query(By.css('.option-value'));
  let event = new MouseEvent('mouseleave', {
      bubbles: true,
      cancelable: true,
      view: window
  });
  div.nativeElement.dispatchEvent(event);
  tick();
  fixture.detectChanges();
  spyOn(component, 'onMouseOut') // spy first
component.onMouseOut(data)
fixture.detectChanges();
  expect(component.onMouseOut).toBeTruthy();
}));
</code>```

Body:
I wrote a testcase for the mouseout event, however it does not cover the entire function, instead stopping in the if condition.

Functionality
While hovering the mouse over the State Change in the picture. I'll display the submenu below; mouseleave should hide the submenu. I simply need to write a testcase for the mouseout method.

I believe the fake object onMouseOut(event) is incorrect. Could you possibly assist me in resolving the issue?

HTML

TS

  onMouseOut(event): void {
    this.pageDividerActionOption.forEach(element => {
      if (event.target.innerText === element.option) {
        this.pageActionSubOption = [];
      }
    })
  }

Spec.ts

it(' mouse leave hide the suboption list', fakeAsync(() => {
  const data = { target: { innerText: 'Change State' }};
  const div = fixture.debugElement.query(By.css('.option-value'));
  let event = new MouseEvent('mouseleave', {
      bubbles: true,
      cancelable: true,
      view: window
  });
  div.nativeElement.dispatchEvent(event);
  tick();
  fixture.detectChanges();
  spyOn(component, 'onMouseOut') // spy first
component.onMouseOut(data)
fixture.detectChanges();
  expect(component.onMouseOut).toBeTruthy();
}));


问:
Scraping data with Python from reCAPTCHA embedded website
I have been trying to scrape the prices and products for personal use from a website. I cannot go around the reCaptcha blocking.

Here is the code

```<code>import pandas as pd
import requests
from bs4 import BeautifulSoup

ourdata = "https://hotline.ua/ua/computer/noutbuki-netbuki/33373/"
page = requests.get(ourdata)
soup = BeautifulSoup(page.text, "html.parser")
</code>```

And when I call soup

```<code>soup
</code>```

I get this

```<code><html>
<head><title>503 Service Temporarily Unavailable</title></head>
<body bgcolor="white">
<center><h1>503 Service Temporarily Unavailable</h1></center>
<hr/><center>nginx</center>
</body>
</html>
</code>```

Body:
I have been trying to scrape the prices and products for personal use from a website. I cannot go around the reCaptcha blocking.

Here is the code

import pandas as pd
import requests
from bs4 import BeautifulSoup

ourdata = "https://hotline.ua/ua/computer/noutbuki-netbuki/33373/"
page = requests.get(ourdata)
soup = BeautifulSoup(page.text, "html.parser")

And when I call soup

soup

I get this

<title>503 Service Temporarily Unavailable</title>

503 Service Temporarily Unavailable

nginx


问:
How to keep the dropdown menu correctly aligned when showing and hiding dropdown items that are right-aligned?
I am using bootstrap-select and I hide and show dropdown items based on some filtering (in this example the filter is by the class).

The problem is that when I play around with showing and hiding the list items, the alignment of the dropdown breaks - you can give it a try and see - just select and unselect some items a few times, and you will see that the menu goes left or sometimes right (with the scroll bar going out of the screen)

How can I keep the alignment correct as it is when I'm not showing/hiding?

I am also using right-alignment classes because this is for the RTL version of the website so it's necessary to keep the right alignment as it is now

At first I tried to replace the show() and hide() methods of jQuery with css visibility hidden or visible and while it does keep the alignment, it's not what I'm looking for because it just keep showing long list of blank lines

This is the example of the problem:

$(".my_select").selectpicker();

$(".my_select").on("changed.bs.select", function(e, clicked, curr, prev) {
  let clickedOptionId = $(this).find('option').eq(clicked).attr('id');

  let clickedListItem = $(".my_select").find(`li > a.${clickedOptionId}`);

  let elems = $("a.dropdown-item").not(`.${clickedOptionId}`);

  if (clickedListItem.hasClass("selected")) {
    elems.each(function(i) {
      $(this).closest('li').hide();
    });
  } else {
    elems.each(function(i) {
      $(this).closest('li').show();
    });
  }

});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/js/bootstrap-select.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/css/bootstrap-select.min.css" rel="stylesheet" />
<div class="container-fluid">
  <div class="d-flex flex-row-reverse flex-wrap justify-content-start">
    <div class="form-group justify-content-end text-right form-inline">
      <select class="my_select" multiple data-live-search="true" data-size="10" data-dropdown-align-right="true">
        <option id="option1" class="option1" value="option1">option1</option>
        <option id="option2" class="option2" value="option2">Very Very Long Option Here</option>
        <option id="option3" class="option3" value="option3">option3</option>
        <option id="option4" class="option4" value="option4">option4</option>
        <option id="option5" class="option5" value="option5">option5</option>
        <option id="option6" class="option6" value="option6">option6</option>
        <option id="option7" class="option7" value="option7">option7</option>
        <option id="option8" class="option8" value="option8">option8</option>
        <option id="option9" class="option9" value="option9">option9</option>
        <option id="option10" class="option10" value="option10">option10</option>
        <option id="option11" class="option11" value="option11">option11</option>
        <option id="option12" class="option12" value="option12">option12</option>
        <option id="option13" class="option13" value="option13">option13</option>
        <option id="option14" class="option14" value="option14">option14</option>
        <option id="option15" class="option15" value="option15">option15</option>
      </select>
    </div>
  </div>
</div></code>```

Body:
I am using bootstrap-select and I hide and show dropdown items based on some filtering (in this example the filter is by the class).

The problem is that when I play around with showing and hiding the list items, the alignment of the dropdown breaks - you can give it a try and see - just select and unselect some items a few times, and you will see that the menu goes left or sometimes right (with the scroll bar going out of the screen)

How can I keep the alignment correct as it is when I'm not showing/hiding?

I am also using right-alignment classes because this is for the RTL version of the website so it's necessary to keep the right alignment as it is now

At first I tried to replace the show() and hide() methods of jQuery with css visibility hidden or visible and while it does keep the alignment, it's not what I'm looking for because it just keep showing long list of blank lines

This is the example of the problem:

$(".my_select").selectpicker();

$(".my_select").on("changed.bs.select", function(e, clicked, curr, prev) {
  let clickedOptionId = $(this).find('option').eq(clicked).attr('id');

  let clickedListItem = $(".my_select").find(`li > a.${clickedOptionId}`);

  let elems = $("a.dropdown-item").not(`.${clickedOptionId}`);

  if (clickedListItem.hasClass("selected")) {
    elems.each(function(i) {
      $(this).closest('li').hide();
    });
  } else {
    elems.each(function(i) {
      $(this).closest('li').show();
    });
  }

});

<link href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" rel="stylesheet" />

<link href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/css/bootstrap-select.min.css" rel="stylesheet" />

      <select class="my_select" multiple data-live-search="true" data-size="10" data-dropdown-align-right="true">
        <option id="option1" class="option1" value="option1">option1</option>
        <option id="option2" class="option2" value="option2">Very Very Long Option Here</option>
        <option id="option3" class="option3" value="option3">option3</option>
        <option id="option4" class="option4" value="option4">option4</option>
        <option id="option5" class="option5" value="option5">option5</option>
        <option id="option6" class="option6" value="option6">option6</option>
        <option id="option7" class="option7" value="option7">option7</option>
        <option id="option8" class="option8" value="option8">option8</option>
        <option id="option9" class="option9" value="option9">option9</option>
        <option id="option10" class="option10" value="option10">option10</option>
        <option id="option11" class="option11" value="option11">option11</option>
        <option id="option12" class="option12" value="option12">option12</option>
        <option id="option13" class="option13" value="option13">option13</option>
        <option id="option14" class="option14" value="option14">option14</option>
        <option id="option15" class="option15" value="option15">option15</option>
      </select>


问:
How to return status for extension CallKit IOS to React Native
I'm trying return a enable status extension to React Native from Native IOS. But result i received always is null

My code:

```<code>import Foundation
import CallKit

@objc(CommonFunction)
class CommonFunction : NSObject {

@objc
static func requiresMainQueueSetup() -> Bool {
 return true
}

var extensionStatus: Any? =
CXCallDirectoryManager.EnabledStatus.unknown

@objc
func checkExtensionStatus(_ resolve : @escaping RCTPromiseResolveBlock, reject : RCTPromiseRejectBlock) -> Void {
CXCallDirectoryManager.sharedInstance.getEnabledStatusForExtension(withIdentifier: "com.***.*****.Extension", completionHandler: {
  (status : CXCallDirectoryManager.EnabledStatus, error: Error?) in
  if let error = error {
    print("Error get status extension: \(error.localizedDescription)")
  }
   resolve(status)
  })
 }
}
</code>```

Looks like i'm having a async problem? how can i return synchronous so React Native can get correct result.

I tried this way: https://stackoverflow.com/a/42484670/16986085 but not working

Many thanks!

I'm newbie IOS

Body:
I'm trying return a enable status extension to React Native from Native IOS. But result i received always is null

My code:

import Foundation
import CallKit

@objc(CommonFunction)
class CommonFunction : NSObject {

@objc
static func requiresMainQueueSetup() -> Bool {
 return true
}

var extensionStatus: Any? =
CXCallDirectoryManager.EnabledStatus.unknown

@objc
func checkExtensionStatus(_ resolve : @escaping RCTPromiseResolveBlock, reject : RCTPromiseRejectBlock) -> Void {
CXCallDirectoryManager.sharedInstance.getEnabledStatusForExtension(withIdentifier: "com.***.*****.Extension", completionHandler: {
  (status : CXCallDirectoryManager.EnabledStatus, error: Error?) in
  if let error = error {
    print("Error get status extension: \(error.localizedDescription)")
  }
   resolve(status)
  })
 }
}

Looks like i'm having a async problem? how can i return synchronous so React Native can get correct result.

I tried this way: https://stackoverflow.com/a/42484670/16986085 but not working

Many thanks!

I'm newbie IOS


问:
Dynamically adjust page content height in jspdf
I need to adjust the page content height dynamically. I have a pdf in which I have a footer & that footer will take some page height. e.g Page height=100 then content height will be page height-footer height. Because when our Content starts rendering on jspdf then when 80% page covers it should break the page or to avoid overlapping in footer. Now The Problem is that footer will be shown upon user's need. User wants to see that footer on only First Page OR Last Page. So I need to maintain the Content height of pdf pages if I set content height at the Top Level then all pages will get the same height whether the footer is available or not on that page. Unless & until i will not be able to get exact number of pages when my All data not rendered.

I have tried many ways to find the solutions through documentation but nothing worked.