text:
package com.paprikapp.iothunder.communication;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketAddress;

import timber.log.Timber;

/**
 * ICommunicator implementation using only classes available in Java.
 * The communicator starts its own {@link Thread} in which it is waiting for data from the server,
 * and notifies the {@link OnDataReceivedListener} from this {@link Thread}.
 */
public class SimpleSocketCommunicator implements ICommunicator {
    private String address;
    private int port;

    private Thread thread;
    private Socket socket;
    private PrintWriter writer;
    private BufferedReader reader;
    private OnDataReceivedListener listener;

    @Override
    public void setEndpoint(String address, int port) {
        this.address = address;
        this.port = port;
        this.thread = new Thread(new ClientDataNodeRunnable());
        this.thread.start();
    }

    @Override
    public void setListener(OnDataReceivedListener listener) {
        this.listener = listener;
    }

    @Override
    public void sendData(String data) {
        Timber.v("sendData called");
        if (writer != null) {
            writer.println(data + "\r");
            Timber.v("Sent: " + data);

            if (listener != null) {
                listener.onDataSent();
            }
        } else {
            if (listener != null) {
                listener.onDataLost();
            }
        }
    }

    @Override
    public void disconnect() {
        Timber.v("Disconnecting from: " + address + ":" + port);
        cleanUp();
    }

    /**
     * Frees up resources and to close all the connections properly.
     */
    private synchronized void cleanUp() {
        Timber.v("Cleaning up: " + address + ":" + port);
        try {
            if (socket != null) {
                if (socket.isConnected()) {
                    socket.shutdownInput();
                    socket.shutdownOutput();
                }
                socket.close();
                socket = null;
            }
        } catch (IOException e) {
            e.printStackTrace();
            socket = null;
        }

        try {
            if (reader != null) {
                reader.close();
                reader = null;
            }
        } catch (IOException e) {
            e.printStackTrace();
            reader = null;
        }

        if (writer != null) {
            writer.close();
            writer = null;
        }
    }

    /**
     * This {@link Runnable} implementation is used in a {@link Thread} to connect to the server
     * on the address and port specified in the communicator and to listen on the reader for incoming data.
     */
    class ClientDataNodeRunnable implements Runnable {
        private static final int TIMEOUT = 5000;
        public void run() {
            String input = null;
            try {
                Timber.v("Connecting to " + address + ":" + port);

                InetAddress serverAddress = InetAddress.getByName(address);
                SocketAddress socketAddress = new InetSocketAddress(serverAddress, port);

                socket = new Socket();
                socket.connect(socketAddress, TIMEOUT);
                writer = new PrintWriter(socket.getOutputStream(), true);
                reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));

                Timber.v("Connected to " + address + ":" + port);
                if (listener != null) {
                    listener.onConnected();
                }

                while ((input = reader.readLine()) != null) {
                    Timber.v("Received: " + input);
                    if (listener != null) {
                        listener.onReceive(input);
                    }
                }
            } catch (Exception e) {
                Timber.v("Socket exception: " + e.toString());
            } finally {
                // close connection
                cleanUp();
            }

            Timber.v("Thread exit");
            Timber.v("input: " + ((input == null) ? "null" : input));
            if (listener != null) {
                listener.onDisconnected();
            }
        }
    }
}


text:
import { NgModule, ModuleWithProviders } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { RoundPipe } from './round.pipe';
import { KeysPipe } from './keys.pipe';

export { RoundPipe } from './round.pipe';
export { KeysPipe } from './keys.pipe';

const PIPES = [
    RoundPipe,
    KeysPipe
];

@NgModule({
    imports: [
        BrowserModule
    ],
    declarations: PIPES,
    exports: PIPES
})
export class PipesModule {
    static forRoot(): ModuleWithProviders { return {ngModule: PipesModule, providers: []}; }
}

redpajama_set_name: RedPajamaGithub


text:
using NutriStore.DAL.Contexto;
using NutriStore.Model.Data;
using NutriStore.Model.Entity;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System;

namespace NutriStore.DAL
{
    /// <summary>
    /// =======================================================================
    /// Author:         Carvalho, Gabriel
    /// Create date:    04/06/2017
    /// Description:    Repositorio
    /// Public
    /// Parameters:
    /// Public
    /// Methods:        void Delete(Alimento entidade)
    ///                 Alimento Get(int id)
    ///                 IEnumerable<Alimento> ListarGrupoDAlimento
    ///                 void Save(Alimento entidade)
    ///                 List<Alimento> ConvertTable(DataTable tb)
    /// Dependencies:   Dal
    /// =======================================================================
    /// </summary>
    public class AtividadeFisicaDAL : Dal<AtividadeFisica>, IAtividadeFisicaDAL
    {
        public void Delete(AtividadeFisica entidade)
        {
            using (Contexto = new Dil())
            {
                Contexto.AddParameter("@AtividadeFisicaId", entidade.AtividadeFisicaId);

                Contexto.ExecuteStoredProcedureNonQuery("sp_DeleteAtividadeFisica");
            }
        }

        public AtividadeFisica Get(int id)
        {
            DataTable table = null;

            using (Contexto = new Dil())
            {
                Contexto.AddParameter("@AtividadeFisicaId", id);

                table = Contexto.ExecuteStoredProcedureQuery("sp_GetAtividadeFisica");
            }

            return ConvertTableToEntity(table)[0];
        }

        public List<AtividadeFisica> GetAtividadeDieta(int dietaId)
        {

            DataTable table = null;

            using (Contexto = new Dil())
            {
                Contexto.AddParameter("@DietaId", dietaId);

                table = Contexto.ExecuteStoredProcedureQuery("sp_GetAtividadeDieta");
            }

            return ConvertTableToEntity(table);
        }

        public IEnumerable<AtividadeFisica> Listar(string pesquisa)
        {
            DataTable tb;

            using (Contexto = new Dil())
            {
                Contexto.AddParameter("@Pesquisa", pesquisa);

                tb = Contexto.ExecuteStoredProcedureQuery("sp_ListAtividadeFisica");
            }

            return ConvertTableToEntity(tb);
        }

        public void Save(AtividadeFisica entidade)
        {
            using (Contexto = new Dil())
            {
                Contexto.AddParameter("@AtividadeFisicaId", entidade.AtividadeFisicaId);
                Contexto.AddParameter("@Nome", entidade.Nome.ToLower());
                Contexto.AddParameter("@Categoria", entidade.Categoria.ToLower());
                Contexto.AddParameter("@CaloriapHora", entidade.CaloriapHora);
                Contexto.AddParameter("@Descricao", entidade.Descricao.ToLower());

                entidade.AtividadeFisicaId = (int)Contexto.ExecuteStoredProcedureScalar("sp_SaveAtividadeFisica");
            }
        }

        internal override List<AtividadeFisica> ConvertTableToEntity(DataTable table)
        {
            return (from DataRow registro in table.Rows
                    select new AtividadeFisica()
                    {

                        AtividadeFisicaId = int.Parse(registro["AtividadeFisicaId"].ToString()),
                        Nome = registro["Nome"].ToString(),
                        Categoria = registro["Categoria"].ToString(),
                        CaloriapHora = double.Parse(registro["CaloriapHora"].ToString()),
                        Descricao = registro["Descricao"].ToString()
                    }).ToList();
        }
    }
}


text:
package main

import (
	"fmt"
	"sync"
	"time"
)

type LockeAbleNotEmbeded struct {
	lock           sync.Mutex
	readableInt    int
	readableString string
}

func main() {
	l := &LockeAbleNotEmbeded{}
	go func() {
		for {
			time.Sleep(time.Second * 15)
			l.read("one")
		}
	}()

	go func() {
		for {
			time.Sleep(time.Second * 10)
			l.write("two", "hello", 5)
		}
	}()

	l.lock.Lock()
	l.lock.Unlock()
	l.read("one")

	select {}
}

func (l *LockeAbleNotEmbeded) read(st string) {
	l.lock.Lock()
	fmt.Println("just Locked by", st, "for reading")
	fmt.Println(l.readableInt, l.readableString)
	l.lock.Unlock()
	fmt.Println("just UnLocked", st, "from reading")
}

func (l *LockeAbleNotEmbeded) write(st string, val string, valInt int) {
	l.lock.Lock()
	fmt.Println("just Locked by", st, "for writing")
	l.readableString = val
	l.readableInt = valInt
	l.lock.Unlock()
	fmt.Println("just UnLocked", st, "from writing")
}


text: bash /scripts/provision/smbpasswd_helper.sh -o add -f /config/users.txt


text:
const exec = require('child_process').exec;

// exec('ls -al',function(error,stdout,stderr){
//   if(error){
//     console.error('error:'+error);
//     return;
//   }
//   console.log('stdout:'+stdout);
//   console.log('stderr:'+typeof stderr);
// });
//
// exec('ls hello.text',function(error,stdout,stderr){
//   if(error){
//     console.error('error:'+error);
//     return;
//   }
//   console.log('stdout:'+stdout);
//   console.log('stderr:'+typeof stderr);
// });

const spawn = require('child_process').spawn;
const ls = spawn('ls', ['-lh', '/usr']);

ls.stdout.on('data', (data) => {
  console.log(`stdout: ${data}`);
});

ls.stderr.on('data', (data) => {
  console.log(`stderr: ${data}`);
});

ls.on('close', (code) => {
  console.log(`child process exited with code ${code}`);
});


text:
package org.apache.flink.util;

import org.apache.flink.annotation.Internal;

import java.util.Optional;
import java.util.stream.Stream;

/** Utilities for working with {@link Optional}. */
@Internal
public class OptionalUtils {

    /**
     * Converts the given {@link Optional} into a {@link Stream}.
     *
     * <p>This is akin to {@code Optional#stream} available in JDK9+.
     */
    @SuppressWarnings("OptionalUsedAsFieldOrParameterType")
    public static <T> Stream<T> stream(Optional<T> opt) {
        return opt.map(Stream::of).orElseGet(Stream::empty);
    }

    /** Returns the first {@link Optional} which is present. */
    @SafeVarargs
    public static <T> Optional<T> firstPresent(Optional<T>... opts) {
        for (Optional<T> opt : opts) {
            if (opt.isPresent()) {
                return opt;
            }
        }

        return Optional.empty();
    }

    private OptionalUtils() {}
}


text:
export { SpinnerComponent } from './spinner.component';
export { SpinnerService } from './spinner.service';
export { SpinnerModule } from './spinner.module';


text:
<meta http-equiv="Content-Language" content="de">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Modul-Übersicht/-Hilfe - powered by CC2Net.de</title>
<base target="_self">

Modul-Übersicht / -Hilfe

U=Unit, Unit+Appl.Board

S=Station

RB=Unit+CC2-ReglerBoard

SB=Unit+CC2-StarterBoard

P5=C-Control Robot Project 5

      U
      S
      RB
      SB
      P5
      Modul
      Beschreibung
      Autor

      (X)
      X

      X
      asmcall.c2
      Adressmanager für Systemroutinen vom CTC in Segment 3

        (veraltet !!)

        nicht zusammen mit SP2.0 oder höher verwenden
        !

      CTC / Conrad

      X
      X
      X
      X
      X
      calendar.c2
      Datumsfunktionen
      Ralph Homann /
        André Helbig

      X
      ccpr5.c2
      Treiber für C-Control Robot Project 5 (CCRP5)
        V2.0
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      can.c2
      System-Modul für Hardware CAN-Bus
      Martin Förster (mafoe)

      X
      X
      X
      X
      X
      cap.c2
      System-Modul für erweiterte Captures
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      constant.c2
      System-Konstanten
      Martin Förster (mafoe)

      X
      X
      X
      X
      X
      ds1621.c2
      Treiber für DS1621 9-Bit I²C-Bus-Temperatursensor
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      ds1631.c2
      Treiber für DS1631 12-Bit I²C-Bus-Temperatursensor
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      ds2482.c2
      Treiber für DS2482-100
        I²C-Bus-1WireBridge
      André Helbig / CC2Net.de

      X
      X
      X
      X

      dynlcd.c2
      Treiber für EA Dynamische LCDs an SWCOM
      Günter Welzel

      X
      X
      X
      X
      X
      eeprom.c2
      Treiber für serielle EEProms(I²C) und
        Speicherchipkarten

        24C32 bis
        24C512
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      eeprom2k.c2
      Treiber für serielle EEProms(I²C) und
        Speicherchipkarten

        24C02 & 24C01
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      fs20.c2
      Treiber für FS20
        Funksystem
      Hans-Jörg
        Schuschke

      X
      X
      X
      X
      X
      geo.c2
      Berechnung des
        Örtlichen Sonnenauf- und Untergangs
      Wolfgang Fast

      X
      X
      X
      X
      X
      gp2d02.c2
      Treiber für Distanzmeßsensor GP2D02
      Andreas Strecker

      X
      X
      X
      X
      X
      hwcom.c2
      System-Modul für Hardware RS232

      Martin Förster

        V1.2 André Helbig

      X
      X
      X
      X
      X
      i2c.c2
      System-Modul für I²C-bus

      Martin Förster

        V1.2 André Helbig

      X
      X
      X
      X
      X
      i2ccom.c2
      Treiber für RS232 I²C-Bus Interface von
        CCTools
      André Helbig / CCTools

      X
      X
      X
      X
      X
      i2cext.c2
      Treiber für weitere I²C-Busse an I/O-Ports
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      i2ckop.c2
      Treiber für CCTools I²C-Koppler zum
        Verbinden

        mehrerer Controller (z.B. CC1 mit CC2) über I²C-Bus
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      i2cmux.c2
      Treiber für I²C-Multiplexer mit MAX4572

        (CCTools I2C-MUX4 HS & I2C-MUX7)
      André Helbig / CC2Net.de

      X

      X
      X
      X
      inkremental.c2
      Treiber für Drehimpulsgeber über
        systemeigene

        Routinen
      Cris Ullmann

      X
      X
      X
      X
      X
      irctrl.c2
      Treiber für Conrad IRCTRL
      CTC / Conrad

      X

      X
      X
      X
      lcd.c2
      System-Modul für internes LCD der Unit

        (nur für "alte" CC2-Units mit Gehäuse/LCD)
      Martin Förster (mafoe)

      X
      X

      X
      X
      lcdext.c2
      Treiber für externes LC-Display an P1L im
        4Bit-Mode
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      leddisp.c2
      Treiber C-Control LED-7-Segment-Displays

        von Conrad
      Mario Fischer

      X

      lpt.c2
      System-Modul für LPT-Port
      Martin Förster (mafoe)

      X
      X
      X
      X
      X
      math.c2
      Mathematische Funktionen
      Martin Förster (mafoe)

      X
      X
      X
      X
      X
      mathx.c2
      erweiterte mathematische Funktionen
      Walter Goebel

      X
      X
      X
      X
      X
      max4572.c2
      Treiber für MAX4572 14fach I²C-Bus-Analog-Schalter
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      max520.c2
      Treiber für MAX520 4fach 8Bit I²C-Bus-DA-Wandler
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      max7311.c2
      Treiber für MAX7311 16Bit I²C-Bus-Portexpander
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      mem.c2
      Modul zur Manipulation von Bytepuffervariablen
      Martin Förster (mafoe)

        V2.0 André Helbig

      X
      X
      X
      X
      X
      modem.c2
      Treiber für Hayes-AT-kompatibles Modem

        an HWCOM
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      pcf.c2
      Treiber für PCF8574 Portexpander
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      pca9531.c2
      Treiber für PCA9531
         I²C-Bus LED-Dimmer
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      pcf8583.c2
      Treiber für PCF8583 u.a. f. PCF-UHR-WD
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      pcfad.c2
      Treiber für PCF8591 8-Bit-AD-Wandler
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      pcfcnt.c2
      Treiber für CCTools I2C-CNT8 Zählermodul
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      pcfkeyb.c2
      Treiber für Matrix-Tastatur am I²C-Bus
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      pcflcd.c2
      Standard-LC-Display am I²C-Bus
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      plm.c2
      Systemtreiber für PLM-Ports
      Martin Förster (mafoe)

      X
      X
      X
      X
      X
      ports.c2
      Systemtreiber für I/O-& AD-Ports
      Martin Förster (mafoe)

      X
      X
      X
      X
      X
      ps2.c2
      Treiber zum Anschluß einer AT-Tastatur
      Cris Ullmann

      X
      X
      X
      X
      X
      ram.c2
      Treiber für CC2Net-RAM-Device
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      ramhs4.c2
      Treiber für CCTools-RAM-Device
        HS 4MBit
      André Helbig / CC2Net.de

      ram_hs.c2
      Dieser Treiber ist
        veraltet; ram.c2 ab V2.0 für

        CC2Net-RAM-Device HS 2MBit verwenden !
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      random.c2
      Pseudo Zufallsgenerator
      Ralph Homann

      X

      X
      X
      X
      rbkeyb.c2
      Treiber für CCTools Tastaturinterfaces
      André Helbig / CC2Net.de

      X
      X

      rblcd.c2
      Treiber für externes LC-Display am
        CC2-ReglerBoard
      André Helbig / CC2Net.de

      X

      rbports.c2
      Treiber für erweiterte CC2-ReglerBoard Ports
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      saa1064.c2
      Treiber für I²C-Bus 7-Segment-LED-Treiber
        SAA1064
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      sfr.c2
      Modul zum Schreiben und Lesen einiger
        Systemregister
      Cris Ullmann

      X
      X
      X
      X
      X
      sht.c2
      Treiber für Sensirion Feuchte-&
        Temperatur-Sensoren
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      sms.c2

      CTC / Conrad

      X
      X
      X
      X
      X
      srin.c2
      Treiber für SR-Eingangserweiterungen
      André Helbig / CC2Net.de

      X

      X
      X
      X
      srlcd.c2
      Treiber für CCTools SR-LCD-Interface
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      srrel.c2
      Treiber für SR-Ausgangserweiterungen
      André Helbig / CC2Net.de

      X

      stports.c2
      Treiber für erweiterte Station-Ports
      André Helbig / CC2Net.de

      X

      stkeyb.c2
      Treiber für Station-Tastatur
      André Helbig / CC2Net.de

      X

      station_2wsm.c2
      Original-Stationtreiber 2W-Bus Modem f.RS232
      CTC / Conrad

      X

      station_io.c2
      Original-Stationtreiber für erweiterte Ports
        (veraltet !!)

        nicht zusammen mit SP2.0 oder höher verwenden
        !

        stports.c2 und stkeyb.c2 benutzen !
      CTC / Conrad

      X

      station_lcd.c2
      Original-Stationtreiber für Station-LC-Display
        (veraltet !!)

        nicht zusammen mit SP2.0 oder höher verwenden
        !

        lcdext.c2 benutzen !
      CTC / Conrad

      X

      station_plm.c2
      Original-Stationtreiber für Power-Line-Modem
      CTC / Conrad

      X

      station_twb.c2
      Original-Stationtreiber 2W-Bus Modem
      CTC / Conrad

      X
      X
      X
      X
      X
      str.c2
      System-Modul für String-Funktionen
      Martin Förster (mafoe)

      X
      X
      X
      X
      X
      strx.c2
      Erweiterte Stringfunktionen
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      swcom.c2
      System-Modul für Software RS232
      Martin Förster (mafoe)

      X
      X
      X
      X
      X
      system.c2
      System-Modul für Systeminterne Funktionen
      Martin Förster (mafoe)

        André Helbig / CC2Net.de

      X
      X
      X
      X

      touchlcd.c2
      Treiber für EA Bedieneinheiten an SWCOM.

        (Grafik-Touch-LCDs)
      André Helbig / CC2Net.de

      X
      X
      X
      X
      X
      trx.c2
      Treiber für TRX433 Tranceiver
      Dirk Ottensmeyer

      X
      X
      X
      X
      X
      twb.c2
      Systemtreiber für 2W-Bus Modem
      Martin Förster (mafoe)

      X
      X
      X
      X
      X
      twbs.c2
      Erweiterte Treiber für 2W-Bus Komponenten
      Martin Binder

      X
      X
      X
      X
      X
      vmcodes.c2
      Definition der VM-Maschienen-Codes
      Martin Förster (mafoe)


text:
  <title> TFI test images</title>
  <link rel="stylesheet" type="text/css" href="css/test.css">
  <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">

 Protocolos de Transferencia de Informacion - TFI


text:
package at.ac.tuwien.infosys.jcloudscale.messaging.objects.ui;

import at.ac.tuwien.infosys.jcloudscale.messaging.objects.MessageObject;

public class ListServersRequest extends MessageObject {

	private static final long serialVersionUID = 1L;

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.Runtime.InteropServices;

namespace InputOverlay.Model.Declerations
{
   public struct KEYINPUTTYPES
   {
      ///
      /// Posted to the window with the keyboard focus when a nonsystem key is
      /// pressed. A nonsystem key is a key that is pressed when the ALT key is
      /// not pressed.
      ///
      public const uint WM_KEYDOWN = 0x0100;

      ///
      /// Posted to the window with the keyboard focus when the user presses
      /// the F10 key (which activates the menu bar) or holds down the ALT key
      /// and then presses another key. It also occurs when no window currently
      /// has the keyboard focus; in this case, the WM_SYSKEYDOWN message is
      /// sent to the active window. The window that receives the message can
      /// distinguish between these two contexts by checking the context code
      /// in the lParam parameter.
      ///
      public const uint WM_SYSKEYDOWN = 0x0104;

      ///
      /// Posted to the window with the keyboard focus when a nonsystem key is
      /// released. A nonsystem key is a key that is pressed when the ALT key
      /// is not pressed, or a keyboard key that is pressed when a window has
      /// the keyboard focus.
      ///
      public const uint WM_KEYUP = 0x0101;

      ///
      /// Posted to the window with the keyboard focus when the user releases a
      /// key that was pressed while the ALT key was held down. It also occurs
      /// when no window currently has the keyboard focus; in this case, the
      /// WM_SYSKEYUP message is sent to the active window. The window that
      /// receives the message can distinguish between these two contexts by
      /// checking the context code in the lParam parameter.
      ///
      public const uint WM_SYSKEYUP = 0x0105;
   }

   ///
   /// Value type for raw input.
   ///
   [StructLayout(LayoutKind.Explicit)]
   public struct RAWINPUT
   {
      /// Header for the data.
      [FieldOffset(0)]
      public RAWINPUTHEADER Header;
      /// Mouse raw input data.
      [FieldOffset(16)]
      public RAWMOUSE Mouse;
      /// Keyboard raw input data.
      [FieldOffset(16)]
      public RAWKEYBOARD Keyboard;
      /// HID raw input data.
      [FieldOffset(16)]
      public RAWINPUTHID Hid;
   }

   ///
   /// Value type for a raw input header.
   ///
   [StructLayout(LayoutKind.Sequential)]
   public struct RAWINPUTHEADER
   {
      /// Type of device the input is coming from.
      public RawInputType Type;
      /// Size of the packet of data.
      public int Size;
      /// Handle to the device sending the data.
      public IntPtr Device;
      /// wParam from the window message.
      public IntPtr wParam;
   }

   ///
   /// Contains information about the state of the mouse.
   ///
   [StructLayout(LayoutKind.Explicit)]
   public struct RAWMOUSE
   {
      ///
      /// The mouse state.
      ///
      [FieldOffset(0)]
      public RawMouseFlags Flags;
      ///
      /// Flags for the event.
      ///
      [FieldOffset(4)]
      public RawMouseButtonFlags ButtonFlags;
      ///
      /// If the mouse wheel is moved, this will contain the delta amount.
      ///
      [FieldOffset(6)]
      public ushort ButtonData;
      ///
      /// Raw button data.
      ///
      [FieldOffset(8)]
      public uint RawButtons;
      ///
      /// The motion in the X direction. This is signed relative motion or
      /// absolute motion, depending on the value of usFlags.
      ///
      [FieldOffset(12)]
      public int LastX;
      ///
      /// The motion in the Y direction. This is signed relative motion or absolute motion,
      /// depending on the value of usFlags.
      ///
      [FieldOffset(16)]
      public int LastY;
      ///
      /// The device-specific additional information for the event.
      ///
      [FieldOffset(20)]
      public uint ExtraInformation;
   }

   /// The mouse state. This member can be any reasonable combination of the following.
   public enum RawMouseFlags : ushort
   {
      ///   Mouse movement data is relative to the last mouse position.
      MoveRelative = 0x00,
      ///  Mouse movement data is based on absolute position.
      MoveAbsolute = 0x01,
      ///  Mouse coordinates are mapped to the virtual desktop (for a multiple monitor system).
      VirtualDesktop = 0x02,
      ///  Mouse attributes changed; application needs to query the mouse attributes.
      AttributesChanged = 0x04,
   }

   ///
   /// The transition state of the mouse buttons.
   /// This member can be one or more of the following values.
   ///
   public enum RawMouseButtonFlags : ushort
   {
      ///   Left button changed to down.
      LeftButtonDown = 0x0001,
      ///   Left button changed to up.
      LeftButtonUp = 0x0002,
      ///   Right button changed to down.
      RightButtonDown = 0x0004,
      ///   Right button changed to up.
      RightButtonUp = 0x0008,
      ///   Middle button changed to down.
      MiddleButtonDown = 0x0010,
      ///   Middle button changed to up.
      MiddleButtonUp = 0x0020,
      ///  XBUTTON1 changed to down.
      Button4Down = 0x0040,
      ///  XBUTTON1 changed to up.
      Button4Up = 0x0080,
      ///  XBUTTON2 changed to down.
      Button5Down = 0x0100,
      ///  XBUTTON2 changed to up.
      Button5Up = 0x0200,
      ///  Raw input comes from a mouse wheel. The wheel delta is stored in usButtonData.
      MouseWheel = 0x0400
   }

   ///
   /// The command flag. This parameter can be one of the following values.
   ///
   public enum UICommand : uint
   {
      RID_INPUT = 0x10000003,
      RID_HEADER = 0x10000005
   }

   ///
   /// Value type for raw input from a keyboard.
   ///
   [StructLayout(LayoutKind.Sequential)]
   public struct RAWKEYBOARD
   {
      /// Scan code for key depression.
      public short MakeCode;
      /// Scan code information.
      public RawKeyboardFlags Flags;
      /// Reserved.
      public short Reserved;
      /// Virtual key code.
      public ushort VirtualKey;
      /// Corresponding window message.
      public uint Message;
      /// Extra information.
      public int ExtraInformation;
   }

   /// Flags for scan code information. It can be one or more of the following.
   public enum RawKeyboardFlags : ushort
   {
      /// The key is up.
      Break = 1,
      /// This is the left version of the key.
      E0 = 2,
      /// This is the right version of the key.
      E1 = 4,
      /// The key is down.
      Make = 0,
   }

   ///
   /// Value type for raw input from a HID.
   ///
   [StructLayout(LayoutKind.Sequential)]
   public struct RAWINPUTHID
   {
      /// Size of the HID data in bytes.
      public int Size;
      /// Number of HID in Data.
      public int Count;
      /// Data for the HID.
      public IntPtr Data;
   }

   /// Enumeration containing the Raw Input Type values.
   public enum RawInputType : uint
   {
      Mouse = 0,
      Keyboard = 1,
      HID = 2,
   }

   /// Enumeration containing flags for a raw input device.
   [Flags()]
   public enum RawInputDeviceFlags
   {
      /// No flags.
      None = 0,
      /// If set, this removes the top level collection from the inclusion list. This tells the operating system to stop reading from a device which matches the top level collection.
      Remove = 0x00000001,
      /// If set, this specifies the top level collections to exclude when reading a complete usage page. This flag only affects a TLC whose usage page is already specified with PageOnly.
      Exclude = 0x00000010,
      /// If set, this specifies all devices whose top level collection is from the specified usUsagePage. Note that Usage must be zero. To exclude a particular top level collection, use Exclude.
      PageOnly = 0x00000020,
      /// If set, this prevents any devices specified by UsagePage or Usage from generating legacy messages. This is only for the mouse and keyboard.
      NoLegacy = 0x00000030,
      /// If set, this enables the caller to receive the input even when the caller is not in the foreground. Note that WindowHandle must be specified.
      InputSink = 0x00000100,
      /// If set, the mouse button click does not activate the other window.
      CaptureMouse = 0x00000200,
      /// If set, the application-defined keyboard device hotkeys are not handled. However, the system hotkeys; for example, ALT+TAB and CTRL+ALT+DEL, are still handled. By default, all keyboard hotkeys are handled. NoHotKeys can be specified even if NoLegacy is not specified and WindowHandle is NULL.
      NoHotKeys = 0x00000200,
      /// If set, application keys are handled.  NoLegacy must be specified.  Keyboard only.
      AppKeys = 0x00000400
   }

   [StructLayout(LayoutKind.Sequential)]
   public struct RAWINPUTDEVICE
   {
      internal HIDUsagePage UsagePage;
      internal HIDUsage Usage;
      internal RawInputDeviceFlags Flags;
      internal IntPtr Target;

      public override string ToString()
      {
         return string.Format("{0}/{1}, flags: {2}, target: {3}", UsagePage, Usage, Flags, Target);
      }
   }

   /// Enumeration containing the HID usage values.
   public enum HIDUsage : ushort
   {
      ///
      Pointer = 0x01,
      ///
      Mouse = 0x02,
      ///
      Joystick = 0x04,
      ///
      Gamepad = 0x05,
      ///
      Keyboard = 0x06,
      ///
      Keypad = 0x07,
      ///
      SystemControl = 0x80,
      ///
      X = 0x30,
      ///
      Y = 0x31,
      ///
      Z = 0x32,
      ///
      RelativeX = 0x33,
      ///
      RelativeY = 0x34,
      ///
      RelativeZ = 0x35,
      ///
      Slider = 0x36,
      ///
      Dial = 0x37,
      ///
      Wheel = 0x38,
      ///
      HatSwitch = 0x39,
      ///
      CountedBuffer = 0x3A,
      ///
      ByteCount = 0x3B,
      ///
      MotionWakeup = 0x3C,
      ///
      VX = 0x40,
      ///
      VY = 0x41,
      ///
      VZ = 0x42,
      ///
      VBRX = 0x43,
      ///
      VBRY = 0x44,
      ///
      VBRZ = 0x45,
      ///
      VNO = 0x46,
      ///
      SystemControlPower = 0x81,
      ///
      SystemControlSleep = 0x82,
      ///
      SystemControlWake = 0x83,
      ///
      SystemControlContextMenu = 0x84,
      ///
      SystemControlMainMenu = 0x85,
      ///
      SystemControlApplicationMenu = 0x86,
      ///
      SystemControlHelpMenu = 0x87,
      ///
      SystemControlMenuExit = 0x88,
      ///
      SystemControlMenuSelect = 0x89,
      ///
      SystemControlMenuRight = 0x8A,
      ///
      SystemControlMenuLeft = 0x8B,
      ///
      SystemControlMenuUp = 0x8C,
      ///
      SystemControlMenuDown = 0x8D,
      ///
      KeyboardNoEvent = 0x00,
      ///
      KeyboardRollover = 0x01,
      ///
      KeyboardPostFail = 0x02,
      ///
      KeyboardUndefined = 0x03,
      ///
      KeyboardaA = 0x04,
      ///
      KeyboardzZ = 0x1D,
      ///
      Keyboard1 = 0x1E,
      ///
      Keyboard0 = 0x27,
      ///
      KeyboardLeftControl = 0xE0,
      ///
      KeyboardLeftShift = 0xE1,
      ///
      KeyboardLeftALT = 0xE2,
      ///
      KeyboardLeftGUI = 0xE3,
      ///
      KeyboardRightControl = 0xE4,
      ///
      KeyboardRightShift = 0xE5,
      ///
      KeyboardRightALT = 0xE6,
      ///
      KeyboardRightGUI = 0xE7,
      ///
      KeyboardScrollLock = 0x47,
      ///
      KeyboardNumLock = 0x53,
      ///
      KeyboardCapsLock = 0x39,
      ///
      KeyboardF1 = 0x3A,
      ///
      KeyboardF12 = 0x45,
      ///
      KeyboardReturn = 0x28,
      ///
      KeyboardEscape = 0x29,
      ///
      KeyboardDelete = 0x2A,
      ///
      KeyboardPrintScreen = 0x46,
      ///
      LEDNumLock = 0x01,
      ///
      LEDCapsLock = 0x02,
      ///
      LEDScrollLock = 0x03,
      ///
      LEDCompose = 0x04,
      ///
      LEDKana = 0x05,
      ///
      LEDPower = 0x06,
      ///
      LEDShift = 0x07,
      ///
      LEDDoNotDisturb = 0x08,
      ///
      LEDMute = 0x09,
      ///
      LEDToneEnable = 0x0A,
      ///
      LEDHighCutFilter = 0x0B,
      ///
      LEDLowCutFilter = 0x0C,
      ///
      LEDEqualizerEnable = 0x0D,
      ///
      LEDSoundFieldOn = 0x0E,
      ///
      LEDSurroundFieldOn = 0x0F,
      ///
      LEDRepeat = 0x10,
      ///
      LEDStereo = 0x11,
      ///
      LEDSamplingRateDirect = 0x12,
      ///
      LEDSpinning = 0x13,
      ///
      LEDCAV = 0x14,
      ///
      LEDCLV = 0x15,
      ///
      LEDRecordingFormatDet = 0x16,
      ///
      LEDOffHook = 0x17,
      ///
      LEDRing = 0x18,
      ///
      LEDMessageWaiting = 0x19,
      ///
      LEDDataMode = 0x1A,
      ///
      LEDBatteryOperation = 0x1B,
      ///
      LEDBatteryOK = 0x1C,
      ///
      LEDBatteryLow = 0x1D,
      ///
      LEDSpeaker = 0x1E,
      ///
      LEDHeadset = 0x1F,
      ///
      LEDHold = 0x20,
      ///
      LEDMicrophone = 0x21,
      ///
      LEDCoverage = 0x22,
      ///
      LEDNightMode = 0x23,
      ///
      LEDSendCalls = 0x24,
      ///
      LEDCallPickup = 0x25,
      ///
      LEDConference = 0x26,
      ///
      LEDStandBy = 0x27,
      ///
      LEDCameraOn = 0x28,
      ///
      LEDCameraOff = 0x29,
      ///
      LEDOnLine = 0x2A,
      ///
      LEDOffLine = 0x2B,
      ///
      LEDBusy = 0x2C,
      ///
      LEDReady = 0x2D,
      ///
      LEDPaperOut = 0x2E,
      ///
      LEDPaperJam = 0x2F,
      ///
      LEDRemote = 0x30,
      ///
      LEDForward = 0x31,
      ///
      LEDReverse = 0x32,
      ///
      LEDStop = 0x33,
      ///
      LEDRewind = 0x34,
      ///
      LEDFastForward = 0x35,
      ///
      LEDPlay = 0x36,
      ///
      LEDPause = 0x37,
      ///
      LEDRecord = 0x38,
      ///
      LEDError = 0x39,
      ///
      LEDSelectedIndicator = 0x3A,
      ///
      LEDInUseIndicator = 0x3B,
      ///
      LEDMultiModeIndicator = 0x3C,
      ///
      LEDIndicatorOn = 0x3D,
      ///
      LEDIndicatorFlash = 0x3E,
      ///
      LEDIndicatorSlowBlink = 0x3F,
      ///
      LEDIndicatorFastBlink = 0x40,
      ///
      LEDIndicatorOff = 0x41,
      ///
      LEDFlashOnTime = 0x42,
      ///
      LEDSlowBlinkOnTime = 0x43,
      ///
      LEDSlowBlinkOffTime = 0x44,
      ///
      LEDFastBlinkOnTime = 0x45,
      ///
      LEDFastBlinkOffTime = 0x46,
      ///
      LEDIndicatorColor = 0x47,
      ///
      LEDRed = 0x48,
      ///
      LEDGreen = 0x49,
      ///
      LEDAmber = 0x4A,
      ///
      LEDGenericIndicator = 0x3B,
      ///
      TelephonyPhone = 0x01,
      ///
      TelephonyAnsweringMachine = 0x02,
      ///
      TelephonyMessageControls = 0x03,
      ///
      TelephonyHandset = 0x04,
      ///
      TelephonyHeadset = 0x05,
      ///
      TelephonyKeypad = 0x06,
      ///
      TelephonyProgrammableButton = 0x07,
      ///
      SimulationRudder = 0xBA,
      ///
      SimulationThrottle = 0xBB
   }

   ///
   /// Enumeration containing HID usage page flags.
   ///
   public enum HIDUsagePage : ushort
   {
      /// Unknown usage page.
      Undefined = 0x00,
      /// Generic desktop controls.
      Generic = 0x01,
      /// Simulation controls.
      Simulation = 0x02,
      /// Virtual reality controls.
      VR = 0x03,
      /// Sports controls.
      Sport = 0x04,
      /// Games controls.
      Game = 0x05,
      /// Keyboard controls.
      Keyboard = 0x07,
      /// LED controls.
      LED = 0x08,
      /// Button.
      Button = 0x09,
      /// Ordinal.
      Ordinal = 0x0A,
      /// Telephony.
      Telephony = 0x0B,
      /// Consumer.
      Consumer = 0x0C,
      /// Digitizer.
      Digitizer = 0x0D,
      /// Physical interface device.
      PID = 0x0F,
      /// Unicode.
      Unicode = 0x10,
      /// Alphanumeric display.
      AlphaNumeric = 0x14,
      /// Medical instruments.
      Medical = 0x40,
      /// Monitor page 0.
      MonitorPage0 = 0x80,
      /// Monitor page 1.
      MonitorPage1 = 0x81,
      /// Monitor page 2.
      MonitorPage2 = 0x82,
      /// Monitor page 3.
      MonitorPage3 = 0x83,
      /// Power page 0.
      PowerPage0 = 0x84,
      /// Power page 1.
      PowerPage1 = 0x85,
      /// Power page 2.
      PowerPage2 = 0x86,
      /// Power page 3.
      PowerPage3 = 0x87,
      /// Bar code scanner.
      BarCode = 0x8C,
      /// Scale page.
      Scale = 0x8D,
      /// Magnetic strip reading devices.
      MSR = 0x8E
   }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Peronospora brassicae f. major Savul. & Rayss

### Remarks
null


text:
static FILE* logFile = NULL;

static char* getLogFileName(const char* dirName)
{
	const char* logName = "pts.log";
	int size = strlen(logName) + strlen(dirName) + 2;
	char* fileNameStr = malloc(size);
	strcpy(fileNameStr, dirName);
	strcat(fileNameStr, "/");
	strcat(fileNameStr, logName);
	return fileNameStr;
}

static void panic(const char* fmt, ...)
{
	va_list args;
	va_start(args, fmt);
	vfprintf(stderr, fmt, args);
	va_end(args);

	if (logFile != NULL)
		fclose(logFile);
	exit(-1);
}

static void openLogFile(const char* dirName)
{
	assert(logFile == NULL);
	char* logFileName = getLogFileName(dirName);
	logFile = fopen(logFileName, "wb");
	if (logFile == NULL)
		panic("Log file \'%s\' open failed.\n", logFileName);
	free(logFileName);
}

static void writeData(void* data, size_t size)
{
	size_t numBytesWritten = fwrite(data, size, 1, logFile);
	if (numBytesWritten != 1)
		panic("Log write error\n");
}

static void writeLogRecord(struct LogRecord* rec)
{
	assert(logFile != NULL && rec != NULL);
	char type = rec->type;
	writeData(&type, sizeof(char));
	switch (rec->type)
	{
		case TAllocRec:
			writeData(&rec->allocRecord.type, sizeof(char));
			writeData(&rec->allocRecord.id, sizeof(unsigned));
			writeData(&rec->allocRecord.address, sizeof(void*));
			break;
		case TPointerRec:
			writeData(&rec->ptrRecord.id, sizeof(unsigned));
			writeData(&rec->ptrRecord.address, sizeof(void*));
			break;
		case TEnterRec:
			writeData(&rec->enterRecord.id, sizeof(unsigned));
			break;
		case TExitRec:
			writeData(&rec->exitRecord.id, sizeof(unsigned));
			break;
		case TCallRec:
			writeData(&rec->callRecord.id, sizeof(unsigned));
			break;
		default:
			panic("Illegal record type\n");
	}
}

extern void HookFinalize()
{
	assert(logFile != NULL);
	fclose(logFile);
}

extern void HookInit()
{
	const char* logDirName = "log";
	const char* logDirEnv = getenv("LOG_DIR");
	if (logDirEnv != NULL)
		logDirName = logDirEnv;

	int r = mkdir(logDirName, 0755);
	if (r == -1 && errno != EEXIST)
		panic("Log directory \'%s\' creation failed.\n", logDirName);
	openLogFile(logDirName);
	atexit(HookFinalize);
}

extern void HookAlloc(char ty, unsigned id, void* addr)
{
	struct LogRecord record;
	memset(&record, 0, sizeof(record));
	record.type = TAllocRec;
	record.allocRecord.type = ty;
	record.allocRecord.id = id;
	record.allocRecord.address = addr;
	//printf("[ALLOC] %d %p\n", ty, addr);
	writeLogRecord(&record);
}

extern void HookMain(int argvId, char** argv, int envpId, char** envp)
{
	HookAlloc(1, argvId, argv);
	if (envp != NULL && envpId != 0)
		HookAlloc(1, envpId, envp);
}

extern void HookPointer(unsigned id, void* addr)
{
	struct LogRecord record;
	record.type = TPointerRec;
	record.ptrRecord.id = id;
	record.ptrRecord.address = addr;
	//printf("[PTR] %d %p\n", id, addr);
	writeLogRecord(&record);
}

extern void HookEnter(unsigned id)
{
	struct LogRecord record;
	record.type = TEnterRec;
	record.enterRecord.id = id;
	//printf("[ENTER] %d\n", id);
	writeLogRecord(&record);
}

extern void HookExit(unsigned id)
{
	struct LogRecord record;
	record.type = TExitRec;
	record.exitRecord.id = id;
	//printf("[EXIT] %d\n", id);
	writeLogRecord(&record);
}

extern void HookCall(unsigned id)
{
	struct LogRecord record;
	record.type = TCallRec;
	record.callRecord.id = id;
	//printf("[CALL] %d\n", id);
	writeLogRecord(&record);
}


text:
package storage::emc::xtremio::restapi::custom::xtremioapi;

use strict;
use warnings;
use centreon::plugins::http;
use centreon::plugins::statefile;
use JSON;

sub new {
    my ($class, %options) = @_;
    my $self  = {};
    bless $self, $class;

    if (!defined($options{output})) {
        print "Class Custom: Need to specify 'output' argument.\n";
        exit 3;
    }
    if (!defined($options{options})) {
        $options{output}->add_option_msg(short_msg => "Class Custom: Need to specify 'options' argument.");
        $options{output}->option_exit();
    }

    if (!defined($options{noptions})) {
        $options{options}->add_options(arguments =>
                    {
                      "hostname:s@"         => { name => 'hostname' },
                      "xtremio-username:s@" => { name => 'xtremio_username' },
                      "xtremio-password:s@" => { name => 'xtremio_password' },
                      "proxyurl:s@"         => { name => 'proxyurl' },
                      "timeout:s@"          => { name => 'timeout' },
                      "ssl-opt:s@"          => { name => 'ssl_opt' },
                      "reload-cache-time:s" => { name => 'reload_cache_time' },
                    });
    }
    $options{options}->add_help(package => __PACKAGE__, sections => 'REST API OPTIONS', once => 1);

    $self->{output} = $options{output};
    $self->{mode} = $options{mode};
    $self->{http} = centreon::plugins::http->new(output => $self->{output});
    $self->{statefile_cache_cluster} = centreon::plugins::statefile->new(%options);

    return $self;

}

sub set_options {
    my ($self, %options) = @_;

    $self->{option_results} = $options{option_results};
}

sub set_defaults {
    my ($self, %options) = @_;

    foreach (keys %{$options{default}}) {
        if ($_ eq $self->{mode}) {
            for (my $i = 0; $i < scalar(@{$options{default}->{$_}}); $i++) {
                foreach my $opt (keys %{$options{default}->{$_}[$i]}) {
                    if (!defined($self->{option_results}->{$opt}[$i])) {
                        $self->{option_results}->{$opt}[$i] = $options{default}->{$_}[$i]->{$opt};
                    }
                }
            }
        }
    }
}

sub check_options {
    my ($self, %options) = @_;

    $self->{hostname} = (defined($self->{option_results}->{hostname})) ? shift(@{$self->{option_results}->{hostname}}) : undef;
    $self->{xtremio_username} = (defined($self->{option_results}->{xtremio_username})) ? shift(@{$self->{option_results}->{xtremio_username}}) : '';
    $self->{xtremio_password} = (defined($self->{option_results}->{xtremio_password})) ? shift(@{$self->{option_results}->{xtremio_password}}) : '';
    $self->{timeout} = (defined($self->{option_results}->{timeout})) ? shift(@{$self->{option_results}->{timeout}}) : 10;
    $self->{proxyurl} = (defined($self->{option_results}->{proxyurl})) ? shift(@{$self->{option_results}->{proxyurl}}) : undef;
    $self->{reload_cache_time} = (defined($self->{option_results}->{reload_cache_time})) ? shift(@{$self->{option_results}->{reload_cache_time}}) : 180;

    if (!defined($self->{hostname})) {
        $self->{output}->add_option_msg(short_msg => "Need to specify hostname option.");
        $self->{output}->option_exit();
    }

    if (!defined($self->{xtremio_username}) || !defined($self->{xtremio_password})) {
        $self->{output}->add_option_msg(short_msg => "Need to specify --xtremio-username and --xtremio-password options.");
        $self->{output}->option_exit();
    }

    if (!defined($self->{hostname}) ||
        scalar(@{$self->{option_results}->{hostname}}) == 0) {
        $self->{statefile_cache_cluster}->check_options(option_results => $self->{option_results});
        return 0;
    }
    return 1;
}

sub build_options_for_httplib {
    my ($self, %options) = @_;

    $self->{option_results}->{hostname} = $self->{xtremio_username}.':'.$self->{xtremio_password}.'@'.$self->{hostname};
    $self->{option_results}->{timeout} = $self->{timeout};
    $self->{option_results}->{port} = 443;
    $self->{option_results}->{proto} = 'https';
    $self->{option_results}->{proxyurl} = $self->{proxyurl};
}

sub settings {
    my ($self, %options) = @_;

    $self->build_options_for_httplib();
    $self->{http}->set_options(%{$self->{option_results}});
}

sub cache_clusters {
    my ($self, %options) = @_;

    my $has_cache_file = $self->{statefile_cache_cluster}->read(statefile => 'cache_xtremio_clusters_' . $self->{hostname});
    my $timestamp_cache = $self->{statefile_cache_cluster}->get(name => 'last_timestamp');
    my $clusters = $self->{statefile_cache_cluster}->get(name => 'clusters');
    if ($has_cache_file == 0 || !defined($timestamp_cache) || ((time() - $timestamp_cache) > (($self->{reload_cache_time}) * 60))) {
        $clusters = {};
        my $datas = { last_timestamp => time(), clusters => $clusters };
        my @items = $self->get_items(url => '/api/json/types/',
                                     obj => 'clusters');
        foreach (@items) {
            $clusters->{$_} = 1;
        }
        $self->{statefile_cache_cluster}->write(data => $datas);
    }

    return $clusters;
}

sub get_items {
    my ($self, %options) = @_;

    $self->settings();

    if (defined($options{obj}) && $options{obj} ne '') {
        $options{url} .= $options{obj} . '/';
    }

    my $response = $self->{http}->request(url_path => $options{url});
    my $decoded;
    eval {
        $decoded = decode_json($response);
    };
    if ($@) {
        $self->{output}->add_option_msg(short_msg => "Cannot decode json response");
        $self->{output}->option_exit();
    }

    my @items;
    foreach my $context (@{$decoded->{$options{obj}}}) {
        push @items, $context->{name};
    }

    return @items;
}

sub get_details_data {
    my ($self, %options) = @_;

    my $response = $self->{http}->request(url_path => $options{url},
        critical_status => '', warning_status => '', unknown_status => '');
    my $decoded;
    eval {
        $decoded = decode_json($response);
    };
    if ($@) {
        $self->{output}->add_option_msg(short_msg => "Cannot decode json response");
        $self->{output}->option_exit();
    }

    return $decoded;
}

sub get_details_lookup_clusters {
    my ($self, %options) = @_;

    #Message if object not found:
    #{
    #   "message": "obj_not_found",
    #   "error_code": 400
    #}
    #
    if (!defined($self->{cache_clusters})) {
        $self->{cache_clusters} = $self->cache_clusters();
    }
    foreach my $cluster_name (keys %{$self->{cache_clusters}}) {
        my $url = $options{url} . $options{append} . 'cluster-name=' . $cluster_name;
        my $decoded = $self->get_details_data(url => $url);
        return $decoded if (!defined($decoded->{error_code}));
    }

    # object is not found.
    $self->{output}->add_option_msg(short_msg => "xtremio api issue: cannot found object details");
    $self->{output}->option_exit();
}

sub get_details {
    my ($self, %options) = @_;

    $self->settings();

    my $append = '?';
    if ((defined($options{obj}) && $options{obj} ne '') && (defined($options{name}) && $options{name} ne '')) {
        $options{url} .= $options{obj} . '/?name=' . $options{name};
        $append = '&';
    }

    #Message when cluster id needed:
    #{
    #   "message": "cluster_id_is_required",
    #   "error_code": 400
    #}
    #
    my $decoded = $self->get_details_data(%options);
    if (defined($decoded->{error_code}) &&
        ($decoded->{error_code} == 400 && $decoded->{message} eq 'cluster_id_is_required')) {
        $decoded = $self->get_details_lookup_clusters(%options, append => $append);
    } elsif (defined($decoded->{error_code})) {
        $self->{output}->add_option_msg(short_msg => "xtremio api issue: $decoded->{message}");
        $self->{output}->option_exit();
    }

    return $decoded->{content};

}

1;

__END__

=head1 NAME

XREMIO REST API

=head1 SYNOPSIS

Xtremio Rest API custom mode

=head1 REST API OPTIONS

=over 8

=item B<--hostname>

Xtremio hostname.

=item B<--xtremio-username>

Xtremio username.

=item B<--xtremio-password>

Xtremio password.

=item B<--proxyurl>

Proxy URL if any

=item B<--timeout>

Set HTTP timeout

=item B<--ssl-opt>

Set SSL Options (--ssl-opt="SSL_version => TLSv1" --ssl-opt="SSL_verify_mode => SSL_VERIFY_NONE").

=item B<--reload-cache-time>

Time in seconds before reloading cache file (default: 180).
The cache is used when XMS manages multiple clusters.

=back

=head1 DESCRIPTION

B<custom>.

=cut


text:
namespace device {

// Issues GL for rendering a texture for AR.
// TODO(crbug.com/838013): Share code with WebVrRenderer.
class ArRenderer {
 public:
  ArRenderer();

  ArRenderer(const ArRenderer&) = delete;
  ArRenderer& operator=(const ArRenderer&) = delete;

  ~ArRenderer();

  void Draw(int texture_handle, const float (&uv_transform)[16]);

 private:
  GLuint program_handle_ = 0;
  GLuint position_handle_ = 0;
  GLuint clip_rect_handle_ = 0;
  GLuint texture_handle_ = 0;
  GLuint uv_transform_ = 0;
  GLuint vertex_buffer_ = 0;
  GLuint index_buffer_ = 0;
};

}  // namespace device

#endif  // DEVICE_VR_ANDROID_ARCORE_AR_RENDERER_H_


text:
<?php

/* @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */
$installer = $this;
$installer->startSetup();

$installer->getConnection()->dropForeignKey(
    $installer->getTable('catalog/product_super_attribute_label'),
    'FK_CATALOG_PRODUCT_SUPER_ATTRIBUTE_LABEL_ATTRIBUTE'
);
$installer->getConnection()->dropForeignKey(
    $installer->getTable('catalog/product_super_attribute_label'),
    'FK_CATALOG_PRODUCT_SUPER_ATTRIBUTE_LABEL_STORE'
);
$installer->getConnection()->addConstraint('FK_CATALOG_PROD_SUPER_ATTR_LABEL_ATTR',
    $installer->getTable('catalog/product_super_attribute_label'), 'product_super_attribute_id',
    $installer->getTable('catalog/product_super_attribute'), 'product_super_attribute_id'
);
$installer->getConnection()->addConstraint('FK_CATALOG_PROD_SUPER_ATTR_LABEL_STORE',
    $installer->getTable('catalog/product_super_attribute_label'), 'store_id',
    $installer->getTable('core/store'), 'store_id'
);
$installer->endSetup();


text:
/***************************************************/
/*! \class BlitSaw
    \brief STK band-limited sawtooth wave class.

    This class generates a band-limited sawtooth waveform using a
    closed-form algorithm reported by Stilson and Smith in "Alias-Free
    Digital Synthesis of Classic Analog Waveforms", 1996.  The user
    can specify both the fundamental frequency of the sawtooth and the
    number of harmonics contained in the resulting signal.

    If nHarmonics is 0, then the signal will contain all harmonics up
    to half the sample rate.  Note, however, that this setting may
    produce aliasing in the signal when the frequency is changing (no
    automatic modification of the number of harmonics is performed by
    the setFrequency() function).

    Based on initial code of Robin Davies, 2005.
    Modified algorithm code by Gary Scavone, 2005.
*/
/***************************************************/

#include "BlitSaw.h"

namespace stk {

BlitSaw::BlitSaw(StkFloat frequency) {
  if (frequency <= 0.0) {
    oStream_ << "BlitSaw::BlitSaw: argument (" << frequency
             << ") must be positive!";
    handleError(StkError::FUNCTION_ARGUMENT);
  }

  nHarmonics_ = 0;
  this->reset();
  this->setFrequency(frequency);
}

BlitSaw ::~BlitSaw() {}

void BlitSaw ::reset() {
  phase_ = 0.0f;
  state_ = 0.0;
  lastFrame_[0] = 0.0;
}

void BlitSaw ::setFrequency(StkFloat frequency) {
  if (frequency <= 0.0) {
    oStream_ << "BlitSaw::setFrequency: argument (" << frequency
             << ") must be positive!";
    handleError(StkError::WARNING);
    return;
  }

  p_ = Stk::sampleRate() / frequency;
  C2_ = 1 / p_;
  rate_ = PI * C2_;
  this->updateHarmonics();
}

void BlitSaw ::setHarmonics(unsigned int nHarmonics) {
  nHarmonics_ = nHarmonics;
  this->updateHarmonics();

  // I found that the initial DC offset could be minimized with an
  // initial state setting as given below.  This initialization should
  // only happen before starting the oscillator for the first time
  // (but after setting the frequency and number of harmonics).  I
  // struggled a bit to decide where best to put this and finally
  // settled on here.  In general, the user shouldn't be messing with
  // the number of harmonics once the oscillator is running because
  // this is automatically taken care of in the setFrequency()
  // function.  (GPS - 1 October 2005)
  state_ = -0.5 * a_;
}

void BlitSaw ::updateHarmonics(void) {
  if (nHarmonics_ <= 0) {
    unsigned int maxHarmonics = (unsigned int)floor(0.5 * p_);
    m_ = 2 * maxHarmonics + 1;
  } else
    m_ = 2 * nHarmonics_ + 1;

  a_ = m_ / p_;
}

} // namespace stk


text:
class Level4Feature:
	public Feature
{
protected:
	using Feature::level;

public:
	Level4Feature(void);
	~Level4Feature(void);
};


text:
package com.hazelcast.client.cache.nearcache;

import com.hazelcast.cache.ICache;
import com.hazelcast.cache.impl.HazelcastServerCacheManager;
import com.hazelcast.cache.impl.HazelcastServerCachingProvider;
import com.hazelcast.client.cache.impl.HazelcastClientCacheManager;
import com.hazelcast.client.cache.impl.HazelcastClientCachingProvider;
import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.client.impl.clientside.HazelcastClientProxy;
import com.hazelcast.client.test.TestHazelcastFactory;
import com.hazelcast.config.CacheConfig;
import com.hazelcast.config.Config;
import com.hazelcast.config.NearCacheConfig;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.internal.adapter.DataStructureAdapterMethod;
import com.hazelcast.internal.adapter.ICacheCacheLoader;
import com.hazelcast.internal.adapter.ICacheDataStructureAdapter;
import com.hazelcast.internal.nearcache.AbstractNearCacheBasicTest;
import com.hazelcast.internal.nearcache.NearCache;
import com.hazelcast.internal.nearcache.NearCacheManager;
import com.hazelcast.internal.nearcache.NearCacheTestContext;
import com.hazelcast.internal.nearcache.NearCacheTestContextBuilder;
import com.hazelcast.internal.nearcache.NearCacheTestUtils;
import com.hazelcast.nio.serialization.Data;
import com.hazelcast.test.HazelcastParallelClassRunner;
import com.hazelcast.test.annotation.ParallelTest;
import com.hazelcast.test.annotation.QuickTest;
import org.junit.After;
import org.junit.Before;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;

import javax.cache.configuration.FactoryBuilder;
import javax.cache.spi.CachingProvider;

import static com.hazelcast.config.EvictionConfig.MaxSizePolicy.USED_NATIVE_MEMORY_PERCENTAGE;
import static com.hazelcast.config.EvictionPolicy.LRU;
import static com.hazelcast.config.InMemoryFormat.NATIVE;
import static com.hazelcast.config.NearCacheConfig.DEFAULT_LOCAL_UPDATE_POLICY;
import static com.hazelcast.config.NearCacheConfig.DEFAULT_MEMORY_FORMAT;
import static com.hazelcast.config.NearCacheConfig.DEFAULT_SERIALIZE_KEYS;
import static com.hazelcast.internal.nearcache.NearCacheTestUtils.createNearCacheConfig;
import static com.hazelcast.internal.nearcache.NearCacheTestUtils.getBaseConfig;

/**
 * Basic Near Cache tests for {@link ICache} on Hazelcast clients.
 */
@RunWith(HazelcastParallelClassRunner.class)
@Category({QuickTest.class, ParallelTest.class})
public class ClientCacheNearCacheBasicTest extends AbstractNearCacheBasicTest<Data, String> {

    private final TestHazelcastFactory hazelcastFactory = new TestHazelcastFactory();

    @Before
    public void setUp() {
        nearCacheConfig = createNearCacheConfig(DEFAULT_MEMORY_FORMAT, DEFAULT_SERIALIZE_KEYS)
                .setLocalUpdatePolicy(DEFAULT_LOCAL_UPDATE_POLICY);
    }

    @After
    public void tearDown() {
        hazelcastFactory.terminateAll();
    }

    @Override
    protected void assumeThatMethodIsAvailable(DataStructureAdapterMethod method) {
        NearCacheTestUtils.assumeThatMethodIsAvailable(ICacheDataStructureAdapter.class, method);
    }

    @Override
    protected <K, V> NearCacheTestContext<K, V, Data, String> createContext(boolean loaderEnabled) {
        Config config = getConfig();
        CacheConfig<K, V> cacheConfig = getCacheConfig(nearCacheConfig, loaderEnabled);

        HazelcastInstance member = hazelcastFactory.newHazelcastInstance(config);
        CachingProvider memberProvider = HazelcastServerCachingProvider.createCachingProvider(member);
        HazelcastServerCacheManager memberCacheManager = (HazelcastServerCacheManager) memberProvider.getCacheManager();
        ICache<K, V> memberCache = memberCacheManager.createCache(DEFAULT_NEAR_CACHE_NAME, cacheConfig);
        ICacheDataStructureAdapter<K, V> dataAdapter = new ICacheDataStructureAdapter<K, V>(memberCache);

        NearCacheTestContextBuilder<K, V, Data, String> builder = createNearCacheContextBuilder(cacheConfig);
        return builder
                .setDataInstance(member)
                .setDataAdapter(dataAdapter)
                .setMemberCacheManager(memberCacheManager)
                .build();
    }

    @Override
    protected <K, V> NearCacheTestContext<K, V, Data, String> createNearCacheContext() {
        CacheConfig<K, V> cacheConfig = getCacheConfig(nearCacheConfig, false);
        NearCacheTestContextBuilder<K, V, Data, String> builder = createNearCacheContextBuilder(cacheConfig);
        return builder.build();
    }

    @Override
    protected Config getConfig() {
        return getBaseConfig();
    }

    protected ClientConfig getClientConfig() {
        ClientConfig clientConfig = new ClientConfig();
        clientConfig.setProperty(NearCache.PROP_EXPIRATION_TASK_INITIAL_DELAY_SECONDS, "0");
        clientConfig.setProperty(NearCache.PROP_EXPIRATION_TASK_PERIOD_SECONDS, "1");
        return clientConfig.addNearCacheConfig(nearCacheConfig);
    }

    @SuppressWarnings("unchecked")
    private <K, V> CacheConfig<K, V> getCacheConfig(NearCacheConfig nearCacheConfig, boolean loaderEnabled) {
        CacheConfig<K, V> cacheConfig = new CacheConfig<K, V>()
                .setName(DEFAULT_NEAR_CACHE_NAME)
                .setInMemoryFormat(nearCacheConfig.getInMemoryFormat());

        if (nearCacheConfig.getInMemoryFormat() == NATIVE) {
            cacheConfig.getEvictionConfig()
                    .setEvictionPolicy(LRU)
                    .setMaximumSizePolicy(USED_NATIVE_MEMORY_PERCENTAGE)
                    .setSize(90);
        }

        if (loaderEnabled) {
            cacheConfig
                    .setReadThrough(true)
                    .setCacheLoaderFactory(new FactoryBuilder.ClassFactory(ICacheCacheLoader.class));
        }

        return cacheConfig;
    }

    private <K, V> NearCacheTestContextBuilder<K, V, Data, String> createNearCacheContextBuilder(CacheConfig<K, V> cacheConfig) {
        ClientConfig clientConfig = getClientConfig();

        HazelcastClientProxy client = (HazelcastClientProxy) hazelcastFactory.newHazelcastClient(clientConfig);
        CachingProvider provider = HazelcastClientCachingProvider.createCachingProvider(client);
        HazelcastClientCacheManager cacheManager = (HazelcastClientCacheManager) provider.getCacheManager();
        ICache<K, V> clientCache = cacheManager.createCache(DEFAULT_NEAR_CACHE_NAME, cacheConfig);

        NearCacheManager nearCacheManager = client.client.getNearCacheManager();
        String cacheNameWithPrefix = cacheManager.getCacheNameWithPrefix(DEFAULT_NEAR_CACHE_NAME);
        NearCache<Data, String> nearCache = nearCacheManager.getNearCache(cacheNameWithPrefix);

        return new NearCacheTestContextBuilder<K, V, Data, String>(nearCacheConfig, client.getSerializationService())
                .setNearCacheInstance(client)
                .setNearCacheAdapter(new ICacheDataStructureAdapter<K, V>(clientCache))
                .setNearCache(nearCache)
                .setNearCacheManager(nearCacheManager)
                .setCacheManager(cacheManager);
    }
}


text:
package org.apereo.cas.services;

import java.util.Collection;
import java.util.Comparator;
import java.util.stream.Collectors;

/**
 * Default implementation of the {@link ServicesManager} interface.
 *
 * @author Scott Battaglia
 * @since 3.1
 */
public class DefaultServicesManager extends AbstractServicesManager {

    public DefaultServicesManager(final ServicesManagerConfigurationContext context) {
        super(context);
    }

    @Override
    protected Collection<RegisteredService> getCandidateServicesToMatch(final String serviceId) {
        return getConfigurationContext().getServicesCache()
            .asMap()
            .values()
            .stream()
            .sorted(Comparator.naturalOrder())
            .collect(Collectors.toList());
    }

    @Override
    public Collection<RegisteredService> getServicesForDomain(final String domain) {
        return getConfigurationContext().getServicesCache()
            .asMap()
            .values()
            .stream()
            .sorted(Comparator.naturalOrder())
            .collect(Collectors.toList());
    }
}


text:
qson
---

Quick JSON based key value store over http

```python
import sys
import thread

import qson

test_server = qson.Server(("0.0.0.0", 0), qson.Handler)
port = test_server.port()

thread.start_new_thread(test_server.serve_forever, tuple())

test_client = qson.client(port=port)
print test_client("key1")
print test_client("key2", {
    "test": "values"
})
print test_client("key2")
```


text:
package com.amazonaws.services.simpleworkflow.model.transform;

import java.util.Map;
import java.util.Map.Entry;

import com.amazonaws.services.simpleworkflow.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;

import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;

/**
 * Start Lambda Function Failed Event Attributes JSON Unmarshaller
 */
public class StartLambdaFunctionFailedEventAttributesJsonUnmarshaller implements Unmarshaller<StartLambdaFunctionFailedEventAttributes, JsonUnmarshallerContext> {

