text:
/*
	TCP Client handling
	this also does UnixSocket connections too
*/

package cadent

import (
	"bufio"
	//"log"
	"bytes"
	"cadent/server/dispatch"
	"cadent/server/schemas/repr"
	"cadent/server/splitter"
	"cadent/server/stats"
	"fmt"
	"net"
	"reflect"
	"time"
)

// TCP_BUFFER_SIZE Size in bytes of the TCP read buffer
const TCP_BUFFER_SIZE = 1048576

// TCP_READ_TIMEOUT TCP read timeout
const TCP_READ_TIMEOUT = 5 * time.Second // second

/************************** TCP Dispatcher Job *******************************/

type tcpJob struct {
	Client  *TCPClient
	Splitem splitter.SplitItem
	retry   int
}

func (t tcpJob) DoWork() {
	if t.Splitem == nil {
		return
	}
	llen := (int64)(len(t.Splitem.Line()))
	t.Client.server.AddToCurrentTotalBufferSize(llen)
	if t.Client.server.NeedBackPressure() {
		t.Client.server.log.Warning(
			"Error::Max Queue or buffer reached dropping connection (Buffer %v, queue len: %v)",
			t.Client.server.CurrentReadBufferRam.Get(),
			len(t.Client.server.WorkQueue))
		t.Client.server.BackPressure()
	}
	t.Client.server.ProcessSplitItem(t.Splitem, t.Client.server.ProcessedQueue)
	t.Client.server.AddToCurrentTotalBufferSize(-llen)
}

/*
TCPClient Should be one per connection (unlike udp/http which is one for all servers, so handling is
treated a bit differently here
*/
type TCPClient struct {
	server     *Server
	hashers    *[]*ConstHasher
	LineParser splitter.Splitter

	Connection net.Conn
	LineCount  uint64

	BufferSize int

	//ins and outs
	writer *bufio.Writer
	reader *bufio.Reader

	outQueue      chan splitter.SplitItem
	inputQueue    chan splitter.SplitItem
	dispatchQueue chan dispatch.IJob
	done          chan Client
	workerQueue   chan *OutputMessage
	close         chan bool
	shutitdown    bool
}

// NewTCPClient create a new TCP client
func NewTCPClient(server *Server,
	hashers *[]*ConstHasher,
	conn net.Conn,
	dispatchQueue chan dispatch.IJob,
	done chan Client,
) *TCPClient {

	client := new(TCPClient)
	client.server = server
	client.hashers = hashers

	//client.writer = bufio.NewWriter(conn)
	//client.reader = bufio.NewReaderSize(conn, TCP_BUFFER_SIZE)
	client.LineCount = 0
	client.Connection = conn
	client.SetBufferSize(TCP_BUFFER_SIZE)

	//to deref things
	client.workerQueue = server.WorkQueue
	client.inputQueue = server.InputQueue
	client.dispatchQueue = dispatchQueue

	client.outQueue = server.ProcessedQueue

	client.done = done
	client.shutitdown = false
	client.close = make(chan bool)

	return client
}

// ShutDown initiate a client shudown
func (client *TCPClient) ShutDown() {
	client.shutitdown = true
	client.close <- true
}

func (client *TCPClient) connType() reflect.Type {
	return reflect.TypeOf(client.Connection)
}

// SetBufferSize read buffer for TCP conections
func (client *TCPClient) SetBufferSize(size int) {
	client.BufferSize = size
	if client.connType() == reflect.TypeOf(new(net.TCPConn)) {
		client.Connection.(*net.TCPConn).SetReadBuffer(client.BufferSize)
	} else if client.connType() == reflect.TypeOf(new(net.UnixConn)) {
		client.Connection.(*net.UnixConn).SetReadBuffer(client.BufferSize)
	}
}

// Server of this client
func (client *TCPClient) Server() (server *Server) {
	return client.server
}

// Hashers of this client
func (client *TCPClient) Hashers() (server *[]*ConstHasher) {
	return client.hashers
}

// WorkerQueue chan
func (client *TCPClient) WorkerQueue() chan *OutputMessage {
	return client.workerQueue
}

// InputQueue chan
func (client *TCPClient) InputQueue() chan splitter.SplitItem {
	return client.inputQueue
}

// Close the 2 hooks, channel and connection
func (client *TCPClient) Close() {
	defer stats.StatsdClient.Incr(fmt.Sprintf("worker.%s.tcp.connection.close", client.server.Name), 1)
	defer log.Debug("TCP client: Closing conn %v", client.Connection.RemoteAddr())
	//client.close <- true
	client.reader = nil
	if client.Connection != nil {
		client.Connection.Close()
	}
	client.Connection = nil
	client.server = nil
	client.hashers = nil
}

func (client *TCPClient) handleRequest(outqueue chan splitter.SplitItem, closeClient chan bool) {
	//spin up the splitters

	//client.Connection.SetReadDeadline(time.Now().Add(TCP_READ_TIMEOUT))
	buf := bufio.NewReaderSize(client.Connection, client.BufferSize)
	for {
		select {
		case <-client.close:
			return
		case <-closeClient:
			client.Connection.Close()
			return
		default:
		}

		line, err := buf.ReadBytes(repr.NEWLINE_SEPARATOR_BYTE)

		if err != nil {
			break
		}
		line = bytes.TrimSpace(line)
		if len(line) == 0 {
			continue
		}

		client.server.BytesReadCount.Up(uint64(len(line)))
		client.server.AllLinesCount.Up(1)
		splitem, err := client.server.SplitterProcessor.ProcessLine(line)
		if err == nil {
			if client.shutitdown {
				break
			}
			//this will block once the queue is full
			splitem.SetOrigin(splitter.TCP)
			splitem.SetOriginName(client.server.Name)
			client.server.ValidLineCount.Up(1)
			client.inputQueue <- splitem
			//client.dispatchQueue <- TCPJob{Client: client, Splitem: splitem}
			stats.StatsdClient.Incr("incoming.tcp.lines", 1)
		} else {
			client.server.InvalidLineCount.Up(1)
			stats.StatsdClient.Incr("incoming.tcp.invalidlines", 1)
			log.Warning("Invalid Line: %s (%s)", err, line)
		}
	}

	if client.done != nil {
		client.done <- client
	}

	return
}

func (client *TCPClient) handleSend(outqueue chan splitter.SplitItem) {
	//just "bleed" it
	// NOT NEED for this really.  the client.done <- will take care of the
	// close and we don't use the outqueue for anything, so we waist channel locking cycles for no reason

	for {
		select {
		case message := <-outqueue:
			if message == nil || !message.IsValid() {
				return
			}
		case <-client.close:
			return
		}
	}
}


text:
/*
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/*
 *    InstanceStreamToBatchMakerBeanInfo.java
 *    Copyright (C) 2008-2012 University of Waikato, Hamilton, New Zealand
 *
 */

package weka.gui.beans;

import java.beans.EventSetDescriptor;
import java.beans.SimpleBeanInfo;

/**
 * BeanInfo class for the InstanceStreamToBatchMaker bean
 *
 * @author Mark Hall (mhall{[at]}pentaho{[dot]}com)
 * @version $Revision: 8034 $
 */
public class InstanceStreamToBatchMakerBeanInfo
  extends SimpleBeanInfo {

  /**
   * Returns the event set descriptors
   *
   * @return an EventSetDescriptor[] value
   */
  public EventSetDescriptor [] getEventSetDescriptors() {
    try {
      EventSetDescriptor [] esds =
      { new EventSetDescriptor(DataSource.class,
			       "dataSet",
			       DataSourceListener.class,
			       "acceptDataSet")};
      return esds;
    } catch (Exception ex) {
      ex.printStackTrace();
    }
    return null;
  }
}

redpajama_set_name: RedPajamaGithub


text:
package org.apache.geode.modules.session.internal.filter;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Interface which, when implemented, can be put into a servlet context and executed by the servlet.
 */
public interface Callback {
  void call(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException;
}


text:
package com.github.abarhub.filerw.binary;

import com.github.abarhub.filerw.Field;
import com.github.abarhub.filerw.Tools;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;

import static org.junit.jupiter.api.Assertions.*;

public class StructBinaryInputStreamTest {

    @Test
    public void testStructBinaryInputStreamInputStreamClassOfT()
            throws IOException, ParseException {
        ByteArrayInputStream buf;
        byte[] buf0 = new byte[]{31, 32, 33, 34, 35, 36, 92, 38, 39, 40, 41,
                42, 43, 44, 45, 46, 47};
        LineContentBinary<FieldsListChamps2> line;

        buf = new ByteArrayInputStream(buf0);
        try (StructBinaryInputStream<FieldsListChamps2> in = new StructBinaryInputStream<>(buf,
                FieldsListChamps2.class)) {
            line = in.readLn();
            assertNotNull(line);

            assertArrayEquals(new byte[]{31, 32, 33, 34},
                    line.get(FieldsListChamps2.Code1));
            assertArrayEquals(new byte[]{35, 36, 92, 38, 39, 40},
                    line.get(FieldsListChamps2.Code2));
            assertArrayEquals(new byte[]{41, 42, 43, 44, 45, 46, 47},
                    line.get(FieldsListChamps2.Code3));

            assertArrayEquals(buf0, line.getLine());

            line = in.readLn();
            assertNull(line);

        }
    }

    @Test
    public void testStructBinaryInputStreamInputStreamClassOfT2()
            throws IOException, ParseException {
        ByteArrayInputStream buf;
        byte[] buf0 = new byte[]{31, 32, 33, 34, 35, 36, 92, 38, 39, 40, 41,
                42, 43, 44, 45, 46, 47};
        LineContentBinary<FieldsListChamps2> line;

        buf = new ByteArrayInputStream(buf0);
        try (StructBinaryInputStream<FieldsListChamps2> in = new StructBinaryInputStream<>(buf,
                Tools.convClassEnum(FieldsListChamps2.class))) {
            line = in.readLn();
            assertNotNull(line);

            assertArrayEquals(new byte[]{31, 32, 33, 34},
                    line.get(FieldsListChamps2.Code1));
            assertArrayEquals(new byte[]{35, 36, 92, 38, 39, 40},
                    line.get(FieldsListChamps2.Code2));
            assertArrayEquals(new byte[]{41, 42, 43, 44, 45, 46, 47},
                    line.get(FieldsListChamps2.Code3));

            assertArrayEquals(buf0, line.getLine());

            line = in.readLn();
            assertNull(line);

        }
    }

    @Test
    public void testStructBinaryInputStreamInputStreamClassOfT3()
            throws IOException, ParseException {
        ByteArrayInputStream buf;
        byte[] buf0 = new byte[]{31, 32, 33, 34, 35, 36, 92, 38, 39, 40, 41,
                42, 43, 44, 45, 46, 47, 121, 32, 33, 34, 35, 36, 92, 38, 39,
                40, 41, 42, 43, 44, 45, 46, 47, -124, 32, 33, 34, 35, 36, 92,
                38, 39, 40, 41, 42, 43, 44, 45, 46, 47};
        LineContentBinary<FieldsListChamps2> line;

        buf = new ByteArrayInputStream(buf0);
        try (StructBinaryInputStream<FieldsListChamps2> in = new StructBinaryInputStream<>(buf,
                FieldsListChamps2.class)) {
            line = in.readLn();
            assertNotNull(line);

            assertArrayEquals(new byte[]{31, 32, 33, 34},
                    line.get(FieldsListChamps2.Code1));
            assertArrayEquals(new byte[]{35, 36, 92, 38, 39, 40},
                    line.get(FieldsListChamps2.Code2));
            assertArrayEquals(new byte[]{41, 42, 43, 44, 45, 46, 47},
                    line.get(FieldsListChamps2.Code3));

            line = in.readLn();
            assertNotNull(line);

            assertArrayEquals(new byte[]{121, 32, 33, 34},
                    line.get(FieldsListChamps2.Code1));
            assertArrayEquals(new byte[]{35, 36, 92, 38, 39, 40},
                    line.get(FieldsListChamps2.Code2));
            assertArrayEquals(new byte[]{41, 42, 43, 44, 45, 46, 47},
                    line.get(FieldsListChamps2.Code3));

            line = in.readLn();
            assertNotNull(line);

            assertArrayEquals(new byte[]{-124, 32, 33, 34},
                    line.get(FieldsListChamps2.Code1));
            assertArrayEquals(new byte[]{35, 36, 92, 38, 39, 40},
                    line.get(FieldsListChamps2.Code2));
            assertArrayEquals(new byte[]{41, 42, 43, 44, 45, 46, 47},
                    line.get(FieldsListChamps2.Code3));

            line = in.readLn();
            assertNull(line);

        }
    }

