Skip to content

Instantly share code, notes, and snippets.

View gidili's full-sized avatar
🐢
Probably eating pizza 🍕

Giovanni Idili gidili

🐢
Probably eating pizza 🍕
View GitHub Profile
@gidili
gidili / error
Created May 2, 2017 15:34
model.neuroml error
[2017-05-02 16:31:49.562] ERROR http-bio-8080-exec-7 org.apache.coyote.http11.Http11Protocol Error reading request, ignored java.lang.NullPointerException: null
at org.geppetto.model.neuroml.modelInterpreterUtils.PopulateTypes.extractInfoFromComponent(PopulateTypes.java:265)
at org.geppetto.model.neuroml.modelInterpreterUtils.PopulateTypes.createPopulationTypeVariable(PopulateTypes.java:439)
at org.geppetto.model.neuroml.modelInterpreterUtils.PopulateTypes.extractInfoFromComponent(PopulateTypes.java:151)
at org.geppetto.model.neuroml.modelInterpreterUtils.PopulateTypes.extractInfoFromComponent(PopulateTypes.java:82)
at org.geppetto.model.neuroml.services.NeuroMLModelInterpreterService.extractTypes(NeuroMLModelInterpreterService.java:214)
at org.geppetto.model.neuroml.services.LEMSModelInterpreterService.importType(LEMSModelInterpreterService.java:102)
at org.geppetto.simulation.visitor.ImportTypesVisitor.caseImportType(ImportTypesVisitor.java:93)
at org.geppetto.model
@gidili
gidili / popup-button-bar-congif.js
Created December 14, 2016 11:46
popup-button-bar-congif
var buttonBarConfiguration={
"Events" : ["color:set","experiment:selection_changed","experiment:visibility_changed"],
"filter" : function(instance){
return instance.getParent()
},
"VisualCapability": {
"select": {
"id": "select",
"condition": "GEPPETTO.SceneController.isSelected($instance$.$instance$_obj != undefined ? [$instance$.$instance$_obj] : []) || GEPPETTO.SceneController.isSelected($instance$.$instance$_swc != undefined ? [$instance$.$instance$_swc] : [])",
"false": {
@gidili
gidili / createStandaloneChildren.java
Created October 5, 2015 08:57
pull properties from neuroml
public Collection<ANode> createStandaloneChildren(Standalone standaloneComponent)
{
Collection<ANode> standaloneChildren = new ArrayList<ANode>();
standaloneChildren.addAll(createBaseChildren(standaloneComponent));
// TODO: Improve to parse all the attribute in an annotation
Annotation annotation = standaloneComponent.getAnnotation();
if(annotation != null)
{
@gidili
gidili / web.xml
Created August 18, 2015 13:39
Geppetto web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>org.geppetto.frontend</display-name>
<context-param>
<param-name>contextClass</param-name>
define(function(require) {
THREE.WebGLRenderer = function ( parameters ) {
console.log('THREE.WormWebGLRenderer');
parameters = parameters || {};
var _canvas = parameters.canvas !== undefined ? parameters.canvas : document.createElement( 'canvas' ),
_context = parameters.context !== undefined ? parameters.context : null,
@gidili
gidili / theme.js
Created July 24, 2015 09:04
apply theme
function rgb2hex(rgb) {
rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
}
function hex(x) {
return isNaN(x) ? "00" : hexDigits[(x - x % 16) / 16] + hexDigits[x % 16];
}
var hexDigits = new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");
@gidili
gidili / getIntersectedObjects.js
Created July 22, 2015 09:33
modification to selection logic
/**
* Set up the listeners use to detect mouse movement and windoe resizing
*/
var setupListeners = function() {
if(!VARS.listenersCreated){
// when the mouse moves, call the given function
VARS.renderer.domElement.addEventListener('mousedown', function(event) {
var intersects = GEPPETTO.getIntersectedObjects();
if ( intersects.length > 0 ) {
@gidili
gidili / components.js
Created July 9, 2015 11:18
wormsim components
define(function(require) {
require('jsx!./dev/customrenderer/AnimationCustomRenderer');
require('jsx!./dev/wormsimlogo/wormsimLogo');
//require('jsx!./dev/save/SaveControl');
//require('jsx!./dev/home/HomeControl');
require('jsx!./dev/wormsimsimulationcontrols/ExperimentControls');
//require('jsx!./dev/simulationcontrols/ExperimentControls');
require('jsx!./dev/cameracontrols/CameraControls');
//require('jsx!./dev/tutorial/IntroModal');
//require('jsx!./dev/logo/logo');
@gidili
gidili / snippets.java
Created June 27, 2015 12:00
snippets to save
private void init(GeppettoModel geppettoModel)
{
this.clearWatchLists();
// retrieve model interpreters and simulators
CreateModelInterpreterServicesVisitor createServicesVisitor = new CreateModelInterpreterServicesVisitor(modelInterpreters, geppettoManagerCallbackListener);
geppettoModel.accept(createServicesVisitor);
LoadSimulationVisitor loadSimulationVisitor = new LoadSimulationVisitor(modelInterpreters, instancePathToIModelMap, geppettoManagerCallbackListener);
geppettoModel.accept(loadSimulationVisitor);
// Resize canvas when the user manually resizes window
window.addEventListener('resize', function () {
var width = $container.width();
var height = $container.height();
camera.aspect = (width) / (height);
camera.updateProjectionMatrix();