text:
/*!
 * ◆◆◆
 * Solution to Homework Problem 2.63 (Page 155)
 *
 * Fill in code for the following C functions. Function `srl` performs
 * a logical right shift using an arithmetic right shift (given by value
 * xsra), followed by other operations not including right shifts or
 * division. You may use the computation `8 * sizeof(int)` to determine
 * a `w`, the number of bits in data type int, the shift amount k can
 * can range from 0 to `w - 1`.
 */

#include <stdio.h>

#define OK 0
#define NO -1
#define w sizeof(int) << 3

unsigned srl(unsigned x, int k)
{
        /* Performs shift arithmetically */
        unsigned xsra = (int) x >> k;

        /* First masking bits constructor */
        unsigned mask = (unsigned) ~0 >> k;

        /* Second masking bits constructor */
        //unsigned mask = ~(~0 << (w - k - 1) << 1);

        /* Third masking bits constructor */
        //unsigned mask = (1 << (w - k - 1));
        //mask += mask -1;

        return xsra & mask;
}

unsigned sra(unsigned x, int k)
{
        /* Performs shift logically */
        int xsrl = (unsigned) x >> k;
        int sign = x & 1 << (w - 1);
        int mask = ((1 << k) - 1) << (w - k);
        (sign) && (xsrl |= mask);

        return xsrl;
}

int main(void)
{
        int shift_bits = 3;
        int test_hex_0 = 0x80000000;
        int logical_shift = (unsigned) test_hex_0 >> shift_bits;

        !(logical_shift ^ srl(test_hex_0, shift_bits)) &&
                (printf("Logical shifts simulate successful\n"));

        shift_bits = 7;
        int test_hex_1 = 0xFFFFFFF; /* 0x70000000 */
        int arithmetic_shift = (int) test_hex_1 >> shift_bits;

        !(arithmetic_shift ^ sra(test_hex_1, shift_bits)) &&
                (printf("Arithmetic shifts simulate successful\n"));

        getchar();
        return OK;
}

/*
 * EPILOGUE
 *
 * These problems are fairly tricky.They require generating masks based
 * on the shift amounts. Shift value k equal to 0 must be handled as a
 * special case, since otherwise we would me generating the mask by
 * performing a left shift by 32.
 *
 * In `srl` fuction, we need use masking-bits build a w-bits patterns
 * `M` [w-1, w-2, w-3 ... 0] to simulate logical shift, then exploits
 * bit-wise AND to mask off some set of sign-extend bit(all set to 0).
 */


text:
require 'twitter/creatable'
require 'twitter/enumerable'
require 'twitter/null_object'

module Twitter
  class TrendResults
    include Twitter::Creatable
    include Twitter::Enumerable
    attr_reader :attrs
    alias to_h attrs
    alias to_hash attrs
    alias to_hsh attrs

    # Construct a new SearchResults object from a response hash
    #
    # @param response [Hash]
    # @return [Twitter::Base]
    def self.from_response(response={})
      new(response[:body].first)
    end

    # Initializes a new SearchResults object
    #
    # @param attrs [Hash]
    # @return [Twitter::TrendResults]
    def initialize(attrs={})
      @attrs = attrs
      @collection = Array(@attrs[:trends]).map do |trend|
        Twitter::Trend.new(trend)
      end
    end

    # Time when the object was created on Twitter
    #
    # @return [Time]
    def as_of
      @as_of ||= Time.parse(@attrs[:as_of]) if @attrs[:as_of]
    end

    def as_of?
      !!@attrs[:as_of]
    end

    # @return [Twitter::Place, NullObject]
    def location
      @location ||= if location?
        Twitter::Place.new(@attrs[:locations].first)
      else
        Twitter::NullObject.instance
      end
    end

    # @return [Boolean]
    def location?
      !@attrs[:locations].nil? && !@attrs[:locations].first.nil?
    end

  end
end

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Specialized;
using System.ComponentModel;

namespace System.Web.UI.WebControls {

    public class ListViewUpdatedEventArgs : EventArgs {
        private int _affectedRows;
        private Exception _exception;
        private bool _exceptionHandled;
        private IOrderedDictionary _values;
        private IOrderedDictionary _keys;
        private IOrderedDictionary _oldValues;
        private bool _keepInEditMode;

        public ListViewUpdatedEventArgs(int affectedRows, Exception exception) {
            _affectedRows = affectedRows;
            _exceptionHandled = false;
            _exception = exception;
            _keepInEditMode = false;
        }

        /// <devdoc>
        ///    <para>Gets the source of the command. This property is read-only.</para>
        /// </devdoc>
        public int AffectedRows {
            get {
                return _affectedRows;
            }
        }

        /// <devdoc>
        ///    <para>Gets the exception (if any) that occurred during the operation. This property is read-only.</para>
        /// </devdoc>
        public Exception Exception {
            get {
                return _exception;
            }
        }

        /// <devdoc>
        ///    <para>Gets a flag telling whether the exception was handled.</para>
        /// </devdoc>
        public bool ExceptionHandled {
            get {
                return _exceptionHandled;
            }
            set {
                _exceptionHandled = value;
            }
        }

        /// <devdoc>
        ///    <para>Gets or sets whether the control should be rebound.</para>
        /// </devdoc>
        public bool KeepInEditMode {
            get {
                return _keepInEditMode;
            }
            set {
                _keepInEditMode = value;
            }
        }

        /// <devdoc>
        /// <para>Gets a OrderedDictionary to populate with updated row values.  This property is read-only.</para>
        /// </devdoc>
        public IOrderedDictionary NewValues {
            get {
                if (_values == null) {
                    _values = new OrderedDictionary();
                }
                return _values;
            }
        }

        /// <devdoc>
        /// <para>Gets a OrderedDictionary to populate with pre-edit row values.  This property is read-only.</para>
        /// </devdoc>
        public IOrderedDictionary OldValues {
            get {
                if (_oldValues == null) {
                    _oldValues = new OrderedDictionary();
                }
                return _oldValues;
            }
        }

        internal void SetKeys(IOrderedDictionary keys) {
            _keys = keys;
        }

        internal void SetNewValues(IOrderedDictionary newValues) {
            _values = newValues;
        }

        internal void SetOldValues(IOrderedDictionary oldValues) {
            _oldValues = oldValues;
        }
    }
}


text:
package executor

import (
	"runtime"
	"strconv"

	"github.com/pingcap/tidb/distsql"
	"github.com/pingcap/tidb/domain"
	"github.com/pingcap/tidb/metrics"
	"github.com/pingcap/tidb/model"
	"github.com/pingcap/tidb/mysql"
	"github.com/pingcap/tidb/sessionctx"
	"github.com/pingcap/tidb/sessionctx/variable"
	"github.com/pingcap/tidb/statistics"
	"github.com/pingcap/tidb/tablecodec"
	"github.com/pingcap/tidb/util/chunk"
	"github.com/pingcap/tidb/util/ranger"
	"github.com/pingcap/tipb/go-tipb"
	"github.com/pkg/errors"
	log "github.com/sirupsen/logrus"
	"golang.org/x/net/context"
)

var _ Executor = &AnalyzeExec{}

// AnalyzeExec represents Analyze executor.
type AnalyzeExec struct {
	baseExecutor
	tasks []*analyzeTask
}

const (
	maxSampleSize        = 10000
	maxRegionSampleSize  = 1000
	maxSketchSize        = 10000
	defaultCMSketchDepth = 5
	defaultCMSketchWidth = 2048
)

// Next implements the Executor Next interface.
func (e *AnalyzeExec) Next(ctx context.Context, chk *chunk.Chunk) error {
	concurrency, err := getBuildStatsConcurrency(e.ctx)
	if err != nil {
		return errors.Trace(err)
	}
	taskCh := make(chan *analyzeTask, len(e.tasks))
	resultCh := make(chan statistics.AnalyzeResult, len(e.tasks))
	for i := 0; i < concurrency; i++ {
		go e.analyzeWorker(taskCh, resultCh)
	}
	for _, task := range e.tasks {
		taskCh <- task
	}
	close(taskCh)
	statsHandle := domain.GetDomain(e.ctx).StatsHandle()
	for i, panicCnt := 0, 0; i < len(e.tasks) && panicCnt < concurrency; i++ {
		result := <-resultCh
		if result.Err != nil {
			err = result.Err
			if errors.Trace(err) == errAnalyzeWorkerPanic {
				panicCnt++
			}
			log.Error(errors.ErrorStack(err))
			continue
		}
		for i, hg := range result.Hist {
			err1 := statsHandle.SaveStatsToStorage(result.PhysicalTableID, result.Count, result.IsIndex, hg, result.Cms[i], 1)
			if err1 != nil {
				err = err1
				log.Error(errors.ErrorStack(err))
				continue
			}
		}
	}
	if err != nil {
		return errors.Trace(err)
	}
	return errors.Trace(statsHandle.Update(GetInfoSchema(e.ctx)))
}

func getBuildStatsConcurrency(ctx sessionctx.Context) (int, error) {
	sessionVars := ctx.GetSessionVars()
	concurrency, err := variable.GetSessionSystemVar(sessionVars, variable.TiDBBuildStatsConcurrency)
	if err != nil {
		return 0, errors.Trace(err)
	}
	c, err := strconv.ParseInt(concurrency, 10, 64)
	return int(c), errors.Trace(err)
}

type taskType int

const (
	colTask taskType = iota
	idxTask
)

type analyzeTask struct {
	taskType taskType
	idxExec  *AnalyzeIndexExec
	colExec  *AnalyzeColumnsExec
}

var errAnalyzeWorkerPanic = errors.New("analyze worker panic")

func (e *AnalyzeExec) analyzeWorker(taskCh <-chan *analyzeTask, resultCh chan<- statistics.AnalyzeResult) {
	defer func() {
		if r := recover(); r != nil {
			buf := make([]byte, 4096)
			stackSize := runtime.Stack(buf, false)
			buf = buf[:stackSize]
			log.Errorf("analyzeWorker panic stack is:\n%s", buf)
			metrics.PanicCounter.WithLabelValues(metrics.LabelAnalyze).Inc()
			resultCh <- statistics.AnalyzeResult{
				Err: errAnalyzeWorkerPanic,
			}
		}
	}()
	for task := range taskCh {
		switch task.taskType {
		case colTask:
			resultCh <- analyzeColumnsPushdown(task.colExec)
		case idxTask:
			resultCh <- analyzeIndexPushdown(task.idxExec)
		}
	}
}

func analyzeIndexPushdown(idxExec *AnalyzeIndexExec) statistics.AnalyzeResult {
	hist, cms, err := idxExec.buildStats()
	if err != nil {
		return statistics.AnalyzeResult{Err: err}
	}
	result := statistics.AnalyzeResult{
		PhysicalTableID: idxExec.physicalTableID,
		Hist:            []*statistics.Histogram{hist},
		Cms:             []*statistics.CMSketch{cms},
		IsIndex:         1,
	}
	if hist.Len() > 0 {
		result.Count = hist.Buckets[hist.Len()-1].Count
	}
	return result
}

// AnalyzeIndexExec represents analyze index push down executor.
type AnalyzeIndexExec struct {
	ctx             sessionctx.Context
	physicalTableID int64
	idxInfo         *model.IndexInfo
	concurrency     int
	priority        int
	analyzePB       *tipb.AnalyzeReq
	result          distsql.SelectResult
	maxNumBuckets   uint64
}

