Video game main menu tab navigation mapping for PC

The tab navigation menu is very common for console video games. It is usually mapped on LB/RB buttons (Xbox).
Tab navigation in Fortnite

I wonder what would be the most intuitive mapping for PC keyboard?

Tab navigation mapping for video game main menu

The tab navigation menu is very common for console video games. It is usually mapped on LB/RB buttons (Xbox).
Tab navigation in Fortnite

I wonder what would be the most intuitive mapping for PC keyboard?

python – Mapping column names and values of a csv using another csv

I have two csv files, pricat.csv which contains objects I need to populate my DB with, and mapping.csv which specifies how the value in pricat.csv must be displayed in my DB, for ex: 'NW 17-18' in pricat.csv has to be 'Winter Collection 2017/2018' in my DB. Here the csvs, first row in both are the headers:

ean;supplier;brand;catalog_code;collection;season;article_structure_code;article_number;article_number_2;article_number_3;color_code;size_group_code;size_code;size_name;currency;price_buy_gross;price_buy_net;discount_rate;price_sell;material;target_area
8719245200978;Rupesco BV;Via Vai;;NW 17-18;winter;10;15189-02;15189-02 Aviation Nero;Aviation;1;EU;38;38;EUR;;58.5;;139.95;Aviation;Woman Shoes
8719245200985;Rupesco BV;Via Vai;;NW 17-18;winter;10;15189-02;15189-02 Aviation Nero;Aviation;1;EU;39;39;EUR;;58.5;;139.95;Aviation;Woman Shoes
source;destination;source_type;destination_type
winter;Winter;season;season
summer;Summer;season;season
NW 17-18;Winter Collection 2017/2018;collection;collection
EU;European sizes;size_group_code;size_group
EU|36;European size 36;size_group_code|size_code;size
EU|37;European size 37;size_group_code|size_code;size
EU|38;European size 38;size_group_code|size_code;size
EU|39;European size 39;size_group_code|size_code;size
EU|40;European size 40;size_group_code|size_code;size
EU|41;European size 41;size_group_code|size_code;size
EU|42;European size 42;size_group_code|size_code;size
4;Boot;article_structure_code;article_structure
5;Sneaker;article_structure_code;article_structure
6;Slipper;article_structure_code;article_structure
7;Loafer;article_structure_code;article_structure
8;Mocassin;article_structure_code;article_structure
9;Sandal;article_structure_code;article_structure
10;Pump;article_structure_code;article_structure
1;Nero;color_code;color
2;Marrone;color_code;color
3;Brandy Nero;color_code;color
4;Indaco Nero;color_code;color
5;Fucile;color_code;color
6;Bosco Nero;color_code;color

In my models.py in Django I have three models: Catalog –> Article –> Variation the attributes of my models are manually named as mapping.csv specifies, for ex: Variation will not have a color_code attribute but color.
To populate the DB I’ve created a custom Django command which reads the rows in pricat.csv and create istances like this:

x = Catalog.objects.get_or_create(brand=info(2), supplier=info(1), catalog_code=info(3),
                                  collection=map_dict(info(4)),
                                  season=map_dict(info(5)), size_group=map_dict(info(11)),
                                  currency=info(14), target_area=info(20))
y = Article.objects.get_or_create(article_structure=map_dict(info(6)),
                                  article_number=info(7), catalog=x(0))
z = Variation.objects.get_or_create(ean=info(0), article=y(0), size_code=info(12), color=map_col(info(10)),
                                    material=info(19), price_buy_gross=info(15), price_buy_net=info(16),
                                    discount_rate=info(17), price_sell=info(18), size=f'{map_dict(info(11))} {info(12)}')

info is a list of all the value in a pricat.csv row and map_dict and map_col are two dictionaries I create with two func() from the mapping.csv:

def mapping(map_file):
    with open(map_file, 'r') as f:
        f = (l.strip('n') for l in f)
        map_dict = {}
        for l in f(1:19):
            info = l.strip().split(';')
            source = info(0)
            destination = info(1)
            source_type = info(2)
            destination_type = info(3)
            map_dict(source) = destination
            map_dict(source_type) = destination_type
        return map_dict


def mapping_color(map_file):
    with open(map_file, 'r') as f:
        f = (l.strip('n') for l in f)
        map_dict = {}
        for l in f(19:):
            info = l.strip().split(';')
            source = info(0)
            destination = info(1)
            source_type = info(2)
            destination_type = info(3)
            map_dict(source) = destination
            map_dict(source_type) = destination_type
        return map_dict