    @Nested
    class TestConstructor {

        @Test
        public void testConstructor()
                throws IOException {
            ByteArrayInputStream buf;
            byte[] buf0 = new byte[]{31, 32, 33, 34, 35, 36, 92, 38, 39, 40, 41,
                    42, 43, 44, 45, 46, 47};

            buf = new ByteArrayInputStream(buf0);
            try (StructBinaryInputStream<FieldsListChamps2> in = new StructBinaryInputStream<>(buf,
                    FieldsListChamps2.class)) {
                assertNotNull(in.getFieldsList());
                assertEquals(3, in.getFieldsList().size());
                assertTrue(in.getFieldsList().contains(FieldsListChamps2.Code1));
                assertTrue(in.getFieldsList().contains(FieldsListChamps2.Code2));
                assertTrue(in.getFieldsList().contains(FieldsListChamps2.Code3));
            }
        }

        @Test
        public void testConstructor2()
                throws IOException {
            ByteArrayInputStream buf;
            byte[] buf0 = new byte[]{31, 32, 33, 34, 35, 36, 92, 38, 39, 40, 41,
                    42, 43, 44, 45, 46, 47};

            buf = new ByteArrayInputStream(buf0);
            try (StructBinaryInputStream<FieldsListChamps2> in = new StructBinaryInputStream<>(buf,
                    Tools.convClassEnum(FieldsListChamps2.class))) {
                assertNotNull(in.getFieldsList());
                assertEquals(3, in.getFieldsList().size());
                assertTrue(in.getFieldsList().contains(FieldsListChamps2.Code1));
                assertTrue(in.getFieldsList().contains(FieldsListChamps2.Code2));
                assertTrue(in.getFieldsList().contains(FieldsListChamps2.Code3));

            }
        }

        @Test
        public void testConstructor3() {
            ByteArrayInputStream buf = null;
            assertThrows(IllegalArgumentException.class, () -> new StructBinaryInputStream<>(buf,
                    FieldsListChamps2.class));
        }

        @Test
        public void testConstructor4() {
            ByteArrayInputStream buf;
            byte[] buf0 = new byte[]{31, 32, 33, 34, 35, 36, 92, 38, 39, 40, 41,
                    42, 43, 44, 45, 46, 47};

            buf = new ByteArrayInputStream(buf0);
            assertThrows(IllegalArgumentException.class, () ->
                    new StructBinaryInputStream<>(buf,
                            (Class<FieldsListChamps2>) null));
        }

        @Test
        public void testConstructor5() {
            ByteArrayInputStream buf = null;
            assertThrows(IllegalArgumentException.class, () -> new StructBinaryInputStream<>(buf,
                    new ArrayList<FieldsListChamps2>()));
        }

        @Test
        public void testConstructor6() {
            ByteArrayInputStream buf;
            byte[] buf0 = new byte[]{31, 32, 33, 34, 35, 36, 92, 38, 39, 40, 41,
                    42, 43, 44, 45, 46, 47};

            buf = new ByteArrayInputStream(buf0);
            assertThrows(IllegalArgumentException.class, () ->
                    new StructBinaryInputStream<>(buf,
                            (List<FieldsListChamps2>) null));
        }
    }

    @Nested
    class TestReadLn {

        @Test
        public void testReadLn1() throws Exception {
            ByteArrayInputStream buf;
            byte[] buf0 = new byte[]{31, 32, 33, 34, 35, 36, 92, 38, 39, 40, 41,
                    42, 43, 44, 45, 46, 47, 121, 32, 33, 34, 35, 36, 92, 38, 39,
                    40, 41, 42, 43, 44, 45, 46, 47, -124, 32, 33, 34, 35, 36, 92,
                    38, 39, 40, 41, 42, 43, 44, 45, 46, 47};
            LineContentBinary<FieldsListChamps2> line;

            buf = new ByteArrayInputStream(buf0);
            try (LimitInputStream<FieldsListChamps2> in = new LimitInputStream<>(buf,
                    FieldsListChamps2.class, 5)) {
                line = in.readLn();
                assertNotNull(line);

                assertArrayEquals(new byte[]{31, 32, 33, 34},
                        line.get(FieldsListChamps2.Code1));
                assertArrayEquals(new byte[]{35, 36, 92, 38, 39, 40},
                        line.get(FieldsListChamps2.Code2));
                assertArrayEquals(new byte[]{41, 42, 43, 44, 45, 46, 47},
                        line.get(FieldsListChamps2.Code3));

                line = in.readLn();
                assertNotNull(line);

                assertArrayEquals(new byte[]{121, 32, 33, 34},
                        line.get(FieldsListChamps2.Code1));
                assertArrayEquals(new byte[]{35, 36, 92, 38, 39, 40},
                        line.get(FieldsListChamps2.Code2));
                assertArrayEquals(new byte[]{41, 42, 43, 44, 45, 46, 47},
                        line.get(FieldsListChamps2.Code3));

                line = in.readLn();
                assertNotNull(line);

                assertArrayEquals(new byte[]{-124, 32, 33, 34},
                        line.get(FieldsListChamps2.Code1));
                assertArrayEquals(new byte[]{35, 36, 92, 38, 39, 40},
                        line.get(FieldsListChamps2.Code2));
                assertArrayEquals(new byte[]{41, 42, 43, 44, 45, 46, 47},
                        line.get(FieldsListChamps2.Code3));

                line = in.readLn();
                assertNull(line);

            }
        }

        @Test
        public void testReadLn2() throws Exception {
            ByteArrayInputStream buf;
            byte[] buf0 = new byte[]{31, 32, 33};
            LineContentBinary<FieldsListChamps2> line;

            buf = new ByteArrayInputStream(buf0);
            try (LimitInputStream<FieldsListChamps2> in = new LimitInputStream<>(buf,
                    FieldsListChamps2.class, 5)) {
                ParseException exception = assertThrows(ParseException.class, () -> in.readLn());

                assertNotNull(exception);
                assertEquals("Invalid Size (3!=17)", exception.getMessage());
            }
        }

        @Test
        public void testReadLn3() throws Exception {
            ByteArrayInputStream buf;
            byte[] buf0 = new byte[]{31, 32, 33, 34, 35, 36, 92, 38, 39, 40, 41,
                    42, 43, 44, 45, 46, 47, 121, 32, 33, 34, 35, 36, 92, 38, 39,
                    40, 41, 42, 43, 44, 45, 46, 47, -124, 32, 33, 34, 35, 36, 92,
                    38, 39, 40, 41, 42, 43, 44, 45, 46};
            LineContentBinary<FieldsListChamps2> line;

            buf = new ByteArrayInputStream(buf0);
            try (LimitInputStream<FieldsListChamps2> in = new LimitInputStream<>(buf,
                    FieldsListChamps2.class, 5)) {
                line = in.readLn();
                assertNotNull(line);

                assertArrayEquals(new byte[]{31, 32, 33, 34},
                        line.get(FieldsListChamps2.Code1));
                assertArrayEquals(new byte[]{35, 36, 92, 38, 39, 40},
                        line.get(FieldsListChamps2.Code2));
                assertArrayEquals(new byte[]{41, 42, 43, 44, 45, 46, 47},
                        line.get(FieldsListChamps2.Code3));

                line = in.readLn();
                assertNotNull(line);

                assertArrayEquals(new byte[]{121, 32, 33, 34},
                        line.get(FieldsListChamps2.Code1));
                assertArrayEquals(new byte[]{35, 36, 92, 38, 39, 40},
                        line.get(FieldsListChamps2.Code2));
                assertArrayEquals(new byte[]{41, 42, 43, 44, 45, 46, 47},
                        line.get(FieldsListChamps2.Code3));

                ParseException exception = assertThrows(ParseException.class, () -> in.readLn());

                assertNotNull(exception);
                assertEquals("Invalid Size (16!=17)", exception.getMessage());

            }
        }
    }

    class LimitInputStream<T extends Field> extends StructBinaryInputStream<T> {

        private final int size;

        public LimitInputStream(InputStream in, Class clazz, int size) {
            super(in, clazz);
            this.size = size;
        }

        @Override
        public int read(byte[] b) throws IOException {
            if (b.length <= size) {
                return super.read(b);
            } else {
                byte[] buf = new byte[size];
                int len = super.read(buf);
                if (len >= 0) {
                    System.arraycopy(buf, 0, b, 0, len);
                }
                return len;
            }
        }
    }
}


text:
module SnowAgent
  # Encapsulates HTTP related logic for sending data
  # to SnowmanIO instance
  # TODO: use faraday instead of raw net/http?
  class Service
    def initialize(conf)
      @uri        =  URI.join(conf.server, "agent/metrics")
      @connection = build_connection(conf)
      @token      = conf.secret_token
    end

    def post_data(payload)
      req = Net::HTTP::Post.new("#{@uri.path}?#{@uri.query}", headers)
      req.body = JSON.dump(payload.merge(token: @token))
      size = req.body.length

      response = @connection.request(req)
      SnowAgent.logger.info "[SnowAgent] POST #{size} bytes to #{@uri}"

      response
    end

    def build_connection(conf)
      http = Net::HTTP.new(@uri.host, @uri.port)

      http.use_ssl      = (@uri.scheme == "https")
      http.read_timeout = conf.read_timeout if conf.read_timeout
      http.open_timeout = conf.open_timeout if conf.open_timeout

      http
    end

    def headers
      {'Content-Type' =>'application/json'}
    end
  end
end


text:
import { Ratio, RatioGauge } from '../src/ratio-gauge';
import { MetricType } from '../src/metric';
import { ConstantRatioGauge } from './helpers';

describe('RatioGauge', () => {
  it('should have the Gauge metric type', () => {
    const g = new ConstantRatioGauge(Ratio.of(1, 4));

    expect(g.type).toBe(MetricType.Gauge);
  });

  it('should have return the value of the ratio', () => {
    const g = new ConstantRatioGauge(Ratio.of(1, 4));

    expect(g.getValue()).toBeCloseTo(0.25, 8);
  });
});

describe('Ratio', () => {
  describe('.getValue', () => {
    it('returns the value of the ratio', () => {
      const r = Ratio.of(2, 4);

      expect(r.getValue()).toBeCloseTo(0.5, 8);
    });

    it('handles division by zero', () => {
      const r = Ratio.of(2, 0);

      expect(r.getValue()).toEqual(NaN);
    });

    it('handles infinite denominators', () => {
      const r = Ratio.of(2, Infinity);

      expect(r.getValue()).toEqual(NaN);

      const r2 = Ratio.of(2, -Infinity);

      expect(r2.getValue()).toEqual(NaN);
    });

    it('handles NaN denominators', () => {
      const r = Ratio.of(2, NaN);

      expect(r.getValue()).toEqual(NaN);
    });
  });
});


text:
/****************************************************************************
 * Included Files
 ****************************************************************************/

#include <nuttx/config.h>

#include <sys/types.h>
#include <sys/ioctl.h>

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <limits.h>
#include <errno.h>
#include <debug.h>

#include <nuttx/sensors/qencoder.h>

#include "qe.h"

/****************************************************************************
 * Pre-processor Definitions
 ****************************************************************************/

/****************************************************************************
 * Private Types
 ****************************************************************************/

/****************************************************************************
 * Private Function Prototypes
 ****************************************************************************/

/****************************************************************************
 * Private Data
 ****************************************************************************/

/****************************************************************************
 * Public Data
 ****************************************************************************/

#ifdef CONFIG_NSH_BUILTIN_APPS
struct qe_example_s g_qeexample;
#endif

/****************************************************************************
 * Private Functions
 ****************************************************************************/

/****************************************************************************
 * Name: qe_devpath
 ****************************************************************************/

static void qe_devpath(FAR const char *devpath)
{
  /* Get rid of any old device path */

  if (g_qeexample.devpath)
    {
      free(g_qeexample.devpath);
    }

  /* The set-up the new device path by copying the string */

  g_qeexample.devpath = strdup(devpath);
}

/****************************************************************************
 * Name: qe_help
 ****************************************************************************/

#ifdef CONFIG_NSH_BUILTIN_APPS
static void qe_help(void)
{
  printf("\nUsage: qe [OPTIONS]\n\n");
  printf("OPTIONS include:\n");
  printf("  [-p devpath] QE device path\n");
  printf("  [-n samples] Number of samples\n");
  printf("  [-t msec]    Delay between samples (msec)\n");
  printf("  [-r]         Reset the position to zero\n");
  printf("  [-h]         Shows this message and exits\n\n");
}
#endif

/****************************************************************************
 * Name: arg_string
 ****************************************************************************/

#ifdef CONFIG_NSH_BUILTIN_APPS
static int arg_string(FAR char **arg, FAR char **value)
{
  FAR char *ptr = *arg;

  if (ptr[2] == '\0')
    {
      *value = arg[1];
      return 2;
    }
  else
    {
      *value = &ptr[2];
      return 1;
    }
}
#endif

/****************************************************************************
 * Name: arg_decimal
 ****************************************************************************/

#ifdef CONFIG_NSH_BUILTIN_APPS
static int arg_decimal(FAR char **arg, FAR long *value)
{
  FAR char *string;
  int ret;

  ret = arg_string(arg, &string);
  *value = strtol(string, NULL, 10);
  return ret;
}
#endif

/****************************************************************************
 * Name: parse_args
 ****************************************************************************/

#ifdef CONFIG_NSH_BUILTIN_APPS
static void parse_args(int argc, FAR char **argv)
{
  FAR char *ptr;
  FAR char *str;
  long value;
  int index;
  int nargs;

  g_qeexample.reset  = false;
  g_qeexample.nloops = 1;
  g_qeexample.delay  = CONFIG_EXAMPLES_QENCODER_DELAY;

  for (index = 1; index < argc; )
    {
      ptr = argv[index];
      if (ptr[0] != '-')
        {
          printf("Invalid options format: %s\n", ptr);
          exit(0);
        }

      switch (ptr[1])
        {
          case 'n':
            nargs = arg_decimal(&argv[index], &value);
            if (value < 0 || value > INT_MAX)
              {
                printf("Sample count out of range: %ld\n", value);
                exit(1);
              }

            g_qeexample.nloops = (unsigned int)value;
            index += nargs;
            break;

          case 'p':
            nargs = arg_string(&argv[index], &str);
            qe_devpath(str);
            index += nargs;
            break;

          case 't':
            nargs = arg_decimal(&argv[index], &value);
            if (value < 0 || value > INT_MAX)
              {
                printf("Sample delay out of range: %ld\n", value);
                exit(1);
              }

            g_qeexample.delay = (unsigned int)value;
            index += nargs;
            break;

          case 'r':
            g_qeexample.reset = true;
            index++;
            break;

          case 'h':
            qe_help();
            exit(EXIT_SUCCESS);

          default:
            printf("Unsupported option: %s\n", ptr);
            qe_help();
            exit(EXIT_FAILURE);
        }
    }
}
#endif

/****************************************************************************
 * Public Functions
 ****************************************************************************/

/****************************************************************************
 * Name: qe_main
 ****************************************************************************/

#ifdef CONFIG_BUILD_KERNEL
int main(int argc, FAR char *argv[])
#else
int qe_main(int argc, char *argv[])
#endif
{
  int32_t position;
  int fd;
  int exitval = EXIT_SUCCESS;
  int ret;
#if defined(CONFIG_NSH_BUILTIN_APPS) || defined(CONFIG_EXAMPLES_QENCODER_NSAMPLES)
  int nloops;
#endif

  /* Check if we have initialized */

  if (!g_qeexample.initialized)
    {
      /* Initialization of the encoder hardware is performed by logic external to
       * this test.
       */

      printf("qe_main: Initializing external encoder(s)\n");
      ret = qe_devinit();
      if (ret != OK)
        {
          printf("qe_main: qe_devinit failed: %d\n", ret);
          exitval = EXIT_FAILURE;
          goto errout;
        }

      /* Set the default values */

      qe_devpath(CONFIG_EXAMPLES_QENCODER_DEVPATH);
      g_qeexample.initialized = true;
    }

  /* Parse command line arguments */

#ifdef CONFIG_NSH_BUILTIN_APPS
  parse_args(argc, argv);
#endif

  /* Open the encoder device for reading */

  printf("qe_main: Hardware initialized. Opening the encoder device: %s\n",
          g_qeexample.devpath);

  fd = open(g_qeexample.devpath, O_RDONLY);
  if (fd < 0)
    {
      printf("qe_main: open %s failed: %d\n", g_qeexample.devpath, errno);
      exitval = EXIT_FAILURE;
      goto errout_with_dev;
    }

  /* Reset the count if so requested */

  if (g_qeexample.reset)
    {
      printf("qe_main: Resetting the count...\n");
      ret = ioctl(fd, QEIOC_RESET, 0);
      if (ret < 0)
        {
          printf("qe_main: ioctl(QEIOC_RESET) failed: %d\n", errno);
          exitval = EXIT_FAILURE;
          goto errout_with_dev;
        }
    }

  /* Now loop the appropriate number of times, displaying the collected
   * encoder samples.
   */

#if defined(CONFIG_NSH_BUILTIN_APPS)
  printf("qe_main: Number of samples: %u\n", g_qeexample.nloops);
  for (nloops = 0; nloops < g_qeexample.nloops; nloops++)
#elif defined(CONFIG_EXAMPLES_QENCODER_NSAMPLES)
  printf("qe_main: Number of samples: %d\n", CONFIG_EXAMPLES_QENCODER_NSAMPLES);
  for (nloops = 0; nloops < CONFIG_EXAMPLES_QENCODER_NSAMPLES; nloops++)
#else
  for (;;)
#endif
    {
      /* Flush any output before the loop entered or from the previous pass
       * through the loop.
       */

      fflush(stdout);

      /* Get the positions data using the ioctl */

      ret = ioctl(fd, QEIOC_POSITION, (unsigned long)((uintptr_t)&position));
      if (ret < 0)
        {
          printf("qe_main: ioctl(QEIOC_POSITION) failed: %d\n", errno);
          exitval = EXIT_FAILURE;
          goto errout_with_dev;
        }

      /* Print the sample data on successful return */

      else
        {
          printf("qe_main: %3d. %d\n", nloops+1, position);
        }

      /* Delay a little bit */

#if defined(CONFIG_NSH_BUILTIN_APPS)
      usleep(g_qeexample.delay * 1000);
#else
      usleep(CONFIG_EXAMPLES_QENCODER_DELAY * 1000);
#endif
    }

errout_with_dev:
  close(fd);

errout:
  printf("Terminating!\n");
  fflush(stdout);
  return exitval;
}


text:
local controls = require("controls")
local lcd = require("lcd")
local wpilib = require("wpilib")

local pairs = pairs

module(..., package.seeall)

local TELEOP_LOOP_LAG = 0.005

-- Declarations
local watchdogEnabled = false
local feedWatchdog, enableWatchdog, disableWatchdog

local teleop

local controlMap
local driveX, driveY, wristControl, intakeControl
local robotDrive

local leftDriveMotor, rightDriveMotor, wristMotor, intakeMotor
-- End Declarations

function run()
    lcd.print(1, "Ready")
    lcd.update()

    -- Main loop
    while true do
        if wpilib.IsDisabled() then
            -- TODO: run disabled function
            disableWatchdog()
            repeat wpilib.Wait(0.01) until not wpilib.IsDisabled()
            enableWatchdog()
        elseif wpilib.IsAutonomous() then
            -- TODO: autonomous
            disableWatchdog()
            repeat wpilib.Wait(0.01) until not wpilib.IsAutonomous() or not wpilib.IsEnabled()
            enableWatchdog()
        else
            teleop()
            disableWatchdog()
            repeat wpilib.Wait(0.01) until not wpilib.IsOperatorControl() or not wpilib.IsEnabled()
            enableWatchdog()
        end
    end
end

function teleop()
    disableWatchdog()
    while wpilib.IsOperatorControl() and wpilib.IsEnabled() do
        lcd.print(1, "Running!")
        lcd.update()

        -- Read controls
        controls.update(controlMap)

        -- Drive
        robotDrive:ArcadeDrive(driveY, driveX)

        -- Arm
        wristMotor:Set(wristControl)
        if clawSwitch:Get() then
            intakeMotor:Set(intakeControl)
        else
            intakeMotor:Set(0.0)
        end

        wpilib.Wait(TELEOP_LOOP_LAG)
    end
end

-- Inputs/Outputs
-- Don't forget to add to declarations at the top!
leftDriveMotor = wpilib.Victor(4, 10)
rightDriveMotor = wpilib.Victor(4, 9)
wristMotor = wpilib.Victor(4, 7)
intakeMotor = wpilib.Victor(4, 8)
clawSwitch = wpilib.DigitalInput(4, 1)
-- End Inputs/Outputs

-- Controls
driveX, driveY = 0, 0
intakeSpeed = 0

robotDrive = wpilib.RobotDrive(leftDriveMotor, rightDriveMotor)
robotDrive:SetInvertedMotor(wpilib.RobotDrive_kFrontLeftMotor, true)
robotDrive:SetInvertedMotor(wpilib.RobotDrive_kFrontRightMotor, true)
robotDrive:SetInvertedMotor(wpilib.RobotDrive_kRearLeftMotor, true)
robotDrive:SetInvertedMotor(wpilib.RobotDrive_kRearRightMotor, true)

controlMap =
{
    -- Joystick 1
    {
        ["x"] = function(axis) driveX = axis end,
        ["y"] = function(axis) driveY = axis end,
    },
    -- Joystick 2
    {
        ["y"] = function(axis) wristControl = axis end,
        update=function(stick)
            if stick:GetRawButton(1) then
                intakeControl = 0.6
            elseif stick:GetRawButton(2) or stick:GetRawButton(3) or stick:GetRawButton(4) or stick:GetRawButton(5) then
                intakeControl = -1
            else
                intakeControl = 0
            end
        end,
    },
    -- Joystick 3
    {
    },
    -- Joystick 4 (eStop Module)
    {
    },
    -- Cypress Module
    cypress={},
}
-- End Controls

-- Watchdog shortcuts
if watchdogEnabled then
    wpilib.GetWatchdog():SetExpiration(0.25)

    function feedWatchdog()
        local dog = wpilib.GetWatchdog()
        dog:Feed()
    end

    function enableWatchdog()
        local dog = wpilib.GetWatchdog()
        dog:SetEnabled(true)
    end

    function disableWatchdog()
        local dog = wpilib.GetWatchdog()
        dog:SetEnabled(false)
    end
else
    local dog = wpilib.GetWatchdog()
    dog:SetEnabled(false)

    feedWatchdog = function() end
    enableWatchdog = function() end
    disableWatchdog = function() end
end

-- vim: ft=lua et ts=4 sts=4 sw=4


text:
<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Streamr</title>

<link href="static/font/stylesheet.css" rel="stylesheet" type="text/css" />
<link href="static/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="static/css/bootstrap-responsive.min.css" rel="stylesheet" type="text/css" />
<link href="static/css/styles.css" rel="stylesheet" type="text/css" />
<link href="static/css/media-queries.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="static/fancybox/jquery.fancybox-1.3.4.css" media="screen" />

<meta name="viewport" content="width=device-width" />

<link rel="shortcut icon" href="static/img/favicon.ico" type="image/x-icon">

<link href='https://fonts.googleapis.com/css?family=Exo:400,800' rel='stylesheet' type='text/css'>

Home

About

Updates

Screenshots

Contact

Streamr

                    Streamr enhances your movie experiences by adding an extra social content layer. Streamr lets you createthe content you'd like to see next to a movie, and will enable others to take see the movie with your extra content. Write comments, post images, observations, actor bios, mini reviews, audio comments, basically everything  you can think of that others might want to see when watching a movie.

            Ever watched a movie and just wondered where you have seen the actor before? Not if you watch movies with Streamr!

Browse popular streams

Create your own streams

And it is free!

Coming to an appstore near you! While you're waiting, you can download the Android installer and install it manually.

                Requirements:

                Compatible with iPhone, iPad and iPod touch. WiFi, Edge, or 3G network connection required.

                Requirements:

                Compatible with all Android devices. WiFi, Edge, or 3G network connection required.

                About

                Streamr enhances online movie experiences by adding a social aspect. Streamr lets you create timecoded streams to a given episode/movie that you can play on your second screen while watching. In the streams you can find comments, images, observations, links to other pages for reading more, actor bios, mini reviews, audio comments, and basically everything else you want to know while watching a movie.

                Streamr has a strong focus on not disrupting your movie experience, but wants to be there for you when there's something you're wondering about. New actor on screen that you know you've seen somewhere? A glance down on streamr is probably all you need. If however you're in a more social setting and want to be reminded about funny trivias during the movie, enable notifications and you can be center of all laughs during the movie.

                Streamr is a strictly second screen experience, playing back content on your phone or tablet while the main movie plays on either your laptop, TV or home cinema. Sick and tired of annotations on YouTube? Streamr never comes between you and your movie.

                Updates

Version 0.4

            Released on Feb. 12th, 2014

NEWYou can now go back and edit streams you're working on

Version 0.3

            Released on Feb. 12th, 2014

NEWStreams made private by default, so that you can choose to publish them when you're done

Version 0.2.2

            Released on Feb. 8th, 2014

FIXMore relevant search results

NEWAdded a settings page where you can customize how to be notified of new streams

Version 0.2.1

            Released on Jan. 9th, 2014

NEWMovies stop playback automatically when you reach the end

Version 0.1

            Released on Dec. 16th, 2013

NEWFirst release

                Screenshots

                Contact

Contact Us

Streamr is free. Feel free to contact us for questions, suggestions, bug reporting, and any relevant issues.

streamr@thusoy.com

        Copyright © 2013 Alexis, Tarjei and Hilde

        Theme by Trippo.


text:
{% extends "base.html" %}

{% block breadcrumbs %}

  Experiment {{ exp.pk }}

{% endblock %}

{% block content %}

    <form id="population-form" action="" method="post">
      {% csrf_token %}
      <select id="population-sel">
      {% for pop in pop_list %}
        <option value="{{ pop.pk }}">Population {{ pop.rel_index }}</option>
      {% endfor %}
      </select>
      <input type="submit" value="Select" />
    </form>

    <form class="ink-form" action="{% url 'experiment' exp.pk %}" method="post">
      {% csrf_token %}
      {% include "neatweb/form.html" %}
      <input type="submit" value="Re-Submit">
    </form>

{% endblock %}


text:
@interface NSArray (IBObjectBufferAdditions)
+ (id)ib_arrayFromContentsOfObjectBufferPopulatedBy:(CDUnknownBlockType)arg1;
@end


text:
from __future__ import print_function
import configfile
import os

HTTP_SERVER_PORT = 30000
SERIAL_BAUDRATE = 38400

# global variable
c = configfile.ConfigFile("server.cfg", automaticSections = True)

# default values
c.setCfgValue("port", HTTP_SERVER_PORT)
c.setCfgValue("baudrate", SERIAL_BAUDRATE)
c.setCfgValue("motes", [])
c.setCfgValue("selectedMotes", [])
 # in format <port>:<platform>, e.g. /dev/ttyUSB0:telosb
c.setCfgValue("motePlatforms", [])
c.setCfgValue("codeType", "C")
c.setCfgValue("saveToFilename", "")
c.setCfgValue("saveToFilenameOnMote", "")
c.setCfgValue("saveProcessedData", False)
c.setCfgValue("slowUpload", False)
c.setCfgValue("htmlDirectory", "html")
c.setCfgValue("dataDirectory", "data")
c.setCfgValue("mansosDirectory", "../..")
c.setCfgValue("sealBlocklyDirectory", "seal-blockly")
c.setCfgValue("contikiDirectory", "/opt/contiki")
c.setCfgValue("tinyosDirectory", "/opt/tinyos")
c.setCfgValue("createDaemon", False)
c.setCfgValue("serverTheme", "simple")
c.setCfgValue("serverWebSettings", ["serverTheme"])
c.setCfgValue("serverSettingsType", ["[simple, green]"])
# database config
c.selectSection("database")
c.setCfgValue("dbName", "mansosdb")
c.setCfgValue("dbUsername", "root")
c.setCfgValue("dbPassword", "ln29Tx")
c.setCfgValue("dbHost", "localhost")
c.setCfgValue("senseApiKey", "cJ4Dm_Qb-3stWTWxCJgiFQ")
c.setCfgValue("senseApiFeeds", "light:37012,humidity:37013,temperature:37014")
c.setCfgValue("saveToDB", False)
c.setCfgValue("sendToOpenSense", False)
# user config
c.selectSection("user")
c.setCfgValue("userDirectory", "user")
c.setCfgValue("userFile", "user.dat")
c.setCfgValue("userAttributes", ["name", "password", "level"])
c.setCfgValue("userAttributesType", ["text", "text", "[1, 9]"])
c.setCfgValue("defaultValues", ["unknown", "5f4dcc3b5aa765d61d8327deb882cf99", "1"]) #password "password"
c.setCfgValue("adminValues", ["admin", "21232f297a57a5a743894a0e4a801fc3", "9"]) #password "admin"
#c.setCfgValue("defaultUserValues", ["user", "5f4dcc3b5aa765d61d8327deb882cf99", "8"]) #password "password"
c.setCfgValue("userWebAttributes", []) #user editable (password is built-in)
c.setCfgValue("adminWebAttributes", ["level"]) #admin editable (reset password is built-in and name is uneditable)
# graph config
c.selectSection("graph")
c.setCfgValue("graphTitle", "Measurements_from_all_motes")
c.setCfgValue("graphYAxis", "Measurements")
c.setCfgValue("graphInterval", 1000)
c.setCfgValue("graphData", ["[all]"])
c.setCfgValue("graphAttributes", ["graphTitle", "graphYAxis", "graphInterval", "graphData"])

# load the config file
try:
    c.load()
except Exception as e:
    print("Failed to load configuration:")
    print(e)
    pass # let it be...

# required for TinyOS compilation
def setupPaths():
    tinyosPath = c.getCfgValue("tinyosDirectory")
    os.environ['TOSROOT'] = tinyosPath
    os.environ['TOSDIR'] = tinyosPath + '/tos'
    os.environ['MAKERULES'] = tinyosPath + '/support/make/Makerules'
    os.environ['PATH'] = tinyosPath + ":" + os.environ['PATH']


text:
'use babel'

import InsertMetaProvider from '../lib/providers/insert-meta-provider'
import SQLMetaProvider from '../lib/providers/sql-meta-provider'

describe('InsertMetaProvider', () => {
  describe('Get columns', () => {
  let editor = {
    dataAceColumns: [{
        name: 'test_col',
        tableName: 'tbl',
        type: 'varchar'
      },
      {
        name: 'other_col',
        tableName: 'tbl',
        type: 'bool'
      }]
    }
    it('filters by table name including the ALL suggestion when no previous columns exist', () => {
        let cols = InsertMetaProvider.getTableColumnNames(editor, 'tbl', [])
        expect(cols).toContain({text: 'test_col', rightLabelHTML: 'Column', leftLabel: 'varchar'})
        expect(cols.length).toEqual(3)
    })
    it('filters by table name and only includes columns that are not existing already', () => {
        let cols = InsertMetaProvider.getTableColumnNames(editor, 'tbl', ['test_col'])
        expect(cols).toContain({text: 'other_col', rightLabelHTML: 'Column', leftLabel: 'bool'})
        expect(cols.length).toEqual(1)
    })
  })
})

describe('SQLMetaProvider', () => {
  describe('Get table names', () => {
    it('filters by prefix', () => {
      let editor = {
        dataAceTables: [
          {
            name: 'test_table',
            schemaName: 'something',
            type: 'Table'
          },
          {
            name: 'other_table',
            schemaName: 'something',
            type: 'Table'
          },
          {
            name: 'test_table_2',
            schemaName: 'something',
            type: 'Table'
          }
      ]}
      let tables = SQLMetaProvider.getTableNames(editor, 'test', 'something')

      expect(tables).not.toContain({text: 'other_table', rightLabelHTML: 'Table'})
      expect(tables).toContain({text: 'test_table', rightLabelHTML: 'Table'})
      expect(tables).toContain({text: 'test_table_2', rightLabelHTML: 'Table'})
      expect(tables.length).toEqual(2)
    })
  })

  describe('Get column names', () => {
    it('filters by prefix', () => {
      let editor = {
        dataAceColumns: [
          {
            name: 'test_col',
            tableName: 'tbl',
            type: 'varchar'
          },
          {
            name: 'other_col',
            tableName: 'tbl',
            type: 'bool'
          }
        ]
      }
      let cols = SQLMetaProvider.getColumnNames(editor, 'test', 'tbl')
      expect(cols).toContain({text: 'test_col', rightLabelHTML: 'Column', leftLabel: 'varchar'})
      expect(cols.length).toEqual(1)
    })
  })
})


text:
import sqlalchemy as sa
from sqlalchemy import orm

from neutron.api.v2 import attributes
from neutron.db import db_base_plugin_v2
from neutron.db import model_base
from neutron.db import models_v2
from neutron.extensions import extra_dhcp_opt as edo_ext
from neutron.openstack.common import log as logging

LOG = logging.getLogger(__name__)

class ExtraDhcpOpt(model_base.BASEV2, models_v2.HasId):
    """Represent a generic concept of extra options associated to a port.

    Each port may have none to many dhcp opts associated to it that can
    define specifically different or extra options to DHCP clients.
    These will be written to the <network_id>/opts files, and each option's
    tag will be referenced in the <network_id>/host file.
    """
    port_id = sa.Column(sa.String(36),
                        sa.ForeignKey('ports.id', ondelete="CASCADE"),
                        nullable=False)
    opt_name = sa.Column(sa.String(64), nullable=False)
    opt_value = sa.Column(sa.String(255), nullable=False)
    __table_args__ = (sa.UniqueConstraint('port_id',
                                          'opt_name',
                                          name='uidx_portid_optname'),)

