[Solved] How to han...
 
Notifications
Clear all

[Solved] How to handle dependencies between Angular form controls?

0 Posts
1 Users
0 Likes
0 Views
0
Topic starter
MatterOfFact Asks: How to handle dependencies between Angular form controls?
I'm developing an Angular (12) reactive form with lots of direct and indirect dependencies between the form control values. Example: The tax rate is dependent on the selected country, the date and the selected receipt type, but it can also be set manually. Changes of the tax rate trigger changes to the net amount. But the net amount can also be set manually with leads to changes of the gross amount. And so on...

I tried to handle these dependencies with the form control valueChanges subscriptions and with on blur events of the control components, but this ends in an event handler hell where one change overwrites the other.

What is the way to handle complex dependencies between Angular reactive form controls in a clean, clear and maintainable way? I couldn't find a suitable example for this.

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

Unreplied Posts

[Solved] Have a new Google form be started linked to an existing spreadsheet

josinalvo Asks: Have a new Google form be started linked to an existing spreadsheet
My problem:

I want to create a new form and have it automatically linked to an existing spreadsheet.

It can create a new sheet on the existing spreadsheet, but the linking step should be automatic.

Unfortunately, it seems that a copy of a form does not auto-link to the same spreadsheet as the original form, but if there is a solution based on copying forms rather than creating, that works as well.

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.
 
 
 

[Solved] Change aggregation type for Grand Total in pivot table (ie, to SUM)

Drewdavid Asks: Change aggregation type for Grand Total in pivot table (ie, to SUM)
I have a pivot table based on the MIN value.

That is fine. But now, the so-called “Grand Total” is also just showing the MIN of the columns. It seems it just sticks with the aggregation type selected for the Value(?)…

This isn’t much of a Grand Total, however. What I really want is the SUM of the columns (what I would expect).

I don’t see any immediate way to specify the aggregation type for the total; just a checkbox labelled “Show totals” (which I have employed).

That said: Is there some way to get a SUM as the “Grand Total”?

Here is my PT*:


enter image description here

And here are the current settings:


enter image description here

*I hope you enjoyed my mouse-writing; for some reason Windows Snip & Sketch has elected to omit text in it’s editing tools. The unhappy face was my own touch.

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] Why does GTmetrix give me the “serve images that are appropriately sized” error?

alancc Asks: Why does GTmetrix give me the “serve images that are appropriately sized” error?
I’ve run a GTmetrix test on my website.

I get one issue in its audit report:
audit report

I check the image with Chrome DevTools, as below:


chrome devtools

Since the test is for Desktop, the image size is 649 x 508 and it is served as 649 x 508.

Also I found that there is a srcset tag in the code for the different resolutions, which is also recommended in How to properly size images. So I cannot find the problem with the image, why does GTmetrix report it as an issue?

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] Why the object is not rotating slowly?

Haim Hadad Asks: Why the object is not rotating slowly?
At the top

Code:
public float secondsToRotate;
private float secondsSoFar = 0.0f;

Then in the Update

Code:
private Update()
{
  secondsSoFar += Time.deltaTime;
  float t = secondsSoFar / secondsToRotate;
  Vector3 lerpPoint = Vector3.Lerp(transform.position, -transform.position, t);
  transform.rotation = Quaternion.LookRotation(lerpPoint);
}

but instead of slowly smooth rotating it’s just waiting X seconds then rotate too fast like rotating at once. I wanted it to rotate slowly smooth. for example, if I set the secondsToRotate to 5 so the rotation will take 5 seconds.