map_dict = mapping('mapping.csv')
map_col = mapping_color('mapping.csv')

I had to create two dict because a single one would have duplicate keys.

The code works fine and the DB is populated as intended, but I feel the way I did the mapping is bad practice, also both my command and funcs relies on indeces so the values in my csvs have to be in that specific order to work. I would greatly appreciate any suggestion on how to improve my code or accomplish this task, I hope my explanation is clear.

general topology – Mapping a semi-infinite strip to the first quadrant

I want to find the image of the semi-infinite strip
$$
0 le Re(z) le fracpi2, Im(y) ge 0
$$

under the map
$$
w = frac{i}{sin z}
$$

I first rewrite the mapping function as
$$
w = frac{1}{cos x sinh y – i sin x cosh y}
$$

So the right boundary gets mapped to the imaginary axis from 0 to 1; the bottom boundary gets mapped to the imaginary axis from 1 to $infty$, and the left boundary gets mapped to the positive real axis. From here, it becomes clear that this maps the infinite strip to the first quadrant. But I don’t how to manipulate the points within the strip. e.g. the vertical lines. I tried to plug in $x = c$ into the mapping function, but don’t know how to further simplify it. Can someone give me a hint? Thanks!

Mapping the Status property between the MS Word Property and the Status SharePoint site column

Inside MS Office word we have the Status property as follow:-

enter image description here

and inside a SharePoint online site collection i added the built-in Status site column inside a document library:-

enter image description here

now when i upload a document the Status will be mapped between the MS office word and SharePoint. For example if a document have status = “Not Started” and i upload the document then the Status inside SharePoint will also be “Not Started” (as shown in the above 2 pictures)… but the issue i am facing is that the Status inside MS Office word will be a free text while inside SharePoint it will be a drop-down, so the status inside MS office word can contain a value not inside the drop-down choices as in the “Not Started” case.. so how i can fix this issue? either by modifying the MS office word property or the SharePoint site column?

Thanks

MS Azure/Google S Suite User Provisioning/Attribute Mapping

I’m using MS Azure to sync/provision my users with Google. It’s working fine except for I need to sync the Azure email attribute with a Google user email alias, as users are set for SSO using their UPN and not email address. Can someone tell me how to edit the mappings in MS Azure to map the attribute?

optimization – How badly are distances distorted by mapping a rectangle to a line?

Purely out of curiousity, I was thinking about the following question:

Let $(n)$ be the set ${0,1,2,ldots,n-1}$ and consider the cartesian product $(n)times (m)$. Given any bijection $f:(n)times(m)rightarrow (nm)$, let’s define its distortion as the greatest difference $|f(x_1)-f(x_2)|$ in its evaluation between two adjacent elements $x_1$ and $x_2$ of $(n)times(m)$ where “adjacency” is considered that they agree in one coordinate and differ by exactly $1$ in the other coordinate. What is the minimum possible distortion of any bijection?

One might consider this as something about minimizing the Lipschitz constant of a bijection between a discrete line segment and a lattice rectangle under the taxicab metric.


One can constrain the answer fairly well: for a lower bound to distortion, observe that some element $x_1$ of $(n)times (m)$ must have $f(x_1)=0$ and some $x_2$ must have $f(x_2)=nm-1$. There has to be some path of at most $n+m-2$ points in $(n)times (m)$, each adjacent to the prior, connecting $x_1$ and $x_2$. Thus, some difference along this path must be at least $frac{nm-1}{n+m-2}$.

On the other side, one can consider the explicit bijection $f(a,b)=ma+b$ or $g(a,b)=a+nb$ to get that some bijection has distortion at most $min(n,m)$. There are other maps that attain this bound (e.g. you can adapt Cantor’s pairing function to this finite domain to get this bound – essentially by ordering the points of the rectangle by diagonals and the filling each diagonal in in a consistent order). My guess is that this bound is optimal, although I lack a good argument to prove it. There’s roughly a ratio of $2$ between the two bounds I give here in the worst case.

As far as exact results, this the distortion is clearly at least $1$ for any map $(1)times (n)rightarrow (n)$ where $ngeq 1$ and at least $2$ for any map $(2)times (n)rightarrow (2n)$ where $ngeq 2$ simply due to the pigeonhole principle. One can work out that all maps $(3)times (3)rightarrow (9)$ (and by extension $(3)times (n)rightarrow (3n)$ for $ngeq 3$) have distortion at least $3$ by extending the lower bound argument a touch. I checked with computer that $(4)times (4)rightarrow (16)$ maps have distortion at least $4$ and $(5)times (5)rightarrow (25)$ maps have distortion at least $5$. I told my computer to try working on the $(6)times(6)$ case but I’m not optimistic that it will survive the combinatorial explosion.

amazon web services – port mapping didn’t happen for a container deployed on AWS ECS(uses EC2)

Context:

I am using Circle CI’s aws-ecs/deploy-service-update orb to deploy my docker container by pulling the latest image in AWS ECR and deploy it in AWS ECS with AWS EC2 instance. This container is a Machine Learning model that accepts API requests at TCP port 3000(I am using fastAPI for this) and returns the predictions. After I deployed it I couldn’t send requests to the public IP of the container instance of the task that deploys the container at port 3000 (This IP is not my EC2 instance’s public IP; it only has private IP and public IP is disable).

Debugging

  1. I checked my security group and made sure that the port 3000 is open to receive requests from all IPs(0.0.0.0), as part of the inbound rule.
  2. I stopped the task(which automatically will stop the container running in the EC2 instance) with the thought that something may have gone wrong from Circle CI. Then, according to the service configuration(1 desired task) and task definition of AWS ECS, a new task has started(hence the container) automatically. But, I couldn’t send requests to this either.
  3. I SSHed into my EC2 instance to know if the port 3000 is open. This is when is when I learned that ports weren’t mapped at all:
    enter image description here
    As you can see, PORTS column is empty for the container and the container has to accept requests at port 3000 from the command.

And here are the open ports of the EC2 instance:
enter image description here
As you can see, port 3000 is not listed here.


Here is the task with port mappings which deployed the container (to AWS ECS) that you see docker ps screenshot above:
enter image description here
In the task definition, you can see the port mappings I have defined for the container.


Here is the task running on my EC2 instance with the task-definition shown above and the network mode I am using is ‘awsvpc’:
enter image description here


Here’s the “Networking” tab of ENI associated with the task, and also the inbound rule of the security group associated with the EC2 instance that the task is running inside, which accepts requests on port 3000 from all IPs.
enter image description here

EDIT 1:

After I did

docker run -p 3000:3000 <my-image:my-tag>

inside the EC2 machine(by SSHing from my laptop), I could send API requests and receive proper response to the container to it’s public IP, of the cluster of AWS ECS. This means that ports are being mapped only when I run the container manually.

I had no problems with ports when I used FARGATE, when I updated the service from Circle CI or even when I manually started tasks.

So, how to automatically map ports when a task is run from AWS ECS service dashboard or from Circle CI? If I run docker container manually, I will not be able to get logs automatically from AWS Cloudwatch and will not be able to stop it from AWS ECS dashboard. Another container by AWS that is running in EC2 instance will take care of those things. It will route the logs to Cloudwatch and accepts stop the existing one and start commands to start a new container with new image stored in AWS ECR, without having to SSH everytime I would want to look at logs or start/stop containers.

What has gone wrong here, which led to ports not being mapped and How do I fix it and map ports properly, so i will be able to send API requests to my container.

Mapping a custom domain registered in Google Domains to a website in Google New-Sites

I had this working with old-Sites, but new-Sites messed everything up.
(1) Need to map orgchangedoctor.com & www.orgchangedoctor.com to https://sites.google.com/site/orgchangedoctor
(2) Would like to map the entire URL including folders and html
(3) Lastly, have the orgchangedoctor.com url display on the browser (not the Sites address)

I have been going in circles with various help articles that make changes to Google Domains DNS (variations on Synthetic Records and Custom Resource Records), Google Domains Website (Build a website, Simple site, and use existing site), and Google new-Sites (Settings, Custom URL).

database design – I have a [Tag] table will associated with multiple entity tables, should I create mapping table for each or only one table?

The (tag) table schema:

___________________________________
|column |type        |note        |
|-------+------------+------------|
|id     |bigint      |primary key |
|name   |varchar(20) |            |
-----------------------------------

the entity1 tag associate table (entity1_tag_map) schema:

__________________________________
|column     |type   |note        |
|-----------+-------+------------|
|entity1_id |bigint |primary key |
|tag_id     |bigint |primary key |
----------------------------------

but I have more than 5 entity need to associate to tag table. it means I will create 5 or more table like this.

The other idea is only create one table, and add a column for entity type:

_________________________________________
|column      |type         |note        |
|------------+-------------+------------|
|entity_id   |bigint       |primary key |
|tag_id      |bigint       |primary key |
|entity_type |nvarchar(50) |primary key |
-----------------------------------------

Is this better than the previous one?