8wDlpd.png
8wDFp9.png
8wDEOx.png
8wDMfH.png
8wDKte.png

Java Spring 应用程序不知为何被终止,没有留下任何痕迹

RARE Kpop Manifesto 2月前

49 0

我正在寻找一种解决方案,以便在我的 2D 游戏中的等距场景中正确对对象进行排序目前我正在使用这种方法:int itemSortingOrder = - (int) (item.GameObject.transform.parent.trans...

我正在寻找一种解决方案,以便在我的 2D 游戏中的等距场景中正确对对象进行排序

Wrong sorting

目前我正在使用这种方法:

int itemSortingOrder = - (int) (item.GameObject.transform.parent.transform.position.y * 1000);

但问题是,它 transform.position 被存储为 WorldCoordinates,Object's coordinates in Unity inspector当单个单元格周围的几面墙具有相同的坐标时,就会导致问题。我通过不仅计算项目的位置,还添加对象的“边界”来解决了这个问题:Green diamonds - bounds of the object

但我觉得我选择了错误的方法,应该以其他方式解决这个问题。

您能就场景中物体的排序方法提供一些建议吗?

帖子版权声明 1、本帖标题:Java Spring 应用程序不知为何被终止,没有留下任何痕迹
    本站网址:http://xjnalaquan.com/
2、本网站的资源部分来源于网络,如有侵权,请联系站长进行删除处理。
3、会员发帖仅代表会员个人观点,并不代表本站赞同其观点和对其真实性负责。
4、本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
5、站长邮箱:yeweds@126.com 除非注明,本帖由RARE Kpop Manifesto在本站《ubuntu》版块原创发布, 转载请注明出处!
最新回复 (0)
  • MJH 2月前 0 只看Ta
    引用 1

    我想为单触摸屏创建一个本地多人 2D 游戏,它应包括以下功能:1 分屏:屏幕的每个部分都有一个独立的摄像头来跟踪......

    我想为单触摸屏创建一个本地多人 2D 游戏,该游戏应包含以下功能:1 分屏:屏幕的每个部分都有一个独立的摄像头来跟随玩家,因为游戏世界比屏幕大得多,玩家可以位于世界上的任何地方 2 游戏应该能够同时响应所有玩家 3 每个玩家可以拥有自己的 UI,例如分数、库存和虚拟操纵杆

    因为我想在 Unity 中使用 Cinemachine 和新输入系统,所以我遇到一个问题:如何将每个摄像机中的触摸事件传递给其对应的玩家而不影响其他玩家,有没有什么方法可以让玩家-摄像机对拥有自己的屏幕触摸输入和 UI 点击事件,而不与同一屏幕上的其他玩家-摄像机对交互?

    我正在使用 Cinemachine 和新输入系统,每个玩家都可以拥有自己的摄像头和虚拟摄像头,从而拥有自己的视图,并且我使用 PlayerInputManager 获得了分屏,但似乎摄像头不能有独立的玩家触摸事件输入,当我触摸摄像头区域时,所有玩家都会收到相同的输入。当然,如果我使用不同的控制设备(例如游戏手柄或操纵杆),我可以实现我想要的,但我只有一个触摸屏来响应用户操作,仅此而已。

  • 我正在尝试按照官方安装页面上的说明在 Ubuntu(WSL)上安装 miniconda:https://docs.anaconda.com/free/miniconda/miniconda-install/我可以下载包...

    我正在尝试按照官方安装页面上的说明在 Ubuntu(WSL)上安装 miniconda: https://docs.anaconda.com/free/miniconda/miniconda-install/

    我可以下载该软件包,但在安装时,我收到如下所示的错误消息-

    Miniconda3 will now be installed into this location:
    /home/suma/miniconda3
    
      - Press ENTER to confirm the location
      - Press CTRL-C to abort the installation
      - Or specify a different location below
    
    [/home/suma/miniconda3] >>>
    PREFIX=/home/suma/miniconda3
    Unpacking payload ...
    
    Installing base environment...
    
    
    # >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
    
        Traceback (most recent call last):
          File "conda/exception_handler.py", line 17, in __call__
          File "conda/cli/main.py", line 66, in main_subshell
          File "conda/base/context.py", line 472, in __init__
          File "conda/common/configuration.py", line 1416, in _set_search_path
          File "boltons/setutils.py", line 125, in __init__
          File "boltons/setutils.py", line 355, in update
          File "conda/common/configuration.py", line 1389, in _expand_search_path
          File "pathlib.py", line 1322, in is_file
          File "pathlib.py", line 1097, in stat
        PermissionError: [Errno 13] Permission denied: '/home/chandsum/miniconda3/.condarc'
    
    `$ /home/suma/miniconda3/_conda install --offline --file /home/suma/miniconda3/pkgs/env.txt -yp /home/suma/miniconda3`
    
      environment variables:
                     CIO_TEST=<not set>
               CONDA_CHANNELS=https://repo.anaconda.com/pkgs/main,https://repo.anaconda.com/pkgs/r
            CONDA_DEFAULT_ENV=base
                    CONDA_EXE=/home/chandsum/miniconda3/bin/conda
    CONDA_EXTRA_SAFETY_CHECKS=no
              CONDA_PKGS_DIRS=/home/suma/miniconda3/pkgs
                 CONDA_PREFIX=/home/chandsum/miniconda3
        CONDA_PROMPT_MODIFIER=(base)
             CONDA_PYTHON_EXE=/home/chandsum/miniconda3/bin/python
                  CONDA_QUIET=0
          CONDA_REGISTER_ENVS=true
                   CONDA_ROOT=/home/suma/miniconda3/install_tmp/_MEIR38PLO
            CONDA_ROOT_PREFIX=/home/suma/miniconda3
          CONDA_SAFETY_CHECKS=disabled
                  CONDA_SHLVL=1
               CURL_CA_BUNDLE=<not set>
              LD_LIBRARY_PATH=/home/suma/miniconda3/install_tmp/_MEIR38PLO
                   LD_PRELOAD=<not set>
          OLD_LD_LIBRARY_PATH=
                         PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/game
                              s:/usr/local/games:/snap/bin
           REQUESTS_CA_BUNDLE=<not set>
                SSL_CERT_FILE=<not set>
    
         active environment : /home/chandsum/miniconda3
        active env location : /home/chandsum/miniconda3
                shell level : 1
           user config file : /home/suma/.condarc
     populated config files :
              conda version : 24.1.2
        conda-build version : not installed
             python version : 3.10.13.final.0
                     solver : libmamba (default)
           virtual packages : __archspec=1=skylake
                              __conda=24.1.2=0
                              __cuda=11.6=0
                              __glibc=2.35=0
                              __linux=5.15.146.1=0
                              __unix=0=0
           base environment : /home/suma/miniconda3/install_tmp/_MEIR38PLO  (read only)
          conda av data dir : /home/suma/miniconda3/install_tmp/_MEIR38PLO/etc/conda
      conda av metadata url : None
               channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                              https://repo.anaconda.com/pkgs/main/noarch
                              https://repo.anaconda.com/pkgs/r/linux-64
                              https://repo.anaconda.com/pkgs/r/noarch
              package cache : /home/suma/miniconda3/install_tmp/_MEIR38PLO/pkgs
                              /home/suma/.conda/pkgs
           envs directories : /home/suma/.conda/envs
                              /home/suma/miniconda3/install_tmp/_MEIR38PLO/envs
                   platform : linux-64
                 user-agent : conda/24.1.2 requests/2.31.0 CPython/3.10.13 Linux/5.15.146.1-microsoft-standard-WSL2 ubuntu/22.04.3 glibc/2.35 solver/libmamba conda-libmamba-solver/24.1.0 libmambapy/1.5.6
                    UID:GID : 1001:1001
                 netrc file : None
               offline mode : False
    
    
    An unexpected error has occurred. Conda has prepared the above report.
    If you suspect this error is being caused by a malfunctioning plugin,
    consider using the --no-plugins option to turn off plugins.
    
    Example: conda --no-plugins install <package>
    
    Alternatively, you can set the CONDA_NO_PLUGINS environment variable on
    the command line to run the command without plugins enabled.
    
    Example: CONDA_NO_PLUGINS=true conda install <package>
    
    If submitted, this report will be used by core maintainers to improve
    future releases of conda.
    Would you like conda to send this report to the core maintainers? [y/N]: y
    Upload did not complete.
    
    

    我检查了 SHA256 哈希,它与官方网站相符。有谁遇到过这个问题并解决了吗?

  • 这是我的脚本:#!/bin/bash# Proxmox Ubuntu 模板创建脚本。# 该脚本旨在在 Proxmox 主机上运行。# 所需脚本包REQUIRED_PKG=(\'libguestfs-tools&qu...

    这是我的脚本:

    #!/bin/bash
    
    # Proxmox Ubuntu template create script.
    # This script is designed to be run on the Proxmox host.
    
    # Required script packages
    REQUIRED_PKG=("libguestfs-tools" "wget")
    
    ### Constants
    GEN_PASS=$(date +%s | sha256sum | base64 | head -c 16 ; echo) # Random password generation
    WORK_DIR="/tmp"
    
    ### Defaults
    CLOUD_PASSWORD_DEFAULT=$GEN_PASS # Password for cloud-init
    CLOUD_USER_DEFAULT="root" # User for cloud-init
    LOCAL_LANG="en_GB.UTF-8"
    SET_X11="yes" # "yes" or "no" required
    VMID_DEFAULT="52000" # VM ID
    X11_LAYOUT="gb"
    X11_MODEL="pc105"
    
    ### Virt-Customize variables
    VIRT_PKGS="qemu-guest-agent,cloud-utils,cloud-guest-utils"
    EXTRA_VIRT_PKGS="" # Comma separated packages. Leave empty if not installing additional packages.
    
    ### VM variables
    AGENT_ENABLE="1" # Change to 0 if you don't want the guest agent
    BALLOON="768" # Minimum balooning size
    BIOS="ovmf" # Choose between ovmf or seabios
    CORES="2"
    DISK_SIZE="15G"
    DISK_STOR="proxmox" # Name of disk storage within Proxmox
    FSTRIM="1"
    MACHINE="q35" # Type of machine. Q35 or i440fx
    MEM="2048" # Max RAM
    NET_BRIDGE="vmbr1" # Network bridge name
    TAG="template"
    
    OS_TYPE="l26" # OS type (Linux 6x - 2.6 Kernel)
    # SSH Keys. Unset the variable if you don't want to use this. Use the public key. One per line.
    SSH_KEY=$(cat << 'EOF'
    ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOFLnUCnFyoONBwVMs1Gj4EqERx+Pc81dyhF6IuF26WM proxvms
    EOF
    )
    TZ="Europe/London"
    VLAN="50" # Set if you have VLAN requirements
    ZFS="true" # Set to true if you have a ZFS datastore
    
    # Notes variable
    NOTES=$(cat << 'EOF'
    When modifying this template, make sure you run this at the end
    
    apt-get clean \
    && apt -y autoremove --purge \
    && apt -y clean \
    && apt -y autoclean \
    && cloud-init clean \
    && echo -n > /etc/machine-id \
    && echo -n > /var/lib/dbus/machine-id \
    && sync \
    && history -c \
    && history -w \
    && fstrim -av \
    && shutdown now
    EOF
    )
    
    ### Functions
    
    # CTRL+C/INT catch
    ctrl_c() {
        echo "User pressed Ctrl + C. Exiting script..."
        cleanup
        exit 1
    }
    
    proxmox_check() {
    # Check if the script is running on a Proxmox system
    echo "### System Check ###"
    if pveversion &>/dev/null; then
        echo "This is a Proxmox system. Proceeding."
    else
        echo "This script is intended to run only on Proxmox. Exiting."
        exit 1
    fi
    }
    
    # Check if prerequisite package is installed.
    package_installed() {
        for pkg in "${REQUIRED_PKG[@]}"; do
            dpkg -l | grep -q "^ii  $pkg "
            if [ $? -ne 0 ]; then
                return 1
            fi
        done
        return 0
    }
    
    install_package() {
        echo "### Package Installation ###"
    
        # Check if the packages are already installed.
        if package_installed; then
            echo "The required packages are already installed."
        else
            # Prompt the user for installation confirmation with "Y" as the default choice.
            read -rp "Do you want to install the required packages '${REQUIRED_PKG[*]}'? (Y/n): " user_choice
            user_choice=${user_choice:-Y}
    
            if [[ "$user_choice" == "N" || "$user_choice" == "n" ]]; then
                echo "Package installation aborted."
                exit 0
            elif [[ "$user_choice" == "Y" || "$user_choice" == "y" ]]; then
                # Install the required packages using apt-get with -y flag for automatic "yes" to prompts.
                sudo apt-get update
                sudo apt-get install -y "${REQUIRED_PKG[@]}"
    
                # Check the exit status of apt-get to see if the installation was successful.
                if [ $? -eq 0 ]; then
                    echo "Required packages '${REQUIRED_PKG[*]}' are installed successfully."
                else
                    echo "Installation of required packages '${REQUIRED_PKG[*]}' failed."
                    exit 1
                fi
            else
                echo "Invalid choice. Aborting package installation."
                exit 1
            fi
        fi
    }
    
    select_ubuntu_version() {
        declare -A camel_to_lower
    
        camel_to_lower["Jammy"]="jammy"
        camel_to_lower["Focal"]="focal"
        camel_to_lower["Mantic"]="mantic"
        camel_to_lower["Lunar"]="lunar"
        camel_to_lower["Noble"]="noble"
    
        echo "Choose an Ubuntu version:"
    
        select version in "${!camel_to_lower[@]}"; do
            if [ -n "$version" ]; then
                selected_version="${camel_to_lower["$version"]}"
                break
            else
                echo "Invalid choice. Please select a valid option."
            fi
        done
    
        if [ -n "$selected_version" ]; then
            DISTRO_VER="$selected_version"
            DISK_IMAGE="$DISTRO_VER-server-cloudimg-amd64.img"
            IMAGE_URL="https://cloud-images.ubuntu.com/$DISTRO_VER/current/$DISK_IMAGE"
            TEMPL_NAME_DEFAULT=$(echo "ubuntu-$DISTRO_VER-cloud-master" | sed -r 's/(^|_)([a-z])/\U\2/g')
            OS_NAME="Ubuntu $DISTRO_VER" # Name of VM
            OS_NAME="$(echo "$OS_NAME" | awk '{for(i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) tolower(substr($i,2));}1')"
            echo "Selected Ubuntu version: $version"
        else
            echo "Invalid choice, exiting."
            return
        fi
    }
    
    # DISK_IMAGE="jammy-server-cloudimg-amd64.img"
    # IMAGE_URL="https://cloud-images.ubuntu.com/jammy/current/$DISK_IMAGE"
    
    
    # Check if VM ID exists
    vmidexist() {
        local vmid="$1"
        # Check if the VM ID exists in the list
        if qm list | awk '{print $1}' | grep -q "^$vmid$"; then
            return 0 # VM exists
        else
            return 1 # VM does not exist
        fi
    }
    
    # Function to get a valid VM ID from the user
    get_valid_vmid() {
        local vmid_input
        read -p "Enter a VM ID (default: $VMID_DEFAULT): " vmid_input
        VMID="${vmid_input:-$VMID_DEFAULT}"
    
        while vmidexist "$VMID"; do
            echo "VM with ID $VMID exists."
            read -p "Enter a new VM ID: " VMID
        done
    }
    
    # Define user variables
    user_var() {
        # Prompt for user-defined variables
        read -p "Enter a VM Template Name [$TEMPL_NAME_DEFAULT]: " TEMPL_NAME
        TEMPL_NAME=${TEMPL_NAME:-$TEMPL_NAME_DEFAULT}
    
        read -p "Enter a Cloud-Init Username for $OS_NAME [$CLOUD_USER_DEFAULT]: " CLOUD_USER
        CLOUD_USER=${CLOUD_USER:-$CLOUD_USER_DEFAULT}
    
        read -p "Enter a Cloud-Init Password for $OS_NAME [$CLOUD_PASSWORD_DEFAULT]: " CLOUD_PASSWORD
        CLOUD_PASSWORD=${CLOUD_PASSWORD:-$CLOUD_PASSWORD_DEFAULT}
    
        # Optionally, set default values for VMID if needed
        # VMID=${VMID:-$VMID_DEFAULT}
    
        # Optionally, set default values for OS_NAME and VMID if needed
        # OS_NAME=${OS_NAME:-$OS_NAME_DEFAULT}
        # VMID=${VMID:-$VMID_DEFAULT}
    }
    
    # Remove temporary files
    cleanup() {
        # Display a message indicating temporary file deletion is starting.
        echo "### Deleting temporary files ###"
    
        # Check if the file "99_pve.cfg" exists and remove it if it does.
        if [ -f "/tmp/99_pve.cfg" ]; then
            rm -v /tmp/99_pve.cfg
        fi
    
        if [ -f "$DISK_IMAGE" ]; then
            # Prompt the user for their choice of whether to delete the image
            read -rp "Do you want to delete the image at '$DISK_IMAGE'? (Y/n): " user_choice
            user_choice=${user_choice:-Y}
    
            if [[ "$user_choice" == "Y" || "$user_choice" == "y" ]]; then
                # Remove the disk image and display a message.
                rm -v "$DISK_IMAGE"
                echo "Image deleted: $DISK_IMAGE"
            else
                # Display a message indicating the image was not deleted.
                echo "Image not deleted: $DISK_IMAGE"
            fi
        else
            # Display a message indicating that the image does not exist.
            echo "Image not found: $DISK_IMAGE"
        fi
    }
    
    
    # Create and move to working directory
    create_work_dir() {
    echo "### Creating working directory in $WORK_DIR ###"
    mkdir -p $WORK_DIR
    cd $WORK_DIR || exit
    }
    
    # Download the disk image if it doesn't exist or if it was modified upsteam
    download_image() {
        echo "### Downloading $DISK_IMAGE ###"
        wget -N -nv --show-progress "$IMAGE_URL"
    }
    
    # Install qemu-guest-agent inside image
    install_virt_pkgs() {
        if [ -n "${TZ+set}" ]; then
            echo "### Setting up TZ ###"
            virt-customize -a $DISK_IMAGE --timezone $TZ
        fi
    
        if [ $SET_X11 == 'yes' ]; then
            echo "### Setting up keyboard language and locale ###"
            virt-customize -a $DISK_IMAGE \
            --firstboot-command "localectl set-locale LANG=$LOCAL_LANG" \
            --firstboot-command "localectl set-x11-keymap $X11_LAYOUT $X11_MODEL"
        fi
    
        echo "### Updating system and installing packages ###"
        virt-customize -a $DISK_IMAGE --update --install $VIRT_PKGS
    
        if [ -z "$EXTRA_VIRT_PKGS" ]
        then
              echo "No additional packages to install"
        else
              virt-customize -a $DISK_IMAGE --update --install $EXTRA_VIRT_PKGS
        fi
    }
    
    # Create Proxmox Cloud-init config
    create_proxmox_cloud_init_config() {
        echo "### Creating Proxmox Cloud-init config ###"
        echo -n > $WORK_DIR/99_pve.cfg
        cat > $WORK_DIR/99_pve.cfg <<EOF
    # to update this file, run dpkg-reconfigure cloud-init
    datasource_list: [ NoCloud, ConfigDrive ]
    EOF
    }
    
    # Copy Proxmox Cloud-init config to the image
    copy_cloud_init_config_to_image() {
        echo "### Copying Proxmox Cloud-init config to image ###"
        virt-customize -a $DISK_IMAGE --upload $WORK_DIR/99_pve.cfg:/etc/cloud/cloud.cfg.d/
    }
    
    # Create the VM
    create_vm() {
        echo "### Creating VM ###"
        qm create $VMID --name $TEMPL_NAME --memory $MEM --balloon $BALLOON --cores $CORES --bios $BIOS --machine $MACHINE --net0 virtio,bridge=${NET_BRIDGE}${VLAN:+,tag=$VLAN}
        qm set $VMID --agent enabled=$AGENT_ENABLE,fstrim_cloned_disks=$FSTRIM
        qm set $VMID --ostype $OS_TYPE
        if [ $ZFS == 'true' ]; then
            echo "### ZFS set to $ZFS ###"
            qm importdisk $VMID $WORK_DIR/$DISK_IMAGE $DISK_STOR
            qm set $VMID --scsihw virtio-scsi-single --scsi0 $DISK_STOR:vm-$VMID-disk-0,cache=writethrough,discard=on,iothread=1,ssd=1
            qm set $VMID --efidisk0 $DISK_STOR:0,efitype=4m,,pre-enrolled-keys=1,size=528K
        else
            echo "### ZFS set to $ZFS ####"
            qm importdisk $VMID $WORK_DIR/$DISK_IMAGE $DISK_STOR -format qcow2
            qm set $VMID --scsihw virtio-scsi-single --scsi0 $DISK_STOR:$VMID/vm-$VMID-disk-0.qcow2,cache=writethrough,discard=on,iothread=1,ssd=1
            qm set "$VM"
        fi
        qm set $VMID --tags $TAG
        qm set $VMID --scsi1 $DISK_STOR:cloudinit
        qm set $VMID --rng0 source=/dev/urandom
        qm set $VMID --ciuser $CLOUD_USER
        qm set $VMID --cipassword "$CLOUD_PASSWORD"
        qm set $VMID --boot c --bootdisk scsi0
        qm set $VMID --tablet 0
        qm set $VMID --ipconfig0 ip=dhcp
        qm cloudinit update $VMID
        qm set $VMID --description "$NOTES"
    }
    
    # Apply SSH Key if the value is set
    apply_ssh() {
    echo "### Applying SSH Key ###"
    if [ -n "${SSH_KEY+set}" ]; then
        qm set $VMID --sshkey <(cat <<<"${SSH_KEY}")
    fi
    }
    
    # Resize VM disk
    vm_resize() {
    echo "### Resizing VM disk ###"
    qm resize $VMID scsi0 $DISK_SIZE
    }
    
    ### Run script
    
    # Check if the script is running under Proxmox
    proxmox_check
    
    # Trap CTRL+C
    trap ctrl_c INT
    
    # Install prerequisite packages
    install_package
    
    # Choose which flavour of Ubuntu to create
    select_ubuntu_version
    
    # Check if VM ID exists, and if it does, prompt for a new ID
    get_valid_vmid
    
    # Define user variables
    user_var
    
    # Create and move to working directory
    create_work_dir
    
    # Download the disk image if it doesn't exist or if it was modified upsteam
    download_image
    
    # Install qemu-guest-agent, set timezone and keyboard
    install_virt_pkgs
    
    # Create Proxmox Cloud-init config
    create_proxmox_cloud_init_config
    
    # Copy Proxmox Cloud-init config to the image
    copy_cloud_init_config_to_image
    
    # Create the VM
    create_vm
    
    # Apply SSH Key if the value is set
    apply_ssh
    
    # Resize VM disk
    vm_resize
    
    # Remove temporary files
    cleanup
    

    我该如何使用它。我已经制作了虚拟机,但它无法启动,当我将其变成模板并克隆它时,我仍然无法启动它。

    抱歉,问了个菜鸟问题。

    -钛

    当我运行脚本,将其转换为模板,克隆模板,然后运行模板时,它不起作用,而我希望它能起作用。

  • 我在 Ubuntu 上有一个 java Spring boot 应用程序,它(主要)运行良好。但是,如果我访问一个调用控制器的网站 - 数据被获取,网站被显示,但几秒钟后 - 该应用程序被杀死......

    我在 Ubuntu 上有一个 java Spring boot 应用程序,它(主要)运行良好。

    但是,如果我访问一个调用控制器的网站 - 数据被获取,网站被显示,但几秒钟后 - 应用程序被杀死!(ps -ef 不显示应用程序,控制器都死了)。

    我试图在这个类中捕捉 Spring 关闭操作:

    @Slf4j
    @Component
    public class AlpacaServiceLifeCycle implements CommandLineRunner {
        @Override
        public void run(String... arg0) throws Exception {
            log.info("###START FROM THE LIFECYCLE###");
        }
    
        @PreDestroy
        public void onExit() {
            log.info("###STOP FROM THE LIFECYCLE###");
            new Exception().printStackTrace();
        }
    }
    

    还有这个类:

    @Component
    public class ContextClosedEventListener {
        @EventListener(ContextClosedEvent.class)
        public void onContextClosedEvent(ContextClosedEvent     contextClosedEvent) {
            System.out.println("ContextClosedEvent occurred     at millis: " + contextClosedEvent.getTimestamp());
            new Exception().printStackTrace();
        }
    }
    

    此外,有问题的类实现了SmartLifecycle。

    但仍然什么也没有显示!

    如果应用程序内存不足,则会抛出异常并创建文件告诉我发生了什么。但这里不是(您可以看到数据保存在表中 - 表大小(一行)为 0.02MB)。

    会不会是 ubuntu 以某种方式杀死了该应用程序?

    有问题的控制器:

    @Slf4j
    @RestController
    @RequestMapping("/positions")
    public class PositionsController implements SmartLifecycle {
        private static final String BODY_HTML_END = "\t</body>\n" +
                "</html>";
        private static final String alpacaLink = "https://app.alpaca.markets/trade/{*}";
    
        @Autowired
        private PositionsFetchService positionsFetchService;
        @Autowired
        private SellStocksDailyIndicatorScheduler sellStocksDailyIndicator;
        @Autowired
        private DailyPurchaseLogCache dailyPurchaseLogCache;
    
        @Resource
        private PositionTableRepository positionTableRepository;
        
        @RequestMapping(value = "/list", method = RequestMethod.GET, produces = {MediaType.TEXT_HTML_VALUE})
        @ResponseStatus(HttpStatus.OK)
        public String list(@RequestParam(name = "soa", required = false) Boolean showOnlyAvailable) throws Exception {
            log.info("Positions called");
            
            if (positionTableRepository.findByFetchDate(LocalDate.now()) != null) {
                log.info("Fetching from DB");
                return positionTableRepository.findByFetchDate(LocalDate.now()).getTableStr();
            }
            
            Set<OutptOrderEntity> allOrders = dailyPurchaseLogCache.fetchAllOrders(false);
            StringBuilder theTable = new StringBuilder(CONSTANT_VISIBLE_HEADERS + "\t\t<table class=\"sortable\">");
            theTable = new StringBuilder(theTable.toString().replace("*TITLE*", "Positions"));
            theTable.append("\t\t<th>#</th>\n");
            theTable.append("\t\t<th>Created At</th>\n");
            theTable.append("\t\t<th>symbol</th>\n");
            theTable.append("\t\t<th>avg_entry_price</th>\n");
            theTable.append("\t\t<th>current_price</th>\n");
            theTable.append("\t\t<th>qty_available</th>\n");
            theTable.append("\t\t<th>cost_basis</th>\n");
            theTable.append("\t\t<th>market_value</th>\n");
            theTable.append("\t\t<th>diff</th>\n");
            theTable.append("\t\t<th>change_today</th>\n");
            theTable.append("\t\t<th>lastday_price</th>\n");
            theTable.append("\t\t<th>qty</th>\n");
            theTable.append("\t\t<th>unrealized_pl</th>\n");
    
            List<PositionEntity> positionEntities = positionsFetchService.fetch();
    
            for (int i = 0; i < positionEntities.size(); i++) {
                PositionEntity curr = positionEntities.get(i);
                if (curr.getAvg_entry_price() != null && curr.getCurrent_price() != null) {
                    try {
                        String symbol = curr.getSymbol();
                        List<OutptOrderEntity> ordersOfSymbol = allOrders.stream().filter(s -> s.getSymbol().equals(symbol)).collect(Collectors.toList());
                        if (ordersOfSymbol.isEmpty()) {
                            log.warn("Symbol {} doesn't have data", symbol);
                            continue;
                        }
                        LocalDateTime createdAt = ordersOfSymbol.get(ordersOfSymbol.size() - 1).getCreated_at();
                        if (showOnlyAvailable && Float.parseFloat(curr.getQty_available()) > 0f) {
                            theTable.append(new TableData(false, alpacaLink.replace("{*}", curr.getSymbol()),
                                    i + 1, createdAt, curr.getSymbol(), curr.getAvg_entry_price(), curr.getCurrent_price(), curr.getQty_available(), curr.getCost_basis(), curr.getMarket_value(),
                                    Float.parseFloat(curr.getMarket_value()) - Float.parseFloat(curr.getCost_basis()), curr.getChange_today(), curr.getLastday_price(), curr.getQty(), curr.getUnrealized_pl()).
                                    createString(Float.parseFloat(curr.getCurrent_price()) > Float.parseFloat(curr.getAvg_entry_price())));
    
                        } else if (!showOnlyAvailable) {
                            theTable.append(new TableData(false, alpacaLink.replace("{*}", symbol),
                                    i + 1, createdAt, curr.getSymbol(), curr.getAvg_entry_price(), curr.getCurrent_price(), curr.getQty_available(), curr.getCost_basis(), curr.getMarket_value(),
                                    Float.parseFloat(curr.getMarket_value()) - Float.parseFloat(curr.getCost_basis()), curr.getChange_today(), curr.getLastday_price(), 
                                    curr.getQty(), curr.getUnrealized_pl()). createString(Float.parseFloat(curr.getCurrent_price()) > Float.parseFloat(curr.getAvg_entry_price())));
                        }
                    } catch (Exception e) {
                        log.error(e.toString(), e);
                    }
                }
            }
    
            theTable.append("\t\t\t<script src=\"https://www.kryogenix.org/code/browser/sorttable/sorttable.js\"></script>");
            theTable.append("\n\t\t</table>\n");
            theTable.append(BODY_HTML_END);
            log.info("Fetched all positions");
    
            positionTableRepository.save(new PositionsTableEntity(theTable.toString()));
            
            return theTable.toString();
        }
    
        @RequestMapping(value = "/sell_qty_exists", method = RequestMethod.GET, produces = {MediaType.TEXT_HTML_VALUE})
        @ResponseStatus(HttpStatus.OK)
        public void sellQtyExists() throws Exception {
            sellStocksDailyIndicator.scalpOnAllIndicators();
        }
    
        @Override public boolean isAutoStartup() {
            return false;
        }
    
        @Override public void stop(Runnable runnable) {
            new Exception().printStackTrace();
        }
    
        @Override public void start() {
    
        }
    
        @Override public void stop() {
            new Exception().printStackTrace();
        }
    
        @Override public boolean isRunning() {
            return false;
        }
    
        @Override public int getPhase() {
            return 0;
        }
    } 
    
  • 我目前正在为 Apple Vision Pro 进行开发,但我的朋友似乎也在 meta-quest pro 上遇到了类似的问题;我在 Unity 中将音频监听器连接到了主 XR 摄像头

    我目前正在为 Apple Vision Pro 进行开发,但我的朋友似乎也在 meta-quest pro 上遇到了类似的问题;我在 Unity 编辑器中将音频监听器连接到主 XR 摄像头,即使耳机移动,音频监听器仍停留在原点或我启动应用程序的位置,因此当用户听到游戏对象的音频时,他们会根据启动应用程序的位置听到音频,而不是他们当前的位置/耳机在物理空间中的位置。

    我曾尝试过绕过这个问题,方法是将一个空的子游戏对象附加到主摄像头,并将音频源放置在该子对象上,以便它遵循摄像头/耳机坐标,但没有成功。我还使用文本网格专业版打印出了用户界面上的坐标,我可以向你保证,摄像头/耳机坐标确实会随着耳机的移动而变化,但音频侦听器听起来仍然像是来自原点,换句话说,就是我启动应用程序的位置,所以它似乎是固定的。附件是我在 Unity 编辑器中的对象层次结构的屏幕截图以及附加了音频侦听器组件的子对象。

    值得注意的是,我正在使用 ARFoundation、XR 交互工具包,并且正在为 Apple Vision Pro 开发一款“无界”应用程序。谢谢

    My object hierarchy in Unity editor for context Audio source as component in child object of the 'main XR camera'

  • 由于这是管理员路径,因此可以解释权限被拒绝的错误。应该有一种方法可以只为当前用户安装,而不会干扰其他用户的家庭所有者

  • 路径 /home/chandsum 是管理路径。我试图为用户 /home/suma/ 安装它。我是否应该更改安装位置?

  • WSL2 中是否存在 /home/chandsum?似乎它想使用它而不是 /home/suma/

返回
作者最近主题: