android – Why is it taking too long to take the picture?

I use OCR (Optical Character Recognition) from Google for text recognition. When I take the picture with the camera, it takes about 7 seconds to crop it on the screen. If you click the button to capture the image, a circular progress bar will appear at the time of the capture. why it takes too long to capture and lock the progress bar.

Follow code

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_detector_text, container, false);

    captureImage = view.findViewById(R.id.imageCapture);

    viewRect = view.findViewById(R.id.view);

    textureView = view.findViewById(R.id.surfaceView);

    txtText = view.findViewById(R.id.textView);

    btCapture = view.findViewById(R.id.btnCapture);
    btnProgCapture = view.findViewById(R.id.btnProgress);


    permissao();

    createCameraSource();

    btCapture.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            clikImage();

            btCapture.setVisibility(View.INVISIBLE);

            btnProgCapture.setVisibility(View.VISIBLE);

        }
    });


    return view;

}

private void cameraFocus(boolean autoFocus) {


    cameraSource = new CameraSource.Builder(getContext(), textRecognizer)
            .setFacing(CameraSource.CAMERA_FACING_BACK)
            .setRequestedPreviewSize(1000,780)
            .setFocusMode(autoFocus ? Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE : null)
            .setFocusMode(autoFocus ? Camera.Parameters.FOCUS_MODE_AUTO:null)
            .setAutoFocusEnabled(true)
            .build();


}

private void createCameraSource() {


    textRecognizer = new TextRecognizer.Builder(getContext()).build();

    if (!textRecognizer.isOperational()) {

        Toast.makeText(getContext(), "Reconhecimento de texto não esta funcionando", Toast.LENGTH_LONG).show();

    }

    cameraFocus(true);


    textureView.getHolder().addCallback(new SurfaceHolder.Callback() {
        @Override
        public void surfaceCreated(SurfaceHolder holder) {
            try {
                cameraSource.start(textureView.getHolder());
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }

        @Override
        public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {

        }

        @Override
        public void surfaceDestroyed(SurfaceHolder holder) {

            cameraSource.stop();

        }
    });

    textRecognizer.setProcessor(new Detector.Processor() {
        @Override
        public void release() {

        }

        @Override
        public void receiveDetections(Detector.Detections detections) {

            final SparseArray items = detections.getDetectedItems();
            if (items.size() != 0) {

                txtText.post(new Runnable() {
                    @Override
                    public void run() {

                        StringBuilder value = new StringBuilder();
                        for (int i = 0; i < items.size(); ++i) {

                            TextBlock item = items.valueAt(i);
                            value.append(item.getValue());
                            value.append("n");

                        }



                    }
                });

            }

        }
    });


}

private void getTextRecogFrame(){

    final TextRecognizer textRecognizer2 = new TextRecognizer.Builder(getContext()).build();

    if (!textRecognizer2.isOperational()){
        Toast.makeText(getContext(), "error", Toast.LENGTH_SHORT).show();
    }else {

        textRecognizer.setProcessor(new Detector.Processor() {
            @Override
            public void release() {

            }

            @Override
            public void receiveDetections(Detector.Detections detections) {


                Frame frame = new Frame.Builder().setBitmap(croop).build();

                final SparseArray items = textRecognizer2.detect(frame);
                if (items.size() != 0) {

                    txtText.post(new Runnable() {
                        @Override
                        public void run() {

                            StringBuilder value = new StringBuilder();
                            for (int i = 0; i < items.size(); ++i) {

                                TextBlock item = items.valueAt(i);
                                value.append(item.getValue());
                                value.append("n");

                            }

                            txtText.setText(value.toString());


                        }
                    });

                }

            }
        });
    }

}

private void clikImage(){

    if (cameraSource != null) {

        cameraSource.takePicture(new CameraSource.ShutterCallback() {
            @Override
            public void onShutter() {

                btnProgCapture.setVisibility(View.VISIBLE);
            }
        }, new CameraSource.PictureCallback() {
            @Override
            public void onPictureTaken(byte() bytes) {
                Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);

                Display display = ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();

                if (display.getRotation() == Surface.ROTATION_0) {

                    Matrix matrix = new Matrix();
                    matrix.postRotate(90);
                    Bitmap rotadeBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);

                    float koefX = (float) rotadeBitmap.getWidth() / (float) textureView.getWidth();
                    float koefY = (float) rotadeBitmap.getHeight() / textureView.getHeight();

                    int x1 = viewRect.getLeft();
                    int y1 = viewRect.getTop();

                    int x2 = viewRect.getWidth();
                    int y2 = viewRect.getHeight();

                    int cropStarX = Math.round(x1 * koefX);
                    int cropStarY = Math.round(y1 * koefY);

                    int cropWidthX = Math.round(x2 * koefX);
                    int cropHeightY = Math.round(y2 * koefY);

                    if (cropStarX + cropWidthX <= rotadeBitmap.getWidth() && cropStarY + cropHeightY <= rotadeBitmap.getHeight()) {

                        croop = Bitmap.createBitmap(rotadeBitmap, cropStarX, cropStarY, cropWidthX, cropHeightY);
                        captureImage.setImageBitmap(croop);
                    }
                }

                getTextRecogFrame();

            }
        });

    }
}

Really long list in a modal – set the height of the list and make it scrollable?

Yes – your idea sounds good.
Scroll.

I am not sure whether it is appropriate to place such a list in the modal.

Perhaps the product search system should be revised and reduced to the minimum necessary for the user?

Also look at the items in the list – maybe someone should create an architecture of the category for them – with that card sorting Method (for example).
I mean, there are a lot of items that can be categorized energy (Energy storage (…), – while in energy Category it can be one battery Subcategory (level II) (chargers, battery accessories).

This approach offers many potential benefits in the long term after implementation (filtering – sorting by category, etc.).

Enter image description here

calculated column formula – SharePoint If Statement Long

OR itself is a function, see here.

for example, =IF(OR((thing1)=(thing2),(thing3)=(thing4),(thing5)=(thing6)), "ValueToShowIfAtLeastOneOfThoseAreTrue", "ValueToShowIfNoneAreTrue"))

Basically that is OR The function takes up to 30 different Boolean statement parameters and returns them TRUE if one or more of these statements TRUEand returns FALSE if none of the statements is TRUE, (There is a similar one AND() Function that only returns TRUE if all statements are TRUE,

You can also nest IF statements. So the first parameter is your Boolean parameter (which can itself be an OR or AND operation or another Boolean function) TRUEand the third parameter is what to return if this is the first parameter FALSE, and this third parameter can also be a nested IF to evaluate whether the first was present FALSE, and so on.

Based on your comment, the following example is the OR This feature may be more like what you want to do.

=IF(OR((DeptID)=101,(DeptID)=102,(DeptID)=103),"Bob", IF(OR((DeptID)=211,(DeptID)=212,(DeptID)=213), "TOD", IF(OR((DeptID)=641,(DeptID)=642,(DeptID)=643), "Sara", "Unknown")))

Also note that if your department IDs are numeric and sequential, use more or less than the same, e.g. B. IF (AND ((DeptID)> = 101, (DeptID) <= 103), "Bob" etc. However, this only works if all departments belonging to one person are arranged in order.

This is an old article, but still a good place to start learning SharePoint formulas: https://support.office.com/en-us/article/examples-of-common-formulas-in-sharepoint-lists- d81f5f21-2b4e -45ce-b170-bf7ebf6988b3

Mathematica provides unprocessable long solutions to two simple quadratic equations

I tried to get a positive solution (or any solution) to the following two quadratic equations with two variables. My code was:

Solve((1/8)(-A1+x2+α+x1(-2+β)-2βx2^2-θx1^2==0 && (1/16)(A1+3x2-α-2βx2+x1(-2+3β))^2-θx2^2==0, {x1, x2})

It shows that there is a big issue, then I clicked Show Fulloutput, it took 5 minutes to show … and the result is in strange format, there is only one icon on each line in the last part, and it is very difficult to identify, I can't even find where x2 appears

SQL Server – Why should a SET TRANSACTION command display a long duration when the CPU is low?

I was instructed to troubleshoot a customer's SQL Server 2016 Enterprise Edition performance issue and received a SQL Profiler trace that was collected during a period of "poor" performance. One of my observations is that apparently harmless statements like SET TRANSACTION ISOLATION register a duration of the order of seconds.

Enter image description here
In the image above, the StmtCompleted event specifies a duration and a CPU of 0 milliseconds, while the BatchCompleted event specifies a duration of 1907 ms (I translated the duration of the profiler into milliseconds by dividing it by 1000). Why should there be such a drastic gap in the length reported by the BatchCompleted event and the StmntCompleted event? The BatchCompleted event also reports a CPU of 15 ms, but not the StmtCompleted event. Why should sending an ACK back to the client take so much CPU or time? There are other statements that report a high duration for the BatchCompleted event, with the StmtCompleted event reporting almost 0 ms. There are sp_reset_connection events that indicate a CPU = 0 ms but a long duration on the order of seconds. The same applies to BEGIN TRANS, COMMIT TRANS, SCOPE_IDENTITY, etc. To complicate matters, there are many instances of the same commands that were executed in the same period of time within an acceptable period of a few milliseconds. I am at a loss to find an explanation. I wonder if the stack exchange community can find a plausible explanation for this. The customer swears that the CPU and network usage reported at the operating system level were normal, but admits that the disk usage appears to be higher than usual. However, most of the commands above should not be affected by disk activity.

The site does not carry out continuous monitoring. You run a profiler trace if you feel that the SQL Server is "slow". Waiting statistics are also not recorded and regularly restart the computer.

I suggest that the customer snapshot wait statistics be displayed in addition to a profiler trace. I hope that a very high "ASYNC NETWORK IO" wait will appear :). Should I request another type of surveillance? Any help appreciated.

Use string vs hash code to store long strings

Let's say I have 2 tables, company (Id, Name, AddressId) and addresses (Line1, Line2 etc …)

Now I have to check whether a company exists or not so that I can search the database with the following parameters:

(Name + address) .UpperCase.Trim // pseudocode

Now I want to simplify the search and am thinking about creating a new table with the following parameters

NewTable (BunsinessNameWithAddressColumn, AddressId, BusinessId)

I have following questions

  • What should be the limit for BusienssNameWithAddressColumn
  • Should I use a hash code or a checksum instead of the full text for the search?

How long did it take to reach the top page rank on Google?

How long did it take to reach the top page rank on Google? My website has to do with laptop repairing services in Pune. I have been working for 2 months but do not get the first page rank. please help