dynamic – How to plot the stable and unstable manifolds of a hyperbolic fixed point of a nonlinear system of a map?

I would like to plot the stable and unstable manifold of the Hénon map x_{n+1} = 1 – a*x_n^2 + by_n, y_{n+1} = x_n. I believe that iterate the inverse map i would get the stable curve, and for the unstable i need to choose an large number of initial conditions inside the neighborhood of the saddle point along the unstable direction and then iterate the map for a few times, but i do not know how to do this things.

performance – Wrote My own data structure. Mixture of a doubly linked list & unordered map C++

I decided to make my own data structure. I did this because I wanted a data structure that is a queue but has o(1) time on lookup.

    template <class Object>
class ObjectQueue;
template <class Object>
class ObjectQueueNode: private NonCopyable
{
    friend class ObjectQueue<Object>;
public:
    ObjectQueueNode(const glm::ivec3& position)
        : position(position),
        previous(nullptr),
        next(nullptr)
    {}
    ObjectQueueNode(ObjectQueueNode&& orig) noexcept
        : position(orig.position),
        previous(orig.previous),
        next(orig.next)
    {
        orig.previous = nullptr;
        orig.next = nullptr;
    }
    ObjectQueueNode& operator=(ObjectQueueNode&& orig) noexcept
    {
        position = orig.position;
        previous = orig.previous;
        next = orig.next;

        orig.previous = nullptr;
        orig.next = nullptr;

        return *this;
    }

    const glm::ivec3& getPosition() const
    {
        return position;
    }

private:
    glm::ivec3 position;
    Object* previous;
    Object* next;
};

struct PositionNode : public ObjectQueueNode<PositionNode>
{
    PositionNode(const glm::ivec3& position)
        : ObjectQueueNode(position)
    {}
};

template <class Object>
class ObjectQueue : private NonCopyable, private NonMovable
{
public:
    ObjectQueue()
        : m_initialObjectAdded(nullptr),
        m_recentObjectAdded(nullptr),
        m_container()
    {}

    void add(Object&& newObject)
    {
        glm::ivec3 position = newObject.position;
        if (m_container.empty())
        {
            assert(!m_initialObjectAdded && !m_recentObjectAdded);
            Object& addedObject = m_container.emplace(std::piecewise_construct,
                std::forward_as_tuple(position),
                std::forward_as_tuple(std::move(newObject))).first->second;

            addedObject.previous = nullptr;
            m_initialObjectAdded = &addedObject;
            m_recentObjectAdded = &addedObject;
        }
        else if (m_container.size() == 1)
        {
            assert(m_initialObjectAdded && m_recentObjectAdded);
            Object& addedObject = m_container.emplace(std::piecewise_construct,
                std::forward_as_tuple(position),
                std::forward_as_tuple(std::move(newObject))).first->second;

            addedObject.previous = m_initialObjectAdded;
            m_initialObjectAdded->next = &addedObject;
            m_recentObjectAdded = &addedObject;
        }
        else if (m_container.size() > 1)
        {
            assert(m_initialObjectAdded && m_recentObjectAdded);
            Object& addedObject = m_container.emplace(std::piecewise_construct,
                std::forward_as_tuple(position),
                std::forward_as_tuple(std::move(newObject))).first->second;

            addedObject.previous = m_recentObjectAdded;
            m_recentObjectAdded->next = &addedObject;
            m_recentObjectAdded = &addedObject;
        }
    }

    bool contains(const glm::ivec3& position) const
    {
        return m_container.find(position) != m_container.cend();
    }

    bool isEmpty() const
    {
        return m_container.empty();
    }

    Object* next(Object* object)
    {
        assert(m_initialObjectAdded && m_recentObjectAdded && !m_container.empty());
        if (object)
        {
            return object->next;
        }
        else
        {
            return nullptr;
        }
    }

    Object& front()
    {
        assert(m_initialObjectAdded && m_recentObjectAdded && !m_container.empty());

        auto iter = m_container.find(m_initialObjectAdded->position);

        assert(iter != m_container.end());
        return iter->second;
    }

    void pop()
    {
        assert(m_initialObjectAdded && m_recentObjectAdded && !m_container.empty());

        auto iter = m_container.find(m_initialObjectAdded->position);
        assert(iter != m_container.end());

        if (m_container.size() == 1)
        {
            assert(m_initialObjectAdded == m_recentObjectAdded);
            m_initialObjectAdded = nullptr;
            m_recentObjectAdded = nullptr;

        }
        else if (m_container.size() > 1)
        {
            assert(m_initialObjectAdded->next);
            m_initialObjectAdded = m_initialObjectAdded->next;
            m_initialObjectAdded->previous = nullptr;
        }

        m_container.erase(iter);
    }

