How can I calculate the difference of two dates via Period class?

I have two dates : LocalDateTime start = LocalDateTime.of(2014,2,19,12,02,41,112); LocalDateTime end = LocalDateTime.of(2014,2,19,12,05,58,146); And I need to obtain two difference between start and end. So, I should receive : 3:17.034 ( 3 minutes, 17 seconds and 34 milliseconds ). Is it possible to calculate the difference via class Period ? I am confused because when…

Details

How to pass a List to a constructor of a new object using java lambda expression?

I have a problem where I want to convert a list of POJOs into DTOs and pass them into a wrapper object which is then returned. Consider this working piece of code: List<Device> devices = dbService.getDevices(…); List<DeviceDTO> devicesDTO = new ArrayList<DeviceDTO>(); for (Device d : devices) { devicesDTO.add(convertToDTO(d)); } WrapperDTO wrapper = new WrapperDTO(devicesDTO); I…

Details

How to reduce the size of an image when uploading it to a project

I need help to reduce the size of an image. I know that it is necessary to resize() but I do not understand where to insert it. Controller: $target_file_name = public_path().’/upload/’.Str::random(10); $type = $_FILES[“image2”][“type”]; $type = stristr($type, ‘/’); $type = substr($type, 1); $response = array(); move_uploaded_file($_FILES[“image2”][“tmp_name”], $target_file_name.’.’.$type); $dopysk->ydostak =basename($request=$target_file_name.’.’.$type );

Details