text:
<resources>
    <string name="app_name">Olmatix</string>
    <string name="app_version">2.0</string>

    <!-- label network -->
    <string name="pref_domain">Server Credential</string>
    <string name="server_title">Address</string>
    <string name="server_sum">Olmatix server address</string>
    <string name="port_title">Port Number</string>
    <string name="port_sum">Olmatix port number</string>

    <string name="pref_network">Network Setting</string>
    <string name="pref_user">User Credential</string>
    <string name="user_title">User Name</string>
    <string name="pass_title">Password</string>
    <string name="address">cloud.olmatix.com</string>
    <string name="port">1883</string>
    <string name="info_address">Please input Olmatix Server Address, leave default if you dont know..</string>
    <string name="info_port">Please input port number for the server, leave default if you dont know..</string>
    <string name="info_user">Type your user name here</string>
    <string name="info_pass">Type your password here</string>

    <!-- label menu -->
    <string name="action_settings">Settings</string>
    <string name="status_conn">Waiting respond..</string>

    <string name="pref_about">About</string>
    <string name="about_sum">Olmatix 2.0 by lesjaw@olmatix.com</string>
    <string name="copy_right">Copyrights © %1$d</string>
    <string name="action_about">About</string>
    <string name="switch_title">Enable Persistence</string>

    <string name="err_internet">No internet connection</string>
    <string name="local_service_label">Olmatix 2.0</string>

    <string name="add_node_dialog">Add Node</string>
    <string name="add_node_dialog_sum">Type Olmatix product ID</string>
    <string name="connecting">Connecting to server..</string>
    <string name="sub_success">Subscribe success</string>
    <string name="sub_fail">Subscribe fail</string>
    <string name="conn_success">Connection Success</string>
    <string name="conn_fail">Connection Fail</string>
    <string name="service_start">Olmatix service starting..</string>
    <string name="service_stop">Olmatix service stop</string>
    <string name="nodename">Node Name</string>
    <string name="ipaddrs">IP Address</string>
    <string name="lastupdt">Last Update</string>
    <string name="uptime">Up Time</string>
    <string name="pref_setup">Setup Product</string>
    <string name="pref_wifi">WiFi Credential</string>
    <string name="ssid">SSID / WiFi</string>
    <string name="info_ssid">Type your home WiFi Name/SSID</string>
    <string name="info_pass_ssid">Type your home WiFi password</string>
    <string name="sendButton">Send Config</string>
    <string name="connect_product">Connect to product WiFi</string>
    <string name="action_exit">Exit</string>
    <string name="backbutton">Olmatix will go to background, dont kill/Force stop Olmatix or you wont receive any notification!</string>
    <string name="fav_label">Favorite</string>
    <string name="installed_label">Installed Node</string>
    <string name="signal">100</string>
    <string name="deviceoffline">Your devices OFFLINE!</string>
    <string name="latestAdding">Adding</string>
    <string name="reseting">is going to do a factory reset..</string>
    <string name="pref_misc">Miscellaneous</string>
    <string name="pref_location">Location</string>
    <string name="servicehomepos">Setup your location</string>
    <string name="opt_servicehomepos">Your Home Location</string>
    <string name="opt_Thold_desc">Range at which you will be considered out of home when you leave</string>
    <string name="opt_Thold">Distance From Home</string>
    <string name="opt_homepos_err">Error getting current position</string>
    <string name="opt_homepos_set">Home position set, press back now to see the location update</string>
    <string name="scene_label">Base on what?..</string>
    <string name="scene_do">What do you want to do?...</string>
    <string name="back">Back</string>
    <string name="next">Submit</string>
    <string name="add">Add</string>
    <string name="cancel">Cancel</string>
    <string name="opt_homepos_set_false">Can\'t find location</string>
    <string name="local_service_label_loc">Olmatix location update</string>
    <string name="switch_loc">Enable location notification?</string>
    <string name="switch_notif">Enable status notification?</string>
    <string name="opt_loc_notif">Location will update if you move</string>
    <string name="opt_loc_notif1">Notify me if device status change</string>
    <string name="opt_loc_notif2">Notify me if sensor door change</string>
    <string name="opt_loc_notif3">Notify me if sensor motion change</string>
    <string name="opt_loc_notif4">Notify me if sensor proximity change</string>

    <string name="switch_sum">Persistence connection to server</string>
    <string name="switch_locDisable">Disable location notification</string>
    <string name="switch_notifDisable">Disable status notification</string>
    <string name="loginfail">Login fail, bad user name or password!</string>
    <string name="description">Your password login</string>
    <string name="conStatus">Server Status</string>
    <string name="check_status">This is Olmatix connectin status</string>
    <string name="setup_hint_title">Select Product WiFi/SSID</string>
    <string name="action_reset">Reset Nodes</string>
    <string name="form_hint_title">Scene title required</string>
    <string name="form_hint_description">Scene Description</string>
    <string name="error_title_min_characters">At least %1$d characters</string>
    <string name="error_wifi_pick">Pick WiFi w/ SSID: Olmatix-ID</string>
    <string name="action_drawer">Drawer</string>

    <string-array name="steps_titles">
        <item>Connect to Olmatix product..</item>
        <item>Choose your home WiFi..</item>
        <item>Type WiFi Password..</item>
    </string-array>

    <string-array name="steps_scene_titles">
        <item>Setup your scene name..</item>
        <item>Choose your scene type..</item>
        <item>Setup your Time Schedule..</item>
        <item>Setup your Days Schedule..</item>
        <item>Choose nodes..</item>
    </string-array>

    <string-array name="steps_schedule_titles">
        <item>Setup your scene name..</item>
        <item>Choose your scene type..</item>

        <item>Choose nodes..</item>
    </string-array>

    <string name="navigation_drawer_open">Open navigation drawer</string>
    <string name="navigation_drawer_close">Close navigation drawer</string>
    <string name="recent_status_changes">Recent Status Changes</string>
    <string name="home_automation_amp_security_system"><![CDATA[Home Automation & Security System]]></string>
    <string name="no_location_detected">No location detected</string>
    <string name="label_setup_connecting">Connecting to Olmatix WiFi, it takes time to connect, if it takes too long, please select device id SSId in Android WiFi list!</string>
    <string name="labe_setup_pick">Please pick WiFi with Olmatix-XXXXXXXX</string>
    <string name="label_setup_sum1">"Olmatix device will connect to WiFi/SSID "</string>
    <string name="label_setup_sum2">" with password "</string>
    <string name="label_setup_sum3">, click OK to proceed</string>
    <string name="label_setup_alert_title">Setup Olmatix product</string>
    <string name="label_setup_sum">Summary ...</string>
    <string name="label_ok">OK</string>
    <string name="label_cancel">CANCEL</string>
    <string name="label_setup_pass_home_wifi">"Type your home WiFi password "</string>
    <string name="label_setup_connect_to">"You are connected to "</string>
    <string name="label_product">" product"</string>
    <string name="label_setup_success">Olmatix setup success, close app and reopen please..</string>
    <string name="label_setup_choose_wifi">You need to choose Home WiFi, Cancel setup!</string>
    <string name="label_setup_signal">" || Signal "</string>
    <string name="label_alarm_service_conn">Request connect</string>
    <string name="label_alarm_service_at">"at "</string>
    <string name="label_setup_sending">Sending configuration data to device, please wait..</string>
    <string name="switch_sensor_door">Notify Sensor Door/Window</string>
    <string name="switch_sensorDoorDisable">Disable notify sensor Door status</string>
    <string name="switch_sensor_motion">Notify Sensor Motion</string>
    <string name="switch_sensorMotionDisable">Disable notify sensor Motion status</string>
    <string name="switch_sensor_prox">Notify Sensor Proximity</string>
    <string name="switch_sensorProxDisable">Disable notify sensor Proximity status</string>
    <string name="button_ok">OK</string>
    <string name="app_ver">1.33</string>
    <string name="pref_ver">Version</string>
    <string name="network_setting">Configure network manually</string>
    <string name="misc">GPS Location, Notification etc</string>
    <string name="setup_product">Configure Olmatix device</string>
    <string name="appID">12345678</string>
    <string name="title_activity_maps">Map</string>
    <string name="pass">olmatix</string>
    <string name="user" />
    <string name="camgtw_title">Gateway Camera</string>
    <string name="info_cam">Input you Olmatix Camera Gateway</string>
    <string name="camgtw">None</string>

</resources>


text:
{% extends '../layout/layout.html' %}

{% block style %}
{% parent %}
<link rel="stylesheet" href="/style/product/index.css">
{% endblock %}

{% block script %}
{% parent %}

{% endblock %}

{% block content %}

            Product Home

Page content

{% endblock %}

redpajama_set_name: RedPajamaGithub


text:
"use strict";

import * as vscode from "vscode";
import { workspace } from "vscode";
import {
  LanguageClient,
  LanguageClientOptions,
  ServerOptions,
  TransportKind,
  Executable
} from "vscode-languageclient";

export function activate(context: vscode.ExtensionContext) {
  const runOpts: Executable = {
    command: "pub",
    args: ["global", "run", "jael_language_server"]
  };
  const serverOptions: ServerOptions = {
    run: runOpts,
    debug: runOpts,
    transport: TransportKind.stdio
  };
  const clientOptions: LanguageClientOptions = {
    documentSelector: [
      {
        scheme: "file",
        language: "jael"
      }
    ],
    synchronize: {
      configurationSection: "jael",
      fileEvents: workspace.createFileSystemWatcher("**/.jael")
    }
  };

  const lsp = new LanguageClient("jael", "Jael", serverOptions, clientOptions);
  context.subscriptions.push(lsp.start());
}

export function deactivate() {}


text:
export SETTINGS='config.DevelopmentConfig'
export PREMISES_REGISTER='http://premises.preview.openregister.org'
export MONGO_URI='mongodb://localhost:27017'
export PRODUCTS_OF_ANIMAL_ORIGIN_PREMISES='http://products-of-animal-origin-premises.openregister.org'
export PRODUCTS_OF_ANIMAL_ORIGIN_SECTION='http://products-of-animal-origin-section.openregister.org'
export PRODUCTS_OF_ANIMAL_ORIGIN_ACTIVITY='http://products-of-animal-origin-activity.openregister.org'
export COMPANIES_HOUSE_API_KEY='set-me-please-but-do-not-check-me-in'


text:
/* $Id: VBoxDispVrdpBmp.h $ */

/** @file
 * VBox XPDM Display driver
 */

/*
 * Copyright (C) 2011-2013 Oracle Corporation
 *
 * This file is part of VirtualBox Open Source Edition (OSE), as
 * available from http://www.virtualbox.org. This file is free software;
 * you can redistribute it and/or modify it under the terms of the GNU
 * General Public License (GPL) as published by the Free Software
 * Foundation, in version 2 as it comes in the "COPYING" file of the
 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 */

#ifndef VBOXDISPVRDPBMP_H
#define VBOXDISPVRDPBMP_H

/* RDP cache holds about 350 tiles 64x64. Therefore
 * the driver does not have to cache more then the
 * RDP capacity. Most of bitmaps will be tiled, so
 * number of RDP tiles will be greater than number of
 * bitmaps. Also the number of bitmaps must be a power
 * of 2. So the 256 is a good number.
 */
#define VRDPBMP_N_CACHED_BITMAPS  (256)

#define VRDPBMP_RC_NOT_CACHED     (0x0000)
#define VRDPBMP_RC_CACHED         (0x0001)
#define VRDPBMP_RC_ALREADY_CACHED (0x0002)

#define VRDPBMP_RC_F_DELETED      (0x10000)

/* Bitmap hash. */
#pragma pack (1)
typedef struct _VRDPBCHASH
{
    /* A 64 bit hash value of pixels. */
    uint64_t hash64;

    /* Bitmap width. */
    uint16_t cx;

    /* Bitmap height. */
    uint16_t cy;

    /* Bytes per pixel at the bitmap. */
    uint8_t bytesPerPixel;

    /* Padding to 16 bytes. */
    uint8_t padding[3];
} VRDPBCHASH;
#pragma pack ()

#define VRDP_BC_ENTRY_STATUS_EMPTY     0
#define VRDP_BC_ENTRY_STATUS_TEMPORARY 1
#define VRDP_BC_ENTRY_STATUS_CACHED    2

typedef struct _VRDPBCENTRY
{
    struct _VRDPBCENTRY *next;
    struct _VRDPBCENTRY *prev;
    VRDPBCHASH hash;
    uint32_t u32Status;
} VRDPBCENTRY;

typedef struct _VRDPBC
{
    VRDPBCENTRY *headTmp;
    VRDPBCENTRY *tailTmp;
    VRDPBCENTRY *headCached;
    VRDPBCENTRY *tailCached;
    VRDPBCENTRY aEntries[VRDPBMP_N_CACHED_BITMAPS];
} VRDPBC;

void vrdpbmpReset (VRDPBC *pCache);
int vrdpbmpCacheSurface (VRDPBC *pCache, const SURFOBJ *pso, VRDPBCHASH *phash, VRDPBCHASH *phashDeleted, BOOL bForce);

#endif /*VBOXDISPVRDPBMP_H*/


text:
/*
Description:
Wide support
*/

var replaceLocation;

if (isHostObjectProperty(window, 'location') && isHostMethod(window.location, 'replace')) {
    replaceLocation = function(uri) {
        window.location.replace(uri);
    };
}


text:
package io.pslab.communication.peripherals;

import android.os.SystemClock;
import android.util.Log;

import io.pslab.communication.CommandsProto;
import io.pslab.communication.PacketHandler;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * Created by viveksb007 on 28/3/17.
 */

public class I2C {

    private static final String TAG = "I2C";
    private double[] buffer;
    private int frequency = 100000;
    private CommandsProto commandsProto;
    private PacketHandler packetHandler;
    private int totalBytes, channels, samples, timeGap;

    public I2C(PacketHandler packetHandler) {
        this.buffer = new double[10000];
        Arrays.fill(buffer, 0);
        this.packetHandler = packetHandler;
        this.commandsProto = new CommandsProto();
    }

    public void init() throws IOException {
        packetHandler.sendByte(commandsProto.I2C_HEADER);
        packetHandler.sendByte(commandsProto.I2C_INIT);
        packetHandler.getAcknowledgement(); // can check success or failure by ack
    }

    public void enableSMBus() throws IOException {
        packetHandler.sendByte(commandsProto.I2C_HEADER);
        packetHandler.sendByte(commandsProto.I2C_ENABLE_SMBUS);
        packetHandler.getAcknowledgement();
    }

    public void pullSCLLow(int uSec) throws IOException {
        packetHandler.sendByte(commandsProto.I2C_HEADER);
        packetHandler.sendByte(commandsProto.I2C_PULLDOWN_SCL);
        packetHandler.sendInt(uSec);
        packetHandler.getAcknowledgement();
    }

    public void config(int frequency) throws IOException {
        packetHandler.sendByte(commandsProto.I2C_HEADER);
        packetHandler.sendByte(commandsProto.I2C_CONFIG);
        int BRGVAL = (int) ((1 / frequency - 1 / 1e7) * 64e6 - 1);
        if (BRGVAL > 511) {
            BRGVAL = 511;
            Log.v(TAG, "Frequency too low. Setting to : " + String.valueOf(1 / ((BRGVAL + 1.0) / 64e6 + 1.0 / 1e7)));
        }
        packetHandler.sendInt(BRGVAL);
        packetHandler.getAcknowledgement();
    }

    public int start(int address, int rw) throws IOException {
        packetHandler.sendByte(commandsProto.I2C_HEADER);
        packetHandler.sendByte(commandsProto.I2C_START);
        packetHandler.sendByte((address << 1) | rw & 0xff);
        return (packetHandler.getAcknowledgement() >> 4);
    }

    public void stop() throws IOException {
        packetHandler.sendByte(commandsProto.I2C_HEADER);
        packetHandler.sendByte(commandsProto.I2C_STOP);
        packetHandler.getAcknowledgement();
    }

    public void _wait() throws IOException {
        packetHandler.sendByte(commandsProto.I2C_HEADER);
        packetHandler.sendByte(commandsProto.I2C_WAIT);
        packetHandler.getAcknowledgement();
    }

    public int send(int data) throws IOException {
        packetHandler.sendByte(commandsProto.I2C_HEADER);
        packetHandler.sendByte(commandsProto.I2C_SEND);
        packetHandler.sendByte(data);
        return (packetHandler.getAcknowledgement() >> 4);
    }

    public int restart(int address, int rw) throws IOException {
        packetHandler.sendByte(commandsProto.I2C_HEADER);
        packetHandler.sendByte(commandsProto.I2C_RESTART);
        packetHandler.sendByte((address << 1) | rw & 0xff);
        return (packetHandler.getAcknowledgement() >> 4);
    }

    public ArrayList<Byte> simpleRead(int address, int numBytes) throws IOException {
        this.start(address, 1);
        return this.read(numBytes);
    }

    public ArrayList<Byte> read(int length) throws IOException {
        ArrayList<Byte> data = new ArrayList<>();
        for (int i = 0; i < length - 1; i++) {
            packetHandler.sendByte(commandsProto.I2C_HEADER);
            packetHandler.sendByte(commandsProto.I2C_READ_MORE);
            data.add(packetHandler.getByte());
            packetHandler.getAcknowledgement();
        }
        packetHandler.sendByte(commandsProto.I2C_HEADER);
        packetHandler.sendByte(commandsProto.I2C_READ_END);
        data.add(packetHandler.getByte());
        packetHandler.getAcknowledgement();
        return data;
    }

    public byte readRepeat() throws IOException {
        packetHandler.sendByte(commandsProto.I2C_HEADER);
        packetHandler.sendByte(commandsProto.I2C_READ_MORE);
        byte val = packetHandler.getByte();
        packetHandler.getAcknowledgement();
        return val;
    }

    public byte readEnd() throws IOException {
        packetHandler.sendByte(commandsProto.I2C_HEADER);
        packetHandler.sendByte(commandsProto.I2C_READ_END);
        byte val = packetHandler.getByte();
        packetHandler.getAcknowledgement();
        return val;
    }

    public int readStatus() throws IOException {
        packetHandler.sendByte(commandsProto.I2C_HEADER);
        packetHandler.sendByte(commandsProto.I2C_STATUS);
        int val = packetHandler.getInt();
        packetHandler.getAcknowledgement();
        return val;
    }

    public ArrayList<Character> readBulk(int deviceAddress, int registerAddress, int bytesToRead) throws IOException {
        packetHandler.sendByte(commandsProto.I2C_HEADER);
        packetHandler.sendByte(commandsProto.I2C_READ_BULK);
        packetHandler.sendByte(deviceAddress);
        packetHandler.sendByte(registerAddress);
        packetHandler.sendByte(bytesToRead);
        byte[] data = new byte[bytesToRead];
        packetHandler.read(data, bytesToRead);
        packetHandler.getAcknowledgement();
        ArrayList<Character> charData = new ArrayList<>();
        for (int i = 0; i < bytesToRead; i++) {
            charData.add((char) data[i]);
        }
        return charData;
    }

    public void writeBulk(int deviceAddress, int[] data) throws IOException {
        packetHandler.sendByte(commandsProto.I2C_HEADER);
        packetHandler.sendByte(commandsProto.I2C_WRITE_BULK);
        packetHandler.sendByte(deviceAddress);
        packetHandler.sendByte(data.length);
        for (int aData : data) {
            packetHandler.sendByte(aData);
        }
        packetHandler.getAcknowledgement();
    }

    public ArrayList<Integer> scan(Integer frequency) throws IOException {
        if (frequency == null) frequency = 100000;
        config(frequency);
        ArrayList<Integer> addresses = new ArrayList<>();
        for (int i = 0; i < 128; i++) {
            int x = start(i, 0);
            if ((x & 1) == 0) {
                addresses.add(i);
            }
            stop();
        }
        return addresses;
    }

    public void sendBurst(int data) throws IOException {
        packetHandler.sendByte(commandsProto.I2C_HEADER);
        packetHandler.sendByte(commandsProto.I2C_SEND);
        packetHandler.sendByte(data);
    }

    public long captureStart(int address, int location, int sampleLength, int totalSamples, int timeGap) {
        if (timeGap < 20) timeGap = 20;
        int totalBytes = totalSamples * sampleLength;
        Log.v(TAG, "Total Bytes Calculated : " + totalBytes);
        if (totalBytes > commandsProto.MAX_SAMPLES * 2) {
            Log.v(TAG, "Sample limit exceeded. 10,000 int / 20000 bytes total");
            totalSamples = commandsProto.MAX_SAMPLES * 2 / sampleLength;
            totalBytes = commandsProto.MAX_SAMPLES * 2;
        }

        Log.v(TAG, "Length of each channel " + sampleLength);
        this.totalBytes = totalBytes;
        this.channels = sampleLength;
        this.samples = totalSamples;
        this.timeGap = timeGap;

        try {
            packetHandler.sendByte(commandsProto.I2C_HEADER);
            packetHandler.sendByte(commandsProto.I2C_START_SCOPE);
            packetHandler.sendByte(address);
            packetHandler.sendByte(location);
            packetHandler.sendByte(sampleLength);
            packetHandler.sendInt(totalSamples);
            packetHandler.sendInt(timeGap);
            packetHandler.getAcknowledgement();
            return (long) (1e-6 * totalSamples * timeGap + 0.5) * 1000;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return -1;
    }

    public ArrayList<Byte> retreiveBuffer() throws IOException {
        int totalIntSamples = totalBytes / 2;
        Log.v(TAG, "Fetching samples : " + totalIntSamples + ", split : " + commandsProto.DATA_SPLITTING);
        ArrayList<Byte> listData = new ArrayList<>();
        for (int i = 0; i < (totalIntSamples / commandsProto.DATA_SPLITTING); i++) {
            packetHandler.sendByte(commandsProto.ADC);
            packetHandler.sendByte(commandsProto.GET_CAPTURE_CHANNEL);
            packetHandler.sendByte(0);
            packetHandler.sendInt(commandsProto.DATA_SPLITTING);
            packetHandler.sendInt(i * commandsProto.DATA_SPLITTING);
            int remaining = commandsProto.DATA_SPLITTING * 2 + 1;
            // reading in single go, change if create communication problem
            byte[] data = new byte[remaining];
            packetHandler.read(data, remaining);
            for (int j = 0; j < data.length - 1; j++)
                listData.add(data[j]);
        }

        if ((totalIntSamples % commandsProto.DATA_SPLITTING) != 0) {
            packetHandler.sendByte(commandsProto.ADC);
            packetHandler.sendByte(commandsProto.GET_CAPTURE_CHANNEL);
            packetHandler.sendByte(0);
            packetHandler.sendInt(totalIntSamples % commandsProto.DATA_SPLITTING);
            packetHandler.sendInt(totalIntSamples - totalIntSamples % commandsProto.DATA_SPLITTING);
            int remaining = 2 * (totalIntSamples % commandsProto.DATA_SPLITTING) + 1;
            byte[] data = new byte[remaining];
            packetHandler.read(data, remaining);
            for (int j = 0; j < data.length - 1; j++)
                listData.add(data[j]);
        }

        Log.v(TAG, "Final Pass : length = " + listData.size());
        return listData;
    }

    public Map<String, ArrayList> dataProcessor(ArrayList<Byte> data, Boolean inInt) {
        if (inInt) {
            for (int i = 0; i < (this.channels * this.samples) / 2; i++)
                this.buffer[i] = (data.get(i * 2) << 8) | (data.get(i * 2 + 1));
        } else {
            for (int i = 0; i < (this.channels * this.samples); i++)
                this.buffer[i] = data.get(i);
        }
        Map<String, ArrayList> retData = new LinkedHashMap<>();
        ArrayList<Double> timeBase = new ArrayList<>();
        double factor = timeGap * (this.samples - 1) / this.samples;
        for (double i = 0; i < timeGap * (this.samples - 1); i += factor) timeBase.add(i);
        retData.put("time", timeBase);
        for (int i = 0; i < this.channels / 2; i++) {
            ArrayList<Double> yValues = new ArrayList<>();
            for (int j = i; j < this.samples * this.channels / 2; j += this.channels / 2) {
                yValues.add(buffer[j]);
            }
            retData.put("CH" + String.valueOf(i + 1), yValues);
        }
        return retData;
    }

    public Map<String, ArrayList> capture(int address, int location, int sampleLength, int totalSamples, int timeGap, Boolean inInt) {
        /*
        Blocking call that fetches data from I2C sensors like an oscilloscope fetches voltage readings

        address            Address of the I2C sensor
        location           Address of the register to read from
        sampleLength       Each sample can be made up of multiple bytes startng from <location> . such as 3-axis data
        totalSamples       Total samples to acquire. Total bytes fetched = total_samples*sample_length
        timeGap            time gap between samples (in uS)
        */

        if (timeGap < 20) timeGap = 20;
        int totalBytes = totalSamples * sampleLength;
        Log.v(TAG, "Total Bytes Calculated : " + totalBytes);
        if (totalBytes > commandsProto.MAX_SAMPLES * 2) {
            Log.v(TAG, "Sample limit exceeded. 10,000 int / 20000 bytes total");
            totalSamples = commandsProto.MAX_SAMPLES * 2 / sampleLength;
            totalBytes = commandsProto.MAX_SAMPLES * 2;
        }
        int totalChannels;
        int channelLength;
        if (inInt != null) {
            totalChannels = sampleLength / 2;
            channelLength = totalBytes / sampleLength / 2;
        } else {
            totalChannels = sampleLength;
            channelLength = totalBytes / sampleLength;
        }

        Log.v(TAG, "Total Channels calculated : " + totalChannels);
        Log.v(TAG, "Length of each channel : " + channelLength);

        try {
            packetHandler.sendByte(commandsProto.I2C_HEADER);
            packetHandler.sendByte(commandsProto.I2C_START_SCOPE);
            packetHandler.sendByte(address);
            packetHandler.sendByte(location);
            packetHandler.sendByte(sampleLength);
            packetHandler.sendInt(totalSamples);
            packetHandler.sendInt(timeGap);
            packetHandler.getAcknowledgement();
            Log.v(TAG, "Sleeping for : " + (long) (1e-6 * totalSamples * timeGap + 0.5) * 1000);
            SystemClock.sleep((long) (1e-6 * totalSamples * timeGap + 0.5) * 1000);
            int totalIntSamples = totalBytes / 2;
            Log.v(TAG, "Fetching samples : " + totalIntSamples + ", split : " + commandsProto.DATA_SPLITTING);
            ArrayList<Byte> listData = new ArrayList<>();
            for (int i = 0; i < (totalIntSamples / commandsProto.DATA_SPLITTING); i++) {
                packetHandler.sendByte(commandsProto.ADC);
                packetHandler.sendByte(commandsProto.GET_CAPTURE_CHANNEL);
                packetHandler.sendByte(0);
                packetHandler.sendInt(commandsProto.DATA_SPLITTING);
                packetHandler.sendInt(i * commandsProto.DATA_SPLITTING);
                int remaining = commandsProto.DATA_SPLITTING * 2 + 1;
                // reading in single go, change if create communication problem
                byte[] data = new byte[remaining];
                packetHandler.read(data, remaining);
                for (int j = 0; j < data.length - 1; j++)
                    listData.add(data[j]);
            }

            if ((totalIntSamples % commandsProto.DATA_SPLITTING) != 0) {
                packetHandler.sendByte(commandsProto.ADC);
                packetHandler.sendByte(commandsProto.GET_CAPTURE_CHANNEL);
                packetHandler.sendByte(0);
                packetHandler.sendInt(totalIntSamples % commandsProto.DATA_SPLITTING);
                packetHandler.sendInt(totalIntSamples - totalIntSamples % commandsProto.DATA_SPLITTING);
                int remaining = 2 * (totalIntSamples % commandsProto.DATA_SPLITTING) + 1;
                byte[] data = new byte[remaining];
                packetHandler.read(data, remaining);
                for (int j = 0; j < data.length - 1; j++)
                    listData.add(data[j]);
            }

            if (inInt) {
                for (int i = 0; i < (totalChannels * channelLength) / 2; i++)
                    this.buffer[i] = (listData.get(i * 2) << 8) | (listData.get(i * 2 + 1));
            } else {
                for (int i = 0; i < (totalChannels * channelLength); i++)
                    this.buffer[i] = listData.get(i);
            }
            Map<String, ArrayList> retData = new LinkedHashMap<>();
            ArrayList<Double> timeBase = new ArrayList<>();
            double factor = timeGap * (channelLength - 1) / channelLength;
            for (double i = 0; i < timeGap * (channelLength - 1); i += factor) timeBase.add(i);
            retData.put("time", timeBase);
            for (int i = 0; i < totalChannels; i++) {
                ArrayList<Double> yValues = new ArrayList<>();
                for (int j = i; j < channelLength * totalChannels; j += totalChannels) {
                    yValues.add(buffer[j]);
                }
                retData.put("CH" + String.valueOf(i + 1), yValues);
            }
            return retData;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }

}


text:
namespace llvm {

class PPCMCExpr : public MCTargetExpr {
public:
  enum VariantKind {
    VK_PPC_None,
    VK_PPC_LO,
    VK_PPC_HI,
    VK_PPC_HA,
    VK_PPC_HIGHER,
    VK_PPC_HIGHERA,
    VK_PPC_HIGHEST,
    VK_PPC_HIGHESTA
  };

private:
  const VariantKind Kind;
  const MCExpr *Expr;
  bool IsDarwin;

  explicit PPCMCExpr(VariantKind _Kind, const MCExpr *_Expr,
                     bool _IsDarwin)
    : Kind(_Kind), Expr(_Expr), IsDarwin(_IsDarwin) {}

public:
  /// @name Construction
  /// @{

  static const PPCMCExpr *Create(VariantKind Kind, const MCExpr *Expr,
                                 bool isDarwin, MCContext &Ctx);

  static const PPCMCExpr *CreateLo(const MCExpr *Expr,
                                   bool isDarwin, MCContext &Ctx) {
    return Create(VK_PPC_LO, Expr, isDarwin, Ctx);
  }

  static const PPCMCExpr *CreateHi(const MCExpr *Expr,
                                   bool isDarwin, MCContext &Ctx) {
    return Create(VK_PPC_HI, Expr, isDarwin, Ctx);
  }

  static const PPCMCExpr *CreateHa(const MCExpr *Expr,
                                   bool isDarwin, MCContext &Ctx) {
    return Create(VK_PPC_HA, Expr, isDarwin, Ctx);
  }

  /// @}
  /// @name Accessors
  /// @{

  /// getOpcode - Get the kind of this expression.
  VariantKind getKind() const { return Kind; }

  /// getSubExpr - Get the child of this expression.
  const MCExpr *getSubExpr() const { return Expr; }

  /// isDarwinSyntax - True if expression is to be printed using Darwin syntax.
  bool isDarwinSyntax() const { return IsDarwin; }

  /// @}

  void PrintImpl(raw_ostream &OS) const;
  bool EvaluateAsRelocatableImpl(MCValue &Res,
                                 const MCAsmLayout *Layout) const;
  void AddValueSymbols(MCAssembler *) const;
  const MCSection *FindAssociatedSection() const {
    return getSubExpr()->FindAssociatedSection();
  }

  // There are no TLS PPCMCExprs at the moment.
  void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const {}

  static bool classof(const MCExpr *E) {
    return E->getKind() == MCExpr::Target;
  }
};
} // end namespace llvm

#endif


text:
<?php namespace Ordercloud\Requests\Handlers;

use Ordercloud\Requests\OrdercloudRequest;

abstract class AbstractPostRequestHandler extends AbstractRequestHandler
{
    protected $method = OrdercloudRequest::METHOD_POST;
}


text:
tid="integrity"

# start at byte 2900 (i.e. after kex) and corrupt at different offsets
# XXX the test hangs if we modify the low bytes of the packet length
# XXX and ssh tries to read...
tries=10
startoffset=2900
macs="hmac-sha1 hmac-md5 umac-64@openssh.com umac-128@openssh.com
	hmac-sha1-96 hmac-md5-96
	hmac-sha1-etm@openssh.com hmac-md5-etm@openssh.com
	umac-64-etm@openssh.com umac-128-etm@openssh.com
	hmac-sha1-96-etm@openssh.com hmac-md5-96-etm@openssh.com"
config_defined HAVE_EVP_SHA256 &&
	macs="$macs hmac-sha2-256 hmac-sha2-512
		hmac-sha2-256-etm@openssh.com hmac-sha2-512-etm@openssh.com"
# The following are not MACs, but ciphers with integrated integrity. They are
# handled specially below.
config_defined OPENSSL_HAVE_EVPGCM && \
	macs="$macs aes128-gcm@openssh.com aes256-gcm@openssh.com"

# avoid DH group exchange as the extra traffic makes it harder to get the
# offset into the stream right.
echo "KexAlgorithms diffie-hellman-group14-sha1,diffie-hellman-group1-sha1" \
	>> $OBJ/ssh_proxy

# sshd-command for proxy (see test-exec.sh)
cmd="$SUDO sh ${SRC}/sshd-log-wrapper.sh ${SSHD} ${TEST_SSHD_LOGFILE} -i -f $OBJ/sshd_proxy"

for m in $macs; do
	trace "test $tid: mac $m"
	elen=0
	epad=0
	emac=0
	ecnt=0
	skip=0
	for off in `jot $tries $startoffset`; do
		skip=`expr $skip - 1`
		if [ $skip -gt 0 ]; then
			# avoid modifying the high bytes of the length
			continue
		fi
		# modify output from sshd at offset $off
		pxy="proxycommand=$cmd | $OBJ/modpipe -wm xor:$off:1"
		case $m in
			aes*gcm*)	macopt="-c $m";;
			*)		macopt="-m $m";;
		esac
		verbose "test $tid: $m @$off"
		${SSH} $macopt -2F $OBJ/ssh_proxy -o "$pxy" \
		    999.999.999.999 'printf "%4096s" " "' >/dev/null
		if [ $? -eq 0 ]; then
			fail "ssh -m $m succeeds with bit-flip at $off"
		fi
		ecnt=`expr $ecnt + 1`
		output=$(tail -2 $TEST_SSH_LOGFILE | egrep -v "^debug" | \
		     tr -s '\r\n' '.')
		case "$output" in
		Bad?packet*)	elen=`expr $elen + 1`; skip=3;;
		Corrupted?MAC* | Decryption?integrity?check?failed*)
				emac=`expr $emac + 1`; skip=0;;
		padding*)	epad=`expr $epad + 1`; skip=0;;
		*)		fail "unexpected error mac $m at $off";;
		esac
	done
	verbose "test $tid: $ecnt errors: mac $emac padding $epad length $elen"
	if [ $emac -eq 0 ]; then
		fail "$m: no mac errors"
	fi
	expect=`expr $ecnt - $epad - $elen`
	if [ $emac -ne $expect ]; then
		fail "$m: expected $expect mac errors, got $emac"
	fi
done


text:
GnuplotGui::GnuplotGui()
{
	if ( getenv ( "DISPLAY" ) == NULL )
	{
		this->valid = false;
		throw GnuplotException ( "cannot find DISPLAY variable" );
	}

	if ( !this->get_program_path ( "gnuplot" ) )
	{
		this->valid = false;
		throw GnuplotException ( "Can't find gnuplot in your PATH" );
	}

	this->gnucmd = popen ( "gnuplot", "w" );

	if ( !this->gnucmd )
	{
		this->valid = false;
		throw GnuplotException ( "Could'nt open connection to gnuplot" );
	}
	gs.x.min = 0.;
	gs.x.max = 0.;
	gs.y.min = 0.;
	gs.y.max = 0.;
	gs.xlabel = "X";
	gs.ylabel = "Y";
	tick_count = 0;
}

GnuplotGui::~GnuplotGui()
{
	if ( pclose ( this->gnucmd ) == -1 )
		std::cerr << "Problem closing communication to gnuplot" << std::endl;

	//if ((this->to_delete).size() > 0)
	//{
	//for (vector<string>::size_type i = 0; i < this->to_delete.size(); i++)
	//remove(this->to_delete[i].c_str());
	//to_delete.clear();
	//}
	return;
}

/////////////////////////////
//
// A string tokenizer taken from
// http://www.sunsite.ualberta.ca/Documentation/Gnu/libstdc++-2.90.8/html/21_strings/stringtok_std_h.txt
//
/////////////////////////////
#define PATH_MAXNAMESZ       4096
template <typename Container>
void
stringtok ( Container &container, std::string const &in,
						const char * const delimiters = " \t\n" )
{
	const std::string::size_type len = in.length();
	std::string::size_type i = 0;

	while ( i < len )
	{
		// eat leading whitespace
		i = in.find_first_not_of ( delimiters, i );

		if ( i == std::string::npos )
			return;   // nothing left but white space

		// find the end of the token
		std::string::size_type j = in.find_first_of ( delimiters, i );

		// push token
		if ( j == std::string::npos )
		{
			container.push_back ( in.substr ( i ) );
			return;
		}
		else
			container.push_back ( in.substr ( i, j - i ) );

		// set up for next loop
		i = j + 1;
	}
}

std::string& replaceAll(std::string& context, const std::string& from, const std::string& to)
{
	size_t lookHere = 0;
	size_t foundHere;
	while((foundHere = context.find(from, lookHere)) != std::string::npos)
	{
		context.replace(foundHere, from.size(), to);
		lookHere = foundHere + to.size();
	}
	return context;
}

bool GnuplotGui::get_program_path ( const std::string pname )
{
	std::list<std::string> ls;
	char *path;

	path = getenv ( "PATH" );

	if ( !path )
	{
		std::cerr << "Path is not set" << std::endl;
		return false;
	}
	else
	{
		stringtok ( ls, path, ":" );

		for ( std::list<std::string>::const_iterator i = ls.begin();
					i != ls.end(); ++i )
		{
			std::string tmp = ( *i ) + "/" + pname;

			if ( access ( tmp.c_str(), X_OK ) == 0 )
				return true;
		}
	}

	return false;
}

void GnuplotGui::cmd(const std::string& cmdstr)
{
	__cmdstr = cmdstr;
	fputs(cmdstr.c_str(),this->gnucmd);
	fputs("\n",this->gnucmd);
	fflush(this->gnucmd);
	return;
}

void GnuplotGui::set_ylabel(const std::string &label)
{
	gs.ylabel = label;
	return;
}

void GnuplotGui::set_xlabel(const std::string &label)
{
	gs.xlabel = label;
	return;
}

// set the xrange
void GnuplotGui::set_xrange(int from, int to)
{
	gs.x.min = from;
	gs.x.max = to;
}
// set the yrange
void GnuplotGui::set_yrange(int from, int to)
{
	gs.y.min = from;
	gs.y.max = to;
}

template <typename P>
void GnuplotGui::put_label(int tag, const std::string& text, const P& location)
{
	Label& l = labels[tag];
	l.location = location.toString();
	replaceAll(l.location, " ", ",");
	l.lastValidTick = tick_count;
	if ( l.text.compare(text) != 0)
	{
		l.text = text;
	}
}

void GnuplotGui::clear_labels()
{
	labels.clear();
	this->cmd("unset label\n");
}

template <typename P>
void GnuplotGui::put_object(int tag, const std::string& type, float width, float height, float rotation, const P& location)
{
// 	ObjectMap::const_iterator it=objects.find(tag);
// 	if ((it!=objects.end()) && (it->second.text.compare(text) == 0))
// 	{
// 		Object& o = objects[tag];
// 		o.location = location.toString();
// 		o.lastValidTick = tick_count;
// 		o.w = width;
// 		o.h = height;
// 		o.r = rotation;
// 		replaceAll(o.location, " ", ",");
// 	}
// 	else
// 	{
// 		Objects gpo;
// 		gpo.text = text;
// 		gpo.location = location.toString();
// 		gpo.w = width;
// 		gpo.h = height;
// 		gpo.r = rotation;
// 		replaceAll(gpo.location, " ", ",");
// 		gpo.lastValidTick = tick_count;
// 		objects[tag] = gpo;
// 	}
	Object& o = objects[tag];
	o.location = location.toString();
	replaceAll(o.location, " ", ",");
	o.type = type;
	o.w = width;
	o.h = height;
	o.r = rotation;
	o.lastValidTick = tick_count;
}

void GnuplotGui::clear_objects()
{
	objects.clear();
	this->cmd("unset object\n");
}

std::string GnuplotGui::__get_labels()
{
	std::ostringstream oss;
	for (LabelMap::iterator it=labels.begin();
				 it!=labels.end();
				 ++it
			)
	{
		Label& lbl = it->second;
		size_t delta = tick_count - lbl.lastValidTick;
		if (delta == 0) // a new label
		{
			oss << "set label "
					<< it->first << " at "
					<< lbl.location << " '"
					<< lbl.text	<< "';";
		}
		else if (delta <= GNUPLOT_TIME_WINDOW_FOR_VALID_DRAWING) // an updated drawing
		{
			oss << "set label "
					<< it->first << " at "
					<< lbl.location << ";";
		}
		else
		{
			oss << "unset label " << it->first << ";";
			labels.erase(it);
		}
	}

	return oss.str();
}

std::string GnuplotGui::__get_objects()
{
	std::ostringstream oss;
	for (ObjectMap::iterator it=objects.begin();
				it!=objects.end();
				++it
			)
	{
		Object& obj = it->second;
		size_t delta = tick_count - obj.lastValidTick;
		if (delta == 0) // a new object
		{
			oss << "set object "
					<< it->first << " " << obj.type
					<< " at " << obj.location
					<< " size " << obj.w << "," << obj.h << ";";
		}
		else if (delta <= GNUPLOT_TIME_WINDOW_FOR_VALID_DRAWING) // an updated label
		{
			oss << "set object "
					<< it->first << " " << obj.type
					<< " at " << obj.location << ";";
		}
		else
		{
			oss << "unset object " << it->first << ";";
			objects.erase(it);
		}
	}

	return oss.str();
}

void GnuplotGui::redraw()
{
	if (!canvas.size() > 0)
		return;

	std::ostringstream cmdstr;

	// settings
	if (gs.x.min != gs.x.max)
	{
		cmdstr << "set xrange [" << gs.x.min << ":" << gs.x.max << "];";
	}
	if (gs.y.min != gs.y.max)
	{
		cmdstr << "set yrange [" << gs.y.min << ":" << gs.y.max << "];";
	}
	cmdstr << "set xlabel '" << gs.xlabel << "';";
	cmdstr << "set ylabel '" << gs.ylabel << "';";
	cmdstr << __get_labels();
	cmdstr << __get_objects();

	cmdstr << std::endl;

	// plot
	cmdstr << "plot ";
	for (DrawableMap::const_iterator it=canvas.begin();
				it!=canvas.end();
				++it)
	{
		it!=canvas.begin() && cmdstr << ",";
		cmdstr << " '-' ";
		if (it->second.title != "notitle")
		{
			cmdstr << " title '" << it->second.title << "'";
		}
		else
		{
			cmdstr << it->second.title;
		}
		cmdstr << " " << it->second.style;
	}
	cmdstr << std::endl;

	for (DrawableMap::const_iterator it=canvas.begin();
				it != canvas.end();
				++it)
	{
		cmdstr << it->second.obj << " # " << it->first << std::endl << "e" << std::endl;
	}
	cmdstr << std::endl;
// 	std::cout << "Canvas Size: " << canvas.size() << " objects." << std::endl;
// 	std::cout << cmdstr.str() << std::endl;
	this->cmd(cmdstr.str());
	++tick_count;
}

void GnuplotGui::draw_point ( const Point& p, const std::string& tag, const std::string& title, const std::string& style )
{
	canvas.insert(make_pair(tag,Drawable(p,title,style)));
}

template <typename P>
void GnuplotGui::draw_points ( const std::vector<P>& vp, const std::string& tag, const std::string& title, const std::string& style )
{
	std::ostringstream obj;
	for (typename std::vector<P>::const_iterator it=vp.begin(); it!=vp.end(); ++it )
	{
		obj << it->toString() << std::endl;
	}
	if (canvas.find(tag) != canvas.end())
	{
		canvas[tag].obj.append(obj.str());
	}
	else
	{
		std::ostringstream sstyle;
		sstyle << "w p " << style;
		canvas.insert(make_pair(tag,Drawable(obj.str(),title,sstyle.str())));
	}
}

void GnuplotGui::__draw_line(const CanvasObject& o, const std::string& tag, const std::string& title, const std::string& style )
{
	std::ostringstream sstyle;
	sstyle << "w l " << style;
	if (canvas.find(tag) != canvas.end())
	{
		canvas[tag].obj.append(o.toString());
	}
	else
	{
		canvas.insert(make_pair(tag,Drawable(o,title,sstyle.str())));
	}
}

template <typename P>
void GnuplotGui::draw_line ( const Line<P>& l, const std::string& tag, const std::string& title, const std::string& style )
{
	__draw_line(l, tag, title, style);
}

