Skip to content

Instantly share code, notes, and snippets.

@ybonnel
ybonnel / exception
Created May 2, 2013 12:59
Error in Infinitest on intellij (12.1/Windows)
Error during dispatching of java.awt.event.InvocationEvent[INVOCATION_DEFAULT,runnable=org.infinitest.EventNormalizer$1$1@1b9086c,notifier=null,catchExceptions=false,when=1367497227897] on sun.awt.windows.WToolkit@10cbe41: java.lang.reflect.InvocationTargetException
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.infinitest.EventNormalizer$1$1.run(EventNormalizer.java:142)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:682)
at java.awt.EventQueue$3.run(EventQueue.java:680)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
@Test
public void testCalcul1() {
int i;
// Compile pas, on ne peux pas faire un '++' sur un int non-initialisé.
i = i++;
System.out.println(i);
}
@Test
public void testCalcul2() {
@ybonnel
ybonnel / tree.ceylon
Created March 27, 2013 10:16
Compilation error in ceylon
abstract class Tree() {
shared formal Integer evaluate();
}
class UnaryOperator(Tree branch, Integer f(Integer t)) extends Tree() {
evaluate() => f(branch.evaluate());
}
class Constant(Integer constantValue) extends Tree() {
@ybonnel
ybonnel / gist:5238180
Created March 25, 2013 15:58
log couchbase
16:41:57.799 [qtp0-10 - /data/channel] ERROR org.mortbay.log - EXCEPTION
net.spy.memcached.OperationTimeoutException: Timeout waiting for value
at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:1015) ~[ybo-tv-server.jar:na]
at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:1030) ~[ybo-tv-server.jar:na]
at fr.ybo.services.ChannelService.getAll(ChannelService.java:22) ~[ybo-tv-server.jar:na]
at fr.ybo.services.ServiceFactory.callService(ServiceFactory.java:22) ~[ybo-tv-server.jar:na]
at fr.ybo.web.DataServer.doGet(DataServer.java:62) ~[ybo-tv-server.jar:na]
at fr.ybo.WebServer.handle(WebServer.java:32) ~[ybo-tv-server.jar:na]
at org.mortbay.jetty.handler.HandlerList.handle(HandlerList.java:49) ~[ybo-tv-server.jar:na]
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) ~[ybo-tv-server.jar:na]
@ybonnel
ybonnel / Exercice3.scala
Last active December 13, 2015 21:38
Calcul de score de bowling
package fr.ybo.battle
object Exercice3 {
def calculate(feuille:String):Int = {
// decomposition en frames
var countFrame = 0
var inFrame = false
@ybonnel
ybonnel / Exercice2.scala
Created February 18, 2013 13:43
Scalculate in scala
package fr.ybo.battle
object Exercice2 {
def specificSepRegExp = "\\[([^\\[\\]]+)]".r
def defaultSep = Seq("\n", ",")
def add(valeur:String):Int = {
@ybonnel
ybonnel / Exercice1.scala
Created February 18, 2013 10:47
Tour de Hanoi en scala
package fr.ybo.battle
class Hanoi(val pile1: Seq[Int],
val pile2: Seq[Int],
val pile3: Seq[Int],
val history: Seq[Hanoi]) {
def isFinished: Boolean = {
pile1.isEmpty && pile2.isEmpty
}
package fr.ybonnel.codestory;
import com.google.common.primitives.Longs;
import fr.ybonnel.codestory.path.jajascript.Flight;
import fr.ybonnel.codestory.path.jajascript.JajascriptService;
import org.junit.Ignore;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
@ybonnel
ybonnel / bigRequestJajascript50000.json
Created January 31, 2013 04:55
Jajascript requête avec 50 000 vols
This file has been truncated, but you can view the full file.
[{"VOL":"1","DEPART":1,"DUREE":10,"PRIX":19},{"VOL":"2","DEPART":2,"DUREE":7,"PRIX":5},{"VOL":"3","DEPART":3,"DUREE":8,"PRIX":15},{"VOL":"4","DEPART":4,"DUREE":1,"PRIX":2},{"VOL":"5","DEPART":5,"DUREE":10,"PRIX":3},{"VOL":"6","DEPART":6,"DUREE":5,"PRIX":9},{"VOL":"7","DEPART":7,"DUREE":3,"PRIX":12},{"VOL":"8","DEPART":8,"DUREE":4,"PRIX":1},{"VOL":"9","DEPART":9,"DUREE":1,"PRIX":16},{"VOL":"10","DEPART":10,"DUREE":6,"PRIX":5},{"VOL":"11","DEPART":11,"DUREE":6,"PRIX":16},{"VOL":"12","DEPART":12,"DUREE":3,"PRIX":11},{"VOL":"13","DEPART":13,"DUREE":3,"PRIX":5},{"VOL":"14","DEPART":14,"DUREE":7,"PRIX":15},{"VOL":"15","DEPART":15,"DUREE":10,"PRIX":20},{"VOL":"16","DEPART":16,"DUREE":6,"PRIX":2},{"VOL":"17","DEPART":17,"DUREE":6,"PRIX":12},{"VOL":"18","DEPART":18,"DUREE":4,"PRIX":12},{"VOL":"19","DEPART":19,"DUREE":8,"PRIX":9},{"VOL":"20","DEPART":20,"DUREE":7,"PRIX":18},{"VOL":"21","DEPART":21,"DUREE":4,"PRIX":2},{"VOL":"22","DEPART":22,"DUREE":2,"PRIX":1},{"VOL":"23","DEPART":23,"DUREE":7,"PRIX":16},{"VOL":"24","D
@ybonnel
ybonnel / Scalaskel.ceylon
Created January 31, 2013 03:42
Scalaskel en ceylon
import java.util { ArrayList }
import ceylon.collection { LinkedList }
shared class Coin(Integer coinValue) {
shared Integer valeur = coinValue;
shared Boolean canPay(Integer centsToPay) {
return centsToPay >= valeur;
}
}