Skip to content

Instantly share code, notes, and snippets.

View mathieuancelin's full-sized avatar

Mathieu ANCELIN mathieuancelin

View GitHub Profile
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css"></link>
</head>
<body>
<br/>
<a class="btn success" id="hide" href="#">Apparition</a>
<br/><br/>
<div id="image"><img class="thumbnail" src="http://placehold.it/330x230" alt=""></img></div>
package foo.bar;
import com.sun.net.httpserver.HttpExchange;
import java.net.URI;
public class MyResource implements WebServer.Resource {
public static void main(String... args) {
WebServer.create("0.0.0.0", 9000).addResource(new MyResource()).run();
}
@mathieuancelin
mathieuancelin / form 1
Created December 1, 2011 22:17
Formulaires auto générés
Mon super formulaire :
==================================
id : _______________________
==================================
nom : ______________________
==================================
prenom : ___________________
==================================
login : nom.prenom
module org.planetjdk.aggregator @ 1.0 {
requires jdom @ 1.0;
requires tagsoup @ 1.2;
requires rome @ 1.0;
requires rome-fetcher @ 1.6;
requires joda-time @ 1.6;
requires jax-p @ 1.4.4;
class org.openjdk.aggregator.Main;
}
class student {
String anme
int gradYear
double score
}
List<Student> students = ...;
double max = Double.MIN_VALUE;
for (Student s : students) {
@mathieuancelin
mathieuancelin / gist:1264396
Created October 5, 2011 13:16
JNDI lookup for BundleContext FAIL
15:15:37,060 INFO [stdout] (MSC service thread 1-4) 15:15:37.060 [MSC service thread 1-4] WARN o.j.w.e.o.i.e.s.WeldOSGiExtension - Starting Weld-OSGi extension in hybrid mode.
15:15:37,065 ERROR [stderr] (MSC service thread 1-4) javax.naming.NameNotFoundException: java:comp/BundleContext
15:15:37,065 ERROR [stderr] (MSC service thread 1-4) at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:55)
15:15:37,065 ERROR [stderr] (MSC service thread 1-4) at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:209)
15:15:37,065 ERROR [stderr] (MSC service thread 1-4) at javax.naming.InitialContext.lookup(InitialContext.java:392)
15:15:37,066 ERROR [stderr] (MSC service thread 1-4) at org.jboss.weld.environment.osgi.impl.extension.service.WeldOSGiExtension.runExtensionInHybridMode(WeldOSGiExtension.java:224)
15:15:37,066 ERROR [stderr] (MSC service thread 1-4) at org.jboss.weld.environment.osgi.impl.extension.service.WeldOSGiExtension.registerCDIOSGiServices(WeldOSGiExtension.java:216)
15:15:
import cx.ath.mancel01.osgi.simple.api.Event;
import cx.ath.mancel01.osgi.simple.api.F.Action;
import cx.ath.mancel01.osgi.simple.api.F.Callable;
import cx.ath.mancel01.osgi.simple.api.F.Function;
import cx.ath.mancel01.osgi.simple.api.F.Option;
import cx.ath.mancel01.osgi.simple.api.ListenerRegistration;
import cx.ath.mancel01.osgi.simple.api.ServiceRegistration;
import static cx.ath.mancel01.osgi.simple.api.ListenerTypes.*;
import org.junit.Test;
import org.osgi.framework.BundleContext;
@mathieuancelin
mathieuancelin / gist:1242395
Created September 26, 2011 14:46
Weld context error
16:28:50,062 GRAVE [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-1) Error Rendering View[/home.xhtml]: javax.el.ELException: /home.xhtml @14,119 rendered="#{game.number gt game.guess and game.guess ne 0}": org.jboss.weld.context.ContextNotActiveException: WELD-001303 No active contexts for scope type javax.enterprise.context.SessionScoped
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:114) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:413) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1750) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at javax.faces.render.Renderer.encodeChildren(Renderer.java:168) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
import javassist.util.proxy.MethodHandler;
import javassist.util.proxy.ProxyFactory;
import org.osgi.framework.Bundle;
public class MyProxyFactory extends ProxyFactory {
private final Bundle bundle;
public MyProxyFactory(Bundle bundle) {
this.bundle = bundle;
public class WeldListener extends AbstractServletListener
{
...
@Override
public void requestInitialized(ServletRequestEvent event)
{
String contextId = (String) event.getServletContext().getAttribute(Container.CONTEXT_ID_KEY);
...
this.requestContextCache = Container.instance(contextId).deploymentManager().instance().select(HttpRequestContext.class).get();