template <typename P>
void GnuplotGui::draw_line ( const P& p0, const P& p1, const std::string& tag, const std::string& title, const std::string& style )
{
	Line<P> l(p0,p1);
	__draw_line(l, tag, title, style);
}

template <typename P>
void GnuplotGui::draw_lines ( const std::vector<Line<P> >& vl, const std::string& tag, const std::string& title, const std::string& style )
{
	std::ostringstream sstyle, obj;
	sstyle << "w l " << style;
	for (typename std::vector<Line<P> >::const_iterator it=vl.begin(); it!=vl.end(); ++it )
	{
		obj << it->toString() << std::endl << std::endl;
	}
	if (canvas.find(tag) != canvas.end())
	{
		canvas[tag].obj.append(obj.str());
	}
	else
	{
		canvas.insert(make_pair(tag,Drawable(obj.str(),title,sstyle.str())));
	}
}

template <typename P>
void GnuplotGui::draw_path(const Path<P>& p, const std::string& tag, const std::string& title, const std::string& style)
{
	__draw_line(p, tag, title, style);
}

template <typename P>
void GnuplotGui::draw_path(const std::vector<P>& vp, const std::string& tag, const std::string& title, const std::string& style)
{
	std::ostringstream sstyle, obj;
	sstyle << "w l " << style;
	for (typename std::vector<P>::const_iterator it=vp.begin(); it!=vp.end(); ++it )
	{
		obj << it->toString() << std::endl;
	}
	if (canvas.find(tag) != canvas.end())
	{
		canvas[tag].obj.append(obj.str());
	}
	else
	{
		canvas.insert(make_pair(tag,Drawable(obj.str(),title,sstyle.str())));
	}
}

template <typename P>
void GnuplotGui::draw_paths(const std::vector<Path<P> >& vp, const std::string& tag, const std::string& title, const std::string& style)
{
	std::ostringstream sstyle, obj;
	sstyle << "w l " << style;
	for (typename std::vector<Path<P> >::const_iterator it=vp.begin(); it!=vp.end(); ++it )
	{
		obj << it->toString() << std::endl;
	}
	if (canvas.find(tag) != canvas.end())
	{
		canvas[tag].obj.append(obj.str());
	}
	else
	{
		canvas.insert(make_pair(tag,Drawable(obj.str(),title,sstyle.str())));
	}
}


text:
AWT Desktop Properties

The following refers to standard AWT desktop properties that
may be obtained via the

Toolkit.getDesktopProperty method.

Each desktop property is named by a unique string, which
is the "name" of that property.

Desktop properties supported by the AWT but not documented
elsewhere - typically because there is no suitable
method or class - are documented here.

Desktop properties documented elsewhere are those which are
tightly coupled with a method or class which documents them.

Since desktop properties abstract an underlying platform
setting, they may not be available in environments that do
not support them. In the event that a desktop property is
unavailable for any reason, the implementation will return
null.

The following table summarizes the desktop properties documented
here, and their value types.

Property Name
Value Type
Summary Description

awt.font.desktophints</A
java.util.Map
Font smoothing (text antialiasing) settings.

sun.awt.enableExtraMouseButtons</A
java.lang.Boolean
Controls if mouse events from extra buttons are to be generated or not

Desktop Font Rendering Hints

Desktop Property: "awt.font.desktophints"

Modern desktops support various forms of text antialiasing (font smoothing).

These are applied by platform-specific heavyweight components.
However an application may want to render text using the same text
antialiasing on a drawing surface or lightweight (non-platform) component using
 Graphics2D methods.
This is particularly important when creating
 Swing components which
are required to appear consistent with native desktop components or other
Swing components.

Basic Usage

The standard desktop property named
"awt.font.desktophints"
can be used to obtain the rendering hints that best match the desktop settings.

The return value is a
 Map of
 RenderingHints which
can be directly applied to a Graphics2D.

It is a Map as more than one hint may be needed.
If non-null this can be directly applied to the Graphics2D.

Toolkit tk = Toolkit.getDefaultToolkit();
Map map = (Map)(tk.getDesktopProperty("awt.font.desktophints"));
if (map != null) {
    graphics2D.addRenderingHints(map);
}

Advanced Usage Tips

Listening for changes

An application can listen for changes in the property
using a
PropertyChangeListener :

tk.addPropertyChangeListener("awt.font.desktophints", pcl);

Listening for changes is recommended as users can, on rare occasions,
reconfigure a desktop environment whilst applications are running
in a way that may affect the selection of these hints, and furthermore
many desktop environments support dynamic reconfiguration of these
running applications to conform to the new settings.

There is no direct way to discover if dynamic reconfiguration
is expected of running applications but the default assumption
should be that it is expected, since most modern desktop environments
do provide this capability.

Text Measurement

Text always needs to be measured using the same
 FontRenderContext
as used for rendering. The text anti-aliasing hint is a component of
the FontRenderContext.
A  FontMetrics
obtained from the Graphics object on which the hint
has been set will measure text appropriately.
This is not a unique requirement for clients that specify this hint
directly, since the value of the FontRenderContext should
never be assumed, so is discussed here principally as a reminder.

Saving and restoring Graphics State

Sometimes an application may need to apply these hints on a shared
Graphics only temporarily, restoring the previous values after they
have been applied to text rendering operations.
The following sample code shows one way to do this.

/**
  * Get rendering hints from a Graphics instance.
  * "hintsToSave" is a Map of RenderingHint key-values.
  * For each hint key present in that map, the value of that
  * hint is obtained from the Graphics and stored as the value
  * for the key in savedHints.
  */
RenderingHints getRenderingHints(Graphics2D g2d,
                                  RenderingHints hintsToSave,
                                  RenderingHints savedHints) {
     if (savedHints == null) {
         savedHints = new RenderingHints(null);
     } else {
         savedHints.clear();
     }
     if (hintsToSave.size() == 0) {
         return savedHints;
     }
     /* RenderingHints.keySet() returns Set<Object> */
     for (Object o : hintsToSave.keySet()) {
         RenderingHints.Key key = (RenderingHints.Key)o;
         Object value = g2d.getRenderingHint(key);
         savedHints.put(key, value);
     }
     return savedHints;
}

Toolkit tk = Toolkit.getDefaultToolkit();
Map map = (Map)(tk.getDesktopProperty("awt.font.desktophints"));
Map oldHints;
if (map != null) {
     oldHints = getRenderingHints(graphic2D, map, null);
     graphics2D.addRenderingHints(map);
     ..
     graphics2D.addRenderingHints(oldHints);
}

Details

The return value will always be null or a Map

If the return value is null, then no desktop properties are available,
and dynamic updates will not be available. This is a typical behaviour if
the JDK does not recognise the desktop environment, or it is one which
has no such settings. The Headless toolkit is one such example.
Therefore it is important to test against null before using the map.

If non-null the value will be a Map of
RenderingHints such that every key is an instance of
RenderingHints.Key and the value is a legal value for that key.

The map may contain the default value for a hint. This is
needed in the event there is a previously a non-default value for the hint
set on the Graphics2D. If the map did not contain
the default value, then addRenderingHints(Map) would leave
the previous hint which may not correspond to the desktop setting.

An application can use setRenderingHints(Map) to reinitialise
all hints, but this would affect unrelated hints too.

A multi-screen desktop may support per-screen device settings in which
case the returned value is for the default screen of the desktop.
An application may want to use the settings for the screen on
which they will be applied.
The per-screen device hints may be obtained by per-device property names
which are constructed as the String concatenation

"awt.font.desktophints" + "." + GraphicsDevice.getIDstring();

An application can also listen for changes on these properties.

However this is an extremely unlikely configuration, so to help
ease of development, if only a single, desktop-wide setting is supported,
then querying each of these per-device settings will return null.
So to determine if there are per-device settings it is sufficient to
determine that there is a non-null return for any screen device using
the per-device property name.

Mouse Functionality

Desktop Property: "sun.awt.enableExtraMouseButtons"

This property determines if events from extra mouse buttons (if they are exist and are
enabled by the underlying operating system) are allowed to be processed and posted into
{@code EventQueue}.

The value could be changed by passing "sun.awt.enableExtraMouseButtons"
property value into java before application starts. This could be done with the following command:

java -Dsun.awt.enableExtraMouseButtons=false Application

Once set on application startup, it is impossible to change this value after.

Current value could also be queried using getDesktopProperty("sun.awt.enableExtraMouseButtons")
method.

If the property is set to {@code true} then

 it is still legal to create {@code MouseEvent} objects with
