This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package in.javadigest.encryption; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileNotFoundException; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.io.ObjectInputStream; | |
import java.io.ObjectOutputStream; | |
import java.security.KeyPair; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Foobar{ | |
public static void doSomething(){ | |
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); | |
System.out.print("Enter String"); | |
String s = br.readLine(); | |
System.out.print("Enter Integer:"); | |
try{ | |
int i = Integer.parseInt(br.readLine()); | |
}catch(NumberFormatException nfe){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class IOUtils | |
public ByteArrayOutputStream readBytes(InputStream is) throws IOException{ | |
ByteArrayOutputStream baos = new ByteArrayOutputStream(); | |
int nRead; | |
byte[] data = new byte[1024 * 16]; | |
while ((nRead = is.read(data, 0, data.length)) != -1) { | |
baos.write(data, 0, nRead); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.io.PrintWriter; | |
import java.lang.reflect.Method; | |
import java.util.HashMap; | |
import java.util.Map; | |
import javax.servlet.GenericServlet; | |
import javax.servlet.ServletException; | |
import javax.servlet.ServletRequest; | |
import javax.servlet.ServletResponse; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Participant implements Serializable{ | |
// ... | |
private Date date; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.context.annotation.Configuration; | |
import org.springframework.data.rest.webmvc.RepositoryRestMvcConfiguration; | |
// @Configuration | |
public class RestConfig extends RepositoryRestMvcConfiguration { | |
public RestConfig() { | |
System.out.println("Rest Config"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.servlet.ServletConfig; | |
import javax.servlet.ServletContext; | |
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; | |
import org.springframework.context.ApplicationContext; | |
import org.springframework.context.support.AbstractRefreshableConfigApplicationContext; | |
import org.springframework.core.env.ConfigurableEnvironment; | |
import org.springframework.core.io.Resource; | |
import org.springframework.core.io.support.ResourcePatternResolver; | |
import org.springframework.ui.context.Theme; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# stashed in src/main/resources | |
hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect | |
hibernate.ejb.naming_strategy=org.hibernate.cfg.ImprovedNamingStrategy | |
hibernate.connection.charSet=UTF-8 | |
hibernate.export.schema.delimiter=; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./redis/bin/redis-server | |
# new tab | |
./xd/bin/xd-singlenode | |
# another window | |
# To view redis info: ./redis/bin/redis-cli | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ApiDocExample{ | |
@Inject | |
private RequestMappingHandlerMapping mapping; | |
public void foobar(){ | |
Map<RequestMappingInfo, HandlerMethod> map = mapping.getHandlerMethods(); | |
for( RequestMappingInfo info : map.keySet() ){ | |
HandlerMethod method = map.get(info); | |
ApiOperation annotation = method.getMethodAnnotation(ApiOperation.class); |