小编Mol*_*Ice的帖子

使用Google帐户登录时,请使用gitlab的https链接

我已经使用他们与Google帐户的连接注册了Gitlab.一旦完成并且我有权从git存储库克隆,我尝试使用https://链接克隆(而不是git:SSH一个)

现在要完成此过程,我被问到我的用户名和密码,但在这种情况下是什么?请不要建议使用SSH链接,因为在Windows操作系统上ssh并不简单.

git https gitlab

23
推荐指数
2
解决办法
8727
查看次数

与策展人一起使用ACL

使用CuratorFramework,有人可以解释我怎么做:

  1. 创建一个新路径
  2. 设置此路径的数据
  3. 走这条路

使用用户名foo和密码bar?那些不知道这个用户/通行证的人将无法做任何事情.

出于此问题的目的,我不关心通过明文发送的SSL或密码.

java apache-zookeeper apache-curator

18
推荐指数
1
解决办法
1864
查看次数

SharedPreferences.getFloat()的重点是什么

该方法getFloat()用于从android的SharedPreferencesAPI中提取浮点值.但是,在xml中EditTextPreference,即使定义了数字,也始终存储字符串值.

人们会期望getFloat()自动返回这个,但它抛出一个ClassCastException,我们必须使用Float.parseFloat(SharedPreferences.getString())来获得这个值.

是不是没有用,getFloat()或者我在这里遗漏了什么?

android android-preferences sharedpreferences

10
推荐指数
1
解决办法
4583
查看次数

Java:我得到一个类转换异常错误,指向我甚至没有导入的类

我的问题很简单,我有我编写的代码,首先缩小图像然后裁剪到所需的尺寸(由Constants类获得).

if(image != null){
        Image originalImage = image.getImage();

        int width = Constants.width;

        //Algorithm: get the original width and divide with desired width
        int height = originalImage.getHeight(null)/(originalImage.getWidth(null)/width);

        Image scaledImage = originalImage.getScaledInstance(width, height, java.awt.Image.SCALE_SMOOTH);

        //Now to crop it to specified dimensions
        BufferedImage imageToCrop = (BufferedImage) (java.awt.Image) scaledImage;

        height = Constants.height;

        imageToCrop = imageToCrop.getSubimage(imageToCrop.getWidth() - width, imageToCrop.getHeight() - height, width, height);

        image.setImage(imageToCrop);
    }
Run Code Online (Sandbox Code Playgroud)

运行时,这是我得到的错误:

java.lang.ClassCastException: sun.awt.image.ToolkitImage cannot be cast to java.awt.image.BufferedImage
Run Code Online (Sandbox Code Playgroud)

这对应于这一行:

BufferedImage imageToCrop = (BufferedImage) (java.awt.Image) scaledImage;
Run Code Online (Sandbox Code Playgroud)

现在我没有在任何地方导入sun.awt,实际上这里是这个类的导入项目列表:

import java.awt.Image;
import java.awt.image.BufferedImage; …
Run Code Online (Sandbox Code Playgroud)

java import crop scale

2
推荐指数
1
解决办法
2069
查看次数

Spring @Autowired在一个与当前类同名的类上

假设我在Spring启动应用程序中有以下类:

@Configuration
public class Environment {
    @Autowired
    org.springframework.core.env.Environment environment;
}
Run Code Online (Sandbox Code Playgroud)

运行时,我得到:

***************************
APPLICATION FAILED TO START
***************************

Description:

Field environment in com.example.Environment required a bean of type 'org.springframework.core.env.Environment' that could not be found.


Action:

Consider defining a bean of type 'org.springframework.core.env.Environment' in your configuration.

Disconnected from the target VM, address: '127.0.0.1:57780', transport: 'socket'
Run Code Online (Sandbox Code Playgroud)

解决此问题的解决方法是将我的类重命名public class Environmentpublic class Environments

但我不想这样做.如何保留我的班级名称,让Spring知道我想要做什么?

java spring spring-boot

1
推荐指数
1
解决办法
7514
查看次数