The full script :

Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerSpaceshipAreaColliding : MonoBehaviour
{
    public float rotationSpeed;
    public float movingSpeed;
    public float secondsToRotate;

    private float timeElapsed = 0;
    private float lerpDuration = 3;
    private float startValue = 1;
    private float endValue = 0;
    private float valueToLerp = 0;
    private Animator playerAnimator;
    private bool exitSpaceShipSurroundingArea = false;
    private bool slowd = true;
    private float secondsSoFar = 0.0f;

    // Start is called before the first frame update
    void Start()
    {
        playerAnimator = GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
        if (exitSpaceShipSurroundingArea)
        {
            if (slowd)
                SlowDown();

            if (playerAnimator.GetFloat("Forward") == 0)
            {
                slowd = false;
            }

            if (slowd == false)
            {
                secondsSoFar += Time.deltaTime;
                float t = secondsSoFar / secondsToRotate;
                Vector3 lerpPoint = Vector3.Lerp(transform.position, -transform.position, t);
                transform.rotation = Quaternion.LookRotation(lerpPoint);
            }
        }
    }

    private void OnTriggerEnter(Collider other)
    {
        if (other.name == "CrashLandedShipUpDown")
        {
            exitSpaceShipSurroundingArea = false;
            Debug.Log("Entered Spaceship Area !");
        }
    }

    private void OnTriggerExit(Collider other)
    {
        if (other.name == "CrashLandedShipUpDown")
        {
            exitSpaceShipSurroundingArea = true;
            Debug.Log("Exited Spaceship Area !");
        }
    }

    private void SlowDown()
    {
        if (timeElapsed < lerpDuration)
        {
            valueToLerp = Mathf.Lerp(startValue, endValue, timeElapsed / lerpDuration);
            playerAnimator.SetFloat("Forward", valueToLerp);
            timeElapsed += Time.deltaTime;
        }

        playerAnimator.SetFloat("Forward", valueToLerp);
        valueToLerp = 0;
    }
}

In that place in the script, I’m trying to rotate the player smooth slowly to the opposite direction. I want also to increase the “Forward” speed when it’s rotating while it’s rotating but for now the rotation itself is not working at all the player is not rotating.

Code:
if (slowd == false)
                {
                    secondsSoFar += Time.deltaTime;
                    float t = secondsSoFar / secondsToRotate;
                    Vector3 lerpPoint = Vector3.Lerp(transform.position, -transform.position, t);
                    transform.rotation = Quaternion.LookRotation(lerpPoint);
                }

The main goal is to create some realistic effect when the player is leaving the colliding area the player will slow down then when the player has stopped to start rotating slowly to the opposite direction and start moving by increasing the “Forward” value while rotating.

Some realistic preventing from the player to leave the colliding area. when he try to leave the area he should move back in the colliding area.

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] Multiple glossaries on a single page with a chapter-title

max Asks: Multiple glossaries on a single page with a chapter-title
The setting is that I need to have two glossaries. They should be separated just by a medskip and not by a newpage-break. To stow them properly, I thought of putting them in a single chapter List of symbols.

The manual raises a warning when using the long-table style (e.g. long3col), but only for entries with long descriptions as there won’t be a page-break within a cell of a table. However, this does not apply here …

To suppress the page-break, I followed a comment of this post of nullifying the newpage-command temporarily (the accepted answer suggested to redefine glsclearpage, which didn’t work in my case and apparently for others neither)

Code:
begingroupletnewpagerelax
    printglossary
    printglossary
endgroup

The odd thing is that this seems to suppress the appearing of the chapter-title: The first chapter/glossaries produces six pages with a double page-break between the chapter title, the first glossary and the second glossary.

The second chapter/glossary attempt resulted in a page with both glossaries on but without any chapter-title (left); only if text is added, the chapter-title is printed (right):


tightGlossaryWithWithoutText

Code:
documentclass{scrbook}

usepackage{glossaries}
% define alternative glossaries
newglossary[ulg]{UppercaseCharacter}{uld}{udn}{List of uppercase characters}
newglossary[llg]{LowercaseCharacter}{lld}{ldn}{List of lowercase characters}

% Term definitions
newglossaryentry{A}{name=A, description={This is an uppercase character}, type=UppercaseCharacter}
newglossaryentry{a}{name=a, description={This is a lowercase character}, type=LowercaseCharacter}

