A c++ program to take the size and components of an Array from user and return the reversed Array

I have written this code that should take the size and components of the array from the user and then return the reverse of the Array but not able to identify and fix the error.
My best guess is that the while loop is causing trouble, but I am not sure.

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;


// function to reverse given array
void reverseArray(int arr(), int start, int end){

while (start<=end){
    int temp = arr(start);
    arr(start) = arr(end);
    arr(end) = temp;
    start++;
    end--;
       
}

}


// function to print given array
void printArray(int arr(), int size){
   for (int i = 0; i < size; i++)
   cout << arr(i) << " ";
}


int main() {
    int n;
    cin >> n;
    int mainarray() = {n} ; 
    n = sizeof(mainarray);

    for (int i=0; i<n; i++) {
        cin >> mainarray(i);
    }

reverseArray(mainarray , 0, n-1);
printArray(mainarray ,n);

    return 0;
}

sensor size – Focal length for a specific distance?

I have the following information:

s: Image sensors dimensions: 6.00mm, 4.80mm, 3.60mm (diagonal, horizontal, and vertical)
f: focal length range: 5.1mm - 51mm
f=(s*WD/FOV), where `WD` is the working distance and the `FOV` is the object size. 

I would like to compute the optimal f for a given WD=10m and FOV=1mx1m.

Which sensor dimension should I choose (diagonal, horizontal, or vertical)? Since the results differ quite heavily depending on that.

Thanks

plotting – Minimal ListPlot Marker Size

I would like to make a ListPlot where the size of each marker is controlled separately.

The best solution I have found so far is to wrap every data point in Style with its own PointSize value, as suggested here

ListPlot[Table[Style[RandomReal[{-2, 2}, 2], PointSize[RandomReal[{0, 0.03}]]], {i, 100}]]

enter image description here

However, this type of scaling does not allow reducing the size to zero, but keeps the marker size constant at some point:

ListPlot[Table[Style[RandomReal[{-2, 2}, 2], PointSize[0]], {i, 100}]]

enter image description here

How can I ensure that the scaling of the markers is really linear with respect to Pointsize all the way to zero?

amazon web services – Troubleshooting block device mappings with Packer to increase size of EBS volume

I’d like to understand more about what to do when you need to increase a block device size for a build. I have some examples that work successfully with ubuntu 18, and centos 7 that I use, but it seems like each time I’m in a slightly new scenario the old techniques don’t apply, and that is probably due to a gap in my knowledge of what is required.

Building an AMI with NICE DCV (remote display):

name: DCV-AmazonLinux2-2020-2-9662-NVIDIA-450-89-x86_64

I tried this in my packer template:

  launch_block_device_mappings {
    device_name           = "/dev/sda1"
    volume_size           = 16
    volume_type           = "gp2"
    delete_on_termination = true
  }

But then ssh never became available. I reverted to not doing any customisation, and took a look at the mounts:

(ec2-user@ip-172-31-39-29 ~)$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        482M     0  482M   0% /dev
tmpfs           492M     0  492M   0% /dev/shm
tmpfs           492M  740K  491M   1% /run
tmpfs           492M     0  492M   0% /sys/fs/cgroup
/dev/xvda1      8.0G  4.4G  3.7G  55% /
tmpfs            99M  8.0K   99M   1% /run/user/42
tmpfs            99M     0   99M   0% /run/user/1000

So I thought I should try this instead (which didn’t work):

  launch_block_device_mappings {
    device_name           = "/dev/xvda1"
    volume_size           = 20
    volume_type           = "gp2"
    delete_on_termination = true
  }

which resulted in these errors:

==> amazon-ebs.amazonlinux2-nicedcv-nvidia-ami: Authorizing access to port 22 from (0.0.0.0/0) in the temporary security groups...
==> amazon-ebs.amazonlinux2-nicedcv-nvidia-ami: Launching a source AWS instance...
==> amazon-ebs.amazonlinux2-nicedcv-nvidia-ami: Adding tags to source instance
    amazon-ebs.amazonlinux2-nicedcv-nvidia-ami: Adding tag: "Name": "Packer Builder"
