Skip to content
Advertisement

Tag: java

CSV file from HDFS to Oracle BLOB using Spark

I’m working on Java app that uses Spark 2.3.1 to load data from Oracle to HDFS and vice versa. I want to create CSV file in HDFS and then load it to Oracle (12.2) BLOB. The code.. I’m new to Spark.. so any ideas please how to convert JavaRDD to BufferedInputStream, or get rid of mess above and put Dataset

How do I read multiple CSV files to sort data in Java?

So, my Java project has two CSV files that needs to read and print some sort the data from high to low. First CSV file has date, location, new_cases, new_deaths, total_cases, total_deaths format. Second CSV file has Country, location, continent, population_year, population format. What I’m trying to do is to read both data, run a function to calculate continent data,

How to convert 100 into ONE ZERO ZERO not ONE?

I have to call a method which is converting number to words and two others methods which are reversing and getting count of entered number and have to call both in first method but in case of number 100 it is giving output as ONE but it should give ONE ZERO ZERO.So my confusion is how to call count method

Set CameraX image capture File path

I set the File path to the following: File file = new File(Environment.getExternalStorageDirectory() + “/” + System.currentTimeMillis() + “.png”); But for some reason when i click on the capture image button, it jumps into the onError and logs the following: onError: androidx.camera.core.ImageCaptureException: Failed to write or close the file Answer Your app needs permission to write to the desired location.

Best practice for Unit Testing class which is mostly responsible to call methods of dependencies, but contains logic as well

Let’s assume I have StartCommandHandler which has responsibility to create some file with required files. But for doing this I have to give him a set of sub-responsibilities, like: Checks whether file exists in the FTP If Not downloads files from multiple sources to the temp folder Then executes some script in the folder Then read generated file after script

Dynamically add chips to chipgroup

I’m trying to add several chips to the chip group dynamically. The first one appears fine but others do not appear properly. But when I do it using XML it works fine. activity_main.xml In MainActivity.java style.xml standalone_chip.xml Answer In your main activity you are doing like this. Notice you are creating a new instance of chip i.e chip2 but you

SpringBoot DTO Validation

I am new to spring-boot I’m trying to add validation to my DTO class like below. Below is my REST endpoint to save employee. I create a Validation class like below to validate the DTO fields. expected output is { “firstName”:”Employee first name is required”, “employeeNum”:”EmployeeNUM is required” } But I’m getting only the 400 bad request when hit the

Advertisement