    Object* remove(const glm::ivec3& position)
    {
        auto iter = m_container.find(position);
        if (iter != m_container.end())
        {
            assert(m_initialObjectAdded && m_recentObjectAdded);
            Object* previousObject = iter->second.previous;
            Object* nextObject = iter->second.next;

            //Top
            if (!nextObject && previousObject)
            {
                m_recentObjectAdded = previousObject;
                m_recentObjectAdded->next = nullptr;
                previousObject->next = nullptr;
            }
            //Bottom
            else if (!previousObject && nextObject)
            {
                m_initialObjectAdded = nextObject;
                m_initialObjectAdded->previous = nullptr;
                nextObject->previous = nullptr;
            }
            //Inbetween
            else if (previousObject && nextObject)
            {
                previousObject->next = nextObject;
                nextObject->previous = previousObject;
            }
            else
            {
                assert(m_container.size() == 1);
                m_initialObjectAdded = nullptr;
                m_recentObjectAdded = nullptr;
            }

            m_container.erase(iter);
            return nextObject;
        }

        return nullptr;
    }

private:
    Object* m_initialObjectAdded;
    Object* m_recentObjectAdded;

    std::unordered_map<glm::ivec3, Object> m_container;
};

battle map – Princess Elizabeth’s Space Marines gaming league?

Does anyone have any information about the gaming league described in this recent post on Reddit’s r/DungeonAndDragons?

Back in the early 2000s, a coworker used to be involved in a game league that used [styrofoam packing inserts as dungeons]. It was called something like “Princess Elizabeth’s Space Marines”. It was not Warhammer, it was some ad hoc wargaming thing that people were playing in the mid atlantic and northeastern US during that time. I have never been able to find documentation about it and I might be misremembering the name, but they primarily used these as their dungeons. Now I’m going to go into a google rabbit hole looking for this for hours. I never got to play but he had tons of pics of the games they played.

javascript – mejorar codigo, promise and Map

Hola tengo un codigo funcional pero no me arroja el resultado como lo espero, hago una busqueda con unas condiciones en el query y funciona pero el resultado me lo trae como varios arreglos json y lo que quiero es un solo arreglo json, aca el codgio a ver si alguien puede ver la falla:

  var comparaPago = (lista) =>
        new Promise((resolve, reject) => {
            var listaPagos = Pagos.find({
                "user_id": lista.user,
                "fecha_pago": {
                    "$lt": lista.createdAt
                }
            }, (err, registrosEncontrados) => {
                if (!err) {

                    return registrosEncontrados

                }
            }
            ).sort({ fecha_pago: -1 })
                .limit(1)
            resolve(listaPagos);

        });

y aqui llamo a la promesa que itera una respuesta de un proceso anterior:

   ListarUsuariosMaxDate.then(response => {
        if (response !== null) {

            var miLista = Promise.all(
                response.map(elemento => {
                    return comparaPago(elemento);
                }));
        }

        miLista
            .then(lista => {
                return res.status(200).json(lista)

            })
            .catch(error => {
                console.error(error);
            })
    }).catch(error => {
        console.error(error);
    })

}

el resultado es el siguiente:

  (),
    (),
    (
        {
            "_id": "59fc6f6aaf24f50ea619ac97",
            "updatedAt": "2017-11-03T13:40:36.980Z",
            "createdAt": "2017-11-03T13:30:18.729Z",
            "user_id": "563857ed3817661751605eaf",

        }
    ),
    (
        {
            "_id": "59a01d948642d70e294f6fd0",
            "updatedAt": "2017-08-25T13:00:34.622Z",
            "createdAt": "2017-08-25T12:52:36.934Z",
            "user_id": "563855fe38176617515fa8ae"
}

    )

lo que quisiera seria un solo arreglo, y sin los vacios, pero no se en que fallo, algo asi:

(        {
            "_id": "59a01d948642d70e294f6fd0",
            "updatedAt": "2017-08-25T13:00:34.622Z",
            "createdAt": "2017-08-25T12:52:36.934Z",
            "user_id": "563855fe38176617515fa8ae"
}, 
 {
            "_id": "59fc6f6aaf24f50ea619ac97",
            "updatedAt": "2017-11-03T13:40:36.980Z",
            "createdAt": "2017-11-03T13:30:18.729Z",
            "user_id": "563857ed3817661751605eaf",

        }

)

gracias y disculpen los errores

javascript – React reconciling issues with keys during map function

const {useState} = React;

