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

[Solved] How to go back to the original active cell after moving around in VBA?

0 Posts
1 Users
0 Likes
0 Views
0
Topic starter
R. Peek Asks: How to go back to the original active cell after moving around in VBA?
The vba code below:

Code:
Sub try_1()
Dim sac As Range  'Original ActiveCell
Set sac = ActiveCell
ActiveCell.Offset(0, 2).Select
sac.RefersToRange.Select
End Sub

Is intended to go back to the original ActiveCell, after doing stuff that is symbolized by the 2nd executable statement. However, it fails at the last statement just before "End Sub". Although there is an error message, I don't understand it. Can you help? I've tried leaving out "RefersToRange" but it did not work. I did figure a work around, but it is more complicated, and I'd prefer to keep the code as simple as reasonably feasible.

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] 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.

 

 


 

[Solved] inner string array filter in array object with string arrry

Mohammed salim ali Asks: inner string array filter in array object with string arrry

Code:
var mainobj=[[{
      "title": "Nifty News: Dapper Labs pursuing DAOs, Bundesliga partners with Sorare, and more. ",
    
      "category": [
        "Dapper Labs",
        " Brud",
        " Sorare",
        " Bundesliga",
        " Etched",
        " Hockey Diversity Alliance",
        " Archdiocese of Bangkok NFT"
      ],
      "description": "Nifty News: Dapper Labs pursuing DAOs, Bundesliga partners with Sorare, and more. ",
  
    },
    {
      "title": "Bitcoin returns to $1T asset as BTC price blasts to $55K",
     
      "category": [
        "Bitcoin",
        " BTC price"
      ],
      "description": "Bitcoin returns to $1T asset as BTC price blasts to $55K",
      
    }]]

var categoryfilterArray=['Bitcoin','Bundesliga','Sorare']

i need filter which match categoryfilterArray in mainobj

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] Spring Cloud Gateway do not create WebSocket connection due to CORS

Alexey Usharovski Asks: Spring Cloud Gateway do not create WebSocket connection due to CORS
I have a pretty simple configuration with Eureka for service discovery, Gateway for load balancing, and one service with WebSocket API.

If I try to access the service directly with a client (Angular + SocksJS) all works fine but if I put it behind the Gateway it produces 403 errors due to CORS.

Also I use Spring Security for authentication and can’t use tricks like setAllowedOrigins("*"). Please help me to find proper configuration for Gateway.

In browser logs I see errors like that

Code:
websocket.js:6 WebSocket connection to 'ws://localhost:4200/api/v1/socket-channel/457/x0j1bjvd/websocket' failed: One or more reserved bits are on: reserved1 = 1, reserved2 = 0, reserved3 = 0
.....
POST http://localhost:4200/api/v1/socket-channel/457/se02m4wm/xhr_streaming?t=1633548504411 403 (Forbidden)

Client connection code

Code:
export class OrderStatusService {

  private client;
  private state: BehaviorSubject<SocketClientState>;

  constructor() {
    this.client = Stomp.over(new SockJS("/api/v1/socket-channel"));
    this.state = new BehaviorSubject<SocketClientState>(SocketClientState.ATTEMPTING);
    this.client.connect({}, () => {
      this.state.next(SocketClientState.CONNECTED);
    });
  }

  private connect(): Observable<Client> {
    return new Observable<Client>(observer => {
      this.state.pipe(filter(state => state === SocketClientState.CONNECTED))
        .subscribe(() => {
          observer.next(this.client);
        });
    });
  }

  onMessage(topic: string): Observable<any> {
    return this.connect().pipe(first(), switchMap(client => {
      return new Observable<any>(observer => {
        const subscription: StompSubscription = client.subscribe(topic, message => {
          observer.next(JSON.parse(message.body));
        });
        return () => client.unsubscribe(subscription.id);
      });
    }));
  }
}

Spring Gateway configuration. Here I try many cases with direct URLs etc.

Code:
server:
  port: 8080

eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/
    fetch-registry: true

spring:
  application:
    name: gateway-service
  cloud:
    gateway:
      routes:
        - id: backend-api
          uri: lb://BACKEND-API
          predicates:
            - Path=/api/v1/**
        - id: backend-api-ws
          uri: lb:ws://BACKEND-API
          predicates:
            - Path=/api/v1/**

Websocket configuration

Code:
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {

    private static final Logger logger = LoggerFactory.getLogger(WebSocketConfig.class);

    @Override
    public void registerStompEndpoints(StompEndpointRegistry registry) {
        registry.addEndpoint("/socket-channel")
                .withSockJS();
    }

    @Override
    public void configureMessageBroker(MessageBrokerRegistry registry) {
        registry.setApplicationDestinationPrefixes("/order_in");
        registry.enableSimpleBroker("/order_out");
    }

}

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: