text:
using InterSystems.Globals;
using System;
using CacheEXTREME2.WDirectGlobal;
using CacheEXTREME2.WMetaGlobal;
using System.Reflection;
using System.Collections.Generic;
using System.Collections;

namespace CacheEXTREME2.WProxyGlobal
{
    public class CacheEXTREMEcontext
    {
        public Connection conn;
        protected string globalName = "";
        protected string globalMetaName = "";
        //
        protected GlobalMeta globalMeta;
        protected Dictionary<string, EntityMeta> entitiesMeta;
        protected List<IStructManager> structsManagers = new List<IStructManager>();
        //
        protected TrueNodeReference globalRef;
        //
        public CacheEXTREMEcontext(Connection conn, string globalName, string globalMetaName, IMetaReader metaReader)
        {
            this.globalName = globalName;
            this.globalMetaName = globalMetaName;
            this.conn = conn;
            this.globalMeta = metaReader.GetMeta(this.globalMetaName);
            this.globalName = this.globalMeta.GlobalName;
            this.globalRef = new TrueNodeReference(conn, globalName);
            this.getEntities();
        }

        public CacheEXTREMEcontext(Connection conn, string globalName, string globalMetaName)
            : this(conn, globalName, globalMetaName, new MetaReaderWriter(conn))
        {
        }

        public CacheEXTREMEcontext(Connection conn, string globalMetaName)
            :this(conn,"",globalMetaName)
        {
        }

        public CacheEXTREMEcontext(Connection conn, GlobalMeta globalMeta)
        {
            this.globalName = globalMeta.GlobalName;
            this.globalMetaName = globalMeta.GlobalMetaName;
            this.conn = conn;
            this.globalMeta = globalMeta;
            this.globalRef = new TrueNodeReference(conn, globalName);
            this.getEntities();
        }
        private void getEntities()
        {
            entitiesMeta = new Dictionary<string, EntityMeta>();
            for (int i = 1; i <= globalMeta.KeysCount; i++)
            {
                if (globalMeta.GetEntityMeta(i).ValuesMeta.Count > 0)
                {
                    string entityName = globalMeta.GetNodeMeta(i - 1).Key + "Proxy";
                    entitiesMeta.Add(entityName, globalMeta.GetEntityMeta(i));
                }
            }
        }
        //
        public bool HasEntity(object entity)
        {
            if (entitiesMeta.ContainsKey(entity.GetType().Name))
            {
                return true;
            }
            return false;
        }
        public bool HasEntity(Type entityType)
        {
            if (entitiesMeta.ContainsKey(entityType.Name))
            {
                return true;
            }
            return false;
        }
        public TrueNodeReference GetNodeReference()
        {
            return new TrueNodeReference(conn, globalName);
        }
        //
        public object GetEntity(Type entityType, object key)
        {
            object entity = null;
            string entityName = entityType.Name;
            if (HasEntity(entityType))
            {
                FieldInfo[] keyFields = key.GetType().GetFields();
                ArrayList keys = new ArrayList();
                for (int i = 0; i < entitiesMeta[entityName].KyesMeta.Count; i++)
                {
                    entitiesMeta[entityName].KeysValidator[i].ValidateKey(keyFields[i].GetValue(key));
                    keys.Add(keyFields[i].GetValue(key));
                }
                List<ValueMeta> valuesMeta = entitiesMeta[entityName].ValuesMeta;
                List<ValueMeta> keysMeta = entitiesMeta[entityName].KyesMeta;
                globalRef.SetSubscripts(keys);
                if (globalRef.HasValues())
                {
                    ArrayList values = globalRef.GetValues(valuesMeta);
                    //
                    keys.AddRange(values);
                    entity = CreateEntity(entityType, keys.ToArray());
                }
            }
            return entity;
        }
        public object GetEntity(Type entityType, ArrayList keys)
        {
            object entity = null;
            string entityName = entityType.Name;
            if (HasEntity(entityType))
            {
                for (int i = 0; i < keys.Count; i++)
                {
                    this.globalMeta[i].Validate(keys[i]);
                }
                List<ValueMeta> valuesMeta = entitiesMeta[entityName].ValuesMeta;
                List<ValueMeta> keysMeta = entitiesMeta[entityName].KyesMeta;
                globalRef.SetSubscripts(keys);
                if (globalRef.HasValues())
                {
                    ArrayList values = globalRef.GetValues(valuesMeta);
                    keys.AddRange(values);
                    //
                    entity = CreateEntity(entityType, keys.ToArray());
                }
            }
            return entity;
        }
        public ArrayList TrueGetEntities(Type entityType, object key)
        {
            ArrayList entities = new ArrayList();
            if (HasEntity(entityType))
            {
                int keyCount = entitiesMeta[entityType.Name].KyesMeta.Count;
                FieldInfo[] keyFields = key.GetType().GetFields();
                ArrayList keys = new ArrayList();
                for (int i = 0; i < keyCount; i++)
                {
                    //entitiesMeta[entityType.Name].keysValidator[i].ValidateKey( keyFields[i].GetValue(key));
                    keys.Add(keyFields[i].GetValue(key));
                }
                keyFields = null;
                globalRef.Reset();
                ArrayList subsList = new ArrayList();
                treeWalkForKeys(globalRef, keys, subsList);
                ArrayList tempVals;
                foreach (ArrayList nkey in subsList)
                {
                    globalRef.SetSubscripts(nkey);
                    tempVals = globalRef.GetValues(entitiesMeta[entityType.Name].ValuesMeta);
                    nkey.AddRange(tempVals);
                    entities.Add(CreateEntity(entityType, nkey.ToArray()));
                }
                subsList = null;
            }
            return entities;
        }
        public void SaveEntity(object entity)
        {
            if(HasEntity(entity))
            {
                Type entityType = entity.GetType();
                FieldInfo[] fields = entityType.GetFields();
                ArrayList keys = new ArrayList();
                ArrayList values = new ArrayList();
                int keysCount = entitiesMeta[entityType.Name].KyesMeta.Count;
                for (int i = 0; i < keysCount; i++ )
                {
                    keys.Add(fields[i].GetValue(entity));
                }
                for (int i = 0; i < keys.Count; i++)
                {
                    this.globalMeta[i].Validate(keys[i]);
                }
                for (int i = keysCount, j = 0; j < globalMeta.GetNodeMeta(keysCount).Value.Count; i++, j++)
                {
                    values.Add(fields[i].GetValue(entity));
                }
                for (int j = 0; j < values.Count; j++)
                {
                    this.globalMeta[keys.Count - 1, j].Validate(values[j]);
                }
                globalRef.SetValues(keys, values);
            }
        }
        public void KillEntity(Type entityType, object key)
        {
            if(HasEntity(entityType))
            {
                FieldInfo[] keyFields = key.GetType().GetFields();
                ArrayList keys = new ArrayList();
                for (int i = 0; i < entitiesMeta[entityType.Name].KyesMeta.Count; i++)
                {
                    entitiesMeta[entityType.Name].KeysValidator[i].ValidateKey(keyFields[i].GetValue(key));
                    keys.Add(keyFields[i].GetValue(key));
                }
                globalRef.SetSubscripts(keys);
                globalRef.Kill();
            }
        }
        public ArrayList TrueGetKeys(ArrayList baseSubscripts)
        {
            ArrayList subs = new ArrayList();
            treeWalkForKeys(globalRef, baseSubscripts, subs);
            return subs;
        }
        public void ReloadGlobalMeta(GlobalMeta newMeta)
        {
            try
            {
                globalMeta.ResetRestrictionsOnly(newMeta);
            }
            catch(Exception ex)
            {
                throw new ArgumentException("newMeta has diferent structure or/and semantics. " + ex.Message, "newMeta", ex);
            }
        }
        //
        private object CreateEntity(Type entityType, object[] args)
        {
            object entity = null;
            if(HasEntity(entityType))
            {
                ConstructorInfo[] constructor = entityType.GetConstructors();
                entity = constructor[0].Invoke(args);
            }
            return entity;
        }
        //
        private void treeWalkForKeys(TrueNodeReference glNode, ArrayList baseSubscripts, ArrayList subscriptsList)
        {
            glNode.AppendSubscript("");
            if (baseSubscripts[glNode.SubsCount - 1] != null && baseSubscripts[glNode.SubsCount - 1].ToString() != "")
            {
                glNode.SetSubscript(glNode.SubsCount, baseSubscripts[glNode.SubsCount - 1]);
                if (glNode.SubsCount == baseSubscripts.Count)
                {
                    if (glNode.HasValues())
                    {
                        subscriptsList.Add(glNode.GetSubscripts());
                        return;
                    }
                    return;
                }
                treeWalkForKeys(glNode, baseSubscripts, subscriptsList);
                glNode.GoParentNodeSubscripts();
                return;
            }
            while (glNode.NextSubscript() != "")
            {
                glNode.GoNextSubscript();
                if (glNode.SubsCount == baseSubscripts.Count)
                {
                    subscriptsList.Add(glNode.GetSubscripts());
                    continue;
                }
                if (glNode.HasSubnodes())
                {
                    treeWalkForKeys(glNode, baseSubscripts, subscriptsList);
                    glNode.GoParentNodeSubscripts();
                }
            }
        }
    }
}


text:
package org.apache.camel.component.restlet;

import java.util.ArrayList;
import java.util.List;

import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.JndiRegistry;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.junit.Test;

/**
 * This unit test verifies a single route can service multiple templates.
 *
 * @version $Revision$
 */
public class RestletMultiUriTemplatesEndpointTest extends RestletTestSupport {

    @Override
    protected JndiRegistry createRegistry() throws Exception {
        List<String> list = new ArrayList<String>();
        list.add("/users/{username}");
        list.add("/atom/collection/{id}/component/{cid}");

        JndiRegistry jndi = super.createRegistry();
        jndi.bind("uriTemplates", list);
        return jndi;
    }

    @Test
    public void testPostUserUriPattern() throws Exception {
        HttpResponse response = doExecute(new HttpPost("http://localhost:9080/users/homer"));

        assertHttpResponse(response, 200, "text/plain", "POST homer");
    }

    @Test
    public void testGetAtomUriPattern() throws Exception {
        HttpResponse response = doExecute(new HttpGet("http://localhost:9080/atom/collection/foo/component/bar"));

        assertHttpResponse(response, 200, "text/plain", "GET foo bar");
    }

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                // START SNIPPET: routeDefinition
                from("restlet:http://localhost:9080?restletMethods=post,get&restletUriPatterns=#uriTemplates")
                    .process(new Processor() {
                        public void process(Exchange exchange) throws Exception {
                            // echo the method
                            String uri = exchange.getIn().getHeader(Exchange.HTTP_URI, String.class);
                            String out = exchange.getIn().getHeader(Exchange.HTTP_METHOD, String.class);
                            if ("http://localhost:9080/users/homer".equals(uri)) {
                                exchange.getOut().setBody(out + " " + exchange.getIn().getHeader("username", String.class));
                            } else if ("http://localhost:9080/atom/collection/foo/component/bar".equals(uri)) {
                                exchange.getOut().setBody(out + " " + exchange.getIn().getHeader("id", String.class)
                                                          + " " + exchange.getIn().getHeader("cid", String.class));
                            }
                        }
                    });
                // END SNIPPET: routeDefinition
            }
        };
    }
}

redpajama_set_name: RedPajamaGithub


text:
import { Component, OnInit } from '@angular/core';
import { PodcastService } from '../../services/podcast.service';
import { Podcast } from '../../models/podcast';

