This file contains 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
clone the project | |
git remote rename origin upstream | |
git remote add origin <your own project> | |
use git desktop push upstream | |
`upstream` for fetch & pull | |
`origin` for push |
This file contains 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
https://stackoverflow.com/questions/18618779/differences-between-proxy-and-decorator-pattern |
This file contains 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
### Local Configuration Files ### | |
fookeeper-local.json | |
### System Files ### | |
.DS_Store | |
### Managed Files ### | |
target/ | |
.terraform/ |
This file contains 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
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : | |
1. Create new ConcurrentHashMap and put 1000 entries to it, with keys=1,2,3,...,1000 and all values=0. | |
2. Start 2 parallel threads: | |
- First thread: for i=1,2,3,...,1000 puts an entry (k=i, v=1) into the map; | |
- Second thread: removes all `0` from the map: `map.entrySet().removeIf(e -> e.getValue() == 0)`. | |
3. Check size of the map. | |
EXPECTED VERSUS ACTUAL BEHAVIOR : | |
EXPECTED - |
This file contains 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
private String getFileWithUtil(String fileName) { | |
String result = ""; | |
ClassLoader classLoader = getClass().getClassLoader(); | |
try { | |
result = IOUtils.toString(classLoader.getResourceAsStream(fileName)); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} |
This file contains 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
To adhere to guidelines or requirements, API designers may want to control how JSON/XML responses are formatted. Spring Web makes use of Jackson to perform JSON/XML serialization. Therefore, to customize our output format, we must configure the Jackson processor. Spring Web offers XML-based or Java-based approaches to handling configuration. In this article, we will look at the Java-based configuration. | |
Enable XML output | |
First of all, if you have created your project through https://start.spring.io/ you need add the following dependency to your project because there is no XML serialization by default: | |
<dependency> | |
<groupId>com.fasterxml.jackson.dataformat</groupId> | |
<artifactId>jackson-dataformat-xml</artifactId> | |
</dependency> | |
ok, now we can investigate the output customization process. Imagine we have this REST controller: |
This file contains 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
/** | |
* Recursively compare the contents of the directory of downloaded | |
* files with the contents of the "ground truth" directory. | |
*/ | |
public static void recursivelyCompareDirectories(File expected, | |
File generated) | |
throws IOException { | |
// Checks parameters. | |
assertTrue("Generated Folder doesn't exist: " + generated, | |
generated.exists()); |
This file contains 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 com.dealer.modules.cms.promotions.factory; | |
import java.util.AbstractMap; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.Locale; | |
import java.util.Map; | |
import static java.util.stream.Collectors.toList; | |
import static java.util.stream.Collectors.toMap; |
This file contains 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 edu.vanderbilt.platform; | |
import java.util.concurrent.CancellationException; | |
import edu.vanderbilt.utils.Crawler; | |
import edu.vanderbilt.utils.Options; | |
/** | |
* A container singleton class that provides access to the platform | |
* dependent objects Platform, Options, and Crawler. This singleton |
This file contains 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 edu.vanderbilt.utils; | |
import edu.vanderbilt.platform.PlatformOptions; | |
/** | |
* Immutable data class containing all crawling options. | |
*/ | |
public class Options implements PlatformOptions { | |
public static String DEFAULT_WEB_URL = "http://www.dre.vanderbilt.edu/~schmidt/imgs"; | |
public static String DEFAULT_DOWNLOAD_DIR_NAME = "downloaded-images"; |
NewerOlder