GVKun编程网logo

为什么我得到Error(为什么我得到二十四孝图既高兴又扫兴)

16

本文将分享为什么我得到Error的详细内容,并且还将对为什么我得到二十四孝图既高兴又扫兴进行详尽解释,此外,我们还将为大家带来关于amazon-web-services–为什么我得到ElasticBe

本文将分享为什么我得到Error的详细内容,并且还将对为什么我得到二十四孝图既高兴又扫兴进行详尽解释,此外,我们还将为大家带来关于amazon-web-services – 为什么我得到ElasticBeanstalk :: ExternalInvocationError?、android – 为什么我得到:“没有为此目标安装系统映像”、c# – 为什么我得到PingException?、ios – 为什么我得到手势识别器不能用于原型对象?的相关知识,希望对你有所帮助。

本文目录一览:

为什么我得到Error(为什么我得到二十四孝图既高兴又扫兴)

为什么我得到Error(为什么我得到二十四孝图既高兴又扫兴)

public class Category {

    private Category parentCategory;    private Set<Category> childCategories;    private String name;    public Category() {        childCategories = new HashSet<Category>();    }    public Category getParentCategory() {        return parentCategory;    }    public void setParentCategory(Category parentCategory) {        this.parentCategory = parentCategory;    }    public Set<Category> getChildCategories() {        return childCategories;    }    public void setChildCategories(Set<Category> childCategories) {        this.childCategories = childCategories;    }    public String getName() {        return name;    }    public void setName(String name) {        this.name = name;    }    @Override    public String toString() {        return "Category [childCategories=" + childCategories + ", name="                + name + ", parentCategory=" + parentCategory + "]";    }}public static void main(String[] args) {        Category books = new Category();        books.setName("Books");        books.setParentCategory(null);        Category novels = new Category();        novels.setName("Novels");        novels.setParentCategory(books);        books.getChildCategories().add(novels);        //novels.setChildCategories(null);        System.out.println("Books > " + books);    }

System.out.println正在生成StackOverflowError

答案1

小编典典

当您执行时toString(),您称呼toString()孩子们的。这里没有问题,只不过您toString()在这里调用了父对象。这将称呼toString()孩子,等等。

不错的无限循环。

摆脱它的最好方法是将您的toString()方法更改为:

@Overridepublic String toString() {    return "Category [childCategories=" + childCategories + ", name="            + name + ", parentCategory=" + parentCategory.getName() + "]";}

这样,您将不打印parentCategory,而仅显示其名称,不显示无限循环,不显示StackOverflowError。

编辑: 正如博洛在下面说的那样,您将需要检查parentCategory不为null,NullPointerException如果有则为null

amazon-web-services – 为什么我得到ElasticBeanstalk :: ExternalInvocationError?

amazon-web-services – 为什么我得到ElasticBeanstalk :: ExternalInvocationError?

我的应用程序构建在RubyOnRails上,并使用乘客部署为弹性beanstalk应用程序,我正在尝试将标头添加到Nginx服务器并重新启动它,这是我的配置文件,来自aws弹性beanstalk的.ebextensions文件夹中的脚本:

packages: 
    yum:
        Nginx: [] 

files:
    "/etc/Nginx/conf.d/webapp.conf" :
        mode: "000644"
        owner: root
        group: root
        content: |
            server {

                location /assets {
                  alias /var/app/current/public/assets;
                  gzip_static on;
                  gzip on;
                  expires max;
                  add_header Cache-Control public;
                }

                location /public {
                  alias /var/app/current/public;
                  gzip_static on;
                  gzip on;
                  expires max;
                  add_header Cache-Control public;
                }

            }

# This reloads the server,which will both make the changes take affect and makes sure the config is valid when you deploy
container_commands:
  01_reload_Nginx:
    command: "sudo service Nginx reload"

但是我收到了这个错误:

[2017-12-13T06:23:48.635Z] ERROR [17344] : Command CMD-AppDeploy Failed!
[2017-12-13T06:23:48.635Z] INFO  [17344] : Command processor returning results: 
{"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"container_command 01_reload_Nginx in .ebextensions/01_elastic_beanstalk_webapp.config Failed. For more detail,check /var/log/eb-activity.log using console or EB CLI","returncode":7,"events":[]}]}

/var/log/eb-activity.log:

[2017-12-13T06:23:48.584Z] INFO  [17344] - [Application update fix-command-Nginx-reload-hope@2/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_myapp_website/Command 01_reload_Nginx] : Starting activity...
[2017-12-13T06:23:48.619Z] INFO  [17344] - [Application update fix-command-Nginx-reload-hope@2/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_myapp_website/Command 01_reload_Nginx] : Activity execution Failed,because:  (ElasticBeanstalk::ExternalInvocationError)


[2017-12-13T06:23:48.619Z] INFO  [17344] - [Application update fix-command-Nginx-reload-hope@2/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_myapp_website/Command 01_reload_Nginx] : Activity Failed.

虽然如果我ssh到实例并执行sudo服务Nginx重新加载它将正常执行..
任何的想法?

编辑

$cat /proc/version
Linux version 4.9.43-17.39.amzn1.x86_64 (mockbuild@gobi-build-64011) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Fri Sep 15 23:39:41 UTC 2017

部署命令:

eb deploy my-app -v

请求资产的标题:

Connection: keep-alive
content-encoding: gzip
Content-Type: application/x-javascript
Date: Fri,24 Aug 2018 11:03:50 GMT
ETag: W/"12cd8ea0-20db3"
Last-Modified: Mon,31 Dec 1979 04:08:00 GMT
Server: Nginx/1.12.1
transfer-encoding: chunked
Via: 1.1 8cc9957dff77c27e9931ab0aaf344ec9.cloudfront.net (CloudFront)
X-Amz-Cf-Id: 0NlE-figgzczadHYeK7HMMsDsGRmaB8Sefvo89phHWw3LSx01t5rgQ==
X-Cache: Miss from cloudfront

缺少标题:

   access-control-max-age: 3000
   age: 48214

服务器上的更新conf文件

$cat /etc/Nginx/conf.d/webapp.conf
server {

    location /assets {
      alias /var/app/current/public/assets;
      gzip_static on;
      gzip on;
      expires max;
      add_header Cache-Control public;
      add_header 'Access-Control-Allow-Origin' '*';
    }

    location /public {
      alias /var/app/current/public;
      gzip_static on;
      gzip on;
      expires max;
      add_header Cache-Control public;
      add_header 'Access-Control-Allow-Origin' '*';
    }

}

编辑

service Nginx configtest结果:

$sudo service Nginx configtest
Nginx: the configuration file /etc/Nginx/Nginx.conf Syntax is ok
Nginx: configuration file /etc/Nginx/Nginx.conf test is successful
最佳答案
命令:“sudo service Nginx reload”不是必需的,因为Nginx服务在每次成功部署后自动重启.您可以从配置文件中删除它.

您可能会遇到CDN服务到期的延迟,请尝试刷新缓存或直接对EB网址进行测试.

android – 为什么我得到:“没有为此目标安装系统映像”

android – 为什么我得到:“没有为此目标安装系统映像”

我在 Android模拟器上遇到了麻烦.

我在Windows 10上运行,这是我的环境:

Microsoft Visual Studio Professional 2017 
Version 15.5.6
VisualStudio.15.Release/15.5.6+27130.2027
Microsoft .NET Framework
Version 4.7.02556

Xamarin   4.8.0.760 (fc93f3f5b)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   4.8.188 (c5813fa34)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin.Android SDK   8.1.5.0 (HEAD/75f8c6838)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK   11.6.1.4 (db807ec)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

我的Android SDK平台如下所示:

和SDK工具是:

在我的模拟器屏幕中,无论我选择什么设备,我都会收到错误:
“没有为此目标安装系统映像”.

我显然已经安装了谷歌ARM系统映像.
我不明白为什么我收到错误信息.
任何帮助将不胜感激.

查尔斯

更新2

我要感谢York Shen和Jon Douglas的帮助.设备模拟器现在可以正常运行……

我安装了英特尔HAXM仿真器加速器.我的控制台脚本是:

我还从SDK工具中选择了加速器:

当我尝试使用模拟器管理器定义新设备时,我现在得到:

显然,我仍然有HAXM的问题.顺便说一句,如果你告诉我我必须更改计算机的BIOS以使HAXM正常工作,我将放弃Android.

我试图运行默认模拟器,它警告我,我可以继续,但没有任何加速.出现了一个模拟器,但我的应用程序没有运行.我的应用程序仅在iOS和UWP上运行.

我试图让Android Emulators工作五天.没有雪茄.我将此与我对iOS模拟器的体验进行了对比.那一个花了我大概半小时才能跑步.它非常干净简单.我正在认真考虑放弃Android的所有软件开发.

解决方法

Why am I getting: “No system images installed for this target”

正如@Jon Douglas所说,您使用的是AVD Manager的弃用版本,您可以参考docuemnt:

As of Android SDK Tools version 26.0.1,Google has removed support for their UI-based AVD and SDK managers in favor of their new CLI (Command Line Interface) tools.

您可以参考我的答案,获得有关如何解决此问题的更详细答案:

Xamarin with Visual Studio not detecting CPU/ABI system image for emulator,even though system images are installed

更新:

如果您使用Xamarin SDK Manager和Xamarin Android设备管理器,则需要更新到Android SDK Tools 26.0.1及更高版本(这是Android 8.0 Oreo开发所必需的).

您可以阅读:Requirements.在您的情况下,将您的Android SDK Tools版本升级到26.1.1:

更新2:

您需要Installing the Xamarin Android Device Manager,然后您可以通过单击工具>启动设备管理器. Android模拟器管理器:

c# – 为什么我得到PingException?

c# – 为什么我得到PingException?

这一切都是在一小时前和很多天前完成的.
我尝试ping的链接是:

Link to ping

这是form1中的代码:

nc = new NetworkConnection();
bool bval = nc.PingConnection(satellite_address);

if (bval)
{
    label19.Visible = true;
    label19.Text = "Internet Access";
}
else
{
    label19.Visible = true;
    label19.Text = "No Internet Access";
}

当它试图执行此行时:

bool bval = nc.PingConnection(satellite_address);

它将进入nc类:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.networkinformation;
using System.IO;
using System.Windows.Forms;

namespace mws
{
    class NetworkConnection
    {
        public NetworkConnection()
        {    
        }

        public bool PingConnection(string url)
        {
            bool Result = false;

            using (Ping pp = new Ping())
            {
                byte[] buffer = Encoding.ASCII.GetBytes("samplestring");
                int timeout = 120;

                try
                {
                    PingReply reply = pp.Send(url,timeout,buffer);
                    if (reply.Status == IPStatus.Success)
                        Result = true;
                }
                catch (Exception)
                {
                    Result = false;
                }
            }
            return Result;
        }
    }
}

在尝试执行该行时在nc类中:

PingReply reply = pp.Send(url,buffer);

它跳转到catch块并抛出PingException:

An exception occurred during a Ping request

然后在Form1中返回的结果是没有互联网访问,但有互联网,我可以冲浪到网址没有问题.

这是完整的异常消息:

System.Net.networkinformation.PingException was caught
  HResult=-2146233079
  Message=An exception occurred during a Ping request.
  Source=System
  StackTrace:
       at System.Net.networkinformation.Ping.Send(String hostNameOrAddress,Int32 timeout,Byte[] buffer,PingOptions options)
       at System.Net.networkinformation.Ping.Send(String hostNameOrAddress,Byte[] buffer)
       at mws.NetworkConnection.PingConnection(String url) in d:\C-Sharp\Download File\Downloading-File-Project-Version-012\Downloading File\NetworkConnection.cs:line 33
  InnerException: System.Net.sockets.socketException
       HResult=-2147467259
       Message=No such host is kNown
       Source=System
       ErrorCode=11001
       NativeErrorCode=11001
       StackTrace:
            at System.Net.Dns.GetAddrInfo(String name)
            at System.Net.Dns.InternalGetHostByName(String hostName,Boolean includeIPv6)
            at System.Net.Dns.GetHostAddresses(String hostNameOrAddress)
            at System.Net.networkinformation.Ping.Send(String hostNameOrAddress,PingOptions options)
       InnerException:

第33行是:

PingReply reply = pp.Send(url,buffer);

这个例外出现的原因是什么?在我的节目现在为一些人工作之前它没有出现.

我应该怎样或怎么处理它?

解决方法

您无法将完整URL传递给Ping类的 Send方法.参数字符串hostNameOrAddress需要

A String that identifies the computer that is the destination for the ICMP echo message. The value specified for this parameter can be a host name or a string representation of an IP address.

因此,您只能传入www.sat24.com或主机82.94.176.100的IP(取自CommandLine ping www.sat24.com).

如果要将完整URL传递给方法,则需要从该URL中提取主机以执行Ping.对于这种情况,你可以参加Uri课程

Uri uri = new Uri(url);
PingReply reply = pp.Send(uri.Host,buffer);

ios – 为什么我得到手势识别器不能用于原型对象?

ios – 为什么我得到手势识别器不能用于原型对象?

当我在UIView中放置UITapGestureRecognizer时,我从故事板中得到了上述错误,该UIView位于我场景中的UITableViewCell内.

知道我为什么会收到这个错误吗?

解决方法

我不确定为什么限制到位但我知道你为什么会得到它的错误.

在StoryBoard中设计UITableViewCell时,您只需要设计一个原型对象.即物体可能永远不会存在.它只能在tableView:cellForRowAtIndexPath中获得ACTUALLY:

可能更好的方法是在代码中配置单元格时创建gestureRecognizer.这样你就不会有这个限制.

我也可能看看你是否真的需要它?如果它只是用一根手指进行一次点击,那么你最好不要使用touchesEnded进行编码,或者只使用UIButton进行编码.

今天关于为什么我得到Error为什么我得到二十四孝图既高兴又扫兴的分享就到这里,希望大家有所收获,若想了解更多关于amazon-web-services – 为什么我得到ElasticBeanstalk :: ExternalInvocationError?、android – 为什么我得到:“没有为此目标安装系统映像”、c# – 为什么我得到PingException?、ios – 为什么我得到手势识别器不能用于原型对象?等相关知识,可以在本站进行查询。

本文标签: