问:
How can i make faster container starting for vscode dev containers?
I have a good machine for developing inside containers, but containers starting take at least one minute, how can i make it faster?

Also can i have common extensions kit for any next dev container? Because i have to click "Install in Dev container..." button on every needed extension in my new dev container now.


来源: stackexchange

问:
Android Studio gradle build failed: Could not resolve all files for configuration:app:debugRuntime Classpath
i am facing this issue for 3 days and can't solve it i tried maximum available solution but it not solve i hope hare i find som solution

I am using a DensoSacnner sdk(dependency)

i have tried toggle online or offline mode but the solution is not working i have tried many solution but not solve

ContentLicense: CC BY-SA 4.0


问:
Create a Identity with ORY hosted and console, CORS issue (kratos)
I am using Ory kratos's API and sdk, I can not seem to get any data back from my admin console or my hosted kratos, I am getting a cors error(This also happens when the server is off)

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://ory.project.oryapis.com/admin/identities. (Reason: CORS request did not succeed). Status code: (null).

I have tried everything it seems, I had a look through the console and no cors needed to be changed or set, and insomnia can create and get data from the same API and the hosted version, so I am thinking its my code(NOTE I am using axios) but I also can see anything wrong with it.

const axiosClient = axios.create({
  headers: {
    'Content-type': 'application/json'
  },
  withCredentials: true
});

export async function createIdentity(email) {
  try {
    const { data } = await axiosClient.post('http://127.0.0.1:4434/identities', {
        traits: {
          email: email
      }
    });

    console.log(data);
  } catch (error) {
    console.log(error);
  }
}
```
<p>insomnia working
<img src="https://i.stack.imgur.com/IyJLQ.png" alt="insomnia working" /></p>
<p>I also tryed the SDK and got the same thing</p>
<pre class="lang-js prettyprint-override"><code>const identity = new IdentityApi(
  new Configuration({
    basePath: `https://pedantic.projects.oryapis.com`,
    accessToken: 'Bearer My_token',
    baseOptions: {
      withCredentials: true
    }
  })
);

export async function createIdentity(email: string) {
  return await identity
    .createIdentity({
      createIdentityBody: {
        schema_id: 'preset://email',
        traits: {
          email: email
        }
      }
    })
    .then(({ data }) => data);
}
</code>```

I also tried it locally and got the same thing, my kratos(v0.11.0) config

serve:
  public:
    base_url: http://127.0.0.1:4433/
    host: 127.0.0.1
    cors:
      enabled: true
      allowed_origins:
        - 'http://localhost:5000'
        - 'http://localhost:3000'
      allowed_methods:
        - POST
        - GET
        - PUT
        - PATCH
        - DELETE
      allowed_headers:
        - Authorization
        - Access-Control-Allow-Origin
        - Cookie
        - Content-Type
      exposed_headers:
        - Content-Type
        - Set-Cookie
  admin:
    base_url: http://kratos:4434/
    host: 127.0.0.1
```
<p>But everything is working fine on insomnia</p>
<p>LOGS:</p>
```INFO[2022-12-20T15:47:41+10:00] completed handling request http_request=map[headers:map[accept:*/* accept-encoding:gzip, deflate, br accept-language:en-US,en;q=0.5 access-control-request-headers:content-type access-control-request-method:POST connection:keep-alive origin:http://127.0.0.1:5000 referer:http://127.0.0.1:5000/ sec-fetch-dest:empty sec-fetch-mode:cors sec-fetch-site:same-site user-agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:108.0) Gecko/20100101 Firefox/108.0] host:127.0.0.1:4434 method:OPTIONS path:/admin/identities query:<nil> remote:127.0.0.1:38972 scheme:http] http_response=map[headers:map[location:/admin/identities] size:0 status:307 text_status:Temporary Redirect took:100.3µs]

```

Body:
I am using Ory kratos's API and sdk, I can not seem to get any data back from my admin console or my hosted kratos, I am getting a cors error(This also happens when the server is off)

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://ory.project.oryapis.com/admin/identities. (Reason: CORS request did not succeed). Status code: (null).

I have tried everything it seems, I had a look through the console and no cors needed to be changed or set, and insomnia can create and get data from the same API and the hosted version, so I am thinking its my code(NOTE I am using axios) but I also can see anything wrong with it.

const axiosClient = axios.create({
  headers: {
    'Content-type': 'application/json'
  },
  withCredentials: true
});

export async function createIdentity(email) {
  try {
    const { data } = await axiosClient.post('http://127.0.0.1:4434/identities', {
        traits: {
          email: email
      }
    });

    console.log(data);
  } catch (error) {
    console.log(error);
  }
}

insomnia working

I also tryed the SDK and got the same thing

const identity = new IdentityApi(
  new Configuration({
    basePath: `https://pedantic.projects.oryapis.com`,
    accessToken: 'Bearer My_token',
    baseOptions: {
      withCredentials: true
    }
  })
);

export async function createIdentity(email: string) {
  return await identity
    .createIdentity({
      createIdentityBody: {
        schema_id: 'preset://email',
        traits: {
          email: email
        }
      }
    })
    .then(({ data }) => data);
}

I also tried it locally and got the same thing, my kratos(v0.11.0) config

serve:
  public:
    base_url: http://127.0.0.1:4433/
    host: 127.0.0.1
    cors:
      enabled: true
      allowed_origins:
        - 'http://localhost:5000'
        - 'http://localhost:3000'
      allowed_methods:
        - POST
        - GET
        - PUT
        - PATCH
        - DELETE
      allowed_headers:
        - Authorization
        - Access-Control-Allow-Origin
        - Cookie
        - Content-Type
      exposed_headers:
        - Content-Type
        - Set-Cookie
  admin:
    base_url: http://kratos:4434/
    host: 127.0.0.1

But everything is working fine on insomnia

LOGS:

INFO[2022-12-20T15:47:41+10:00] completed handling request http_request=map[headers:map[accept:*/* accept-encoding:gzip, deflate, br accept-language:en-US,en;q=0.5 access-control-request-headers:content-type access-control-request-method:POST connection:keep-alive origin:http://127.0.0.1:5000 referer:http://127.0.0.1:5000/ sec-fetch-dest:empty sec-fetch-mode:cors sec-fetch-site:same-site user-agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:108.0) Gecko/20100101 Firefox/108.0] host:127.0.0.1:4434 method:OPTIONS path:/admin/identities query:<nil> remote:127.0.0.1:38972 scheme:http] http_response=map[headers:map[location:/admin/identities] size:0 status:307 text_status:Temporary Redirect took:100.3µs]


问:
JsPdf html() giving background image as black in generated pdf
I am generating PDF from HTML element using html() of jsPDF. HTML contains background image, its getting black in generated PDF.

CodePen Sample

JS Code

```<code>const { jsPDF } = window.jspdf;
document.querySelector('button').addEventListener('click',downloadPdf);
function downloadPdf(){
  var doc = new jsPDF({unit:'pt'});
doc.html(document.body.querySelector('.container'), {
   callback: function (doc) {
     doc.save("sample.pdf");
   },
   html2canvas:{scale:.4},
   x: 10,
   y: 10
});
}
</code>```

HTML

```<code><div class="container">
  <div class="txtbox bgimg">
    Title goes here
    </div>
</div>
<button>Download PDF</button>
</code>```

CSS

```<code>.container{
  height:200px;
  background-image:url("https://www.w3schools.com/cssref/paper.gif")
}
.txtbox{
  color:Blue;
  font-size:36px;
  text-align:center;
  }
</code>```

Body:
I am generating PDF from HTML element using html() of jsPDF. HTML contains background image, its getting black in generated PDF.

CodePen Sample

JS Code

const { jsPDF } = window.jspdf;
document.querySelector('button').addEventListener('click',downloadPdf);
function downloadPdf(){
  var doc = new jsPDF({unit:'pt'});
doc.html(document.body.querySelector('.container'), {
   callback: function (doc) {
     doc.save("sample.pdf");
   },
   html2canvas:{scale:.4},
   x: 10,
   y: 10
});
}

HTML

    Title goes here

<button>Download PDF</button>

CSS

.container{
  height:200px;
  background-image:url("https://www.w3schools.com/cssref/paper.gif")
}
.txtbox{
  color:Blue;
  font-size:36px;
  text-align:center;
  }


问:
How to set map[string]string value in GoLand when debugging a golang program?
I hava use goland dehug，i want to set a value for map[string]string,but i am not set ok

how to I set the value, i dont know this

i can set the map[string]string value


问:
Legend and x-label not showing in 1 column of subplot
Why is the subplot on my left plot legend not showing the names nor the x labels whereas the other plot on the right is showing?

Below is one of the images which I get while running this code

This is the code which I am working on.

for i in countplot1:
    figure,(ax1, ax2) = plt.subplots(1,2, figsize=(60,20))

    sns.countplot(data=pay_difficulty[i], x=pay_difficulty.code_gender, hue=pay_difficulty[i], ax=ax1)
    ax1.tick_params(axis='x', which='major', labelsize=40)
    ax1.set_xlabel(ax1.get_xlabel(),size=40)
    ax1.set_ylabel("Total Counts",size=40)
    ax1.set_title("Client with Payment Difficulty", size=40, fontweight="bold")
    plt.setp(ax1.get_legend().get_texts(), fontsize='32')
    plt.setp(ax1.get_legend().get_title(), fontsize='36')

    sns.countplot(data=pay_not_difficulty[i], x=pay_not_difficulty.code_gender, hue=pay_not_difficulty[i], ax=ax2)
    ax2.tick_params(axis='x', which='major', labelsize=40)
    ax2.set_xlabel(ax2.get_xlabel(),size=40)
    ax2.set_ylabel("Total Counts", size=40)
    ax2.set_title("Client with No Payment Difficulty", size=40, fontweight="bold")
    plt.setp(ax2.get_legend().get_texts(), fontsize='32')
    plt.setp(ax2.get_legend().get_title(), fontsize='36')

    plt.tight_layout()

plt.show()
```


问:
how to give one div two different image and color borders
I have a div, that requires both having color and image mixed borders. The top border need to be a red color and the bottom using an SVG image however the left and right border will left transprant. When I make the image border active all the div become same image based border and while i use color border all the div become color based border. Is there any CSS property to use to make it clear which border should go for image based and which one for color. Right now i have bottom border as image

div#navigation {

    background-color: #F3F3F3;
    border-bottom: 15px solid #000;
    border-image-repeat: round;
    border-image-slice: 300;
    border-image: url(/sites/default/files/inline-images/Component%203%20%E2%80%93%203.svg) 100% 0 / 2;
    stretch: ;
       border-top: 5px solid #e00021;

}```


问:
How to take picture and convert it to BASE64?
I want to create a camera app, take a picture and convert it to BASE64 before saving.
I can take a picture and save it to gallery, but I want to convert that picture to BASE64 and pass it to another API.

Here this code I use :

```<code>public class MainActivity extends AppCompatActivity {
    String[] REQUIRED_PERMISSIONS = {Manifest.permission.CAMERA};
    final int REQUEST_CODE_PERMISSIONS = 0;

    boolean allPermissionsGranted() {
        for (String permission : REQUIRED_PERMISSIONS) {
            final int result = ContextCompat.checkSelfPermission(this, permission);
            if (result != PackageManager.PERMISSION_GRANTED) {
                return false;
            }
        }
        return true;
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);

        if (requestCode == REQUEST_CODE_PERMISSIONS) {
            if (allPermissionsGranted()) {
                startCamera();
            } else {
                Toast.makeText(this, "Permission not granted", Toast.LENGTH_LONG).show();
                finish();
            }
        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        if (allPermissionsGranted()) {
            startCamera();
        } else {
            ActivityCompat.requestPermissions(this, REQUIRED_PERMISSIONS, REQUEST_CODE_PERMISSIONS);
        }

        // Set up the listener for take photo button
        Button button = findViewById(R.id.camera_capture_button);
        button.setOnClickListener(v -> takePhoto());

        Button button2 = findViewById(R.id.bt_next);
        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this,EncodePage.class);
                startActivity(intent);
            }
        });

    }

    ImageCapture imageCapture;

    private void startCamera() {
        final ListenableFuture<ProcessCameraProvider> future = ProcessCameraProvider.getInstance(this);
        future.addListener(() -> {
            try {
                imageCapture = new ImageCapture.Builder().build();

                ProcessCameraProvider cameraProvider = future.get();
                Preview preview = new Preview.Builder().build();
                PreviewView viewFinder = findViewById(R.id.viewFinder);
                preview.setSurfaceProvider(viewFinder.getSurfaceProvider());
                cameraProvider.unbindAll();
                cameraProvider.bindToLifecycle(this, CameraSelector.DEFAULT_BACK_CAMERA, preview, imageCapture);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }, ContextCompat.getMainExecutor(this));
    }

    static final String FILENAME_FORMAT = "yyyy-MM-dd-HH-mm-ss-SSS";

    //
    public void takePhoto() {
        if (imageCapture == null)
            return;

        final File photoFile = new File(new SimpleDateFormat(FILENAME_FORMAT, Locale.US).format(System.currentTimeMillis()) + ".jpg");

        ContentValues contentValue = new ContentValues();
        contentValue.put(MediaStore.MediaColumns.DISPLAY_NAME, photoFile.getName());
        contentValue.put(MediaStore.MediaColumns.MIME_TYPE, "image/jpg");
        contentValue.put(MediaStore.MediaColumns.RELATIVE_PATH, Environment.DIRECTORY_DCIM);

        ImageCapture.OutputFileOptions outputOptions = new ImageCapture.OutputFileOptions.Builder(
                getContentResolver(),
                MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
                contentValue).build();

        imageCapture.takePicture(outputOptions,
                ContextCompat.getMainExecutor(this),
                new ImageCapture.OnImageSavedCallback() {
                    @Override
                    public void onImageSaved(@NonNull ImageCapture.OutputFileResults outputFileResults) {
                        File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM), photoFile.getName());
                        String msg = "Photo capture succeeded : ";
                        Toast.makeText(MainActivity.this, msg, Toast.LENGTH_LONG).show();
                        Log.d("vac", "onImageSaved: " + file.length());
                    }

                    @Override
                    public void onError(@NonNull ImageCaptureException exception) {
                        Log.e("vac", "onError: ");
                    }
                });
    }
}
</code>```

and this XML

```<code><?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="24dp"
        android:text="-  -"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <Button
        android:id="@+id/camera_capture_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="28dp"
        android:text="CAPTURE"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.136"
        app:layout_constraintStart_toStartOf="parent" />

    <Button
        android:id="@+id/bt_next"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="next"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.869"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.959" />

    <androidx.camera.view.PreviewView
        android:id="@+id/viewFinder"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginStart="30dp"
        android:layout_marginTop="60dp"
        android:layout_marginEnd="30dp"
        android:layout_marginBottom="100dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.0">

    </androidx.camera.view.PreviewView>

</androidx.constraintlayout.widget.ConstraintLayout>
</code>```

I used Code below to convert it but doesn't work on me

I don't know how to use it

```<code>@Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (requestCode == 100 && resultCode == RESULT_OK){
            final Uri imageUri = data.getData();
            InputStream imageStream = null;
            try {
                imageStream = getContentResolver().openInputStream(imageUri);
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
            final Bitmap selectImage = BitmapFactory.decodeStream(imageStream);
            String encodedImage = encodeImage(selectImage);
        }
    }

    private String encodeImage(Bitmap bm) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        bm.compress(Bitmap.CompressFormat.JPEG,100,baos);
        byte[] b = baos.toByteArray();
        String encImage = Base64.encodeToString(b, Base64.DEFAULT);

        return encImage;

    }
</code>```

Body:
I want to create a camera app, take a picture and convert it to BASE64 before saving.
I can take a picture and save it to gallery, but I want to convert that picture to BASE64 and pass it to another API.

Here this code I use :

public class MainActivity extends AppCompatActivity {
    String[] REQUIRED_PERMISSIONS = {Manifest.permission.CAMERA};
    final int REQUEST_CODE_PERMISSIONS = 0;

    boolean allPermissionsGranted() {
        for (String permission : REQUIRED_PERMISSIONS) {
            final int result = ContextCompat.checkSelfPermission(this, permission);
            if (result != PackageManager.PERMISSION_GRANTED) {
                return false;
            }
        }
        return true;
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);

        if (requestCode == REQUEST_CODE_PERMISSIONS) {
            if (allPermissionsGranted()) {
                startCamera();
            } else {
                Toast.makeText(this, "Permission not granted", Toast.LENGTH_LONG).show();
                finish();
            }
        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        if (allPermissionsGranted()) {
            startCamera();
        } else {
            ActivityCompat.requestPermissions(this, REQUIRED_PERMISSIONS, REQUEST_CODE_PERMISSIONS);
        }

        // Set up the listener for take photo button
        Button button = findViewById(R.id.camera_capture_button);
        button.setOnClickListener(v -> takePhoto());

        Button button2 = findViewById(R.id.bt_next);
        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this,EncodePage.class);
                startActivity(intent);
            }
        });

    }

    ImageCapture imageCapture;

    private void startCamera() {
        final ListenableFuture<ProcessCameraProvider> future = ProcessCameraProvider.getInstance(this);
        future.addListener(() -> {
            try {
                imageCapture = new ImageCapture.Builder().build();

                ProcessCameraProvider cameraProvider = future.get();
                Preview preview = new Preview.Builder().build();
                PreviewView viewFinder = findViewById(R.id.viewFinder);
                preview.setSurfaceProvider(viewFinder.getSurfaceProvider());
                cameraProvider.unbindAll();
                cameraProvider.bindToLifecycle(this, CameraSelector.DEFAULT_BACK_CAMERA, preview, imageCapture);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }, ContextCompat.getMainExecutor(this));
    }

    static final String FILENAME_FORMAT = "yyyy-MM-dd-HH-mm-ss-SSS";

    //
    public void takePhoto() {
        if (imageCapture == null)
            return;

        final File photoFile = new File(new SimpleDateFormat(FILENAME_FORMAT, Locale.US).format(System.currentTimeMillis()) + ".jpg");

        ContentValues contentValue = new ContentValues();
        contentValue.put(MediaStore.MediaColumns.DISPLAY_NAME, photoFile.getName());
        contentValue.put(MediaStore.MediaColumns.MIME_TYPE, "image/jpg");
        contentValue.put(MediaStore.MediaColumns.RELATIVE_PATH, Environment.DIRECTORY_DCIM);

        ImageCapture.OutputFileOptions outputOptions = new ImageCapture.OutputFileOptions.Builder(
                getContentResolver(),
                MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
                contentValue).build();

        imageCapture.takePicture(outputOptions,
                ContextCompat.getMainExecutor(this),
                new ImageCapture.OnImageSavedCallback() {
                    @Override
                    public void onImageSaved(@NonNull ImageCapture.OutputFileResults outputFileResults) {
                        File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM), photoFile.getName());
                        String msg = "Photo capture succeeded : ";
                        Toast.makeText(MainActivity.this, msg, Toast.LENGTH_LONG).show();
                        Log.d("vac", "onImageSaved: " + file.length());
                    }

                    @Override
                    public void onError(@NonNull ImageCaptureException exception) {
                        Log.e("vac", "onError: ");
                    }
                });
    }
}

and this XML

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="24dp"
        android:text="-  -"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <Button
        android:id="@+id/camera_capture_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="28dp"
        android:text="CAPTURE"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.136"
        app:layout_constraintStart_toStartOf="parent" />

    <Button
        android:id="@+id/bt_next"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="next"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.869"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.959" />

    <androidx.camera.view.PreviewView
        android:id="@+id/viewFinder"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginStart="30dp"
        android:layout_marginTop="60dp"
        android:layout_marginEnd="30dp"
        android:layout_marginBottom="100dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.0">

    </androidx.camera.view.PreviewView>

</androidx.constraintlayout.widget.ConstraintLayout>

I used Code below to convert it but doesn't work on me

I don't know how to use it

@Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (requestCode == 100 && resultCode == RESULT_OK){
            final Uri imageUri = data.getData();
            InputStream imageStream = null;
            try {
                imageStream = getContentResolver().openInputStream(imageUri);
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
            final Bitmap selectImage = BitmapFactory.decodeStream(imageStream);
            String encodedImage = encodeImage(selectImage);
        }
    }

    private String encodeImage(Bitmap bm) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        bm.compress(Bitmap.CompressFormat.JPEG,100,baos);
        byte[] b = baos.toByteArray();
        String encImage = Base64.encodeToString(b, Base64.DEFAULT);

        return encImage;

    }


问:
How to use boost::filesystem::copy_file for copy in ProgramData?
There is no copying inside ProgramData. In other folders copies correctly. Maybe an access problem?</p>
```<code>boost::filesystem::path pFr(C:\ProgramData\Manufacturer\Product\MSSQL.mdf);
boost::filesystem::path pTo(C:\ProgramData\Manufacturer\Product\Archive\MSSQL.mdf);

boost::filesystem::copy_file(pFr, pTo, boost::filesystem::copy_option::overwrite_if_exists);
</code>```

Body:
There is no copying inside ProgramData. In other folders copies correctly. Maybe an access problem?

boost::filesystem::path pFr(C:\ProgramData\Manufacturer\Product\MSSQL.mdf);
boost::filesystem::path pTo(C:\ProgramData\Manufacturer\Product\Archive\MSSQL.mdf);

boost::filesystem::copy_file(pFr, pTo, boost::filesystem::copy_option::overwrite_if_exists);


问:
Indexed db showing 200mb even though system has 100gb in mac chrome
we use web storage API to get the estimated storage.
This is a random case, but sometimes estimate API shows a very inaccurate storage quota.

bug

Mac chrome shows 200 MB even though the system has 100 GB of free storage.


问:
Can i make add-on for Google chat in Google Workspace to display in right nav menu?

I want to make an Add-on for Google Chat in Google Workspace. But main question, can I make an Add-on to display in this right nav menu? Because all that I saw, all Add-ons, are always displaying at the left side, where there are other chats.

Is it possible to make an Add-on for Google Chat and display it in the right side menu?


问:
promql: Grouping events based on the time of occurrence
I have several events in time on charts. Can I group these events as shown in the picture? Promql language

solution or solution description


问:
Quarkus + Camel JPA with multiple Datasources
I'm trying to use Camel to move data from one database to another. We used to use Spring to define two different JPA components as follows:

```<code><bean id="txManager" class="org.springframework.transaction.jta.JtaTransactionManager">
   <property name="transactionManager" ref="transactionManager" />
</bean>

<bean id="jpa1" class="org.apache.camel.component.jpa.JpaComponent">
   <property name="entityManagerFactory" ref="entityManagerFactory1" />
   <property name="transactionManager" ref="txManager" />
</bean>

<bean id="jpa2" class="org.apache.camel.component.jpa.JpaComponent">
   <property name="entityManagerFactory" ref="entityManagerFactory2" />
   <property name="transactionManager" ref="txManager" />
</bean>
</code>```

which allows us to use each jpa component separately in the Routes class as follows:

```<code>from(jpa("jpa1","org.src.entity.DataSource1"))
-OR-
from(jpa("jpa2","org.src.entity.DataSource2"))

</code>```

But now in Quarkus I'm unable to find a way to define these JPA components!

Here is my application.properties:

```<code>#postgresql 'default datasource'
quarkus.datasource.db-kind=postgresql
quarkus.datasource.username=admin
quarkus.datasource.password=admin
quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5555/postgres
quarkus.datasource.jdbc.min-size=2
quarkus.datasource.jdbc.max-size=20
quarkus.hibernate-orm.database.generation=drop-and-create
quarkus.hibernate-orm.packages=org.src.target
quarkus.hibernate-orm.log.sql=true

#oracle
quarkus.datasource.oracle.db-kind=oracle
quarkus.datasource.oracle.username=admin
quarkus.datasource.oracle.password=admin
quarkus.datasource.oracle.jdbc.url=jdbc:oracle:thin:@//{{link}}
quarkus.datasource.oracle.jdbc.min-size=2
quarkus.datasource.oracle.jdbc.max-size=20
quarkus.hibernate-orm.oracle.datasource=oracle
quarkus.hibernate-orm.oracle.packages=org.src.source
quarkus.hibernate-orm.oracle.database.default-schema=AAAA

# Quarkus Narayana JTA
quarkus.transaction-manager.object-store-directory=target/narayana
quarkus.transaction-manager.enable-recovery=true

# Camel
camel.rest.context-path=/api
</code>```

I tried using the oracle datasource as a jpa component but it did not work! I also tried declaring a new JPAComponent in Routes:

```<code>@ApplicationScoped
public class Routes extends EndpointRouteBuilder {

    @Inject
    @PersistenceUnit("oracle")
    EntityManagerFactory entityManagerFactory;

    @Inject
    CamelContext camelContext;

    @Override
    public void configure() throws Exception {

        JpaComponent jpaComponent = new JpaComponent();
        jpaComponent.setEntityManagerFactory(entityManagerFactory);
        camelContext.addComponent("jpaComponent", jpaComponent);
  }
}

</code>```

But got this error instead: java.lang.ClassNotFoundException: org.springframework.transaction.support.TransactionCallback

I would really appreciate any suggestions.

Body:
I'm trying to use Camel to move data from one database to another. We used to use Spring to define two different JPA components as follows:

<bean id="txManager" class="org.springframework.transaction.jta.JtaTransactionManager">
   <property name="transactionManager" ref="transactionManager" />
</bean>

<bean id="jpa1" class="org.apache.camel.component.jpa.JpaComponent">
   <property name="entityManagerFactory" ref="entityManagerFactory1" />
   <property name="transactionManager" ref="txManager" />
</bean>

<bean id="jpa2" class="org.apache.camel.component.jpa.JpaComponent">
   <property name="entityManagerFactory" ref="entityManagerFactory2" />
   <property name="transactionManager" ref="txManager" />
</bean>

which allows us to use each jpa component separately in the Routes class as follows:

from(jpa("jpa1","org.src.entity.DataSource1"))
-OR-
from(jpa("jpa2","org.src.entity.DataSource2"))

But now in Quarkus I'm unable to find a way to define these JPA components!

Here is my application.properties:

#postgresql 'default datasource'
quarkus.datasource.db-kind=postgresql
quarkus.datasource.username=admin
quarkus.datasource.password=admin
quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5555/postgres
quarkus.datasource.jdbc.min-size=2
quarkus.datasource.jdbc.max-size=20
quarkus.hibernate-orm.database.generation=drop-and-create
quarkus.hibernate-orm.packages=org.src.target
quarkus.hibernate-orm.log.sql=true

#oracle
quarkus.datasource.oracle.db-kind=oracle
quarkus.datasource.oracle.username=admin
quarkus.datasource.oracle.password=admin
quarkus.datasource.oracle.jdbc.url=jdbc:oracle:thin:@//{{link}}
quarkus.datasource.oracle.jdbc.min-size=2
quarkus.datasource.oracle.jdbc.max-size=20
quarkus.hibernate-orm.oracle.datasource=oracle
quarkus.hibernate-orm.oracle.packages=org.src.source
quarkus.hibernate-orm.oracle.database.default-schema=AAAA

# Quarkus Narayana JTA
quarkus.transaction-manager.object-store-directory=target/narayana
quarkus.transaction-manager.enable-recovery=true

# Camel
camel.rest.context-path=/api

I tried using the oracle datasource as a jpa component but it did not work! I also tried declaring a new JPAComponent in Routes:

@ApplicationScoped
public class Routes extends EndpointRouteBuilder {

    @Inject
    @PersistenceUnit("oracle")
    EntityManagerFactory entityManagerFactory;

    @Inject
    CamelContext camelContext;

    @Override
    public void configure() throws Exception {

        JpaComponent jpaComponent = new JpaComponent();
        jpaComponent.setEntityManagerFactory(entityManagerFactory);
        camelContext.addComponent("jpaComponent", jpaComponent);
  }
}

But got this error instead: java.lang.ClassNotFoundException: org.springframework.transaction.support.TransactionCallback

I would really appreciate any suggestions.


问:
How do you update all the TreeView items full area when the vertical scrollbar shows up or goes away?
I am using NM_CUSTOMDRAW to draw tree view items.   My items right justify parts of it by using a right margin based on the RECT area reported available.  The issue I have is that when the vertical scrollbar appears or disappears, only the item expanded/collapsed and the area under the scrollbar seems to update (invalidated regions).  This causes the repaint requests (with the new width) to not update the area correctly.

For example (using text and a single space as example):  You could have something with the scrollbar be right justified text ## where ## is the scrollbar then when the scrollbar goes away you end up with right justified text t  instead of right justified text

Is there a good way to fix this?

One thought is if I could catch a message when a scrollbar shows up or goes away, I could just invalidate the window to force a redraw.  Is there such a message?

Or is there a way to add to the invalidated region without triggering a redraw loop but would update the full items area?

Another thought is I can just use the full window RECT size and use a right margin large enough that wouldn't be under the scroll area but I'd rather not do that.

Thanks!


问:
Uncaught TypeError: container.addEventListener is not a function
Trying to make a pop-up bot for a website and got the code on GitHub changed my elements named in id to a class.

works fine if I use getElementById()

I this error in the console:

bot.js:105 Uncaught TypeError: container.addEventListener is not a
function

at init (<anonymous>:132:15)

at bot (<anonymous>:140:3)

at <anonymous>:142:1

at eve (transformScriptTags.ts:99:10)

at n (transformScriptTags.ts:173:9)

at s (transformScriptTags.ts:204:11)

at t.forEach.e.src.o.onreadystatechange (transformScriptTags.ts:121:9)

const bot = function () {

    const bot = document.getElementsByClassName('bot');
    const container = document.getElementsByClassName('bot-container');
    const inner = document.getElementsByClassName('bot-inner');

    let restartButton = null;

    const sleep = function (ms) {
        return new Promise(resolve => setTimeout(resolve, ms));
    };

    const scrollContainer = function () {
        inner.scrollTop = inner.scrollHeight;
    };

    const insertNewChatItem = function (elem) {
        //container.insertBefore(elem, bot);
        bot.appendChild(elem);
        scrollContainer();
        //debugger;
        elem.classList.add('activated');
    };

    const printResponse = async function (step) {
        const response = document.createElement('div');
        response.classList.add('chat-response');
        response.innerHTML = step.text;
        insertNewChatItem(response);

        await sleep(1500);

        if (step.options) {
            const choices = document.createElement('div');
            choices.classList.add('choices');
            step.options.forEach(function (option) {
                const button = document.createElement(option.url ? 'a' : 'button');
                button.classList.add('choice');
                button.innerHTML = option.text;
                if (option.url) {
                    button.href = option.url;
                } else {
                    button.dataset.next = option.next;
                }
                choices.appendChild(button);
            });
            insertNewChatItem(choices);
        } else if (step.next) {
            printResponse(chat[step.next]);
        }
    };

    const printChoice = function (choice) {
        const choiceElem = document.createElement('div');
        choiceElem.classList.add('chat-ask');
        choiceElem.innerHTML = choice.innerHTML;
        insertNewChatItem(choiceElem);
    };

    const disableAllChoices = function () {
        const choices = document.querySelectorAll('.choice');
        choices.forEach(function (choice) {
            choice.disabled = 'disabled';
        });
        return;
    };

    const handleChoice = async function (e) {

        if (!e.target.classList.contains('choice') || 'A' === e.target.tagName) {
            // Target isn't a button, but could be a child of a button.
            var button = e.target.closest('.bot-container .choice');

            if (button !== null) {
                button.click();
            }

            return;
        }

        e.preventDefault();
        const choice = e.target;

        disableAllChoices();

        printChoice(choice);
        scrollContainer();

        await sleep(1500);

        if (choice.dataset.next) {
            printResponse(chat[choice.dataset.next]);
        }
        // Need to disable buttons here to prevent multiple choices
    };

    const handleRestart = function () {
        startConversation();
    }

    const startConversation = function () {
        printResponse(chat[1]);
    }

    const init = function () {
        container.addEventListener('click', handleChoice);

        restartButton = document.createElement('button');
        restartButton.innerText = "Restart";
        restartButton.classList.add('restart');
        restartButton.addEventListener('click', handleRestart);

        container.appendChild(restartButton);

        startConversation();
    };

    init();
}

bot();
```
<pre class="lang-html prettyprint-override"><code><body>

    <header class="text-center">
        <h1 class="xl reset-margin large-margin">bot</h1>

    <main id="main">
        <div  class="bot-container ">
            <div class="bot-inner">
                <div class="bot"></div>
            </div>
        </div>
    </main>
<button class="chat"><i class="fa fa-question"></i></button>
    <script src="conversation.js"></script>
    <script type="text/babel" data-presets="es2015,es2016,es2017" src="bot.js"></script>

</body>
</code>```

i tried changing it back to Id it works but i want it as class.

Body:
Trying to make a pop-up bot for a website and got the code on GitHub changed my elements named in id to a class.

works fine if I use getElementById()

I this error in the console:

bot.js:105 Uncaught TypeError: container.addEventListener is not a
function

at init (<anonymous>:132:15)

at bot (<anonymous>:140:3)

at <anonymous>:142:1

at eve (transformScriptTags.ts:99:10)

at n (transformScriptTags.ts:173:9)

at s (transformScriptTags.ts:204:11)

at t.forEach.e.src.o.onreadystatechange (transformScriptTags.ts:121:9)

const bot = function () {

    const bot = document.getElementsByClassName('bot');
    const container = document.getElementsByClassName('bot-container');
    const inner = document.getElementsByClassName('bot-inner');

    let restartButton = null;

    const sleep = function (ms) {
        return new Promise(resolve => setTimeout(resolve, ms));
    };

    const scrollContainer = function () {
        inner.scrollTop = inner.scrollHeight;
    };

    const insertNewChatItem = function (elem) {
        //container.insertBefore(elem, bot);
        bot.appendChild(elem);
        scrollContainer();
        //debugger;
        elem.classList.add('activated');
    };

    const printResponse = async function (step) {
        const response = document.createElement('div');
        response.classList.add('chat-response');
        response.innerHTML = step.text;
        insertNewChatItem(response);

        await sleep(1500);

        if (step.options) {
            const choices = document.createElement('div');
            choices.classList.add('choices');
            step.options.forEach(function (option) {
                const button = document.createElement(option.url ? 'a' : 'button');
                button.classList.add('choice');
                button.innerHTML = option.text;
                if (option.url) {
                    button.href = option.url;
                } else {
                    button.dataset.next = option.next;
                }
                choices.appendChild(button);
            });
            insertNewChatItem(choices);
        } else if (step.next) {
            printResponse(chat[step.next]);
        }
    };

    const printChoice = function (choice) {
        const choiceElem = document.createElement('div');
        choiceElem.classList.add('chat-ask');
        choiceElem.innerHTML = choice.innerHTML;
        insertNewChatItem(choiceElem);
    };

    const disableAllChoices = function () {
        const choices = document.querySelectorAll('.choice');
        choices.forEach(function (choice) {
            choice.disabled = 'disabled';
        });
        return;
    };

    const handleChoice = async function (e) {

        if (!e.target.classList.contains('choice') || 'A' === e.target.tagName) {
            // Target isn't a button, but could be a child of a button.
            var button = e.target.closest('.bot-container .choice');

            if (button !== null) {
                button.click();
            }

            return;
        }

        e.preventDefault();
        const choice = e.target;

        disableAllChoices();

        printChoice(choice);
        scrollContainer();

        await sleep(1500);

        if (choice.dataset.next) {
            printResponse(chat[choice.dataset.next]);
        }
        // Need to disable buttons here to prevent multiple choices
    };

    const handleRestart = function () {
        startConversation();
    }

    const startConversation = function () {
        printResponse(chat[1]);
    }

    const init = function () {
        container.addEventListener('click', handleChoice);

        restartButton = document.createElement('button');
        restartButton.innerText = "Restart";
        restartButton.classList.add('restart');
        restartButton.addEventListener('click', handleRestart);

        container.appendChild(restartButton);

        startConversation();
    };

    init();
}

bot();

bot

<button class="chat"></button>

i tried changing it back to Id it works but i want it as class.


问:
Download multiple files in an angular application
I have an async method that retrieves the presigned URL of a selected file and a method that takes that URL and downloads the file by adding an anchor tag, assigns the URL to href and then simulates a click event. It works fine for a single file download. However, when there are multiple files selected it doesn't download all the files. I have tried other approaches such as calling fetch(), axios etc but that also results in the same issue.
Below is my code:
method in component:

```<code>`public async downloadSelectedFiles(event: Event, entitlementId: string) {
  event.preventDefault();
  for (const releaseFile of this.selectedReleaseFiles) {
    const url = await this._softwareProductsService.getFileDownloadUrl(entitlementId, String(releaseFile.id));
    await this._downloadService.downloadFile(url);
  }
}`
</code>```

method in service:

```<code>`public async downloadFile(url: string): Promise<void> {
  const a = this._document.createElement('a');
  a.download = '';
  a.href = url;
  a.style.display = 'none';
  document.body.appendChild(a);
  a.click();
  await this._delay(100);
  document.body.removeChild(a);
}

private _delay(ms: number): Promise<void> {
  return new Promise<void>((resolve) => {
    setTimeout(resolve, ms);
  });
}`
</code>```

I have tried setting id of anchor tag. Waiting after click and after remove as well. Also tried 'multi-download' library. All result in same issue.
It doesn't download all the files when download button is clicked for the first time. When clicked again it works fine.
Is there a way to await on anchor tag click event?

Body:
I have an async method that retrieves the presigned URL of a selected file and a method that takes that URL and downloads the file by adding an anchor tag, assigns the URL to href and then simulates a click event. It works fine for a single file download. However, when there are multiple files selected it doesn't download all the files. I have tried other approaches such as calling fetch(), axios etc but that also results in the same issue.
Below is my code:
method in component:

`public async downloadSelectedFiles(event: Event, entitlementId: string) {
  event.preventDefault();
  for (const releaseFile of this.selectedReleaseFiles) {
    const url = await this._softwareProductsService.getFileDownloadUrl(entitlementId, String(releaseFile.id));
    await this._downloadService.downloadFile(url);
  }
}`

method in service:

`public async downloadFile(url: string): Promise<void> {
  const a = this._document.createElement('a');
  a.download = '';
  a.href = url;
  a.style.display = 'none';
  document.body.appendChild(a);
  a.click();
  await this._delay(100);
  document.body.removeChild(a);
}

private _delay(ms: number): Promise<void> {
  return new Promise<void>((resolve) => {
    setTimeout(resolve, ms);
  });
}`

I have tried setting id of anchor tag. Waiting after click and after remove as well. Also tried 'multi-download' library. All result in same issue.
It doesn't download all the files when download button is clicked for the first time. When clicked again it works fine.
Is there a way to await on anchor tag click event?


问:
Graphical representation of simulation study Using R Software
I would like to perform a simulation study to evaluate the performance of a distribution. For that, I wrote the R program for the specified initial values and evaluated the  Maximum likelihood estimates, bias and MSE values. The program succeeds in showing that as the sample size increases, the estimated values becomes closer to the true values and the bias and MSE decreases. The estimation technique used is MLE. Some recent works displays the simulation results(estimates, bias and MSE) graphically instead of table. In my program, I got the results for a specified sample size but in the graph shown below they got continuous curve corresponding to a range of sample size. But I didn't get the idea what changes I have to make in the R program to get the results as shown in this graphenter image description here.Can anyone help me in giving the idea behind this graph.
I am expecting ideas to obtain a single graph having results showing curves of all the parameters as in the attached graph.</p>


问:
The endpoint I'm using is to create a new contact
I'm currently trying to send an email from our Squarespace newsletter signup to our Everlytic but I'm hitting 401 response headers from Cloudflare. The support agent suggested I send through the call (The Auth header is already base64 encoded):

javascript sends an email address to a contact list (id 31188). It currently works in Postman but has issues when it's sent through the browser. It's not CORS and the response header shows a 401 from cloudflare.


问:
reading data from a sequence of folders that share different subfolder paths
I have a series of data files in a folder that I want to read and copy to another folder after converting to some other format. The root folder path is like E:\new (1)\PPMI. Folder PPMI contains subfolders which further contains three different level of subfolders like this

```<code>E:\new (1)\PPMI\3102\MPRAGE_GRAPPA\2010-11-23_09_51_22.0\I226365
E:\new (1)\PPMI\3106\MPRAGE_GRAPPA\2011-03-24_14_13_48.0\I235251
E:\new (1)\PPMI\3367\MPRAGE_T1_SAG\2011-08-26_09_28_15.0\I259619
</code>```

The last folder contains the files I want to read. This has to be done for all the folders.
How to perform this operation

```<code>for i,patient in enumerate(glob(input_path)):
    for dir in os.walk(input_path).next()[1]:
        for dir1 in os.walk(dir).next()[1]:
            for dir2 in os.walk(dir1).next()[1]:
                for dir3 in os.walk(dir2).next()[1]:
                        dicom2nifti.dicom_series_to_nifti(os.path.join(input_path,dir1,dir2,dir3,os.walk(dir3).next()[2]),os.path.join(output_nifti_path,'patient_num'+str(i+1)+'.nii.gz'))

</code>```

I want to convert the dicom files stored in one path to nifti files and save them to destination folder.

Body:
I have a series of data files in a folder that I want to read and copy to another folder after converting to some other format. The root folder path is like E:\new (1)\PPMI. Folder PPMI contains subfolders which further contains three different level of subfolders like this

E:\new (1)\PPMI\3102\MPRAGE_GRAPPA\2010-11-23_09_51_22.0\I226365
E:\new (1)\PPMI\3106\MPRAGE_GRAPPA\2011-03-24_14_13_48.0\I235251
E:\new (1)\PPMI\3367\MPRAGE_T1_SAG\2011-08-26_09_28_15.0\I259619

The last folder contains the files I want to read. This has to be done for all the folders.
How to perform this operation

for i,patient in enumerate(glob(input_path)):
    for dir in os.walk(input_path).next()[1]:
        for dir1 in os.walk(dir).next()[1]:
            for dir2 in os.walk(dir1).next()[1]:
                for dir3 in os.walk(dir2).next()[1]:
                        dicom2nifti.dicom_series_to_nifti(os.path.join(input_path,dir1,dir2,dir3,os.walk(dir3).next()[2]),os.path.join(output_nifti_path,'patient_num'+str(i+1)+'.nii.gz'))

I want to convert the dicom files stored in one path to nifti files and save them to destination folder.


问:
Indexed DB Data lost
We save real-time data in indexed DB, sometimes data is removed from indexed DB even though the system has enough storage.

If the user chooses to remove data on the browser close. That is one known case, But still, these kinds of bugs are there.

Does anyone know any suitable technique to avoid data loss in indexed DB?

I am using idb library
https://www.npmjs.com/package/idb

Title: Indexed DB Data lost


问:
Datastream cannot read UPDATE binary log in Google cloud Datastream
I use Datastream to bigquery.
I sync data from oracle mysql to bigquery use datastream.
when use oracle mysql version 8.0.28 -> working.
when use oracle mysql version 8.0.30 -> working but I only saw data with change_type is INSERT. There is no UPDATE-INSERT event appear.
I wonder if there any case that Datastream cannot read binary log with UPDATE type? Thanks for your help.

Thanks for your help.


问:
Com Exception: Code = -2,146,777,998 Code meaning = Unknown error 0x800AC472.Why this error showing in console C-PLEX?
Com Exception:  Code = -2,146,777,998   Code meaning = Unknown error 0x800AC472.Why this error showing in console C-PLEX?</p>


Title: Unknown compression method

Body:
Can someone explain me, what is that compression method used?

I tried to reverse engeneer old application. It using tcp connection and send messages using json.
All data was the plain json, but that data is json value "pb_rsp" was binary and i cant uncompress that.

120113837000265, Xanthus, EliteDog, flag30, 574949063200274 - thats a plain data. Around them some unknown separators.

I think thats encoded json, but cant detect method, help please

�
 9181129d4be64c36ad42401c8227226f��
"Z
120113837000265Xanthus *8
 84860c8bfafb48b1b6ef8b595fcf6246EEDEliteDog"flag30�(��0@H����0P�����0X�����0`j�
574949063200274Z
120113837000265Xanthus *8
 84860c8bfafb48b1b6ef8b595fcf6246EEDEliteDog"flag30� �����0(�����02�(0@ZJ
107107ddR

or hex

1A D5 02 0A 0F 35 37 35 30 33 30 39 37 36 39 30 30 32 37 34 10 3F 1A 58 0A 0F 31 36 37 38 34 37 30 37 35 30 30 30 32 37 34 12 05 41 6B 61 72 64 20 09 2A 38 0A 20 38 34 38 36 30 63 38 62 66 61 66 62 34 38 62 31 62 36 65 66 38 62 35 39 35 66 63 66 36 32 34 36 12 03 45 45 44 1A 08 45 6C 69 74 65 44 6F 67 22 05 66 6C 61 67 33 30 EB A7 12 2A 39 0A 1C 77 6F 72 6C 64 52 6F 62 6F 74 2D 31 36 37 31 34 37 32 38 35 30 31 34 38 2D 33 33 39 12 0A 41 6E 6F 6E 79 6D 6F 75 73 31 1A 0D 70 69 63 5F 31 32 5F 5A 68 75 6A 75 65 38 97 91 A4 EF D2 30 40 CF C5 C4 EF D2 30 48 01 50 9B E1 1C 5A 27 08 98 11 28 01 30 0E 40 50 4A 0C 0A 06 31 30 37 30 30 38 10 5A 18 5A 4A 0C 0A 06 31 30 37 30 30 39 10 0A 18 0A 52 00 5A 19 08 E0 12 28 02 30 0E 40 50 4A 0C 0A 06 31 30 37 30 30 38 10 64 18 64 52 00 5A 19 08 EB 12 28 05 30 0E 40 64 4A 0C 0A 06 31 30 37 31 30 38 10 64 18 64 52 00 5A 19 08 E1 12 28 04 30 0E 40 64 4A 0C 0A 06 31 30 37 32 30 38 10 64 18 64 52 00 5A 19 08 99 11 28 03 30 0E 40 64 4A 0C 0A 06 31 30 37 31 30 38 10 64 18 64 52 00 60 AA F9 0F 1A C7 02 0A 0F 35 37 35 30 33 31 30 32 38 30 30 30 32 37 34 10 3F 1A 58 0A 0F 31 36 37 38 34 37 30 37 35 30 30 30 32 37 34 12 05 41 6B 61 72 64 20 09 2A 38 0A 20 38 34 38 36 30 63 38 62 66 61 66 62 34 38 62 31 62 36 65 66 38 62 35 39 35 66 63 66 36 32 34 36 12 03 45 45 44 1A 08 45 6C 69 74 65 44 6F 67 22 05 66 6C 61 67 33 30 EB A7 12 2A 39 0A 1C 77 6F 72 6C 64 52 6F 62 6F 74 2D 31 36 37 31 34 37 32 38 35 30 31 34 38 2D 33 33 39 12 0A 41 6E 6F 6E 79 6D 6F 75 73 31 1A 0D 70 69 63 5F 31 32 5F 5A 68 75 6A 75 65 38 A1 A6 A4 EF D2 30 40 D9 DA C4 EF D2 30 48 01 50 9B E1 1C 5A 19 08 B4 10 28 01 30 0E 40 46 4A 0C 0A 06 31 30 37 30 30 38 10 64 18 64 52 00 5A 19 08 BF 10 28 02 30 0D 40 5F 4A 0C 0A 06 31 30 37 30 30 38 10 64 18 64 52 00 5A 19 08 B5 10 28 05 30 0E 40 5F 4A 0C 0A 06 31 30 37 31 30 38 10 64 18 64 52 00 5A 19 08 BE 10 28 04 30 0E 40 5F 4A 0C 0A 06 31 30 37 31 30 38 10 64 18 64 52 00 5A 19 08 C1 10 28 03 30 0E 40 5F 4A 0C 0A 06 31 30 37 32 30 38 10 64 18 64 52 00 60 AA F9 0F 1A C7 02 0A 0F 35 37 35 30 33 31 31 35 34 37 30 30 32 37 34 10 3F 1A 58 0A 0F 31 36 37 38 34 37 30 37 35 30 30 30 32 37 34 12 05 41 6B 61 72 64 20 09 2A 38 0A 20 38 34 38 36 30 63 38 62 66 61 66 62 34 38 62 31 62 36 65 66 38 62 35 39 35 66 63 66 36 32 34 36 12 03 45 45 44 1A 08 45 6C 69 74 65 44 6F 67 22 05 66 6C 61 67 33 30 EB A7 12 2A 39 0A 1C 77 6F 72 6C 64 52 6F 62 6F 74 2D 31 36 37 31 34 37 32 38 35 30 31 34 38 2D 33 33 39 12 0A 41 6E 6F 6E 79 6D 6F 75 73 31 1A 0D 70 69 63 5F 31 32 5F 5A 68 75 6A 75 65 38 E3 B6 A4 EF D2 30 40 9B EB C4 EF D2 30 48 01 50 9B E1 1C 5A 19 08 FD 11 28 03 30 0E 40 46 4A 0C 0A 06 31 30 37 32 30 38 10 64 18 64 52 00 5A 19 08 FC 11 28 01 30 0E 40 46 4A 0C 0A 06 31 30 37 30 30 38 10 64 18 64 52 00 5A 19 08 86 12 28 04 30 0D 40 5A 4A 0C 0A 06 31 30 37 32 30 38 10 64 18 64 52 00 5A 19 08 FE 11 28 05 30 0E 40 46 4A 0C 0A 06 31 30 37 32 30 38 10 64 18 64 52 00 5A 19 08 81 12 28 02 30 0E 40 46 4A 0C 0A 06 31 30 37 31 30 38 10 64 18 64 52 00 60 AA F9 0F 1A D5 02 0A 0F 35 37 35 30 33 31 32 30 34 34 30 30 32 37 34 10 3F 1A 58 0A 0F 31 36 37 38 34 37 30 37 35 30 30 30 32 37 34 12 05 41 6B 61 72 64 20 09 2A 38 0A 20 38 34 38 36 30 63 38 62 66 61 66 62 34 38 62 31 62 36 65 66 38 62 35 39 35 66 63 66 36 32 34 36 12 03 45 45 44 1A 08 45 6C 69 74 65 44 6F 67 22 05 66 6C 61 67 33 30 EB A7 12 2A 39 0A 1C 77 6F 72 6C 64 52 6F 62 6F 74 2D 31 36 37 31 34 37 32 38 35 30 31 34 38 2D 33 33 39 12 0A 41 6E 6F 6E 79 6D 6F 75 73 31 1A 0D 70 69 63 5F 31 32 5F 5A 68 75 6A 75 65 38 86 C6 A4 EF D2 30 40 BE FA C4 EF D2 30 48 01 50 9B E1 1C 5A 27 08 A2 11 28 01 30 0E 40 3C 4A 0C 0A 06 31 30 37 30 30 38 10 63 18 63 4A 0C 0A 06 31 30 37 30 30 39 10 01 18 01 52 00 5A 19 08 E4 12 28 02 30 0E 40 41 4A 0C 0A 06 31 30 37 30 30 38 10 64 18 64 52 00 5A 19 08 E2 12 28 05 30 0E 40 46 4A 0C 0A 06 31 30 37 32 30 38 10 64 18 64 52 00 5A 19 08 E5 12 28 04 30 0E 40 46 4A 0C 0A 06 31 30 37 31 30 38 10 64 18 64 52 00 5A 19 08 EC 12 28 03 30 0E 40 55 4A 0C 0A 06 31 30 37 31 30 38 10 64 18 64 52 00 60 AA F9 0F

or base64

Ev8HCiAwYjk5MGU1NzIwNzU0ZTNlODhlYTc2MDc3YmViNWNmYxji2AsicAoPMTQ1MTk2NDk1MDAwMjk0Eghzb29uMTAwNBoVcGljXzEwX0tlZXJtYW5fTElOU0hJKjgKIDg0ODYwYzhiZmFmYjQ4YjFiNmVmOGI1OTVmY2Y2MjQ2EgNFRUQaCEVsaXRlRG9nIgVmbGFnMzDrpxIohpEMMA9ABUjLneju0jBQm5GO79IwWIvtjO/SMGABapwCCg81NzQ5OTUyNTY5MDAyNzQScAoPMTQ1MTk2NDk1MDAwMjk0Eghzb29uMTAwNBoVcGljXzEwX0tlZXJtYW5fTElOU0hJKjgKIDg0ODYwYzhiZmFmYjQ4YjFiNmVmOGI1OTVmY2Y2MjQ2EgNFRUQaCEVsaXRlRG9nIgVmbGFnMzDrpxIgk+2M79IwKJuRju/SMDIbCOwSKAQwDEBfSgwKBjEwNzEwNxBkGGRSAggBMhsItRAoAzAMQF9KDAoGMTA3MTA3EGQYZFICCAEyGQi0ECgBMAlARkoMCgYxMDcwMDcQZBhkUgAyGQi4ECgCMA5AVUoMCgYxMDcyMDcQZBhkUgAyGQi2ECgFMA5AWkoMCgYxMDcyMDcQZBhkUgBqgAIKDzU3NDk5NjA5MTQwMDI3NBJYCg8xNjk1ODE1MjIwMDAyNjUSBUt3b24yIAwqOAogODQ4NjBjOGJmYWZiNDhiMWI2ZWY4YjU5NWZjZjYyNDYSA0VFRBoIRWxpdGVEb2ciBWZsYWczMOunEiCYi+ru0jAo0KLq7tIwMhkIuBAoAjAOQDJKDAoGMTA3MjA3EGQYZFIAMhkIgBIoATALQDxKDAoGMTA3MDA3EGQYZFIAMhkI/xEoBTAOQEZKDAoGMTA3MjA3EGQYZFIAMhkIthAoBDAOQEZKDAoGMTA3MjA3EGQYZFIAMhkIgRIoAzAOQEZKDAoGMTA3MTA3EGQYZFIAaoUCCg81NzUwMDUzNTMxMDAyNzQSWwoOMTk4NDcxMjQwMDAyNzESCUFtYW5kYTI2NSAGKjgKIDg0ODYwYzhiZmFmYjQ4YjFiNmVmOGI1OTVmY2Y2MjQ2EgNFRUQaCEVsaXRlRG9nIgVmbGFnMzDrpxIgo5367tIwKLPc/+7SMDIZCOQSKAEwDkBBSgwKBjEwNzAwNxBkGGRSADIZCOASKAIwCkBBSgwKBjEwNzAwNxBkGGRSADIZCJoRKAMwCUAFSgwKBjEwNzIwNxBkGGRSADIbCOESKAQwDUBkSgwKBjEwNzIwNxBkGGRSAggCMhkI6xIoBTAMQGRKDAoGMTA3MTA3EGQYZFIAggEGOTAwMDM3sAEBugEPNTc0OTk1MjU2OTAwMjc0

Thanks

Thats not a gzip or zip


问:
How do I undo the most recent commits in Git
How do I undo the most recent commits in Git. I accidentally committed the wrong files to Git, but didn't push the commit to the server yet.</p>


问:
when i run the docker image I'm unable to find the content on the browser
I've built a docker image using the command   "docker build -t flask-app-testing .".   Later I've run the image with the command docker run --name test-flask -p 5060:5060 flask-app-testing using a port of 5060 later it generates a url like : image
if i click here it gives the content from the flask app on the browser page but it's not giving the desired. and showing ....

This site can’t be reached The webpage at http://localhost:5060/ might be temporarily down or it may have moved permanently to a new web address.
ERR_UNSAFE_PORT

The app.py file is

```<code>import uuid
from flask import Flask
instanceId = uuid.uuid4().hex
app = Flask(__name__)

@app.route("/")
def get_instance_id():
    return f"instance {instanceId}"

if __name__ == "__main__":
    app.run(port=5060, host="0.0.0.0")

</code>```

The docker file is:

```<code>FROM python:3.9.12
WORKDIR /app
COPY . .
RUN pip3 install -r requirements.txt
CMD ["gunicorn", "--bind=0.0.0.0:5060","app:app"]
</code>```

requirements.txt:

```<code>flask
gunicorn

</code>```

Body:
I've built a docker image using the command   "docker build -t flask-app-testing .".   Later I've run the image with the command docker run --name test-flask -p 5060:5060 flask-app-testing using a port of 5060 later it generates a url like : image
if i click here it gives the content from the flask app on the browser page but it's not giving the desired. and showing ....

This site can’t be reached The webpage at http://localhost:5060/ might be temporarily down or it may have moved permanently to a new web address.
ERR_UNSAFE_PORT

The app.py file is

import uuid
from flask import Flask
instanceId = uuid.uuid4().hex
app = Flask(__name__)

@app.route("/")
def get_instance_id():
    return f"instance {instanceId}"

if __name__ == "__main__":
    app.run(port=5060, host="0.0.0.0")

The docker file is:

FROM python:3.9.12
WORKDIR /app
COPY . .
RUN pip3 install -r requirements.txt
CMD ["gunicorn", "--bind=0.0.0.0:5060","app:app"]

requirements.txt:

flask
gunicorn


问:
Whether the resource id in Android xml can be used before being declared
I wonder that Whether the resource id in Android xml can be used before being declared? when I test it in a demo application , compiled in Android Studio and ran in the phone both work. The xml code in demo as following:

```<code><?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:id ="@+id/view"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:background="@color/black"
        android:layout_alignBottom="@id/bt"/>
    <Button
        android:id="@+id/bt"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text=" am a button" />
</RelativeLayout>

</code>```

The Activity code as following:

public class MainActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}
```

Body:
I wonder that Whether the resource id in Android xml can be used before being declared? when I test it in a demo application , compiled in Android Studio and ran in the phone both work. The xml code in demo as following:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:id ="@+id/view"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:background="@color/black"
        android:layout_alignBottom="@id/bt"/>
    <Button
        android:id="@+id/bt"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text=" am a button" />
</RelativeLayout>

The Activity code as following:

public class MainActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}


问:
Trying to send data to API using model and list in flutter
I am trying to send data to API, But I can't make it to work. I use model to get data from users.

Here is the model

```<code>   class SurgeryModel {
  String id;
  String name;
  DateTime date;
  String eye;

  SurgeryModel(
      {required this.id,
      required this.date,
      required this.name,
      required this.eye});

}
</code>```

And I am adding data like this.

```<code>    void addNewSurgeryRecord(BuildContext ctx) {
    showDialog(
        context: context,
        builder: (context) {
          // we use statefulbilder because we need to use setState to update the dropdown menu state.
          return StatefulBuilder(builder: (context, setState) {
            return AlertDialog(
              shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.circular(
                  10.0,
                ),
              ),
              content: SingleChildScrollView(
                child: Column(
                  children: [
                    Column(
                      mainAxisAlignment: MainAxisAlignment.start,
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisSize: MainAxisSize.min,
                      children: [
                        Container(
                          child: Text(
                            'Surgery Name',
                            style: TextStyle(
                              color: Colors.black,
                              fontSize: 16.0,
                            ),
                          ),
                        ),
                        TextField(
                          keyboardType: TextInputType.multiline,
                          maxLength: 1000,
                          maxLines: null,
                          controller: sNameController,
                          decoration: InputDecoration(
                            border: OutlineInputBorder(
                              borderRadius: BorderRadius.circular(
                                15.0,
                              ),
                            ),
                            focusedBorder: OutlineInputBorder(
                              borderRadius:
                                  BorderRadius.all(Radius.circular(15.0)),
                              borderSide: BorderSide(color: Colors.blue),
                            ),
                            // labelText: 'Drug name',
                            // labelStyle: TextStyle(color: Colors.blue[200]),
                            enabledBorder: OutlineInputBorder(
                              borderSide: BorderSide(
                                color: Colors.blueAccent,
                              ),
                              borderRadius: BorderRadius.circular(
                                15.0,
                              ),
                            ),
                          ),
                        ),
                      ],
                    ),
                    Column(
                      mainAxisAlignment: MainAxisAlignment.start,
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisSize: MainAxisSize.min,
                      children: [
                        Container(
                          child: Text(
                            'Date',
                            style: TextStyle(
                              color: Colors.black,
                              fontSize: 16.0,
                            ),
                          ),
                        ),
                        TextFieldContainer(
                          child: DateTimeField(
                            format: format,
                            onChanged: (getPrescriptionDate) {
                              formattedTodate = getPrescriptionDate!;
                            },
                            onShowPicker: (context, currentValue) {
                              return showDatePicker(
                                  context: context,
                                  firstDate: DateTime(1900),
                                  initialDate: currentValue ?? DateTime.now(),
                                  lastDate: DateTime(2100));
                            },
                            decoration: InputDecoration(
                              border: InputBorder.none,
                              hintText: 'Select Date of Visited',
                              hintStyle: TextStyle(
                                  fontSize: 15, fontWeight: FontWeight.normal),
                            ),
                            initialValue: formattedTodate.toLocal(),
                            validator: (dateOfBirthValue) {
                              // dob = dateOfBirthValue.toString();
                              return null;
                            },
                          ),
                        ),
                        // TextFieldContainer(
                        //   keyboardType: TextInputType.multiline,
                        //   maxLength: 1000,
                        //   maxLines: null,
                        //   // controller: surgeryDateController,
                        //   decoration: InputDecoration(
                        //     border: OutlineInputBorder(
                        //       borderRadius: BorderRadius.circular(
                        //         15.0,
                        //       ),
                        //     ),
                        //     focusedBorder: OutlineInputBorder(
                        //       borderRadius:
                        //           BorderRadius.all(Radius.circular(15.0)),
                        //       borderSide: BorderSide(color: Colors.blue),
                        //     ),
                        //     // labelText: 'Drug name',
                        //     // labelStyle: TextStyle(color: Colors.blue[200]),
                        //     enabledBorder: OutlineInputBorder(
                        //       borderSide: BorderSide(
                        //         color: Colors.blueAccent,
                        //       ),
                        //       borderRadius: BorderRadius.circular(
                        //         15.0,
                        //       ),
                        //     ),
                        //   ),
                        // ),
                      ],
                    ),
                    Column(
                      mainAxisAlignment: MainAxisAlignment.start,
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisSize: MainAxisSize.min,
                      children: [
                        Container(
                          child: Text(
                            'Eye',
                            style: TextStyle(
                              color: Colors.black,
                              fontSize: 16.0,
                            ),
                          ),
                        ),
                        TextFieldContainer(
                          child: DropdownButtonHideUnderline(
                            child: DropdownButton(
                              icon: Visibility(
                                  visible: false,
                                  child: Icon(Icons.arrow_downward)),
                              isExpanded: true,
                              value: dropDownValue,
                              items: eyeSide.map((value) {
                                return DropdownMenuItem(
                                  value: value,
                                  child: Text(value),
                                );
                              }).toList(),
                              onChanged: ((String? value) {
                                setState(() {
                                  print(value);
                                  dropDownValue = value!;
                                  print(' print 2$value');
                                });
                              }),
                            ),
                          ),
                        ),
                        // TextField(
                        //   keyboardType: TextInputType.multiline,
                        //   maxLength: 1000,
                        //   maxLines: null,
                        //   controller: sEyeController,
                        //   decoration: InputDecoration(
                        //     border: OutlineInputBorder(
                        //       borderRadius: BorderRadius.circular(
                        //         15.0,
                        //       ),
                        //     ),
                        //     focusedBorder: OutlineInputBorder(
                        //       borderRadius:
                        //           BorderRadius.all(Radius.circular(15.0)),
                        //       borderSide: BorderSide(color: Colors.blue),
                        //     ),
                        //     // labelText: 'Drug name',
                        //     // labelStyle: TextStyle(color: Colors.blue[200]),
                        //     enabledBorder: OutlineInputBorder(
                        //       borderSide: BorderSide(
                        //         color: Colors.blueAccent,
                        //       ),
                        //       borderRadius: BorderRadius.circular(
                        //         15.0,
                        //       ),
                        //     ),
                        //   ),
                        // ),
                      ],
                    ),
                  ],
                ),
              ),
              actions: [
                Align(
                  alignment: Alignment.bottomRight,
                  child: ElevatedButton(
                    style: ElevatedButton.styleFrom(
                      primary: Colors.green,
                      onPrimary: Colors.white,
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(20.0),
                      ),
                    ),
                    onPressed: () {
                      widget.addSurgery(
                        sNameController.text,
                        dropDownValue,
                        formattedTodate,
                      );
                      // _addNewSurgery(sNameController.text, sEyeController.text);
                      print(sNameController.text);
                      print(sEyeController.text);
                      print(formattedTodate.toString());
                      Navigator.of(context).pop();
                    },
                    child: Text('Done'),
                  ),
                ),
              ],
            );
          });
        });
  }
</code>```

Below function is in another screen I pass this function to the above code screen.

```<code>    void _addNewSurgery(String sName, String sEye, DateTime date) {
    final newProp = SurgeryModel(
      date: date,
      name: sName,
      eye: sEye,
      id: DateTime.now().toString(),
    );

    setState(() {
      widget.surgeData.add(newProp);
    });
  }
</code>```

With help of these codes I am sending data to the web like below code

```<code>    testFunction() async {
    var localStorage = await SharedPreferences.getInstance();

    var data = {

      'surgeryHistory ': surgeData.toList(),

    };

    print('viewing pres data $data');
    var res = await Network().authData(data, '/route');
    debugPrint('printing before response ${res.body}');
    var body = json.decode(res.body);
    debugPrint('printing coming response ${body}');

  }
</code>```

I am getting this data like this on the web side(in laravel)

```<code> public function testWebFunction(Request $request)
    {

        $surgery_history = $request->get('surgeryHistory');
        $surgery_history_index = $surgery_history;

        return $surgery_history;

    }
</code>```

But I am getting error like this,

Am I doing something wrong here? I need to get those data to the web and save that data in to the database using for loop. In backend side I am using foreach to save data but i cant get sizeof the variable. Any answer will help me to overcome this situation. Thank You.

Body:
I am trying to send data to API, But I can't make it to work. I use model to get data from users.

Here is the model

   class SurgeryModel {
  String id;
  String name;
  DateTime date;
  String eye;

  SurgeryModel(
      {required this.id,
      required this.date,
      required this.name,
      required this.eye});

}

And I am adding data like this.

    void addNewSurgeryRecord(BuildContext ctx) {
    showDialog(
        context: context,
        builder: (context) {
          // we use statefulbilder because we need to use setState to update the dropdown menu state.
          return StatefulBuilder(builder: (context, setState) {
            return AlertDialog(
              shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.circular(
                  10.0,
                ),
              ),
              content: SingleChildScrollView(
                child: Column(
                  children: [
                    Column(
                      mainAxisAlignment: MainAxisAlignment.start,
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisSize: MainAxisSize.min,
                      children: [
                        Container(
                          child: Text(
                            'Surgery Name',
                            style: TextStyle(
                              color: Colors.black,
                              fontSize: 16.0,
                            ),
                          ),
                        ),
                        TextField(
                          keyboardType: TextInputType.multiline,
                          maxLength: 1000,
                          maxLines: null,
                          controller: sNameController,
                          decoration: InputDecoration(
                            border: OutlineInputBorder(
                              borderRadius: BorderRadius.circular(
                                15.0,
                              ),
                            ),
                            focusedBorder: OutlineInputBorder(
                              borderRadius:
                                  BorderRadius.all(Radius.circular(15.0)),
                              borderSide: BorderSide(color: Colors.blue),
                            ),
                            // labelText: 'Drug name',
                            // labelStyle: TextStyle(color: Colors.blue[200]),
                            enabledBorder: OutlineInputBorder(
                              borderSide: BorderSide(
                                color: Colors.blueAccent,
                              ),
                              borderRadius: BorderRadius.circular(
                                15.0,
                              ),
                            ),
                          ),
                        ),
                      ],
                    ),
                    Column(
                      mainAxisAlignment: MainAxisAlignment.start,
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisSize: MainAxisSize.min,
                      children: [
                        Container(
                          child: Text(
                            'Date',
                            style: TextStyle(
                              color: Colors.black,
                              fontSize: 16.0,
                            ),
                          ),
                        ),
                        TextFieldContainer(
                          child: DateTimeField(
                            format: format,
                            onChanged: (getPrescriptionDate) {
                              formattedTodate = getPrescriptionDate!;
                            },
                            onShowPicker: (context, currentValue) {
                              return showDatePicker(
                                  context: context,
                                  firstDate: DateTime(1900),
                                  initialDate: currentValue ?? DateTime.now(),
                                  lastDate: DateTime(2100));
                            },
                            decoration: InputDecoration(
                              border: InputBorder.none,
                              hintText: 'Select Date of Visited',
                              hintStyle: TextStyle(
                                  fontSize: 15, fontWeight: FontWeight.normal),
                            ),
                            initialValue: formattedTodate.toLocal(),
                            validator: (dateOfBirthValue) {
                              // dob = dateOfBirthValue.toString();
                              return null;
                            },
                          ),
                        ),
                        // TextFieldContainer(
                        //   keyboardType: TextInputType.multiline,
                        //   maxLength: 1000,
                        //   maxLines: null,
                        //   // controller: surgeryDateController,
                        //   decoration: InputDecoration(
                        //     border: OutlineInputBorder(
                        //       borderRadius: BorderRadius.circular(
                        //         15.0,
                        //       ),
                        //     ),
                        //     focusedBorder: OutlineInputBorder(
                        //       borderRadius:
                        //           BorderRadius.all(Radius.circular(15.0)),
                        //       borderSide: BorderSide(color: Colors.blue),
                        //     ),
                        //     // labelText: 'Drug name',
                        //     // labelStyle: TextStyle(color: Colors.blue[200]),
                        //     enabledBorder: OutlineInputBorder(
                        //       borderSide: BorderSide(
                        //         color: Colors.blueAccent,
                        //       ),
                        //       borderRadius: BorderRadius.circular(
                        //         15.0,
                        //       ),
                        //     ),
                        //   ),
                        // ),
                      ],
                    ),
                    Column(
                      mainAxisAlignment: MainAxisAlignment.start,
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisSize: MainAxisSize.min,
                      children: [
                        Container(
                          child: Text(
                            'Eye',
                            style: TextStyle(
                              color: Colors.black,
                              fontSize: 16.0,
                            ),
                          ),
                        ),
                        TextFieldContainer(
                          child: DropdownButtonHideUnderline(
                            child: DropdownButton(
                              icon: Visibility(
                                  visible: false,
                                  child: Icon(Icons.arrow_downward)),
                              isExpanded: true,
                              value: dropDownValue,
                              items: eyeSide.map((value) {
                                return DropdownMenuItem(
                                  value: value,
                                  child: Text(value),
                                );
                              }).toList(),
                              onChanged: ((String? value) {
                                setState(() {
                                  print(value);
                                  dropDownValue = value!;
                                  print(' print 2$value');
                                });
                              }),
                            ),
                          ),
                        ),
                        // TextField(
                        //   keyboardType: TextInputType.multiline,
                        //   maxLength: 1000,
                        //   maxLines: null,
                        //   controller: sEyeController,
                        //   decoration: InputDecoration(
                        //     border: OutlineInputBorder(
                        //       borderRadius: BorderRadius.circular(
                        //         15.0,
                        //       ),
                        //     ),
                        //     focusedBorder: OutlineInputBorder(
                        //       borderRadius:
                        //           BorderRadius.all(Radius.circular(15.0)),
                        //       borderSide: BorderSide(color: Colors.blue),
                        //     ),
                        //     // labelText: 'Drug name',
                        //     // labelStyle: TextStyle(color: Colors.blue[200]),
                        //     enabledBorder: OutlineInputBorder(
                        //       borderSide: BorderSide(
                        //         color: Colors.blueAccent,
                        //       ),
                        //       borderRadius: BorderRadius.circular(
                        //         15.0,
                        //       ),
                        //     ),
                        //   ),
                        // ),
                      ],
                    ),
                  ],
                ),
              ),
              actions: [
                Align(
                  alignment: Alignment.bottomRight,
                  child: ElevatedButton(
                    style: ElevatedButton.styleFrom(
                      primary: Colors.green,
                      onPrimary: Colors.white,
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(20.0),
                      ),
                    ),
                    onPressed: () {
                      widget.addSurgery(
                        sNameController.text,
                        dropDownValue,
                        formattedTodate,
                      );
                      // _addNewSurgery(sNameController.text, sEyeController.text);
                      print(sNameController.text);
                      print(sEyeController.text);
                      print(formattedTodate.toString());
                      Navigator.of(context).pop();
                    },
                    child: Text('Done'),
                  ),
                ),
              ],
            );
          });
        });
  }

Below function is in another screen I pass this function to the above code screen.

    void _addNewSurgery(String sName, String sEye, DateTime date) {
    final newProp = SurgeryModel(
      date: date,
      name: sName,
      eye: sEye,
      id: DateTime.now().toString(),
    );

    setState(() {
      widget.surgeData.add(newProp);
    });
  }

With help of these codes I am sending data to the web like below code

    testFunction() async {
    var localStorage = await SharedPreferences.getInstance();

    var data = {

      'surgeryHistory ': surgeData.toList(),

    };

    print('viewing pres data $data');
    var res = await Network().authData(data, '/route');
    debugPrint('printing before response ${res.body}');
    var body = json.decode(res.body);
    debugPrint('printing coming response ${body}');

  }

I am getting this data like this on the web side(in laravel)

 public function testWebFunction(Request $request)
    {

        $surgery_history = $request->get('surgeryHistory');
        $surgery_history_index = $surgery_history;

        return $surgery_history;

    }

But I am getting error like this,

Am I doing something wrong here? I need to get those data to the web and save that data in to the database using for loop. In backend side I am using foreach to save data but i cant get sizeof the variable. Any answer will help me to overcome this situation. Thank You.


问:
Disable browser back button
I need to prevent click of the browser back button. When user clicks on browser back button from desktop or mobile we need to stay on same page. I tried different solutions from internet (some of them are working for Firefox). One of the code that is working on Firefox only:

```<code>window.history.pushState(null, "", window.location.href);
window.onpopstate = function () {
   window.history.pushState(null, "", window.location.href);
};
</code>```

On chrome or safari or edge browser when we do external click on page then only above code will work and user will be prevented to click on the back button.
Please help me for this issue

Title: Disable browser back button

Body:
I need to prevent click of the browser back button. When user clicks on browser back button from desktop or mobile we need to stay on same page. I tried different solutions from internet (some of them are working for Firefox). One of the code that is working on Firefox only:

window.history.pushState(null, "", window.location.href);
window.onpopstate = function () {
   window.history.pushState(null, "", window.location.href);
};

On chrome or safari or edge browser when we do external click on page then only above code will work and user will be prevented to click on the back button.
Please help me for this issue


问:
Why this error showing while created a form to upload image in Django
Error raised is here

```<code>enter code here
</code>```

This is the view to addpost and inherited from CreateView.
views.py

```<code>class PostAddView(CreateView):
    template_name="add_post.html"
    form_class=PostForm
    model=AddPost
    success_url=reverse_lazy("index")
    context_object_name="posts"
</code>```

models.py

```<code>class AddPost(models.Model):
    post=models.ImageField(upload_to="postimages",null=True)
    caption=models.CharField(max_length=200)
    user=models.ForeignKey(MyUser,on_delete=models.CASCADE)
    created_date=models.DateTimeField(auto_now_add=True)
</code>```

Here MyUser is a abstract user

forms.py

```<code>class PostForm(forms.ModelForm):
    class Meta:
        model=AddPost
        fields=["post","caption"]

        widget={
            "post":forms.FileInput(attrs={"class":"form-control"}),
            "caption":forms.Textarea(attrs={"class":"form-control","rows":3})
        }
</code>```

template given to render the form.
(add_post.html)

```<code><!DOCTYPE HTML>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="container">
        <div class="row">
            <div class="col-2"></div>
            <div class="col-3">
                <form action="" method="post" enctype="multipart/form-data">
                    {%csrf_token%}
                    {{form.as_p}}
                    <input type="submit" value="Post">
                 </form>
            </div>
            <div class="col-2"></div>
          </div>
     </div>
</body>
</html>
</code>```

Body:
Error raised is here

enter code here

This is the view to addpost and inherited from CreateView.
views.py

class PostAddView(CreateView):
    template_name="add_post.html"
    form_class=PostForm
    model=AddPost
    success_url=reverse_lazy("index")
    context_object_name="posts"

models.py

class AddPost(models.Model):
    post=models.ImageField(upload_to="postimages",null=True)
    caption=models.CharField(max_length=200)
    user=models.ForeignKey(MyUser,on_delete=models.CASCADE)
    created_date=models.DateTimeField(auto_now_add=True)

Here MyUser is a abstract user

forms.py

class PostForm(forms.ModelForm):
    class Meta:
        model=AddPost
        fields=["post","caption"]

        widget={
            "post":forms.FileInput(attrs={"class":"form-control"}),
            "caption":forms.Textarea(attrs={"class":"form-control","rows":3})
        }

template given to render the form.
(add_post.html)

<!DOCTYPE HTML>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

                <form action="" method="post" enctype="multipart/form-data">
                    {%csrf_token%}
                    {{form.as_p}}
                    <input type="submit" value="Post">
                 </form>