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
mvn clean package tomcat7:redeploy -Dtomcat.url=http://your-url:portnumberhere/manager/text -Dtomcat.user=your-user -Dtomcat.password=your-password |
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
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Optional; | |
public class SafelyAvoidingNull { | |
public static void main(String[] args) { | |
List<String> strings = null; | |
int initialSize = Optional.ofNullable(strings).orElse(new ArrayList<String>()).size(); | |
System.out.println(initialSize); | |
} |
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
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.Optional; | |
import java.util.stream.Collectors; | |
public class Optionalizable { | |
public static Optional<Integer> getMaxLengthFrom(List<String> stringList) { |
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
@Override | |
public String toString() { | |
return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); | |
} |
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
installed.packages(lib.loc = NULL, priority = NULL, | |
+ noCache = FALSE, fields = NULL, | |
+ subarch = .Platform$r_arch) |
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
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-surefire-plugin</artifactId> | |
<version>2.7.1</version> | |
<configuration> | |
<parallel>classes</parallel> | |
<threadCount>5</threadCount> | |
</configuration> |
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
<!-- At this time junit 4.12 is available but there is a bug with it in regard to running Junit tests in Eclipse with the run contextual menu option --> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>org.lompo.banking</groupId> | |
<artifactId>playground</artifactId> | |
<packaging>jar</packaging> | |
<version>1.0-SNAPSHOT</version> | |
<name>playground</name> | |
<url>http://maven.apache.org</url> |
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 org.lompo.banking.utils.maths; | |
import static org.junit.Assert.assertEquals; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.mockito.Mockito; | |
import org.powermock.api.mockito.PowerMockito; | |
import org.powermock.core.classloader.annotations.PrepareForTest; | |
import org.powermock.modules.junit4.PowerMockRunner; |
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 org.lompo.banking.utils.maths; | |
public class BasicMaths { | |
private BasicMaths() {} | |
public static double PI_I() { | |
return 22.0/7.0; | |
} | |
public static double PI_II() { |
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
# applying the filterings on a data set called agadez | |
# filtering by the pm25tmean2 column and retaining the values that are greater and 30 | |
moreThan30PM25 <- filter(agadez, pm25tmean2 > 30) | |
# get summary stats | |
summary(moreThan30PM25$pm25tmean2) | |
# Adding the temperature condition to the filter | |
moreThan30PM25And80DegF <- filter(agadez, pm25tmean2 > 30 & tmpd > 80) |