Scaling monitors – Ask Ubuntu

I have two monitors, one on my laptop that have the resolution 3840×2160 and one external that’s 1920×1080. To be able to see anything on my laptop I need to have it at 200% scale but then everything get to big on my external screen. I have tried
xrandr --output DVI-I-1-1 --scale 0.5x0.5 to try and scale the second monitor. This make it so the second screen is only a square at the top right instead.

I have also tried what what is explained here: Ubuntu 18.04 different scaling for bulit-in and external monitor (changed the numbers of course) but this didn’t scale anything correctly and when trying to get my cursor to the other screen my laptop-screen kinda moves to the left and disappears.

Sorry if this is a bad explanation, am very new to Ubuntu.

I have Nvidia driver 460 and Ubuntu 18.04

geometric intuition – Why do geometrical scaling laws work differently for empty vs. filled regions?

My question has to do with scaling laws, i.e., how surface areas scale as the square of the linear dimension, and volumes scale as the cube of the linear dimension. And, therefore, volumes should scale as the 3/2 power of areas.

Examples: (1) Suppose you have a cube in which each edge measures 5 meters. By what factor will the volume increase if you double the length of each edge? Answer: The volume increases by 2^3 or a factor of 8. (The 2 came from the factor by which we’re increasing the length of each edge. And the 5 meters was irrelevant; the volume would increase by a factor of 8 regardless of the starting size.)
(2) What is the volume of a cube whose sides each have an area of 9 square centimeters. Answer: 9^(3/2) = 27 cubic centimeters. (One could also answer this by taking the square root of 9 to determine that each edge is 3 cm long, and then cube that to get 27 c.c., but that square root and cubing is equivalent to raising to the 3/2 power.)

My problem:
Suppose you have a square divided into 3×3 or 9 sub-squares. Remove the center sub-square; we can think of that as a pore or a void, and it occupies 1/9 (11.1%) of the area. We can say that the porosity is 11.1%.

Now lets move up to three dimensions. Instead of a square, we have a cube divided into 3x3x3 or 27 sub-volumes. Create a void by removing the center sub-cube. Your porosity is then 1/27 (3.7%). Consistent with our scaling laws, we could have also gotten that result by raising 1/9 to the 3/2 power, which also gives you 3.7%. So the scaling law seems to work for this kind of problem.

Now the question is, Why can’t you do the same thing with the non-void (solid) portion? The solid part occupies 88.9% of the square and 96.3% of the cube. But one cannot go from 89.9% to 96.3% with the same 3/2-power scaling that worked so well for the empty area. Why not? Why the difference in doing this with the solid part vs. the empty part?

Matt

matt20742@gmail.com

how does unity handle image scaling

Unlike in android SDKs, in almost all tutorials I’ve seen, creating UI elements like menus in unity starts with laying out a default background image onto a canvas object.

I don’t really get the fact that different resolution image are not kept in the folder as we do in android(mdpi, xdpi etc.). Is this expected for unity? I mean, the same app can be viewed in a 4K wide screen right? Wouldn’t the image appear blurred? How is that handled for apps created by unity? No tutorial I’ve viewed so far seems to really care for that. Please give me some idea on how this is handled or supposed to be handled in unity 3D.

unity – How can I scale with speed ? The speed in this case also make the scaling size but I want it only to control the speed

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Walls : MonoBehaviour
{
    public GameObject gameObjectToRaise;
    public float raiseAmount;
    public float raiseTotal = 50;
    public float speed = 2;
    public static bool raised = false;

    private List<GameObject> cubes;
    private GameObject go;

    public bool randomColor;
    public Color() colorChoices;

    Vector3 lp;
    Vector3 ls;

    // Use this for initialization

    void Start()
    {
        lp = gameObjectToRaise.transform.localPosition;
        ls = gameObjectToRaise.transform.localScale;

        GameObject cube = CUBE.CreatePrimitive(CUBE.CubePivotPoint.UPLEFT);
        GameObject cube1 = CUBE.CreatePrimitive(CUBE.CubePivotPoint.UPRIGHT);

        cube.transform.position = new Vector3(lp.x, lp.y, lp.z);
        cube1.transform.position = new Vector3(lp.x, lp.y, lp.z);
        cube1.transform.Rotate(0, 90, 0);

        StartCoroutine(scaleCube(cube.transform));
        StartCoroutine(scaleCube(cube1.transform));

        GameObject clone1 = Instantiate(cube);
        GameObject clone2 = Instantiate(cube1);

        clone1.transform.localScale = cube.transform.localScale;
        clone2.transform.localScale = cube1.transform.localScale;
        clone1.transform.position = new Vector3(lp.x, lp.y, lp.z - 15);
        clone2.transform.position = new Vector3(lp.x - 15, lp.y, lp.z);
    }

    IEnumerator scaleCube(Transform trans)
    {
        while (raiseAmount < raiseTotal)
        {
            raiseAmount += 1;
            trans.localScale += new Vector3(speed * Time.deltaTime, speed * Time.deltaTime, 0);
            yield return null;
        }
    }

    public class CUBE
    {
        public enum CubePivotPoint
        {
            MIDDLE, RIGHT, LEFT, UP, DOWN, FORWARD, BACK, UPLEFT,
            UPRIGHT, FORWARDUP, BACKUP
        }

        //Takes CubePivotPoint Enum as pivot point
        public static GameObject CreatePrimitive(CubePivotPoint pivot)
        {
            //Calculate pivot point
            Vector3 cubePivot = createPivotPos(pivot);

            //Create cube with the calculated pivot point
            return createCubeWithPivotPoint(cubePivot);
        }

        //Takes Vector3 as pivot point
        public static GameObject CreatePrimitive(Vector3 pivot)
        {
            //Create cube with the calculated pivot point
            return createCubeWithPivotPoint(pivot);
        }

        private static Vector3 createPivotPos(CubePivotPoint pivot)
        {
            switch (pivot)
            {
                case CubePivotPoint.MIDDLE:
                    return new Vector3(0f, 0f, 0f);
                case CubePivotPoint.LEFT:
                    return new Vector3(0.5f, 0f, 0f);
                case CubePivotPoint.RIGHT:
                    return new Vector3(-0.5f, 0f, 0f);
                case CubePivotPoint.UP:
                    return new Vector3(0f, 0.5f, 0f);
                case CubePivotPoint.DOWN:
                    return new Vector3(0f, -0.5f, 0f);
                case CubePivotPoint.FORWARD:
                    return new Vector3(0f, 0f, 0.5f);
                case CubePivotPoint.BACK:
                    return new Vector3(0f, 0f, -0.5f);
                case CubePivotPoint.UPLEFT:
                    return new Vector3(0.5f, -0.5f, 0);
                case CubePivotPoint.UPRIGHT:
                    return new Vector3(-0.5f, -0.5f, 0);
                case CubePivotPoint.FORWARDUP:
                    return new Vector3(0.5f, -0.5f, -0.5f);
                case CubePivotPoint.BACKUP:
                    return new Vector3(0f, -0.5f, -0.5f);
                default:
                    return default(Vector3);
            }
        }

        private static GameObject createCubeWithPivotPoint(Vector3 pivot)
        {
            //Create a cube postioned at 0,0,0
            GameObject childCube = GameObject.CreatePrimitive(PrimitiveType.Cube);
            //Create an empty parent object
            GameObject parentObject = new GameObject("CubeHolder");
            //Move the parent object to the provided pivot postion 
            parentObject.transform.position = pivot;
            //Make the childcube to be child child of the empty object (CubeHolder)
            childCube.transform.SetParent(parentObject.transform);
            return parentObject;
        }
    }
}

At this line :

trans.localScale += new Vector3(speed * Time.deltaTime, speed * Time.deltaTime, 0);

If I set the speed to 1000 for example it will raise a very big walls.
but I don’t want the speed to change the size. The speed should only change how fast the walls will be build.

I found how to do it with the speed but still when running there is a delay for maybe a second or millisecond before it start building even if the speed is set to 0 not sure why :

IEnumerator scaleCube(Transform trans)
    {
        while (raiseAmount < raiseTotal)
        {
            raiseAmount += 1;
            trans.localScale += new Vector3(raiseAmount, raiseAmount, 0);

            yield return new WaitForSeconds(speed * Time.deltaTime);
        }
    }

scaling filter fails when coverting size of video using ffmpeg

I wanted to convert size of a video using ffmpeg but it fails with following error.

ffmpeg -v verbose -i Running-Map-Reduce-program-on-EMR_frag.mp4 -vcodec h264 -filter scale=800x600  -f mp4 -hls_segment_filename 'file%03d.ts' out.m3u8

ffmpeg version N-103157-ge6754d2ad2 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-44)
  configuration: 
  libavutil      57.  3.100 / 57.  3.100
  libavcodec     59.  4.100 / 59.  4.100
  libavformat    59.  4.101 / 59.  4.101
  libavdevice    59.  0.100 / 59.  0.100
  libavfilter     8.  1.103 /  8.  1.103
  libswscale      6.  0.100 /  6.  0.100
  libswresample   4.  0.100 /  4.  0.100
(h264 @ 0x3278600) Reinit context to 1600x912, pix_fmt: yuv420p
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Running-Map-Reduce-program-on-EMR_frag.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41iso5
  Duration: 00:12:28.02, start: -0.023220, bitrate: 310 kb/s
  Stream #0:0(und): Video: h264 (Constrained Baseline), 1 reference frame (avc1 / 0x31637661), yuv420p(left), 1598x900 (1600x912), 231 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
    Metadata:
      handler_name    : Bento4 Video Handler
      vendor_id       : (0)(0)(0)(0)
  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 75 kb/s (default)
    Metadata:
      handler_name    : Bento4 Sound Handler
      vendor_id       : (0)(0)(0)(0)
Matched encoder 'h264_vaapi' for codec 'h264'.
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_vaapi))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press (q) to stop, (?) for help
(h264 @ 0x3365300) Reinit context to 1600x912, pix_fmt: yuv420p
(Parsed_scale_0 @ 0x3726b80) w:800 h:600 flags:'' interl:0
(graph 0 input from stream 0:0 @ 0x3727980) w:1598 h:900 pixfmt:yuv420p tb:1/12800 fr:25/1 sar:0/1
(auto_scaler_0 @ 0x3727140) w:iw h:ih flags:'' interl:0
(format @ 0x3727300) auto-inserting filter 'auto_scaler_0' between the filter 'Parsed_scale_0' and the filter 'format'
Impossible to convert between the formats supported by the filter 'Parsed_scale_0' and the filter 'auto_scaler_0'
Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while processing the decoded data for stream #0:0
(AVIOContext @ 0x336d180) Statistics: 0 seeks, 0 writeouts
(AVIOContext @ 0x327fc80) Statistics: 9588735 bytes 

How should I handle Azure SQL hanging when scaling up from General Purpose to Hyperscale?

I’m in the process of scaling up an Azure SQL database from General Purpose to Hyperscale. This has been running for more than 12 hours. When I check the “Ongoing operations” it says that it is “Scaling database performance” and “Progress: 0%”.

I’m not sure if I should wait for it to complete, or click the “Cancel this operation” and try another approach. How should I handle Azure SQL hanging when scaling up from General Purpose to Hyperscale?

ergonomics – Which screen PPI / scaling is recommended for a computer display?

This is a tricky one to answer!

Firstly, DPI and PPI aren’t the same thing conceptually. One is a measure of the dots per inch on a printed output and one the pixels per inch of a digital display.

I believe as a result you’re kinda talking cross purposes. The windows DPI setting of 96 is the default https://support.corel.com/hc/en-us/articles/115001485408-Display-Options-How-to-change-DPI-Scaling-Level-for-displays-in-Windows-10-#:~:text=DPI%20setting%20controls%20the%20size,has%20setting%20of%2096%20DPI.

And by changing this what you’re effectively doing is scaling a ratio (as I understand it) the number of “dots” (which doesn’t make much sense in digital displays) which would make up an inch (I assume, given the windows dialog) of screen. What this results in, (by reducing DPI) is more pixels representing the same inch that 96 would have, thereby given a fixed hardware resolution display making the screen elements appear smaller.

As a side point, Windows 10 has done away with this dialog and shows interface scaling as a percentage.

So, context aside, your original question asks what the optimum PPI / scaling is recommended for reading a typical computer display. What you’re asking is at least two questions.

The reason it’s at least questions is that the output “size” of text on screen is a function of both PPI and scaling. For example, a 24″ 4k monitor with a high DPI and scaling of 200% will look identical (in size) to a 24″ 1080p monitor with a scaling of 100%. The 4k monitor will look sharper at this setting because there are 2x the pixels per inch and techniques like pixel rounding and smoothing are less pronounced.
This is especially true of mobile devices which may have a very high hardware PPI, but internal scaling (on android its just “smallest to largest” which they control. I’m not aware of the technical scaling factors used here, I cite it to illustrate that different devices handling scaling differently in their terminology.

Finally, we come to “optimum” there are many ways to look at this:

  • Minimum text size to meet WCAG accessibility guidelines, but beyond this, recommended best practice for “base” font sizes. 9pt/12px has been given as the literal minimum before you starting failing A11y checks and should certainly not be used for body text for example where something close to 16px as a minimum would be recommended.
  • Optimum font spacing, line lengths and justifications, for readability (https://www.w3.org/TR/WCAG21/#visual-presentation)
  • Optimum for your content, userbase and use cases -For example if you’re expecting users to read in specific environmental conditions, you should consider this

Those three points alone could warrant and answer each, all longer that this answer!
DPI as a number in that context is largely meaningless, because it’s a measure from a single OS 20 years ago.

In summary, there is no optimum, scaling is a user controlled preference and should be treated as such, if a user chooses to change it, you should accommodate it (https://www.w3.org/TR/WCAG21/#resize-text).

ergonomics – Which screen DPI / scaling is recommended for a computer display?

Assuming a font size of 9 pt (pretty widespread minimum font size), what PPI / scaling is recommended for reading it from a typical computer display? Is the 96 PPI standard close to optimal, or is it just a legacy of old days when higher display PPI were not possible?

Windows dialogs certainly suggest it’s the optimum:
enter image description here