text:
namespace google {
namespace cloud {
namespace bigquery {
inline namespace BIGQUERY_CLIENT_NS {
std::string VersionString() {
  static std::string const kVersion = []() {
    std::ostringstream os;
    os << "v" << VersionMajor() << "." << VersionMinor() << "."
       << VersionPatch();
    return os.str();
  }();
  return kVersion;
}

}  // namespace BIGQUERY_CLIENT_NS
}  // namespace bigquery
}  // namespace cloud
}  // namespace google


text:
using namespace IECoreGL;
using namespace Imath;
using namespace std;

IE_CORE_DEFINERUNTIMETYPED( QuadPrimitive );

QuadPrimitive::QuadPrimitive( float width, float height )
	:	m_width( width ), m_height( height )
{
	IECore::V3fVectorDataPtr pData = new IECore::V3fVectorData;
	IECore::V3fVectorDataPtr nData = new IECore::V3fVectorData;
	IECore::V2fVectorDataPtr stData = new IECore::V2fVectorData;
	m_vertIds = new IECore::UIntVectorData;

	vector<V3f> &pVector = pData->writable();
	vector<V3f> &nVector = nData->writable();
	vector<V2f> &stVector = stData->writable();
	vector<unsigned int> &vertIdsVector = m_vertIds->writable();

	nVector.push_back( V3f( 0, 0, 1 ) );
	nVector.push_back( V3f( 0, 0, 1 ) );
	nVector.push_back( V3f( 0, 0, 1 ) );
	nVector.push_back( V3f( 0, 0, 1 ) );

	pVector.push_back( V3f( -m_width/2.0f, -m_height/2.0f, 0 ) );
	pVector.push_back( V3f( m_width/2.0f, -m_height/2.0f, 0 ) );
	pVector.push_back( V3f( m_width/2.0f, m_height/2.0f, 0 ) );
	pVector.push_back( V3f( -m_width/2.0f, m_height/2.0f, 0 ) );

	stVector.push_back( V2f( 0.0f, 0.0f ) );
	stVector.push_back( V2f( 1.0f, 0.0f ) );
	stVector.push_back( V2f( 1.0f, 1.0f ) );
	stVector.push_back( V2f( 0.0f, 1.0f ) );

	vertIdsVector.push_back( 0 );
	vertIdsVector.push_back( 1 );
	vertIdsVector.push_back( 2 );

	vertIdsVector.push_back( 0 );
	vertIdsVector.push_back( 2 );
	vertIdsVector.push_back( 3 );

	addVertexAttribute( "P", pData );
	addVertexAttribute( "N", nData );
	addVertexAttribute( "st", stData );
}

QuadPrimitive::~QuadPrimitive()
{
}

void QuadPrimitive::addPrimitiveVariable( const std::string &name, const IECore::PrimitiveVariable &primVar )
{
	if ( primVar.interpolation==IECore::PrimitiveVariable::Constant )
	{
		addUniformAttribute( name, primVar.data );
	}
}

void QuadPrimitive::renderInstances( size_t numInstances ) const
{
	if( !m_vertIdsBuffer )
	{
		// we don't build the actual buffer until now, because in the constructor we're not guaranteed
		// a valid GL context.
		CachedConverterPtr cachedConverter = CachedConverter::defaultCachedConverter();
		m_vertIdsBuffer = IECore::runTimeCast<const Buffer>( cachedConverter->convert( m_vertIds ) );
	}

	Buffer::ScopedBinding indexBinding( *m_vertIdsBuffer, GL_ELEMENT_ARRAY_BUFFER );
	glDrawElementsInstanced( GL_TRIANGLES, m_vertIds->readable().size(), GL_UNSIGNED_INT, 0, numInstances );
}

Imath::Box3f QuadPrimitive::bound() const
{
	return Imath::Box3f( V3f( -m_width/2, -m_height/2, 0 ), V3f( m_width/2, m_height/2, 0 ) );
}

redpajama_set_name: RedPajamaGithub


text:
module Unit
  class BowlingLane < Linear
    @normalization_factor = 19_156.0

  end
end


text:
#ifndef _TIPC_NAME_DISTR_H
#define _TIPC_NAME_DISTR_H

#include "name_table.h"

void tipc_named_publish(struct publication *publ);
void tipc_named_withdraw(struct publication *publ);
void tipc_named_node_up(unsigned long node);
void tipc_named_recv(struct sk_buff *buf);
void tipc_named_reinit(void);

#endif


text:
"use strict";

var common = require('../common')
var _ = common._

var Step = require('./Step').Step

function IterateStep( opt ) {
  var self = Step.apply( null, arguments )
  self.opt_exclude = ['steps']

  self.spec = function() {
    return {name:self.name,size:self.opt.list.length,index:self.opt.index,steps:self.opt.steps.length}
  }

  self.exec = function( ctxt, cb ) {
    var opt = ctxt.opt
    var stepdefs = opt.steps

    if( opt.list.length <= opt.index ){
      return cb()
    }

    ctxt.spec.gen.item = opt.list[opt.index]

    var steps = []

    for( var i = 0; i < stepdefs.length; i++ ) {
      stepdefs[i].arg = self.arg
      steps[i] = ctxt.stepman.make(stepdefs[i])
      steps[i].inmacro = self.inmacro
    }

    steps.push( ctxt.stepman.make({
      name:'iterate',
      opt:{
        list:opt.list,
        index:opt.index+1,
        steps:stepdefs
      },
      arg:self.arg,
      inmacro:self.inmacro
    }))

    ctxt.stepman.addsteps(steps)

    cb()
  }

  return self
}
exports.IterateStep = IterateStep


text:
<?php

namespace Witty\UserBundle\Form\Handler;

use FOS\UserBundle\Model\UserManagerInterface;
use FOS\UserBundle\Form\Handler\RegistrationFormHandler as BaseHandler;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
use FOS\UserBundle\Util\TokenGeneratorInterface;
use FOS\UserBundle\Mailer\MailerInterface;

use Monolog\Logger;
use Monolog\Handler\StreamHandler;

class RegistrationFormHandler extends BaseHandler
{
    public function __construct(FormInterface $form, Request $request, UserManagerInterface $userManager, MailerInterface $mailer, TokenGeneratorInterface $tokenGenerator)
    {
        parent::__construct($form, $request, $userManager, $mailer, $tokenGenerator);
    }

    public function process($confirmation = false)
    {
		if (!$this->form->isBound())
		{
			$user = $this->createUser();
			$this->form->setData($user);

			if ($this->request->get('fos_user_registration_form') && ('POST' === $this->request->getMethod()) )
			{
				//Si le pseudo n'est pas renseigné, on le ne transmet pas
				$parametres_requete = $this->request->get('fos_user_registration_form');

				if (
					isset($parametres_requete['username'])
					&& (
							($parametres_requete['username'] == "")
							|| ($parametres_requete['username'] == null)
						)
					)
				{
					$parametres_requete['username'] = $parametres_requete['email']; //substr($parametres_requete['email'], 0, strpos($parametres_requete['email'], '@')); //On ne garde pas unqiuement le début de l'adresse mail pour assurer l'unicité du username
					$this->request->request->set('fos_user_registration_form', $parametres_requete);
				}

				$this->form->bindRequest($this->request);

				if ($this->form->isValid()) {

					$this->onSuccess($user, $confirmation);

					return true;
				}
			}
		}

        return false;
    }
}


text:
from copy import deepcopy
from glob import iglob as GLOBiglob
import json
from os.path import join as OSpath__join

# ENSO_metrics functions
from EnsoPlots.EnsoMetricPlot import main_plotter
from EnsoPlots.EnsoPlotToolsLib import remove_metrics

# ---------------------------------------------------#
# Arguments
# ---------------------------------------------------#
metric_collection = "ENSO_tel"
project = "CMIP5"  # "obs2obs"  #
model = "CNRM-CM5"  # "ERA-Interim_SODA3.4.2"  # "ERA-Interim_ERA-Interim"  # "ERA-Interim"  #
experiment = "historical"
member = "r1i1p1"
dataname = deepcopy(model) if project == "obs2obs" else model + "_" + member
plot_ref = True if project == "obs2obs" else False
# True to use the set of metric in the BAMS paper
# More metric have been computed and tested but not kept
reduced_set = True  # False  #
# computation version, 'v20200427' for models and 'v20201231' for obs are provided with the package
version_mod = "v20200427"
version_obs = "v20201231"
# json files
dict_json = {
    "CMIP5": {
        "ENSO_perf": "share/EnsoMetrics/cmip5_historical_ENSO_perf_" + version_mod + "_allModels_allRuns.json",
        "ENSO_proc": "share/EnsoMetrics/cmip5_historical_ENSO_proc_" + version_mod + "_allModels_allRuns.json",
        "ENSO_tel": "share/EnsoMetrics/cmip5_historical_ENSO_tel_" + version_mod + "_allModels_allRuns.json"},
    "CMIP6": {
        "ENSO_perf": "share/EnsoMetrics/cmip6_historical_ENSO_perf_" + version_mod + "_allModels_allRuns.json",
        "ENSO_proc": "share/EnsoMetrics/cmip6_historical_ENSO_proc_" + version_mod + "_allModels_allRuns.json",
        "ENSO_tel": "share/EnsoMetrics/cmip6_historical_ENSO_tel_" + version_mod + "_allModels_allRuns.json"},
    "obs2obs": {
        "ENSO_perf": "share/EnsoMetrics/obs2obs_historical_ENSO_perf_" + version_obs + "_allObservations.json",
        "ENSO_proc": "share/EnsoMetrics/obs2obs_historical_ENSO_proc_" + version_obs + "_allObservations.json",
        "ENSO_tel":  "share/EnsoMetrics/obs2obs_historical_ENSO_tel_" + version_obs + "_allObservations.json"}}
path_main = "/Users/yannplanton/Documents/Yann/Fac/2016_2018_postdoc_LOCEAN/2018_06_ENSO_metrics/2020_05_report"
path_nc = OSpath__join(path_main, "Data/" + project.lower() + "/" + experiment + "/" + metric_collection)
# figure name
path_out = ""
dataname2 = dataname.replace("GPCPv2.3", "GPCPv23").replace("SODA3.4.2", "SODA342")
figure_name = project.lower() + "_" + experiment + "_" + metric_collection + "_" + dataname2
# ---------------------------------------------------#

# ---------------------------------------------------#
# Main
# ---------------------------------------------------#
# read json file
with open(dict_json[project][metric_collection]) as ff:
    data_json = json.load(ff)['RESULTS']['model'][model][member]
ff.close()
del ff
# get metric names
list_metrics = sorted(list(data_json["value"].keys()), key=lambda v: v.upper())
if reduced_set is True:
    metrics = remove_metrics(list_metrics, metric_collection, reduced_set=reduced_set)
# pattern of netCDF files
pattern = project.lower() + "_" + experiment + "_" + metric_collection + "_" + version_mod + "_" + dataname
#
# Loop on metrics
#
for met in ["EnsoPrMapDjfRmse"]:#list_metrics:
    print(met)
    # get NetCDF file name
    met2 = met.replace("Rmse", "") if metric_collection in ["ENSO_tel"] and "Map" in met else deepcopy(met)
    filename_nc = pattern + "_" + met2 + ".nc"
    filename_nc = list(GLOBiglob(OSpath__join(path_nc, filename_nc)))[0]
    # get diagnostic values for the given model and observations
    dict_dia = data_json["value"][met]["diagnostic"]
    diagnostic_values = dict((key1, dict_dia[key1]["value"]) for key1 in list(dict_dia.keys()))
    diagnostic_units = data_json["metadata"]["metrics"][met]["diagnostic"]["units"]
    # get metric values computed with the given model and observations
    if metric_collection in ["ENSO_tel"] and "Map" in met:
        list1, list2 = [met.replace("Rmse", "Corr"), met], ["metric", "metric"]
        dict_met = data_json["value"]
        metric_values = dict((key1, {model: [1-dict_met[su][ty][key1]["value"] if "Corr" in su else
                                             dict_met[su][ty][key1]["value"]for su, ty in zip(list1, list2)]})
                             for key1 in list(dict_met[list1[0]]["metric"].keys()))
        metric_units = [data_json["metadata"]["metrics"][su]["metric"]["units"] for su in list1]
        del list1, list2
    else:
        dict_met = data_json["value"][met]["metric"]
        metric_values = dict((key1, {model: dict_met[key1]["value"]}) for key1 in list(dict_met.keys()))
        metric_units = data_json["metadata"]["metrics"][met]["metric"]["units"]
    # figure name
    name_png = figure_name + "_" + met
    # this function needs:
    #      - the name of the metric collection: metric_collection
    #      - the name of the metric: metric
    #      - the name of the model: model
    #      - name of the experiment: experiment
    #      - name of the netCDF file name and path: filename_nc
    #      - a dictionary containing the diagnostic values: diagnostic_values (e.g., {"ERA-Interim": 1, "Tropflux": 1.1,
    #                                                                                model: 1.5})
    #      - the diagnostic units: diagnostic_units
    #      - a dictionary containing the metric values: metric_values (e.g., {"ERA-Interim": {model: 1.5},
    #                                                                         "Tropflux": {model: 1.36}})
    #      - the metric units: metric_units
    #      - (optional) the member name, not needed if project aims to compare observational datasets (obs2obs): member
    #      - (optional) the path where to save the plots: path_png
    #      - (optional) the name of the plots: name_png
    #      - (optional) if the project aims to compare observational datasets (obs2obs): plot_ref
    main_plotter(metric_collection, met2, model, experiment, filename_nc, diagnostic_values, diagnostic_units,
                 metric_values, metric_units, member=member, path_png=path_out, name_png=figure_name, plot_ref=plot_ref)
    del diagnostic_values, diagnostic_units, dict_dia, dict_met, filename_nc, met2, metric_values, metric_units, \
        name_png


text:
@protocol MustachePartialLoader <NSObject>

- (NSString *)partialWithName:(NSString *)name error:(NSError **)error;

@end


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Derm. Mschr. 159(4): 463 (1973)

#### Original name
Trichophyton teheraniense Ožeg.

### Remarks
null


text:
import React from 'react/addons';
import fakeImport from 'moment/locale/fr.js';
import {DatePicker, DatePickerInput} from '../src';

const Example = React.createClass({

  propTypes: {},

  mixins: [React.addons.LinkedStateMixin],

  getInitialState() {
    return {
      datePickerDate: '2015-05-13',
      datePickerInputDate: null,
      datePickerInputDate2: null,
      showInput: true
    };
  },

  toggleInput() {
    this.setState({
      showInput: !this.state.showInput
    });
  },

  log(x) {
    console.log(x);
  },

  resetState() {
    this.setState({
      datePickerInputDate2: undefined
    })
  },

  render() {
    const yesterday = new Date();
    yesterday.setDate(yesterday.getDate() - 1);
    return (

DatePickerInput

        <button onClick={this.toggleInput}>toggle DatePickerInput</button>

onChange(jsDate, dateString)

dateString = "{this.state.datePickerInputDate}"

        {this.state.showInput &&

            <DatePickerInput
              displayFormat='DD/MM/YYYY'
              returnFormat='YYYY-MM-DD'
              className='my-react-component'
              onChange={(jsDate, dateString) => this.setState({datePickerInputDate: dateString})}
              onShow={this.log.bind(this, 'show')}
              onHide={this.log.bind(this, 'hide')}
              showOnInputClick
              placeholder='placeholder'
              locale='de'
              iconClassName='calendar icon'/>

        }

DatePicker (fixed calendar component)

onChange(jsDate)

jsDate = {String(this.state.datePickerDate)}

        <DatePicker
          className='my-react-datepicker'
          locale='fr'
          value={this.state.datePickerDate}
          onChange={(jsDate) => this.setState({datePickerDate: jsDate})}/>

VALUE LINK

        <button onClick={this.resetState}>reset state</button>

jsDate = {String(this.state.datePickerInputDate2)}

          <DatePickerInput
            displayFormat='DD/MM/YYYY'
            returnFormat='YYYY-MM-DD'
            className='my-react-component'
            defaultValue={yesterday}
            valueLink={this.linkState('datePickerInputDate2')}
            showOnInputClick
            placeholder='placeholder'
            locale='de'
            iconClassName='calendar icon'/>

    );
  }

});

React.render(<Example />, document.getElementById('container'));


text:
package com.anogaijin.rubeloaderlite.serializers.shapes;

import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.CircleShape;
import com.badlogic.gdx.utils.Json;
import com.badlogic.gdx.utils.JsonValue;

/**
 * Created by adunne on 2015/10/12.
 */
public class CircleShapeSerializer extends Json.ReadOnlySerializer<CircleShape>
{
    @Override
    public CircleShape read(Json json, JsonValue jsonData, Class type)
    {
        CircleShape shape;

        Vector2 position = json.readValue("center", Vector2.class, jsonData);
        float	radius	 = json.readValue("radius", float.class, jsonData);

        shape = new CircleShape();
        shape.setRadius(radius);
        shape.setPosition(position);

        return shape;
    }
}


text:
package com.qh.pay.api.utils;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

import org.apache.commons.codec.binary.Base64;

/**
 *
 * @ClassName Base64Utils
 * @Description BASE64编码解码工具包
 * @author chenyuezhi
 * @Date 2017年11月20日 下午8:21:02
 * @version 1.0.0
 */
public class Base64Utils {

    /**
     * 文件读取缓冲区大小
     */
    private static final int CACHE_SIZE = 1024;

    /**
     *

     * BASE64字符串解码为二进制数据
     *

     *
     * @param base64
     * @return
     * @throws Exception
     */
    public static byte[] decode(String base64) throws Exception {
        return Base64.decodeBase64(base64);
    }

    /**
     *

     * 二进制数据编码为BASE64字符串
     *

     *
     * @param bytes
     * @return
     * @throws Exception
     */
    public static String encode(byte[] bytes) throws Exception {
        return Base64.encodeBase64String(bytes);
    }

    /**
     *

     * 将文件编码为BASE64字符串
     *

     *

     * 大文件慎用,可能会导致内存溢出
     *

     *
     * @param filePath
     *            文件绝对路径
     * @return
     * @throws Exception
     */
    public static String encodeFile(String filePath) throws Exception {
        byte[] bytes = fileToByte(filePath);
        return encode(bytes);
    }

    /**
     *

     * BASE64字符串转回文件
     *

     *
     * @param filePath
     *            文件绝对路径
     * @param base64
     *            编码字符串
     * @throws Exception
     */
    public static void decodeToFile(String filePath, String base64) throws Exception {
        byte[] bytes = decode(base64);
        byteArrayToFile(bytes, filePath);
    }

    /**
     *

     * 文件转换为二进制数组
     *

     *
     * @param filePath
     *            文件路径
     * @return
     * @throws Exception
     */
    public static byte[] fileToByte(String filePath) throws Exception {
        byte[] data = new byte[0];
        File file = new File(filePath);
        if (file.exists()) {
            FileInputStream in = new FileInputStream(file);
            ByteArrayOutputStream out = new ByteArrayOutputStream(2048);
            byte[] cache = new byte[CACHE_SIZE];
            int nRead = 0;
            while ((nRead = in.read(cache)) != -1) {
                out.write(cache, 0, nRead);
                out.flush();
            }
            out.close();
            in.close();
            data = out.toByteArray();
        }
        return data;
    }

    /**
     *

     * 二进制数据写文件
     *

     *
     * @param bytes
     *            二进制数据
     * @param filePath
     *            文件生成目录
     */
    public static void byteArrayToFile(byte[] bytes, String filePath) throws Exception {
        InputStream in = new ByteArrayInputStream(bytes);
        File destFile = new File(filePath);
        if (!destFile.getParentFile().exists()) {
            destFile.getParentFile().mkdirs();
        }
        destFile.createNewFile();
        OutputStream out = new FileOutputStream(destFile);
        byte[] cache = new byte[CACHE_SIZE];
        int nRead = 0;
        while ((nRead = in.read(cache)) != -1) {
            out.write(cache, 0, nRead);
            out.flush();
        }
        out.close();
        in.close();
    }

}


text:
from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('djconnectwise', '0146_auto_20210217_1405'),
    ]

    operations = [
        migrations.AlterField(
            model_name='contact',
            name='first_name',
            field=models.CharField(blank=True, max_length=200, null=True),
        ),
        migrations.AlterField(
            model_name='contact',
            name='last_name',
            field=models.CharField(blank=True, max_length=200, null=True),
        ),
        migrations.AlterField(
            model_name='contact',
            name='title',
            field=models.CharField(blank=True, max_length=200, null=True),
        ),
    ]


text:
package m3.wikipedia.analysis.charts;

import java.awt.BasicStroke;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Paint;
import java.awt.Stroke;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.geom.Point2D;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JSlider;
import javax.swing.JToggleButton;
import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

import org.apache.commons.collections15.Factory;
import org.apache.commons.collections15.Transformer;
import org.apache.commons.collections15.functors.ConstantTransformer;
import org.apache.commons.collections15.functors.MapTransformer;
import org.apache.commons.collections15.map.LazyMap;

import edu.uci.ics.jung.algorithms.cluster.EdgeBetweennessClusterer;
import edu.uci.ics.jung.algorithms.layout.AggregateLayout;
import edu.uci.ics.jung.algorithms.layout.BalloonLayout;
import edu.uci.ics.jung.algorithms.layout.CircleLayout;
import edu.uci.ics.jung.algorithms.layout.FRLayout;
import edu.uci.ics.jung.algorithms.layout.KKLayout;
import edu.uci.ics.jung.algorithms.layout.Layout;
import edu.uci.ics.jung.algorithms.layout.TreeLayout;
import edu.uci.ics.jung.algorithms.layout.util.Relaxer;
import edu.uci.ics.jung.graph.Forest;
import edu.uci.ics.jung.graph.Graph;
import edu.uci.ics.jung.graph.SparseMultigraph;
import edu.uci.ics.jung.graph.UndirectedGraph;
import edu.uci.ics.jung.graph.UndirectedSparseMultigraph;
import edu.uci.ics.jung.graph.util.TestGraphs;
import edu.uci.ics.jung.io.PajekNetReader;
import edu.uci.ics.jung.visualization.GraphZoomScrollPane;
import edu.uci.ics.jung.visualization.VisualizationViewer;
import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.TreeSet;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import m3.wikipedia.explorer.data.WikiNode;

/**
 * This simple app demonstrates how one can use our algorithms and visualization
 * libraries in unison. In this case, we generate use the Zachary karate club
 * data set, widely known in the social networks literature, then we cluster the
 * vertices using an edge-betweenness clusterer, and finally we visualize the
 * graph using Fruchtermain-Rheingold layout and provide a slider so that the
 * user can adjust the clustering granularity.
 *
 * @author Scott White
 */
@SuppressWarnings("serial")
public class WikiCorpusClusteringView extends JApplet {

    VisualizationViewer<Number, Number> vv;
//	Factory<Graph<Number,Number>> graphFactory;
    Map<Number, Paint> vertexPaints =
            LazyMap.<Number, Paint>decorate(new HashMap<Number, Paint>(),
            new ConstantTransformer(Color.white));
    Map<Number, Paint> edgePaints =
            LazyMap.<Number, Paint>decorate(new HashMap<Number, Paint>(),
            new ConstantTransformer(Color.blue));
    public final Color[] similarColors = {
        new Color(216, 134, 134),
        new Color(135, 137, 211),
        new Color(134, 206, 189),
        new Color(206, 176, 134),
        new Color(194, 204, 134),
        new Color(145, 214, 134),
        new Color(133, 178, 209),
        new Color(103, 148, 255),
        new Color(60, 220, 220),
        new Color(30, 250, 100)
    };

    public void open(HashMap<String, String> _iwlinks,
            String[] _links,
            String[] _catMembs,
            JPanel jpNETWORK,
            String[] a) throws IOException {

        centerPage = new WikiNode(a);
        links = _links;
        iwlinks = _iwlinks;
        catMembs = _catMembs;

        mode = 2;
        jpNETWORK.add(this, BorderLayout.CENTER);

        start();
        // Add a restart button so the graph can be redrawn to fit the size of the frame

    }
    static HashMap<String, String> iwlinks;
    static String[] links;
    static String[] catMembs;

    public static void main(String[] args) throws IOException {

        WikiCorpusClusteringView cd = new WikiCorpusClusteringView();
        cd.start();
        // Add a restart button so the graph can be redrawn to fit the size of the frame
        JFrame jf = new JFrame();
        jf.getContentPane().add(cd);

        jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        jf.pack();
        jf.setVisible(true);
    }
    int mode = 1;

    public void start() {

        Graph<Number, Number> graph = null;

        switch (mode) {
            case 1:
                graph = loadDemoGraph();
                break;
            case 2:
                graph = loadWikiGraph();
                break;
        }

        try {

            setUpView(graph);
        } catch (IOException ex) {
            ex.printStackTrace();
            Logger.getLogger(WikiCorpusClusteringView.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    public Graph loadDemoGraph() {

        InputStream is = this.getClass().getClassLoader().getResourceAsStream("datasets/zachary.net");
        BufferedReader br = new BufferedReader(new InputStreamReader(is));

        final Graph<Number, Number> graph = new SparseMultigraph<Number, Number>();

        try {

            Factory<Number> vertexFactory = new Factory<Number>() {
                int n = 0;

                public Number create() {
                    return n++;
                }
            };
            Factory<Number> edgeFactory = new Factory<Number>() {
                int n = 0;

                public Number create() {
                    return n++;
                }
            };

            PajekNetReader<Graph<Number, Number>, Number, Number> pnr =
                    new PajekNetReader<Graph<Number, Number>, Number, Number>(vertexFactory, edgeFactory);

            pnr.load(br, graph);

        } catch (IOException e) {
            System.out.println("Error in loading graph");
            e.printStackTrace();
        }

        return graph;
    }

    /**
     *
     * @param br
     * @throws IOException
     */
    private void setUpView(Graph graph) throws IOException {

        //Create a simple layout frame
        //specify the Fruchterman-Rheingold layout algorithm
//        final AggregateLayout<Number, Number> layout =
//                new AggregateLayout<Number, Number>(new FRLayout<Number, Number>(graph));

        //layout = new TreeLayout<String,Integer>(graph);
        Layout<Number,Number> layout = new KKLayout<Number,Number>(graph);
        layout.setSize(new Dimension(900,900));

        vv = new VisualizationViewer<Number, Number>(layout);
        vv.setBackground(Color.white);
        //Tell the renderer to use our own customized color rendering
        vv.getRenderContext().setVertexFillPaintTransformer(MapTransformer.<Number, Paint>getInstance(vertexPaints));
        vv.getRenderContext().setVertexDrawPaintTransformer(new Transformer<Number, Paint>() {
            public Paint transform(Number v) {
                if (vv.getPickedVertexState().isPicked(v)) {
                    return Color.cyan;
                } else {
                    return Color.BLACK;
                }
            }
        });

        vv.getRenderContext().setEdgeDrawPaintTransformer(MapTransformer.<Number, Paint>getInstance(edgePaints));

        vv.getRenderContext().setEdgeStrokeTransformer(new Transformer<Number, Stroke>() {
            protected final Stroke THIN = new BasicStroke(1);
            protected final Stroke THICK = new BasicStroke(2);

            public Stroke transform(Number e) {
                Paint c = edgePaints.get(e);
                if (c == Color.LIGHT_GRAY) {
                    return THIN;
                } else {
                    return THICK;
                }
            }
        });

        //add restart button
        JButton scramble = new JButton("Restart");
        scramble.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                Layout layout = vv.getGraphLayout();
                layout.initialize();
                Relaxer relaxer = vv.getModel().getRelaxer();
                if (relaxer != null) {
                    relaxer.stop();
                    relaxer.prerelax();
                    relaxer.relax();
                }
            }
        });

        DefaultModalGraphMouse gm = new DefaultModalGraphMouse();
        vv.setGraphMouse(gm);

        final JToggleButton groupVertices = new JToggleButton("Group Clusters");

        //Create slider to adjust the number of edges to remove when clustering
        final JSlider edgeBetweennessSlider = new JSlider(JSlider.HORIZONTAL);
        edgeBetweennessSlider.setBackground(Color.WHITE);
        edgeBetweennessSlider.setPreferredSize(new Dimension(210, 50));
        edgeBetweennessSlider.setPaintTicks(true);
        edgeBetweennessSlider.setMaximum(graph.getEdgeCount());
        edgeBetweennessSlider.setMinimum(0);
        edgeBetweennessSlider.setValue(0);
        edgeBetweennessSlider.setMajorTickSpacing(10);
        edgeBetweennessSlider.setPaintLabels(true);
        edgeBetweennessSlider.setPaintTicks(true);

//		edgeBetweennessSlider.setBorder(BorderFactory.createLineBorder(Color.black));
        //TO DO: edgeBetweennessSlider.add(new JLabel("Node Size (PageRank With Priors):"));
        //I also want the slider value to appear
        final JPanel eastControls = new JPanel();
        eastControls.setOpaque(true);
        eastControls.setLayout(new BoxLayout(eastControls, BoxLayout.Y_AXIS));
        eastControls.add(Box.createVerticalGlue());
        eastControls.add(edgeBetweennessSlider);

        final String COMMANDSTRING = "Edges removed for clusters: ";
        final String eastSize = COMMANDSTRING + edgeBetweennessSlider.getValue();

        final TitledBorder sliderBorder = BorderFactory.createTitledBorder(eastSize);
        eastControls.setBorder(sliderBorder);
        //eastControls.add(eastSize);
        eastControls.add(Box.createVerticalGlue());

        groupVertices.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {

                //clusterAndRecolor(layout, edgeBetweennessSlider.getValue(),
                //        similarColors, e.getStateChange() == ItemEvent.SELECTED);
                vv.repaint();
            }
        });

        //clusterAndRecolor(layout, 0, similarColors, groupVertices.isSelected());

        edgeBetweennessSlider.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent e) {
                JSlider source = (JSlider) e.getSource();
                if (!source.getValueIsAdjusting()) {
                    int numEdgesToRemove = source.getValue();
                    //clusterAndRecolor(layout, numEdgesToRemove, similarColors,
                    //        groupVertices.isSelected());
                    sliderBorder.setTitle(
                            COMMANDSTRING + edgeBetweennessSlider.getValue());
                    eastControls.repaint();
                    vv.validate();
                    vv.repaint();
                }
            }
        });

        Container content = getContentPane();
        content.add(new GraphZoomScrollPane(vv));
        JPanel south = new JPanel();
        JPanel grid = new JPanel(new GridLayout(2, 1));
        grid.add(scramble);
        grid.add(groupVertices);
        south.add(grid);
        south.add(eastControls);
        JPanel p = new JPanel();
        p.setBorder(BorderFactory.createTitledBorder("Mouse Mode"));
        p.add(gm.getModeComboBox());
        south.add(p);
        content.add(south, BorderLayout.SOUTH);
    }

    public void clusterAndRecolor(AggregateLayout<Number, Number> layout,
            int numEdgesToRemove,
            Color[] colors, boolean groupClusters) {
        //Now cluster the vertices by removing the top 50 edges with highest betweenness
        //		if (numEdgesToRemove == 0) {
        //			colorCluster( g.getVertices(), colors[0] );
        //		} else {

//        Graph<Number, Number> g = layout.getGraph();
//        layout.removeAll();
//
//        EdgeBetweennessClusterer<Number, Number> clusterer =
//                new EdgeBetweennessClusterer<Number, Number>(numEdgesToRemove);
//        Set<Set<Number>> clusterSet = clusterer.transform(g);
//        List<Number> edges = clusterer.getEdgesRemoved();
//
//        int i = 0;
//        //Set the colors of each node so that each cluster's vertices have the same color
//        for (Iterator<Set<Number>> cIt = clusterSet.iterator(); cIt.hasNext();) {
//
//            Set<Number> vertices = cIt.next();
//            Color c = colors[i % colors.length];
//
//            colorCluster(vertices, c);
//            if (groupClusters == true) {
//                groupCluster(layout, vertices);
//            }
//            i++;
//        }
//        for (Number e : g.getEdges()) {
//
//            if (edges.contains(e)) {
//                edgePaints.put(e, Color.lightGray);
//            } else {
//                edgePaints.put(e, Color.black);
//            }
//        }

    }

    private void colorCluster(Set<Number> vertices, Color c) {
        for (Number v : vertices) {
            vertexPaints.put(v, c);
        }
    }

    private void groupCluster(AggregateLayout<Number, Number> layout, Set<Number> vertices) {
        if (vertices.size() < layout.getGraph().getVertexCount()) {
            Point2D center = layout.transform(vertices.iterator().next());
            Graph<Number, Number> subGraph = SparseMultigraph.<Number, Number>getFactory().create();
            for (Number v : vertices) {
                subGraph.addVertex(v);
            }
            Layout<Number, Number> subLayout =
                    new CircleLayout<Number, Number>(subGraph);
            subLayout.setInitializer(vv.getGraphLayout());
            subLayout.setSize(new Dimension(40, 40));

            layout.put(subLayout, center);
            vv.repaint();
        }
    }

    private Graph<Number, Number> loadWikiGraph() {
        Graph<Number, Number> graph = getGraph();
        return graph;
    }

    WikiNode centerPage = null;
    Hashtable<Integer, WikiNode> linksHASH = new Hashtable<Integer, WikiNode>();
    Hashtable<WikiNode, Integer> linksHASH_INV = new Hashtable<WikiNode, Integer>();

    public Graph<Number, Number> getGraph() {

        UndirectedGraph<Number, Number> g1 = new UndirectedSparseMultigraph<Number, Number>();

        // KERN
        TreeSet<Number> s0 = new TreeSet<Number>();
        s0.add(0);
        colorCluster(s0, Color.BLACK);
        linksHASH.put(0, centerPage);
        g1.addVertex(0);

        int i = 1;

        // add direct linked pages
        TreeSet<Number> s1 = new TreeSet<Number>();
        for (String l : links) {

            WikiNode n = new WikiNode(centerPage.wiki, l);
            linksHASH.put(i, n);
            linksHASH_INV.put(n, i);

            s0.add(0);

            g1.addEdge(i, 0, i);
            g1.addVertex(i);
            i++;
        }
        colorCluster(s1, Color.BLUE);

        // add IWL-Pages
        TreeSet<Number> s2 = new TreeSet<Number>();
        for (String key : iwlinks.keySet()) {
            String value = iwlinks.get(key);
            System.out.println("val=" + key + "_" + value);
            WikiNode n = new WikiNode(key, value);
            linksHASH.put(i, n);
            linksHASH_INV.put(n, i);
            s2.add(i);
            g1.addVertex(i);
            if (!linksHASH_INV.containsKey(value)) {
                g1.addEdge(i, 0, i);
            }
            i++;
        }
        colorCluster(s2, Color.RED);

        // add Categorie Members
        TreeSet<Number> s3 = new TreeSet<Number>();
        for (String l : catMembs) {

            WikiNode n = new WikiNode(centerPage.wiki, l);

            g1.addVertex(i);
            if (linksHASH_INV.containsKey(l)) {
                g1.addEdge(i, 0, i);
                linksHASH.put(i, n);
            }
            i++;
            s3.add(i);
        }
        colorCluster(s3, Color.GREEN);

        return g1;
    }
}
class Link {