    # Add a relationship to the Port model in order to instruct SQLAlchemy to
    # eagerly load extra_dhcp_opts bindings
    ports = orm.relationship(
        models_v2.Port,
        backref=orm.backref("dhcp_opts", lazy='joined', cascade='delete'))

class ExtraDhcpOptMixin(object):
    """Mixin class to add extra options to the DHCP opts file
    and associate them to a port.
    """
    def _process_port_create_extra_dhcp_opts(self, context, port,
                                             extra_dhcp_opts):
        if not extra_dhcp_opts:
            return port
        with context.session.begin(subtransactions=True):
            for dopt in extra_dhcp_opts:
                db = ExtraDhcpOpt(
                    port_id=port['id'],
                    opt_name=dopt['opt_name'],
                    opt_value=dopt['opt_value'])
                context.session.add(db)
        return self._extend_port_extra_dhcp_opts_dict(context, port)

    def _extend_port_extra_dhcp_opts_dict(self, context, port):
        port[edo_ext.EXTRADHCPOPTS] = self._get_port_extra_dhcp_opts_binding(
            context, port['id'])

    def _get_port_extra_dhcp_opts_binding(self, context, port_id):
        query = self._model_query(context, ExtraDhcpOpt)
        binding = query.filter(ExtraDhcpOpt.port_id == port_id)
        return [{'opt_name': r.opt_name, 'opt_value': r.opt_value}
                for r in binding]

    def _update_extra_dhcp_opts_on_port(self, context, id, port,
                                        updated_port=None):
        # It is not necessary to update in a transaction, because
        # its called from within one from ovs_neutron_plugin.
        dopts = port['port'].get(edo_ext.EXTRADHCPOPTS)

        if dopts:
            opt_db = self._model_query(
                context, ExtraDhcpOpt).filter_by(port_id=id).all()
            # if there are currently no dhcp_options associated to
            # this port, Then just insert the new ones and be done.
            if not opt_db:
                with context.session.begin(subtransactions=True):
                    for dopt in dopts:
                        db = ExtraDhcpOpt(
                            port_id=id,
                            opt_name=dopt['opt_name'],
                            opt_value=dopt['opt_value'])
                        context.session.add(db)
            else:
                for upd_rec in dopts:
                    with context.session.begin(subtransactions=True):
                        for opt in opt_db:
                            if opt['opt_name'] == upd_rec['opt_name']:
                                if opt['opt_value'] != upd_rec['opt_value']:
                                    opt.update(
                                        {'opt_value': upd_rec['opt_value']})
                                break
                        # this handles the adding an option that didn't exist.
                        else:
                            db = ExtraDhcpOpt(
                                port_id=id,
                                opt_name=upd_rec['opt_name'],
                                opt_value=upd_rec['opt_value'])
                            context.session.add(db)

            if updated_port:
                edolist = self._get_port_extra_dhcp_opts_binding(context, id)
                updated_port[edo_ext.EXTRADHCPOPTS] = edolist

        return bool(dopts)

    def _extend_port_dict_extra_dhcp_opt(self, res, port):
        res[edo_ext.EXTRADHCPOPTS] = [{'opt_name': dho.opt_name,
                                       'opt_value': dho.opt_value}
                                      for dho in port.dhcp_opts]
        return res

    db_base_plugin_v2.NeutronDbPluginV2.register_dict_extend_funcs(
        attributes.PORTS, ['_extend_port_dict_extra_dhcp_opt'])


text:
using System;
using System.CodeDom.Compiler;
using System.Xml.Serialization;
namespace ExportImportPromotion.StoreMarketingWebService
{
#if MS
	[GeneratedCode("System.Xml", "4.0.30319.1"), XmlType(Namespace = "http://schemas.microsoft.com/CommerceServer/2006/06/MarketingWebService")]
#else
	[GeneratedCode("System.Xml", "4.0.30319.1"), XmlType(Namespace = "http://schemas.commerceserver.net/2013/01/Marketing/MarketingWebService")]
#endif

	[Serializable]
	public enum PromoCodeGenerationMethod
	{
		GenerateRandomCodes,
		ImportCodes,
		ImportUsersAndGenerateCodes
	}
}


text:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Parser Semantic Actions</title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="Spirit X3 3.0.9">
<link rel="up" href="../tutorials.html" title="Tutorials">
<link rel="prev" href="warming_up.html" title="Warming up">
<link rel="next" href="complex___our_first_complex_parser.html" title="Complex - Our first complex parser">

Home
Libraries
People
FAQ
More

Parser Semantic
      Actions

        The example in the previous section was very simplistic. It only recognized
        data, but did nothing with it. It answered the question: "Did the input
        match?". Now, we want to extract information from what was parsed. For
        example, we would want to store the parsed number after a successful match.
        To do this, you will need semantic actions.

        Semantic actions may be attached to any point in the grammar specification.
        These actions are polymorphic function objects that are called whenever a
        part of the parser successfully recognizes a portion of the input. Say you
        have a parser p, and a polymorphic
        C++ function object f. You
        can make the parser call f
        whenever it matches an input by attaching f:

p[f]

        The expression above links f
        to the parser, p. f is expected to be a polymorphic function
        object with the signature:

template <typename Context>
void operator()(Context const& ctx) const;

        We can also use C++14 generic lambdas of the form:

[](auto& ctx) { /*...*/ }

        From the context, we can extract relevant information:

Table 2. Parse Context Access Functions

<colgroup>
<col>
<col>
<col>
</colgroup>

                  Function

                  Description

                  Example

                  _val

                  A reference to the attribute of the innermost rule that directly
                  or indirectly invokes the parser p

                  _val(ctx)
                  = "Gotya!"

                  _where

                  Iterator range to the input stream

                  _where(ctx).begin()

                  _attr

                  A reference to the attribute of the parser p

                  _val(ctx)
                  += _attr(ctx)

                  _pass

                  A reference to a bool
                  flag that can be used to force the p
                  to fail

                  _pass(ctx)
                  = false

        Examples
        of Semantic Actions

        Given:

struct print_action
{
    template <typename Context>
    void operator()(Context const& ctx) const
    {
        std::cout << _attr(ctx) << std::endl;
    }
};

        Take note that with function objects, we need to have an operator() with the Context argument. If we don't
        care about the context, we can use unused_type.
        We'll see more of unused_type
        elsewhere. unused_type is
        a Spirit supplied support class.

        All examples parse inputs of the form:

"{NNN}"

        Where NNN is an integer inside the curly braces (e.g. {44}).

        The first example shows how to attach a function object:

parse(first, last, '{' >> int_[print_action()] >> '}');

        What's new? Well int_ is
        the sibling of double_. I'm
        sure you can guess what this parser does.

        The next example shows how use C++14 lambda:

auto f = [](auto& ctx){ std::cout << _attr(ctx) << std::endl; };
parse(first, last, '{' >> int_[f] >> '}');

        Attaching semantic actions is the first hurdle one has to tackle when getting
        started with parsing with Spirit. Familiarize yourself with this task.

        The examples above can be found here: actions.cpp

Copyright © 2001-2018 Joel de Guzman,
      Hartmut Kaiser

        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)


text:
> Remind when it's time to leave.
> To remove reminders use `kill $(pidof leave)`.

- Set a reminder at a given time:

`leave {{time_to_leave}}`

- Remind to leave at noon:

`leave {{1200}}`

- Set a reminder in a specific amount of time:

`leave +{{amount_of_time}}`

- Remind to leave in 4 hours and 4 minutes:

`leave +{{0404}}`


text:
/*
 * Author: Mehedi Hasan
 *
 * Theme Name: TS
 * URL: http://themesell.co
 * Version: 1.0
 */

/*	################################################################
	1. GENERAL STRUCTURES
################################################################# */

/* Import fonts */
@import url(http://fonts.googleapis.com/css?family=Lato:300,400,700,900);

@import url("prettyPhoto.css") screen;
@import url("hoverex-all.css") screen;

* {
	margin: 0;
	padding: 0px;
    font-family: 'Lato', sans-serif;
}
body {
	background: #fff;
	margin: 0;
	color: #5a5a5a;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Lato', sans-serif;
	font-weight: 300;
}

p {
	padding: 0;
	margin-bottom: 12px;
    font-family: 'Lato', sans-serif;
	font-weight: 300;
	font-size: 18px;
	line-height: 28px;
	color: #666;
	margin-top: 10px;
}

html,
body {
	height: 100%;
}

.alignleft { float: left; }
.alignright { float: right; }
.aligncenter {
	margin-left: auto;
	margin-right: auto;
	display: block;
	clear: both;
}
.centered {text-align: center}
.mt {margin-top: 50px;}
.mb {margin-bottom: 50px;}
.mtb {margin-top: 50px; margin-bottom: 50px;}
.mtb2 { margin-top: 100px; margin-bottom: 100px;}
.ptb {padding-top: 80px; padding-bottom: 80px;}

.clear {
	clear: both;
	display: block;
	font-size: 0;
	height: 0;
	line-height: 0;
	width:100%;
}
::-moz-selection  {
	color: #fff;
	text-shadow:none;
	background:#2B2E31;
}
::selection {
	color: #fff;
	text-shadow:none;
	background:#2B2E31;
}
*,
*:after,
*:before {
	-webkit-box-sizing: border-box;
	-moz-box-sizing: border-box;
	box-sizing: border-box;
	padding: 0;
	margin: 0;
}
a {
	padding: 0;
	margin: 0;
	text-decoration: none;
	-webkit-transition: background-color .4s linear, color .4s linear;
	-moz-transition: background-color .4s linear, color .4s linear;
	-o-transition: background-color .4s linear, color .4s linear;
	-ms-transition: background-color .4s linear, color .4s linear;
	transition: background-color .4s linear, color .4s linear;
	color: #1abc9c;
}
a:hover,
a:focus {
  text-decoration: none;
  color:#696E74;
}

.nopadding {
	padding: 0px !important;
	margin: 0px;
}

/* FORM CONFIGURATION */

input {
	font-size: 16px;
	min-height: 40px;
	border-radius: 2px;
	line-height: 20px;
	padding: 11px 30px 12px;
	border: 1px solid #b9b9af;
	margin-bottom: 10px;
	background-color: #fff;
	-webkit-transition: background-color 0.2s;
	transition: background-color 0.2s;
}

.subscribe-input {
	float: left;
	width: 65%;
	text-align: left;
	margin-right: 2px;
}

.subscribe-submit {
	right: 0;
}

.btn-download {
	background: #FDE3A7;
}

.btn-conf {
	border-radius: 50px;
	margin-right: 15px;
	font-size: 11px;
	letter-spacing: 1px;
	text-transform: uppercase;
	padding: 14px 28px 13px 28px;
	}

.btn-clear {
	background: transparent;
	color: white;
	border: 2px solid white;
}
.btn-clear:hover {
	background: white;
	color: #2f2f2f;
}

.dmbutton:hover,
.dmbutton:active,
.dmbutton:focus{
	color: #ffffff;
	background-color: #222222;
	border-color: #ffffff;
}
.dmbutton {
	background:rgba(0, 0, 0, 0);
	border: 1px solid #ffffff;
	color: #ffffff;
	-webkit-border-radius: 2px;
	border-radius: 2px;
	padding-top: 1.025rem;
	padding-right: 2.25rem;
	letter-spacing:0.85px;
	padding-bottom: 1.0875rem;
	padding-left: 2.25rem;
	font-size: 1.55rem;
	cursor: pointer;
	font-weight: normal;
	line-height: normal;
	margin: 0 0 1.25rem;
	text-decoration: none;
	text-align: center;
	display: inline-block;
	-webkit-transition: background-color 300ms ease-out;
	-moz-transition: background-color 300ms ease-out;
	transition: background-color 300ms ease-out;
	-webkit-appearance: none;
	font-weight: normal !important;
}

/* HEADER SECTION */
#main-header {
	background: url("../img/header.jpg") no-repeat scroll  rgba(0, 0, 0, 0.45);
	padding-top: 5px;
	background-attachment: relative;
	background-position: center center;
	min-height: 700px;
	width: 100%;

    -webkit-background-size: 100%;
    -moz-background-size: 100%;
    -o-background-size: 100%;
    background-size: 100%;

    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
    color: white;
}

#main-header .logo {
	margin-top: 30px;
	margin-left: 40px;
	padding-bottom: 150px;
}

#main-header .logo h2{
	font-weight: 900;
	color: white;
	letter-spacing: 1px;
}

#main-header h3 {
	margin-top: 10px;
}

#main-header i {
	font-size: 50px;
}

/* Features SECTION */

#features{
padding:50px 0;
background:#f5f5f5;

}
.service-icon {
  border: 1px solid #0eb493;
  border-radius: 50%;
  color: #0eb493;
  float: left;
  padding: 10px 13px;
}
.service-desc {
  margin-left: 70px;
  position: relative;
  top: 5px;
}
.sec-title h2 {
  color: #0eb493;
  font-size: 28px;
  font-weight: 800;
  text-transform: uppercase;
}
.devider::before, .devider::after {
  bottom: 6px;
  color: #e6e8ea;
  content: "______________________";
  position: relative;
}
.devider::after {
  left: 10px;
}
.devider::before {
  right: 10px;
}

/* GREY SECTION */
#themesell-g {
	padding-top: 50px;
	padding-bottom: 50px;
	background: #f5f5f5;
}

.portfolio {
	padding:0 !important;
	margin:0 !important;
	display:block;
}

.portfolio-item .title:before {border-radius:0; display:none}
.portfolio-item p {margin:0px 0 30px;}
.portfolio-item h3 {margin:-10px 0 10px; font-size:16px; text-transform:uppercase;}

.tpl6 h3
{
	color:#fff;
	margin:0;
	padding:40px 5px 0;
	font-size:16px;
	text-transform:uppercase;
}
.tpl6 .dmbutton
{
	display:inline-block;
	margin:30px 5px 20px 5px;
	font-size:13px;
}

.tpl6 .bg
{
	height:100%;
	width:100%;
	background-color:#00b3fe;
	background-color:rgba(0,179,254,.9);
	text-align:center;
}

/* CLIENTS */

.clients img {
	max-width: 140px;
	max-height: 60px;
	vertical-align: middle;
}

.clients .col-sm-2 {
	height: 80px;
	line-height: 80px;
}

/* CONTACT SEPARATOR */
#themesell-sep {
	background: url(../img/sep.jpg) no-repeat center top;
	padding-top: 100px;
	background-attachment: relative;
	background-position: center center;
	min-height: 450px;
	width: 100%;
	color: white;

    -webkit-background-size: 100%;
    -moz-background-size: 100%;
    -o-background-size: 100%;
    background-size: 100%;

    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
    color: white;
}

#themesell-sep h3 {
	font-weight: 300;
	letter-spacing: 2px;
}

/* FOOTER */
#themesell-footer {
	padding-top: 25px;
	padding-bottom: 25px;
	background-color: #0eb493;
}

#themesell-footer i {
	margin-right: 30px;
	font-size: 35px;
}

#themesell-footer a {
	color: white;
}

/* HEADER 2 - PORTFOLIO SECTION */
#h2 {
	background: url(../img/header-2.jpg) no-repeat center top;
	padding-top: 5px;
	background-attachment: relative;
	background-position: center center;
	min-height: 700px;
	width: 100%;

    -webkit-background-size: 100%;
    -moz-background-size: 100%;
    -o-background-size: 100%;
    background-size: 100%;

    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
    color: white;
}

#h2 .logo {
	margin-top: 30px;
	margin-left: 40px;
	padding-bottom: 150px;
}

#h2 .logo h2{
	font-weight: 900;
	color: white;
	letter-spacing: 1px;
}

#h2 h3 {
	margin-top: 30px;
	letter-spacing: 1px;
}


text:
from django.conf import settings
from django.conf.urls import include, patterns, url

from rest_framework.routers import SimpleRouter

from mkt.abuse.urls import api_patterns as abuse_api_patterns
from mkt.account.urls import api_patterns as account_api_patterns
from mkt.api.base import SubRouter, SubRouterWithFormat
from mkt.api.views import (CarrierViewSet, CategoryViewSet,
                           error_reporter, ErrorViewSet, PriceTierViewSet,
                           PriceCurrencyViewSet, RefreshManifestViewSet,
                           RegionViewSet, site_config)
from mkt.collections.views import CollectionImageViewSet, CollectionViewSet
from mkt.comm.urls import api_patterns as comm_api_patterns
from mkt.developers.urls import dev_api_patterns, payments_api_patterns
from mkt.features.views import AppFeaturesList
from mkt.receipts.urls import receipt_api_patterns
from mkt.reviewers.urls import api_patterns as reviewer_api_patterns
from mkt.search.views import (FeaturedSearchView, RocketbarView, SearchView,
                            SuggestionsView)
from mkt.stats.urls import stats_api_patterns, txn_api_patterns
from mkt.submit.views import PreviewViewSet, StatusViewSet, ValidationViewSet
from mkt.webapps.views import AppTagViewSet, AppViewSet, PrivacyPolicyViewSet

rocketfuel = SimpleRouter()
rocketfuel.register(r'collections', CollectionViewSet,
                    base_name='collections')

subcollections = SubRouterWithFormat()
subcollections.register('image', CollectionImageViewSet,
                        base_name='collection-image')

apps = SimpleRouter()
apps.register(r'preview', PreviewViewSet, base_name='app-preview')
apps.register(r'validation', ValidationViewSet, base_name='app-validation')
apps.register(r'category', CategoryViewSet, base_name='app-category')
apps.register(r'status', StatusViewSet, base_name='app-status')
apps.register(r'app', AppViewSet, base_name='app')

subapps = SubRouter()
subapps.register('refresh-manifest', RefreshManifestViewSet,
                 base_name='app-refresh-manifest')
subapps.register('privacy', PrivacyPolicyViewSet,
                 base_name='app-privacy-policy')
subapps.register('tags/(?P<tag_text>\w+)', AppTagViewSet, base_name='app-tags')

services = SimpleRouter()

if settings.ENABLE_API_ERROR_SERVICE:
    services.register(r'error', ErrorViewSet, base_name='error')

services.register(r'carrier', CarrierViewSet, base_name='carriers')
services.register(r'region', RegionViewSet, base_name='regions')
services.register(r'price-tier', PriceTierViewSet,
              base_name='price-tier')
services.register(r'price-currency', PriceCurrencyViewSet,
              base_name='price-currency')

urlpatterns = patterns('',
    url('', include('mkt.fireplace.urls')),
    url(r'^apps/', include(apps.urls)),
    url(r'^apps/app/', include(subapps.urls)),
    url(r'^apps/search/featured/', FeaturedSearchView.as_view(),
        name='featured-search-api'),
    url(r'^apps/search/suggest/', SuggestionsView.as_view(),
        name='suggestions-search-api'),
    url(r'^apps/search/rocketbar/', RocketbarView.as_view(),
        name='rocketbar-search-api'),
    url(r'^apps/search/', SearchView.as_view(), name='search-api'),
    url(r'^services/', include(services.urls)),
    url(r'^services/config/site/', site_config, name='site-config'),
    url(r'^fireplace/report_error/\d*', error_reporter, name='error-reporter'),
    url(r'^rocketfuel/', include(rocketfuel.urls)),
    url(r'^rocketfuel/collections/', include(subcollections.urls)),
    url(r'^apps/', include('mkt.versions.urls')),
    url(r'^apps/', include('mkt.ratings.urls')),
    url(r'^apps/features/', AppFeaturesList.as_view(),
        name='api-features-feature-list'),
    url('', include(abuse_api_patterns)),
    url('', include(account_api_patterns)),
    url('', include('mkt.installs.urls')),
    url('', include(reviewer_api_patterns)),
    url('', include('mkt.webpay.urls')),
    url('', include(dev_api_patterns)),
    url('', include(payments_api_patterns)),
    url('', include(receipt_api_patterns)),
    url('', include('mkt.monolith.urls')),
    url('', include(comm_api_patterns)),
    url('', include(stats_api_patterns)),
    url('', include(txn_api_patterns)),
)


text:
.integration-server-url {
  margin-bottom : 20px;
}

.project-avatar-preview {
  max-width  : 16px;
  max-height : 16px;
}


text:
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import vtk.vtkActor;
import vtk.vtkNativeLibrary;
import vtk.vtkPanel;
import vtk.vtkPolyDataMapper;
import vtk.vtkLineSource;

//Author: Bharatesh Chakravarthi
//Affiliation: VE Lab, Chung Ang University, Seoul, South Korea.

public class Line extends JPanel implements ActionListener
{
  private static final long serialVersionUID = 1L;
  private vtkPanel renWin;
  private JButton exitButton;

  // -----------------------------------------------------------------
  // Load VTK library and print which library was not properly loaded
  static
  {
    if (!vtkNativeLibrary.LoadAllNativeLibraries())
    {
      for (vtkNativeLibrary lib : vtkNativeLibrary.values())
      {
        if (!lib.IsLoaded())
        {
          System.out.println(lib.GetLibraryName() + " not loaded");
        }
      }
    }
    vtkNativeLibrary.DisableOutputWindow(null);
  }
  // -----------------------------------------------------------------

  public Line()
  {
    super(new BorderLayout());
    double p0[] = new double[] {1.0,0.0,0.0};
    double p1[] = new double[] {0.0,1.0,0.0};

    //Create a Line
    vtkLineSource LineSource = new vtkLineSource();
    LineSource.SetPoint1(p0);
    LineSource.SetPoint1(p1);

    //Create a Mapper and Actor
    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();
    Mapper.SetInputConnection(LineSource.GetOutputPort());

    vtkActor Actor = new vtkActor();
    Actor.SetMapper(Mapper);
    Actor.GetProperty().SetColor(0.0, 0.5, 0.5);
    Actor.GetProperty().SetLineWidth(5);

    renWin = new vtkPanel();
    renWin.GetRenderer().AddActor(Actor);
    renWin.GetRenderer().SetBackground(0.0, 0.1, 0.1);
    renWin.resetCamera();

    //Add Java UI components
    exitButton = new JButton("Exit");
    exitButton.addActionListener(this);

    add(renWin, BorderLayout.CENTER);
    add(exitButton, BorderLayout.SOUTH);
  }

  /** An ActionListener that listens to the button. */
  public void actionPerformed(ActionEvent e)
  {
    if (e.getSource().equals(exitButton))
    {
      System.exit(0);
    }
  }

  public static void main(String s[])
  {
    SwingUtilities.invokeLater(new Runnable()
      {
        public void run()
        {
          JFrame frame = new JFrame("Line");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.getContentPane().setLayout(new BorderLayout());
          frame.getContentPane().add(new Line(), BorderLayout.CENTER);
          frame.setSize(400, 400);
          frame.setLocationRelativeTo(null);
          frame.setVisible(true);
        }
      });
  }
}


text:
Index

Wat is DNSCheck?

Wat is DNS?

Over www.dnscheck.se

Waarom een nieuwe DNSCheck?

Hoe werkt DNScheck?

Hoe kan DNSCheck mij helpen?

DNSCheck geeft "fouten" en "waarschuwingen" op mijn domein, wat betekent dat?

Hoe kan DNSCheck bepalen wat goed of fout is?

Ondersteund DNSCheck IPv6?

Ondersteund DNSCheck DNSSEC?

Wat maakt DNSCheck anders dan andere zone controle software?

Werkt DNSCheck voor een niet-.se-domein?

DNSCheck en privacy

Waarom kan ik mijn domein niet testen?

Wat voor soort vragen stelt de DNSCheck?

Wat is een 'undelegated' domein test?

Wat is DNSCheck?

			DNSCheck is bedoeld om de juiste configuratie en
			werking van nameservers voor een bepaald(e)
			domein(naam) te controleren.
			Een correcte configuratie van het Domain Name System
			(DNS) draagt bij aan de stabiliteit van het Internet. Wanneer u een domeinnaam
			ingeeft, zal DNScheck deze op tal van punten controleren
			en hiervan de resultaten na enige tijd tonen.
			Daarmee vergrijgt de gebruiker hopenlijk meer
			inzicht in de werking en het belang van het DNS.

Naar boven

Wat is DNS?

			Het domain name system (afgekort DNS) is een
			hiërarchisch naam-systeem op het Internet of
			lokaal netwerk, dat met name wordt gebruikt om voor mensen
			betekenisvolle labels te vertalen naar
			een binaire aanduiding geschikt voor computers. Denk
			bijvoorbeeld aan een domeinnaam (www.iis.se) die
			wordt omgezet naar een IP-adres (212.247.7.229).
			Het kan beschouwd worden als het "telefoonboek" van het Internet.
			Kort samengevat kan gesteld worden dat een stabiel,
			berouwbaar DNS van essentieel belang is.

Naar boven

Over www.dnscheck.se

De pagina www.dnscheck.se wijst naar een eerdere versie van DNSCheck die .SE ontwikkeld heeft met behulp van Patrik F?ltsr?m van Frobbit AB. De nieuwe versie van DNSCheck staat op dnscheck.iis.se en is ontwikkeld door Jakob Schlyter van Kirei AB.

Naar boven

Waarom een nieuwe DNSCheck?

			.SE wilde een betere controle over de code en ook meer mogelijkheden om delen van deze code in andere projecten op te nemen. Vandaar dat we tot de conclusie kwamen dat het een beter idee was om het produkt van de grond af opnieuw op te bouwen met een modulaire codebase.
			Zodoende konden we nieuwe features zoals bijvoorbeeld ipv6- en dnssec controle toevoegen.

Naar boven

Hoe werkt de DNSCheck?

Voor technische informatie over de DNSCheck kunt
			u kijken op de Wiki van het DNScheck
			open source project Zie voor een minder
			technisch antwoord de vraag Wat is DNSCheck?.

Naar boven

Hoe kan DNSCheck mij helpen?

De huidige versie van DNSCheck is gemaakt voor technici of in ieder geval mensen die meer willen weten over hoe het DNS werkt. Als u puur wilt zien wie de baas is over uw domein (de tech-c or technische staf bij uw name server provider) dat er in feite een probleem is met uw domein kunt u de link gebruiken die onderaan de pagina verschijnt na iedere test. Dus als u een test heeft gedraaid en u wilt het specifieke resultaat aan iemand laten zien, kunt u gewoon de link onderaan de pagina die uw testresultaten toont kopieren.

Naar boven

DNSCheck geeft "fouten" en "waarschuwingen" op mijn domein, wat betekent dat?

			Dat is, vanzelfsprekend, afhankelijk van welke test
			de melding heeft opgeleverd. In veel gevallen kunt u
			de melding aanklikken voor een nadere toelichting.

Stel dat een test van de domeinnaam
			"iis.se" de volgende fout geeft: "ns.nic.se (212.247.7.228)
			geeft geen antwoord op queries via UDP".
			Wat wil dat dan zeggen? Nadat we op de foutmelding geklikt hebben, kijgen we meer informatie te zien:
			"De nameserver reageerde niet op queries via UDP. Waarschijnlijk als gevolg van een configuratie fout".
			Dat vergt nader onderzoek. Wellicht een fout in uw
			firewall? Gelukkig gaat het hier slechts om een
			voorbeeld want de betreffende fout geeft feitelijk
			aan dat de nameserver niet bereikbaar is (via IPv6
			althans). Dat is beslist niet de meest onschuldige fout die denkbaar
			is.

Naar boven

Hoe kan DNSCheck bepalen wat goed of fout is?

Er is geen ondubbelzinnig oordeel over de kwaliteit van een domein waarin een ieder zich volledig kan vinden. Dit is erg belangrijk. .SE en de mensen achter DNSCheck beweren niet dat het resultaat van de DNSCheck altijd de volledige waarheid is.
			Meningen verschillen soms, zeker tussen landen, maar ook soms lokaal. We hebben het geluk gehad hulp te krijgen van een zeer competente DNS-groep hier in Zweden.
			Hopelijk heeft hun mening in combinatie met die van ons gezorgd voor een goede afweging tussen wat werkelijk een potentieel gevaarlijke fout is en wat enkel als een
			opmerking of waarschuwing gezien kan worden.

			Maar zoals met alle zaken rond DNS verandert de situatie voortdurend en kan wat nu gezien wordt als een opmerking morgen een foutmelding zijn.
			Als u werkelijk denkt dat we een fout hebben gemaakt in onze beoordeling, aarzel niet en stuur ons een mailtje naar dnscheck@iis.se met een link naar uw test en
			een uitleg over waarom u denkt dat de beoordeling foutief is.

			DNScheck kan nog tekortkomingen hebben, in het
			bijzonder in onderdelen waari vertrouwd wordt op
			diensten van derden, zoals het bepalen van het
			AS-nummer op basis van een IP-adres.

			Mocht u van mening zijn dat de applicatie een
			beoordelingsfout heeft gemaakt, schroom dan niet om
			contact met ons op te nemen. Stuurt u in een e-mail
			de link van de test in kwestie, voorzien van uw
			toelichting.

Naar boven

Ondersteunt DNSCheck IPv6?

Uiteraard.

Naar boven

Ondersteunt DNSCheck DNSSEC?

Ja.

Naar boven

Wat maakt DNSCheck anders dan andere zone controle software?

Ten eerste slaat DNSCheck alle historie van eerdere testen op, wat betekent dat u terug kunt gaan naar een test die u een week geleden hebt gedaan en deze vergelijken met een test die u net heeft gedaan.

			DNSCheck controleert ook of de name servers die vroeger gebruikt werden voor een zone niet langer informatie over de zone die u aan het testen bent bevatten (dit geldt enkel voor .SE-domeinen die na februari 2007 gedelegeerd zijn).

DNSCheck probeert ook de foutmelding/waarschuwing die u krijgt op een goede manier uit te leggen, hoewel deze meldingen soms moeilijk zijn te begrijpen voor een niet-technisch gebruikers. De volgende versie van DNSCheck, die later dit jaar uitkomt, zal beter aansluiten voor niet-technische gebruikers.

DNSCheck zal voortdurend de .SE-zone controleren en de gezondheid in de database rapporteren.

Er is een "advanced" tab voor technici die mogelijk de DNSCheck willen gebruiken zonder de "basic" view.

Ten slotte, deze open source versie van DNSCheck is gebouwd in modulaire code wat in principe betekent dat u onderdelen kunt gebruiken in uw systemen, als u dat wilt. Het is bijvoorbeeld niet nodig dat u het complete programma gebruikt om alleen redelegations te checken.

Naar boven

Werkt DNSCheck voor een niet-.se-domein

Ja. Alle checks die voor .SE-domeinen worden gedaan, worden ook op uw zone uitgevoerd. Echter, de periodieke run over de database (in principe de automatische checks) worden alleen uitgevoerd op .SE-domeinen. Voor de rest is de test identiek.

Naar boven

DNSCheck en privacy

Omdat DNSCheck voor iedereen beschikbaar is,
                        kunnen derden uw domein aan een test onderwerpen,
                        alsmede de testgeschiedenis opvragen en raadplegen.
                        Er is echter geen manier om te achterhalen wie een
                        specifieke test heeft aangevraagd, aangezien alleen
                        het tijdstip van de test wordt vastgelegd en verder
                        niets.

Naar boven

Waarom kan ik mijn domein niet testen?

Los van de mogelijkheid dat u een niet bestaande
                        domeinnaam heeft opgegeven zijn er twee opties:

1. Ter bescherming van de applicatie kan vanaf elk
			IP-adress niet vaker dan 1 x per 5 minuten een test
			gedaan worden. Probeert u het vaker, dan krijgt u
			eerdere testresultaten te zien.

2. Er is iets anders aan de hand. Laat het ons aub
			 weten, zodat wij het probleem in onderzoek kunnen
			 nemen.

Naar boven

Wat voor soort vragen stelt de DNSCheck?

Deze vraag is moeilijk te beantwoorden omdat DNSCheck verschillende vragen stelt afhankelijk van hoe uw name servers vragen beantwoorden. De gemakkelijkste manier om een volledig overzicht te krijgen welke vragen worden gesteld is door het ?dnscheck? CLI commando te gebruiken en de vlag ?--raw? aan te zetten. Hierdoor krijgt u behoorlijk uitgebreide informatie over wat er gebeurt. De output van deze CLI-tool is echter zeer technisch dus tenzij u verstand hebt van bits en bytes wilt u deze stap misschien overslaan. :)

Naar boven

Wat is een 'undelegated' domein test

Een 'undelegated' domein test is a test die wordt
                        uitgevoerd op een domein dat mogelijkerwijs nog niet
                        volledig is opgenomen in het DNS. Bijvoorbeeld omdat
                        deze nog niet is geregistreerd, terwijl de
                        autoritative nameservers al wel zijn voorbereid.

Een andere scenario is wanneer een domeinnaam
                        verhuist gaat worden van de ene registrar naar de
                        andere. U kunt de nieuwe nameservers voorbereiden en
                        deze controleren m.b.v. DNSCheck, voordat de
                        verhuizing in gang gezet wordt.

Naar boven


text:
@class DrinkConsumption;

@interface HistoryCellViewModel : RVMViewModel

- (id)initWithConsumption:(DrinkConsumption *)consumption;

@property (readonly) NSAttributedString *title;
@property (readonly) NSString *caffeine;
@property (readonly) NSString *size;
@property (readonly) NSString *timestamp;

@property (readonly) BOOL showSize;

@property (readonly) DrinkConsumption *consumption;

@end


text:
@extends('layouts_new.profileBase')

@section('title', $fullName)

@section('form')

<form class="form-horizontal scene_element scene_element--fadein" id="account_form" method="POST" action="{{ route('profile.password.update') }}">

			 {{ Lang::get('messages.proposition.back') }}

	@if (session('status'))

		    	{{ session('status') }}

	@endif

