小编Yod*_*ism的帖子

iOS:Ionic中上载遇到DATA_URL DestinationType的“无效的URL服务器”

我一直在从事一个将带有捕获图像的文本数据上传到服务器的项目。但是然后我在iOS中遇到了此错误,但在Android上运行良好。我已经尝试使用NATIVE_URIFILE_URI但效果不好。

这是它在Xcode终端中产生的错误:

在此处输入图片说明

这是代码:

const options: FileUploadOptions = {
                  fileKey: 'webcam',
                  fileName: 'dtr.jpg',
                  chunkedMode: false,
                  headers: {}
                };

const cameraOptions: CameraOptions = {
                  quality: 50,
                  destinationType: this.camera.DestinationType.DATA_URL,
                  encodingType: this.camera.EncodingType.JPEG,
                  mediaType: this.camera.MediaType.PICTURE,
                  allowEdit: false
                };

this.camera.getPicture(cameraOptions).then((imageData) => {
    this.yourImage = 'data:image/jpeg;base64,' + imageData;

    const endPoint = ENPOINT_URL;
    fileTransfer.upload(this.yourImage, endPoint, options)
        .then(
            (data) => {
                this.dismiss();
                $('.on-success').show();
            },
            (err) => {
                this.presentAlertConfirm(JSON.stringify(err));
            });
        }, (err) => {
            this.dismiss();
            this.presentAlertConfirm(JSON.stringify(err));
        });
...
Run Code Online (Sandbox Code Playgroud)

版本信息

  • MacOS Mojave 10.14.6
  • Xcode 11
  • 离子CLI 5.4.2 …

javascript xcode ionic-framework angular ionic4

5
推荐指数
0
解决办法
226
查看次数

使用AES-128加密和解密字符串

我在加密128位密钥时得到了它.我该怎么做才能扭转这个过程.我几乎要坐在这里差不多一个小时才想到这个,但我不能.我刚接触这个btw.

样本输入是:J§???????ÿK??{??

输出应该是: hello

在这个计划中:

样本输入是:hello

输出是: J§???????ÿK??{??...

public class en {
    public static void main(String[] args){
      ...
    try{
      System.out.print("Enter text: ");
        String text = dataIn.readLine();
        String key = "dAtAbAsE98765432"; // 128 bit key

     // Create key and cipher
     Key aesKey = new SecretKeySpec(key.getBytes(), "AES");
     Cipher cipher = Cipher.getInstance("AES");

     // encrypt the text
     cipher.init(Cipher.ENCRYPT_MODE, aesKey);
     byte[] encrypted = cipher.doFinal(text.getBytes());
     System.err.println("Encrypted: " + new String(encrypted));

     // Decrypt the text
     cipher.init(Cipher.DECRYPT_MODE, aesKey);
     String decrypted = new String(cipher.doFinal(encrypted));
     System.err.println("Decrypted: " + …
Run Code Online (Sandbox Code Playgroud)

java encryption aes

3
推荐指数
2
解决办法
4万
查看次数

使用c ++中的函数打印圆的区域 - 所有声明为double但整数结果,为什么?

我正在学习c ++,我必须做这个练习,我必须计算并用用户输入的光线打印出圆形区域.这似乎工作,但结果它不是一个双重而是一个int类型.为什么?提前致谢.这里的代码:

#include <iostream>

double area_f(double raggio_f); //prototype

using namespace std;

    int main(){
        double raggio, area;

        cout << "inserire il raggio: " << endl;
        cin >> raggio;

        area = area_f(raggio);
        cout << area;
        return 0;
    }

    double area_f(double raggio_f){
        double risultato;
        risultato=raggio_f*raggio_f*3,14;
        return (risultato);
    }
Run Code Online (Sandbox Code Playgroud)

c++ function

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

Smalltalk x raiseTo:y错误

美好的一天!我明天有报告,我正在审查Smalltalk.我试图使用该raisedTo:方法,但它给了我这个错误:

 MessageNotUnderstood: Character>>raisedTo:
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

|x y z|
x := UIManager default request: 'P1: '.
y := UIManager default request: 'P2: '.
z := x raisedTo: y.
self inform: z.
Run Code Online (Sandbox Code Playgroud)

smalltalk squeak

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