    double str = 0;
    int src = 0;
    int dest = 0;
}


text:
package org.apache.vxquery.xtest;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import org.apache.vxquery.xtest.TestCaseResult.State;

public class HTMLFileReporterImpl implements ResultReporter {
    private List<TestCaseResult> results;

    private int count;

    private int userErrors;

    private int internalErrors;

    private Map<Class<?>, Integer> exDistribution;

    private Map<TestCaseResult.State, Integer> stDistribution;

    private long startTime;

    private long endTime;

    private PrintWriter out;

    private File reportFile;

    public HTMLFileReporterImpl(File file) {
        results = new ArrayList<>();
        count = 0;
        userErrors = 0;
        internalErrors = 0;
        startTime = -1;
        exDistribution = new HashMap<>();
        stDistribution = new HashMap<>();
        reportFile = file;
    }

    @Override
    public void reportResult(TestCaseResult result) {
        results.add(result);
        endTime = System.currentTimeMillis();
        if (startTime < 0) {
            startTime = endTime;
        }
        if (result.error()) {
            if (result.userError()) {
                ++userErrors;
            } else {
                ++internalErrors;
                Integer internalCount = exDistribution.get(result.error.getClass());
                if (internalCount == null) {
                    internalCount = 0;
                }
                internalCount++;
                exDistribution.put(result.error.getClass(), internalCount);
            }
        }
        Integer stCount = stDistribution.get(result.state);
        if (stCount == null) {
            stCount = 0;
        }
        stCount++;
        stDistribution.put(result.state, stCount);
        ++count;
    }

    @Override
    public void close() {
        if (reportFile != null) {
            try {
                out = new PrintWriter(reportFile);
                writeHTML(out, createResultDir(reportFile));
                out.flush();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    private static File createResultDir(File file) {
        String fileName = file.getName();
        int dot = file.getName().lastIndexOf('.');
        String resultDirName = (dot < 0 ? fileName : fileName.substring(0, dot)) + "_results";
        return file.getParent() != null ? new File(file.getParent() + File.separator + resultDirName)
                : new File(resultDirName);
    }

    public void writeHTML(PrintWriter out) {
        writeHTML(out, null);
    }

    public void writeHTML(PrintWriter out, File resultDir) {
        long start = System.currentTimeMillis();
        out.println("");
        writeSummary(out, count, userErrors, internalErrors, startTime, endTime);
        out.println("<hl>");
        writeStateDistribution(out, stDistribution);
        out.println("<hl>");
        writeExceptionDistribution(out, exDistribution);
        out.println("<hl>");
        writeResults(out, resultDir, results);
        out.println("");
        System.err.println("HTML generation time: " + (System.currentTimeMillis() - start));
    }

    private static void writeSummary(PrintWriter out, int count, int userErrors, int internalErrors, long startTime,
            long endTime) {
        out.println("
");
        out.println("
Test Count	");
        out.println(count);
        out.println("
");
        out.println("
Test Errors	");
        out.println(userErrors);
        out.println("
");
        out.println("
Test Failures	");
        out.println(internalErrors);
        out.println("
");
        out.println("
Total time	");
        out.println(endTime - startTime);
        out.println("
");
        out.println("
");
    }

    private static void writeExceptionDistribution(PrintWriter out, Map<Class<?>, Integer> exDistribution) {
        out.println("
");
        List<Entry<Class<?>, Integer>> entryList = new ArrayList<>(exDistribution.entrySet());
        Comparator<Entry<Class<?>, Integer>> comp = new Comparator<Entry<Class<?>, Integer>>() {
            public int compare(Entry<Class<?>, Integer> o1, Entry<Class<?>, Integer> o2) {
                return o1.getKey().getName().compareTo(o2.getKey().getName());
            }
        };
        Collections.sort(entryList, comp);
        for (Map.Entry<Class<?>, Integer> e : entryList) {
            out.println("
");
            out.println(e.getKey().getName());
            out.println("	");
            out.println(e.getValue());
            out.println("
");
        }
        out.println("
");
    }

    private static void writeStateDistribution(PrintWriter out, Map<TestCaseResult.State, Integer> stDistribution) {
        out.println("
");
        List<Map.Entry<TestCaseResult.State, Integer>> entryList = new ArrayList<>(stDistribution.entrySet());
        Comparator<Map.Entry<TestCaseResult.State, Integer>> comp = new Comparator<Map.Entry<TestCaseResult.State, Integer>>() {
            public int compare(Map.Entry<TestCaseResult.State, Integer> o1,
                    Map.Entry<TestCaseResult.State, Integer> o2) {
                return o1.getKey().compareTo(o2.getKey());
            }
        };
        Collections.sort(entryList, comp);
        for (Map.Entry<TestCaseResult.State, Integer> e : entryList) {
            State key = e.getKey();
            out.print("
");
            out.println(key);
            out.println("	");
            out.println(e.getValue());
            out.println("
");
        }
        out.println("
");
    }

    private static void writeResults(PrintWriter out, File resultDir, List<TestCaseResult> results) {
        ResultManager rfw = new ResultManager(resultDir);
        out.println("
");
        int len = results.size();
        for (int i = 0; i < len; ++i) {
            TestCaseResult res = results.get(i);
            out.print("
");
            out.print(i + 1);
            out.print("	");
            String queryDisplayName = res.testCase.getXQueryDisplayName();
            out.print(queryDisplayName);
            out.print("	");
            out.print(res.time);
            out.print("	");
            String uri = rfw.writeResult(res, queryDisplayName);
            if (uri != null) {
                out.print("");
                out.print(res.report);
                out.print("");
            } else {
                out.print(res.report);
            }
            out.println("
");
        }
        out.println("
");
        rfw.close();
    }

}

/**
 * writes results into several HTML files of manageable size
 */
class ResultManager {

    /**
     * if the length of a file passes this length, a new file will be used
     * for the next result
     */
    private static final long MAX_LEN = 1000000;

    private final File dir;

    private File curFile;
    private URI curURI;
    private FileWriter curFileWriter;
    private PrintWriter curPrintWriter;

    ResultManager(File dir) {
        this.dir = dir;
    }

    /**
     * writes an HTML serialization of a test result into a temp HTML file
     * inside the given directory
     *
     * @param res
     *            the result data for 1 test case
     * @param linkName
     *            the name of the (internal) HTML link that points to
     *            the test result inside the HTML file
     * @return the full URI that references the test result in the HTML file
     */
    String writeResult(TestCaseResult res, String linkName) {
        if (dir == null) {
            return null;
        }
        try {
            if (curFile == null || curFile.length() > MAX_LEN) {
                if (curFile != null) {
                    writeDocFooter(curPrintWriter);
                    curPrintWriter.flush();
                    curFileWriter.close();
                } else {
                    ensureDir(dir);
                }
                curFile = File.createTempFile("res", ".html", dir);
                curFileWriter = new FileWriter(curFile);
                curPrintWriter = new PrintWriter(new BufferedWriter(curFileWriter));
                curURI = curFile.toURI();
                writeDocHeader(curPrintWriter);
            }
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }

        curPrintWriter.println("   ");
        curPrintWriter.println(linkName);
        curPrintWriter.println("
");
        if (res.result != null) {
            curPrintWriter.println(escape(res.result));
        } else {
            res.error.printStackTrace(curPrintWriter);
        }
        curPrintWriter.println("
");
        return curURI + "#" + linkName;
    }

    void close() {
        try {
            if (curFile != null) {
                writeDocFooter(curPrintWriter);
                curPrintWriter.flush();
                curFileWriter.close();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private static void ensureDir(File dir) throws IOException {
        if (!dir.isDirectory() && !dir.mkdirs()) {
            throw new IOException("could not create dir " + dir);
        }
    }

    private static void writeDocHeader(PrintWriter resOut) {
        resOut.println("<title>results</title>");
        resOut.println("");
    }

    private static void writeDocFooter(PrintWriter resOut) {
        resOut.println("");
    }

    /* this should not be necessary anymore, when the XQuery serialization
     * works right
     */
    private static String escape(String s) {
        final char[] ca = s.toCharArray();
        final int l = ca.length;
        int start = 0;
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < l; ++i) {
            switch (ca[i]) {
                case '<':
                    sb.append(ca, start, i - start);
                    sb.append("<");
                    start = i + 1;
                    break;
                case '>':
                    sb.append(ca, start, i - start);
                    sb.append(">");
                    start = i + 1;
                    break;
                case '&':
                    sb.append(ca, start, i - start);
                    sb.append("&");
                    start = i + 1;
                    break;
            }
        }
        return start > 0 ? sb.toString() : s;
    }

}


text:
package agent

import (
	"container/heap"
	"github.com/infradash/dash/pkg/dash"
	"github.com/qorio/maestro/pkg/docker"
	"strconv"
	"strings"
)

type VersionComparator func(imageA, imageB string) bool

func CompareImages(imageA, imageB string) bool {
	repoA, tagA, err := dash.ParseDockerImage(imageA)
	if err != nil {
		return false
	}
	repoB, tagB, err := dash.ParseDockerImage(imageB)
	if err != nil {
		return false
	}

	if repoA != repoB {
		return false
	}

	sep := func(c rune) bool { return c == '.' || c == ',' || c == '-' }
	min := func(a, b int) int {
		if a < b {
			return a
		} else {
			return b
		}
	}

	// compare the tags... we tokenize the tags by delimiters such as . and -
	fieldsA := strings.FieldsFunc(tagA, sep)
	fieldsB := strings.FieldsFunc(tagB, sep)
	for i := 0; i < min(len(fieldsA), len(fieldsB)); i++ {
		a, erra := strconv.Atoi(fieldsA[i])
		b, errb := strconv.Atoi(fieldsB[i])
		switch {
		case erra != nil && errb != nil:
			if fieldsA[i] == fieldsB[i] {
				continue
			} else {
				return fieldsA[i] < fieldsB[i]
			}
		case erra == nil && errb == nil:
			if a == b {
				continue
			} else {
				return a < b
			}
		case erra != nil || errb != nil:
			return false
		}
	}
	return false
}

// Min-heap of container groups prioritized by the version
type MinVersionHeap []*ContainerGroup

func (h MinVersionHeap) Len() int { return len(h) }
func (h MinVersionHeap) Less(i, j int) bool {
	return CompareImages(h[i].Image, h[j].Image)
}
func (h MinVersionHeap) Swap(i, j int) { h[i], h[j] = h[j], h[i] }
func (h *MinVersionHeap) Push(x interface{}) {
	// Push and Pop use pointer receivers because they modify the slice's length,
	// not just its contents.
	*h = append(*h, x.(*ContainerGroup))
}
func (h *MinVersionHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

func (ch *MinVersionHeap) GetFsm(c *docker.Container) *dash.Fsm {
	for _, cg := range *ch {
		if cg.Image == c.Image {
			return cg.GetFsm(c)
		}
	}
	// container's image doesn't match any known. create new
	cg := NewContainerGroup(c.Image)
	heap.Push(ch, cg)
	return cg.GetFsm(c)
}

func (ch *MinVersionHeap) RemoveFsm(c *docker.Container) {
	for i, cg := range *ch {
		if cg.Image == c.Image {
			cg.RemoveFsm(c)
			if cg.Empty() {
				heap.Remove(ch, i)
				return // iteration now invalid
			}
			return
		}
	}
}

func (ch *MinVersionHeap) Visit(visit func(*ContainerGroup)) {
	if visit == nil {
		return
	}
	for _, cg := range *ch {
		visit(cg)
	}
}

func (ch *MinVersionHeap) Instances(image string) []*dash.Fsm {
	for _, cg := range *ch {
		if cg.Image == image {
			return cg.Instances()
		}
	}
	return []*dash.Fsm{}
}


text:
package com.dmdirc.addons.ui_swing.components;

import java.awt.Dimension;
import java.awt.Insets;

import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JToggleButton;

/**
 * Image toggle button.
 */
public class ImageToggleButton extends JToggleButton {

    /** A version number for this class. */
    private static final long serialVersionUID = 2;

    /**
     * Creates a new instance of ImageToggleButton.
     *
     * @param actionCommand Action command for the button
     * @param icon          Normal icon for the button
     */
    public ImageToggleButton(final String actionCommand, final Icon icon) {
        this(actionCommand, icon, icon);
    }

    /**
     * Creates a new instance of ImageToggleButton.
     *
     * @param actionCommand Action command for the button
     * @param icon          Normal icon for the button
     * @param rolloverIcon  Rollover icon for the button
     */
    public ImageToggleButton(final String actionCommand, final Icon icon,
            final Icon rolloverIcon) {
        this(actionCommand, icon, rolloverIcon, rolloverIcon);
    }

    /**
     * Creates a new instance of ImageToggleButton.
     *
     * @param actionCommand Action command for the button
     * @param icon          Normal icon for the button
     * @param rolloverIcon  Rollover icon for the button
     * @param pressedIcon   Pressed icon for the button
     */
    public ImageToggleButton(final String actionCommand, final Icon icon,
            final Icon rolloverIcon, final Icon pressedIcon) {

        setIcon(icon);
        setRolloverIcon(rolloverIcon);
        setPressedIcon(pressedIcon);
        setSelectedIcon(pressedIcon);
        setContentAreaFilled(false);
        setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
        setMargin(new Insets(0, 0, 0, 0));
        setPreferredSize(new Dimension(16, 0));
        setActionCommand(actionCommand);
    }

    /**
     * Sets all the image buttons icons.
     *
     * @param icon New icon
     */
    public void setIcons(final Icon icon) {
        setIcon(icon);
        setRolloverIcon(icon);
        setPressedIcon(icon);
    }

}


text:
Deploy and rebuild/reload scripts for Histograph

## Usage
### Shell scripts for rebuilding and reloading
With an already running server, it is possible to rebuild the components and refresh the data.
To rebuild everyting:
```
./histograph-rebuild.sh
```
To reload all source data and rebuild indexes and storage (this will take a while, depending on your hardware)
```
./histograph-reload.sh
```

To refresh the indexes and graph:
```
./histograph-refresh.sh
```

### Debian/Ubuntu, possibly many other linux or even posix (Mac?)
Install docker through the main repository
```
apt-get install docker
```
Set up SSH key for Github, if you haven't already. This is necessary to be able to clone the private data repository
```
ssh-keygen -t rsa -C "your_email@example.com"
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_rsa
clip < ~/.ssh/id_rsa.pub
```
Then paste the clipboard contents in github under [https://github.com/settings/ssh] as a new key.
Clone this repository, change to the cloned directory and start using:
```
git clone https://github.com/histograph/deploy
cd deploy
docker build .
```
### Windows
Unfortunately, Docker needs a virtual machine to run in, which complicates matters somewhat.
- Install Docker for Windows using the instructions on [https://docs.docker.com/installation/windows/].
- Install Putty for Windows using the instructions on http://git-scm.com/download/win

Open putty and log into the virtual machine using the following settings:
- hostname: localhost
- port: 2022
Open the connection and provide the following credentials:
- user: docker
- pass: tcuser

Then set up the SSH key for Github. This is necessary to be able to clone the private data repository. In putty, type the following (make sure to insert your own mail adress). Make sure NOT to provide a passphrase, otherwise the procedure will fail.
```
ssh-keygen -t rsa -C "your_email@example.com"
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub
```
Then paste the clipboard contents, starting from "ssh-rsa" and including the email address at the end, past it in github under [https://github.com/settings/ssh] as a new key. Check the correct workings of this all with:
```
ssh -T git@github.com
```
and enter yes when asked to add the fingerprint.

Then, the installation can start!
Clone this repository, change to the cloned directory and start using:
```
git clone https://github.com/histograph/deploy
cd deploy
docker build .
```

Copyright (C) 2015 [Waag Society](http://waag.org).


text:
package org.bigtesting.fixd.interpolation;

import java.util.HashMap;
import java.util.Map;

import org.bigtesting.fixd.request.HttpRequest;
import org.bigtesting.interpolatd.Interpolator;
import org.bigtesting.interpolatd.Substitutor;

/**
 *
 * @author Luis Antunes
 */
public class ResponseBodyInterpolator {

    private static final Interpolator<HttpRequest> interpolator = new Interpolator<HttpRequest>();

    private static final Map<String, RequestValueProvider<?>> requestValueProviders =
            new HashMap<String, RequestValueProvider<?>>();

    static {
        requestValueProviders.put("request.body", new RequestBodyValueProvider());
        requestValueProviders.put("request.method", new RequestMethodValueProvider());
        requestValueProviders.put("request.time", new RequestTimeValueProvider());
        requestValueProviders.put("request.path", new RequestPathValueProvider());
        requestValueProviders.put("request.query", new RequestQueryValueProvider());
        requestValueProviders.put("request.major", new RequestMajorValueProvider());
        requestValueProviders.put("request.minor", new RequestMinorValueProvider());
        requestValueProviders.put("request.target", new RequestTargetValueProvider());

        interpolator.when("[a-zA-Z0-9_]+").prefixedBy(":")
            .handleWith(new Substitutor<HttpRequest>() {
                public String substitute(String captured, HttpRequest req) {

                    String path = req.getUndecodedPath();
                    return req.getRoute().getNamedParameter(captured, path);
                }
            });

        interpolator.when("[0-9]+").enclosedBy("*[").and("]")
            .handleWith(new Substitutor<HttpRequest>() {
                public String substitute(String captured, HttpRequest req) {

                    String path = req.getUndecodedPath();
                    int index = Integer.parseInt(captured);
                    return req.getRoute().getSplatParameter(index, path);
                }
            });

        interpolator.when().enclosedBy("{").and("}")
            .handleWith(new Substitutor<HttpRequest>() {
                public String substitute(String captured, HttpRequest req) {

                    if (req.getSession() != null) {
                        Object val = req.getSession().get(captured);
                        if (val != null) {
                            return val.toString();
                        }
                    }
                    return null;
                }
            });

        interpolator.when().enclosedBy("[").and("]")
            .handleWith(new Substitutor<HttpRequest>() {
                public String substitute(String captured, HttpRequest req) {

                    if (captured.startsWith("request?")) {
                        return req.getRequestParameter(captured.replaceFirst("request\\?", ""));
                    }

                    if (captured.startsWith("request$")) {
                        return req.getHeaderValue(captured.replaceFirst("request\\$", ""));
                    }

                    RequestValueProvider<?> requestValueProvider = requestValueProviders.get(captured);
                    if (requestValueProvider != null) {
                        Object val = requestValueProvider.getValue(req);
                        if (val != null) {
                            return val.toString();
                        }
                    }
                    return null;
                }
            });

        interpolator.escapeWith("^");
    }

    public static String interpolate(String body, HttpRequest request) {

        return interpolator.interpolate(body, request);
    }
}


text:
import Datastore = require('@google-cloud/datastore');
import {
    DatastoreDouble,
    DatastoreGeopoint,
    DatastoreInt,
    DatastoreKey,
    DatastoreKeyPath
} from '@google-cloud/datastore/entity';
import { Query, QueryCallback, QueryInfo, QueryOptions, QueryResult } from '@google-cloud/datastore/query';
import { AllocateIdsResult, CommitCallback, CommitResponse, CommitResult } from '@google-cloud/datastore/request';
import { DatastoreTransaction, TransactionResult } from '@google-cloud/datastore/transaction';

interface TestEntity {
    name?: string;
    location?: string;
    symbol?: string;

    [keySymbol: string]: any;
}

const kind = 'Company';
const entityToCreate: TestEntity = {
    name: 'Google',
    location: 'CA'
};

const ds: Datastore = new Datastore({
                                        apiEndpoint: 'http://localhost:8081',
                                        namespace: 'project-namespace',
                                        projectId: 'project-id',
                                        keyFilename: '../secret.json',
                                        credentials: {}
                                    });
ds.determineBaseUrl_('http://localhost:8081');

// Keys components creation:
const dsInt: DatastoreInt = ds.int(42);
const dsDouble: DatastoreDouble = ds.double('3.14');
const dsGeopoint: DatastoreGeopoint = ds.geoPoint({latitude: 0, longitude: 0});

// Keys creation:
const keyPath: DatastoreKeyPath = [kind, 'Google', 'Department', dsInt];
const key: DatastoreKey = ds.key(keyPath);
const ancestorKey: DatastoreKey = ds.key(['ParentCompany', 'Alphabet']);
const keyWithOptions: DatastoreKey = ds.key({
                                                namespace: 'special-namespace',
                                                path: keyPath
                                            });
const incompleteKey = ds.key([kind]);

// ID allocation:
ds.allocateIds(incompleteKey, 1, (err: Error, keys: DatastoreKey[]) => {
});
const allocationPromise: Promise<AllocateIdsResult> = ds.allocateIds(incompleteKey, 1);

// Query creation:
const manuallyCreatedQuery = new Datastore.Query('scope', kind, 'namespace');
const options: QueryOptions = {consistency: 'strong'};
const query: Query = ds.createQuery(kind);
const complexQuery = ds.createQuery('special_namespace', kind)
                       .hasAncestor(ancestorKey)
                       .filter('aProp', '<', 0)
                       .filter('location', dsGeopoint)
                       .order('location', {descending: true})
                       .select(['1', '2'])
                       .groupBy(['group', 'props'])
                       .limit(1000)
                       .offset(10);

// Running queries:
const queryCallback: QueryCallback = (err: Error, entities: TestEntity[]) => entities[0][Datastore.KEY];

ds.runQuery(query, queryCallback);
ds.runQuery(query, options, queryCallback);
ds.runQuery(query, options);

const queryStream: NodeJS.ReadableStream = complexQuery.runStream();
const dsQueryStream: NodeJS.ReadableStream = ds.runQueryStream(complexQuery, options);
complexQuery.run()
            .then((data: QueryResult) => {
                const {moreResults, endCursor} = data[1];
                const frontEndResponse: any = {};
                switch (moreResults) {
                case Datastore.NO_MORE_RESULTS:
                    frontEndResponse.nextPageCursor = null;
                    break;
                case Datastore.MORE_RESULTS_AFTER_CURSOR:
                case Datastore.MORE_RESULTS_AFTER_LIMIT:
                    frontEndResponse.nextPageCursor = endCursor;
                }
            });

query.run((err: Error, entities: TestEntity[], info: QueryInfo) => {
    if (err) {
        return;
    }
    const {moreResults, endCursor} = info;

    const frontEndResponse: any = {entities};
    switch (moreResults) {
    case ds.NO_MORE_RESULTS:
        frontEndResponse.nextPageCursor = null;
        break;
    case ds.MORE_RESULTS_AFTER_CURSOR:
    case ds.MORE_RESULTS_AFTER_LIMIT:
        frontEndResponse.nextPageCursor = endCursor;
    }
});

// Saving an entity:
const saveCallback: CommitCallback = (err: Error, response: CommitResponse) => undefined;

ds.insert(entityToCreate, saveCallback);
ds.save(entityToCreate, saveCallback);
ds.update(entityToCreate, saveCallback);
ds.upsert(entityToCreate, saveCallback);

const insertPromise: Promise<CommitResult> = ds.insert(entityToCreate);
const savePromise: Promise<CommitResult> = ds.save(entityToCreate);
const updatePromise: Promise<CommitResult> = ds.update(entityToCreate);
const upsertPromise: Promise<CommitResult> = ds.upsert(entityToCreate);

// Getting entities:
ds.get(key, (err, entity) => {
});
ds.get(key).then((data: [TestEntity]) => data[0]);
ds.get(key, {maxApiCalls: 1})
  .then((data: [TestEntity]) => {
      const blah: TestEntity = data[0];
  });
ds.get([key, key], {maxApiCalls: 1})
  .then((data: [TestEntity[]]) => {
      const blah: TestEntity[] = data[0];
  });
ds.get(key, (err: Error, data: any[]) => data[0]);

// We can verify the data was saved by using {module:datastore#get}.
ds.get(
    key,
    (err, entity) => {
    }
);

// Deleting entities:
ds.delete(key, err => {
    if (!err) {
        // Record deleted successfully.
    }
});

// Running in transactions:
const transaction: DatastoreTransaction = ds.transaction();
const manuallyCreatedTx = new Datastore.Transaction(ds);

transaction.run((err, activeTx: DatastoreTransaction) => {
    transaction.get(key, (err: Error, entity: TestEntity) => {
        if (err) {
            transaction.rollback(err => {
            });
        }

        const queryInTx: Query = activeTx.createQuery(kind);
        const namespacedQueryInTx: Query = activeTx.createQuery('special-namespace', kind);

        transaction.save(entity);
        transaction.commit(err => {
        });
    });
});

const promisedTxStart: Promise<TransactionResult> = ds.transaction().run();

promisedTxStart.then((result: TransactionResult) => {
    const activeTx: DatastoreTransaction = result[0];
    const rollbackPromise: Promise<{}> = activeTx.rollback();
    return activeTx.commit();
});

class MyCustomDatastoreRequest extends Datastore.DatastoreRequest {
    constructor() {
        super();
    }
}


text:
.gform_wrapper .top_label li.gfield.gf_inline {
    vertical-align: top;
    width: auto !important;
    margin-right: 0.875em;
    float: none !important;
    display: -moz-inline-stack;
    display: inline-block;
}
.gform_wrapper .top_label li.gfield.gf_inline input[type=text].large, .gform_wrapper .top_label li.gfield.gf_inline input[type=url].large, .gform_wrapper .top_label li.gfield.gf_inline input[type=email].large, .gform_wrapper .top_label li.gfield.gf_inline input[type=tel].large, .gform_wrapper .top_label li.gfield.gf_inline input[type=number].large, .gform_wrapper .top_label li.gfield.gf_inline input[type=password].large { width: 25.4em !important }
.gform_wrapper .top_label li.gfield.gf_inline input[type=text].medium, .gform_wrapper .top_label li.gfield.gf_inline input[type=url].medium, .gform_wrapper .top_label li.gfield.gf_inline input[type=email].medium, .gform_wrapper .top_label li.gfield.gf_inline input[type=tel].medium, .gform_wrapper .top_label li.gfield.gf_inline input[type=number].medium, .gform_wrapper .top_label li.gfield.gf_inline input[type=password].medium { width: 18.7em !important }
.gform_wrapper .top_label li.gfield.gf_inline input[type=text].datepicker.medium { width: 6em !important }
.gform_wrapper .top_label li.gfield.gf_inline input[type=text].small, .gform_wrapper .top_label li.gfield.gf_inline input[type=url].small, .gform_wrapper .top_label li.gfield.gf_inline input[type=email].small, .gform_wrapper .top_label li.gfield.gf_inline input[type=tel].small, .gform_wrapper .top_label li.gfield.gf_inline input[type=number].small, .gform_wrapper .top_label li.gfield.gf_inline input[type=password].small { width: 5em !important }
.gform_wrapper .top_label li.gfield.gf_inline select { width: auto !important }
.gform_wrapper .top_label li.gfield.gf_inline textarea { width: 95% !important }
.gform_wrapper .top_label li.gfield.gf_inline div.gfield_time_hour input[type=text], .gform_wrapper .top_label li.gfield.gf_inline div.gfield_time_minute input[type=text] { width: 70% !important }
.gform_wrapper .top_label li.gfield.gf_inline div.gfield_time_hour, .gform_wrapper .top_label li.gfield.gf_inline div.gfield_time_minute, .gform_wrapper .top_label li.gfield.gf_inline div.gfield_date_month, .gform_wrapper .top_label li.gfield.gf_inline div.gfield_date_day, .gform_wrapper .top_label li.gfield.gf_inline div.gfield_date_year { width: 3.125em }
.gform_wrapper .top_label li.gfield.gf_inline div.gfield_time_ampm { width: auto }
.gform_wrapper li.gf_inline div.ginput_container { white-space: nowrap !important }
.gform_wrapper .top_label li.gfield.gf_left_half {
    margin: 0 0 0.50em 0;
    width: 49%;
}
.gform_wrapper .top_label li.gfield.gf_right_half {
    margin: 0 0 0.50em 0;
    width: 48.5%;
}
.gform_wrapper .top_label li.gfield.gf_left_half, .gform_wrapper .top_label li.gfield.gf_right_half {
    display: -moz-inline-stack;
    display: inline-block;
    vertical-align: top;
}
.gform_wrapper .top_label li.gfield.gf_left_half {
    clear: left !important;
    margin-right: 1.6%;
}
.gform_wrapper .top_label li.gfield.gf_right_half { clear: right !important }
.gform_wrapper .top_label li.gfield.gfield_error.gf_left_half, .gform_wrapper .top_label li.gfield.gfield_error.gf_right_half { width: 47.5% !important }
.gform_wrapper .top_label li.gfield.gfield_error.gf_left_half { margin-right: 1.2% }
.gform_wrapper .top_label li.gfield.gf_left_half input.medium, .gform_wrapper .top_label li.gfield.gf_left_half input.large, .gform_wrapper .top_label li.gfield.gf_left_half select.medium, .gform_wrapper .top_label li.gfield.gf_left_half select.large, .gform_wrapper .top_label li.gfield.gf_right_half input.medium, .gform_wrapper .top_label li.gfield.gf_right_half input.large, .gform_wrapper .top_label li.gfield.gf_right_half select.medium, .gform_wrapper .top_label li.gfield.gf_right_half select.large { width: 97% }
.gform_wrapper .top_label li.gfield.gf_left_half textarea, .gform_wrapper .top_label li.gfield.gf_right_half textarea { width: 98% }
.gform_wrapper .top_label li.gfield.gf_left_half input.small, .gform_wrapper .top_label li.gfield.gf_right_half input.small { width: 35% }
.gform_wrapper .top_label li.gfield.gf_left_half+li.gsection, .gform_wrapper .top_label li.gfield.gf_right_half+li.gsection { padding: 1em 0 0.50em 0 }
.gform_wrapper .top_label li.gfield.gf_left_half+li.gfield.gsection.gf_left_half, .gform_wrapper .top_label li.gfield.gf_right_half+li.gfield.gsection.gf_left_half, .gform_wrapper .top_label li.gfield.gf_left_half+li.gfield.gsection.gf_right_half, .gform_wrapper .top_label li.gfield.gf_right_half+li.gfield.gsection.gf_right_half, .gform_wrapper .top_label li.gfield.gsection.gf_left_half+li.gfield.gsection.gf_left_half, .gform_wrapper .top_label li.gfield.gsection.gf_right_half+li.gfield.gsection.gf_left_half, .gform_wrapper .top_label li.gfield.gsection.gf_right_half+li.gfield.gsection.gf_right_half { padding: 1em 0 0.50em 0 }
.gform_wrapper .top_label li.gfield.gsection.gf_left_half+li.gfield.gsection.gf_right_half { padding: 0 0 0.50em 0 }
.gform_wrapper .top_label li.gfield.gsection.gf_left_half+li.gfield.gsection.gf_right_half+li.gfield.gsection.gf_left_half+li.gfield.gsection.gf_right_half { padding: 1em 0 0.50em 0 }
.gform_wrapper .top_label li.gfield.gf_left_half+li.gfield, .gform_wrapper .top_label li.gfield.gf_right_half+li.gfield, .gform_wrapper .top_label li.gfield.gf_left_half+.gform_footer, .gform_wrapper .top_label li.gfield.gf_right_half+.gform_footer { clear: both }
.gform_wrapper .top_label li.gfield.gf_left_third, .gform_wrapper .top_label li.gfield.gf_middle_third, .gform_wrapper .top_label li.gfield.gf_right_third {
    width: 31.9%;
    display: -moz-inline-stack;
    display: inline-block;
    vertical-align: top;
}
.gform_wrapper .top_label li.gfield.gf_left_third { margin: 0 0 .5em 0 }
.gform_wrapper .top_label li.gfield.gf_middle_third, .gform_wrapper .top_label li.gfield.gf_right_third {
    margin-bottom: .5em;
    margin-left: 1.3% !important;
}
.gform_wrapper .top_label li.gfield.gfield_error.gf_left_third, .gform_wrapper .top_label li.gfield.gfield_error.gf_middle_third, .gform_wrapper .top_label li.gfield.gfield_error.gf_right_third { width: 31.5% }
.gform_wrapper .top_label li.gfield.gf_left_third { clear: left !important }
.gform_wrapper .top_label li.gfield.gf_middle_third { clear: none !important }
.gform_wrapper .top_label li.gfield.gfield_error.gf_middle_third {

}
.gform_wrapper .top_label li.gfield.gf_right_third { clear: right !important }
.gform_wrapper .top_label li.gfield.gf_left_third input.medium, .gform_wrapper .top_label li.gfield.gf_left_third input.large, .gform_wrapper .top_label li.gfield.gf_left_third select.medium, .gform_wrapper .top_label li.gfield.gf_left_third select.large, .gform_wrapper .top_label li.gfield.gf_middle_third input.medium, .gform_wrapper .top_label li.gfield.gf_middle_third input.large, .gform_wrapper .top_label li.gfield.gf_middle_third select.medium, .gform_wrapper .top_label li.gfield.gf_middle_third select.large, .gform_wrapper .top_label li.gfield.gf_right_third input.medium, .gform_wrapper .top_label li.gfield.gf_right_third input.large, .gform_wrapper .top_label li.gfield.gf_right_third select.medium, .gform_wrapper .top_label li.gfield.gf_right_third select.large { width: 97.5% }
.gform_wrapper .top_label li.gfield.gf_left_third+li.gsection, .gform_wrapper .top_label li.gfield.gf_right_third+li.gsection { padding: 1em 0 0.50em 0 }
.gform_wrapper .top_label li.gfield.gf_left_third+li.gfield, .gform_wrapper .top_label li.gfield.gf_middle_third+li.gfield, .gform_wrapper .top_label li.gfield.gf_right_third+li.gfield, .gform_wrapper .top_label li.gfield.gf_left_third+.gform_footer, .gform_wrapper .top_label li.gfield.gf_middle_third+.gform_footer, .gform_wrapper .top_label li.gfield.gf_right_third+.gform_footer { clear: both }
.gform_wrapper li.gfield.gf_list_2col ul.gfield_checkbox li, .gform_wrapper li.gfield.gf_list_2col ul.gfield_radio li, .gform_wrapper li.gfield.gf_2col ul.gfield_checkbox li, .gform_wrapper li.gfield.gf_2col ul.gfield_radio li {
    width: 50%;
    display: -moz-inline-stack;
    display: inline-block;
    margin: 0 0 0.50em 0;
    min-height: 1.8em;
    vertical-align: top;
}
.gform_wrapper li.gfield.gf_list_3col ul.gfield_checkbox li, .gform_wrapper li.gfield.gf_list_3col ul.gfield_radio li, .gform_wrapper li.gfield.gf_3col ul.gfield_checkbox li, .gform_wrapper li.gfield.gf_3col ul.gfield_radio li {
    width: 33%;
    display: -moz-inline-stack;
    display: inline-block;
    margin: 0 0 0.50em 0;
    min-height: 1.8em;
    vertical-align: top;
}
.gform_wrapper li.gfield.gf_list_4col ul.gfield_checkbox li, .gform_wrapper li.gfield.gf_list_4col ul.gfield_radio li {
    width: 25%;
    display: -moz-inline-stack;
    display: inline-block;
    margin: 0 0 0.5em 0;
    min-height: 1.8em;
    vertical-align: top;
}
.gform_wrapper li.gfield.gf_list_5col ul.gfield_checkbox li, .gform_wrapper li.gfield.gf_list_5col ul.gfield_radio li {
    width: 20%;
    display: -moz-inline-stack;
    display: inline-block;
    margin: 0 0 0.50em 0;
    min-height: 1.8em;
    vertical-align: top;
}
.gform_wrapper li.gfield.gf_list_2col ul.gfield_checkbox, .gform_wrapper li.gfield.gf_list_2col ul.gfield_radio, .gform_wrapper li.gfield.gf_list_3col ul.gfield_checkbox, .gform_wrapper li.gfield.gf_list_3col ul.gfield_radio, .gform_wrapper li.gfield.gf_list_4col ul.gfield_checkbox, .gform_wrapper li.gfield.gf_list_4col ul.gfield_radio, .gform_wrapper li.gfield.gf_list_5col ul.gfield_checkbox, .gform_wrapper li.gfield.gf_list_5col ul.gfield_radio, .gform_wrapper li.gfield.gf_2col ul.gfield_checkbox, .gform_wrapper li.gfield.gf_2col ul.gfield_radio, .gform_wrapper li.gfield.gf_3col ul.gfield_checkbox, .gform_wrapper li.gfield.gf_3col ul.gfield_radio { overflow: hidden }
.gform_wrapper  li.gfield.gf_list_2col label.gfield_label, .gform_wrapper  li.gfield.gf_list_3col label.gfield_label, .gform_wrapper  li.gfield.gf_list_4col label.gfield_label, .gform_wrapper  li.gfield.gf_list_5col label.gfield_label, .gform_wrapper  li.gfield.gf_list_inline label.gfield_label { margin: 0.625em 0 0.625em 0 }
.gform_wrapper li.gfield.gf_list_height_25 ul.gfield_checkbox li, .gform_wrapper li.gfield.gf_list_height_25 ul.gfield_radio li { height: 25px }
.gform_wrapper li.gfield.gf_list_height_50 ul.gfield_checkbox li, .gform_wrapper li.gfield.gf_list_height_50 ul.gfield_radio li { height: 50px }
.gform_wrapper li.gfield.gf_list_height_75 ul.gfield_checkbox li, .gform_wrapper li.gfield.gf_list_height_75 ul.gfield_radio li { height: 75px }
.gform_wrapper li.gfield.gf_list_height_100 ul.gfield_checkbox li, .gform_wrapper li.gfield.gf_list_height_100 ul.gfield_radio li { height: 100px }
.gform_wrapper li.gfield.gf_list_height_125 ul.gfield_checkbox li, .gform_wrapper li.gfield.gf_list_height_125 ul.gfield_radio li { height: 125px }
.gform_wrapper li.gfield.gf_list_height_150 ul.gfield_checkbox li, .gform_wrapper li.gfield.gf_list_height_150 ul.gfield_radio li { height: 150px }
.gform_wrapper li.gf_list_inline ul.gfield_checkbox li, .gform_wrapper li.gf_list_inline ul.gfield_radio li {
    width: auto !important;
    float: none !important;
    margin: 0 0.625em 0.625em 0;
    display: -moz-inline-stack;
    display: inline-block;
}
body.gform_wrapper .top_label li.gsection.gf_scroll_text { width: 92.5% !important }
.gform_wrapper li.gf_hide_ampm div.gfield_time_ampm { display: none !important }
.gform_wrapper .top_label li.gsection.gf_scroll_text {
    height: 11.250em;
    width: 97.5% !important;
    background-color: #fff;
    overflow: auto;
    border: 1px solid #CCC;
    border-bottom: 1px solid #CCC !important;
}
.gform_wrapper .top_label li.gsection.gf_scroll_text h2.gsection_title { margin: 0.625em 0.625em 0 0.50em !important }
.gform_wrapper.gf_browser_gecko .top_label li.gsection.gf_scroll_text h2.gsection_title, .gform_wrapper.gf_browser_chrome .top_label li.gsection.gf_scroll_text h2.gsection_title { margin: 0 0.625em 0 0.50em !important }
.gform_wrapper .top_label li.gsection.gf_scroll_text .gsection_description {
    margin: 0.625em;
    font-size: 0.8em;
}
.gform_wrapper div.gform_ul.gform_fields .top_label li.gfield.gsection.gf_scroll_text div.gsection_description ul li, .gform_wrapper form div.gform_ul.gform_fields .top_label li.gfield.gsection.gf_scroll_text div.gsection_description ul li {
    list-style-type: disc !important;
    margin: 0 0 0.5em;
    overflow: visible;
    padding-left: 0;
}
.gform_wrapper div.gform_ul.gform_fields .top_label li.gfield.gsection.gf_scroll_text div.gsection_description ul, .gform_wrapper form div.gform_ul.gform_fields .top_label li.gfield.gsection.gf_scroll_text div.gsection_description ul {
    list-style-type: disc !important;
    margin: 1em 0 1em 1.5em;
    padding-left: 0;
}
.gform_wrapper div.gform_ul.gform_fields .top_label li.gfield.gsection.gf_scroll_text div.gsection_description ol li, .gform_wrapper form div.gform_ul.gform_fields .top_label li.gfield.gsection.gf_scroll_text div.gsection_description ol li {
    list-style-type: decimal!important;
    overflow: visible;
    margin: 0 0 0.5em;
    padding-left: 0;
}
.gform_wrapper div.gform_ul.gform_fields .top_label li.gfield.gsection.gf_scroll_text div.gsection_description ol, .gform_wrapper form div.gform_ul.gform_fields .top_label li.gfield.gsection.gf_scroll_text div.gsection_description ol {
    list-style-type: decimal!important;
    margin: 1em 0 1.5em 2.0em;
    padding-left: 0;
}
.gform_wrapper div.gform_ul.gform_fields .top_label li.gfield.gsection.gf_scroll_text div.gsection_description ol li ul, .gform_wrapper form div.gform_ul.gform_fields .top_label li.gfield.gsection.gf_scroll_text div.gsection_description ol li ul li {
    list-style-type: disc !important;
    padding-left: 0;
}
.gform_wrapper div.gform_ul.gform_fields .top_label li.gfield.gsection.gf_scroll_text div.gsection_description ol li ul { margin: 1em 0 1em 1.5em }
.gform_wrapper form div.gform_ul.gform_fields .top_label li.gfield.gsection.gf_scroll_text div.gsection_description ol li ul li { margin: 0 0 0.5em }
.gform_wrapper div.gform_ul.gform_fields .top_label li.gfield.gsection.gf_scroll_text div.gsection_description dl {
    margin: 0 0 1.5em 0;
    padding-left: 0;
}
.gform_wrapper div.gform_ul.gform_fields .top_label li.gfield.gsection.gf_scroll_text div.gsection_description dl dt { font-weight: bold }
.gform_wrapper div.gform_ul.gform_fields .top_label li.gfield.gsection.gf_scroll_text div.gsection_description dl dd { margin: 0 0 1em 1.5em }
.gform_wrapper li.gfield.gfield_html.gf_alert_green, .gform_wrapper li.gfield.gfield_html.gf_alert_red, .gform_wrapper li.gfield.gfield_html.gf_alert_yellow, .gform_wrapper li.gfield.gfield_html.gf_alert_gray, .gform_wrapper li.gfield.gfield_html.gf_alert_blue {
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    border-radius: 3px;
    margin: 1.250em 0 !important;
    padding: 1.250em !important;
}
.gform_wrapper li.gfield.gfield_html.gf_alert_green {
    border: 1px solid #97B48A;
    background-color: #CBECA0;
    text-shadow: #DFB 1px 1px;
    color: #030;
}
.gform_wrapper li.gfield.gfield_html.gf_alert_red {
    border: 1px solid #CFADB3;
    background-color: #FAF2F5;
    text-shadow: #FFF 1px 1px;
    color: #832525;
}
.gform_wrapper li.gfield.gfield_html.gf_alert_yellow {
    border: 1px solid #E6DB55;
    background-color: #FFFBCC;
    text-shadow: #FCFAEA 1px 1px;
    color: #222;
}
.gform_wrapper li.gfield.gfield_html.gf_alert_gray {
    border: 1px solid #CCC;
    background-color: #EEE;
    text-shadow: #FFF 1px 1px;
    color: #424242;
}
.gform_wrapper li.gfield.gfield_html.gf_alert_blue {
    border: 1px solid #a7c2e7;
    background-color: #D1E4F3;
    text-shadow: #E0F1FF 1px 1px;
    color: #314475;
}
div.gform_confirmation_wrapper.gf_confirmation_simple_yellow {
    margin: 1.875em 0;
    max-width: 99%;
    border-top: 1px solid #E6DB55;
    border-bottom: 1px solid #E6DB55;
    padding: 2em;
    background-color: #FFFBCC;
    color: #424242;
    font-size: 1.6em;
}
div.gform_confirmation_wrapper.gf_confirmation_simple_gray {
    margin: 1.875em 0;
    max-width: 99%;
    border-top: 1px solid #CCC;
    border-bottom: 1px solid #CCC;
    padding: 2em;
    background-color: #EAEAEA;
    color: #424242;
    font-size: 1.6em;
}
div.gform_confirmation_wrapper.gf_confirmation_yellow_gradient {
    position: relative;
    background-color: #FFFBD2;
    margin: 1.875em 0;
    border: 1px solid #E6DB55;
    -webkit-box-shadow: 0px 0px 5px rgba(221, 215, 131, 0.75);
    -moz-box-shadow: 0px 0px 5px rgba(221, 215, 131, 0.75);
    box-shadow: 0px 0px 5px rgba(221, 215, 131, 0.75);
}
div.gform_confirmation_wrapper.gf_confirmation_yellow_gradient div.gforms_confirmation_message {
    margin: 0;
    padding: 2.50em;
    max-width: 99%;
    font-size: 1.8em;
    border-top: 2px solid #FFF;
    border-bottom: 1px solid #E6DB55;
    background-color: #FFFBCC;
    color: #424242;
    background: #fffce5;
    background: -moz-linear-gradient(top,  #fffce5 0%, #fff9bf 100%);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fffce5), color-stop(100%,#fff9bf));
    background: -webkit-linear-gradient(top,  #fffce5 0%,#fff9bf 100%);
    background: -o-linear-gradient(top,  #fffce5 0%,#fff9bf 100%);
    background: -ms-linear-gradient(top,  #fffce5 0%,#fff9bf 100%);
    background: linear-gradient(to bottom,  #fffce5 0%,#fff9bf 100%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fffce5', endColorstr='#fff9bf',GradientType=0 );
}
div.gform_confirmation_wrapper.gf_confirmation_green_gradient {
    position: relative;
    background-color: #f1fcdf;
    margin: 1.875em 0;
    border: 1px solid #a7c37c;
    -webkit-box-shadow: 0px 0px 5px rgba(86, 122, 86, 0.4);
    -moz-box-shadow: 0px 0px 5px rgba(86, 122, 86, 0.4);
    box-shadow: 0px 0px 5px rgba(86, 122, 86, 0.4);
}
div.gform_confirmation_wrapper.gf_confirmation_green_gradient div.gforms_confirmation_message {
    margin: 0;
    padding: 2.50em;
    max-width: 99%;
    font-size: 1.8em;
    border-top: 2px solid #effade;
    border-bottom: 1px solid #a7c37c;
    background-color: #FFFBCC;
    text-shadow: #DFB 1px 1px;
    color: #030;
    background: rgb(219,242,183);
    background: -moz-linear-gradient(top,  rgba(219,242,183,1) 0%, rgba(180,208,136,1) 100%);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(219,242,183,1)), color-stop(100%,rgba(180,208,136,1)));
    background: -webkit-linear-gradient(top,  rgba(219,242,183,1) 0%,rgba(180,208,136,1) 100%);
    background: -o-linear-gradient(top,  rgba(219,242,183,1) 0%,rgba(180,208,136,1) 100%);
    background: -ms-linear-gradient(top,  rgba(219,242,183,1) 0%,rgba(180,208,136,1) 100%);
    background: linear-gradient(to bottom,  rgba(219,242,183,1) 0%,rgba(180,208,136,1) 100%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#dbf2b7', endColorstr='#b4d088',GradientType=0 );
}
div.gform_confirmation_wrapper.gf_confirmation_yellow_gradient:before, div.gform_confirmation_wrapper.gf_confirmation_yellow_gradient:after, div.gform_confirmation_wrapper.gf_confirmation_green_gradient:before, div.gform_confirmation_wrapper.gf_confirmation_green_gradient:after {
    z-index: -1;
    position: absolute;
    content: "";
    bottom: 15px;
    left: 10px;
    width: 50%;
    top: 80%;
    max-width: 40%;
    background: rgba(0, 0, 0, 0.2);
    -webkit-box-shadow: 0 15px 10px rgba(0,0,0, 0.2);
    -moz-box-shadow: 0 15px 10px rgba(0, 0, 0, 0.2);
    box-shadow: 0 15px 10px rgba(0, 0, 0, 0.2);
    -webkit-transform: rotate(-3deg);
    -moz-transform: rotate(-3deg);
    -o-transform: rotate(-3deg);
    -ms-transform: rotate(-3deg);
    transform: rotate(-3deg);
}
div.gform_confirmation_wrapper.gf_confirmation_yellow_gradient:after, div.gform_confirmation_wrapper.gf_confirmation_green_gradient:after {
    -webkit-transform: rotate(3deg);
    -moz-transform: rotate(3deg);
    -o-transform: rotate(3deg);
    -ms-transform: rotate(3deg);
    transform: rotate(3deg);
    right: 10px;
    left: auto;
}
div.gf_simple_horizontal_wrapper { max-width: 97.5% }
div.gf_simple_horizontal_wrapper div.gform_body, div.gf_simple_horizontal div.gform_body, div.gf_simple_horizontal_wrapper div.gform_footer, div.gf_simple_horizontal div.gform_footer {
    display: -moz-inline-stack;
    display: inline-block;
    vertical-align: top;
}
div.gf_simple_horizontal_wrapper div.gform_body, div.gf_simple_horizontal div.gform_body {
    width: 74%;
    margin: 0 !important;
    padding: 0 !important;
}
div.gf_simple_horizontal_wrapper div.gform_footer, div.gf_simple_horizontal div.gform_footer {
    width: 24%;
    margin: 0 !important;
    padding: 0 !important;
}
div.gf_simple_horizontal_wrapper div.gform_body ul li.gfield input.small, div.gf_simple_horizontal_wrapper div.gform_body ul li.gfield input.medium, div.gf_simple_horizontal_wrapper div.gform_body ul li.gfield input.large, div.gf_simple_horizontal div.gform_body ul li.gfield input.small, div.gf_simple_horizontal div.gform_body ul li.gfield input.medium, div.gf_simple_horizontal div.gform_body ul li.gfield input.large { width: 97.5% }
div.gf_simple_horizontal_wrapper div.gform_body ul li.gfield label.gfield_label, div.gf_simple_horizontal div.gform_body ul li.gfield label.gfield_label {
    position: absolute;
    left: -9000px;
}
.gform_wrapper .left_label li.gfield.gsection.gf_section_right, .gform_wrapper .right_label li.gfield.gsection.gf_section_right {
    margin-left: 30% !important;
    width: 64%;
}


text:
import Ember from 'ember';

const {$, Mixin, run} = Ember;

function K() {
    return this;
}

// Code modified from Addepar/ember-widgets
// https://github.com/Addepar/ember-widgets/blob/master/src/mixins.coffee#L39

export default Mixin.create({
    bodyElementSelector: 'html',
    bodyClick: K,

    init() {
        this._super(...arguments);

        return run.next(this, this._setupDocumentHandlers);
    },

    willDestroy() {
        this._super(...arguments);

        return this._removeDocumentHandlers();
    },

    _setupDocumentHandlers() {
        if (this._clickHandler) {
            return;
        }

        this._clickHandler = () => {
            return this.bodyClick();
        };

        return $(this.get('bodyElementSelector')).on('click', this._clickHandler);
    },

    _removeDocumentHandlers() {
        $(this.get('bodyElementSelector')).off('click', this._clickHandler);
        this._clickHandler = null;
    },

    // http://stackoverflow.com/questions/152975/how-to-detect-a-click-outside-an-element
    click(event) {
        return event.stopPropagation();
    }
});


text:
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Conectividad</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <link rel="stylesheet" href="<?php echo base_url('assets/bower_components/bootstrap/dist/css/bootstrap.min.css'); ?>">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="<?php echo base_url('assets/bower_components/font-awesome/css/font-awesome.min.css'); ?>">
  <!-- Ionicons -->
  <link rel="stylesheet" href="<?php echo base_url('assets/bower_components/Ionicons/css/ionicons.min.css'); ?>">
  <!-- Theme style -->
  <link rel="stylesheet" href="<?php echo base_url('assets/dist/css/AdminLTE.min.css'); ?>">
  <!-- iCheck -->
   <link rel="stylesheet" href="<?php echo base_url('assets/plugins/iCheck/square/blue.css'); ?>">

  <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
   <link rel="stylesheet" href="<?php echo base_url('assets/dist/css/skins/_all-skins.min.css'); ?>">

  <!-- Google Font -->
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
</head>
<body class="hold-transition login-page">
<?php echo $this->section('page')?>

<!-- jQuery 3 -->
<script src="<?php echo base_url('assets/bower_components/jquery/dist/jquery.min.js');?>"></script>
<!-- Bootstrap 3.3.7 -->
<script src="<?php echo base_url('assets/bower_components/bootstrap/dist/js/bootstrap.min.js');?>"></script>
<!-- AdminLTE App -->
<script src="<?php echo base_url('assets/dist/js/adminlte.min.js');?>"></script>
<!-- iCheck -->
<script src="<?php echo base_url('assets/plugins/iCheck/icheck.min.js');?>"></script>
<script src="<?php echo base_url('assets/js/validaciones.js');?>"></script>

<?php echo $this->section('extra_js')?>
</body>
</html>


text:
package com.google.cloud.accessapproval.v1.samples;

// [START accessapproval_v1_generated_AccessApproval_ApproveApprovalRequest_sync]
import com.google.cloud.accessapproval.v1.AccessApprovalAdminClient;
import com.google.cloud.accessapproval.v1.ApprovalRequest;
import com.google.cloud.accessapproval.v1.ApprovalRequestName;
import com.google.cloud.accessapproval.v1.ApproveApprovalRequestMessage;
import com.google.protobuf.Timestamp;

public class SyncApproveApprovalRequest {

  public static void main(String[] args) throws Exception {
    syncApproveApprovalRequest();
  }

  public static void syncApproveApprovalRequest() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
      ApproveApprovalRequestMessage request =
          ApproveApprovalRequestMessage.newBuilder()
              .setName(
                  ApprovalRequestName.ofProjectApprovalRequestName(
                          "[PROJECT]", "[APPROVAL_REQUEST]")
                      .toString())
              .setExpireTime(Timestamp.newBuilder().build())
              .build();
      ApprovalRequest response = accessApprovalAdminClient.approveApprovalRequest(request);
    }
  }
}
// [END accessapproval_v1_generated_AccessApproval_ApproveApprovalRequest_sync]