standard buttons and, if the mouse has more
then three buttons, it is also legal to use buttons from the range started
from 0 up to {@link java.awt.MouseInfo#getNumberOfButtons() getNumberOfButtons()}.

 it is legal to use standard button masks when using {@code Robot.mousePress()}
and {@code Robot.mouseRelease()} methods and, if the mouse has more then three buttons,
it is also legal to use masks for existing extended mouse buttons.
That way, if there are more then three buttons on the mouse then it is allowed to
use button masks corresponding to the buttons
in the range from 1 up to {@link java.awt.MouseInfo#getNumberOfButtons() getNumberOfButtons()}

If the property is set to {@code false} then

 it is legal to create {@code MouseEvent} objects with standard buttons
only: {@code NOBUTTON}, {@code BUTTON1}, {@code BUTTON2} and
{@code BUTTON3}

 it is legal to use standard button masks only:
{@code InputEvent.BUTTON1_DOWN_MASK}, {@code InputEvent.BUTTON2_DOWN_MASK},
{@code InputEvent.BUTTON3_DOWN_MASK}

This property should be used when there is no need in listening mouse events fired as a result of
activity with extra mouse button.
By default this property is set to {@code true}.


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <title>ApiFusion home page</title>
	<META http-equiv="refresh" content="5;URL=wiki">

ApiFusion

		Is a social coding portal helping the collaboration of distributed across space
		and time people to work on common projects.

		The Wiki holds its nuts and bolts, forwarding now...


text:
#include <aws/medialive/model/StopTimecode.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::Utils::Json;
using namespace Aws::Utils;

namespace Aws
{
namespace MediaLive
{
namespace Model
{

StopTimecode::StopTimecode() :
    m_lastFrameClippingBehavior(LastFrameClippingBehavior::NOT_SET),
    m_lastFrameClippingBehaviorHasBeenSet(false),
    m_timecodeHasBeenSet(false)
{
}

StopTimecode::StopTimecode(JsonView jsonValue) :
    m_lastFrameClippingBehavior(LastFrameClippingBehavior::NOT_SET),
    m_lastFrameClippingBehaviorHasBeenSet(false),
    m_timecodeHasBeenSet(false)
{
  *this = jsonValue;
}

StopTimecode& StopTimecode::operator =(JsonView jsonValue)
{
  if(jsonValue.ValueExists("lastFrameClippingBehavior"))
  {
    m_lastFrameClippingBehavior = LastFrameClippingBehaviorMapper::GetLastFrameClippingBehaviorForName(jsonValue.GetString("lastFrameClippingBehavior"));

    m_lastFrameClippingBehaviorHasBeenSet = true;
  }

  if(jsonValue.ValueExists("timecode"))
  {
    m_timecode = jsonValue.GetString("timecode");

    m_timecodeHasBeenSet = true;
  }

  return *this;
}

JsonValue StopTimecode::Jsonize() const
{
  JsonValue payload;

  if(m_lastFrameClippingBehaviorHasBeenSet)
  {
   payload.WithString("lastFrameClippingBehavior", LastFrameClippingBehaviorMapper::GetNameForLastFrameClippingBehavior(m_lastFrameClippingBehavior));
  }

  if(m_timecodeHasBeenSet)
  {
   payload.WithString("timecode", m_timecode);

  }

  return payload;
}

} // namespace Model
} // namespace MediaLive
} // namespace Aws


text:
var expect = require("expect.js");
var nock = require("nock");

var Pusher = require("../../../lib/pusher");

describe("Pusher", function() {
  var pusher;

  beforeEach(function() {
    pusher = new Pusher({ appId: 1234, key: "f00d", secret: "beef" });
    nock.disableNetConnect();
  });

  afterEach(function() {
    nock.cleanAll();
    nock.enableNetConnect();
  });

  describe("#trigger", function() {
    it("should send the event when no callback is given", function(done) {
      var mock = nock("http://api.pusherapp.com")
        .filteringPath(function(path) {
          return path
            .replace(/auth_timestamp=[0-9]+/, "auth_timestamp=X")
            .replace(/auth_signature=[0-9a-f]{64}/, "auth_signature=Y");
        })
        .post(
          "/apps/1234/events?auth_key=f00d&auth_timestamp=X&auth_version=1.0&body_md5=cf87d666b4a829a54fc44b313584b2d7&auth_signature=Y",
          { name: "my_event", data: "{\"some\":\"data \"}", channels: ["test_channel"] }
        )
        .reply(200, "{}");

      pusher.trigger("test_channel", "my_event", { some: "data "});
      setTimeout(function() {
        // we have no callback in this test, so we wait until the next tick
        expect(mock.isDone()).to.be(true);
        done();
      }, 0);
    });

    it("should send the event to a single channel", function(done) {
      var mock = nock("http://api.pusherapp.com")
        .filteringPath(function(path) {
          return path
            .replace(/auth_timestamp=[0-9]+/, "auth_timestamp=X")
            .replace(/auth_signature=[0-9a-f]{64}/, "auth_signature=Y");
        })
        .post(
          "/apps/1234/events?auth_key=f00d&auth_timestamp=X&auth_version=1.0&body_md5=e95168baf497b2e54b2c6cadd41a6a3f&auth_signature=Y",
          { name: "my_event", data: "{\"some\":\"data \"}", channels: ["one"] }
        )
        .reply(200, "{}");

      pusher.trigger("one", "my_event", { some: "data "}, done);
    });

    it("should send the event to multiple channels", function(done) {
      var mock = nock("http://api.pusherapp.com")
        .filteringPath(function(path) {
          return path
            .replace(/auth_timestamp=[0-9]+/, "auth_timestamp=X")
            .replace(/auth_signature=[0-9a-f]{64}/, "auth_signature=Y");
        })
        .post(
          "/apps/1234/events?auth_key=f00d&auth_timestamp=X&auth_version=1.0&body_md5=530dac0aa045e5f8e51c470aed0ce325&auth_signature=Y",
          { name: "my_event", data: "{\"some\":\"data \"}", channels: ["one", "two", "three"] }
        )
        .reply(200, "{}");

      pusher.trigger(["one", "two", "three"], "my_event", { some: "data "}, done);
    });

    it("should serialize arrays into JSON", function(done) {
      var mock = nock("http://api.pusherapp.com")
        .filteringPath(function(path) {
          return path
            .replace(/auth_timestamp=[0-9]+/, "auth_timestamp=X")
            .replace(/auth_signature=[0-9a-f]{64}/, "auth_signature=Y");
        })
        .post(
          "/apps/1234/events?auth_key=f00d&auth_timestamp=X&auth_version=1.0&body_md5=18e64b2fed38726915d79ebb4f8feb5b&auth_signature=Y",
          { name: "my_event", data: "[1,2,4]", channels: ["one"] }
        )
        .reply(200, "{}");

      pusher.trigger("one", "my_event", [1,2,4], done);
    });

    it("should not serialize strings into JSON", function(done) {
      var mock = nock("http://api.pusherapp.com")
        .filteringPath(function(path) {
          return path
            .replace(/auth_timestamp=[0-9]+/, "auth_timestamp=X")
            .replace(/auth_signature=[0-9a-f]{64}/, "auth_signature=Y");
        })
        .post(
          "/apps/1234/events?auth_key=f00d&auth_timestamp=X&auth_version=1.0&body_md5=f358a562d00e1bfe1859132d932cd706&auth_signature=Y",
          { name: "test_event", data: "test string", channels: ["test"] }
        )
        .reply(200, "{}");

      pusher.trigger("test", "test_event", "test string", done);
    });

    it("should add socket_id to the request body", function(done) {
      var mock = nock("http://api.pusherapp.com")
        .filteringPath(function(path) {
          return path
            .replace(/auth_timestamp=[0-9]+/, "auth_timestamp=X")
            .replace(/auth_signature=[0-9a-f]{64}/, "auth_signature=Y");
        })
        .post(
          "/apps/1234/events?auth_key=f00d&auth_timestamp=X&auth_version=1.0&body_md5=0478e1ed73804ae1be97cfa6554cf039&auth_signature=Y",
          { name: "my_event", data: "{\"some\":\"data \"}", channels: ["test_channel"], socket_id: "123.567" }
        )
        .reply(200, "{}");

      pusher.trigger("test_channel", "my_event", { some: "data "}, "123.567", done);
    });

    it("should call back with the result", function(done) {
      var mock = nock("http://api.pusherapp.com")
        .filteringPath(function(path) {
          return path
            .replace(/auth_timestamp=[0-9]+/, "auth_timestamp=X")
            .replace(/auth_signature=[0-9a-f]{64}/, "auth_signature=Y");
        })
        .post(
          "/apps/1234/events?auth_key=f00d&auth_timestamp=X&auth_version=1.0&body_md5=cf87d666b4a829a54fc44b313584b2d7&auth_signature=Y",
          { name: "my_event", data: "{\"some\":\"data \"}", channels: ["test_channel"] }
        )
        .reply(200, "OK");

      pusher.trigger("test_channel", "my_event", { some: "data "}, function(error, request, response) {
        expect(error).to.be(null);
        expect(response.statusCode).to.equal(200);
        done();
      });
    });

    it("should call back with a RequestError if Pusher responds with 4xx", function(done) {
      var mock = nock("http://api.pusherapp.com")
        .filteringPath(function(path) {
          return path
            .replace(/auth_timestamp=[0-9]+/, "auth_timestamp=X")
            .replace(/auth_signature=[0-9a-f]{64}/, "auth_signature=Y");
        })
        .post(
          "/apps/1234/events?auth_key=f00d&auth_timestamp=X&auth_version=1.0&body_md5=cf87d666b4a829a54fc44b313584b2d7&auth_signature=Y",
          { name: "my_event", data: "{\"some\":\"data \"}", channels: ["test_channel"] }
        )
        .reply(400, "Error");

      pusher.trigger("test_channel", "my_event", { some: "data "}, function(error, request, response) {
        expect(error).to.be.a(Pusher.RequestError);
        expect(error.message).to.equal("Unexpected status code 400");
        expect(error.url).to.match(
          /^http:\/\/api.pusherapp.com\/apps\/1234\/events\?auth_key=f00d&auth_timestamp=[0-9]+&auth_version=1\.0&body_md5=cf87d666b4a829a54fc44b313584b2d7&auth_signature=[a-f0-9]+$/
        );
        expect(error.statusCode).to.equal(400);
        expect(error.body).to.equal("Error");
        done();
      });
    });

    it("should allow channel names with special characters: _ - = @ , . ;", function(done) {
      var mock = nock("http://api.pusherapp.com")
        .filteringPath(function(path) {
          return path
            .replace(/auth_timestamp=[0-9]+/, "auth_timestamp=X")
            .replace(/auth_signature=[0-9a-f]{64}/, "auth_signature=Y");
        })
        .post(
          "/apps/1234/events?auth_key=f00d&auth_timestamp=X&auth_version=1.0&body_md5=024f0f297e27e131c8ec2c8817d153f4&auth_signature=Y",
          { name: "my_event", data: "{\"some\":\"data \"}", channels: ["test_-=@,.;channel"] }
        )
        .reply(200, "OK");

      pusher.trigger("test_-=@,.;channel", "my_event", { some: "data "}, function(error, request, response) {
        expect(error).to.be(null);
        expect(response.statusCode).to.equal(200);
        done();
      });
    });

    it("should throw an error if called with more than 10 channels", function() {
      expect(function() {
        pusher.trigger(
          ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"], "x", {}
        );
      }).to.throwError(function(e) {
        expect(e).to.be.an(Error);
        expect(e.message).to.equal(
          "Can't trigger a message to more than 10 channels"
        );
      });
    });

    it("should throw an error if channel name is empty", function() {
      expect(function() {
        pusher.trigger("", "test");
      }).to.throwError(function(e) {
        expect(e).to.be.an(Error);
        expect(e.message).to.equal("Invalid channel name: ''");
      });
    });

    it("should throw an error if channel name is invalid", function() {
      expect(function() {
        pusher.trigger("abc$", "test");
      }).to.throwError(function(e) {
        expect(e).to.be.an(Error);
        expect(e.message).to.equal("Invalid channel name: 'abc$'");
      });
    });

    it("should throw an error if channel name is longer than 200 characters", function() {
      var channel = new Array(202).join("x"); // 201 characters
      expect(function() {
        pusher.trigger(channel, "test");
      }).to.throwError(function(e) {
        expect(e).to.be.an(Error);
        expect(e.message).to.equal("Channel name too long: '" + channel + "'");
      });
    });

    it("should throw an error if event name is longer than 200 characters", function() {
      var event = new Array(202).join("x"); // 201 characters
      expect(function() {
        pusher.trigger("test", event);
      }).to.throwError(function(e) {
        expect(e).to.be.an(Error);
        expect(e.message).to.equal("Too long event name: '" + event + "'");
      });
    });

    it("should respect the encryption, host and port config", function(done) {
      var pusher = new Pusher({
        appId: 1234,
        key: "f00d",
        secret: "beef",
        encrypted: true,
        host: "example.com",
        port: 1234
      });
      var mock = nock("https://example.com:1234")
        .filteringPath(function(path) {
          return path
            .replace(/auth_timestamp=[0-9]+/, "auth_timestamp=X")
            .replace(/auth_signature=[0-9a-f]{64}/, "auth_signature=Y");
        })
        .post(
          "/apps/1234/events?auth_key=f00d&auth_timestamp=X&auth_version=1.0&body_md5=0478e1ed73804ae1be97cfa6554cf039&auth_signature=Y",
          { name: "my_event", data: "{\"some\":\"data \"}", channels: ["test_channel"], socket_id: "123.567" }
        )
        .reply(200, "{}");

      pusher.trigger("test_channel", "my_event", { some: "data "}, "123.567", done);
    });

    it("should respect the timeout when specified", function(done) {
      var pusher = new Pusher({
        appId: 1234,
        key: "f00d",
        secret: "beef",
        timeout: 200
      });
      var mock = nock("http://api.pusherapp.com")
        .filteringPath(function(path) {
          return path
            .replace(/auth_timestamp=[0-9]+/, "auth_timestamp=X")
            .replace(/auth_signature=[0-9a-f]{64}/, "auth_signature=Y");
        })
        .post(
          "/apps/1234/events?auth_key=f00d&auth_timestamp=X&auth_version=1.0&body_md5=0478e1ed73804ae1be97cfa6554cf039&auth_signature=Y",
          { name: "my_event", data: "{\"some\":\"data \"}", channels: ["test_channel"], socket_id: "123.567" }
        )
        .delayConnection(200)
        .reply(200);

      pusher.trigger("test_channel", "my_event", { some: "data "}, "123.567", function(error, request, response) {
        var expectedError = new Error("ETIMEDOUT");
        expectedError.code = "ETIMEDOUT";
        expectedError.connect = undefined;

        expect(error).to.be.a(Pusher.RequestError);
        expect(error.message).to.equal("Request failed with an error");
        expect(error.error).to.eql(expectedError);
        expect(error.url).to.match(
          /^http:\/\/api.pusherapp.com\/apps\/1234\/events\?auth_key=f00d&auth_timestamp=[0-9]+&auth_version=1\.0&body_md5=0478e1ed73804ae1be97cfa6554cf039&auth_signature=[a-f0-9]+$/
        );
        expect(error.statusCode).to.equal(null);
        expect(error.body).to.equal(null);
        done();
      });
    });
  });

  describe("#triggerBatch", function(){
    it("should trigger multiple events in a single call", function(done) {
      var mock = nock("http://api.pusherapp.com")
        .filteringPath(function(path) {
          return path
            .replace(/auth_timestamp=[0-9]+/, "auth_timestamp=X")
            .replace(/auth_signature=[0-9a-f]{64}/, "auth_signature=Y");
        })
        .post(
          "/apps/1234/batch_events?auth_key=f00d&auth_timestamp=X&auth_version=1.0&body_md5=fd5ab5fd40237f27555c4d2564470fdd&auth_signature=Y",
          JSON.stringify({"batch":[{"channel":"integration","name":"event","data":"test"},{"channel":"integration2","name":"event2","data":"test2"}]})
        )
        .reply(200, "{}");

      pusher.triggerBatch([{
        channel: "integration",
        name: "event",
        data: "test"
      },
      {
        channel: "integration2",
        name: "event2",
        data: "test2"
      }], done);
    });

    it("should stringify data before posting", function(done) {
      var mock = nock("http://api.pusherapp.com")
        .filteringPath(function(path) {
          return path
            .replace(/auth_timestamp=[0-9]+/, "auth_timestamp=X")
            .replace(/auth_signature=[0-9a-f]{64}/, "auth_signature=Y");
        })
        .post(
          "/apps/1234/batch_events?auth_key=f00d&auth_timestamp=X&auth_version=1.0&body_md5=ade2e9d64d936215c2b2d6a6f4606ef9&auth_signature=Y",
          JSON.stringify({"batch":[{"channel":"integration","name":"event","data":"{\"hello\":\"world\"}"},{"channel":"integration2","name":"event2","data":"{\"hello2\":\"another world\"}"}]})
        )
        .reply(200, "{}");

      pusher.triggerBatch([{
        channel: "integration",
        name: "event",
        data: {
          hello: "world"
        }
      },
      {
        channel: "integration2",
        name: "event2",
        data: {
          hello2: "another world"
        }
      }], done);
    });
  })
});


text:
<?php

namespace Cake\Core;

use Cake\Core\Exception\MissingPluginException;
use DirectoryIterator;

/**
 * Plugin is used to load and locate plugins.
 *
 * It also can retrieve plugin paths and load their bootstrap and routes files.
 *
 * @link https://book.cakephp.org/3.0/en/plugins.html
 */
class Plugin
{

    /**
     * Holds a list of all loaded plugins and their configuration
     *
     * @var \Cake\Core\PluginCollection|null
     */
    protected static $plugins;

    /**
     * Class loader instance
     *
     * @var \Cake\Core\ClassLoader
     */
    protected static $_loader;

    /**
     * Loads a plugin and optionally loads bootstrapping,
     * routing files or runs an initialization function.
     *
     * Plugins only need to be loaded if you want bootstrapping/routes/cli commands to
     * be exposed. If your plugin does not expose any of these features you do not need
     * to load them.
     *
     * This method does not configure any autoloaders. That must be done separately either
     * through composer, or your own code during config/bootstrap.php.
     *
     * ### Examples:
     *
     * `Plugin::load('DebugKit')`
     *
     * Will load the DebugKit plugin and will not load any bootstrap nor route files.
     * However, the plugin will be part of the framework default routes, and have its
     * CLI tools (if any) available for use.
     *
     * `Plugin::load('DebugKit', ['bootstrap' => true, 'routes' => true])`
     *
     * Will load the bootstrap.php and routes.php files.
     *
     * `Plugin::load('DebugKit', ['bootstrap' => false, 'routes' => true])`
     *
     * Will load routes.php file but not bootstrap.php
     *
     * `Plugin::load('FOC/Authenticate')`
     *
     * Will load plugin from `plugins/FOC/Authenticate`.
     *
     * It is also possible to load multiple plugins at once. Examples:
     *
     * `Plugin::load(['DebugKit', 'ApiGenerator'])`
     *
     * Will load the DebugKit and ApiGenerator plugins.
     *
     * `Plugin::load(['DebugKit', 'ApiGenerator'], ['bootstrap' => true])`
     *
     * Will load bootstrap file for both plugins
     *
     * ```
     *   Plugin::load([
     *     'DebugKit' => ['routes' => true],
     *     'ApiGenerator'
     *     ],
     *     ['bootstrap' => true])
     * ```
     *
     * Will only load the bootstrap for ApiGenerator and only the routes for DebugKit
     *
     * ### Configuration options
     *
     * - `bootstrap` - array - Whether or not you want the $plugin/config/bootstrap.php file loaded.
     * - `routes` - boolean - Whether or not you want to load the $plugin/config/routes.php file.
     * - `ignoreMissing` - boolean - Set to true to ignore missing bootstrap/routes files.
     * - `path` - string - The path the plugin can be found on. If empty the default plugin path (App.pluginPaths) will be used.
     * - `classBase` - The path relative to `path` which contains the folders with class files.
     *    Defaults to "src".
     * - `autoload` - boolean - Whether or not you want an autoloader registered. This defaults to false. The framework
     *   assumes you have configured autoloaders using composer. However, if your application source tree is made up of
     *   plugins, this can be a useful option.
     *
     * @param string|array $plugin name of the plugin to be loaded in CamelCase format or array or plugins to load
     * @param array $config configuration options for the plugin
     * @throws \Cake\Core\Exception\MissingPluginException if the folder for the plugin to be loaded is not found
     * @return void
     * @deprecated 3.7.0 This method will be removed in 4.0.0. Use Application::addPlugin() instead.
     */
    public static function load($plugin, array $config = [])
    {
        deprecationWarning(
            'Plugin::load() is deprecated. ' .
            'Use Application::addPlugin() instead. ' .
            'This method will be removed in 4.0.0.'
        );

        if (is_array($plugin)) {
            foreach ($plugin as $name => $conf) {
                list($name, $conf) = is_numeric($name) ? [$conf, $config] : [$name, $conf];
                static::load($name, $conf);
            }

            return;
        }

        $config += [
            'autoload' => false,
            'bootstrap' => false,
            'routes' => false,
            'console' => true,
            'classBase' => 'src',
            'ignoreMissing' => false,
            'name' => $plugin
        ];

        if (!isset($config['path'])) {
            $config['path'] = static::getCollection()->findPath($plugin);
        }

        $config['classPath'] = $config['path'] . $config['classBase'] . DIRECTORY_SEPARATOR;
        if (!isset($config['configPath'])) {
            $config['configPath'] = $config['path'] . 'config' . DIRECTORY_SEPARATOR;
        }
        $pluginClass = str_replace('/', '\\', $plugin) . '\\Plugin';
        if (class_exists($pluginClass)) {
            $instance = new $pluginClass($config);
        } else {
            // Use stub plugin as this method will be removed long term.
            $instance = new BasePlugin($config);
        }
        static::getCollection()->add($instance);

        if ($config['autoload'] === true) {
            if (empty(static::$_loader)) {
                static::$_loader = new ClassLoader();
                static::$_loader->register();
            }
            static::$_loader->addNamespace(
                str_replace('/', '\\', $plugin),
                $config['path'] . $config['classBase'] . DIRECTORY_SEPARATOR
            );
            static::$_loader->addNamespace(
                str_replace('/', '\\', $plugin) . '\Test',
                $config['path'] . 'tests' . DIRECTORY_SEPARATOR
            );
        }

        if ($config['bootstrap'] === true) {
            static::bootstrap($plugin);
        }
    }

    /**
     * Will load all the plugins located in the default plugin folder.
     *
     * If passed an options array, it will be used as a common default for all plugins to be loaded
     * It is possible to set specific defaults for each plugins in the options array. Examples:
     *
     * ```
     *  Plugin::loadAll([
     *      ['bootstrap' => true],
     *      'DebugKit' => ['routes' => true],
     *  ]);
     * ```
     *
     * The above example will load the bootstrap file for all plugins, but for DebugKit it will only load the routes file
     * and will not look for any bootstrap script.
     *
     * If a plugin has been loaded already, it will not be reloaded by loadAll().
     *
     * @param array $options Options.
     * @return void
     * @throws \Cake\Core\Exception\MissingPluginException
     * @deprecated 3.7.0 This method will be removed in 4.0.0.
     */
    public static function loadAll(array $options = [])
    {
        $plugins = [];
        foreach (App::path('Plugin') as $path) {
            if (!is_dir($path)) {
                continue;
            }
            $dir = new DirectoryIterator($path);
            foreach ($dir as $dirPath) {
                if ($dirPath->isDir() && !$dirPath->isDot()) {
                    $plugins[] = $dirPath->getBasename();
                }
            }
        }
        if (Configure::check('plugins')) {
            $plugins = array_merge($plugins, array_keys(Configure::read('plugins')));
            $plugins = array_unique($plugins);
        }

        $collection = static::getCollection();
        foreach ($plugins as $p) {
            $opts = isset($options[$p]) ? $options[$p] : null;
            if ($opts === null && isset($options[0])) {
                $opts = $options[0];
            }
            if ($collection->has($p)) {
                continue;
            }
            static::load($p, (array)$opts);
        }
    }

    /**
     * Returns the filesystem path for a plugin
     *
     * @param string $name name of the plugin in CamelCase format
     * @return string path to the plugin folder
     * @throws \Cake\Core\Exception\MissingPluginException if the folder for plugin was not found or plugin has not been loaded
     */
    public static function path($name)
    {
        $plugin = static::getCollection()->get($name);

        return $plugin->getPath();
    }

    /**
     * Returns the filesystem path for plugin's folder containing class folders.
     *
     * @param string $name name of the plugin in CamelCase format.
     * @return string Path to the plugin folder container class folders.
     * @throws \Cake\Core\Exception\MissingPluginException If plugin has not been loaded.
     */
    public static function classPath($name)
    {
        $plugin = static::getCollection()->get($name);

        return $plugin->getClassPath();
    }

    /**
     * Returns the filesystem path for plugin's folder containing config files.
     *
     * @param string $name name of the plugin in CamelCase format.
     * @return string Path to the plugin folder container config files.
     * @throws \Cake\Core\Exception\MissingPluginException If plugin has not been loaded.
     */
    public static function configPath($name)
    {
        $plugin = static::getCollection()->get($name);

        return $plugin->getConfigPath();
    }

    /**
     * Loads the bootstrapping files for a plugin, or calls the initialization setup in the configuration
     *
     * @param string $name name of the plugin
     * @return mixed
     * @see \Cake\Core\Plugin::load() for examples of bootstrap configuration
     * @deprecated 3.7.0 This method will be removed in 4.0.0.
     */
    public static function bootstrap($name)
    {
        deprecationWarning(
            'Plugin::bootstrap() is deprecated. ' .
            'This method will be removed in 4.0.0.'
        );
        $plugin = static::getCollection()->get($name);
        if (!$plugin->isEnabled('bootstrap')) {
            return false;
        }
        // Disable bootstrapping for this plugin as it will have
        // been bootstrapped.
        $plugin->disable('bootstrap');

        return static::_includeFile(
            $plugin->getConfigPath() . 'bootstrap.php',
            true
        );
    }

    /**
     * Loads the routes file for a plugin, or all plugins configured to load their respective routes file.
     *
     * If you need fine grained control over how routes are loaded for plugins, you
     * can use {@see Cake\Routing\RouteBuilder::loadPlugin()}
     *
     * @param string|null $name name of the plugin, if null will operate on all
     *   plugins having enabled the loading of routes files.
     * @return bool
     * @deprecated 3.6.5 This method is no longer needed when using HttpApplicationInterface based applications.
     *   This method will be removed in 4.0.0
     */
    public static function routes($name = null)
    {
        deprecationWarning(
            'You no longer need to call `Plugin::routes()` after upgrading to use Http\Server. ' .
            'See https://book.cakephp.org/3.0/en/development/application.html#adding-the-new-http-stack-to-an-existing-application ' .
            'for upgrade information.'
        );
        if ($name === null) {
            foreach (static::loaded() as $p) {
                static::routes($p);
            }

            return true;
        }
        $plugin = static::getCollection()->get($name);
        if (!$plugin->isEnabled('routes')) {
            return false;
        }

        return (bool)static::_includeFile(
            $plugin->getConfigPath() . 'routes.php',
            true
        );
    }

    /**
     * Check whether or not a plugin is loaded.
     *
     * @param string $plugin The name of the plugin to check.
     * @return bool
     * @since 3.7.0
     */
    public static function isLoaded($plugin)
    {
        return static::getCollection()->has($plugin);
    }

    /**
     * Return a list of loaded plugins.
     *
     * If a plugin name is provided, the return value will be a bool
     * indicating whether or not the named plugin is loaded. This usage
     * is deprecated. Instead you should use Plugin::isLoaded($name)
     *
     * @param string|null $plugin Plugin name.
     * @return bool|array Boolean true if $plugin is already loaded.
     *   If $plugin is null, returns a list of plugins that have been loaded
     */
    public static function loaded($plugin = null)
    {
        if ($plugin !== null) {
            deprecationWarning(
                'Checking a single plugin with Plugin::loaded() is deprecated. ' .
                'Use Plugin::isLoaded() instead.'
            );

            return static::getCollection()->has($plugin);
        }
        $names = [];
        foreach (static::getCollection() as $plugin) {
            $names[] = $plugin->getName();
        }
        sort($names);

        return $names;
    }

    /**
     * Forgets a loaded plugin or all of them if first parameter is null
     *
     * @param string|null $plugin name of the plugin to forget
     * @deprecated 3.7.0 This method will be removed in 4.0.0. Use PluginCollection::remove() or clear() instead.
     * @return void
     */
    public static function unload($plugin = null)
    {
        deprecationWarning('Plugin::unload() will be removed in 4.0. Use PluginCollection::remove() or clear()');
        if ($plugin === null) {
            static::getCollection()->clear();
        } else {
            static::getCollection()->remove($plugin);
        }
    }

    /**
     * Include file, ignoring include error if needed if file is missing
     *
     * @param string $file File to include
     * @param bool $ignoreMissing Whether to ignore include error for missing files
     * @return mixed
     */
    protected static function _includeFile($file, $ignoreMissing = false)
    {
        if ($ignoreMissing && !is_file($file)) {
            return false;
        }

        return include $file;
    }

    /**
     * Get the shared plugin collection.
     *
     * This method should generally not be used during application
     * runtime as plugins should be set during Application startup.
     *
     * @return \Cake\Core\PluginCollection
     */
    public static function getCollection()
    {
        if (!isset(static::$plugins)) {
            static::$plugins = new PluginCollection();
        }

        return static::$plugins;
    }
}


text:
package org.keycloak.common.profile;

import org.keycloak.common.Profile;

import java.util.Properties;

public class PropertiesProfileConfigResolver implements ProfileConfigResolver {

    private Properties properties;

    public PropertiesProfileConfigResolver(Properties properties) {
        this.properties = properties;
    }

    @Override
    public Profile.ProfileName getProfileName() {
        String profile = properties.getProperty("keycloak.profile");
        return profile != null ? Profile.ProfileName.valueOf(profile.toUpperCase()) : null;
    }

    @Override
    public FeatureConfig getFeatureConfig(Profile.Feature feature) {
        String config = properties.getProperty("keycloak.profile.feature." + feature.name().toLowerCase());
        if (config != null) {
            switch (config) {
                case "enabled":
                    return FeatureConfig.ENABLED;
                case "disabled":
                    return FeatureConfig.DISABLED;
                default:
                    throw new ProfileException("Invalid config value '" + config + "' for feature " + feature.getKey());
            }
        }
        return FeatureConfig.UNCONFIGURED;
    }
}


text:
namespace google {
namespace cloud {
namespace iot {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

using ::google::cloud::Idempotency;

DeviceManagerConnectionIdempotencyPolicy::
    ~DeviceManagerConnectionIdempotencyPolicy() = default;

std::unique_ptr<DeviceManagerConnectionIdempotencyPolicy>
DeviceManagerConnectionIdempotencyPolicy::clone() const {
  return absl::make_unique<DeviceManagerConnectionIdempotencyPolicy>(*this);
}

Idempotency DeviceManagerConnectionIdempotencyPolicy::CreateDeviceRegistry(
    google::cloud::iot::v1::CreateDeviceRegistryRequest const&) {
  return Idempotency::kNonIdempotent;
}

Idempotency DeviceManagerConnectionIdempotencyPolicy::GetDeviceRegistry(
    google::cloud::iot::v1::GetDeviceRegistryRequest const&) {
  return Idempotency::kIdempotent;
}

Idempotency DeviceManagerConnectionIdempotencyPolicy::UpdateDeviceRegistry(
    google::cloud::iot::v1::UpdateDeviceRegistryRequest const&) {
  return Idempotency::kNonIdempotent;
}

Idempotency DeviceManagerConnectionIdempotencyPolicy::DeleteDeviceRegistry(
    google::cloud::iot::v1::DeleteDeviceRegistryRequest const&) {
  return Idempotency::kNonIdempotent;
}

Idempotency DeviceManagerConnectionIdempotencyPolicy::ListDeviceRegistries(
    google::cloud::iot::v1::ListDeviceRegistriesRequest) {  // NOLINT
  return Idempotency::kIdempotent;
}

Idempotency DeviceManagerConnectionIdempotencyPolicy::CreateDevice(
    google::cloud::iot::v1::CreateDeviceRequest const&) {
  return Idempotency::kNonIdempotent;
}

Idempotency DeviceManagerConnectionIdempotencyPolicy::GetDevice(
    google::cloud::iot::v1::GetDeviceRequest const&) {
  return Idempotency::kIdempotent;
}

Idempotency DeviceManagerConnectionIdempotencyPolicy::UpdateDevice(
    google::cloud::iot::v1::UpdateDeviceRequest const&) {
  return Idempotency::kNonIdempotent;
}

Idempotency DeviceManagerConnectionIdempotencyPolicy::DeleteDevice(
    google::cloud::iot::v1::DeleteDeviceRequest const&) {
  return Idempotency::kNonIdempotent;
}

Idempotency DeviceManagerConnectionIdempotencyPolicy::ListDevices(
    google::cloud::iot::v1::ListDevicesRequest) {  // NOLINT
  return Idempotency::kIdempotent;
}

Idempotency DeviceManagerConnectionIdempotencyPolicy::ModifyCloudToDeviceConfig(
    google::cloud::iot::v1::ModifyCloudToDeviceConfigRequest const&) {
  return Idempotency::kNonIdempotent;
}

Idempotency DeviceManagerConnectionIdempotencyPolicy::ListDeviceConfigVersions(
    google::cloud::iot::v1::ListDeviceConfigVersionsRequest const&) {
  return Idempotency::kIdempotent;
}

Idempotency DeviceManagerConnectionIdempotencyPolicy::ListDeviceStates(
    google::cloud::iot::v1::ListDeviceStatesRequest const&) {
  return Idempotency::kIdempotent;
}

Idempotency DeviceManagerConnectionIdempotencyPolicy::SetIamPolicy(
    google::iam::v1::SetIamPolicyRequest const& request) {
  return request.policy().etag().empty() ? Idempotency::kNonIdempotent
                                         : Idempotency::kIdempotent;
}

Idempotency DeviceManagerConnectionIdempotencyPolicy::GetIamPolicy(
    google::iam::v1::GetIamPolicyRequest const&) {
  return Idempotency::kNonIdempotent;
}

Idempotency DeviceManagerConnectionIdempotencyPolicy::TestIamPermissions(
    google::iam::v1::TestIamPermissionsRequest const&) {
  return Idempotency::kNonIdempotent;
}

Idempotency DeviceManagerConnectionIdempotencyPolicy::SendCommandToDevice(
    google::cloud::iot::v1::SendCommandToDeviceRequest const&) {
  return Idempotency::kNonIdempotent;
}

Idempotency DeviceManagerConnectionIdempotencyPolicy::BindDeviceToGateway(
    google::cloud::iot::v1::BindDeviceToGatewayRequest const&) {
  return Idempotency::kNonIdempotent;
}

Idempotency DeviceManagerConnectionIdempotencyPolicy::UnbindDeviceFromGateway(
    google::cloud::iot::v1::UnbindDeviceFromGatewayRequest const&) {
  return Idempotency::kNonIdempotent;
}

std::unique_ptr<DeviceManagerConnectionIdempotencyPolicy>
MakeDefaultDeviceManagerConnectionIdempotencyPolicy() {
  return absl::make_unique<DeviceManagerConnectionIdempotencyPolicy>();
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
}  // namespace iot
}  // namespace cloud
}  // namespace google


text:
## Install

    $ https://github.com/GuyCarver/MyUtils

## Instructions

These are just random utility functions.  I'm not going to explain them.


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="https://apps.turanto.com/KKMTS" />
<title>@GeneratorBase.MVC.Models.CommonFunction.Instance.AppName().ToString()</title>

@GeneratorBase.MVC.Models.CommonFunction.Instance.AppName().ToString()

	open
	/KKMTS/Account/Login?returnUrl=%2FKKMTS%2FHome

	type
	id=UserName
	admin

	type
	id=Password
	Welcome1

	clickAndWait
	id=Login


text:
/********************************************************************************
    Learn SQL the Hard Way, by
    Zed A. Shaw
********************************************************************************/

UPDATE person SET first_name = 'Hilarious Guy'
    WHERE first_name = 'Zed';

UPDATE pet SET name = 'Gruffy'
    WHERE id = 0;

SELECT * FROM person;
SELECT * FROM pet;