This is the sequence of steps to follow to create a root gh-pages
branch. It is based on a question at [SO]
cd /path/to/repo-name
git symbolic-ref HEAD refs/heads/gh-pages
rm .git/index
git clean -fdx
echo "My GitHub Page" > index.html
Conform [1] The general classifier must be an element stereotyped by Viewpoint.
Conform [2] The specific classifier must be an element that is stereotyped by View.\
Expose [1] The client must be an element stereotyped by View.\
View [1] A view must only conform to a single viewpoint.
View [2] The derived value of the viewpoint is the classifier stereotyped by Viewpoint that is the general classifier of the generalization relationship stereotyped by Conform for which the View is the specific classifier.
View [3] The derived values of the stakeholder attribute are the names of the classifiers stereotyped by Stakeholder that are the values of the stakeholder attribute of the general classifier of the generalization relationship stereotyped by Conform for which the View is the specific classifier.\
Viewpoint [1] The derived values of the method attribute are the names of the methods of the operations stereotyped by the UML Create stereotype on the classifier stereotyped by Viewpoint.\
import java.util.Arrays; | |
import java.util.Collection; | |
import org.eclipse.emf.common.util.Diagnostic; | |
import org.eclipse.emf.common.util.URI; | |
import org.eclipse.emf.ecore.resource.Resource; | |
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; | |
import org.eclipse.emf.ecore.util.Diagnostician; | |
import org.junit.Assert; | |
import org.junit.Test; |
/** | |
* On an online test the recursive method exited with | |
* java.lang.StackOverflowError | |
* | |
* I suppose that the while should have worked better | |
* but my local test only exit with java.lang.OutOfMemoryError: GC overhead limit exceeded for both implem | |
* | |
* TODO: limit jvm parameters to get the StackOverflowError | |
* | |
*/ |
// floating addition/multiplication are commutative but not associative with big numbers | |
val small = 1e-200 | |
val big = 1e200 | |
val invBig = -big | |
(big +invBig)+small // Double = 1.0E-200 | |
big+(invBig+small) // Double = 0.0 | |
List(big,invBig,small).reduceLeft(_+_) // Double = 1.0E-200 | |
List(big,invBig,small).reduceRight(_+_) // Double = 0.0 |
case class A() | |
case class B() | |
val b1 = B() | |
val b2 = B() | |
val sB = Seq[B](b1,b2) | |
sB match { | |
case _:Seq[A] => println("niet") | |
case _:Seq[B] => println("da") |
import org.json4s.FieldSerializer._ | |
import org.json4s.jackson.Serialization | |
import org.json4s.{DefaultFormats, FieldSerializer} | |
case class Data(id: Int) | |
implicit val format = new DefaultFormats {} + FieldSerializer[Data]( | |
renameTo("id", "@id"), | |
renameFrom("@id","id") | |
) |
import java.text.DateFormat; | |
import java.text.ParseException; | |
import java.text.SimpleDateFormat; | |
import java.time.Duration; | |
import java.util.Date; | |
import java.util.TimeZone; | |
class TimeChange { | |
public static void main(String[] args) throws ParseException { | |
timeForward("Europe/Paris", "2019-03-31 01:59:59", Duration.ofSeconds(2).toMillis()); // FRANCE +1 |
import java.time.LocalDate; | |
import java.time.LocalDateTime; | |
import java.util.Random; | |
import java.util.UUID; | |
import java.util.concurrent.ThreadLocalRandom; | |
import java.time.Instant; | |
class JavaRandom { | |
public static void main(String[] args) { |
import java.util.Optional; | |
public class FunIsOptional { | |
public static void main(String[] args) { | |
Integer i = 0; | |
System.out.println(Optional.of(i).map(v -> v++).orElse(i--)); | |
// => res = 0 (orElse is evaluated even when not empty) | |
} |