has('old_password')) has-error @endif">
		{{ Lang::get('messages.profile.password.old') }}

			<input type="password" class="form-control" id="old_password" name="old_password" placeholder="{{ Lang::get('messages.profile.password.enter_old') }}">
			@if ($errors->has('old_password')) {{ $errors->first('old_password') }}@endif

has('new_password')) has-error @endif">
		{{ Lang::get('messages.profile.password.new') }}

			<input type="password" class="form-control" id="new_password" name="new_password" placeholder="{{ Lang::get('messages.profile.password.enter_new') }}">
			@if ($errors->has('new_password')) {{ $errors->first('new_password') }}@endif

has('new_password_confirmation')) has-error @endif">
		{{ Lang::get('messages.profile.password.new_confirm') }}

			<input type="password" class="form-control" id="new_password_confirmation" name="new_password_confirmation" placeholder="{{ Lang::get('messages.profile.password.enter_new_confirm') }}">
			@if ($errors->has('new_password_confirmation')) {{ $errors->first('new_password_confirmation') }}@endif

    {{ csrf_field() }}

			<button type="submit" class="btn btn-default">{{ Lang::get('messages.profile.password.submit') }}</button>

</form>
@stop


text:
#ifndef _JPETANALYSISMODULE_SDAMAKEPHYSSIGNALS_H_
#define _JPETANALYSISMODULE_SDAMAKEPHYSSIGNALS_H_

#include <TCanvas.h>
#include "../../JPetUserTask/JPetUserTask.h"

class SDAMakePhysSignals: public JPetUserTask
{
public:
  SDAMakePhysSignals(const char* name);
  virtual ~SDAMakePhysSignals();
  virtual bool exec() override;
private:
};

#endif


text:
package org.multibit.network;

import org.multibit.controller.Controller;
import org.multibit.controller.bitcoin.BitcoinController;

import com.google.dogecoin.core.BlockChain;
import com.google.dogecoin.core.NetworkParameters;
import com.google.dogecoin.core.PeerGroup;

public class MultiBitPeerGroup extends PeerGroup {
    private final Controller controller;
    private final BitcoinController bitcoinController;
    MultiBitDownloadListener multiBitDownloadListener = null;

    public static final int MAXIMUM_NUMBER_OF_PEERS = 6;

    public MultiBitPeerGroup(BitcoinController bitcoinController, NetworkParameters params, BlockChain chain) {
        super(params, chain);
        this.bitcoinController = bitcoinController;
        this.controller = this.bitcoinController;
        multiBitDownloadListener = new MultiBitDownloadListener(this.bitcoinController);

        setMaxConnections(MAXIMUM_NUMBER_OF_PEERS);
    }

    /**
     * Download the blockchain from peers.
     *
     * <p>This method wait until the download is complete.  "Complete" is defined as downloading
     * from at least one peer all the blocks that are in that peer's inventory.
     */
    @Override
    public void downloadBlockChain() {
        startBlockChainDownload(multiBitDownloadListener);
    }

    public MultiBitDownloadListener getMultiBitDownloadListener() {
        return multiBitDownloadListener;
    }
}


text:
#ifndef MULTI_GATHER_PLUGIN_H
#define MULTI_GATHER_PLUGIN_H

#include "NvInferPlugin.h"
#include <string>
#include <vector>

using namespace nvinfer1;

class MultiGatherPlugin : public IPluginV2IOExt
{
public:
    MultiGatherPlugin(int tensorCount, DataType dataType);

    // Deserializing constructor
    MultiGatherPlugin(const void* data, size_t length);

    MultiGatherPlugin() = delete;

    const char* getPluginType() const override;

    const char* getPluginVersion() const override;

    int getNbOutputs() const override;

    Dims getOutputDimensions(int index, const Dims* inputs, int nbInputDims) override;

    DataType getOutputDataType(int index, const DataType* inputTypes, int nbInputs) const override;

    bool isOutputBroadcastAcrossBatch(int outputIndex, const bool* inputIsBroadcasted, int nbInputs) const override;

    bool canBroadcastInputAcrossBatch(int inputIndex) const override;

    void configurePlugin(const PluginTensorDesc* in, int nbInput, const PluginTensorDesc* out, int nbOutput) override;

    bool supportsFormatCombination(int pos, const PluginTensorDesc* inOut, int nbInputs, int nbOutputs) const override;

    int initialize() override;

    void terminate() override;

    size_t getWorkspaceSize(int maxBatchSize) const override;

    int enqueue(int batchSize, const void* const* inputs, void** outputs, void* workspace, cudaStream_t stream) override;

    size_t getSerializationSize() const override;

    void serialize(void* buffer) const override;

    void destroy() override;

    IPluginV2Ext* clone() const override;

    void setPluginNamespace(const char* pluginNamespace) override;

    const char* getPluginNamespace() const override;

private:
    int mTensorCount;
    DataType mDataType;
    int mOutputVectorCount;
    std::vector<int> mVectorLengths;
    std::vector<int> mSrcVectorCounts;
    std::string mNamespace;
};

class MultiGatherPluginCreator : public IPluginCreator
{
public:
    MultiGatherPluginCreator();

    const char* getPluginName() const override;

    const char* getPluginVersion() const override;

    const PluginFieldCollection* getFieldNames() override;

    IPluginV2* createPlugin(const char* name, const PluginFieldCollection* fc) override;

    IPluginV2* deserializePlugin(const char* name, const void* serialData, size_t serialLength) override;

    void setPluginNamespace(const char* pluginNamespace) override;

    const char* getPluginNamespace() const override;

private:
    static PluginFieldCollection mFC;
    static std::vector<PluginField> mPluginAttributes;
    std::string mNamespace;
};

#endif


text:
RoomServiceDemo
===============

Simple Room Service demo. You can query which room you're in, contribute new rooms / data to the database, and see the hit rate through the Validation interface

Troubleshooting:
If the classes from Android Library cannot be resolved, check that you have
1. Imported the Android Library to your workspaceadded the library.
2. RoomServiceDemo has added the RoomServiceAndroidLibrary as its library.
Steps for item 2:
1 right click your project folder, click properties
2 on the left hand side, click the 'Android' tab
3 on the right hand side, 'Add' the Library project
4 You may need to restart eclipse now. It is a known bug of SDK.


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Uses of Interface at.irian.ankor.serialization.MessageDeserializer (Ankor - Project 0.2-SNAPSHOT API)</title>
<meta name="date" content="2014-04-07">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Interface
at.irian.ankor.serialization.MessageDeserializer

Packages that use MessageDeserializer

Package
Description

at.irian.ankor.serialization

at.irian.ankor.serialization.json.simpletree

at.irian.ankor.serialization.json.viewmodel

at.irian.ankor.switching.connector.socket

at.irian.ankor.switching.connector.websocket

Uses of MessageDeserializer in at.irian.ankor.serialization

Subinterfaces of MessageDeserializer in at.irian.ankor.serialization

Modifier and Type
Interface and Description

interface
MessageMapper<T>

A MessageMapper is responsible of serializing and deserializing messages for the transport layer.

Uses of MessageDeserializer in at.irian.ankor.serialization.json.simpletree

Classes in at.irian.ankor.serialization.json.simpletree that implement MessageDeserializer

Modifier and Type
Class and Description

class
SimpleTreeJsonMessageMapper

MessageMapper that can map client-side generic (map-based) view data structures to json and vice versa.

Uses of MessageDeserializer in at.irian.ankor.serialization.json.viewmodel

Classes in at.irian.ankor.serialization.json.viewmodel that implement MessageDeserializer

Modifier and Type
Class and Description

class
ViewModelJsonMessageMapper

MessageMapper that can map server-side strongly typed(!)

Uses of MessageDeserializer in at.irian.ankor.switching.connector.socket

Constructors in at.irian.ankor.switching.connector.socket with parameters of type MessageDeserializer

Constructor and Description

SocketListener(String systemName,
              URI localAddress,
              MessageDeserializer<String> messageDeserializer,
              Switchboard switchboard,
              PathSyntax pathSyntax)

Uses of MessageDeserializer in at.irian.ankor.switching.connector.websocket

Methods in at.irian.ankor.switching.connector.websocket that return MessageDeserializer

Modifier and Type
Method and Description

static MessageDeserializer<String>
WebSocketConnector.getSingletonMessageDeserializer(AnkorSystem ankorSystem)

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2014. All rights reserved.


text:
<?php
/* Development */
define( 'SAVEQUERIES', true );
define( 'WP_DEBUG', true );
define( 'SCRIPT_DEBUG', true );
define( 'JETPACK_DEV_DEBUG', true );


text:
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DatenMeister.Core;
using DatenMeister.Core.EMOF.Interface.Reflection;
using DatenMeister.Core.Runtime.Workspaces;
using DatenMeister.Core.Uml.Helper;
using DatenMeister.Json;
using DatenMeister.Types;
using Microsoft.AspNetCore.Mvc;

namespace DatenMeister.WebServer.Controller
{
    [Microsoft.AspNetCore.Components.Route("api/[controller]/[action]")]
    [ApiController]
    public class TypesController : ControllerBase
    {
        private readonly IWorkspaceLogic _workspaceLogic;
        private readonly IScopeStorage _scopeStorage;
        private readonly LocalTypeSupport _localTypeSupport;

        public TypesController(IWorkspaceLogic workspaceLogic, IScopeStorage scopeStorage)
        {
            _workspaceLogic = workspaceLogic;
            _scopeStorage = scopeStorage;

            _localTypeSupport = new LocalTypeSupport(_workspaceLogic, _scopeStorage);
        }

        [HttpGet("api/types/all")]
        public ActionResult<List<ItemWithNameAndId>> GetTypes()
        {
            var result = new List<ItemWithNameAndId>();

            var allTypes = _localTypeSupport.GetAllTypes();

            result.AddRange(
                allTypes.OfType<IObject>().Select(o => ItemWithNameAndId.Create(o)!));

            return result;
        }

        /// <summary>
        /// Gets the property type of a certain property within a metaclass.
        /// This is a helper-method for the SubElements View, so the user gets already the right
        /// property type pre-selected when he wants to create a new subelement
        /// </summary>
        /// <param name="workspace">Name of the queried workspace</param>
        /// <param name="metaClass">Metaclass of the element to which a new element shall
        /// be created within one of its properties</param>
        /// <param name="propertyName">Name of the property to which the subelement
        /// shall be added to. </param>
        /// <returns>The item with name and id containing the type of the property</returns>
        [HttpGet("api/types/propertytype/{workspace}/{metaClass}/{propertyName}")]
        public ActionResult<ItemWithNameAndId?> GetPropertyType(string workspace, string metaClass, string propertyName)
        {
            workspace = HttpUtility.UrlDecode(workspace);
            metaClass = HttpUtility.UrlDecode(metaClass);
            propertyName = HttpUtility.UrlDecode(propertyName);

            var foundMetaClass = _workspaceLogic.GetWorkspace(workspace)?.FindObjectByUri(metaClass);
            if (foundMetaClass == null)
            {
                return NotFound($"MetaClass '{workspace}-{metaClass}' is not found");
            }

            var property = ClassifierMethods.GetPropertyOfClassifier(foundMetaClass, propertyName);
            if (property == null)
            {
                return NotFound($"Property {propertyName} is not found");
            }

            var propertyType =
                PropertyMethods.GetPropertyType(property);
            if (propertyType == null)
            {
                return new ActionResult<ItemWithNameAndId?>((ItemWithNameAndId?) null);
            }

            return ItemWithNameAndId.Create(propertyType);
        }
    }
}