@Component({
  selector: 'app-podcast-deck',
  templateUrl: './podcast-deck.component.html',
  styleUrls: ['./podcast-deck.component.css']
})
export class PodcastDeckComponent implements OnInit {

  private podcasts: Podcast[];

  constructor(private podcastService: PodcastService) { }

  ngOnInit() {
    this.getPodcasts();
  }

  private getPodcasts() {
    this.podcastService.getAllPodcasts()
                        .subscribe(podcasts => this.podcasts = podcasts,
                                   error => console.log(error));
  }

}


text:
/*******************************************************************\

Module:

Author: Daniel Kroening, kroening@cs.cmu.edu

\*******************************************************************/

#ifndef CPROVER_EXPR2CPP_H
#define CPROVER_EXPR2CPP_H

#include <string>

class exprt;
class namespacet;
class typet;

std::string expr2cpp(const exprt &expr, const namespacet &ns);
std::string type2cpp(const typet &type, const namespacet &ns);

#endif


text:
'use strict'
//Pass in path to root directory
//returns object representation with all directories and files
//directory properties have property structure
//path: STRING, files: ARRAY, opened: BOOL (default false), type:STRING
//file properties have property structure
//path:STRING, type:STRING

//separate out the proj info stuff into another module? and then put info in local storage instead of a local file?

const fs = require('fs');
const path = require('path');
const { File, Directory } = require('./item-schema');

const projInfoPath = path.join(__dirname, '../lib/projInfo.js');

const projInfo = {
  htmlPath: '',
  hotLoad: false,
  webpack: false,
  rootPath: '',
  devServer: false,
  devServerScript: '',
  mainEntry: '',
  reactEntry: '',
  CRA: false,
};

function insertSorted(fileOrDir, filesOrDirs) {
  // for (var i = 0; i < filesOrDirs.length; i++) {
  //   for (var j = 0; j < fileOrDir.name.length; j++) {
  //     if (fileOrDir.name[j] > filesOrDirs[i].name[j]) break;
  //     else if (fileOrDir.name[j] < filesOrDirs[i].name[j]) filesOrDirs.splice(i, 0, fileOrDir);
  //   }
  // }
  filesOrDirs.push(fileOrDir);
}

function init() {
  projInfo.htmlPath = '';
  projInfo.hotLoad = false;
  projInfo.webpack = false;
  projInfo.rootPath = '';
  projInfo.devServer = false;
  projInfo.devServerScript = '';
  projInfo.mainEntry = '';
  projInfo.reactEntry = '';
  projInfo.CRA = false;
}
// return file extension by file name - Ryan Yang
function getFileExt(fileName) {
  // todo: handle special file names (eg. .gitignore .babelrc)
  let arr = fileName.split('.');
  if (arr.length == 1)
    return '';
  else
    return arr[arr.length - 1];
}
// return css class by file extension - Ryan Yang
function getCssClassByFileExt(ext) {
  switch (ext.toUpperCase()) {
    case 'JS':
      return 'seti-javascript';
    case 'JSX':
      return 'seti-react';
    case 'CSS':
      return 'seti-css';
    case 'LESS':
      return 'seti-less';
    case 'SASS':
    case 'SCSS':
      return 'seti-sass';
    case 'JSON':
      return 'seti-json';
    case 'SVG':
      return 'seti-svg';
    case 'EOT':
    case 'WOFF':
    case 'WOFF2':
    case 'TTF':
      return 'seti-font';
    case 'XML':
      return 'seti-xml';
    case 'YML':
      return 'seti-yml';
    case 'MD':
      return 'seti-markdown';
    case 'HTML':
      return 'seti-html';
    case 'JPG':
    case 'PNG':
    case 'GIF':
    case 'JPEG':
      return 'seti-image';
    default:
      return 'octi-file-text';
  }
}
//getTree is a function expression that takes in 2x arguments
//A 'rootDirPath' and a callback
const getTree = (rootDirPath, callback) => {
  //init resets the values in the projInfo object back to their default values
  init();
  //rootPath property inside of projInfo object is reassigned to the inputted rootDirPath
  projInfo.rootPath = rootDirPath;
  //fileTree is assigned the object returned from invoking Director constructor
  //Object returned has the following properties:
  //path, type, name, opened, files, subdirectories, & id
  //The path.basename() methods returns the last portion of a path, in this instance, the folder name
  let fileTree = new Directory(rootDirPath, path.basename(rootDirPath), true);

  //I'm not sure what the purpose of pending is
  let pending = 1;

  //recurseThroughFileTree is called and passed the object that exists at fileTree
  function recurseThroughFileTree(directory) {
    //Loop through files and fill files property array
    //fs.readdir reads the contents of a directory
    //entire directory exists at directory.path
    fs.readdir(directory.path, (err, files) => {

      //I'm not sure what the purpose of pending is
      pending += files.length;

      //this conditional is assessing pending after it's decremented to see if it's a false/falsy value
      //should only be true after being decremented several times
      if (!--pending) {
        //if it is, we call writeFileSync and pass the file stored at projInfoPath
        //we write the stringified value of projInfo to whatever file exists at projInfoPath
        fs.writeFileSync(projInfoPath, JSON.stringify(projInfo));
        //inputted callback to getTree is then fired and passed the fileTree object
        callback(fileTree);
      }
      //files is an array of files that exist in the directory passed to the fs.readdir method
      //forEach is used to iterate over that array
      files.forEach((file) => {
        //filePath uses path.join() to join the path and file names together
        const filePath = path.join(directory.path, file);
        //fs.stat is a method that checks for file details associated with the inputted file
        //if status is good, it's details are available at the 'stats' variable
        fs.stat(filePath, (err, stats) => {
          if (err) {
            //this conditional is assessing pending after it's decremented to see if it's a false/falsy value
            //should only be true after being decremented several times
            if (!--pending) {
              //if it is, we call writeFileSync and pass the file stored at projInfoPath
              //we write the stringified value of projInfo to whatever file exists at projInfoPath
              fs.writeFileSync(projInfoPath, JSON.stringify(projInfo));
              //inputted callback to getTree is then fired and passed the fileTree object
              callback(fileTree);
            }
          }
          //checks if stats is true or truthy & stats.isFile() resolves to true
          if (stats && stats.isFile()) {
            //insertSorted pushes an object into the directory.files array
            //object pushed into the array has the following parameters:
            //path, type, name, ext, id
            insertSorted(new File(filePath, file, getFileExt), directory.files);
            //checks if the filePath is the same as the resolved value as path.join(...) & if the file contains the text of webpack.config.js
            if (filePath === path.join(projInfo.rootPath, file) && file.search(/webpack.config.js/) !== -1) {
              //if it does, then we invoke the readFile method to access the data in the file
              fs.readFile(filePath, { encoding: 'utf-8' }, (err, data) => {
                //created a regExp to check for a pattern that matches entry...
                const regExp = new RegExp('entry(.*?),', 'g');
                //file is stringified and then searched for the match assigned to the regExp
                let entry = JSON.stringify(data).match(regExp);

                //?????
                let reactEntry = String(entry[0].split('\'')[1]);
                //reactEntry property inside of the projInfo object is updated to the resolved value of path.join(...)
                projInfo.reactEntry = path.join(projInfo.rootPath, reactEntry);
              })
            }
            //look for index.html not in node_modules, get path
            if (!projInfo.htmlPath && filePath.search(/.*node\_modules.*/) === -1 && file.search(/.*index\.html/) !== -1) {
              projInfo.htmlPath = filePath;
            }
            //look for package.json and see if webpack is installed and react-dev-server is installed
            else if (!projInfo.webpack && file.search(/package.json/) !== -1 && filePath === path.join(projInfo.rootPath, file)) {
              //if projInfo.webpack is false, the file contains package.json, and the filePath matches the resolved value of projInfo.rootPath & file, readFile is invoked and passed the filePath variable
              fs.readFile(filePath, { encoding: 'utf-8' }, (err, data) => {
                //data is parsed into a JS object
                data = JSON.parse(data);
                //checks if the parsed object has a property of react-scripts
                if (data.dependencies['react-scripts']) {
                  //if it does, the property of devServerScript is reassigned to 'start'
                  projInfo.devServerScript = 'start',
                  //if it does, the property of CRA is reassigned to 'true'
                    projInfo.CRA = true;
                  //checks if the parsed object has a property of webpack-dev-server
                } else if (data.devDependencies['webpack-dev-server']) {
                  //if it does, the property of devServerScript is reassigned to 'run dev-server'
                  projInfo.devServerScript = 'run dev-server';
                  // console.log(projInfo.devServerScript, '$$$')
                }
                //checks if data.main is true or truthy
                if (data.main) {
                  //if it is, the mainEntry property is reassigned to the resolved value of path.join(...)
                  projInfo.mainEntry = path.join(filePath, data.main);
                }
              })
            }
            //this conditional is assessing pending after it's decremented to see if it's a false/falsy value
            //should only be true after being decremented several times
            if (!--pending) {
              //if it is, we call writeFileSync and pass the file stored at projInfoPath
              //we write the stringified value of projInfo to whatever file exists at projInfoPath
              fs.writeFileSync(projInfoPath, JSON.stringify(projInfo));
              //inputted callback to getTree is then fired and passed the fileTree object
              callback(fileTree);
            }
          }
          //checks if stats is true or truthy
          else if (stats) {
            //if it is, a const variable is declared and assigned the resolved value of invoking the Diretory constructor and passing it the filePath and file variables
            const subdirectory = new Directory(filePath, file);
            //put directories in front
            insertSorted(subdirectory, directory.subdirectories);
              recurseThroughFileTree(subdirectory);

          }
        })
      })
    })
  }
  //calls recurseThroughFileTree on the newly found subdirectory
  recurseThroughFileTree(fileTree);
  return fileTree;
}

module.exports = { getTree, getCssClassByFileExt, getFileExt };


text:
Theme for gohugo.io sites:
* [https://gohugo.io/](https://gohugo.io/)
* [https://themes.gohugo.io/](https://themes.gohugo.io/)

## Tools

### NPM

We use [NPM](https://www.npmjs.com/) for package management The theme's `.gitignore` file should be kept intact to make sure that all files in the `node_modules` folder are not pushed to the repository.

### Webpack 4+

We use Webpack to manage our asset pipeline. Arguably, Webpack is overkill for this use-case, but we're using it here because once it's set up (which we've done for you), it's really easy to use. If you want to use an external script, just add it via Yarn, and reference it in main.js. You'll find instructions in the js/main.js file.

### PostCSS
PostCSS is just CSS. You'll find `postcss.config.js` in the Webpack.config.js file. There you'll find that we're using [`postcss-import`](https://github.com/postcss/postcss-import) which allows us import css files directly from the node_modules folder, [`postcss-cssnext`](http://cssnext.io/features/) which gives us the power to use upcoming CSS features today. If you miss Sass you can find PostCss modules for those capabilities, too.

### Tachyons

This theme uses the [Tachyons CSS Library](http://tachyons.io/). It's about 15kb gzipped, highly modular, and each class is atomic so you never have to worry about overwriting your styles. It's a great library for themes because you can make most all the style changes you need right in your layouts.

## How to Use

You'll find the commands to run in `package.json`.

For development, you'll need Node with NPM installed:

```
$ npm install

$ npm start

```
This will process both postcss, fonts, and scripts.

For production, instead of `npm start`, run `npm run build,` which will output smaller versions of your files.


text:
class CreateEntries < ActiveRecord::Migration
  def change
    create_table :entries do |t|
      t.string :title

      t.timestamps null: false
    end
  end
end


text:
export interface TodoList {
  id?: string;
  title: string;
}


text:
package gor

type writeCallback func(data []byte)

type TestOutput struct {
	cb writeCallback
}

func NewTestOutput(cb writeCallback) (i *TestOutput) {
	i = new(TestOutput)
	i.cb = cb

	return
}

func (i *TestOutput) Write(data []byte) (int, error) {
	i.cb(data)

	return len(data), nil
}

func (i *TestOutput) String() string {
	return "Test Input"
}


text:
package securitygroup_test

import (
	"code.cloudfoundry.org/cli/cf/api/securitygroups/securitygroupsfakes"
	"code.cloudfoundry.org/cli/cf/configuration/coreconfig"
	"code.cloudfoundry.org/cli/cf/errors"
	"code.cloudfoundry.org/cli/cf/models"
	"code.cloudfoundry.org/cli/cf/requirements"
	"code.cloudfoundry.org/cli/cf/requirements/requirementsfakes"
	testcmd "code.cloudfoundry.org/cli/testhelpers/commands"
	testconfig "code.cloudfoundry.org/cli/testhelpers/configuration"
	testterm "code.cloudfoundry.org/cli/testhelpers/terminal"

	"code.cloudfoundry.org/cli/cf/commandregistry"
	. "code.cloudfoundry.org/cli/testhelpers/matchers"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("security-group command", func() {
	var (
		ui                  *testterm.FakeUI
		securityGroupRepo   *securitygroupsfakes.FakeSecurityGroupRepo
		requirementsFactory *requirementsfakes.FakeFactory
		configRepo          coreconfig.Repository
		deps                commandregistry.Dependency
	)

	updateCommandDependency := func(pluginCall bool) {
		deps.UI = ui
		deps.RepoLocator = deps.RepoLocator.SetSecurityGroupRepository(securityGroupRepo)
		deps.Config = configRepo
		commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("security-group").SetDependency(deps, pluginCall))
	}

	BeforeEach(func() {
		ui = &testterm.FakeUI{}
		requirementsFactory = new(requirementsfakes.FakeFactory)
		securityGroupRepo = new(securitygroupsfakes.FakeSecurityGroupRepo)
		configRepo = testconfig.NewRepositoryWithDefaults()
	})

	runCommand := func(args ...string) bool {
		return testcmd.RunCLICommand("security-group", args, requirementsFactory, updateCommandDependency, false, ui)
	}

	Describe("requirements", func() {
		It("should fail if not logged in", func() {
			requirementsFactory.NewLoginRequirementReturns(requirements.Failing{Message: "not logged in"})
			Expect(runCommand("my-group")).To(BeFalse())
		})

		It("should fail with usage when not provided a single argument", func() {
			requirementsFactory.NewLoginRequirementReturns(requirements.Passing{})
			runCommand("whoops", "I can't believe", "I accidentally", "the whole thing")
			Expect(ui.Outputs()).To(ContainSubstrings(
				[]string{"Incorrect Usage", "Requires an argument"},
			))
		})
	})

	Context("when logged in", func() {
		BeforeEach(func() {
			requirementsFactory.NewLoginRequirementReturns(requirements.Passing{})
		})

		Context("when the group with the given name exists", func() {
			BeforeEach(func() {
				rulesMap := []map[string]interface{}{{"just-pretend": "that-this-is-correct"}}
				securityGroup := models.SecurityGroup{
					SecurityGroupFields: models.SecurityGroupFields{
						Name:  "my-group",
						GUID:  "group-guid",
						Rules: rulesMap,
					},
					Spaces: []models.Space{
						{
							SpaceFields:  models.SpaceFields{GUID: "my-space-guid-1", Name: "space-1"},
							Organization: models.OrganizationFields{GUID: "my-org-guid-1", Name: "org-1"},
						},
						{
							SpaceFields:  models.SpaceFields{GUID: "my-space-guid", Name: "space-2"},
							Organization: models.OrganizationFields{GUID: "my-org-guid-1", Name: "org-2"},
						},
					},
				}

				securityGroupRepo.ReadReturns(securityGroup, nil)
			})

			It("should fetch the security group from its repo", func() {
				runCommand("my-group")
				Expect(securityGroupRepo.ReadArgsForCall(0)).To(Equal("my-group"))
			})

			It("tells the user what it's about to do and then shows the group", func() {
				runCommand("my-group")
				Expect(ui.Outputs()).To(ContainSubstrings(
					[]string{"Getting", "security group", "my-group", "my-user"},
					[]string{"OK"},
					[]string{"Name", "my-group"},
					[]string{"Rules"},
					[]string{"["},
					[]string{"{"},
					[]string{"just-pretend", "that-this-is-correct"},
					[]string{"}"},
					[]string{"]"},
					[]string{"#0", "org-1", "space-1"},
					[]string{"#1", "org-2", "space-2"},
				))
			})

			It("tells the user if no spaces are assigned", func() {
				securityGroup := models.SecurityGroup{
					SecurityGroupFields: models.SecurityGroupFields{
						Name:  "my-group",
						GUID:  "group-guid",
						Rules: []map[string]interface{}{},
					},
					Spaces: []models.Space{},
				}

				securityGroupRepo.ReadReturns(securityGroup, nil)

				runCommand("my-group")

				Expect(ui.Outputs()).To(ContainSubstrings(
					[]string{"No spaces assigned"},
				))
			})
		})

		It("fails and warns the user if a group with that name could not be found", func() {
			securityGroupRepo.ReadReturns(models.SecurityGroup{}, errors.New("half-past-tea-time"))
			runCommand("im-late!")

			Expect(ui.Outputs()).To(ContainSubstrings([]string{"FAILED"}))
		})
	})
})


text:
module Main where

import Csound.Base

volume      = text "volume"
frequency   = text "frequency"

instr = do
    vol <- chnGetCtrl volume
    cps <- chnGetCtrl frequency
    return (vol * osc cps)

main = writeCsd "osc.csd" instr


text:
layout: single
title:  "Architecture"
sidebar:
  nav: reference
---

{% include toc %}

## Spinnaker Microservices

Spinnaker is composed of a number of independent microservices:

1. [Deck](https://github.com/spinnaker/deck) is the browser-based UI.

1. [Gate](https://github.com/spinnaker/gate) is the API gateway. The Spinnaker UI and all api callers communicate with Spinnaker via Gate.

1. [Orca](https://github.com/spinnaker/orca) is the orchestration engine. It handles all ad-hoc operations and pipelines.

1. [Clouddriver](https://github.com/spinnaker/clouddriver) is responsible for all mutating calls to the cloud providers and for indexing/caching all deployed
resources.

1. [Front50](https://github.com/spinnaker/front50) is used to persist the metadata of applications, pipelines, projects and notifications.

1. [Rosco](https://github.com/spinnaker/rosco) is the bakery. It is used to produce machine images
(e.g. [GCE images](https://cloud.google.com/compute/docs/images), [AWS AMIs](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html),
[Azure VM images](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/classic/about-images)). It presently wraps [packer](https://www.packer.io/),
but will shortly be expanded to support additional mechanisms for producing images.

1. [Igor](https://github.com/spinnaker/igor) is used to trigger pipelines via continuous integration jobs in systems like Jenkins and Travis, and to allow for
Jenkins/Travis stages to be used in pipelines.

1. [Echo](https://github.com/spinnaker/echo) is Spinnaker's eventing bus. It supports sending notifications (e.g. Slack, email, Hipchat, SMS), and act on incoming webhooks from services like Github.

1. [Fiat](https://github.com/spinnaker/fiat) is Spinnaker's authorization service. It is used to query a user's access permissions for accounts, applications
and service accounts.

1. [Halyard](https://github.com/spinnaker/halyard) is Spinnaker's configuration service. Halyard manages the lifecycle of each of the above services. It only interacts with the above services during Spinnaker startup, updates, and rollbacks.

## System Dependency Graph

<div class="mermaid">
graph TB

deck(Deck) --> gate;
api(Custom Script/API Caller) --> gate(Gate);

gate --> orca(Orca);
gate --> clouddriver(Clouddriver);
orca --> clouddriver;
gate --> rosco(Rosco);
orca --> front50;
gate --> front50(Front50);
gate --> fiat(Fiat);
clouddriver --> fiat;
orca --> fiat;
front50 --> fiat;
echo(Echo) --> orca;
echo --> front50;
igor(Igor) --> echo;

classDef default fill:#d8e8ec,stroke:#39546a;
linkStyle default stroke:#39546a,stroke-width:2px,fill:none;

classDef external fill:#c0d89d,stroke:#39546a;
class deck,api external
</div>

The diagram above represents which microservices depend on each other. The green boxes represent
"external" components, including Deck, the single-page JavaScript application that runs in your
browser.

{% include mermaid %}

A filled cell indicates that the system listed in the heading of that column has a dependency on the system listed in the heading of that row. As all Spinnaker
services can be run in their own server group, it is typical for services to resolve their dependencies via load balancers or discovery systems (e.g.
[Eureka](https://github.com/Netflix/eureka) or [Consul](https://www.consul.io/)).

![](graph.png)

## Port mappings

By default Spinnaker binds ports according to the following table

| Service     | Port              |
| :---------- | :---------------- |
| Deck        | 9000              |
| Gate        | 8084              |
| Orca        | 8083              |
| Clouddriver | 7002              |
| Front50     | 8080              |
| Rosco       | 8087              |
| Igor        | 8088              |
| Echo        | 8089              |
| Fiat        | 7003              |


text:
package org.simpleflatmapper.jdbc.test;

import org.junit.Test;
import org.simpleflatmapper.jdbc.JdbcMapper;
import org.simpleflatmapper.jdbc.JdbcMapperBuilder;
import org.simpleflatmapper.jdbc.JdbcMapperFactory;
import org.simpleflatmapper.test.jdbc.DbHelper;

import java.sql.*;
import java.util.Iterator;
import java.util.List;

import static junit.framework.TestCase.assertNotNull;
import static junit.framework.TestCase.assertTrue;

public class Issue670CaseSensitiveListTest {
    private static final String query =
            "with t (id, linkBList_id, linkBList_linkc_id, linkBList_linkC_id ) as (values('aa', 'bb', 'cc', 'cc')) select * from t";

    @Test
    public void minimalTest() throws Exception {
        final JdbcMapperFactory mapperFactory = JdbcMapperFactory.newInstance()
                .useAsm(false)
                .ignorePropertyNotFound()
                .addKeys("linkBList_linkC_id");

        JdbcMapperBuilder<Root> builder = mapperFactory.newBuilder(Root.class);
        builder.addMapping("linkBList_linkc_id");
        builder.addMapping("linkBList_linkC_id");
        JdbcMapper<Root> mapper = builder.mapper();

        testMapper(mapper);
    }

    @Test
    public void failing() throws SQLException {
        final JdbcMapperFactory mapperFactory = JdbcMapperFactory.newInstance()
                .useAsm(false)
                .ignorePropertyNotFound()
                .addKeys("id", "linkBList_id", "linkBList_linkC_id");

        JdbcMapper<Root> mapper = setUpMapper(mapperFactory);
        testMapper(mapper);
    }

    private JdbcMapper<Root> setUpMapper(JdbcMapperFactory mapperFactory) {
        JdbcMapperBuilder<Root> builder = mapperFactory.newBuilder(Root.class);
        builder.addMapping("id");
        builder.addMapping("linkBList_id");
        builder.addMapping("linkBList_linkc_id");
        builder.addMapping("linkBList_linkC_id");
        return builder.mapper();
    }

    @Test
    public void succeeding() throws SQLException {
        final JdbcMapperFactory mapperFactory = JdbcMapperFactory.newInstance()
                .useAsm(false)
                .ignorePropertyNotFound()
                .addKeys("id", "linkBList_id", "linkBList_linkC_id")
                .ignoreColumns("linkBList_linkc_id");

        JdbcMapper<Root> mapper = setUpMapper(mapperFactory);

        testMapper(mapper);
    }

    private void testMapper(JdbcMapper<Root> mapper) throws SQLException {
      Connection conn = DbHelper.getDbConnection(DbHelper.TargetDB.POSTGRESQL);
	if (conn == null) return;
        try {
            PreparedStatement stmt = conn.prepareStatement(query);
            ResultSet rs = stmt.executeQuery();
            Iterator<Root> iterator = mapper.iterator(rs);
            assertTrue(iterator.hasNext());
            final Root found = iterator.next();
            assertNotNull(found);
        } finally {
          conn.close();
        }
    }

    public static class Root {
        private String id;
        private List<Foo> linkBList;

        public Root() {
        }

        public Root(final String id, final List<Foo> linkBList) {
            this.id = id;
            this.linkBList = linkBList;
        }
    }

    public static class Foo {
        private String id;
        private Bar linkC;

        public Foo() {
        }

        public Foo(final String id, final Bar linkC) {
            this.id = id;
            this.linkC = linkC;
        }
    }

    public static class Bar {
        private String id;

        public Bar() {
        }

        public Bar(final String id) {
            this.id = id;
        }
    }
}


text:
package org.sakaiproject.tool.section.jsf.backingbean;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sakaiproject.section.api.SectionManager.ExternalIntegrationConfig;
import org.sakaiproject.tool.section.decorator.SectionDecorator;
import org.sakaiproject.tool.section.jsf.JsfUtil;

/**
 * Controls the overview page.
 *
 * @author Josh Holtzman
 *
 */
public class OverviewBean extends FilteredSectionListingBean implements Serializable {

	private static final long serialVersionUID = 1L;
	private static final Logger log = LoggerFactory.getLogger(OverviewBean.class);

	private String instructions;
	private boolean externallyManaged;

	private List<SectionDecorator> sectionsToDelete;

	public void init() {
		super.init();
		// Determine whether this course is externally managed
		externallyManaged = getSectionManager().isExternallyManaged(getCourse().getUuid());

		// Generate the instructions for this user for the app in its current state
		if(externallyManaged) {
			if(isSectionAssignable()) {
				instructions = JsfUtil.getLocalizedMessage("overview_instructions_auto_ta");
			} else {
				if(getApplicationConfiguration() == ExternalIntegrationConfig.AUTOMATIC_MANDATORY) {
					instructions = JsfUtil.getLocalizedMessage("overview_instructions_mandatory_auto_instructor");
				} else {
					instructions = JsfUtil.getLocalizedMessage("overview_instructions_auto_instructor");
				}
			}
		} else {
			instructions = "";
		}
	}

	protected Comparator<SectionDecorator> getComparator() {
		String sortColumn = getPrefs().getOverviewSortColumn();
		boolean sortAscending = getPrefs().isOverviewSortAscending();

		if("title".equals(sortColumn)) {
			return SectionDecorator.getTitleComparator(sortAscending);
		} else if("managers".equals(sortColumn)) {
			return SectionDecorator.getManagersComparator(sortAscending);
		} else if("totalEnrollments".equals(sortColumn)) {
			return SectionDecorator.getEnrollmentsComparator(sortAscending, false);
		} else if("available".equals(sortColumn)) {
			return SectionDecorator.getEnrollmentsComparator(sortAscending, true);
		} else if("meetingDays".equals(sortColumn)) {
			return SectionDecorator.getDayComparator(sortAscending);
		} else if("meetingTimes".equals(sortColumn)) {
			return SectionDecorator.getTimeComparator(sortAscending);
		} else if("location".equals(sortColumn)) {
			return SectionDecorator.getLocationComparator(sortAscending);
		}
		log.error("Invalid sort specified.");
		return null;
	}

	public String confirmDelete() {
		sectionsToDelete = new ArrayList<SectionDecorator>();
		for(Iterator<SectionDecorator> iter = sections.iterator(); iter.hasNext();) {
			SectionDecorator decoratedSection = iter.next();
			if(decoratedSection.isFlaggedForRemoval()) {
				sectionsToDelete.add(decoratedSection);
			}
		}
		if(sectionsToDelete.isEmpty()) {
			JsfUtil.addErrorMessage(JsfUtil.getLocalizedMessage("overview_delete_section_choose"));
			return null; // Don't go anywhere
		} else {
			return "deleteSections";
		}
	}

	public String deleteSections() {
		Set<String> set = new HashSet<String>();
		for(Iterator<SectionDecorator> iter = sectionsToDelete.iterator(); iter.hasNext();) {
			set.add(iter.next().getUuid());
		}
		getSectionManager().disbandSections(set);
		JsfUtil.addRedirectSafeInfoMessage(JsfUtil.getLocalizedMessage("overview_delete_section_success"));
		return "overview";
	}
	public boolean isDeleteRendered() {
		return (!externallyManaged) && sections.size() > 0 && isSectionManagementEnabled();
	}

	public boolean isExternallyManaged() {
		return externallyManaged;
	}

	public List getSectionsToDelete() {
		return sectionsToDelete;
	}

	@Override
	public String getSortColumn() {
		return getPrefs().getOverviewSortColumn();
	}

	@Override
	public boolean isSortAscending() {
		return getPrefs().isOverviewSortAscending();
	}

	@Override
	public void setSortAscending(boolean sortAscending) {
		getPrefs().setOverviewSortAscending(sortAscending);
	}

	@Override
	public void setSortColumn(String sortColumn) {
		getPrefs().setOverviewSortColumn(sortColumn);
	}

	@Override
	public String getCategoryFilter() {
		return getPrefs().getOverviewCategoryFilter();
	}

	@Override
	public String getMyFilter() {
		return getPrefs().getOverviewMyFilter();
	}

	@Override
	public void setCategoryFilter(String categoryFilter) {
		getPrefs().setOverviewCategoryFilter(categoryFilter);
	}

	@Override
	public void setMyFilter(String myFilter) {
		getPrefs().setOverviewMyFilter(myFilter);
	}

	public String getInstructions() {
		return instructions;
	}
}


text:
<?php

return array(

	// Index method
	'welcome_text' => 'Willkommen',
	'welcome_message' => '
		Hallo, willkommen im welcome-Controller!

		Dieser Inhalt kann in /app/views/welcome/welcome.php geändert werden.
	',

	// Subpage method
	'subpage_text' => 'Subpage',
	'subpage_message' => '
		Hallo, willkommen im welcome-Controller und der subpage-Methode!

		Dieser Inhalt kann in /app/views/welcome/subpage.php geändert werden.
	',

	// Buttons
	'open_subpage' => 'Subpage öffnen',
	'back_home' => 'Home',

);


text:
require 'arjdbc/jdbc'

# This is no longer required and furthermore an error since AR-JDBC 1.2.5
# jdbc_require_driver 'jdbc/sybase'

require 'arjdbc/sybase/connection_methods'
require 'arjdbc/sybase/adapter'

# This is to load the Java parts from their jar
require 'arjdbc/sybase/sybase_java'


text:
<!DOCTYPE html>

    <link href="css/awsdocs.css" rel="stylesheet" type="text/css">

    <meta charset="utf-8">

Amazon Kinesis Data Analytics Application PropertyGroup

The
                        PropertyGroup property type specifies property key-value pairs passed into a Java-based Kinesis
                        Data Analytics application.

                        PropertyGroup is a property of the EnvironmentProperties property.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{
  "PropertyMap" : Json,
  "PropertyGroupId" : String
}

YAML

PropertyMap: Json
PropertyGroupId: String

Properties

PropertyMap

Describes the value of an application execution property key-value pair.

                                 Required: No

                                 Type: Json

                                 Update requires:

                                 No interruption

PropertyGroupId

Describes the key of an application execution property key-value pair.

                                 Required: No

                                 Type: String

                                 Update requires:

                                 No interruption


text:
class AddTermsAcceptedToUser < ActiveRecord::Migration[5.1]
  def change
    add_column :users, :tos_accepted, :boolean
  end
end


text:
void f() {
    boost::contract::check c = boost::contract::function()
        .except([] {})
        .precondition([] {}) // Error (pre after except).
    ;
}

int main() {
    f();
    return 0;
}


text:
package cc.factorie.app.nlp.hcoref

import cc.factorie.infer.{Proposal, SettingsSampler}
import cc.factorie.variable.{DiffList, SettingIterator}

import scala.collection.mutable

trait Verbosity {
  var samplingStep:Int = 0
  var deltaScore:Double = 0.0

  def dScoreString = "%.5f".format(deltaScore)
  var prec:Double = 0.0
  var recall:Double = 0.0
  var fOne:Double = 0.0

  var srcId:String =""
  var srcIsMent:Boolean = false
  var srcIsEnt:Boolean = false
  var srcBagSize:Int = 0
  var srcDepth:Int = 0
  var srcMentionCount:Int = 0

  var dstId:String = ""
  var dstIsMent:Boolean = false
  var dstIsEnt:Boolean = false
  var dstBagSize:Int = 0
  var dstDepth:Int = 0
  var dstMentionCount:Int = 0

  var moveType:String = ""
  var consideredBefore:Boolean = false
  var accepted:Boolean = false

  var newParentId:String = ""

  var numEnts:Int = 0
  var numSubEnts:Int = 0

  def writeOut:String = s"$samplingStep\t$moveType\t$srcId\t$dstId\t$newParentId\t$dScoreString\t$prec\t$recall\t$fOne\t$accepted\t$consideredBefore\t$srcDepth\t$dstDepth\t$srcBagSize\t$dstBagSize\t$srcMentionCount\t$dstMentionCount\t$srcIsMent\t$dstIsMent\t$srcIsEnt\t$dstIsEnt\t$numEnts\t$numSubEnts"
}
object Verbosity {
  def header:String = "Sampling Steps\tMove Type\tSource Id\tDest Id\tNew Parent Id\tDelta Model Score\tPrecision\tRecall\tF1\tAccepted?\tConsidered Before?\tSource Depth\tDest Depth\tSource Bag Size\tDest Bag Size\tSource Mention Count\t Dest MentionCount\tSource Mention?\tDest Mention?\tSource Entity?\t Dest Entity?\tNumber of Entities\tNumber of Sub-Entities"

}

trait VerboseSettingIterator extends SettingIterator {
  override def newDiffList: DiffList = new DiffList with Verbosity
}

trait VerboseMove[Vars <: NodeVariables[Vars]] extends Move[Vars] {

  def getBagSize(n:Node[Vars]):Int

  override abstract def operation(node1:Node[Vars], node2:Node[Vars])(d:DiffList):DiffList = {
    d match {
      case v:Verbosity =>
        v.srcId = node2.uniqueId.toString
        v.srcDepth = node2.depth - 1
        v.srcBagSize = getBagSize(node2)
        v.srcIsEnt = node2.isRoot
        v.srcIsMent = node2.isMention
        v.srcMentionCount = node2.mentionCountVar.value

        v.dstId = node1.uniqueId.toString
        v.dstDepth = node1.depth - 1
        v.dstBagSize = getBagSize(node1)
        v.dstIsEnt = node1.isRoot
        v.dstIsMent = node1.isMention
        v.dstMentionCount = node1.mentionCountVar.value

        v.moveType = this.name

      case _ => println("Difflist not Verbosity: %s (in move %s)".format(d, this.name))
    }
    val res = super.operation(node1, node2)(d)
    d match {
      case v:Verbosity =>
        node1.getParent match {
          case Some(p) => v.newParentId = p.uniqueId
          case None => Unit
        }
      case _ => Unit
    }
    res
  }
}

trait VerboseMoveGenerator[Vars <: NodeVariables[Vars]] extends MoveGenerator[Vars] {
  this :SettingsSampler[(Node[Vars], Node[Vars])] =>

  def outerGetBagSize(n:Node[Vars]):Int

  def settings(c:(Node[Vars], Node[Vars])) = new VerboseSettingIterator with MoveSettingIterator[Vars] {
    var (e1, e2) = c

    val moves = new scala.collection.mutable.ArrayBuffer[Move[Vars]]()

    if(e1.root != e2.root) {
      if(e1.isMention && e1.isRoot && e2.isMention && e2.isRoot) {
        moves += new MergeUp[Vars](e1, e2)({d => newInstance(d)})
      } else if(e1.isMention && e2.isMention) {
        if(e1.parent != null) {
          moves += new MergeLeft[Vars](e1.parent, e2)
        }
        if(e2.parent != null) {
          moves += new MergeLeft[Vars](e2.parent, e1)
        }
      } else {
        while (e1 != null) {
          if(e1.mentionCountVar.value >= e2.mentionCountVar.value && !e1.isMention) {
            moves += new MergeLeft[Vars](e1, e2)
          } else {
            if(e2.isMention) { // we should only be here if e2 has a parent
              moves += new MergeLeft[Vars](e2.parent, e1)
            } else {
              moves += new MergeLeft[Vars](e2, e1)
            }
          }
          e1 = e1.getParent.getOrElse(null.asInstanceOf[Node[Vars]])
        }
      }
    } else {
      if(e1.mentionCountVar.value > e2.mentionCountVar.value) {
        moves += new SplitRight[Vars](e2, e1) with VerboseMove[Vars] {def getBagSize(n:Node[Vars]) = outerGetBagSize(n)}
      } else {
        moves += new SplitRight[Vars](e1, e2) with VerboseMove[Vars] {def getBagSize(n:Node[Vars]) = outerGetBagSize(n)}
      }
    }

    moves += new NoMove[Vars] with VerboseMove[Vars] {def getBagSize(n:Node[Vars]) = outerGetBagSize(n)}
  }
}

trait VerboseSampler[C] {
  this: SettingsSampler[C] =>

  private val _verbosities = new mutable.ArrayBuffer[Verbosity]()
  def verbosities:Iterable[Verbosity] = _verbosities
  private var numSamples = 0

  override def proposals(context:C): Seq[Proposal[C]] = {
    val result = new mutable.ArrayBuffer[Proposal[C]]
    // the call to 'next' is actually what causes the change in state to happen
    var i = 0
    val si = settings(context)
    while (si.hasNext) {
      val d = si.next()
      assert(model ne null) // TODO!!! Clean up and delete this
      val (m,o) = d.scoreAndUndo(model, objective)
      d match {
        case v:Verbosity => {
          v.deltaScore = m
          v.samplingStep = numSamples
        }
        case _ => println("Difflist not Verbosity: %s (In Proposal)".format(d))
      }
      //if (proposalsCache.length == i) proposalsCache.append(null)
      result += new Proposal(d, m, o, m/temperature, context)
      i += 1
    }
    result
  }

  override def processProposals(props: Seq[Proposal[C]]): DiffList = {
    if (props.size == 0 && skipEmptyProposals) return newDiffList
    proposalsHook(props)
    val proposal = props.size match {
      case 0 => throw new Error("No proposals created.")
      case 1 => props.head
      case _ => {
        val p = pickProposal(props)
        p.diff match {
          case v:Verbosity => v.accepted = true
          case _ => println("Difflist not Verbosity: %s (In Proposal)".format(p.diff))
        }
        //p.diff.asInstanceOf[Verbosity].accepted = true
        p
      }
    }
    props.filter(_.diff.size != 0).foreach { prop =>
      prop.diff match {
        case v:Verbosity =>
          if(!v.accepted) {
            v.newParentId = ""
          }
          _verbosities += v

        case _ => Unit
      }
    }
    numSamples += 1
    proposal.diff.redo()
    proposalHook(proposal)
    proposal.diff
  }
}


text:
package org.kie.dockerui.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import org.kie.dockerui.client.service.DockerService;
import org.kie.dockerui.client.service.DockerServiceAsync;
import org.kie.dockerui.shared.model.KieContainer;
import org.kie.dockerui.shared.model.KieImage;
import org.kie.dockerui.shared.model.KieListCommandResponse;

import java.util.List;

public class KieClientManager {
    private static KieClientManager instance;
    private final DockerServiceAsync dockerService = GWT.create(DockerService.class);

    private List<KieImage> images;
    private List<KieContainer> containers;

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

    public KieClientManager() {

    }

    public void reload(final KieClientManagerCallback callback) {
        dockerService.list(new AsyncCallback<KieListCommandResponse>() {
            @Override
            public void onFailure(final Throwable caught) {
                if (callback != null) callback.onFailure(caught);
            }

            @Override
            public void onSuccess(final KieListCommandResponse result) {
                KieClientManager.this.containers = result.getContainers();
                KieClientManager.this.images = result.getImages();
                if (callback != null) callback.onSuccess();
            }
        });
    }

    public List<KieImage> getImages() {
        return images;
    }

    public List<KieContainer> getContainers() {
        return containers;
    }

    public interface KieClientManagerCallback {
        void onFailure(final Throwable caught);
        void onSuccess();
    }
}


text:
export PYTHONPATH=$PYTHONPATH:`pwd`
nosetests tests


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

<title>de.unihannover.se.iviewxjava.core.receiver.stabilization (iviewx-java 1.0.0 API)</title>
<meta name="date" content="2017-06-28">
<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style">

de.unihannover.se.iviewxjava.core.receiver.stabilization

Interfaces

ETStabilizationStrategy

Classes

ETDefaultStabilizationStrategy


text:
"""
Tools and Utilities
"""

def _transform_int(one, two, steps):
    delta = (two - one) / (steps -1)
    one -= delta
    while steps > 0:
        steps -= 1
        one += delta
        yield int(one)

def transform_rgb(rgb_first, rgb_last, steps):
    "Return a sequence of rgb's that go from first to last in given steps."
    rgb_sequence = zip(
        _transform_int(rgb_first[0], rgb_last[0], steps),
        _transform_int(rgb_first[1], rgb_last[1], steps),
        _transform_int(rgb_first[2], rgb_last[2], steps)
    )
    return rgb_sequence


text:
Collection of open-sourced Flax models.

These models are similar to the examples included in Flax's main repository:
https://github.com/google/flax/tree/master/examples

While Flax examples adhere to guidelines described in
[Github issue #231](https://github.com/google/flax/issues/231), the code
examples in this directory do not necessarily tick all the checkboxes, have
somewhat more variance in style, and are not covered by Flax presubmit checks.


text:
package org.openas2.lib.util;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

public class GeneralUtil {

    public static String convert(Object[] array, String delimiter) {
        StringBuffer buffer = new StringBuffer();
        for (int i = 0; i < array.length; i++) {
            if (buffer.length() > 0) {
                buffer.append(delimiter);
            }
            buffer.append(array[i].toString());
        }

        return buffer.toString();
    }

    public static boolean contains(String[] array, String value) {
        for (int i = 0; i < array.length; i++) {
            if (array[i] == null) {
                if (value == null) {
                    return true;
                }
            } else if (value != null && array[i].equals(value)) {
                return true;
            }
        }
        return false;
    }

    public static String[] convert(Enumeration en) {
        List list = Collections.list(en);
        return convert(list);
    }

    public static String[] convert(List list) {
	    String[] values = new String[0];
		return (String[]) list.toArray(values);
	}

    public static String convert(List list, String delimiter) {
        return convert(list.toArray(), delimiter);
    }

    public static String[] convertKeys(Map map) {
        String[] keys = new String[0];
        return (String[]) map.keySet().toArray(keys);
    }

    public static String convert(Map map, String valueDelimiter, String pairDelimiter) {
		StringBuffer strBuf = new StringBuffer();
		Iterator it = map.entrySet().iterator();
		Map.Entry entry;
		while (it.hasNext()) {
			entry = (Map.Entry) it.next();
			strBuf.append(entry.getKey().toString()).append(valueDelimiter);
			strBuf.append(entry.getValue().toString());
			if (it.hasNext()) {
			    strBuf.append(pairDelimiter);
			}
		}
		return strBuf.toString();
	}

    public static String convertTrace(Exception e) {
        StringWriter writer = new StringWriter();
        e.printStackTrace(new PrintWriter(writer));
        return writer.toString();
    }

    public static Object getKey(Map map, Object value) {
        Iterator it = map.entrySet().iterator();
        Map.Entry entry;
        Object currentValue;
        while (it.hasNext()) {
            entry = (Map.Entry) it.next();
            currentValue = entry.getValue();
            if (currentValue == null && value == null) {
                return entry.getKey();
            } else if (currentValue != null && currentValue.equals(value)) {
                return entry.getKey();
            }
        }
        return null;
    }
}


text:
//// [functionAndPropertyNameConflict.ts]
class C65 {
    public aaaaa() { }
    public get aaaaa() {
        return 1;
    }
}

//// [functionAndPropertyNameConflict.js]
var C65 = /** @class */ (function () {
    function C65() {
    }
    C65.prototype.aaaaa = function () { };
    Object.defineProperty(C65.prototype, "aaaaa", {
        get: function () {
            return 1;
        },
        enumerable: false,
        configurable: true
    });
    return C65;
}());


text:
package org.apache.commons.math.distribution;

import java.io.Serializable;

import org.apache.commons.math.MathException;
import org.apache.commons.math.special.Beta;
import org.apache.commons.math.util.MathUtils;

/**
 * The default implementation of {@link PascalDistribution}.
 * @version $Revision: 617953 $ $Date: 2008-02-02 22:54:00 -0700 (Sat, 02 Feb 2008) $
 * @since 1.2
 */
public class PascalDistributionImpl extends AbstractIntegerDistribution
    implements PascalDistribution, Serializable {

    /** Serializable version identifier */
    private static final long serialVersionUID = 6751309484392813623L;

    /** The number of successes */
    private int numberOfSuccesses;

    /** The probability of success */
    private double probabilityOfSuccess;

    /**
     * Create a binomial distribution with the given number of trials and
     * probability of success.
     * @param r the number of successes
     * @param p the probability of success
     */
    public PascalDistributionImpl(int r, double p) {
        super();
        setNumberOfSuccesses(r);
        setProbabilityOfSuccess(p);
    }

    /**
     * Access the number of successes for this distribution.
     * @return the number of successes
     */
    public int getNumberOfSuccesses() {
        return numberOfSuccesses;
    }

    /**
     * Access the probability of success for this distribution.
     * @return the probability of success
     */
    public double getProbabilityOfSuccess() {
        return probabilityOfSuccess;
    }

    /**
     * Change the number of successes for this distribution.
     * @param successes the new number of successes
     * @throws IllegalArgumentException if successes is not
     *         positive.
     */
    public void setNumberOfSuccesses(int successes) {
        if (successes < 0) {
            throw new IllegalArgumentException(
                "number of successes must be non-negative.");
        }
        numberOfSuccesses = successes;
    }

    /**
     * Change the probability of success for this distribution.
     * @param p the new probability of success
     * @throws IllegalArgumentException if p is not a valid
     *         probability.
     */
    public void setProbabilityOfSuccess(double p) {
        if (p < 0.0 || p > 1.0) {
            throw new IllegalArgumentException(
                "probability of success must be between 0.0 and 1.0, inclusive.");
        }
        probabilityOfSuccess = p;
    }

    /**
     * Access the domain value lower bound, based on p, used to
     * bracket a PDF root.
     * @param p the desired probability for the critical value
     * @return domain value lower bound, i.e. P(X < lower bound) <
     *         p
     */
    protected int getDomainLowerBound(double p) {
        return -1;
    }

    /**
     * Access the domain value upper bound, based on p, used to
     * bracket a PDF root.
     * @param p the desired probability for the critical value
     * @return domain value upper bound, i.e. P(X < upper bound) >
     *         p
     */
    protected int getDomainUpperBound(double p) {
        // use MAX - 1 because MAX causes loop
        return Integer.MAX_VALUE - 1;
    }

    /**
     * For this distribution, X, this method returns P(X ≤ x).
     * @param x the value at which the PDF is evaluated
     * @return PDF for this distribution
     * @throws MathException if the cumulative probability can not be computed
     *         due to convergence or other numerical errors
     */
    public double cumulativeProbability(int x) throws MathException {
        double ret;
        if (x < 0) {
            ret = 0.0;
        } else {
            ret = Beta.regularizedBeta(getProbabilityOfSuccess(),
                getNumberOfSuccesses(), x + 1);
        }
        return ret;
    }

    /**
     * For this distribution, X, this method returns P(X = x).
     * @param x the value at which the PMF is evaluated
     * @return PMF for this distribution
     */
    public double probability(int x) {
        double ret;
        if (x < 0) {
            ret = 0.0;
        } else {
            ret = MathUtils.binomialCoefficientDouble(x +
                  getNumberOfSuccesses() - 1, getNumberOfSuccesses() - 1) *
                  Math.pow(getProbabilityOfSuccess(), getNumberOfSuccesses()) *
                  Math.pow(1.0 - getProbabilityOfSuccess(), x);
        }
        return ret;
    }

    /**
     * For this distribution, X, this method returns the largest x, such that
     * P(X ≤ x) ≤ p.
     *

     * Returns -1 for p=0 and Integer.MAX_VALUE
     * for p=1.

     * @param p the desired probability
     * @return the largest x such that P(X ≤ x) <= p
     * @throws MathException if the inverse cumulative probability can not be
     *         computed due to convergence or other numerical errors.
     * @throws IllegalArgumentException if p < 0 or p > 1
     */
    public int inverseCumulativeProbability(final double p)
        throws MathException {
        int ret;

        // handle extreme values explicitly
        if (p == 0) {
            ret = -1;
        } else if (p == 1) {
            ret = Integer.MAX_VALUE;
        } else {
            ret = super.inverseCumulativeProbability(p);
        }

        return ret;
    }
}


text:
<?php

namespace Meccado\ArticleAdmin\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

abstract class Request extends FormRequest
{
    //
}


text:
layout: default
title: Contact Long Haul
---

Contact Me

  <form action="http://formspree.io/rpuscas94@gmail.com" method="post">
    Name
    <input type="text" id="name" name="name" class="full-width">

    Email Address
    <input type="email" id="email" name="_replyto" class="full-width">

    Message
    <textarea name="message" id="message" cols="30" rows="10" class="full-width"></textarea>

    <input type="submit" value="Send" class="button">
  </form>


text: create/cancel repeat jobs


text:
package com.qianjia.douyu.util;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

import com.qianjia.douyu.App;

/**
 * Created by Jiansion on 2017/5/2.
 * 判断网络工具类
 */

public class NetworkUtil {
    /**
     * 获取活动网络信息
     *
需添加权限 {@code <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>}

     *
     * @return NetworkInfo
     */
    private static NetworkInfo getActiveNetworkInfo() {
        return ((ConnectivityManager) App.getInstance().getSystemService(Context.CONNECTIVITY_SERVICE)).getActiveNetworkInfo();
    }

    /**
     * 判断网络是否连接
     *
需添加权限 {@code <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>}

     *
     * @return {@code true}: 是
{@code false}: 否
     */
    public static boolean isConnected() {
        NetworkInfo info = getActiveNetworkInfo();
        return info != null && info.isConnected();
    }
}


text:
<?php

namespace RummyKhan\Socialite\Two;

class FacebookProvider extends AbstractProvider implements ProviderInterface
{
    /**
     * The base Facebook Graph URL.
     *
     * @var string
     */
    protected $graphUrl = 'https://graph.facebook.com';

    /**
     * The Graph API version for the request.
     *
     * @var string
     */
    protected $version = 'v2.5';

    /**
     * The user fields being requested.
     *
     * @var array
     */
    protected $fields = ['first_name', 'last_name', 'email', 'gender', 'verified'];

    /**
     * The scopes being requested.
     *
     * @var array
     */
    protected $scopes = ['email'];

    /**
     * Display the dialog in a popup view.
     *
     * @var bool
     */
    protected $popup = false;

    /**
     * {@inheritdoc}
     */
    protected function getAuthUrl($state)
    {
        return $this->buildAuthUrlFromBase('https://www.facebook.com/'.$this->version.'/dialog/oauth', $state);
    }

    /**
     * {@inheritdoc}
     */
    protected function getTokenUrl()
    {
        return $this->graphUrl.'/oauth/access_token';
    }

    /**
     * Get the access token for the given code.
     *
     * @param  string  $code
     * @return string
     */
    public function getAccessToken($code)
    {
        $response = $this->getHttpClient()->get($this->getTokenUrl(), [
            'query' => $this->getTokenFields($code),
        ]);

        return $this->parseAccessToken($response->getBody());
    }

    /**
     * {@inheritdoc}
     */
    protected function parseAccessToken($body)
    {
        parse_str($body);

        return $access_token;
    }

    /**
     * {@inheritdoc}
     */
    protected function getUserByToken($token)
    {
        $appSecretProof = hash_hmac('sha256', $token, $this->clientSecret);

        $response = $this->getHttpClient()->get($this->graphUrl.'/'.$this->version.'/me?access_token='.$token.'&appsecret_proof='.$appSecretProof.'&fields='.implode(',', $this->fields), [
            'headers' => [
                'Accept' => 'application/json',
            ],
        ]);
        return json_decode($response->getBody(), true);
    }

    /**
     * {@inheritdoc}
     */
    protected function mapUserToObject(array $user)
    {

        $avatarUrl = $this->graphUrl.'/'.$this->version.'/'.$user['id'].'/picture';

        $firstName = isset($user['first_name']) ? $user['first_name'] : null;

        $lastName = isset($user['last_name']) ? $user['last_name'] : null;

        return (new User)->setRaw($user)->map([
            'id' => $user['id'], 'nickname' => null, 'name' => $firstName.' '.$lastName,
            'email' => isset($user['email']) ? $user['email'] : null, 'avatar' => $avatarUrl.'?type=normal',
            'avatar_original' => $avatarUrl.'?width=1920',
        ]);
    }

    /**
     * {@inheritdoc}
     */
    protected function getCodeFields($state = null)
    {
        $fields = parent::getCodeFields($state);

        if ($this->popup) {
            $fields['display'] = 'popup';
        }

        return $fields;
    }

    /**
     * Set the user fields to request from Facebook.
     *
     * @param  array  $fields
     * @return $this
     */
    public function fields(array $fields)
    {
        $this->fields = $fields;

        return $this;
    }

    /**
     * Set the dialog to be displayed as a popup.
     *
     * @return $this
     */
    public function asPopup()
    {
        $this->popup = true;

        return $this;
    }
}


text:
(function (context) {

	var WEBSOCKET_HOST = "pooljs.ir";
	var WEBSOCKET_PORT = 12121;
	var WEBSOCKET_ADDRESS = "wss://" + WEBSOCKET_HOST + ":" + WEBSOCKET_PORT;
	var TURBOJS_URL = "https://turbo.github.io/js/turbo.js";

	if(window && "WebSocket" in window && typeof(Worker) !== "undefined") {

		function loadScript(url, callback)
		{
		    var head = document.getElementsByTagName('head')[0];
		    var script = document.createElement('script');
		    script.type = 'text/javascript';
		    script.src = url;
		    script.onload = callback;
		    head.appendChild(script);
		}

		loadScript(TURBOJS_URL,function() {
			if(turbojs) { // Turbo.js has now been loaded!
				// Create a Worker by a function
				function createWorker(foo) {
					var str = foo.toString().match(/^\s*function\s*\(\s*\)\s*\{(([\s\S](?!\}$))*[\s\S])/)[1];
					return new Worker(window.URL.createObjectURL(new Blob([str],{type:'text/javascript'})));
				}

				function now() { return new Date().getTime(); }
				var MAX_SUBPROCESS_TIME = 4000; // Maximum amount of time for a Worker to return the result in miliseconds

				var workerPool = [];
				var subprocesses = [];
				function fillPool() {
					while(workerPool.length < navigator.hardwareConcurrency) {
						var worker = createWorker(function(){
							var self = this;
							var lastProcessId = undefined;
							var fn;
							this.addEventListener("message", function(event) {
								var subprocess = event.data;
								if(subprocess.process_id !== lastProcessId) {
									var src = "fn = " + subprocess.code;
									eval(src);
									lastProcessId = subprocess.process_id;
								}
								var subprocess_result = { "id": subprocess.id, "result": fn.apply(this, subprocess.args), "error": false };
								self.postMessage(subprocess_result);
							}, false);
						});
						worker.subprocessCreatedTime = null;
						worker.subprocess = null;
						workerPool.push(worker);
					}
				}

				fillPool();

				context.worker = {}

				var sock = null;

				function freeWorkersCount() {
					var count = 0;
					for(var i = 0; i < workerPool.length; i++) {
						if(!workerPool[i].subprocess) {
							count++;
						}
					}
					return count;
				}

				// Notify that there is a free Worker to execute a new SubProcess
				function notify() {
					for(var i = 0; i < freeWorkersCount(); i++) {
						var new_subprocess = subprocesses.shift();
						if(new_subprocess)
							balance(new_subprocess,false);
					}
				}

				function response(event,worker) {
					var subprocess_result = event.data;
					worker.subprocessCreatedTime = null;
					worker.subprocess = null;
					sock.send(JSON.stringify(subprocess_result));
					notify(); // The Worker is now free
				}

				function balance(subprocess,isnew) {

					if(isnew && subprocesses.length > 0){ // Older undone SubProcesses have more priority than new SubProcesses
						subprocesses.push(subprocess);
						subprocess = subprocesses.shift();
					}
					var done = false;
					// Find a free Worker and pass a SubProcess to it
					for(var i = 0; i < workerPool.length; i++) {
						var w = workerPool[i];
						if(!w.subprocess) {
							w.subprocessCreatedTime = now();
							w.subprocess = subprocess;
							w.onmessage = function(event) { response(event,w); };
							w.postMessage(subprocess);
							done = true;
							break;
						}
					}
					// If there was no free Worker then push the subprocess in the queue for further execution
					if(!done) {
						subprocesses.push(subprocess);
					}
				}

				// Run GPU Subprocesses via Turbo.js
				var lastGPUProcessId = undefined;
				var lastGPUKernel = undefined;
				function balanceGPU(subprocess) {
					if(subprocess.process_id == lastGPUProcessId)
						subprocess.code = lastGPUKernel;
					else {
						lastGPUProcessId = subprocess.process_id;
						lastGPUKernel = subprocess.code;
					}
					var size = subprocess.args[1] - subprocess.args[0];
					var foo = turbojs.alloc(size * 4);
					for (var i = 0; i < size; i++) foo.data[4*i] = subprocess.args[0] + i;
					var has_error = false;
					try {
						turbojs.run(foo, subprocess.code +
															'void main(void) { ' +
																'commit(f(int(read().r)));' +
															'}');
					} catch(err) {
						has_error = true;
					}
					var res = foo.data.subarray(0,size * 4);
					var arr = [];
					for(var i=0;i<size;i++)
						arr.push([res[4*i],res[4*i+1],res[4*i+2],res[4*i+3]]);
					var subprocess_result = { "id": subprocess.id, "result": has_error?null:arr, "error": has_error };
					sock.send(JSON.stringify(subprocess_result));
				}

				function startSocket() {
					sock = new WebSocket(WEBSOCKET_ADDRESS);

					sock.onopen = function() {
					};

					sock.onmessage = function(event) {
						var subprocess = JSON.parse(event.data);
						if(subprocess.is_GPU)
							balanceGPU(subprocess);
						else
							balance(subprocess,true);
					};

					sock.onclose = function() {
						setTimeout(startSocket,5000);
					};
				}

				startSocket();

				// Kill the Workers running SubProcesses that take too long to respond
				function badSubProcessKiller() {
					for(var i = 0; i < workerPool.length; i++) {
						if(workerPool[i].subprocessCreatedTime) { // If the Worker is busy
							if(now() - workerPool[i].subprocessCreatedTime > MAX_SUBPROCESS_TIME) {
								var w = workerPool[i];
								w.terminate();
								workerPool.splice(i,1);
								if(sock) {
									var subprocess_result = { "id": w.subprocess.id, "result": null, "error": true };
									// Send null as the result of SubProcesses taking too long to respond
									sock.send(JSON.stringify(subprocess_result));
								}
							}
						}
					}
					fillPool(); // Fill the pool as some Workers have been terminated and removed
					notify();
					setTimeout(badSubProcessKiller, MAX_SUBPROCESS_TIME/2);
				}

				badSubProcessKiller();
			}
		});
	}
}(this));


text:
<?xml version="1.0" encoding="UTF-8"?>
<citations>
	<bibl><title level="j">Trends Biomater. Artif. Organs</title>, Vol <biblScope type="vol">18</biblScope> (<biblScope type="issue">2</biblScope>), <date>January 2005</date></bibl>
</citations>


text:
//
//  XMPPIdentity.h
//  Jabber
//
//  Created by David Chisnall on 20/08/2004.
//  Copyright 2004 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "JID.h"
#import <EtoileXML/ETXMLNullHandler.h>
#import "XMPPPresence.h"
#import "XMPPDispatcher.h"

/**
 * A XMPPIdentity represents a unique endpoint in the Jabber network.  Each
 * person may have a collection of identities, corresponding to different client
 * or different means of accessing them (e.g. a pure Jabber ID and a
 * legacy-protocol gateway Jabber ID both of which are used from the same
 * client.
 *
 * This abstraction allows conversations to be tied to people, rather than to
 * clients.  The roster will assume that entries in the same group with the same
 * name correspond to the same person.  Similarly, different resources of the
 * same JID will be treated as different identities belonging to the same
 * person.
 */
@interface XMPPIdentity : ETXMLNullHandler {
	id person;
	JID * jid;
	NSString * subscription;
	NSString * ask;
	NSString * group;
	NSString * name;
	XMPPPresence * presence;
	int priority;
	int basePriority;
}
/**
 * Create a new identity for the specified person.  The name and group should
 * match that of the person.
 */
- (id) initWithJID:(JID*)_jid withName:(NSString*)_name inGroup:(NSString*)_group forPerson:(id)_person;
/**
 * Set the presence of the identity.  Used whenever a presence stanza is
 * received.
 */
- (void) setPresence:(XMPPPresence*)_presence;
/**
 * Return the person with whom this identity is associated.
 */
- (id) person;
/**
 * Set the person with whom this identity is associated.
 */
- (void) person:(id)_person;
/**
 * Return the name of the identity.
 */
- (NSString*) name;
/**
 * Return the roster group of the identity.
 */
- (NSString*) group;
- (void) setName:(NSString*)aName;
- (void) setGroup:(NSString*)aGroup;
/**
 * Return the Jabber ID of the identity.
 */
- (JID*) jid;
/**
 * Return the current presence of the identity.
 */
- (XMPPPresence*) presence;
/**
 * Return the priority associated with the current presence of the identity.
 */
- (int) priority;
/**
 * The type of subscription that the user has to this contact.
 */
- (NSString*) subscription;
/**
 * Type of subscription being requested by this contact.
 */
- (NSString*) ask;
/**
 * Compare two identities by their priority.  Used to determine which should
 * be the default recipient of messages.
 */
- (NSComparisonResult) compareByPriority:(XMPPIdentity*)_other;
/**
 * Compare two identities by their JID.  Commonly used to sort identities for
 * display in a UI.
 */
- (NSComparisonResult) compareByJID:(XMPPIdentity*)_other;
@end


text:
package com.gmail.thelimeglass.Scoreboards;

import org.bukkit.event.Event;
import org.bukkit.scoreboard.Objective;
import org.eclipse.jdt.annotation.Nullable;

import ch.njol.skript.classes.Changer;
import ch.njol.skript.classes.Changer.ChangeMode;
import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.SkriptParser.ParseResult;
import ch.njol.skript.lang.util.SimpleExpression;
import ch.njol.util.Kleenean;
import ch.njol.util.coll.CollectionUtils;

public class ExprObjectiveDisplayName extends SimpleExpression<String>{

	//(score[ ][board]|[skellett[ ]]board) objective display name [of] %objective%
	//(score[ ][board]|[skellett[ ]]board) %objective%['s] objective['s] display name
	//(score[ ][board]|[skellett[ ]]board) objective %objective%['s] display name

	private Expression<Objective> obj;
	@Override
	public Class<? extends String> getReturnType() {
		return String.class;
	}
	@Override
	public boolean isSingle() {
		return true;
	}
	@SuppressWarnings("unchecked")
	@Override
	public boolean init(Expression<?>[] e, int matchedPattern, Kleenean isDelayed, ParseResult parser) {
		obj = (Expression<Objective>) e[0];
		return true;
	}
	@Override
	public String toString(@Nullable Event e, boolean arg1) {
		return "(score[ ][board]|[skellett[ ]]board) objective display name [of] %objective%";
	}
	@Override
	@Nullable
	protected String[] get(Event e) {
		return new String[]{obj.getSingle(e).getDisplayName()};
	}
	@Override
	public void change(Event e, Object[] delta, Changer.ChangeMode mode){
		if (mode == ChangeMode.SET) {
			obj.getSingle(e).setDisplayName((String)delta[0]);
		}
	}
	@Override
	public Class<?>[] acceptChange(final Changer.ChangeMode mode) {
		if (mode == ChangeMode.SET)
			return CollectionUtils.array(String.class);
		return null;
	}
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="blog,python,django,developer">
    <meta name="author" content="Derek Stegelman">

    <title>Derek.Stegelman.Com  | Django By Example</title>

    <link rel="stylesheet" href='http://derek.stegelman.com/assets/bootstrap/css/bootstrap.min.css'>
    <link rel="stylesheet" href='http://derek.stegelman.com/assets/css/main.min.css'>
    <link href='https://fonts.googleapis.com/css?family=Raleway:200italic,200' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href='http://derek.stegelman.com/assets/font-awesome/css/font-awesome.min.css'>
    <link href='assets/css/prisim.min.css' rel='stylesheet' />

    <meta property="og:title" content="Django By Example" />
<meta property="og:description" content="Glad to announce that a book I’ve been doing a technical review for has finally been published and is available on Amazon.
It took about a year from start to finish, but I’m glad to see it finally done and available for purchase." />
<meta property="og:type" content="article" />
<meta property="og:url" content="http://derek.stegelman.com/posts/2015-12-09-django-by-example/" />

<meta property="article:published_time" content="2015-12-09T00:00:00+00:00"/>

<meta property="article:modified_time" content="2015-12-09T00:00:00+00:00"/>

<meta itemprop="name" content="Django By Example">
<meta itemprop="description" content="Glad to announce that a book I’ve been doing a technical review for has finally been published and is available on Amazon.
It took about a year from start to finish, but I’m glad to see it finally done and available for purchase.">

<meta itemprop="datePublished" content="2015-12-09T00:00:00+00:00" />
<meta itemprop="dateModified" content="2015-12-09T00:00:00+00:00" />
<meta itemprop="wordCount" content="43">

<meta itemprop="keywords" content="" />
<meta name="twitter:card" content="summary"/><meta name="twitter:title" content="Django By Example"/>
<meta name="twitter:description" content="Glad to announce that a book I’ve been doing a technical review for has finally been published and is available on Amazon.
It took about a year from start to finish, but I’m glad to see it finally done and available for purchase."/>

Derek Stegelman

                Writing

                Technical Writing

              Thoughts

                About

Django By Example

          <time>December 9, 2015</time>

Glad to announce that a book I’ve been doing a technical review for has finally
been published and is available on Amazon.

It took about a year from start to finish, but I’m glad to see it finally
done and available for purchase.

      Please enable JavaScript to view the comments powered by Disqus.

                                    Colophon

                                    Talks

                                    Hire

                                    Rocketry

                                    Essays

                                    Contact


text:
Making a new Cask is easy. Follow the directions in [Getting Set Up To Contribute](../../CONTRIBUTING.md#getting-set-up-to-contribute) to begin.

### Examples

Here's a Cask for `shuttle` as an example:

```ruby
cask 'shuttle' do
  version '1.2.5'
  sha256 '7df182f506b80011222c0cdd470be76e0376f38e331f3fafbb6af9add3578023'

  url "https://github.com/fitztrev/shuttle/releases/download/v#{version}/Shuttle.zip"
  appcast 'https://github.com/fitztrev/shuttle/releases.atom',
          checkpoint: '9f66dbb98f73f69f4a1759d4bdb8d2552060d599548427740e239ca45185fe5c'
  name 'Shuttle'
  homepage 'https://fitztrev.github.io/shuttle/'
  license :mit

  app 'Shuttle.app'

  zap delete: '~/.shuttle.json'
end
```

And here is one for `gateblu`. Note that it has an unversioned download (the download `url` does not contain the version number, unlike the example above). It also suppresses the checksum with `sha256 :no_check` (necessary since the checksum will change when a new distribution is made available). This combination of `version :latest` and `sha256 :no_check` is currently the preferred mechanism when a versioned download URL is not available. Also note the comment above `url`, which is needed when [the url and homepage hostnames differ](../cask_language_reference/stanzas/url.md#when-url-and-homepage-hostnames-differ-add-a-comment):

```ruby
cask 'gateblu' do
  version :latest
  sha256 :no_check

  # amazonaws.com is the official download host per the vendor homepage
  url 'https://s3-us-west-2.amazonaws.com/gateblu/gateblu-ui/latest/Gateblu.dmg'
  name 'Gateblu'
  homepage 'https://gateblu.octoblu.com'
  license :mit

  pkg 'Gateblu Installer.pkg'

  uninstall pkgutil: 'com.octoblu.*',
            delete: '/Applications/Gateblu.app'
end
```

### Generating a Token for the Cask

The Cask **token** is the mnemonic string people will use to interact with the Cask via `brew cask install`, `brew cask search`, etc. The name of the Cask **file** is simply the token with the extension `.rb` appended.

The easiest way to generate a token for a Cask is to run this command:

```bash
$ "$(brew --repository)/Library/Taps/caskroom/homebrew-cask/developer/bin/generate_cask_token" '/full/path/to/new/software.app'
```

If the software you wish to Cask is not installed, or does not have an associated App bundle, just give the full proper name of the software instead of a pathname:

```bash
$ "$(brew --repository)/Library/Taps/caskroom/homebrew-cask/developer/bin/generate_cask_token" 'Google Chrome'
```

If the `generate_cask_token` script does not work for you, see [Cask Token Details](#cask-token-details).

### The `brew cask create` Command

Once you know the token, create your Cask with the handy-dandy `brew cask create` command:

```bash
$ brew cask create my-new-cask
```

This will open `$EDITOR` with a template for your new Cask, to be stored in the file `my-new-cask.rb`. Running the `create` command above will get you a template that looks like this:

```ruby
cask 'my-new-cask' do
  version ''
  sha256 ''

  url ''
  name ''
  homepage ''
  license :unknown # TODO: change license and remove this comment; ':unknown' is a machine-generated placeholder

  app ''
end
```

### Cask Stanzas

Fill in the following stanzas for your Cask:

| name               | value       |
| ------------------ | ----------- |
| `version`          | application version; give the value `:latest` if only an unversioned download is available
| `sha256`           | SHA-256 checksum of the file downloaded from `url`, calculated by the command `shasum -a 256 <file>`. Can be suppressed by using the special value `:no_check`. (see [sha256](../cask_language_reference/stanzas/sha256.md))
| `url`              | URL to the `.dmg`/`.zip`/`.tgz`/`.tbz2` file that contains the application.
A [comment](../cask_language_reference/stanzas/url.md#when-url-and-homepage-hostnames-differ-add-a-comment) should be added if the hostnames in the `url` and `homepage` stanzas differ. Block syntax should be used for URLs that change on every visit.
See [URL Stanza Details](../cask_language_reference/stanzas/url.md) for more information.
| `name`             | the full and proper name defined by the vendor, and any useful alternate names (see [Name Stanza Details](../cask_language_reference/stanzas/name.md))
| `homepage`         | application homepage; used for the `brew cask home` command
| `license`          | a symbol identifying the license for the application. Valid category licenses include `:oss`, `:closed`, and `:unknown`. It is OK to leave as `:unknown`. (see [License Stanza Details](../cask_language_reference/stanzas/license.md))
| `app`              | relative path to an `.app` bundle that should be moved into the `/Applications` folder on installation (see [App Stanza Details](../cask_language_reference/stanzas/app.md))

Other commonly-used stanzas are:

| name               | value       |
| ------------------ | ----------- |
| `appcast`          | a URL providing an appcast feed to find updates for this Cask. (see [Appcast Stanza Details](../cask_language_reference/stanzas/appcast.md))
| `pkg`              | relative path to a `.pkg` file containing the distribution (see [Pkg Stanza Details](../cask_language_reference/stanzas/pkg.md))
| `caveats`          | a string or Ruby block providing the user with Cask-specific information at install time (see [Caveats Stanza Details](../cask_language_reference/stanzas/caveats.md))
| `uninstall`        | procedures to uninstall a Cask. Optional unless the `pkg` stanza is used. (see [Uninstall Stanza Details](../cask_language_reference/stanzas/uninstall.md))

Additional `artifact` stanzas you might need for special use-cases can be found [here](../cask_language_reference/all_stanzas.md#at-least-one-artifact-stanza-is-also-required). Even more special-use stanzas are listed at [Optional Stanzas](../cask_language_reference/all_stanzas.md#optional-stanzas).

### Cask Token Details

If a token conflicts with an already-existing Cask, authors should manually make the new token unique by prepending the vendor name. Example: [unison.rb](../../Casks/unison.rb) and [panic-unison.rb](../../Casks/panic-unison.rb).

If possible, avoid creating tokens which differ only by the placement of hyphens.

To generate a token manually, or to learn about exceptions for unusual cases, see [token_reference.md](../cask_language_reference/token_reference.md).

### Archives With Subfolders

When a downloaded archive expands to a subfolder, the subfolder name must be included in the `app` value.

Example:

1. Texmaker is downloaded to the file `TexmakerMacosxLion.zip`.
2. `TexmakerMacosxLion.zip` unzips to a folder called `TexmakerMacosxLion`.
3. The folder `TexmakerMacosxLion` contains the application `texmaker.app`.
4. So, the `app` stanza should include the subfolder as a relative path:

  ```ruby
  app 'TexmakerMacosxLion/texmaker.app'
  ```

## Testing Your New Cask

Give it a shot with `brew cask install my-new-cask`.

Did it install? If something went wrong, `brew cask uninstall my-new-cask` and edit your Cask with `brew cask edit my-new-cask` to fix it.

If everything looks good, you'll also want to make sure your Cask passes audit with:

```bash
brew cask audit my-new-cask --download
```

You should also check stylistic details with `brew cask style`:

```bash
$ cd "$(brew --repository)"/Library/Taps/caskroom/homebrew-cask
$ brew cask style Casks/my-new-cask.rb [--fix]
```

Keep in mind all of these checks will be made when you submit your PR, so by doing them in advance you're saving everyone a lot of time and trouble.

If your application and Homebrew-Cask do not work well together, feel free to [file an issue](https://github.com/caskroom/homebrew-cask#reporting-bugs) after checking out open issues.

## Finding a Home For Your Cask

We maintain separate Taps for different types of binaries. Our nomenclature is:

+ **Stable**: The latest version provided by the developer defined by them as such.
+ **Beta, Development, Unstable**: Subsequent versions to **stable**, yet incomplete and under development, aiming to eventually become the new **stable**.
+ **Nightly**: Constantly up-to-date versions of the current development state.
+ **Legacy**: Any **stable** version that is not the most recent.
+ **Alternative**: Alternative edition of an existing app, by the same vendor (developer editions, community editions, pro editions, …).
+ **Regional, Localized**: Any version that isn't the US English one, when that exists.
+ **Trial**: Date-limited version that stops working entirely after it expires, requiring payment to lift the limitation.
+ **Freemium**: Gratis version that works indefinitely but with limitations that can be removed by paying.
+ **Fork**: An alternate version of an existing project, with a based-on but modified source and binary.
+ **Unofficial**: An *allegedly* unmodified compiled binary, by a third-party, of a binary that has no existing build by the owner of the source code.
+ **Vendorless**: A binary distributed without an official website, like a forum posting.
+ **Walled**: When the download URL is both behind a login/registration form and from a host that differs from the homepage.

### Stable Versions

Stable versions live in the main repository at [caskroom/homebrew-cask](https://github.com/caskroom/homebrew-cask). They should run on the latest release of macOS or the previous point release (in 2015, for example, that meant El Capitan and Yosemite).

### But There Is No Stable Version!

When an App is only available as beta, development, or unstable versions, or in cases where such a version is the general standard, then said version can go into the main repo.

### Beta, Unstable, Development, Nightly, Legacy, or Alternative Versions

When an App has a principal stable version, alternative versions should be submitted to [caskroom/homebrew-versions](https://github.com/caskroom/homebrew-versions).

### Regional and Localized

When an App exists in more than one language or has different regional editions, the US English one belongs in the main repo, and all the others in [caskroom/homebrew-versions](https://github.com/caskroom/homebrew-versions). When not already part of the name of the App, a [regional identifier](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) and a [language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) are to be appended to the Cask's token (both when available, or just the appropriate one when not).

### Trial and Freemium Versions

Before submitting a trial, make sure it can be made into a full working version without the need to be redownloaded. If an App provides a trial but the only way to buy the full version is via the Mac App Store, it does not belong in any of the official repos. Freemium versions are fine.

### Forks and Apps with Conflicting Names

Forks should have the vendor's name as a prefix on the Cask's file name and token. For unrelated Apps that share a name, the most popular one (usually the one already present) stays unprefixed. Since this can be subjective, if you disagree with a decision open an issue and make your case to the maintainers.

### Unofficial, Vendorless, and Walled Builds

We do not accept these casks since they offer a higher-than-normal security risk. [alehouse/homebrew-unofficial](https://github.com/alehouse/homebrew-unofficial) is a sister repo where you may wish to submit your cask.

### Fonts

Font Casks live in the [caskroom/homebrew-fonts](https://github.com/caskroom/homebrew-fonts) repository. See the font repo [CONTRIBUTING.md](../../../../../homebrew-fonts/blob/master/CONTRIBUTING.md)
for details.

## Submitting Your Changes

Hop into your Tap and check to make sure your new Cask is there:

```bash
$ cd "$(brew --repository)"/Library/Taps/caskroom/homebrew-cask
$ git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       Casks/my-new-cask.rb
```

So far, so good. Now make a feature branch that you'll use in your pull request:

```bash
$ git checkout -b my-new-cask
Switched to a new branch 'my-new-cask'
```

Stage your Cask with `git add Casks/my-new-cask.rb`. You can view the changes that are to be committed with `git diff --cached`.

Commit your changes with `git commit -v`.

### Commit Messages

For any git project, some good rules for commit messages are:

* The first line is commit summary, 50 characters or less,
* Followed by an empty line,
* Followed by an explanation of the commit, wrapped to 72 characters.

See [a note about git commit messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) for more.

The first line of a commit message becomes the **title** of a pull request on GitHub, like the subject line of an email. Including the key info in the first line will help us respond faster to your pull.

For Cask commits in the Homebrew-Cask project, we like to include the Application name, version number (or `:latest`), and purpose of the commit in the first line.

Examples of good, clear commit summaries:

* `Add Transmission.app v1.0`
* `Upgrade Transmission.app to v2.82`
* `Fix checksum in Transmission.app Cask`
* `Add CodeBox Latest`

Examples of difficult, unclear commit summaries:

* `Upgrade to v2.82`
* `Checksum was bad`

### Pushing

Push your changes to your GitHub account:

```bash
$ github_user='<my-github-username>'
$ git push "$github_user" my-new-cask
```

If you are using [GitHub two-factor authentication](https://help.github.com/articles/about-two-factor-authentication/) and set your remote repository as HTTPS you will need to set up a personal access token and use that instead of your password. Further information [here](https://help.github.com/articles/https-cloning-errors/#provide-access-token-if-2fa-enabled).

### Squashing

If your pull request has multiple commits which revise the same lines of code, or if you make some changes after comments from one of the maintainers, it is better to [squash](http://davidwalsh.name/squash-commits-git) those commits together into one logical unit.

But you don't always have to squash — it is fine for a pull request to contain multiple commits when there is a logical reason for the separation.

### Filing a Pull Request on GitHub

Now go to the [`homebrew-cask` GitHub repository](https://github.com/caskroom/homebrew-cask). GitHub will often show your `my-new-cask` branch with a handy button to `Compare & pull request`. Otherwise, click the `New pull request` button and choose to `compare across forks`. The base fork should be `caskroom/homebrew-cask @ master`, and the head fork should be `my-github-username/homebrew-cask @ my-new-cask`. You can also add any further comments to your pull request at this stage.

Congratulations! You are done now, and your Cask should be pulled in or otherwise noticed in a while. If a maintainer suggests some changes, just make them on the `my-new-cask` branch locally, [squash](#squashing), and [push](#pushing).

## Cleaning up

After your Pull Request is submitted, you should get yourself back onto `master`, so that `brew update` will pull down new Casks properly:

```bash
cd "$(brew --repository)"/Library/Taps/caskroom/homebrew-cask
git checkout master
```