==> amazon-ebs.amazonlinux2-nicedcv-nvidia-ami: Error launching source instance: InvalidBlockDeviceMapping: Invalid device name /dev/xvda1
==> amazon-ebs.amazonlinux2-nicedcv-nvidia-ami:         status code: 400, request id: 2c419989-dd53-48ef-bcb6-6e54e892d152
==> amazon-ebs.amazonlinux2-nicedcv-nvidia-ami: No volumes to clean up, skipping
==> amazon-ebs.amazonlinux2-nicedcv-nvidia-ami: Deleting temporary security group...
==> amazon-ebs.amazonlinux2-nicedcv-nvidia-ami: Deleting temporary keypair...
Build 'amazon-ebs.amazonlinux2-nicedcv-nvidia-ami' errored after 1 second 820 milliseconds: Error launching source instance: InvalidBlockDeviceMapping: Invalid device name /dev/xvda1
        status code: 400, request id: 2c419989-dd53-48ef-bcb6-6e54e892d152

Would anyone be able to share some pointers on what I’d need to do to increase the volume size in this instance and why?

algorithms – Sub-matrix with minimum size of k and minimum sum

We have an $n x m$ matrix whose entries are non-negative integers and we want to find a sub-matrix whose area (number of entries) is at least k such that the sum of the entries are mimum. The answer to this problem is the sum of these entries.

My solution:
Using dynamic programming, I have defined the sum of entries from the (0,0) entry to (i,j) as $sum(i)(j)$. If the $(i,j)$ entry is $entry(i)(j)$ then we have $sum(i)(j) = sum(i-1)(j) + sum(i)(j-1) – sum(i-1)(j-1) + entry(i)(j)$. Except, when either dimension of $sum$ is 0, the values are only the entries.
If I find all the combinations of sub-matrices with area of at least k, I can compare the sum of their entries and the minimum would be the answer.
The last part is where I’d appreciate your help.

P.S: If you have a better idea for this problem, that would be appreciated too!

magento2 – Magento 2 – How to change fotorama nav shaft thumbnail image size – for grouped products?

I need to change the size of the small images below the gallery, but only for products of type grouped

enter image description here

Normaly you can change the size in the file THEME/etc/view.xml:

<?xml version="1.0"?>
<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/view.xsd">
    <media>
        <images module="Magento_Catalog">
            ...
            <image id="product_page_image_small" type="thumbnail">
                <width>110</width>
                <height>110</height>
            </image>
            ...

So I tried to change it for grouped products only like this:

<?xml version="1.0"?>
<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/view.xsd">
    <media>
        <images module="Magento_GroupedProduct">
            <image id="product_page_image_small" type="thumbnail">
                <width>129</width>
                <height>129</height>
            </image>
        </images>
        <images module="Magento_Catalog">
            ...
            <image id="product_page_image_small" type="thumbnail">
                <width>110</width>
                <height>110</height>
            </image>
            ...

Then I flushed the cache. But it does not work. The image size still stays 110px instead of 129px.

How do I set the size of a single ‘unit’ in my game?

I’m currently trying to remake/port an old game created on Unreal Engine 2.5 to my own engine, and I have access to its physics data. It’s using a scale of 80 units per meter, or 1 unit = 1.25cm.

The walk speed value for example is 5, and physics is simulated at 60 FPS, so the walking speed I need to implement would be 3.75 meters per second.

But I don’t exactly know what the size of a game engine’s "unit" actually means. I of course want my own engine (I’m using C++, OpenGL, and GLM) to use this same scale, but I’m not sure how to go about that. I’d assume this affects not only physics/movement code, but the scale of models and maps I load in as well, so it’s important to make sure it’s the same as in the original game.

How would I implement this? What parts of a game does the size of a ‘unit’ affect and how? Just the physics and movement calculations, or the graphics side as well (matrices, clipping space, FOV, etc.)?

(I’m not sure if I’m overthinking things)