% activateglossaries
makeglossaries
setglossarystyle{long3col}


begin{document} 
    chapter*{List of symbols}
     % Print the glossaries
    printglossary[type=UppercaseCharacter] % domain glossary
    printglossary[type=LowercaseCharacter] % domain glossary

    chapter*{Tight list of symbols}
    begingroupletnewpagerelax
        printglossary[type=UppercaseCharacter] % domain glossary
        bigskip
        printglossary[type=LowercaseCharacter] % domain glossary
    endgroup
    
    chapter*{Tight list of symbols + Text}
    dfgfgjfghj
    begingroupletnewpagerelax
    printglossary[type=UppercaseCharacter] % domain glossary
    printglossary[type=LowercaseCharacter] % domain glossary
    endgroup%clearpage


    chapter{Content}
    UPPERCASE: gls{A} and lowercase: gls{a}

end{document}

It further seems to be impossible to control the vertical spacing within the Tex-primitive group or is this rather because the glossaries are not supposed to be on a single page?

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] Change color of circles in Blochsphere package

manuel459 Asks: Change color of circles in Blochsphere package
For drawing qubit-states I used the blochsphere package, especially the code drawLongitudeCircle to draw the “equator”. I cannot find how to change the color (or opacity) of that line properly. The only thing working seems to be using style={gray} or something like that because the opacity option doesn’t work – which I’d prefer to use so the opcaity matches the ball’s one. Has anyone that is familiar with the blochsphere package got a better solution to this? Thank you

MWE (you can ignore everything after the definition of the points on the bloch sphere)

Code:
documentclass{article}
usepackage{amsmath}
usepackage{amssymb}
usepackage{amsfonts}
usepackage{tikz}
usetikzlibrary{positioning,arrows,calc,math,angles,quotes}
usepackage{blochsphere}
usepackage{braket}

begin{document}
%%%% Change these parameters to change the position of psi, or the size/rotation of the sphere
defrotationSphere{-110}
defradiusSphere{3cm}
defpsiLat{45}
defpsiLon{45}
begin{blochsphere}[radius=radiusSphere,opacity=0.1,rotation=rotationSphere]
  %drawBallGrid[style={opacity=.3}]{360}{90}
  % Draw the sphere...
  %drawLongitudeCircle[]{rotationSphere} % draw the longitude that face us to delimit the sphere
  %draw another circle
  drawLongitudeCircle[style={lightgray}]{0}
  % ... and the equatorial plane
  drawLatitudeCircle[style={dashed}]{0}
  % Define the different points on the bloch sphere
  labelLatLon{ket0}{90}{0};
  labelLatLon{ket1}{-90}{0};
  labelLatLon{ketminus}{0}{180};
  labelLatLon{ketplus}{00}{0};
  labelLatLon{ketpluspi2}{0}{-90};  % Longitude seems to be defined in the "wrong" direction, hence the minus
  labelLatLon{ketplus3pi2}{0}{-270};
  labelLatLon{psi}{psiLat}{-psiLon};
  % Draw and label the axis
  draw[-latex] (0,0) -- (ket0) node[above,inner sep=.5mm] at (ket0) {footnotesize $z$};
  draw[-latex] (0,0) -- (ketplus) node[below,inner sep=.5mm] at (ketplus) {footnotesize$x$};
  draw[-latex] (0,0) -- (ketpluspi2) node[below,inner sep=.5mm] at (ketpluspi2) {footnotesize $y$};
  % Draw |psi>
  draw[-latex] (0,0) -- (psi) node[above]{footnotesize $ket{psi}$};

  % Draw the angles
  coordinate (origin) at (0,0);
  {
    % Will draw the angle/projection one the equatorial plane
    setDrawingPlane{0}{0}
    % Draw the projection: cos is used to compute the length of the projection
    draw[current plane,dashed] (0,0) -- (-90+psiLon:{cos(psiLat)*radiusSphere}) coordinate (psiProjectedEquat) -- (psi);
    % Draw the angle
    pic[current plane, draw,fill=orange!50,fill opacity=.5, text opacity=1,"footnotesize $phi$", angle eccentricity=2.2]{angle=ketplus--origin--psiProjectedEquat};
  }
  { setLongitudinalDrawingPlane{psiLon}
    % Draw the angle
    pic[current plane, draw,fill=orange!50,fill opacity=.5, text opacity=1,"footnotesize $theta$", angle eccentricity=1.5]{angle=psi--origin--ket0};
  }