    public StartLambdaFunctionFailedEventAttributes unmarshall(JsonUnmarshallerContext context) throws Exception {
        StartLambdaFunctionFailedEventAttributes startLambdaFunctionFailedEventAttributes = new StartLambdaFunctionFailedEventAttributes();

        int originalDepth = context.getCurrentDepth();
        String currentParentElement = context.getCurrentParentElement();
        int targetDepth = originalDepth + 1;

        JsonToken token = context.getCurrentToken();
        if (token == null) token = context.nextToken();
        if (token == VALUE_NULL) return null;

        while (true) {
            if (token == null) break;

            if (token == FIELD_NAME || token == START_OBJECT) {
                if (context.testExpression("scheduledEventId", targetDepth)) {
                    context.nextToken();
                    startLambdaFunctionFailedEventAttributes.setScheduledEventId(LongJsonUnmarshaller.getInstance().unmarshall(context));
                }
                if (context.testExpression("cause", targetDepth)) {
                    context.nextToken();
                    startLambdaFunctionFailedEventAttributes.setCause(StringJsonUnmarshaller.getInstance().unmarshall(context));
                }
                if (context.testExpression("message", targetDepth)) {
                    context.nextToken();
                    startLambdaFunctionFailedEventAttributes.setMessage(StringJsonUnmarshaller.getInstance().unmarshall(context));
                }
            } else if (token == END_ARRAY || token == END_OBJECT) {
                if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
                    if (context.getCurrentDepth() <= originalDepth) break;
                }
            }

            token = context.nextToken();
        }

        return startLambdaFunctionFailedEventAttributes;
    }

    private static StartLambdaFunctionFailedEventAttributesJsonUnmarshaller instance;
    public static StartLambdaFunctionFailedEventAttributesJsonUnmarshaller getInstance() {
        if (instance == null) instance = new StartLambdaFunctionFailedEventAttributesJsonUnmarshaller();
        return instance;
    }
}


text:
@interface A0EmailSendCodeViewController ()

@property (weak, nonatomic) A0CredentialFieldView *emailFieldView;
@property (weak, nonatomic) A0ProgressButton *registerButton;
@property (weak, nonatomic) UILabel *messageLabel;

@property (strong, nonatomic) A0PasswordlessLockViewModel *viewModel;
- (IBAction)registerEmail:(id)sender;

@end

@implementation A0EmailSendCodeViewController

AUTH0_DYNAMIC_LOGGER_METHODS

- (instancetype)initWithViewModel:(A0PasswordlessLockViewModel *)viewModel {
    self = [super init];
    if (self) {
        _viewModel = viewModel;
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];

    A0CredentialFieldView *emailField = [[A0CredentialFieldView alloc] init];
    UILabel *messageLabel = [[UILabel alloc] initWithFrame:CGRectZero];
    A0ProgressButton *registerButton = [A0ProgressButton progressButton];
    A0RoundedBoxView *boxView = [[A0RoundedBoxView alloc] init];

    [boxView addSubview:emailField];
    [emailField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(boxView);
    }];

    [self.view addSubview:messageLabel];
    [self.view addSubview:boxView];
    [self.view addSubview:registerButton];
    [messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view.mas_centerX);
        make.top.equalTo(self.view).offset(10);
    }];
    [boxView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(20);
        make.right.equalTo(self.view).offset(-20);
        make.top.equalTo(messageLabel.mas_bottom).offset(8);
        make.height.equalTo(@50);
    }];
    [registerButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(boxView.mas_bottom).offset(18);
        make.left.equalTo(self.view).offset(20);
        make.right.equalTo(self.view).offset(-20);
        make.bottom.equalTo(self.view);
        make.height.equalTo(@55);
    }];

    self.emailFieldView = emailField;
    self.messageLabel = messageLabel;
    self.registerButton = registerButton;

    self.title = A0LocalizedString(@"Send Passcode");
    A0Theme *theme = [A0Theme sharedInstance];
    [theme configurePrimaryButton:self.registerButton];
    [theme configureLabel:self.messageLabel];

    self.messageLabel.text = A0LocalizedString(@"Enter your email to sign in or create an account");
    self.emailFieldView.type = A0CredentialFieldViewEmail;
    self.emailFieldView.returnKeyType = UIReturnKeySend;
    [self.emailFieldView.textField addTarget:self action:@selector(registerEmail:) forControlEvents:UIControlEventEditingDidEndOnExit];
    [self.registerButton setTitle:A0LocalizedString(@"SEND") forState:UIControlStateNormal];
    [self.registerButton addTarget:self action:@selector(registerEmail:) forControlEvents:UIControlEventTouchUpInside];

    self.emailFieldView.textField.text = self.viewModel.identifier;
    [self.emailFieldView.textField addTarget:self action:@selector(emailDidChangeInTextField:) forControlEvents:UIControlEventEditingChanged];
}

- (void)registerEmail:(id)sender {
    NSError *error = self.viewModel.identifierError;
    if (!error) {
        [self.emailFieldView setInvalid:NO];
        [self.emailFieldView.textField resignFirstResponder];
        A0LogDebug(@"Registering email %@", self.emailFieldView.textField.text);
        [self.registerButton setInProgress:YES];
        __weak A0EmailSendCodeViewController *weakSelf = self;
        A0LogDebug(@"About to send Email code to %@", self.viewModel.identifier);
        [self.viewModel requestVerificationCodeWithCallback:^(NSError * _Nullable error) {
            if (error) {
                A0LogError(@"Failed to send SMS code with error %@", error);
                NSString *title = [error a0_auth0ErrorWithCode:A0ErrorCodeNotConnectedToInternet] ? error.localizedDescription : A0LocalizedString(@"There was an error sending the email code");
                NSString *message = [error a0_auth0ErrorWithCode:A0ErrorCodeNotConnectedToInternet] ? error.localizedFailureReason : A0LocalizedString(@"Couldn't send the email with your login code. Please try again later.");
                [A0Alert showInController:weakSelf errorAlert:^(A0Alert *alert) {
                    alert.title = title;
                    alert.message = message;
                }];
                [weakSelf.registerButton setInProgress:NO];
                return;
            }
            A0LogDebug(@"Email code sent to %@", weakSelf.viewModel.identifier);
            [weakSelf.registerButton setInProgress:NO];
            if (weakSelf.didRequestVerificationCode) {
                weakSelf.didRequestVerificationCode();
            }
        }];
    } else {
        [self.emailFieldView setInvalid:YES];
        [A0Alert showInController:self errorAlert:^(A0Alert *alert) {
            alert.title = error.localizedDescription;
            alert.message = error.localizedFailureReason;
        }];
    }
}

- (void)emailDidChangeInTextField:(UITextField *)textField {
    self.viewModel.identifier = textField.text;
}

#pragma mark - A0KeyboardEnabledView

- (CGRect)rectToKeepVisibleInView:(UIView *)view {
    CGRect rect = [view convertRect:self.registerButton.frame fromView:self.registerButton.superview];
    return rect;
}

- (void)hideKeyboard {
    [self.emailFieldView.textField resignFirstResponder];
}
@end


text:
namespace tigl
{
namespace generated
{
    CPACSTransformation2D::CPACSTransformation2D(CCPACSProfileBasedStructuralElement* parent, CTiglUIDManager* uidMgr)
        : m_uidMgr(uidMgr)
    {
        //assert(parent != NULL);
        m_parent = parent;
    }

    CPACSTransformation2D::~CPACSTransformation2D()
    {
        if (m_uidMgr && m_uID) m_uidMgr->TryUnregisterObject(*m_uID);
    }

    const CCPACSProfileBasedStructuralElement* CPACSTransformation2D::GetParent() const
    {
        return m_parent;
    }

    CCPACSProfileBasedStructuralElement* CPACSTransformation2D::GetParent()
    {
        return m_parent;
    }

    const CTiglUIDObject* CPACSTransformation2D::GetNextUIDParent() const
    {
        return m_parent;
    }

    CTiglUIDObject* CPACSTransformation2D::GetNextUIDParent()
    {
        return m_parent;
    }

    CTiglUIDManager& CPACSTransformation2D::GetUIDManager()
    {
        if (!m_uidMgr) {
            throw CTiglError("UIDManager is null");
        }
        return *m_uidMgr;
    }

    const CTiglUIDManager& CPACSTransformation2D::GetUIDManager() const
    {
        if (!m_uidMgr) {
            throw CTiglError("UIDManager is null");
        }
        return *m_uidMgr;
    }

    void CPACSTransformation2D::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath)
    {
        // read attribute uID
        if (tixi::TixiCheckAttribute(tixiHandle, xpath, "uID")) {
            m_uID = tixi::TixiGetAttribute<std::string>(tixiHandle, xpath, "uID");
            if (m_uID->empty()) {
                LOG(WARNING) << "Optional attribute uID is present but empty at xpath " << xpath;
            }
        }

        // read element scaling
        if (tixi::TixiCheckElement(tixiHandle, xpath + "/scaling")) {
            m_scaling = boost::in_place(this, m_uidMgr);
            try {
                m_scaling->ReadCPACS(tixiHandle, xpath + "/scaling");
            } catch(const std::exception& e) {
                LOG(ERROR) << "Failed to read scaling at xpath " << xpath << ": " << e.what();
                m_scaling = boost::none;
            }
        }

        // read element rotation
        if (tixi::TixiCheckElement(tixiHandle, xpath + "/rotation")) {
            m_rotation = boost::in_place(this, m_uidMgr);
            try {
                m_rotation->ReadCPACS(tixiHandle, xpath + "/rotation");
            } catch(const std::exception& e) {
                LOG(ERROR) << "Failed to read rotation at xpath " << xpath << ": " << e.what();
                m_rotation = boost::none;
            }
        }

        // read element translation
        if (tixi::TixiCheckElement(tixiHandle, xpath + "/translation")) {
            m_translation = boost::in_place(this, m_uidMgr);
            try {
                m_translation->ReadCPACS(tixiHandle, xpath + "/translation");
            } catch(const std::exception& e) {
                LOG(ERROR) << "Failed to read translation at xpath " << xpath << ": " << e.what();
                m_translation = boost::none;
            }
        }

        if (m_uidMgr && m_uID) m_uidMgr->RegisterObject(*m_uID, *this);
    }

    void CPACSTransformation2D::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const
    {
        // write attribute uID
        if (m_uID) {
            tixi::TixiSaveAttribute(tixiHandle, xpath, "uID", *m_uID);
        }
        else {
            if (tixi::TixiCheckAttribute(tixiHandle, xpath, "uID")) {
                tixi::TixiRemoveAttribute(tixiHandle, xpath, "uID");
            }
        }

        // write element scaling
        if (m_scaling) {
            tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/scaling");
            m_scaling->WriteCPACS(tixiHandle, xpath + "/scaling");
        }
        else {
            if (tixi::TixiCheckElement(tixiHandle, xpath + "/scaling")) {
                tixi::TixiRemoveElement(tixiHandle, xpath + "/scaling");
            }
        }

        // write element rotation
        if (m_rotation) {
            tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/rotation");
            m_rotation->WriteCPACS(tixiHandle, xpath + "/rotation");
        }
        else {
            if (tixi::TixiCheckElement(tixiHandle, xpath + "/rotation")) {
                tixi::TixiRemoveElement(tixiHandle, xpath + "/rotation");
            }
        }

        // write element translation
        if (m_translation) {
            tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/translation");
            m_translation->WriteCPACS(tixiHandle, xpath + "/translation");
        }
        else {
            if (tixi::TixiCheckElement(tixiHandle, xpath + "/translation")) {
                tixi::TixiRemoveElement(tixiHandle, xpath + "/translation");
            }
        }

    }

    const boost::optional<std::string>& CPACSTransformation2D::GetUID() const
    {
        return m_uID;
    }

    void CPACSTransformation2D::SetUID(const boost::optional<std::string>& value)
    {
        if (m_uidMgr && value != m_uID) {
            if (!m_uID && value) {
                m_uidMgr->RegisterObject(*value, *this);
            }
            else if (m_uID && !value) {
                m_uidMgr->TryUnregisterObject(*m_uID);
            }
            else if (m_uID && value) {
                m_uidMgr->UpdateObjectUID(*m_uID, *value);
            }
        }
        m_uID = value;
    }

    const boost::optional<CCPACSPointXY>& CPACSTransformation2D::GetScaling() const
    {
        return m_scaling;
    }

    boost::optional<CCPACSPointXY>& CPACSTransformation2D::GetScaling()
    {
        return m_scaling;
    }

    const boost::optional<CPACSPointZ>& CPACSTransformation2D::GetRotation() const
    {
        return m_rotation;
    }

    boost::optional<CPACSPointZ>& CPACSTransformation2D::GetRotation()
    {
        return m_rotation;
    }

    const boost::optional<CCPACSPointXY>& CPACSTransformation2D::GetTranslation() const
    {
        return m_translation;
    }

    boost::optional<CCPACSPointXY>& CPACSTransformation2D::GetTranslation()
    {
        return m_translation;
    }

    CCPACSPointXY& CPACSTransformation2D::GetScaling(CreateIfNotExistsTag)
    {
        if (!m_scaling)
            m_scaling = boost::in_place(this, m_uidMgr);
        return *m_scaling;
    }

    void CPACSTransformation2D::RemoveScaling()
    {
        m_scaling = boost::none;
    }

    CPACSPointZ& CPACSTransformation2D::GetRotation(CreateIfNotExistsTag)
    {
        if (!m_rotation)
            m_rotation = boost::in_place(this, m_uidMgr);
        return *m_rotation;
    }

    void CPACSTransformation2D::RemoveRotation()
    {
        m_rotation = boost::none;
    }

    CCPACSPointXY& CPACSTransformation2D::GetTranslation(CreateIfNotExistsTag)
    {
        if (!m_translation)
            m_translation = boost::in_place(this, m_uidMgr);
        return *m_translation;
    }

    void CPACSTransformation2D::RemoveTranslation()
    {
        m_translation = boost::none;
    }

} // namespace generated
} // namespace tigl


text:
package com.sleepycat.je.tree;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

import com.sleepycat.je.dbi.DatabaseId;

/**
 * A class that embodies a reference to a BIN that does not rely on a
 * Java reference to the actual BIN.
 */
public class BINReference {
    protected byte[] idKey;
    private long nodeId;
    private DatabaseId databaseId;
    private Set<Key> deletedKeys;  // Set of Key objects

    BINReference(long nodeId, DatabaseId databaseId, byte[] idKey) {
	this.nodeId = nodeId;
	this.databaseId = databaseId;
	this.idKey = idKey;
    }

    public long getNodeId() {
	return nodeId;
    }

    public DatabaseId getDatabaseId() {
	return databaseId;
    }

    public byte[] getKey() {
	return idKey;
    }

    public byte[] getData() {
	return null;
    }

    public void addDeletedKey(Key key) {

        if (deletedKeys == null) {
            deletedKeys = new HashSet<Key>();
        }
        deletedKeys.add(key);
    }

    public void addDeletedKeys(BINReference other) {

        if (deletedKeys == null) {
            deletedKeys = new HashSet<Key>();
        }
        if (other.deletedKeys != null) {
            deletedKeys.addAll(other.deletedKeys);
        }
    }

    public void removeDeletedKey(Key key) {

        if (deletedKeys != null) {
            deletedKeys.remove(key);
            if (deletedKeys.size() == 0) {
                deletedKeys = null;
            }
        }
    }

    public boolean hasDeletedKey(Key key) {

        return (deletedKeys != null) && deletedKeys.contains(key);
    }

    public boolean deletedKeysExist() {

        return ((deletedKeys != null) && (deletedKeys.size() > 0));
    }

    public Iterator<Key> getDeletedKeyIterator() {
        if (deletedKeys != null) {
            return deletedKeys.iterator();
        } else {
            return null;
        }
    }

    /**
     * Compare two BINReferences.
     */
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }

        if (!(obj instanceof BINReference)) {
            return false;
        }

	return ((BINReference) obj).nodeId == nodeId;
    }

    public int hashCode() {
	return (int) nodeId;
    }

    public String toString() {
        return "idKey=" + Key.getNoFormatString(idKey) +
            " nodeId = " + nodeId +
            " db=" + databaseId +
            " deletedKeys=" + deletedKeys;
    }
}


text:
Built from the default gatsby starter

To get up and running

1. Clone this repo
2. `yarn`
3. `yarn develop` Gatsby will start a hot-reloading development environment accessible at `localhost:8000`
4. Open `src/pages` to edit the application, saved changes will reload in the browser

For an overview of the project structure please refer to the [Gatsby documentation - Building with Components](https://www.gatsbyjs.org/docs/building-with-components/)

To build a bundle for deployment
1. `yarn build` Gatsby will perform an optimized production build for your site generating static HTML and per-route JavaScript code bundles.
2. `yarn serve` Gatsby starts a local HTML server for testing your built site.

For further reference check out https://www.gatsbyjs.org/docs/


text:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Jasily.Frameworks.Cli.Commands;
using Jasily.Frameworks.Cli.Exceptions;
using Jasily.Frameworks.Cli.IO;
using Microsoft.Extensions.DependencyInjection;

namespace Jasily.Frameworks.Cli.Core
{
    internal class Session : ISession
    {
        private readonly IServiceProvider _serviceProvider;
        private readonly List<ResolvedNode> _nodes = new List<ResolvedNode>();

        public Session(IServiceProvider serviceProvider, IArgumentList argv, SessionConfigurator configurator)
        {
            this._serviceProvider = serviceProvider;
            this.Argv = argv;
            this.ExecuteMode = configurator.Mode;
        }

        public ExecuteMode ExecuteMode { get; }

        public IArgumentList Argv { get; }

        public void DrawUsage()
        {
            var drawer = this._serviceProvider.GetRequiredService<IUsageDrawer>();
            this._nodes.Last().Draw(drawer);
        }

        public void Termination()
        {
            throw new TerminationException();
        }

        public void Dispose()
        {

        }

        public void AddRouter(CommandRouter router)
        {
            this._nodes.Add(new ResolvedNode(router));
        }

        public void AddCommand(ICommand command)
        {
            this._nodes.Add(new ResolvedNode(command));
        }

        private struct ResolvedNode
        {
            public ResolvedNode(CommandRouter router)
            {
                this.IsRouter = true;
                this.Router = router;
                this.Command = null;
            }

            public ResolvedNode(ICommand command)
            {
                this.IsRouter = false;
                this.Router = default(CommandRouter);
                this.Command = command;
            }

            public bool IsRouter { get; }

            public CommandRouter Router { get; }

            public ICommand Command { get; }

            public void Draw(IUsageDrawer drawer)
            {
                if (this.IsRouter)
                {
                    drawer.DrawRouter(this.Router.CommandsProperties);
                }
                else
                {
                    drawer.DrawParameter(this.Command.Properties, this.Command.ParameterConfigurations);
                }
            }
        }
    }
}


text:
"""Entity to track connections to stream API."""
import asyncio
import logging

from homeassistant.const import EVENT_HOMEASSISTANT_STOP
from homeassistant.core import callback
from homeassistant.helpers.entity import Entity

NAME_WS = 'homeassistant.components.websocket_api'
NAME_STREAM = 'homeassistant.components.api'

class StreamHandler(logging.Handler):
    """Check log messages for stream connect/disconnect."""

    def __init__(self, entity):
        """Initialize handler."""
        super().__init__()
        self.entity = entity
        self.count = 0

    def handle(self, record):
        """Handle a log message."""
        if record.name == NAME_STREAM:
            if not record.msg.startswith('STREAM'):
                return

            if record.msg.endswith('ATTACHED'):
                self.entity.count += 1
            elif record.msg.endswith('RESPONSE CLOSED'):
                self.entity.count -= 1

        else:
            if not record.msg.startswith('WS'):
                return
            elif len(record.args) < 2:
                return
            elif record.args[1] == 'Connected':
                self.entity.count += 1
            elif record.args[1] == 'Closed connection':
                self.entity.count -= 1

        self.entity.schedule_update_ha_state()

@asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
    """Set up the logger for filters."""
    entity = APICount()
    handler = StreamHandler(entity)

    logging.getLogger(NAME_STREAM).addHandler(handler)
    logging.getLogger(NAME_WS).addHandler(handler)

    @callback
    def remove_logger(event):
        """Remove our handlers."""
        logging.getLogger(NAME_STREAM).removeHandler(handler)
        logging.getLogger(NAME_WS).removeHandler(handler)

    hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, remove_logger)

    yield from async_add_devices([entity])

class APICount(Entity):
    """Entity to represent how many people are connected to stream API."""

    def __init__(self):
        """Initialize the API count."""
        self.count = 0

    @property
    def name(self):
        """Return name of entity."""
        return "Connected clients"

    @property
    def state(self):
        """Return current API count."""
        return self.count

    @property
    def unit_of_measurement(self):
        """Unit of measurement."""
        return "clients"


text:
module Assette
  module PostProcessor
    extend self
    POST_PROCESSORS = Hash.new {|h,k| h[k] = []}

    def s
      POST_PROCESSORS
    end

    class Base

      def initialize(file, str=nil, args={})
        @file = file
        @str = str||file.code; @args = args
      end

      def should_process?
        true
      end

      def processor
        raise Exception, "You must implement the processor method for #{self.class.inspect} (you can use the @str)"
      end

      def process
        return @str unless should_process?

        processor
      end

      class << self
        def inherited subclass
          return if subclass == Assette::PostProcessor::Base || subclass.inspect =~ /#<Class/

          if outputs
            Assette::PostProcessor::POST_PROCESSORS[outputs] |= [subclass]
          end
        end

        def outputs

        end

        def set_outputs val
          raise ArgumentError, 'must set outputs to a symbol' unless val.is_a?(Symbol)

          instance_eval <<-RUBY
          def outputs
            #{val.inspect}
          end
          RUBY
          val
        end
      end
    end

  end

  def self.PostProcessor(type)
    c = Class.new(PostProcessor::Base)
    c.set_outputs(type)
    c
  end
end