I want to convert this (Mon Jan 16:20:12 India Standard Time 2014) Date in string to java.util.Date in java how can I do it. I want the date in the following format. Actually the Date (Mon Jan 16:20:12 India Standard Time 2014) is argument from MFC application which will be launching a executable jar file and the date in string
Converting MultipartFile to java.io.File without copying to local machine
I have a Java Spring MVC web application. From client, through AngularJS, I am uploading a file and posting it to Controller as webservice. In my Controller, I am gettinfg it as MultipartFile and I can copy it to local machine. But I want to upload the file to Amazone S3 bucket. So I have to convert it to java.io.File.
How to configure Maven shade plugin in a multi-module project?
I have been trying to get jar using Maven Shade Plugin, but I still don’t get a success. This is my project structure: Module1 (pom.xml): Module2 (pom.xml): MainModule (pom.xml): According this code I get 2 jar-files (Module1-version.jar and Module2-version.jar). But it is not what I want. I wish to get 1 jar file (MainModule-version.jar), which would contain the other (Module1
IntelliJ IDEA 13 uses Java 1.5 despite setting to 1.7
Despite specifying JDK 1.7 in all project settings (including in File -> Project Structure -> Project :: Project SDK), the following error is produced by IntelliJ 13 when trying to compile some simple Java 7 code which does use the diamond operator: Is there any other place in the configuration where the expected -source 7 option should be enabled? Answer
Abstract class extends concrete class
I earlier learned that abstract class can extend concrete class. Though I don’t see the reason for it from JAVA designers, but it is ok. I also learned that abstract class that extends concrete class can make overriden methods abstract. Why? Can you provide with use case where it is useful? I am trying to learn design patterns and I
Apache POI – setting left/right print margin in Excel
Is that possible – with apache POI – to set left or right print margin for Excel sheet? The default margins are quite big. I cannot see neither setLeftMargin nor setRightMargin in XSSFPrintSetup, but only header and footer: Is there any kind friend that could help me a little? Answer The sheet margins are not contained in the XSSFPrintSetup object,
best ways to dynamically load config in java?
i am designing a web service in java where i need to do a sort of AB testing with requests in java. Basically I’m looking for ways to easily configure parameters which will be dynamically loaded by a request handler to determine the code path based on config values. for example, let’s say i need to get some data either
Calculate average of a huge long array
I’m trying to calculate the average of many (more than 200) long (primitive type) values stored in an array. Usually you add all the numbers and divide it by the number of the values. But this is not possible in this case since there is no primitive datatype in Java capable of holding such a large number, isn’t it? Will
Signing a jnlp in order to get rid of the Security Warning
I am developing at a company where a jnlp file is used to start a swing web based java application. It has plenty of jars that are downloaded to the client’s jvm cache. When I updated my jvm to its currently latest version (build 1.7.0_45-b18) I started seeing the security warning below when I try to run the jnlp file:
Map Reduce flow in Hadoop
I’m learning Hadoop using the book Hadoop in Practice, and while reading chapter 1 i came across this diagram: From the Hadoop docs:(http://hadoop.apache.org/docs/current2/api/org/apache/hadoop/mapred/Reducer.html) 1.Shuffle Reducer is input the grouped output of a Mapper. In the phase the framework, for each Reducer, fetches the relevant partition of the output of all the Mappers, via HTTP. 2.Sort The framework groups Reducer inputs