func (e *AnalyzeIndexExec) open() error {
	var builder distsql.RequestBuilder
	kvReq, err := builder.SetIndexRanges(e.ctx.GetSessionVars().StmtCtx, e.physicalTableID, e.idxInfo.ID, ranger.FullRange()).
		SetAnalyzeRequest(e.analyzePB).
		SetKeepOrder(true).
		SetConcurrency(e.concurrency).
		Build()
	ctx := context.TODO()
	e.result, err = distsql.Analyze(ctx, e.ctx.GetClient(), kvReq, e.ctx.GetSessionVars().KVVars, e.ctx.GetSessionVars().InRestrictedSQL)
	if err != nil {
		return errors.Trace(err)
	}
	e.result.Fetch(ctx)
	return nil
}

func (e *AnalyzeIndexExec) buildStats() (hist *statistics.Histogram, cms *statistics.CMSketch, err error) {
	if err = e.open(); err != nil {
		return nil, nil, errors.Trace(err)
	}
	defer func() {
		if err1 := e.result.Close(); err1 != nil {
			hist = nil
			cms = nil
			err = errors.Trace(err1)
		}
	}()
	hist = &statistics.Histogram{}
	cms = statistics.NewCMSketch(defaultCMSketchDepth, defaultCMSketchWidth)
	for {
		data, err := e.result.NextRaw(context.TODO())
		if err != nil {
			return nil, nil, errors.Trace(err)
		}
		if data == nil {
			break
		}
		resp := &tipb.AnalyzeIndexResp{}
		err = resp.Unmarshal(data)
		if err != nil {
			return nil, nil, errors.Trace(err)
		}
		hist, err = statistics.MergeHistograms(e.ctx.GetSessionVars().StmtCtx, hist, statistics.HistogramFromProto(resp.Hist), int(e.maxNumBuckets))
		if err != nil {
			return nil, nil, errors.Trace(err)
		}
		if resp.Cms != nil {
			err := cms.MergeCMSketch(statistics.CMSketchFromProto(resp.Cms))
			if err != nil {
				return nil, nil, errors.Trace(err)
			}
		}
	}
	hist.ID = e.idxInfo.ID
	return hist, cms, nil
}

func analyzeColumnsPushdown(colExec *AnalyzeColumnsExec) statistics.AnalyzeResult {
	hists, cms, err := colExec.buildStats()
	if err != nil {
		return statistics.AnalyzeResult{Err: err}
	}
	result := statistics.AnalyzeResult{
		PhysicalTableID: colExec.physicalTableID,
		Hist:            hists,
		Cms:             cms,
	}
	hist := hists[0]
	result.Count = hist.NullCount
	if hist.Len() > 0 {
		result.Count += hist.Buckets[hist.Len()-1].Count
	}
	return result
}

// AnalyzeColumnsExec represents Analyze columns push down executor.
type AnalyzeColumnsExec struct {
	ctx             sessionctx.Context
	physicalTableID int64
	colsInfo        []*model.ColumnInfo
	pkInfo          *model.ColumnInfo
	concurrency     int
	priority        int
	keepOrder       bool
	analyzePB       *tipb.AnalyzeReq
	resultHandler   *tableResultHandler
	maxNumBuckets   uint64
}

func (e *AnalyzeColumnsExec) open() error {
	var ranges []*ranger.Range
	if e.pkInfo != nil {
		ranges = ranger.FullIntRange(mysql.HasUnsignedFlag(e.pkInfo.Flag))
	} else {
		ranges = ranger.FullIntRange(false)
	}
	e.resultHandler = &tableResultHandler{}
	firstPartRanges, secondPartRanges := splitRanges(ranges, e.keepOrder)
	firstResult, err := e.buildResp(firstPartRanges)
	if err != nil {
		return errors.Trace(err)
	}
	if len(secondPartRanges) == 0 {
		e.resultHandler.open(nil, firstResult)
		return nil
	}
	var secondResult distsql.SelectResult
	secondResult, err = e.buildResp(secondPartRanges)
	if err != nil {
		return errors.Trace(err)
	}
	e.resultHandler.open(firstResult, secondResult)

	return nil
}

func (e *AnalyzeColumnsExec) buildResp(ranges []*ranger.Range) (distsql.SelectResult, error) {
	var builder distsql.RequestBuilder
	kvReq, err := builder.SetTableRanges(e.physicalTableID, ranges, nil).
		SetAnalyzeRequest(e.analyzePB).
		SetKeepOrder(e.keepOrder).
		SetConcurrency(e.concurrency).
		Build()
	if err != nil {
		return nil, errors.Trace(err)
	}
	ctx := context.TODO()
	result, err := distsql.Analyze(ctx, e.ctx.GetClient(), kvReq, e.ctx.GetSessionVars().KVVars, e.ctx.GetSessionVars().InRestrictedSQL)
	if err != nil {
		return nil, errors.Trace(err)
	}
	result.Fetch(ctx)
	return result, nil
}

func (e *AnalyzeColumnsExec) buildStats() (hists []*statistics.Histogram, cms []*statistics.CMSketch, err error) {
	if err = e.open(); err != nil {
		return nil, nil, errors.Trace(err)
	}
	defer func() {
		if err1 := e.resultHandler.Close(); err1 != nil {
			hists = nil
			cms = nil
			err = errors.Trace(err1)
		}
	}()
	pkHist := &statistics.Histogram{}
	collectors := make([]*statistics.SampleCollector, len(e.colsInfo))
	for i := range collectors {
		collectors[i] = &statistics.SampleCollector{
			IsMerger:      true,
			FMSketch:      statistics.NewFMSketch(maxSketchSize),
			MaxSampleSize: maxSampleSize,
			CMSketch:      statistics.NewCMSketch(defaultCMSketchDepth, defaultCMSketchWidth),
		}
	}
	for {
		data, err1 := e.resultHandler.nextRaw(context.TODO())
		if err1 != nil {
			return nil, nil, errors.Trace(err1)
		}
		if data == nil {
			break
		}
		resp := &tipb.AnalyzeColumnsResp{}
		err = resp.Unmarshal(data)
		if err != nil {
			return nil, nil, errors.Trace(err)
		}
		sc := e.ctx.GetSessionVars().StmtCtx
		if e.pkInfo != nil {
			pkHist, err = statistics.MergeHistograms(sc, pkHist, statistics.HistogramFromProto(resp.PkHist), int(e.maxNumBuckets))
			if err != nil {
				return nil, nil, errors.Trace(err)
			}
		}
		for i, rc := range resp.Collectors {
			collectors[i].MergeSampleCollector(sc, statistics.SampleCollectorFromProto(rc))
		}
	}
	timeZone := e.ctx.GetSessionVars().Location()
	if e.pkInfo != nil {
		pkHist.ID = e.pkInfo.ID
		err = pkHist.DecodeTo(&e.pkInfo.FieldType, timeZone)
		if err != nil {
			return nil, nil, errors.Trace(err)
		}
		hists = append(hists, pkHist)
		cms = append(cms, nil)
	}
	for i, col := range e.colsInfo {
		for j, s := range collectors[i].Samples {
			collectors[i].Samples[j], err = tablecodec.DecodeColumnValue(s.GetBytes(), &col.FieldType, timeZone)
			if err != nil {
				return nil, nil, errors.Trace(err)
			}
		}
		hg, err := statistics.BuildColumn(e.ctx, int64(e.maxNumBuckets), col.ID, collectors[i], &col.FieldType)
		if err != nil {
			return nil, nil, errors.Trace(err)
		}
		hists = append(hists, hg)
		cms = append(cms, collectors[i].CMSketch)
	}
	return hists, cms, nil
}


text:
/*
 * sheet.h
 *
 */

#ifndef sheet_h
	#define sheet_h

#include <stdlib.h>
#include <stdio.h>
#include <curses.h>
#include "score.h"
#include "yahtzee.h"

void printMark(int y, int x, Mark *mark);
void getScore(int num, int i, Dice **dice, Player ***players);
void sheet(int num, Player **players);

#endif


text:
import React, { Component } from 'react';
import { View, Text, TextInput, TouchableOpacity, StatusBar, AsyncStorage } from 'react-native';
import { Actions } from "react-native-router-flux"

import styles from './style';
import getLocalhost from "../../../server";

class Form extends Component {
  constructor(props) {
    super(props);
    this.state = {
      users: [],
      email: null,
      password: null
    };
  }

  componentDidMount() {
    const localhost = getLocalhost();
    fetch(`${localhost}/users`, {
      method: "GET",
      headers: {
        "Content-Type": "application/json"
      }
    })
      .then(response => response.json())
      .then(data => this.setState({ users: data }))
      .catch(err => console.error(err));
  }

  onButtonPressLogin = () => {
    const { email, password, users } = this.state;
    const findUser = users.filter(user => user.email === email);

    for (let i = 0; i < users.length; i++) {
      if (users[i].password == password || users[i].email == email) {
        return this._localStorage({
            user: findUser[0]
          }), Actions.tab_feed();
      } else {
        return alert("Email or password is wrong!")
      }
    }
  };

  _localStorage = async (value)=> {
    AsyncStorage.setItem("tukangs", JSON.stringify(value));
  }

  render() {
    return (
      <View style={styles.formContainer}>
        <StatusBar barStyle="light-content" />
        <TextInput
          style={styles.input}
          onChangeText={text => this.setState({ email: text })}
          autoCapitalize="none"
          onSubmitEditing={() => this.passwordInput.focus()}
          autoCorrect={false}
          keyboardType="email-address"
          returnKeyType="next"
          placeholder="Email"
          placeholderTextColor="rgba(225,225,225,0.7)"
          underlineColorAndroid="transparent"
        />
        <TextInput
          style={styles.input}
          onChangeText={text => this.setState({ password: text })}
          returnKeyType="go"
          ref={input => (this.passwordInput = input)}
          placeholder="Password"
          placeholderTextColor="rgba(225,225,225,0.7)"
          secureTextEntry
          underlineColorAndroid="transparent"
        />
        <TouchableOpacity
          style={styles.buttonContainer}
          onPress={() => this.onButtonPressLogin()}
        >
          <Text style={styles.buttonText}>LOGIN</Text>
        </TouchableOpacity>
      </View>
    );
  }
}

export default Form;


text:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

r"""After running tuning, use this script to aggregate the results.

Usage:

OUT_DIR="<my_tuning_dir>"
bazel run -c opt single_task:aggregate_tuning_results -- \
    --alsologtostderr \
    --tuning_dir="$OUT_DIR"
"""

import ast
import os

from absl import app
from absl import flags
import tensorflow as tf

FLAGS = flags.FLAGS
flags.DEFINE_string(
    'tuning_dir', '',
    'Absolute path where results tuning trial folders are found.')

def main(argv):
  del argv  # Unused.

  try:
    trial_dirs = tf.gfile.ListDirectory(FLAGS.tuning_dir)
  except tf.errors.NotFoundError:
    print('Tuning directory %s does not exist.' % (FLAGS.tuning_dir,))
    return

  metrics = []
  for trial_dir in trial_dirs:
    tuning_results_file = os.path.join(
        FLAGS.tuning_dir, trial_dir, 'tuning_results.txt')
    if tf.gfile.Exists(tuning_results_file):
      with tf.gfile.FastGFile(tuning_results_file, 'r') as reader:
        for line in reader:
          metrics.append(ast.literal_eval(line.replace(': nan,', ': 0.0,')))

  if not metrics:
    print('No trials found.')
    return

  num_trials = [m['num_trials'] for m in metrics]
  assert all(n == num_trials[0] for n in num_trials)
  num_trials = num_trials[0]
  print('Found %d completed trials out of %d' % (len(metrics), num_trials))

  # Sort by objective descending.
  sorted_trials = sorted(metrics, key=lambda m: -m['objective'])

  for i, metrics in enumerate(sorted_trials):
    hparams = metrics['hparams']
    keys = sorted(hparams.keys())
    print(
        str(i).ljust(4) + ': '
        + '{0:.2f}'.format(metrics['objective']).ljust(10)
        + '['
        + ','.join(['{}={}'.format(k, hparams[k]).ljust(24) for k in keys])
        + ']')

