Converting File to MultiPartFile

MockMultipartFile exists for this purpose. As in your snippet if the file path is known, the below code works for me. import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import org.springframework.mock.web.MockMultipartFile; Path path = Paths.get(“/path/to/the/file.txt”); String name = “file.txt”; String originalFileName = “file.txt”; String contentType = “text/plain”; byte[] content = null; try { content = Files.readAllBytes(path); } … Read more

Disabling Warnings generated via _CRT_SECURE_NO_DEPRECATE

If you don’t want to pollute your source code (after all this warning presents only with Microsoft compiler), add _CRT_SECURE_NO_WARNINGS symbol to your project settings via “Project”->”Properties”->”Configuration properties”->”C/C++”->”Preprocessor”->”Preprocessor definitions”. Also you can define it just before you include a header file which generates this warning. You should add something like this #ifdef _MSC_VER #define _CRT_SECURE_NO_WARNINGS … Read more

How are environment variables used in Jenkins with Windows Batch Command?

I know nothing about Jenkins, but it looks like you are trying to access environment variables using some form of unix syntax – that won’t work. If the name of the variable is WORKSPACE, then the value is expanded in Windows batch using %WORKSPACE%. That form of expansion is performed at parse time. For example, … Read more

How to update GCC in MinGW on Windows?

Update using terminal: Run the command prompt/terminal (cmd or sh). Update the package list: mingw-get update After updating the package list, run: mingw-get upgrade When the command finishes running, all of your packages will be upgraded. Update using the GUI version: If you aren’t used to the terminal, there is also a GUI version of … Read more

Is there any way to get the column name along with the output while execute any query in Hive?

If we want to see the columns names of the table in HiveQl, the following hive conf property should be set to true. hive> set hive.cli.print.header=true; If you prefer to see the column names always then update the $HOME/.hiverc file with the above setting in the first line.. –Hive automatically looks for a file named … Read more

Is deriving square from rectangle a violation of Liskov’s Substitution Principle? [closed]

The answer depends on mutability. If your rectangle and square classes are immutable, then Square is really a subtype of Rectangle and it’s perfectly OK to derive first from second. Otherwise, Rectangle and Square could both expose an IRectangle with no mutators, but deriving one from the other is wrong since neither type is properly … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)