我正在尝试设置AWS CLI工具,并按照说明进行操作 http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/set-up-ec2-cli-linux.html#setting_up_ec2_command_linux上的
然而,在所有的步骤,并且设置了后我AWS_ACCESS_KEY
和AWS_SECRET_KEY
,我得到
$ ec2-describe-regions
Client.UnauthorizedOperation: You are not authorized to perform this operation. (Service: AmazonEC2; Status Code: 403; Error Code: UnauthorizedOperation; Request ID: 55f02cc4-2e9f-4a0a-8b55-46bcc1973f50)
Run Code Online (Sandbox Code Playgroud)
然后我尝试重新生成新凭据,但仍然得到相同的错误.我似乎无法找到有关此问题的其他任何人的信息.我尝试使用-O
和传递密钥-W
,但这也不起作用.
知道我可能做错了什么吗?
我试图在全屏视图中显示图像并使用以下代码:
// Target to write the image to local storage.
Target target = new Target() {
// Target implementation.
}
// (1) Download and save the image locally.
Picasso.with(context)
.load(url)
.into(target);
// (2) Use the cached version of the image and load the ImageView.
Picasso.with(context)
.load(url)
.into(imgDisplay);
Run Code Online (Sandbox Code Playgroud)
此代码适用于较新的手机,但在具有32MB VM的手机上,我遇到了内存问题.所以我尝试将(2)更改为:
Picasso.with(context)
.load(url)
.fit()
.into(imgDisplay);
Run Code Online (Sandbox Code Playgroud)
这导致图像失真.由于在下载之前我不知道图像的尺寸,因此我无法设置ImageView尺寸,因此在不考虑我的ImageView的宽高比的情况下调整图像的大小:
<ImageView
android:id="@+id/imgDisplay"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitCenter"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
Run Code Online (Sandbox Code Playgroud)
处理这种情况的最佳方法是什么?我的原始图像最大宽度为768,高度为1024,我希望在屏幕比这个小得多时进行下采样.如果我尝试使用resize()
,我的代码变得复杂,因为我必须等待(1)完成下载然后添加resize()
in(2).
我假设转换在这种情况下没有帮助,因为输入public Bitmap transform(Bitmap source)
将具有大位图,这将导致我耗尽内存.
当我在运行旧版本的Android设备上安装我的应用程序时(例如4.4.4),我收到此消息.我可以看到与此消息相关的所有其他帖子似乎是在模拟器上运行并与Google Maps API相关时.我使用的是Google Play Service 7.0.0.