function App() {
  const (state, setState) = useState(('Red', 'Green', 'Blue', 'Black'))

  function handleShuffle() {
    const newState = _.shuffle(state)
    setState(newState)
  }

  return ( 
    <div className="App"> 
      {state.map((sourceValue, index) => {
        return ( 
          <div className={
            'box positionAt' + index + ' sourceValue' + sourceValue
          }
          key={sourceValue} ></div>
        )
      })}

      <button id="shuffle" onClick={handleShuffle}> shuffle < /button> 
    </div>
  );
}

const rootElement = document.getElementById("root");
ReactDOM.render( <
  App / > ,
  rootElement
);
.App {
  position: relative;
  width: 200px;
  height: 200px;
  background-color: gray;
}

.box {
  width: 25px;
  height: 25px;
  position: absolute;
  transition: transform 1s;
}

.positionAt0 {
  transform: translate(0px, 0px);
}

.positionAt1 {
  transform: translate(175px, 0px);
}

.positionAt2 {
  transform: translate(0px, 175px);
}

.positionAt3 {
  transform: translate(175px, 175px);
}

.sourceValueGreen {
  background-color: green;
}

.sourceValueBlue {
  background-color: blue;
}

.sourceValueRed {
  background-color: red;
}

.sourceValueBlack {
  background-color: black;
}

#shuffle {
  position: absolute;
  top: 0px;
  left: 75px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.8.4/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.8.4/umd/react-dom.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min.js"></script>
<div id="root"></div>

photos – Map with all accessible geo-tagged images?

I would like to browse all available geo-tagged images on a map. There are Google Maps, Google Earth, Flickr Map, etc. but all of them are displaying only images uploaded to the particular service.

Is there a service crawling the internet for geo-tagged images and displaying them on a map?

There shouldn’t be a legal obstacle creating this, e.g. Google Images are displaying images from various sources.

javascript – why does “`map“` work on array but “`find“` breaks the code

I am working in React Native with a variable that has a value equal to an array of objects:

const list2020 = (

    {
        "monthId": "4",
        "monthName": "May",
        "firstEkadasi": {
            "jsDayOfWeek": "1",
            "dayOfWeek": "Monday",
            "dayInMonth": "4",
            "ekadasiName": "Mohini"
        },
        "secondEkadasi": {
            "jsDayOfWeek": "1",
            "dayOfWeek": "Monday",
            "dayInMonth": "18",
            "ekadasiName": "Apara"
        },
        "thirdEkadasi": {}
    },

    {
        "monthId": "5",
        "monthName": "June",
        "firstEkadasi": {
            "jsDayOfWeek": "2",
            "dayOfWeek": "Tuesday",
            "dayInMonth": "2",
            "ekadasiName": "Pandava Nirjala"
        },
        "secondEkadasi": {
            "jsDayOfWeek": "3",
            "dayOfWeek": "Wednesday",
            "dayInMonth": "17",
            "ekadasiName": "Yogini"
        },
        "thirdEkadasi": {}

    }
)

I have a function that maps over this array:

function TestingMyCode() {

  const getCurrentMonth = new Date().getMonth();
  let plusOne = getCurrentMonth + 1

  let currentMonthIndex = list2020.findIndex((list2020) => list2020.monthId == getCurrentMonth);
  let nextMonthIndex = currentMonthIndex + 1;

  return (
    list2020.find((list, index, array) => {
      if (list.thirdEkadasi.dayOfWeek == undefined) {
        return (
          <View key={index}>
            <Text style={styles.displayEkadasi}>{return-values-of-next-object-in-array (I want to return the values of the next month)}</Text>
          </View>
        )
      }

    })
  )
}

When I use list2020.map I can get a result (even though it is not the desired result).
However, when I used list2020.find it breaks the app with an error
Objects are not valid as a React Child (found: object with keys {monthID, monthName,...}). If you meant to render a collection of children, use an array instead

Is there a vanilla JavaScript way of fixing this?


My objective is to display the values from the next object in the array (if the current object in array does not meet criteria:

  1. If the current Month and date (which is May 19) is greater than the dates in the object
  2. show the values from the next month (June)
  3. Since the date is after May 18th, my app is not showing any text. I could easily display text with if(data.monthId == month && data.firstEkadasi.dayInMonth >= dayOfMonth) {<Text>display text</Text>}
  4. But I am stuck if the dayInMonth is less than current date. For example, it’s May 19 and the object at index 0 has two Ekadasi dates; but both dates are less than 19.

How can I display the values from the next objects in the array?


You can view repo of my code here

java – Drawing object lines in the Tiled map editor

Suppose I have this picture:

I have a map like this created in Tiled already. I would like to draw collision lines (the green ones in the picture) without having to make it a polygon. As far as I know, Tiled does not support drawing a line as a collision object, so I would appreciate ideas on how to make this work.

I also tried drawing a quadrilateral and calculating the diagonal in code (LibGDX), but that’s a bit clunky and can go wrong easily.