React Native FlatList onEndReachedThreshold not detecting position

I have a unique case where I have a FlatList inside a hidden bottom sheet which can be pulled up. On the main screen there is a map with markers. When a marker is clicked, I scroll to the position of the item within the FlatList. This way, if I open the bottom sheet with the FlatList, I will see the item for which marker I clicked on.

My bottom sheet is rendered as follows:

const renderBottomSheet = () => (
      keyExtractor={(item) => `row-${}`}
      onEndReached={() => {
        console.log('END REACHED', isToggledBookList);
        if (isToggledBookList) {
        } else {
          console.log('CLOSED. NOT LOADING MORE RESULTS');

Everything works, but when I click on a marker of an item that is within the onEndReachedThreshold and then I open the bottom sheet:

  1. More results are not loaded – this is actually a good thing
  2. if I scroll to towards the bottom, onEndReached is not triggered – this is the problem

Any ideas how to solve or work around this?

Can you help me make a pin and mash position optimizer and visualizer?

So say I have a 3/16 thick 6×6 grid that needs to be placed at every location where there is a 3×5, 1/4-in thick pin in a zone 3/4 to 1 and 1/4 in away from the back of the pin. You are given mesh dimensions from stock lengths that need to be cut in such a way that the first horizontal rod of the mesh should be some distance away from the end. I want to visualize the final cut and how it would be placed with pin coordinates and frame outline

How to conduct user testing to identify the optimal position for an entry point of a feature

I’m conducting a user testing session to identify what is the optimal entry point on a flight booking mobile app, to introduce users to its frequent flyer program.

Potential entry points are

  • after booking of flight tickets
  • before check-in
  • on the home screen
  • other suggestions by the user

the design itself is a static component with some copy and a ‘register now’ button.

This question is not looking for the answer of which is the optimal entry point, but more regarding what kind of a test should be presented to the participant. Normally user tests are conducted to get feedback on a particular feature. however, the aim of this is to identify the best place in the app (and users journey) to include an entry point to sign up.

Would appreciate suggestions and feedback on this

plotting – How can I precisely control the position of the BarLegend in the DensityPlot?

I’ve had trouble with this, so I usually Rasterize my graphics, then Inset my legend into my graphic. It will take some tweaking, but Inset gives you basically unlimited control. See below.

With({z0 = 0.1, zm = 0.1},
 legend = 
  ListDensityPlot({Range(-0.1, 0.1, 0.1), Range(-0.1, 0.1, 0.1)}, 
   DataRange -> All, ColorFunction -> (Blend({Red, White, Blue}, 
       Rescale(#, {-zm, z0})) &), PlotRange -> Full, 
   ColorFunctionScaling -> False, AspectRatio -> 1/10, 
   FrameTicks -> {{None, None}, {None, {{1, Style(Text(-zm), 13, Black)}, 
{3, Style(Text(z0), 13, Black)}}}}, PlotRangePadding -> None);
 plot = Rasterize@
   DensityPlot(x y, {x, -1, 1}, {y, -1, 1}, FrameStyle -> Black, 
FrameTicksStyle -> Black, ColorFunction -> (Blend({Red, White, Blue}, 
Rescale(#, {-zm, z0})) &), PlotPoints -> 80, FrameLabel -> {x, y}, 
ColorFunctionScaling -> False,PlotLabel -> Style("ZZ", Red, FontSize -> 22));
  Graphics@{Inset(legend, Scaled@{0.96, 0.93}, Scaled@{1, 1}, 125)},
  PlotRange -> {{-15, 375}, {-15, 400}})

using Inset to add a legend to graphics object

glsl – OpenGL – Recreate position in viewspace from depth values

I am trying to recreate positions in Viewspace from only a stored depth value.

In the first pass I store the Normals and the normalized depth in viewspace.
In the second pass I try to build reconstruct the position in viewspace.

I dont know what I am doing wrong, been trying many things, getting out of ideas.
I belive something is going wrong in the reconstruction, but I can’t see what, or if it something else.

The light initially looks fine, but when I start moving around the light seems to be moving around.
When I go futher away, things get less lit. When rotating the light also rotates.

What could I be doing wrong? I want to do the lighting in viewspace, that is what I am trying.

Belove is code for the fragment & vertex shader, first and second pass.

Thank you

First pass:

#version 460

layout( location = 0 ) in vec3 VertexPosition;
layout( location = 1 ) in vec3 VertexNormal;

/* Uniforms */
uniform mat4 ViewMatrix;
uniform mat4 ProjectionMatrix;
uniform mat3 NormalMatrix;
uniform float FarPlane;
uniform float NearPlane;

out vec3 vNormal;
out highp float vDepth;

void main() {
  mat4 vMVP = ProjectionMatrix * ViewMatrix;
  gl_Position = vMVP * vec4( VertexPosition, 1.0 ); // Screenspace

  vNormal = normalize(NormalMatrix  * normalize(VertexNormal));
  vec3 vPos = (ViewMatrix * vec4( VertexPosition, 1.0 )).xyz;

  // Save normalized depth (0, 1)
  vDepth = -(vPos.z - NearPlane) / ( FarPlane - NearPlane);

#version 460

in vec3 vNormal;
in highp float vDepth;

layout (location = 0) out highp vec4 NormalDepth;

void main() {
  NormalDepth = vec4(normalize(vNormal), vDepth);

Second pass (off rendering to screen):

#version 460

layout( location = 0 ) in vec3 VertexPosition;

out vec2 vTexCoord;
out vec2 vDeviceCoords;

void main() {
  vDeviceCoords = 2.0 * ( VertexPosition.xy - 0.5 );// (-1, 1)
  vTexCoord = VertexPosition.xy;//  (0, 1) // Just 2 triangles for the screen

  gl_Position = vec4(vDeviceCoords, 1.0, 1.0 ); // (-1, 1)

#version 460

/* Uniforms */
uniform float NearPlane;
uniform float FarPlane;
uniform mat4 ViewMatrix;

/*  From prev shader stage */
in vec2 vTexCoord;
in vec2 vDeviceCoords;

/* Out */
layout( location = 0 ) out vec4 FragColor;

/* In */
layout( binding = 0 ) uniform highp sampler2D NormalDepthTex;

vec3 diffuseValue( vec3 color, vec3 normal, vec3 position)
  // Light position. Here now for testing purposes
  // Stationary point light, transformed to viewspace
  vec3 vLightPos = (ViewMatrix * vec4( -10.0, 0.0, 2.0, 1.0 )).xyz;

  normal = normalize(normal);
  const vec3 lightDir = normalize(position - vLightPos);
  const float diffuseCos = max( dot( normal, -lightDir ), 0.0 );

  return diffuseCos ;

void main() {
  const vec4 normalDepth = texture2D( NormalDepthTex, vTexCoord );

  // Normalize depth to (0, FarPlane)
  const float depth = normalDepth.w * (FarPlane - NearPlane);

  // Unproject
  vec3 position;
  position = vec3(vDeviceCoords.x, vDeviceCoords.y, NearPlane);
  position.xy *= depth / near; 
  position.z = depth;

  // View space
  vec3 diffuseValue = diffuseValue(, position);

  FragColor = vec4( diffuseValue.x, diffuseValue.y, diffuseValue.z, 1.0 );


mysql – “ENUM” is not vallid at his position, expecting ‘)’

I’m keeping this error and I’m very new to mySQL so I don’t know what is going on. The only way I found to remove this error message is to put ‘)’ before the ENUM and then the message change – “ENUM” is not valid at this position, expecting EOF, ‘;’.

USE labo3_partie2;
CREATE TABLE fournisseur(
        nom VARCHAR(40) NOT NULL,
        prenom VARCHAR(40),
        chiffreAffaire DECIMAL(7,2) CHECK ((chiffreAffaire >= 20000) && (chiffreAffaire <= 1000000)),
        province CHAR(2) DEFAULT 'QC' ENUM('QC','ON','NB')

natural language – Finding position of specific substring within string

Is there a simple way of finding the position of a specific instance of a substring within a string? For instance, in the sentence “Bob bought his car at the car dealership”. Something like StringPosition would give me the position of both instances of car, namely {{16, 18}, {27, 29}}, but what if I only wanted the first or the second instance of the word?

If I do a StringPosition on every word of the sentece, both instances of the word “car” would yield {{16, 18}, {27, 29}}, as opposed to {16, 18} for the first instance and {27, 29} for the second instance, which is not very useful.

This seems to be a recurrent theme for a lot of Mathematica’s NLP functions when they are applied to text: The functions act on each word, without considering the context of the word within the text. Mathematica just gives you all possible answers for each word.

unity – How do I interpolate an object from point A to B such that it accelerates, overshoots, and bounces back to target position?

I’m talking about vectors, but simplifying that to ordinary numbers for the sake of an example, if A is 0 and B is 1, the object would go something like this:

  1. 0.0
  2. 0.2
  3. 0.5
  4. 0.9
  5. 1.3
  6. 0.9
  7. 1.1
  8. 1.0
private IEnumerator GoTo(Vector2 endPosition) {
    float elapsed = 0;
    float duration = 1f;

    while (elapsed <= duration) {
        transform.position = Vector2.LerpUnclamped(transform.position, endPosition, animCurve.Evaluate(elapsed / duration));
        distance = CalculateDistance(transform.position, endPosition);
        elapsed += Time.deltaTime;
        yield return new WaitForEndOfFrame();

Where animCurve is:
The highest point is approx. 1.3, and the plot converges to 1.0 from there.


This doesn’t work at all. Unless something’s wrong with Unity’s Vector2.LerpUnclamped(), I’m lost.

Additionally, I changed the statement inside the while loop to elapsed <= duration from a distance checker (distance to target <= 0.05f) that I used previously with a rebound-less interpolation curve. This now messes up my game.

How the game works

You grab and drag an object around. Once you let go, it interpolates to a certain position, and that’s what I’m trying to do here.

However, when, as I said above, I changed the statement inside the while loop, my dragging sometimes stutters and gets stuck/doesn’t follow. This could be because of a bad interaction with other components of my game, but if I could use a better/more conventional statement/method, please let me know.

unity – How do you get the world position from the screen position in a URP shader graph used in a ScriptableRenderPass?

I’m using a shader graph in the Universal Shader Pipeline (URP) to do some post-processing in a ScriptableRenderPass. How do I get the world coordinates of the screen position?

I have tried using the View Direction node, set to World:
enter image description here

And I have tried the Screen Position node, with either a Transform node or Transformation Matrix node:
enter image description here

Neither seems to be working because the colors change as I move the camera around, but I would expect the color to stay the same since the world position of the GameObject in the view is not changing. Any suggestions?

path finding – Updating the position of a prefab in Unity for A* pathfinding

I am trying to use Aron Granberg A* pathfinding project in my game. I am very new to Unity, so I am having some trouble figuring out how to instantiate multiple enemies from a prefab that will seek out my player. I am unable to set the player object from the scene as the target, since prefabs cannot take in scene objects. However, if I use the player prefab as the target, the enemies will only go toward the starting position of the player. Is there any way to update the prefab position as the player instance moves? Or is there a better way of doing this? I want this to be a top-down shooter style game (2D) with constant enemy spawning, so it doesn’t make sense to set the target for each individual enemy instance. Any help would be greatly appreciated. Thank you!