if __name__ == '__main__':
  app.run(main)


text:
<!doctype html>

    <title>Code coverage report for src/view/dashboard/components/cpu.js</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="..\..\..\..\prettify.css" />
    <link rel="stylesheet" href="..\..\..\..\base.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1">

      All files / src/view/dashboard/components cpu.js

        0%
        Statements
        0/27

        0%
        Branches
        0/8

        0%
        Functions
        0/3

        0%
        Lines
        0/11

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

import React from 'react'
import PropTypes from 'prop-types'
import { color } from 'utils'
import CountUp from 'react-countup'
import { LineChart, Line, XAxis, YAxis, CartesianGrid, ResponsiveContainer } from 'recharts'
import styles from './cpu.less'

const countUpProps = {
  start: 0,
  duration: 2.75,
  useEasing: true,
  useGrouping: true,
  separator: ',',
}

function Cpu ({ usage, space, cpu, data }) {
  return (<div className={styles.cpu}>
    <div className={styles.number}>
      <div className={styles.item}>
        <p>usage</p>
        <p><CountUp
          end={usage}
          suffix="GB"
          {...countUpProps}
        /></p>
      </div>
      <div className={styles.item}>
        <p>space</p>
        <p><CountUp
          end={space}
          suffix="GB"
          {...countUpProps}
        /></p>
      </div>
      <div className={styles.item}>
        <p>cpu</p>
        <p><CountUp
          end={cpu}
          suffix="%"
          {...countUpProps}
        /></p>
      </div>
    </div>
    <ResponsiveContainer minHeight={300}>
      <LineChart data={data} margin={{ left: -40 }}>
        <XAxis dataKey="name" axisLine={{ stroke: color.borderBase, strokeWidth: 1 }} tickLine={false} />
        <YAxis axisLine={false} tickLine={false} />
        <CartesianGrid vertical={false} stroke={color.borderBase} strokeDasharray="3 3" />
        <Line type="monotone" connectNulls dataKey="cpu" stroke={color.blue} fill={color.blue} />
      </LineChart>
    </ResponsiveContainer>
  </div>)
}

Cpu.propTypes = {
  data: PropTypes.array,
  usage: PropTypes.number,
  space: PropTypes.number,
  cpu: PropTypes.number,
}

export default Cpu

  Code coverage
  generated by istanbul at Fri Sep 15 2017 15:08:56 GMT+0800 (中国标准时间)


text:
NS_RURU_BEGIN

const int SERVICE_IDENTIFIER_NOT_SET = 0;

typedef size_t ServiceType_t;

template<typename T>
class ServiceMixin
{
	friend class ServiceLocator;

	private:
		static ServiceType_t ServiceIdentifier;

};

template<typename T>
RuRu::ServiceType_t RuRu::ServiceMixin<T>::ServiceIdentifier = RuRu::SERVICE_IDENTIFIER_NOT_SET;

NS_RURU_END
#endif


text:
title: Other
section: deployment
hidden: true
---


text:
package org.vaadin.gridutil.demo.data;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.lang.time.DateUtils;
import org.vaadin.gridutil.demo.data.Country.Continent;

import com.google.gwt.i18n.server.testing.Gender;

public final class DummyDataGen {

	public static final List<Inhabitants> genInhabitants(final int quantity) {
		List<Inhabitants> result = new ArrayList<Inhabitants>();

		Inhabitants inh;
		for (long x = 1; x <= quantity; x++) {
			result.add(genInhabitant(x));
		}

		return result;
	}

	public static final Inhabitants genInhabitant(final long id) {
		Inhabitants inh = new Inhabitants(id, Math.random() > 0.5 ? Gender.FEMALE : Gender.MALE);
		if (inh.getGender()
				.equals(Gender.MALE)) {
			inh.setName(randomOfList(MALES));
		} else {
			inh.setName(randomOfList(FEMALES));
		}
		inh.setBirthday(new Date(new Date().getTime() - ((long) (Math.random() * 10000) % (365 * 90)) * DateUtils.MILLIS_PER_DAY));
		inh.setBodySize(1.6 + (Math.random() * (Math.random() > 0.5 ? -1 : +1)));
		inh.setCountry(randomCountry());
		inh.setOnFacebook(Math.random() > 0.5);
		return inh;
	}

	private final static String randomOfList(final List<String> list) {
		return list.get((int) (Math.random() * 10000) % (list.size() - 1));
	}

	private final static Country randomCountry() {
		return COUNTRIES.get((int) (Math.random() * 10000) % (COUNTRIES.size() - 1));
	}

	public static List<String> FEMALES = Arrays.asList("AMELIA", "OLIVIA", "JESSICA", "EMILY", "LILY", "AVA", "MIA", "ISLA", "SOPHIE", "ISABELLA", "EVIE",
			"RUBY", "POPPY", "GRACE", "SOPHIA", "CHLOE", "ISABELLE", "ELLA", "FREYA", "CHARLOTTE", "SCARLETT", "DAISY", "LOLA", "EVA", "HOLLY", "MILLIE",
			"LUCY", "PHOEBE", "LAYLA", "MAISIE", "SIENNA", "ALICE", "LILLY", "FLORENCE", "ELLIE", "ERIN", "IMOGEN", "ELIZABETH", "MOLLY", "SUMMER", "MEGAN",
			"HANNAH", "SOFIA", "ABIGAIL", "JASMINE", "LEXI", "MATILDA", "ROSIE", "LACEY", "EMMA", "AMELIE", "GRACIE", "MAYA", "HOLLIE", "GEORGIA", "EMILIA",
			"EVELYN", "BELLA", "BROOKE", "AMBER", "ELIZA", "AMY", "ELEANOR", "LEAH", "ESME", "KATIE", "HARRIET", "ANNA", "WILLOW", "ELSIE", "ZARA", "ANNABELLE",
			"BETHANY", "FAITH", "MADISON", "ISABEL", "MARTHA", "ROSE", "JULIA", "PAIGE", "MARYAM", "MADDISON", "HEIDI", "MOLLIE", "NIAMH", "SKYE", "AISHA",
			"IVY", "DARCEY", "FRANCESCA", "ZOE", "KEIRA", "TILLY", "MARIA", "SARAH", "LYDIA", "CAITLIN", "ISOBEL", "SARA", "VIOLET");

	public static List<String> MALES = Arrays.asList("OLIVER", "JACK", "CHARLIE", "JACOB", "THOMAS", "ALFIE", "RILEY", "WILLIAM", "JAMES", "JOSHUA", "GEORGE",
			"ETHAN", "NOAH", "SAMUEL", "DANIEL", "OSCAR", "MAX", "MUHAMMAD", "LEO", "TYLER", "JOSEPH", "ARCHIE", "HENRY", "LUCAS", "MOHAMMED", "ALEXANDER",
			"DYLAN", "LOGAN", "ISAAC", "MASON", "BENJAMIN", "JAKE", "FINLEY", "HARRISON", "EDWARD", "JAYDEN", "FREDDIE", "ADAM", "ZACHARY", "SEBASTIAN", "RYAN",
			"LEWIS", "THEO", "LUKE", "HARLEY", "MATTHEW", "HARVEY", "TOBY", "LIAM", "CALLUM", "ARTHUR", "MICHAEL", "JENSON", "TOMMY", "NATHAN", "BOBBY",
			"CONNOR", "DAVID", "MOHAMMAD", "LUCA", "CHARLES", "KAI", "JAMIE", "ALEX", "BLAKE", "FRANKIE", "REUBEN", "AARON", "DEXTER", "JUDE", "LEON", "OLLIE",
			"STANLEY", "ELLIOT", "GABRIEL", "CAMERON", "OWEN", "LOUIE", "AIDEN", "LOUIS", "ELIJAH", "FINLAY", "RHYS", "CALEB", "EVAN", "FREDERICK", "HUGO",
			"KIAN", "SONNY", "SETH", "KAYDEN", "TAYLOR", "KYLE", "ELLIOTT", "ROBERT", "THEODORE", "BAILEY", "RORY", "ELLIS");

	// @formatter:off
	public static List<Country> COUNTRIES = Arrays.asList(
				new Country("AF", "Afghanistan", Continent.AS,30419928),
				new Country("AX", "Aland Islands", Continent.EU,28007),
				new Country("AL", "Albania", Continent.EU,3002859),
				new Country("DZ", "Algeria", Continent.AF,35406303),
				new Country("AS", "American Samoa", Continent.OC,68061),
				new Country("AD", "Andorra", Continent.EU,85082),
				new Country("AO", "Angola", Continent.AF,18056072),
				new Country("AI", "Anguilla", Continent.NA,15423),
				new Country("AG", "Antigua and Barbuda", Continent.NA,89018),
				new Country("AR", "Argentina", Continent.SA,42192494),
				new Country("AM", "Armenia", Continent.AS,2970495),
				new Country("AW", "Aruba", Continent.NA,107635),
				new Country("AU", "Australia", Continent.OC,22015576),
				new Country("AT", "Austria", Continent.EU,8219743),
				new Country("AZ", "Azerbaijan", Continent.AS,9493600),
				new Country("BS", "Bahamas", Continent.NA,316182),
				new Country("BH", "Bahrain", Continent.AS,1248348),
				new Country("BD", "Bangladesh", Continent.AS,161083804),
				new Country("BB", "Barbados", Continent.NA,287733),
				new Country("BY", "Belarus", Continent.EU,9542883),
				new Country("BE", "Belgium", Continent.EU,10438353),
				new Country("BZ", "Belize", Continent.NA,327719),
				new Country("BJ", "Benin", Continent.AF,9598787),
				new Country("BM", "Bermuda", Continent.NA,69080),
				new Country("BT", "Bhutan", Continent.AS,716896),
				new Country("BO", "Bolivia, Plurinational State of", Continent.SA,10290003),
				new Country("BA", "Bosnia and Herzegovina", Continent.EU,4622292),
				new Country("BW", "Botswana", Continent.AF,2098018),
				new Country("BR", "Brazil", Continent.SA,205716890),
				new Country("IO", "British Indian Ocean Territory", Continent.AS,4000),
				new Country("BN", "Brunei Darussalam", Continent.AS,408786),
				new Country("BG", "Bulgaria", Continent.EU,7037935),
				new Country("BF", "Burkina Faso", Continent.AF,17275115),
				new Country("BI", "Burundi", Continent.AF,10557259),
				new Country("KH", "Cambodia", Continent.AS,14952665),
				new Country("CM", "Cameroon", Continent.AF,20129878),
				new Country("CA", "Canada", Continent.NA,34300083),
				new Country("CV", "Cape Verde", Continent.AF,523568),
				new Country("KY", "Cayman Islands", Continent.NA,52560),
				new Country("CF", "Central African Republic", Continent.AF,5057208),
				new Country("TD", "Chad", Continent.AF,10975648),
				new Country("CL", "Chile", Continent.SA,17067369),
				new Country("CN", "China", Continent.AS,1343239923),
				new Country("CX", "Christmas Island", Continent.AS,1496),
				new Country("CC", "Cocos (Keeling) Islands", Continent.AS,596),
				new Country("CO", "Colombia", Continent.SA,45239079),
				new Country("KM", "Comoros", Continent.AF,737284),
				new Country("CG", "Congo", Continent.AF,4125916),
				new Country("CD", "Congo, The Democratic Republic of the", Continent.AF,73599190),
				new Country("CK", "Cook Islands", Continent.OC,10777),
				new Country("CR", "Costa Rica", Continent.NA,4636348),
				new Country("CI", "Cote d'Ivoire", Continent.AF,21952093),
				new Country("HR", "Croatia", Continent.EU,4480043),
				new Country("CU", "Cuba", Continent.NA,11075244),
				new Country("CW", "Curacao", Continent.NA,142180),
				new Country("CY", "Cyprus", Continent.AS,1138071),
				new Country("CZ", "Czech Republic", Continent.EU,10177300),
				new Country("DK", "Denmark", Continent.EU,5543453),
				new Country("DJ", "Djibouti", Continent.AF,774389),
				new Country("DM", "Dominica", Continent.NA,73126),
				new Country("DO", "Dominican Republic", Continent.NA,10088598),
				new Country("EC", "Ecuador", Continent.SA,15223680),
				new Country("EG", "Egypt", Continent.AF,83688164),
				new Country("SV", "El Salvador", Continent.NA,6090646),
				new Country("GQ", "Equatorial Guinea", Continent.AF,685991),
				new Country("ER", "Eritrea", Continent.AF,6086495),
				new Country("EE", "Estonia", Continent.EU,1274709),
				new Country("ET", "Ethiopia", Continent.AF,93815992),
				new Country("FK", "Falkland Islands (Malvinas)", Continent.SA,3140),
				new Country("FO", "Faroe Islands", Continent.EU,49483),
				new Country("FJ", "Fiji", Continent.OC,890057),
				new Country("FI", "Finland", Continent.EU,5262930),
				new Country("FR", "France", Continent.EU,65630692),
				new Country("GF", "French Guiana", Continent.SA,217000),
				new Country("PF", "French Polynesia", Continent.OC,274512),
				new Country("GA", "Gabon", Continent.AF,1608321),
				new Country("GM", "Gambia", Continent.AF,1840454),
				new Country("GE", "Georgia", Continent.AS,4570934),
				new Country("DE", "Germany", Continent.EU,81305856),
				new Country("GH", "Ghana", Continent.AF,25241998),
				new Country("GI", "Gibraltar", Continent.EU,29034),
				new Country("GR", "Greece", Continent.EU,10767827),
				new Country("GL", "Greenland", Continent.NA,57695),
				new Country("GD", "Grenada", Continent.NA,109011),
				new Country("GP", "Guadeloupe", Continent.NA,405500),
				new Country("GU", "Guam", Continent.OC,183286),
				new Country("GT", "Guatemala", Continent.NA,14099032),
				new Country("GG", "Guernsey", Continent.EU,64775),
				new Country("GN", "Guinea", Continent.AF,10884958),
				new Country("GW", "Guinea-Bissau", Continent.AF,1628603),
				new Country("GY", "Guyana", Continent.SA,741908),
				new Country("HT", "Haiti", Continent.NA,9801664),
				new Country("HM", "Heard Island and McDonald Islands", Continent.OC,-1),
				new Country("VA", "Holy See (Vatican City State)", Continent.EU,836),
				new Country("HN", "Honduras", Continent.NA,8296693),
				new Country("HK", "Hong Kong", Continent.AS,7153519),
				new Country("HU", "Hungary", Continent.EU,9958453),
				new Country("IS", "Iceland", Continent.EU,313183),
				new Country("IN", "India", Continent.AS,1205073612),
				new Country("ID", "Indonesia", Continent.AS,248216193),
				new Country("IR", "Iran, Islamic Republic of", Continent.AS,78868711),
				new Country("IQ", "Iraq", Continent.AS,31129225),
				new Country("IE", "Ireland", Continent.EU,4722028),
				new Country("IM", "Isle of Man", Continent.EU,85421),
				new Country("IL", "Israel", Continent.AS,7590758),
				new Country("IT", "Italy", Continent.EU,61261254),
				new Country("JM", "Jamaica", Continent.NA,2889187),
				new Country("JP", "Japan", Continent.AS,127368088),
				new Country("JE", "Jersey", Continent.EU,94949),
				new Country("JO", "Jordan", Continent.AS,6508887),
				new Country("KZ", "Kazakhstan", Continent.AS,17522010),
				new Country("KE", "Kenya", Continent.AF,43013341),
				new Country("KI", "Kiribati", Continent.OC,101998),
				new Country("KP", "Korea, Democratic People's Republic of", Continent.AS,24589122),
				new Country("KR", "Korea, Republic of", Continent.AS,48860500),
				new Country("KW", "Kuwait", Continent.AS,2646314),
				new Country("KG", "Kyrgyzstan", Continent.AS,5496737),
				new Country("LA", "Lao People's Democratic Republic", Continent.AS,6586266),
				new Country("LV", "Latvia", Continent.EU,2191580),
				new Country("LB", "Lebanon", Continent.AS,4140289),
				new Country("LS", "Lesotho", Continent.AF,1930493),
				new Country("LR", "Liberia", Continent.AF,3887886),
				new Country("LY", "Libyan Arab Jamahiriya", Continent.AF,6733620),
				new Country("LI", "Liechtenstein", Continent.EU,36713),
				new Country("LT", "Lithuania", Continent.EU,3525761),
				new Country("LU", "Luxembourg", Continent.EU,509074),
				new Country("MO", "Macao", Continent.AS,578025),
				new Country("MK", "Macedonia, The Former Yugoslav Republic of", Continent.EU,2082370),
				new Country("MG", "Madagascar", Continent.AF,22585517),
				new Country("MW", "Malawi", Continent.AF,16323044),
				new Country("MY", "Malaysia", Continent.AS,29179952),
				new Country("MV", "Maldives", Continent.AS,394451),
				new Country("ML", "Mali", Continent.AF,14533511),
				new Country("MT", "Malta", Continent.EU,409836),
				new Country("MH", "Marshall Islands", Continent.OC,68480),
				new Country("MQ", "Martinique", Continent.NA,397730),
				new Country("MR", "Mauritania", Continent.AF,3359185),
				new Country("MU", "Mauritius", Continent.AF,1313095),
				new Country("YT", "Mayotte", Continent.AF,231139),
				new Country("MX", "Mexico", Continent.NA,114975406),
				new Country("FM", "Micronesia, Federated States of", Continent.OC,106487),
				new Country("MD", "Moldova, Republic of", Continent.EU,3656843),
				new Country("MC", "Monaco", Continent.EU,30510),
				new Country("MN", "Mongolia", Continent.AS,3179997),
				new Country("ME", "Montenegro", Continent.EU,657394),
				new Country("MS", "Montserrat", Continent.NA,5164),
				new Country("MA", "Morocco", Continent.AF,32309239),
				new Country("MZ", "Mozambique", Continent.AF,23515934),
				new Country("MM", "Myanmar", Continent.AS,54584650),
				new Country("NA", "Namibia", Continent.AF,2165828),
				new Country("NR", "Nauru", Continent.OC,9378),
				new Country("NP", "Nepal", Continent.AS,29890686),
				new Country("NL", "Netherlands", Continent.EU,16730632),
				new Country("NC", "New Caledonia", Continent.OC,260166),
				new Country("NZ", "New Zealand", Continent.OC,4327944),
				new Country("NI", "Nicaragua", Continent.NA,5727707),
				new Country("NE", "Niger", Continent.AF,17078839),
				new Country("NG", "Nigeria", Continent.AF,170123740),
				new Country("NU", "Niue", Continent.OC,1269),
				new Country("NF", "Norfolk Island", Continent.OC,2182),
				new Country("MP", "Northern Mariana Islands", Continent.OC,44582),
				new Country("NO", "Norway", Continent.EU,4707270),
				new Country("PS", "Occupied Palestinian Territory", Continent.AS,4199083),
				new Country("OM", "Oman", Continent.AS,3090150),
				new Country("PK", "Pakistan", Continent.AS,190291129),
				new Country("PW", "Palau", Continent.OC,21032),
				new Country("PA", "Panama", Continent.NA,3510045),
				new Country("PG", "Papua New Guinea", Continent.OC,6310129),
				new Country("PY", "Paraguay", Continent.SA,6541591),
				new Country("PE", "Peru", Continent.SA,29549517),
				new Country("PH", "Philippines", Continent.AS,103775002),
				new Country("PN", "Pitcairn", Continent.OC,48),
				new Country("PL", "Poland", Continent.EU,38415284),
				new Country("PT", "Portugal", Continent.EU,10781459),
				new Country("PR", "Puerto Rico", Continent.NA,3998905),
				new Country("QA", "Qatar", Continent.AS,1951591),
				new Country("RE", "Reunion", Continent.AF,827000),
				new Country("RO", "Romania", Continent.EU,21848504),
				new Country("RU", "Russian Federation", Continent.EU,138082178),
				new Country("RW", "Rwanda", Continent.AF,11689696),
				new Country("BL", "Saint Barthelemy", Continent.NA,7332),
				new Country("SH", "Saint Helena, Ascension and Tristan da Cunha", Continent.AF,7728),
				new Country("KN", "Saint Kitts and Nevis", Continent.NA,50726),
				new Country("LC", "Saint Lucia", Continent.NA,162178),
				new Country("MF", "Saint Martin (French part)", Continent.NA,30959),
				new Country("PM", "Saint Pierre and Miquelon", Continent.NA,5831),
				new Country("VC", "Saint Vincent and The Grenadines", Continent.NA,103537),
				new Country("WS", "Samoa", Continent.OC,194320),
				new Country("SM", "San Marino", Continent.EU,32140),
				new Country("ST", "Sao Tome and Principe", Continent.AF,183176),
				new Country("SA", "Saudi Arabia", Continent.AS,26534504),
				new Country("SN", "Senegal", Continent.AF,12969606),
				new Country("RS", "Serbia", Continent.EU,7276604),
				new Country("SC", "Seychelles", Continent.AF,90024),
				new Country("SL", "Sierra Leone", Continent.AF,5485998),
				new Country("SG", "Singapore", Continent.AS,5353494),
				new Country("SX", "Sint Maarten (Dutch part)", Continent.NA,37429),
				new Country("SK", "Slovakia", Continent.EU,5483088),
				new Country("SI", "Slovenia", Continent.EU,1996617),
				new Country("SB", "Solomon Islands", Continent.OC,584578),
				new Country("SO", "Somalia", Continent.AF,10085638),
				new Country("ZA", "South Africa", Continent.AF,48810427),
				new Country("GS", "South Georgia and the South Sandwich Islands", Continent.AN,-1),
				new Country("SS", "South Sudan", Continent.AF,10625176),
				new Country("ES", "Spain", Continent.EU,47042984),
				new Country("LK", "Sri Lanka", Continent.AS,21481334),
				new Country("SD", "Sudan", Continent.AF,34206710),
				new Country("SR", "Suriname", Continent.SA,560157),
				new Country("SJ", "Svalbard and Jan Mayen", Continent.EU,2067),
				new Country("SZ", "Swaziland", Continent.AF,1386914),
				new Country("SE", "Sweden", Continent.EU,9103788),
				new Country("CH", "Switzerland", Continent.EU,7655628),
				new Country("SY", "Syrian Arab Republic", Continent.AS,22530746),
				new Country("TW", "Taiwan, Province of China", Continent.AS,23113901),
				new Country("TJ", "Tajikistan", Continent.AS,7768385),
				new Country("TZ", "Tanzania, United Republic of", Continent.AF,43601796),
				new Country("TH", "Thailand", Continent.AS,67091089),
				new Country("TL", "Timor-Leste", Continent.AS,1201255),
				new Country("TG", "Togo", Continent.AF,6961049),
				new Country("TK", "Tokelau", Continent.OC,1368),
				new Country("TO", "Tonga", Continent.OC,106146),
				new Country("TT", "Trinidad and Tobago", Continent.NA,1226383),
				new Country("TN", "Tunisia", Continent.AF,10732900),
				new Country("TR", "Turkey", Continent.AS,79749461),
				new Country("TM", "Turkmenistan", Continent.AS,5054828),
				new Country("TC", "Turks and Caicos Islands", Continent.NA,46335),
				new Country("TV", "Tuvalu", Continent.OC,10619),
				new Country("UG", "Uganda", Continent.AF,35873253),
				new Country("UA", "Ukraine", Continent.EU,44854065),
				new Country("AE", "United Arab Emirates", Continent.AS,5314317),
				new Country("GB", "United Kingdom", Continent.EU,63047162),
				new Country("US", "United States", Continent.NA,313847465),
				new Country("UM", "United States Minor Outlying Islands", Continent.OC,316),
				new Country("UY", "Uruguay", Continent.SA,3316328),
				new Country("UZ", "Uzbekistan", Continent.AS,28394180),
				new Country("VU", "Vanuatu", Continent.OC,227574),
				new Country("VE", "Venezuela, Bolivarian Republic of", Continent.SA,28047938),
				new Country("VN", "Viet Nam", Continent.AS,91519289),
				new Country("VG", "Virgin Islands, British", Continent.NA,31148),
				new Country("VI", "Virgin Islands, U.S.", Continent.NA,109574),
				new Country("WF", "Wallis and Futuna", Continent.OC,15453),
				new Country("EH", "Western Sahara", Continent.AF,522928),
				new Country("YE", "Yemen", Continent.AS,24771809),
				new Country("ZM", "Zambia", Continent.AF,14309466),
				new Country("ZW", "Zimbabwe", Continent.AF,12619600));
		// @formatter:on
}


text:
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */

/**
 * Holds the PMA\libraries\controllers\server\ServerPluginsController
*
* @package PMA\libraries\controllers\server
*/

namespace PMA\libraries\controllers\server;

use PMA\libraries\controllers\Controller;
use PMA\libraries\Template;

/**
 * Handles viewing server plugin details
 *
 * @package PMA\libraries\controllers\server
 */
class ServerPluginsController extends Controller
{
    /**
     * @var array plugin details
     */
    protected $plugins;

    /**
     * Constructs ServerPluginsController
     */
    public function __construct()
    {
        parent::__construct();
        $this->_setServerPlugins();
    }

    /**
     * Index action
     *
     * @return void
     */
    public function indexAction()
    {
        include 'libraries/server_common.inc.php';

        $header  = $this->response->getHeader();
        $scripts = $header->getScripts();
        $scripts->addFile('jquery/jquery.tablesorter.js');
        $scripts->addFile('server_plugins.js');

        /**
         * Displays the page
        */
        $this->response->addHTML(PMA_getHtmlForSubPageHeader('plugins'));
        $this->response->addHTML($this->_getPluginsHtml());
    }

    /**
     * Sets details about server plugins
     *
     * @return void
     */
    private function _setServerPlugins()
    {
        $sql = "SELECT plugin_name,
                       plugin_type,
                       (plugin_status = 'ACTIVE') AS is_active,
                       plugin_type_version,
                       plugin_author,
                       plugin_description,
                       plugin_license
                FROM information_schema.plugins
                ORDER BY plugin_type, plugin_name";

        $res = $this->dbi->query($sql);
        $this->plugins = array();
        while ($row = $this->dbi->fetchAssoc($res)) {
            $this->plugins[$row['plugin_type']][] = $row;
        }
        $this->dbi->freeResult($res);
        ksort($this->plugins);
    }

    /**
     * Returns the html for plugin Tab.
     *
     * @return string
     */
    private function _getPluginsHtml()
    {
        $html  = '
';
        $html .= Template::get('server/plugins/section_links')
            ->render(array('plugins' => $this->plugins));

        foreach ($this->plugins as $plugin_type => $plugin_list) {
            $html .= Template::get('server/plugins/section')
                ->render(
                    array(
                        'plugin_type' => $plugin_type,
                        'plugin_list' => $plugin_list,
                    )
                );
        }
        $html .= '
';
        return $html;
    }
}


text:
<?php

namespace GuzzleHttp;

use GuzzleHttp\Cookie\CookieJar;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Exception\InvalidArgumentException;
use GuzzleHttp\Promise as P;
use GuzzleHttp\Promise\PromiseInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\UriInterface;

/**
 * @final
 */
class Client implements ClientInterface, \Psr\Http\Client\ClientInterface
{
    use ClientTrait;

    /**
     * @var array Default request options
     */
    private $config;

    /**
     * Clients accept an array of constructor parameters.
     *
     * Here's an example of creating a client using a base_uri and an array of
     * default request options to apply to each request:
     *
     *     $client = new Client([
     *         'base_uri'        => 'http://www.foo.com/1.0/',
     *         'timeout'         => 0,
     *         'allow_redirects' => false,
     *         'proxy'           => '192.168.16.1:10'
     *     ]);
     *
     * Client configuration settings include the following options:
     *
     * - handler: (callable) Function that transfers HTTP requests over the
     *   wire. The function is called with a Psr7\Http\Message\RequestInterface
     *   and array of transfer options, and must return a
     *   GuzzleHttp\Promise\PromiseInterface that is fulfilled with a
     *   Psr7\Http\Message\ResponseInterface on success.
     *   If no handler is provided, a default handler will be created
     *   that enables all of the request options below by attaching all of the
     *   default middleware to the handler.
     * - base_uri: (string|UriInterface) Base URI of the client that is merged
     *   into relative URIs. Can be a string or instance of UriInterface.
     * - **: any request option
     *
     * @param array $config Client configuration settings.
     *
     * @see \GuzzleHttp\RequestOptions for a list of available request options.
     */
    public function __construct(array $config = [])
    {
        if (!isset($config['handler'])) {
            $config['handler'] = HandlerStack::create();
        } elseif (!\is_callable($config['handler'])) {
            throw new InvalidArgumentException('handler must be a callable');
        }

        // Convert the base_uri to a UriInterface
        if (isset($config['base_uri'])) {
            $config['base_uri'] = Psr7\Utils::uriFor($config['base_uri']);
        }

        $this->configureDefaults($config);
    }

    /**
     * @param string $method
     * @param array  $args
     *
     * @return PromiseInterface|ResponseInterface
     *
     * @deprecated Client::__call will be removed in guzzlehttp/guzzle:8.0.
     */
    public function __call($method, $args)
    {
        if (\count($args) < 1) {
            throw new InvalidArgumentException('Magic request methods require a URI and optional options array');
        }

        $uri = $args[0];
        $opts = $args[1] ?? [];

        return \substr($method, -5) === 'Async'
            ? $this->requestAsync(\substr($method, 0, -5), $uri, $opts)
            : $this->request($method, $uri, $opts);
    }

    /**
     * Asynchronously send an HTTP request.
     *
     * @param array $options Request options to apply to the given
     *                       request and to the transfer. See \GuzzleHttp\RequestOptions.
     */
    public function sendAsync(RequestInterface $request, array $options = []): PromiseInterface
    {
        // Merge the base URI into the request URI if needed.
        $options = $this->prepareDefaults($options);

        return $this->transfer(
            $request->withUri($this->buildUri($request->getUri(), $options), $request->hasHeader('Host')),
            $options
        );
    }

    /**
     * Send an HTTP request.
     *
     * @param array $options Request options to apply to the given
     *                       request and to the transfer. See \GuzzleHttp\RequestOptions.
     *
     * @throws GuzzleException
     */
    public function send(RequestInterface $request, array $options = []): ResponseInterface
    {
        $options[RequestOptions::SYNCHRONOUS] = true;
        return $this->sendAsync($request, $options)->wait();
    }

    /**
     * The HttpClient PSR (PSR-18) specify this method.
     *
     * @inheritDoc
     */
    public function sendRequest(RequestInterface $request): ResponseInterface
    {
        $options[RequestOptions::SYNCHRONOUS] = true;
        $options[RequestOptions::ALLOW_REDIRECTS] = false;
        $options[RequestOptions::HTTP_ERRORS] = false;

        return $this->sendAsync($request, $options)->wait();
    }

    /**
     * Create and send an asynchronous HTTP request.
     *
     * Use an absolute path to override the base path of the client, or a
     * relative path to append to the base path of the client. The URL can
     * contain the query string as well. Use an array to provide a URL
     * template and additional variables to use in the URL template expansion.
     *
     * @param string              $method  HTTP method
     * @param string|UriInterface $uri     URI object or string.
     * @param array               $options Request options to apply. See \GuzzleHttp\RequestOptions.
     */
    public function requestAsync(string $method, $uri = '', array $options = []): PromiseInterface
    {
        $options = $this->prepareDefaults($options);
        // Remove request modifying parameter because it can be done up-front.
        $headers = $options['headers'] ?? [];
        $body = $options['body'] ?? null;
        $version = $options['version'] ?? '1.1';
        // Merge the URI into the base URI.
        $uri = $this->buildUri(Psr7\Utils::uriFor($uri), $options);
        if (\is_array($body)) {
            throw $this->invalidBody();
        }
        $request = new Psr7\Request($method, $uri, $headers, $body, $version);
        // Remove the option so that they are not doubly-applied.
        unset($options['headers'], $options['body'], $options['version']);

        return $this->transfer($request, $options);
    }

    /**
     * Create and send an HTTP request.
     *
     * Use an absolute path to override the base path of the client, or a
     * relative path to append to the base path of the client. The URL can
     * contain the query string as well.
     *
     * @param string              $method  HTTP method.
     * @param string|UriInterface $uri     URI object or string.
     * @param array               $options Request options to apply. See \GuzzleHttp\RequestOptions.
     *
     * @throws GuzzleException
     */
    public function request(string $method, $uri = '', array $options = []): ResponseInterface
    {
        $options[RequestOptions::SYNCHRONOUS] = true;
        return $this->requestAsync($method, $uri, $options)->wait();
    }

    /**
     * Get a client configuration option.
     *
     * These options include default request options of the client, a "handler"
     * (if utilized by the concrete client), and a "base_uri" if utilized by
     * the concrete client.
     *
     * @param string|null $option The config option to retrieve.
     *
     * @return mixed
     *
     * @deprecated Client::getConfig will be removed in guzzlehttp/guzzle:8.0.
     */
    public function getConfig(?string $option = null)
    {
        return $option === null
            ? $this->config
            : (isset($this->config[$option]) ? $this->config[$option] : null);
    }

    private function buildUri(UriInterface $uri, array $config): UriInterface
    {
        if (isset($config['base_uri'])) {
            $uri = Psr7\UriResolver::resolve(Psr7\Utils::uriFor($config['base_uri']), $uri);
        }

        if (isset($config['idn_conversion']) && ($config['idn_conversion'] !== false)) {
            $idnOptions = ($config['idn_conversion'] === true) ? \IDNA_DEFAULT : $config['idn_conversion'];
            $uri = Utils::idnUriConvert($uri, $idnOptions);
        }

        return $uri->getScheme() === '' && $uri->getHost() !== '' ? $uri->withScheme('http') : $uri;
    }

    /**
     * Configures the default options for a client.
     */
    private function configureDefaults(array $config): void
    {
        $defaults = [
            'allow_redirects' => RedirectMiddleware::$defaultSettings,
            'http_errors'     => true,
            'decode_content'  => true,
            'verify'          => true,
            'cookies'         => false,
            'idn_conversion'  => false,
        ];

        // Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set.

        // We can only trust the HTTP_PROXY environment variable in a CLI
        // process due to the fact that PHP has no reliable mechanism to
        // get environment variables that start with "HTTP_".
        if (\PHP_SAPI === 'cli' && ($proxy = Utils::getenv('HTTP_PROXY'))) {
            $defaults['proxy']['http'] = $proxy;
        }

        if ($proxy = Utils::getenv('HTTPS_PROXY')) {
            $defaults['proxy']['https'] = $proxy;
        }

        if ($noProxy = Utils::getenv('NO_PROXY')) {
            $cleanedNoProxy = \str_replace(' ', '', $noProxy);
            $defaults['proxy']['no'] = \explode(',', $cleanedNoProxy);
        }

        $this->config = $config + $defaults;

        if (!empty($config['cookies']) && $config['cookies'] === true) {
            $this->config['cookies'] = new CookieJar();
        }

        // Add the default user-agent header.
        if (!isset($this->config['headers'])) {
            $this->config['headers'] = ['User-Agent' => Utils::defaultUserAgent()];
        } else {
            // Add the User-Agent header if one was not already set.
            foreach (\array_keys($this->config['headers']) as $name) {
                if (\strtolower($name) === 'user-agent') {
                    return;
                }
            }
            $this->config['headers']['User-Agent'] = Utils::defaultUserAgent();
        }
    }

    /**
     * Merges default options into the array.
     *
     * @param array $options Options to modify by reference
     */
    private function prepareDefaults(array $options): array
    {
        $defaults = $this->config;

        if (!empty($defaults['headers'])) {
            // Default headers are only added if they are not present.
            $defaults['_conditional'] = $defaults['headers'];
            unset($defaults['headers']);
        }

        // Special handling for headers is required as they are added as
        // conditional headers and as headers passed to a request ctor.
        if (\array_key_exists('headers', $options)) {
            // Allows default headers to be unset.
            if ($options['headers'] === null) {
                $defaults['_conditional'] = [];
                unset($options['headers']);
            } elseif (!\is_array($options['headers'])) {
                throw new InvalidArgumentException('headers must be an array');
            }
        }

        // Shallow merge defaults underneath options.
        $result = $options + $defaults;

        // Remove null values.
        foreach ($result as $k => $v) {
            if ($v === null) {
                unset($result[$k]);
            }
        }

        return $result;
    }

    /**
     * Transfers the given request and applies request options.
     *
     * The URI of the request is not modified and the request options are used
     * as-is without merging in default options.
     *
     * @param array $options See \GuzzleHttp\RequestOptions.
     */
    private function transfer(RequestInterface $request, array $options): PromiseInterface
    {
        $request = $this->applyOptions($request, $options);
        /** @var HandlerStack $handler */
        $handler = $options['handler'];

        try {
            return P\Create::promiseFor($handler($request, $options));
        } catch (\Exception $e) {
            return P\Create::rejectionFor($e);
        }
    }

    /**
     * Applies the array of request options to a request.
     */
    private function applyOptions(RequestInterface $request, array &$options): RequestInterface
    {
        $modify = [
            'set_headers' => [],
        ];

        if (isset($options['headers'])) {
            $modify['set_headers'] = $options['headers'];
            unset($options['headers']);
        }

        if (isset($options['form_params'])) {
            if (isset($options['multipart'])) {
                throw new InvalidArgumentException('You cannot use '
                    . 'form_params and multipart at the same time. Use the '
                    . 'form_params option if you want to send application/'
                    . 'x-www-form-urlencoded requests, and the multipart '
                    . 'option to send multipart/form-data requests.');
            }
            $options['body'] = \http_build_query($options['form_params'], '', '&');
            unset($options['form_params']);
            // Ensure that we don't have the header in different case and set the new value.
            $options['_conditional'] = Psr7\Utils::caselessRemove(['Content-Type'], $options['_conditional']);
            $options['_conditional']['Content-Type'] = 'application/x-www-form-urlencoded';
        }

        if (isset($options['multipart'])) {
            $options['body'] = new Psr7\MultipartStream($options['multipart']);
            unset($options['multipart']);
        }

        if (isset($options['json'])) {
            $options['body'] = Utils::jsonEncode($options['json']);
            unset($options['json']);
            // Ensure that we don't have the header in different case and set the new value.
            $options['_conditional'] = Psr7\Utils::caselessRemove(['Content-Type'], $options['_conditional']);
            $options['_conditional']['Content-Type'] = 'application/json';
        }

        if (!empty($options['decode_content'])
            && $options['decode_content'] !== true
        ) {
            // Ensure that we don't have the header in different case and set the new value.
            $options['_conditional'] = Psr7\Utils::caselessRemove(['Accept-Encoding'], $options['_conditional']);
            $modify['set_headers']['Accept-Encoding'] = $options['decode_content'];
        }

        if (isset($options['body'])) {
            if (\is_array($options['body'])) {
                throw $this->invalidBody();
            }
            $modify['body'] = Psr7\Utils::streamFor($options['body']);
            unset($options['body']);
        }

        if (!empty($options['auth']) && \is_array($options['auth'])) {
            $value = $options['auth'];
            $type = isset($value[2]) ? \strtolower($value[2]) : 'basic';
            switch ($type) {
                case 'basic':
                    // Ensure that we don't have the header in different case and set the new value.
                    $modify['set_headers'] = Psr7\Utils::caselessRemove(['Authorization'], $modify['set_headers']);
                    $modify['set_headers']['Authorization'] = 'Basic '
                        . \base64_encode("$value[0]:$value[1]");
                    break;
                case 'digest':
                    // @todo: Do not rely on curl
                    $options['curl'][\CURLOPT_HTTPAUTH] = \CURLAUTH_DIGEST;
                    $options['curl'][\CURLOPT_USERPWD] = "$value[0]:$value[1]";
                    break;
                case 'ntlm':
                    $options['curl'][\CURLOPT_HTTPAUTH] = \CURLAUTH_NTLM;
                    $options['curl'][\CURLOPT_USERPWD] = "$value[0]:$value[1]";
                    break;
            }
        }

        if (isset($options['query'])) {
            $value = $options['query'];
            if (\is_array($value)) {
                $value = \http_build_query($value, '', '&', \PHP_QUERY_RFC3986);
            }
            if (!\is_string($value)) {
                throw new InvalidArgumentException('query must be a string or array');
            }
            $modify['query'] = $value;
            unset($options['query']);
        }

        // Ensure that sink is not an invalid value.
        if (isset($options['sink'])) {
            // TODO: Add more sink validation?
            if (\is_bool($options['sink'])) {
                throw new InvalidArgumentException('sink must not be a boolean');
            }
        }

        $request = Psr7\Utils::modifyRequest($request, $modify);
        if ($request->getBody() instanceof Psr7\MultipartStream) {
            // Use a multipart/form-data POST if a Content-Type is not set.
            // Ensure that we don't have the header in different case and set the new value.
            $options['_conditional'] = Psr7\Utils::caselessRemove(['Content-Type'], $options['_conditional']);
            $options['_conditional']['Content-Type'] = 'multipart/form-data; boundary='
                . $request->getBody()->getBoundary();
        }

        // Merge in conditional headers if they are not present.
        if (isset($options['_conditional'])) {
            // Build up the changes so it's in a single clone of the message.
            $modify = [];
            foreach ($options['_conditional'] as $k => $v) {
                if (!$request->hasHeader($k)) {
                    $modify['set_headers'][$k] = $v;
                }
            }
            $request = Psr7\Utils::modifyRequest($request, $modify);
            // Don't pass this internal value along to middleware/handlers.
            unset($options['_conditional']);
        }

        return $request;
    }

    /**
     * Return an InvalidArgumentException with pre-set message.
     */
    private function invalidBody(): InvalidArgumentException
    {
        return new InvalidArgumentException('Passing in the "body" request '
            . 'option as an array to send a request is not supported. '
            . 'Please use the "form_params" request option to send a '
            . 'application/x-www-form-urlencoded request, or the "multipart" '
            . 'request option to send a multipart/form-data request.');
    }
}


text:
package tc

// Capability reflects the ability of a user in ATC to perform some operation.
//
// In practice, they are assigned to relevant Traffic Ops API endpoints - to describe the
// capabilites of said endpoint - and to user permission Roles - to describe the capabilities
// afforded by said Role. Note that enforcement of Capability-based permisions is not currently
// implemented.
type Capability struct {
	Description string    `json:"description" db:"description"`
	LastUpdated TimeNoMod `json:"lastUpdated" db:"last_updated"`
	Name        string    `json:"name" db:"name"`
}

// CapabilitiesResponse models the structure of a minimal response from the Capabilities API in
// Traffic Ops.
type CapabilitiesResponse struct {
	Response []Capability `json:"response"`
	Alerts
}


text:
#ifndef FG3DMESHLEGACY_HPP
#define FG3DMESHLEGACY_HPP

#include "FgDiagnostics.hpp"
#include "FgMatrixC.hpp"
#include "FgMatrixV.hpp"
#include "Fg3dMesh.hpp"

namespace Fg {

struct  FffMultiObjectC
{
        // Function interfaces to get information.
        unsigned long   numObjs() const
                        { return uint(m_objs.size()); }
        unsigned long   numPoints(int objId) const
                        {
                            FGASSERT(size_t(objId) < m_objs.size());
                            return uint(m_objs[objId].ptList.size());
                        }
        unsigned long   numTriangles(int objId) const
                        {
                            FGASSERT(size_t(objId) < m_objs.size());
                            return uint(m_objs[objId].triList.size());
                        }
        unsigned long   numQuads(int objId) const
                        {
                            FGASSERT(size_t(objId) < m_objs.size());
                            return uint(m_objs[objId].quadList.size());
                        }
        unsigned long   numTxtCoord(int objId) const
                        {
                            FGASSERT(size_t(objId) < m_objs.size());
                            return uint(m_objs[objId].textCoord.size());
                        }
        unsigned long   numTxtTris(int objId) const
                        {
                            FGASSERT(size_t(objId) < m_objs.size());
                            return uint(m_objs[objId].texTriList.size());
                        }
        unsigned long   numTxtQuads(int objId) const
                        {
                            FGASSERT(size_t(objId) < m_objs.size());
                            return uint(m_objs[objId].texQuadList.size());
                        }
        unsigned long   totalNumPts() const
                        {
                            unsigned long total=0;
                            for (unsigned long ii=0; ii<numObjs(); ++ii)
                                total += numPoints(ii);
                            return total;
                        }
        unsigned long   totalNumTriangles() const
                        {
                            unsigned long total=0;
                            for (unsigned long ii=0; ii<numObjs(); ++ii)
                                total += numTriangles(ii);
                            return total;
                        }
        unsigned long   totalNumQuads() const
                        {
                            unsigned long total=0;
                            for (unsigned long ii=0; ii<numObjs(); ++ii)
                                total += numQuads(ii);
                            return total;
                        }
        Vec3F const *ptArray(int objId) const
                        {
                            FGASSERT(size_t(objId) < m_objs.size());
                            return &(m_objs[objId].ptList[0]);
                        }
        Vec3UI const *triArray(int objId) const
                        {
                            FGASSERT(size_t(objId) < m_objs.size());
                            return &(m_objs[objId].triList[0]);
                        }
        const Vec4UI *quadArray(int objId) const
                        {
                            FGASSERT(size_t(objId) < m_objs.size());
                            return &(m_objs[objId].quadList[0]);
                        }
        const Svec<Vec3F> &getPtList(int objId) const
                        {
                            FGASSERT(size_t(objId) < m_objs.size());
                            return m_objs[objId].ptList;
                        }
        Svec<Vec3F> &getPtList(int objId)
                        {
                            FGASSERT(size_t(objId) < m_objs.size());
                            return m_objs[objId].ptList;
                        }
        const Svec<Vec3UI> &getTriList(int objId) const
                        {
                            FGASSERT(size_t(objId) < m_objs.size());
                            return m_objs[objId].triList;
                        }
        Svec<Vec3UI> &getTriList(int objId)
                        {
                            FGASSERT(size_t(objId) < m_objs.size());
                            return m_objs[objId].triList;
                        }
        const Svec<Vec4UI> &getQuadList(int objId) const
                        {
                            FGASSERT(size_t(objId) < m_objs.size());
                            return m_objs[objId].quadList;
                        }
        Svec<Vec4UI> &getQuadList(int objId)
                        {
                            FGASSERT(size_t(objId) < m_objs.size());
                            return m_objs[objId].quadList;
                        }
        const Svec<Vec2F> &getTextCoord(int objId) const
                        {
                            FGASSERT(size_t(objId) < m_objs.size());
                            return m_objs[objId].textCoord;
                        }
        Svec<Vec2F> &getTextCoord(int objId)
                        {
                            FGASSERT(size_t(objId) < m_objs.size());
                            return m_objs[objId].textCoord;
                        }
        const Svec<Vec3UI> &getTexTriList(int objId) const
                        {
                            FGASSERT(size_t(objId) < m_objs.size());
                            return m_objs[objId].texTriList;
                        }
        Svec<Vec3UI> &getTexTriList(int objId)
                        {
                            FGASSERT(size_t(objId) < m_objs.size());
                            return m_objs[objId].texTriList;
                        }
        const Svec<Vec4UI> &getTexQuadList(int objId) const
                        {
                            FGASSERT(size_t(objId) < m_objs.size());
                            return m_objs[objId].texQuadList;
                        }
        Svec<Vec4UI> &getTexQuadList(int objId)
                        {
                            FGASSERT(size_t(objId) < m_objs.size());
                            return m_objs[objId].texQuadList;
                        }
        std::string     getTextureFilename(int objId=0) const
                        {
                            FGASSERT(size_t(objId) < m_objs.size());
                            std::string textureFile("");
                            if (m_objs[objId].textureFile.size() != 0 &&
                                m_objs[objId].textureFile != "")
                                textureFile = m_objs[objId].textureFile;
                            return textureFile;
                        }
        std::string     getModelName(int objId=0) const
        {
            FGASSERT(size_t(objId) < m_objs.size());
            char str[48];
            sprintf(str,"Object%d",objId);
            std::string modelName(str);
            if (m_objs[objId].modelName.size() != 0 &&
                m_objs[objId].modelName != "")
                modelName = m_objs[objId].modelName;
            return modelName;
        }

        void            clear() { m_objs.clear(); }

        void            forcePerVertexTextCoord();

        // Functions for adding new objects or setting data to a
        // specific obhect.
        void            setTextureFilename(
                            int                 objId,
                            const std::string   &filename)
                        {
                            FGASSERT(size_t(objId) < m_objs.size());
                            m_objs[objId].textureFile = filename;
                        }
        void            setModelName(
                            int                 objId,
                            const std::string   &modelName)
                        {
                            FGASSERT(size_t(objId) < m_objs.size());
                            m_objs[objId].modelName = modelName;
                        }

        struct objData
        {
            Svec<Vec3F> ptList;
            Svec<Vec3UI> triList;
            Svec<Vec4UI> quadList;
            Svec<Vec2F> textCoord;
            Svec<Vec3UI> texTriList;
            Svec<Vec4UI> texQuadList;
            std::string             textureFile;
            std::string             modelName;
        };

        Svec<objData> m_objs;
};

struct  FgMeshLegacy
{
    FffMultiObjectC                 base;
    Svec<FffMultiObjectC>    morphs;
    Svec<std::string>        morphNames;

    void
    forcePerVertexTextCoord()
    {
        base.forcePerVertexTextCoord();
        for (size_t ii=0; ii<morphs.size(); ++ii)
            morphs[ii].forcePerVertexTextCoord();
    }
};

// Also saves the texture images to appropriate filenames:
FgMeshLegacy
fgMeshLegacy(
    const Svec<Mesh> &   meshes,
    String8 const &                fname,
    const std::string &             imgFormat,
    uint                            maxLen=0);      // If non-zero, maxmum base filename length allowed (eg. 3DS)

}

#endif


text:
<!DOCTYPE html>

<meta name="generator" content="Hexo 3.8.0">

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="HandheldFriendly" content="True">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="description" content="Some people walk in the rain, others just get wet.">
<meta property="og:type" content="website">
<meta property="og:title" content="Categories">
<meta property="og:url" content="http://yoursite.com/categories/index.html">
<meta property="og:site_name" content="no thanks">
<meta property="og:description" content="Some people walk in the rain, others just get wet.">
<meta property="og:locale" content="en">
<meta property="og:updated_time" content="2018-11-29T15:55:35.568Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Categories">
<meta name="twitter:description" content="Some people walk in the rain, others just get wet.">

              <link rel="shortcut icon" href="/images/favicon.ico">

            <link rel="icon" type="image/png" href="/images/favicon-192x192.png" sizes="192x192">

            <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png">

    <title>Categories</title>

    <link rel="stylesheet" href="/css/style.css">

      <link rel="stylesheet" href="/css/rtl.css">

no thanks

Home

Writings

Friends

About

    Copyright © 2019 kernel1994

Home

Writings

Friends

About

<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">
<link rel="stylesheet" href="/lib/justified-gallery/css/justifiedGallery.min.css">


text:
package io.youi

import scala.concurrent.Future
import scala.concurrent.duration.FiniteDuration
import scala.language.implicitConversions

package object task {
  implicit def future2Task[R](future: => Future[R]): Task = FutureTask[R](future)
  implicit def f2Task(f: => Unit): Task = Action(f)

  implicit class StateChannelWorkflowDouble(state: Var[Double]) {
    def to(destination: => Double): PartialAnimate = PartialAnimate(
      get = () => state(),
      apply = (d: Double) => state := d,
      destination = () => destination
    )
  }

  def parallel(tasks: Task*): Parallel = new Parallel(tasks.toList)
  def sequential(tasks: Task*): Sequential = new Sequential(tasks.toList)
  def sleep(duration: FiniteDuration): Sleep = new Sleep(duration)
  def asynchronous(f: => Future[Unit]): Action = Action(f)
  def synchronous(f: => Unit): Action = Action {
    f
    Future.successful(())
  }
  def repeat(task: Task, times: Int = 1): Repeat = new Repeat(task, times)
  def forever(task: Task): Repeat = new Repeat(task, Int.MaxValue)
}


text:
import greenfoot.*;

public class labdoor extends object
{
    boolean mouseOver = false;
    GreenfootSound SFX = new GreenfootSound("sfx/button_hover.mp3");
    public void act()
    {
       MouseInfo mouse = Greenfoot.getMouseInfo();
       if (!mouseOver && Greenfoot.mouseMoved(this))
        {
            setImage("objects/labdoor_hover.png");
            mouseOver = true;
            SFX.play();
            HandCursor.setImage();
         }
       if (mouseOver && Greenfoot.mouseMoved(null) && ! Greenfoot.mouseMoved(this))
         {
             setImage("objects/labdoor.png");
             mouseOver = false;
             MouseCursor.setImage();
         }
       if (Greenfoot.mouseClicked(this))
        {
         Greenfoot.setWorld(new Office());
        }
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
 Copyright 2013 Oliver Schmid
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>MICE Portal</title>
<script type="text/javascript" language="javascript" src="miceScreenShot/miceScreenShot.nocache.js"></script>
</head>
<body></body>
</html>


text:
module Fayde.Controls {
    import ImageUpdater = minerva.controls.image.ImageUpdater;
    export class Image extends FrameworkElement {
        CreateLayoutUpdater() {
            return new ImageUpdater();
        }

        private static _SourceCoercer(d: DependencyObject, propd: DependencyProperty, value: any): any {
            if (typeof value === "string")
                return new Media.Imaging.BitmapImage(new Uri(value));
            if (value instanceof Uri)
                return new Media.Imaging.BitmapImage(value);
            return value;
        }

        static SourceProperty = DependencyProperty.RegisterFull("Source", () => Media.Imaging.ImageSource, Image, undefined, undefined, Image._SourceCoercer);
        // http: //msdn.microsoft.com/en-us/library/system.windows.media.stretch(v=vs.95).aspx
        static StretchProperty = DependencyProperty.RegisterCore("Stretch", () => new Enum(Media.Stretch), Image, Media.Stretch.Uniform);
        Source: Media.Imaging.ImageSource;
        Stretch: Media.Stretch;

        ImageOpened = new nullstone.Event();
        ImageFailed = new nullstone.Event();

        private $watcher: nullstone.IDisposable = null;

        OnImageErrored(source: Media.Imaging.BitmapSource, error: Error) {
            this.ImageFailed.raise(this, null);
        }

        OnImageLoaded(source: Media.Imaging.BitmapSource) {
            this.ImageOpened.raise(this, null);
            var lu = this.XamlNode.LayoutUpdater;
            lu.invalidateMeasure();
        }

        OnImageChanged(source: Media.Imaging.BitmapSource) {
            var lu = this.XamlNode.LayoutUpdater;
            lu.invalidateMeasure();
            lu.invalidate();
        }

        OnSourceChanged(oldSource: Media.Imaging.ImageSource, newSource: Media.Imaging.ImageSource) {
            if (this.$watcher) {
                this.$watcher.dispose();
                this.$watcher = null;
            }
            if (newSource instanceof Media.Imaging.BitmapSource) {
                this.$watcher = newSource.watch({
                    onErrored: (source, error) => this.OnImageErrored(source, error),
                    onLoaded: (source) => this.OnImageLoaded(source),
                    onChanged: (source) => this.OnImageChanged(source)
                });
            }
        }
    }
    Fayde.CoreLibrary.add(Image);

    UIReaction<Media.Imaging.ImageSource>(Image.SourceProperty, (upd: ImageUpdater, ov, nv, image?: Image) => {
        image.OnSourceChanged(ov, nv);
        if (!nv) {
            upd.updateBounds();
            upd.invalidate();
        }
        upd.invalidateMeasure();
        upd.invalidateMetrics();
    }, false);
    UIReaction<minerva.Stretch>(Image.StretchProperty, (upd: ImageUpdater, ov, nv) => {
        upd.invalidateMeasure();
        upd.invalidateMetrics();
    }, false);
}


text:
namespace media {

// Interface for promises being resolved/rejected in response to various
// session actions. These may be called synchronously or asynchronously.
// The promise must be resolved or rejected exactly once. It is expected that
// the caller free the promise once it is resolved/rejected.
//
// This is only the base class, as parameter to resolve() varies.
class MEDIA_EXPORT CdmPromise {
 public:
  // A superset of media::MediaKeys::Exception for UMA reporting.
  enum ResultCodeForUMA {
    SUCCESS,
    NOT_SUPPORTED_ERROR,
    INVALID_STATE_ERROR,
    INVALID_ACCESS_ERROR,
    QUOTA_EXCEEDED_ERROR,
    UNKNOWN_ERROR,
    CLIENT_ERROR,
    OUTPUT_ERROR,
    NUM_RESULT_CODES
  };

  enum ResolveParameterType {
    VOID_TYPE,
    STRING_TYPE,
    KEY_IDS_VECTOR_TYPE
  };

  typedef base::Callback<void(MediaKeys::Exception exception_code,
                              uint32 system_code,
                              const std::string& error_message)>
      PromiseRejectedCB;

  virtual ~CdmPromise();

  // Used to indicate that the operation failed. |exception_code| must be
  // specified. |system_code| is a Key System-specific value for the error
  // that occurred, or 0 if there is no associated status code or such status
  // codes are not supported by the Key System. |error_message| is optional.
  virtual void reject(MediaKeys::Exception exception_code,
                      uint32 system_code,
                      const std::string& error_message);

  ResolveParameterType GetResolveParameterType() const {
    return parameter_type_;
  }

 protected:
  explicit CdmPromise(ResolveParameterType parameter_type);
  CdmPromise(ResolveParameterType parameter_type, PromiseRejectedCB reject_cb);

  // If constructed with a |uma_name| (which must be the name of a
  // CdmPromiseResult UMA), CdmPromise will report the promise result (success
  // or rejection code).
  CdmPromise(ResolveParameterType parameter_type,
             PromiseRejectedCB reject_cb,
             const std::string& uma_name);

  // Called by all resolve()/reject() methods to report the UMA result if
  // applicable, and update |is_pending_|.
  void ReportResultToUMA(ResultCodeForUMA result);

  const ResolveParameterType parameter_type_;
  PromiseRejectedCB reject_cb_;

  // Keep track of whether the promise hasn't been resolved or rejected yet.
  bool is_pending_;

  // UMA name to report result to.
  std::string uma_name_;

  DISALLOW_COPY_AND_ASSIGN(CdmPromise);
};

template <typename T>
class MEDIA_EXPORT CdmPromiseTemplate : public CdmPromise {
 public:
  CdmPromiseTemplate(base::Callback<void(const T&)> resolve_cb,
                     PromiseRejectedCB rejected_cb);
  CdmPromiseTemplate(base::Callback<void(const T&)> resolve_cb,
                     PromiseRejectedCB rejected_cb,
                     const std::string& uma_name);
  virtual void resolve(const T& result);

 protected:
  // Allow subclasses to completely override the implementation.
  CdmPromiseTemplate();

 private:
  base::Callback<void(const T&)> resolve_cb_;

  DISALLOW_COPY_AND_ASSIGN(CdmPromiseTemplate);
};

// Specialization for no parameter to resolve().
template <>
class MEDIA_EXPORT CdmPromiseTemplate<void> : public CdmPromise {
 public:
  CdmPromiseTemplate(base::Callback<void(void)> resolve_cb,
                     PromiseRejectedCB rejected_cb);
  CdmPromiseTemplate(base::Callback<void(void)> resolve_cb,
                     PromiseRejectedCB rejected_cb,
                     const std::string& uma_name);
  virtual void resolve();

 protected:
  // Allow subclasses to completely override the implementation.
  CdmPromiseTemplate();

 private:
  base::Callback<void(void)> resolve_cb_;

  DISALLOW_COPY_AND_ASSIGN(CdmPromiseTemplate);
};

}  // namespace media

#endif  // MEDIA_BASE_CDM_PROMISE_H_


text:
@interface SJXNetworkTool : NSObject

+ (instancetype)share;

- (void)getWithURLString:(NSString *)urlString parameters:(NSMutableDictionary *)parameters success:(void(^)(id responseObject))success failure:(void(^)(NSError *error))failure;

- (void)postWithURLString:(NSString *)urlString parameters:(NSMutableDictionary *)parameters success:(void(^)(id responseObject))success failure:(void(^)(NSError *error))failure;

@end


text:
module CapistranoDeploy
  module Rails
    def self.load_into(configuration)
      configuration.load do
        set :rake do
          if using_recipe?(:bundle)
            'bundle exec rake'
          else
            'rake'
          end
        end

        set(:rails_env) { 'production' }

        namespace :deploy do
          desc 'Deploy & migrate'
          task :migrations do
            update
            migrate
            restart
          end

          desc 'Run migrations'
          task :migrate, :roles => :db, :only => {:primary => true} do
            run "cd #{deploy_to} && RAILS_ENV=#{rails_env} #{rake} db:migrate"
          end
        end
      end
    end
  end
end


text:
.. _reference.exceptions:

==========
Exceptions
==========

.. php:namespace:: Ramsey\Uuid\Exception

.. php:exception:: BuilderNotFoundException

    Extends `RuntimeException <https://www.php.net/runtimeexception>`_.

    Thrown to indicate that no suitable UUID builder could be found.

.. php:exception:: DateTimeException

    Extends `RuntimeException <https://www.php.net/runtimeexception>`_.

    Thrown to indicate that the PHP DateTime extension encountered an
    exception or error.

.. php:exception:: DceSecurityException

    Extends `RuntimeException <https://www.php.net/runtimeexception>`_.

    Thrown to indicate an exception occurred while dealing with DCE Security
    (version 2) UUIDs

.. php:exception:: InvalidArgumentException

    Extends `InvalidArgumentException <https://www.php.net/invalidargumentexception>`_.

    Thrown to indicate that the argument received is not valid.

.. php:exception:: InvalidBytesException

    Extends `RuntimeException <https://www.php.net/runtimeexception>`_.

    Thrown to indicate that the bytes being operated on are invalid in some way.

.. php:exception:: InvalidUuidStringException

    Extends :php:exc:`Ramsey\\Uuid\\Exception\\InvalidArgumentException`.

    Thrown to indicate that the string received is not a valid UUID.

.. php:exception:: NameException

    Extends `RuntimeException <https://www.php.net/runtimeexception>`_.

    Thrown to indicate that an error occurred while attempting to hash a
    namespace and name

.. php:exception:: NodeException

    Extends `RuntimeException <https://www.php.net/runtimeexception>`_.

    Thrown to indicate that attempting to fetch or create a node ID encountered
    an error.

.. php:exception:: RandomSourceException

    Extends `RuntimeException <https://www.php.net/runtimeexception>`_.

    Thrown to indicate that the source of random data encountered an error.

.. php:exception:: TimeSourceException

    Extends `RuntimeException <https://www.php.net/runtimeexception>`_.

    Thrown to indicate that the source of time encountered an error.

.. php:exception:: UnableToBuildUuidException

    Extends `RuntimeException <https://www.php.net/runtimeexception>`_.

    Thrown to indicate a builder is unable to build a UUID.

.. php:exception:: UnsupportedOperationException

    Extends `LogicException <https://www.php.net/logicexception>`_.

    Thrown to indicate that the requested operation is not supported.


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

<title>DebugMetadata</title>
<meta name="date" content="2022-10-27">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.facebook.litho

Class DebugMetadata

java.lang.Object

com.facebook.litho.DebugMetadata

public class DebugMetadata
extends java.lang.Object

DebugMetadata is a special class that allows custom key-value pairs to be appended to LithoMetadataExceptionWrapper when it wraps an exception. To use it, create a DebugMetadata tree
 prop via @OnCreateTreeProp and add custom metadata you want to appear in crashes. Any crash
 coming from that subtree will contain this metadata in the LithoMetadataExceptionWrapper. Make
 sure to pass in the existing DebugMetadata tree prop if there is one.

Example:

Method Summary

All Methods Static Methods Concrete Methods

Modifier and Type
Method and Description

static DebugMetadata
createWithMetadata(DebugMetadata existingMetadata,
                  java.lang.String key,
                  java.lang.String value,
                  java.lang.String... moreKeysAndValues)

Creates a new DebugMetadata object based on an existing DebugMetadata object (or null).

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail

createWithMetadata

public static DebugMetadata createWithMetadata(DebugMetadata existingMetadata,
                                               java.lang.String key,
                                               java.lang.String value,
                                               java.lang.String... moreKeysAndValues)

Creates a new DebugMetadata object based on an existing DebugMetadata object (or null). Keys
 and values will override existing properties with the same key. See the example in the class
 javadocs for how to use it.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
package orm

type ThermometerReading struct {
	ID        		uint 			`gorm:"primary_key"`    // primary key
	ThermometerID	uint 			`sql:"index"`			// foreign key of the thermometer
	Timestamp		uint64 			`sql:"index`			// timestamp of the event
	Reading			uint64  								// reading multiplied by 1000
}

func NewThermometerReading(thermometer Thermometer, reading uint64) ThermometerReading {
	return ThermometerReading{
		ThermometerID: uint(thermometer.ID),
		Timestamp: GetNow(),
		Reading:   reading}
}


text:
var str: string;
var bool: boolean;
var num: number;
var strOrNum: string | number;
var strOrNumOrBool: string | number | boolean;
var numOrBool: number | boolean;

// A type guard of the form !expr
// - when true, narrows the type of x by expr when false, or
// - when false, narrows the type of x by expr when true.

// !typeguard1
if (!(typeof strOrNum === "string")) {
    num === strOrNum; // number
}
else {
    str = strOrNum; // string
}
// !(typeguard1 || typeguard2)
if (!(typeof strOrNumOrBool === "string" || typeof strOrNumOrBool === "number")) {
    bool = strOrNumOrBool; // boolean
}
else {
    strOrNum = strOrNumOrBool; // string | number
}
// !(typeguard1) || !(typeguard2)
if (!(typeof strOrNumOrBool !== "string") || !(typeof strOrNumOrBool !== "number")) {
    strOrNum = strOrNumOrBool; // string | number
}
else {
    bool = strOrNumOrBool; // boolean
}
// !(typeguard1 && typeguard2)
if (!(typeof strOrNumOrBool !== "string" && typeof strOrNumOrBool !== "number")) {
    strOrNum = strOrNumOrBool; // string | number
}
else {
    bool = strOrNumOrBool; // boolean
}
// !(typeguard1) && !(typeguard2)
if (!(typeof strOrNumOrBool === "string") && !(typeof strOrNumOrBool === "number")) {
    bool = strOrNumOrBool; // boolean
}
else {
    strOrNum = strOrNumOrBool; // string | number
}
// !(typeguard1) && simpleExpr
if (!(typeof strOrNumOrBool === "string") && numOrBool !== strOrNumOrBool) {
    numOrBool = strOrNumOrBool; // number | boolean
}
else {
    var r1: string | number | boolean = strOrNumOrBool; // string | number | boolean
}

//// [typeGuardOfFormNotExpr.js]
var str;
var bool;
var num;
var strOrNum;
var strOrNumOrBool;
var numOrBool;
// A type guard of the form !expr
// - when true, narrows the type of x by expr when false, or
// - when false, narrows the type of x by expr when true.
// !typeguard1
if (!(typeof strOrNum === "string")) {
    num === strOrNum; // number
}
else {
    str = strOrNum; // string
}
// !(typeguard1 || typeguard2)
if (!(typeof strOrNumOrBool === "string" || typeof strOrNumOrBool === "number")) {
    bool = strOrNumOrBool; // boolean
}
else {
    strOrNum = strOrNumOrBool; // string | number
}
// !(typeguard1) || !(typeguard2)
if (!(typeof strOrNumOrBool !== "string") || !(typeof strOrNumOrBool !== "number")) {
    strOrNum = strOrNumOrBool; // string | number
}
else {
    bool = strOrNumOrBool; // boolean
}
// !(typeguard1 && typeguard2)
if (!(typeof strOrNumOrBool !== "string" && typeof strOrNumOrBool !== "number")) {
    strOrNum = strOrNumOrBool; // string | number
}
else {
    bool = strOrNumOrBool; // boolean
}
// !(typeguard1) && !(typeguard2)
if (!(typeof strOrNumOrBool === "string") && !(typeof strOrNumOrBool === "number")) {
    bool = strOrNumOrBool; // boolean
}
else {
    strOrNum = strOrNumOrBool; // string | number
}
// !(typeguard1) && simpleExpr
if (!(typeof strOrNumOrBool === "string") && numOrBool !== strOrNumOrBool) {
    numOrBool = strOrNumOrBool; // number | boolean
}
else {
    var r1 = strOrNumOrBool; // string | number | boolean
}


text:
using ChartJS.NET.Infrastructure;

namespace ChartJS.NET.Charts.Line
{
    public class LineChart : BaseChart<LineDataSet, LineChartOptions>
    {
        private readonly LineChartOptions _barChartOptions = new LineChartOptions();

        public override Enums.ChartTypes ChartType
        {
            get { return Enums.ChartTypes.Line; }
        }

        public override LineChartOptions ChartConfig
        {
            get { return _barChartOptions; }
        }
    }
}


text:
'use strict';

var gulp = require('gulp');
var Server = require('karma').Server;
var path = require('path');

module.exports = gulp.task('karma', function (done) {
    return new Server({
        configFile: path.resolve(config.paths.src.karmaConf),
        singleRun : (release) ? (true) : (false)
    }, done).start();
});