end{blochsphere}
end{document}

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] Columns Overlapping on Reference column

Max Asks: Columns Overlapping on Reference column
First off would just like to say I am pretty new at using latex, my supervisor wants me to use it to publish a paper. I feel like the beginner of beginners when it comes to LaTeX. So if this is painfully obvious to anyone here I am sorry.

The issue is that within my references section, the columns overlap with the main text column and some of the other references too. I have researched this a little but when trying to fix these errors, nothing worked, again being a novice i could have easily missed this. I attached the code for the beginning section to see if this is not enough and you need more information just say and I will reply with the code needed. I also attached an image which shows what the issue looks like

Code:
documentclass[conference]{IEEEtran}
IEEEoverridecommandlockouts
% The preceding line is only needed to identify funding in the 
% first footnote. If that is unneeded, please comment it out.

usepackage{flushend}
usepackage{cite}
usepackage{amsmath,amssymb,amsfonts}
usepackage{algorithmic}
usepackage{graphicx}
usepackage{textcomp}
pagestyle{plain}
usepackage{pgfplots}
pgfplotsset{width=10cm,compat=1.7}


%usepgfplotslibrary{external}
%tikzexternalize
defBibTeX{{rm Bkern-.05em{sc ikern-.025em b}kern-.08em
    Tkern-.1667emlower.7exhbox{E}kern-.125emX}}
begin{document}


Referencing issue image example

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] Positioning text on the side of a paragraph

rmfalcao Asks: Positioning text on the side of a paragraph
I would like to be able to place a text besides a paragraph.

The figure below illustrates the scenario:


enter image description here

I would like to add the text “This is a paragraph comment.” besides a paragraph. But I would not like to hard-code the position of this text in the page; I want instead to be able to tell LaTeX that this particular comment should go along with this specific paragraph.

I could imagine a command like this:

Code:
paragraphnote{This is a paragraph comment} Sed blandit justo vel justo blandit convallis. (...)

However I do not know whether such a command exists, or how it could be defined — furthermore, I do not know whether there is a different command, with a different approach, that do what I am looking for.

Thanks in advance.

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] File Exchange in a Peer-to-Peer Network

user994165 Asks: File Exchange in a Peer-to-Peer Network
I was just looking into peer-to-peer networks for large file exchange (e.g., GitHub – uber/kraken: P2P Docker registry capable of distributing TBs of data in seconds) I understand how the data exchange can grow exponentially because the number of hosts receiving and sending parts of the file grow exponentially. Assuming the hosts are all on one network, wouldn’t the network bandwidth quickly put a cap on how much can be transferred at any given time? How much better can this approach be over a non-P2P approach when distributing files within a cluster? Or is this more something you would do on the public internet, like in torrenting?

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] How to allow invalid JSON in asp.net?

Paul Biggar Asks: How to allow invalid JSON in asp.net?
I’ve got an extremely simple middleware in ASP.NET 6, and I’m not using Web APIs or MVC or controllers.

Requests to my app are failing when they include invalid JSON, but I need them to succeed so I can process the raw body.

In the past, I’ve changed the json parser, for example with:

Code:
.AddSingleTon<Json.ISerializer>(NewtonsoftJson.Serialize())

However, I’d like to completely disable JSON parsing by ASP.NET. Specifically, I don’t want invalid JSON to return a 400 Bad Request, as it does by default. Is there a way to configure this?

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

Share: