c# – Getting a automatic button created in a map by line-art-detection

So I am trying to build a game based off on a real-world map. I have a pretty map and have got all the graphics needed cleared out. Now, the problem is how do I make a clickable button inside the boundary of each provinces in a map.
For this, I think I need a line-detection system for my game. How?

How to collect objects from map in blueprints

I have a plate with trigger(TriggerVolume) on it. When it overlapped cubes from map deleting. I’ve manually created references on cubes in blueprint to delete them but it seems very hard-coded. Is there any way to collect all references with “for loop”? And for more clarity – I’m using FPS template for this project.

opengl – (While using a cube map) box-like textures appearing around my scene whenever I move the camera

I’ve been learning about cube map and I implemented one into my program. It seemed to work well until I started moving the camera around the scene and zooming out. As you can see in the attached gif, there seems to be a problem with the cube map since this weird behavior is occurring:


Main program:

        unsigned int cubemapTexture = texo.loadCubeMap(faces);


        glm::mat4 projection = glm::perspective(glm::radians(fov), (float)scr_width / (float)scr_height, 0.1f, 100.0f);
        glm::mat4 view = camera.GetViewMatrix();
        skyBox.setUniformMat4("projection", projection);
        skyBox.setUniformMat4("view", view);

        glBindTexture(GL_TEXTURE_CUBE_MAP, cubemapTexture);
        GLCall(glDrawArrays(GL_TRIANGLES, 0, 36));


unsigned int Textures::loadCubeMap(std::vector<std::string> faces)
    unsigned int textureID;
    glGenTextures(1, &textureID);
    glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);


    int width, height, nrChannels;
    for (unsigned int i = 0; i < faces.size(); i++)
        unsigned char* data = stbi_load(faces(i).c_str(), &width, &height, &nrChannels, 0);
        if (data)
            glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i,
                0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data

            std::cout << "Cubemap tex failed to load at path: " << faces(i) << std::endl;


    return textureID;

Vertex Shader:

#version 330 core

layout (location = 0) in vec3 aPos;

out vec3 TexCoords; 

uniform mat4 view;
uniform mat4 projection;

void main()
    vec4 pos = projection * view * vec4(aPos, 1.0);
    TexCoords = aPos;
    //Setting z value to w (1.0) so that the cube map is always in the background
    gl_Position = pos.xyww;

Fragment shader:

#version 330 core

out vec4 FragColor;

in vec3 TexCoords;
uniform samplerCube skybox;

void main()
    FragColor = texture(skybox, TexCoords);

The problem probably originates from one of these snippets, but if you have any other ideas I can provide more info.

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.

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.

windows – Create user – map network drive CMD

Stack Exchange Network

Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Deep map, Python – Code Review Stack Exchange

Goal: apply fn to every element of an arbitrarily nested iterable (tuple, list, dict, np.ndarray), including to iterables. Ex:

def fn1(x, key):  # ignore `key` for now
    return str(x) if not isinstance(x, Iterable) else x
def fn2(x, key):
    return x ** 2 if isinstance(x, (int, float, np.generic)) else x

arr = np.random.randint(0, 9, size=(2, 2))
obj = (1, {'a': 3, 'b': 4, 'c': ('5', 6., (7, 8)), 'd': 9}, arr)

deepmap(obj, fn1) == ('1', {'a': '3', 'b': '4', 'c': ('5', '6.0', ('7', '8')), 'd': '9'}, 
                      array(((6, 1), (5, 4))))
deepmap(obj, fn2) == (1, {'a': 9, 'b': 16, 'c': ('5', 36.0, (49, 64)), 'd': 81}, 
                      array(((36,  1), (25, 16))))

deeplen should also be a special case of deepmap, with proper fn (just a demo, don’t care for optimizing this):

def deeplen(obj):
    count = (0)
    def fn(x, key):
        if not isinstance(x, Iterable) or isinstance(x, str):
            count(0) += 1
        return x
    deepmap(obj, fn)
    return count(0)

deeplen(obj) == 12

My working implementation, along tests, below. Unsure this works without OrderedDict (Python >=3.6 default); it does if key order doesn’t change even as values are changed (but no keys inserted/popped). A resolution is appending actual Mapping keys to key instead of their index, but this complicates implementing. (As for why pass key to fn: we can implement e.g. deepequal, comparing obj against another obj; this requires key info).

Any improvements? I haven’t tested exhaustively – maybe there are objects for which this fails, hence subject to extendability. Performance/readability could be better also.

Implementation: live demo

from collections.abc import Iterable, Mapping

def deepmap(obj, fn):
    def deepget(obj, key=None, drop_keys=0):
        if not key:
            return obj
        if drop_keys != 0:
            key = key(:-drop_keys)
        for k in key:
            if isinstance(obj, Mapping):
                k = list(obj)(k)  # get key by index (OrderedDict, Python >=3.6)
            obj = obj(k)
        return obj

    def dkey(x, k):
        return list(x)(k) if isinstance(x, Mapping) else k

    def _process_key(obj, key, depth, revert_tuple_keys, recursive=False):
        container = deepget(obj, key, 1)
        item      = deepget(obj, key, 0)

        if isinstance(item, Iterable) and not isinstance(item, str) and (
                not recursive):
            depth += 1
        if len(key) == depth:
            if key(-1) == len(container) - 1:  # iterable end reached
                depth -= 1      # exit iterable
                key = key(:-1)  # drop iterable key
                if key in revert_tuple_keys:
                    supercontainer = deepget(obj, key, 1)
                    k = dkey(supercontainer, key(-1))
                    supercontainer(k) = tuple(deepget(obj, key))
                if depth == 0 or len(key) == 0:
                    key = None  # exit flag
                    # recursively exit iterables, decrementing depth
                    # and dropping last key with each recursion
                    key, depth = _process_key(obj, key, depth, revert_tuple_keys,
            else:  # iterate next element
                key(-1) += 1
        elif depth > len(key):
            key.append(0)  # iterable entry
        return key, depth

    key = (0) 
    depth = 1
    revert_tuple_keys = ()

    if isinstance(obj, tuple):
        obj = list(obj)
        revert_tuple_keys.append(None)  # revert to tuple at function exit

    while key is not None:
        container = deepget(obj, key, 1)
        item      = deepget(obj, key, 0)

        if isinstance(container, tuple):
            ls = list(container)  # cast to list to enable mutating
            ls(key(-1)) = fn(item, key)

            supercontainer = deepget(obj, key, 2)
            k = dkey(supercontainer, key(-2))
            supercontainer(k) = ls
            revert_tuple_keys.append(key(:-1))  # revert to tuple at iterable exit
            k = dkey(container, key(-1))
            container(k) = fn(item, key)

        key, depth = _process_key(obj, key, depth, revert_tuple_keys)

    if None in revert_tuple_keys:
        obj = tuple(obj)
    return obj


import numpy as np
from collections.abc import Iterable
from copy import deepcopy
from time import time
from deepmap import deepmap

def fn1(x, key):
    return str(x) if not isinstance(x, Iterable) else x

def fn2(x, key):
    return x ** 2 if isinstance(x, (int, float, np.generic)) else x

def fn3(x, key):
    return str(x)

def make_bigobj():
    arrays = (np.random.randn(100, 100), np.random.uniform(30, 40, 10))
    lists = ((1, 2, '3', '4', 5, (6, 7)) * 555, {'a': 1, 'b': arrays(0)})
    dicts = {'x': (1, {2: (3, 4)}, (5, '6', {'7': 8}) * 99) * 55,
             'b': ({'a': 5, 'b': 3}) * 333, ('k', 'g'): (5, 9, (1, 2))}
    tuples = (1, (2, {3: np.array((4., 5.))}, (6, 7, 8, 9) * 21) * 99,
              (10, (11,) * 5) * 666)
    return {'arrays': arrays, 'lists': lists,
            'dicts': dicts, 'tuples': tuples}

def deeplen(obj):
    count = (0)
    def fn(x, key):
        if not isinstance(x, Iterable) or isinstance(x, str):
            count(0) += 1
        return x
    deepmap(obj, fn)
    return count(0)

#### CORRECTNESS  ##############################################################
arr = np.random.randint(0, 9, (2, 2))
obj = (1, {'a': 3, 'b': 4, 'c': ('5', 6., (7, 8)), 'd': 9}, arr)

out1 = deepmap(deepcopy(obj), fn1)
assert str(out1) == ("('1', {'a': '3', 'b': '4', 'c': ('5', '6.0', ('7', '8')), "
                     "'d': '9'}, array(((7, 5),n       (1, 8))))")
out2 = deepmap(deepcopy(obj), fn2)
assert str(out2) == ("(1, {'a': 9, 'b': 16, 'c': ('5', 36.0, (49, 64)), "
                     "'d': 81}, array(((49, 25),n       ( 1, 64))))")
out3 = deepmap(deepcopy(obj), fn3)
assert str(out3) == (r"""('1', "{'a': 3, 'b': 4, 'c': ('5', 6.0, (7, 8)), """
                     r"""'d': 9}", '((7 5)n (1 8))')""")

#### PERFORMANCE  ##############################################################
bigobj  = make_bigobj()

_bigobj = deepcopy(bigobj)
t0 = time()
assert deeplen(bigobj) == 53676
print("deeplen:     {:.3f} sec".format(time() - t0))
assert str(bigobj) == str(_bigobj)  # deeplen should not mutate `bigobj`

bigobj = deepcopy(_bigobj)
t0 = time()
deepmap(bigobj, fn1)
print("deepmap-fn1: {:.3f} sec".format(time() - t0))

# deepmap-fn2 takes too long
deeplen:     0.856 sec
deepmap-fn1: 0.851 sec

Using Fold[ or Map[ Better?

I’m working through MMA Cookbook by Mangano, page 54. He shows Map is a compact form of Fold function. Is using Fold function important?

In[57]:= myMap3[f_,l_]:=Fold[Prepend[#1,f[#2]]&,{},l]
In[58]:= myMap3[Sqrt,{1,2,3}]
Out[58]= {Sqrt[3],Sqrt[2],1}


I value writing better MMA code. Mastering Functional forms, then moving into Rewrite-rules. Thanks in advance.

properties – How to map a ClassifierFunction on a 2D list and get probabilities?

I successfully apply ClassifierFunction on a simple list, for example

ClassifierFunction[logRatios] But
Map[ClassifierFunction,logRatios] gives me an error "The data being evaluated is not formatted correctly". I want to map the ClassifierFunction to a list of lists with probabilities. I can't figure out how to get the probabilities even if the mapping worked.

python – Network color map based on road length (Pyhton, osmnx, networkx)

Currently, I have a plot that shows all the shortest paths between all the nodes in my network and my target: enter description of image here

Now I would like to make a color palette, where I would color the original nodes and edges depending on the distance from the shortest path. Can anyone help me?

Here's what I have:

import networkx as nx
import matplotlib.pyplot as plt
import osmnx as ox
import pandas as pd
import geopandas as gpd
from shapely.wkt import loads as load_wkt

ox.config(log_console=True, use_cache=True)

place = {'city': 'Lisbon', 'country': 'Portugal'}
G = ox.graph_from_place(place, network_type='drive')
G = ox.project_graph(G)
hospitals = ox.pois_from_place(place, amenities=('hospital'))

hosp_1 = hospitals.iloc(21)('geometry')  # Hospital Santa Maria (Polygon)

def poly_centroide(polygon):

# Gives me the coordinates of the center point of the Polygon

    p1 = load_wkt(polygon)
    centroide = p1.centroid.wkt

    return centroide

polygon_1 = str(hosp_1)

coord_1_str = poly_centroide(polygon_1)

coord_1 = (38.74817825481225, -9.160815118526642)  # Coordinates Hospital Santa Maria

target_1 = ox.get_nearest_node(G, coord_1)

routes = ()
for node in G.nodes:
        route = nx.shortest_path(G, node, target_1)
    except nx.exception.NetworkXNoPath:

fig, ax = ox.plot_graph_routes(G, routes, edge_linewidth=0.2, node_size=5, route_linewidth=1)

Now I would like to know how to create the cmap where the colors of the nodes and edges are based on the distance of the shortest path.

I wonder if it could be done with nx.draw() but I do not know how …

Thanks in advance.