我目前正在使用 POST 预签名 url 将图像上传到我的 s3 存储桶。我的图像扩展名为 png,大小为 5.6Mb。当上传到 s3 存储桶时,图像将存储为 base64 编码字符串。s3 上图像的大小从 5.6MB 变为 23.3Mb。有没有对此有解释。我知道编码后图像大小变为原始大小的1.37倍。
我有以下形式的输入标签
<input type="text" name="firstname" id="firstname" placeholder="First name">
Run Code Online (Sandbox Code Playgroud)
首先,我使用 jquery 检查该字段是否为空
$("#submitreg").click(function(e){
if ($.trim($("#firstname").val())=='')
{
$("#firstname").attr('placeholder',"first name can't be empty");
e.preventDefault();
}
});
Run Code Online (Sandbox Code Playgroud)
现在,如果输入字段为空,我将占位符更改为“名字不能为空”。是否也可以将占位符颜色更改为红色并使用 jquery 将字体设为 85%。
谢谢
以前我使用以下代码来区分应用程序启动时我的通知是本地还是远程
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions:
[UIApplication.LaunchOptionsKey: Any]?) -> Bool {
if (launchOptions?[UIApplication.LaunchOptionsKey.localNotification] != nil)
{
}
if (launchOptions?[UIApplication.LaunchOptionsKey.remoteNotification] != nil)
{
}
}
Run Code Online (Sandbox Code Playgroud)
条件是我的应用程序被杀死,我正在从通知中打开它。
问题是这个方法
if (launchOptions?[UIApplication.LaunchOptionsKey.localNotification] != nil)
{
}
Run Code Online (Sandbox Code Playgroud)
已弃用,从通知中心打开应用程序时不会调用以下方法
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {}
Run Code Online (Sandbox Code Playgroud) 我有以下代码来确定是否有互联网连接。这段代码工作正常。我如何知道我是否突然失去连接
var reachability:Reachability?
reachability = Reachability()
self.reachability = Reachability.init()
if((self.reachability!.connection) != .none)
{
print("Internet available")
}
Run Code Online (Sandbox Code Playgroud)
可达性类是否具有报告连接是否断开的功能。如果无法解决可达性问题,其他选择是什么
我正在尝试按照以下链接https://stripe.com/docs/payments/accept-a-payment 中显示的示例进行操作。
我在客户端有以下代码
var cardNumber = elements.create('cardNumber', {
placeholder:'',
style: style
});
var cardexpiry = elements.create('cardExpiry',{
placeholder:'',
style:style
});
var cardCVV = elements.create('cardCvc',{
placeholder:'',
style:style
});
// Add an instance of the card Element into the `card-element` <div>.
cardNumber.mount('#card-element');
cardexpiry.mount("#card-expiry")
cardCVV.mount("#card-cvv")
Run Code Online (Sandbox Code Playgroud)
而不是这个
var card = elements.create("card", { style: style });
card.mount("#card-element");
Run Code Online (Sandbox Code Playgroud)
因为我想要一些 UI 操作。根据链接中发布的代码,我应该执行以下操作
var submitButton = document.getElementById('submit');
submitButton.addEventListener('click', function(ev) {
stripe.confirmCardPayment(clientSecret, {
payment_method: {card: card}
}).then(function(result) {
if (result.error) {
// Show error to your customer …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用以下代码在swift4中访问相机和照片库
let imagePickerController = UIImagePickerController()
imagePickerController.delegate = self
let alert = UIAlertController(title: "", message: "", preferredStyle: .actionSheet)
alert.addAction(UIAlertAction(title: "Camera", style: .default, handler: {(action: UIAlertAction) in
imagePickerController.sourceType = .camera
print(1)
}))
alert.addAction(UIAlertAction(title: "Photo Album", style: .default, handler: {(action: UIAlertAction) in
imagePickerController.sourceType = .photoLibrary
}))
alert.addAction(UIAlertAction(title: "Cancel", style: .default, handler: nil))
self.present(alert, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
但它不起作用。即使我确保plist具有相机和照片库的授权,也没有收到访问授权请求。我对以下代码进行了一些操作
AVCaptureDevice.requestAccess(for: AVMediaType.video) { response in
}
let photos = PHPhotoLibrary.authorizationStatus()
if photos == .notDetermined {
PHPhotoLibrary.requestAuthorization({status in
})
}
let imagePickerController = UIImagePickerController()
imagePickerController.delegate = …Run Code Online (Sandbox Code Playgroud) 我有以下代码:
#include <cstdio>
int main()
{
float b = 323.23f;
std::scanf("%6.3f\n", &b); // <-- Warning
std::printf("%6.3f\n", b);
}
Run Code Online (Sandbox Code Playgroud)
有一个警告scanf()说:
转换说明符无效
'.'
这里有什么我想念的吗?
我有个问题。即使应用程序没有在后台运行,当您从通知打开应用程序时是否可以获取通知正文。它被彻底杀死了。
我有一个具有以下策略的 s3 存储桶
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:ListBucket",
"s3:DeleteObject"
],
"Resource": [
"arn:aws:s3:::bucket",
"arn:aws:s3:::bucket/*"
]
}
]
Run Code Online (Sandbox Code Playgroud)
}
存储桶的公共访问也被阻止。这是存储桶策略的快照
基本上,我希望存储桶是私有的,以防止未经授权的用户上传文件,但我想向任何用户授予对存储桶内对象的公共读取访问权限