Skip to content

Instantly share code, notes, and snippets.

View vongohren's full-sized avatar
⛓️

Snorre Lothar von Gohren Edwin vongohren

⛓️
View GitHub Profile
@vongohren
vongohren / gist:7321523
Created November 5, 2013 16:16
ManagedServiceFactory
package ntnu.opcua.client.service.impl;
import java.util.Dictionary;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import ntnu.opcua.client.api.OPCUAClientAPI;
import org.osgi.framework.BundleContext;
@vongohren
vongohren / gist:7321535
Created November 5, 2013 16:17
Current NullPointerException
!ENTRY org.apache.felix.fileinstall 4 0 2013-11-05 17:04:41.357
!MESSAGE Failed to install artifact: C:\Prosjekter\ReactiveBlocksMaster\config\org_apache_felix_cm_impl_DynamicBindings.config
!STACK 0
java.lang.NullPointerException
at org.apache.felix.cm.impl.helper.TargetedPID.<init>(TargetedPID.java:83)
at org.apache.felix.cm.impl.ConfigurationBase.<init>(ConfigurationBase.java:59)
at org.apache.felix.cm.impl.ConfigurationImpl.<init>(ConfigurationImpl.java:147)
at org.apache.felix.cm.impl.ConfigurationManager.getConfiguration(ConfigurationManager.java:598)
at org.apache.felix.cm.impl.ConfigurationAdminImpl.getConfiguration(ConfigurationAdminImpl.java:159)
at org.apache.felix.fileinstall.internal.ConfigInstaller.getConfiguration(ConfigInstaller.java:337)
@vongohren
vongohren / gist:7321546
Created November 5, 2013 16:17
example of a service.cfg file.
service.pid=ntnu.opcua.hardware.viperwim
hardware=viperWIM
@vongohren
vongohren / gist:7691718
Created November 28, 2013 13:19
OBJECT TYPE
fartSensorObjectFolder = new FolderType(fartSensorNodeManager, fartSensorObjectId, "FartSensorObject", Locale.ENGLISH);
//FOLDER FOR MY FARTSENSOR
fartSensorNodeManager.addNodeAndReference(objectsFolder, fartSensorObjectFolder, Identifiers.Organizes);
//FART SENSOR DEVEICE TYPE
final NodeId fartSensorTypeId = new NodeId(ns, "FartSensorType");
UaObjectType fartSensorType = new UaObjectTypeNode(fartSensorNodeManager, fartSensorTypeId, "FartSensorType", Locale.ENGLISH);
fartSensorNodeManager.addNodeAndReference(baseObjectsType, fartSensorType, Identifiers.HasSubtype);
@vongohren
vongohren / gist:7845460
Created December 7, 2013 17:07
My DS component.xml
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="ModelFartSensorDriver">
<implementation class="model.fartsensor.ModelFartSensor"/>
<reference bind="setServerApi" cardinality="1..1" interface="ntnu.opcua.server.api.ServerApi" name="ServerApi" policy="static" unbind="unsetServerApi"/>
<reference bind="setFartSensor" cardinality="1..1" interface="hardware.driver.api.HardwareAPI" name="HardwareAPI" policy="static" target="(hardware=fartsensor)" unbind="unsetFartSensor"/>
<service>
<provide interface="org.osgi.service.event.EventHandler"/>
</service>
<property name="event.topics" value="ntnu/opcua/server/STARTED"/>
<reference bind="setNameSpaceController" cardinality="1..1" interface="ntnu.opcua.namespace.controller.api.NameSpaceControllerAPI" name="NameSpaceControllerAPI" policy="static" unbind="unsetNameSpaceController"/>
</scr:component>
using System.Web.Mvc;
namespace BEKK_Radar.Web.Helpers.CustomFilters
{
public class CorsActionFilter : ActionFilterAttribute, IActionFilter
{
void IActionFilter.OnActionExecuting(ActionExecutingContext context)
{
if (context.HttpContext.Request.RequestType.Equals("POST")) return;
context.HttpContext.Response.AddHeader("Access-Control-Allow-Origin","*");
initTokens: function() {
var _this = this;
_(this.splitAndTrim(this.$originalInput.val())).each(function(token) {
_this.tokens.add(token);
});
},
componentDidMount: function() {
console.log(this.getDOMNode());
Highcharts.setOptions({
global: {
timezoneOffset: -1*60
}
})
var that = this;
var name = this.props.name;
var valueUpdated = function(snapshot) {
var name = this.props.name;
if(chart) {
var series = chart.series[0];
var x = Date.now();
series.addPoint([x, snapshot.val().watervalue], true, true)
}
}
@vongohren
vongohren / gist:4208f50b7c55c7b33ae8
Created February 3, 2015 10:09
selve chart optiosn
exports.createPlot = function(container, data, name) {
return chart1 = new Highcharts.Chart({
chart: {
renderTo: container,
zoomType: 'x'
},
title: {
text: name.charAt(0).toUpperCase() + name.substring(1)+'´s Moisture levels'
},
subtitle: {