text:
package org.jboss.hal.ballroom.form;

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

import elemental2.dom.HTMLButtonElement;
import elemental2.dom.HTMLElement;
import org.jboss.gwt.elemento.core.Elements;
import org.jboss.hal.ballroom.LabelBuilder;
import org.jboss.hal.dmr.Deprecation;
import org.jboss.hal.resources.Ids;
import org.jboss.hal.resources.UIConstants;

import static org.jboss.gwt.elemento.core.Elements.button;
import static org.jboss.gwt.elemento.core.Elements.div;
import static org.jboss.gwt.elemento.core.Elements.label;
import static org.jboss.gwt.elemento.core.EventType.click;
import static org.jboss.hal.ballroom.form.Decoration.*;
import static org.jboss.hal.ballroom.form.Form.State.EDITING;
import static org.jboss.hal.ballroom.form.Form.State.READONLY;
import static org.jboss.hal.resources.CSS.*;

/** A form item to select from a small set of distinct numbers using a button group. */
public class NumberSelectItem extends AbstractFormItem<Long> {

    public NumberSelectItem(String name, long[] numbers) {
        this(name, new LabelBuilder().label(name), numbers);
    }

    private NumberSelectItem(String name, String label, long[] numbers) {
        super(name, label, null);

        // read-only appearance
        addAppearance(READONLY, new NumberSelectReadOnlyAppearance());

        // editing appearance
        addAppearance(EDITING, new NumberSelectEditingAppearance(numbers));
    }

    @Override
    public boolean isEmpty() {
        return false;
    }

    @Override
    public boolean supportsExpressions() {
        return false;
    }

    private static class NumberSelectReadOnlyAppearance extends ReadOnlyAppearance<Long> {

        NumberSelectReadOnlyAppearance() {
            super(EnumSet.of(DEFAULT, DEPRECATED, HINT, RESTRICTED));
        }

        @Override
        protected String name() {
            return "NumberSelectReadOnlyAppearance";
        }
    }

    private class NumberSelectEditingAppearance extends AbstractAppearance<Long> {

        private static final String NUMBER = "number";

        private final Map<Long, HTMLButtonElement> buttons;
        private final HTMLElement buttonGroup;
        private final HTMLElement helpBlock;
        private final HTMLElement inputContainer;
        private final HTMLElement root;

        NumberSelectEditingAppearance(long[] numbers) {
            super(EnumSet.of(DEPRECATED, ENABLED, INVALID, REQUIRED));
            this.buttons = new HashMap<>();

            root = div().css(formGroup)
                    .add(labelElement = label().css(controlLabel, halFormLabel).element())
                    .add(inputContainer = div().css(halFormInput)
                            .add(buttonGroup = div().css(btnGroup)
                                    .attr(UIConstants.ROLE, UIConstants.GROUP).element()).element()).element();
            for (long number : numbers) {
                String value = String.valueOf(number);
                HTMLButtonElement button = button().css(btn, btnDefault)
                        .textContent(value)
                        .data(NUMBER, value)
                        .on(click, event -> {
                            showValue(number);
                            modifyValue(number);
                        }).element();
                buttons.put(number, button);
                buttonGroup.appendChild(button);
            }
            helpBlock = Appearance.helpBlock();
        }

        @Override
        protected String name() {
            return "NumberSelectEditingAppearance";
        }

        @Override
        public void attach() {
            // noop
        }

        @Override
        public HTMLElement element() {
            return root;
        }

        @Override
        public void setId(String id) {
            this.id = Ids.build(id, EDITING.name().toLowerCase());
            root.dataset.set(FORM_ITEM_GROUP, this.id);
            buttonGroup.id = this.id;
            labelElement.htmlFor = this.id;
        }

        @Override
        public void setName(String name) {
            // noop
        }

        @Override
        public void showValue(Long value) {
            buttons.forEach((number, button) -> {
                if (number.equals(value)) {
                    button.classList.remove(btnDefault);
                    button.classList.add(btnPrimary);
                } else {
                    button.classList.remove(btnPrimary);
                    button.classList.add(btnDefault);
                }
            });
        }

        @Override
        public void clearValue() {
            buttons.values().forEach(button -> button.classList.remove(btnPrimary));
        }

        @Override
        <C> void safeApply(Decoration decoration, C context) {
            switch (decoration) {

                case DEPRECATED:
                    markAsDeprecated((Deprecation) context);
                    break;

                case ENABLED:
                    buttons.values().forEach(button -> button.disabled = false);
                    break;

                case INVALID:
                    helpBlock.textContent = String.valueOf(context);
                    root.classList.add(hasError);
                    inputContainer.appendChild(helpBlock);
                    break;

                case REQUIRED:
                    markAsRequired();
                    break;

                // unsupported
                case DEFAULT:
                case EXPRESSION:
                case HINT:
                case SENSITIVE:
                case SUGGESTIONS:
                    break;
                default:
                    break;
            }
        }

        @Override
        void safeUnapply(Decoration decoration) {
            switch (decoration) {

                case DEPRECATED:
                    clearDeprecation();
                    break;

                case ENABLED:
                    buttons.values().forEach(button -> button.disabled = true);
                    break;

                case INVALID:
                    root.classList.remove(hasError);
                    Elements.failSafeRemove(inputContainer, helpBlock);
                    break;

                case REQUIRED:
                    clearRequired();
                    break;

                // unsupported
                case DEFAULT:
                case EXPRESSION:
                case HINT:
                case SENSITIVE:
                case SUGGESTIONS:
                    break;
                default:
                    break;
            }
        }

        @Override
        public int getTabIndex() {
            return (int) buttonGroup.tabIndex;
        }

        @Override
        public void setAccessKey(char key) {
            // noop
        }

        @Override
        public void setFocus(boolean focused) {
            if (focused) {
                buttonGroup.focus();
            } else {
                buttonGroup.blur();
            }
        }

        @Override
        public void setTabIndex(int index) {
            buttonGroup.tabIndex = index;
        }
    }
}


text:
package expression

import (
	"testing"

	"github.com/pingcap/tidb/parser/ast"
	"github.com/pingcap/tidb/types"
)

var vecBuiltinEncryptionCases = map[string][]vecExprBenchCase{
	ast.AesEncrypt: {
		{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETString, types.ETString}, aesModes: "aes-128-ecb"},
		{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETString, types.ETString, types.ETString}, geners: []dataGenerator{nil, nil, &constStrGener{"iv"}}, aesModes: "aes-128-ecb"},
		{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETString, types.ETString, types.ETString}, geners: []dataGenerator{nil, nil, newRandLenStrGener(16, 17)}, aesModes: "aes-128-cbc"},
		{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETString, types.ETString, types.ETString}, geners: []dataGenerator{nil, nil, newRandLenStrGener(16, 17)}, aesModes: "aes-128-ofb"},
		{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETString, types.ETString, types.ETString}, geners: []dataGenerator{nil, nil, newRandLenStrGener(16, 17)}, aesModes: "aes-128-cfb"},
	},
	ast.Uncompress: {
		{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETString}},
	},
	ast.AesDecrypt: {
		{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETString, types.ETString}, aesModes: "aes-128-ecb"},
		{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETString, types.ETString, types.ETString}, geners: []dataGenerator{nil, nil, &constStrGener{"iv"}}, aesModes: "aes-128-ecb"},
		{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETString, types.ETString, types.ETString}, geners: []dataGenerator{nil, nil, newRandLenStrGener(16, 17)}, aesModes: "aes-128-cbc"},
		{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETString, types.ETString, types.ETString}, geners: []dataGenerator{nil, nil, newRandLenStrGener(16, 17)}, aesModes: "aes-128-ofb"},
		{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETString, types.ETString, types.ETString}, geners: []dataGenerator{nil, nil, newRandLenStrGener(16, 17)}, aesModes: "aes-128-cfb"},
	},
	ast.Compress: {
		{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETString}},
	},
	ast.MD5: {
		{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETString}},
	},
	ast.SHA: {
		{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETString}},
	},
	ast.RandomBytes: {},
	ast.UncompressedLength: {
		{retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETString}},
		{retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETString}, geners: []dataGenerator{newRandLenStrGener(1, 5)}},
	},
	ast.SHA1: {
		{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETString}},
	},
	ast.PasswordFunc: {
		{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETString}, geners: []dataGenerator{newRandLenStrGener(10, 20)}},
	},
	ast.SHA2: {
		{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETString, types.ETInt}, geners: []dataGenerator{newRandLenStrGener(10, 20), newRangeInt64Gener(SHA0, SHA0+1)}},
		{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETString, types.ETInt}, geners: []dataGenerator{newRandLenStrGener(10, 20), newRangeInt64Gener(SHA224, SHA224+1)}},
		{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETString, types.ETInt}, geners: []dataGenerator{newRandLenStrGener(10, 20), newRangeInt64Gener(SHA256, SHA256+1)}},
		{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETString, types.ETInt}, geners: []dataGenerator{newRandLenStrGener(10, 20), newRangeInt64Gener(SHA384, SHA384+1)}},
		{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETString, types.ETInt}, geners: []dataGenerator{newRandLenStrGener(10, 20), newRangeInt64Gener(SHA512, SHA512+1)}},
	},
	ast.Encode: {
		{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETString, types.ETString}},
	},
	ast.Decode: {
		{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETString, types.ETString}, geners: []dataGenerator{newRandLenStrGener(10, 20)}},
	},
}

func TestVectorizedBuiltinEncryptionFunc(t *testing.T) {
	testVectorizedBuiltinFunc(t, vecBuiltinEncryptionCases)
}

func BenchmarkVectorizedBuiltinEncryptionFunc(b *testing.B) {
	benchmarkVectorizedBuiltinFunc(b, vecBuiltinEncryptionCases)
}

redpajama_set_name: RedPajamaGithub


text:
//
// Copyright 1999-2006 and onwards Google, Inc.
//
// Useful string functions and so forth.  This is a grab-bag file.
//
// You might also want to look at memutil.h, which holds mem*()
// equivalents of a lot of the str*() functions in string.h,
// eg memstr, mempbrk, etc.
//
// If you need to process UTF8 strings, take a look at files in i18n/utf8.

#ifndef STRINGS_STRUTIL_H_
#define STRINGS_STRUTIL_H_

#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include <string.h>
#include <stdlib.h>

// for strcasecmp (check SuSv3 -- this is the only header it's in!)
// MSVC doesn't have <strings.h>. Luckily, it defines equivalent
// functions (see port.h)
#ifndef COMPILER_MSVC
#include <strings.h>
#endif
#include <ctype.h>      // not needed, but removing it will break the build

#include "rdb_protocol/geo/s2/base/basictypes.h"
#include "rdb_protocol/geo/s2/base/logging.h"  // for CHECK
#include "rdb_protocol/geo/s2/base/strtoint.h"
#include "rdb_protocol/geo/s2/base/int128.h"
#include "rdb_protocol/geo/s2/strings/ascii_ctype.h"
//#include "rdb_protocol/geo/s2/charset.h"
//#include "rdb_protocol/geo/s2/escaping.h"
//#include "rdb_protocol/geo/s2/host_port.h"
#include "rdb_protocol/geo/s2/strings/stringprintf.h"
#include "rdb_protocol/geo/s2/base/stl_decl.h"
#include "rdb_protocol/geo/s2/base/port.h"
#include "rdb_protocol/geo/s2/util/endian/endian.h"

namespace geo {
using std::less;
using std::unordered_map;
using std::unordered_set;
using std::set;
using std::multiset;
using std::pair;
using std::make_pair;
using std::vector;

// A buffer size which is large enough for all the FastToBuffer functions, as
// well as DoubleToBuffer and FloatToBuffer.  We define this here in case other
// string headers depend on it.
static const unsigned int kFastToBufferSize = 32;

// ----------------------------------------------------------------------
// FpToString()
// FloatToString()
// IntToString()
// Int64ToString()
// UInt64ToString()
//    Convert various types to their string representation, possibly padded
//    with spaces, using snprintf format specifiers.
//    "Fp" here stands for fingerprint: a 64-bit entity
//    represented in 16 hex digits.
// ----------------------------------------------------------------------

std::string FpToString(Fprint fp);
std::string FloatToString(float f, const char* format);
std::string IntToString(int i, const char* format);
std::string Int64ToString(int64 i64, const char* format);
std::string UInt64ToString(uint64 ui64, const char* format);

// The default formats are %7f, %7d, and %7u respectively
std::string FloatToString(float f);
std::string IntToString(int i);
std::string Int64ToString(int64 i64);
std::string UInt64ToString(uint64 ui64);

// ----------------------------------------------------------------------
// FastHexToBuffer()
// FastHex64ToBuffer()
// FastHex32ToBuffer()
//    These are intended for speed.  FastHexToBuffer() puts output in
//    hex rather than decimal.
//
//    FastHex64ToBuffer() puts a 64-bit unsigned value in hex-format,
//    padded to exactly 16 bytes (plus one byte for '\0')
//
//    FastHex32ToBuffer() puts a 32-bit unsigned value in hex-format,
//    padded to exactly 8 bytes (plus one byte for '\0')
//
//       All functions take the output buffer as an arg.  FastInt()
//    uses at most 22 bytes, FastTime() uses exactly 30 bytes.
//    They all return a pointer to the beginning of the output,
//    which may not be the beginning of the input buffer.
// ----------------------------------------------------------------------

// Previously documented minimums -- the buffers provided must be at least this
// long, though these numbers are subject to change:
//     Hex:                  22 bytes
//     Hex32:                 9 bytes
//     Hex64:                17 bytes
// Use kFastToBufferSize rather than hardcoding constants.

char* FastHexToBuffer(int i, char* buffer);
char* FastHex64ToBuffer(uint64 i, char* buffer);
char* FastHex32ToBuffer(uint32 i, char* buffer);

// ----------------------------------------------------------------------
// ConsumeStrayLeadingZeroes
//    Eliminates all leading zeroes (unless the string itself is composed
//    of nothing but zeroes, in which case one is kept: 0...0 becomes 0).
void ConsumeStrayLeadingZeroes(std::string* str);

// ----------------------------------------------------------------------
// ParseLeadingInt32Value
//    A simple parser for int32 values. Returns the parsed value
//    if a valid integer is found; else returns deflt. It does not
//    check if str is entirely consumed.
//    This cannot handle decimal numbers with leading 0s, since they will be
//    treated as octal.  If you know it's decimal, use ParseLeadingDec32Value.
// --------------------------------------------------------------------
int32 ParseLeadingInt32Value(const char* str, int32 deflt);
inline int32 ParseLeadingInt32Value(const std::string& str, int32 deflt) {
  return ParseLeadingInt32Value(str.c_str(), deflt);
}

// ParseLeadingUInt32Value
//    A simple parser for uint32 values. Returns the parsed value
//    if a valid integer is found; else returns deflt. It does not
//    check if str is entirely consumed.
//    This cannot handle decimal numbers with leading 0s, since they will be
//    treated as octal.  If you know it's decimal, use ParseLeadingUDec32Value.
// --------------------------------------------------------------------
uint32 ParseLeadingUInt32Value(const char* str, uint32 deflt);
inline uint32 ParseLeadingUInt32Value(const std::string& str, uint32 deflt) {
  return ParseLeadingUInt32Value(str.c_str(), deflt);
}

// ----------------------------------------------------------------------
// ParseLeadingDec32Value
//    A simple parser for decimal int32 values. Returns the parsed value
//    if a valid integer is found; else returns deflt. It does not
//    check if str is entirely consumed.
//    The string passed in is treated as *10 based*.
//    This can handle strings with leading 0s.
//    See also: ParseLeadingDec64Value
// --------------------------------------------------------------------
int32 ParseLeadingDec32Value(const char* str, int32 deflt);
inline int32 ParseLeadingDec32Value(const std::string& str, int32 deflt) {
  return ParseLeadingDec32Value(str.c_str(), deflt);
}

// ParseLeadingUDec32Value
//    A simple parser for decimal uint32 values. Returns the parsed value
//    if a valid integer is found; else returns deflt. It does not
//    check if str is entirely consumed.
//    The string passed in is treated as *10 based*.
//    This can handle strings with leading 0s.
//    See also: ParseLeadingUDec64Value
// --------------------------------------------------------------------
uint32 ParseLeadingUDec32Value(const char* str, uint32 deflt);
inline uint32 ParseLeadingUDec32Value(const std::string& str, uint32 deflt) {
  return ParseLeadingUDec32Value(str.c_str(), deflt);
}

// ----------------------------------------------------------------------
// ParseLeadingUInt64Value
// ParseLeadingInt64Value
// ParseLeadingHex64Value
// ParseLeadingDec64Value
// ParseLeadingUDec64Value
//    A simple parser for long long values.
//    Returns the parsed value if a
//    valid integer is found; else returns deflt
// --------------------------------------------------------------------
uint64 ParseLeadingUInt64Value(const char* str, uint64 deflt);
inline uint64 ParseLeadingUInt64Value(const std::string& str, uint64 deflt) {
  return ParseLeadingUInt64Value(str.c_str(), deflt);
}
int64 ParseLeadingInt64Value(const char* str, int64 deflt);
inline int64 ParseLeadingInt64Value(const std::string& str, int64 deflt) {
  return ParseLeadingInt64Value(str.c_str(), deflt);
}
uint64 ParseLeadingHex64Value(const char* str, uint64 deflt);
inline uint64 ParseLeadingHex64Value(const std::string& str, uint64 deflt) {
  return ParseLeadingHex64Value(str.c_str(), deflt);
}
int64 ParseLeadingDec64Value(const char* str, int64 deflt);
inline int64 ParseLeadingDec64Value(const std::string& str, int64 deflt) {
  return ParseLeadingDec64Value(str.c_str(), deflt);
}
uint64 ParseLeadingUDec64Value(const char* str, uint64 deflt);
inline uint64 ParseLeadingUDec64Value(const std::string& str, uint64 deflt) {
  return ParseLeadingUDec64Value(str.c_str(), deflt);
}

// -------------------------------------------------------------------------
// DictionaryParse
//   This routine parses a common dictionary format (key and value separated
//   by ':', entries separated by commas). This format is used for many
//   complex commandline flags. It is also used to encode dictionaries for
//   exporting them or writing them to a checkpoint. Returns a vector of
//   <key, value> pairs. Returns true if there if no error in parsing, false
//    otherwise.
// -------------------------------------------------------------------------
bool DictionaryParse(const std::string& encoded_str,
                      vector<pair<std::string, std::string> >* items);

}  // namespace geo

#endif   /* #ifndef STRINGS_STRUTIL_H_ */


text:
require 'http'
require "tito/version"
require "tito/base"
require "tito/eventable"
require "tito/request_proxy"
require "tito/response_array"

require "tito/account"
require "tito/answer"
require "tito/discount_code"
require "tito/event_settings"
require "tito/interested_user"
require "tito/question"
require "tito/registration"
require "tito/release"
require "tito/ticket"
require "tito/event"
require "tito/webhook_endpoint"

module Tito
  def self.api_key
    return @api_key if @api_key
    return ENV['TITO_API_KEY'] if ENV['TITO_API_KEY']
  end

  def self.api_key=(val)
    @api_key = val
  end
end

# Tito::Base.connection do |connection|
#   connection.use Tito::OAuth2Middleware, lambda { |env| Tito.api_key }
# end


text:
Angular Essentials

  <app-header></app-header>

        <list (chosen)='onChosen($event)' (newItem)='addNewItem($event)' (onEditItem)="editItem($event)" [list]="list"></list>

        <item-detail [currentItem]="currentItem" [newItem]="newItem" [editedItem]="editedItem" (item)="saveItem($event)" (onEditItem)="saveEditItem($event)"></item-detail>


text:
title = 'Pmw LogicalFont demonstration'

# Import Pmw from this directory tree.
import sys
sys.path[:0] = ['../../..']

import string
import Tkinter
import Pmw

class Demo:

    # The fonts to demonstrate.
    fontList = (
      (('Times', 0), {}),
      (('Helvetica', 0), {}),
      (('Typewriter', 0), {}),
      (('Fixed', 0), {}),
      (('Courier', 0), {}),
      (('Helvetica', 2), {'slant' : 'italic'}),
      (('Helvetica', 0), {'size' : 18}),
      (('Helvetica', 0), {'weight' : 'bold'}),
      (('Helvetica', 12), {'weight' : 'bold', 'slant' : 'italic'}),
      (('Typewriter', 0), {'size' : 8, 'weight' : 'bold'}),
      (('Fixed', 0), {'size' : 8, 'weight' : 'bold'}),
      (('Times', 0), {'size' : 24, 'weight' : 'bold', 'slant' : 'italic'}),
      (('Typewriter', 0), {'width' : 'condensed'}),
      (('Typewriter', -1), {'width' : 'condensed'}),
      (('Fixed', 0), {'width' : 'condensed'}),
      (('Fixed', -1), {'width' : 'condensed'}),
      (('Helvetica', 0), {'weight' : 'bogus'}),
    )

    fontText = []

    def __init__(self, parent):

	self.parent = parent

	# Create the text to display to the user to represent each font.
	if Demo.fontText == []:
	    for args, dict in Demo.fontList:
		text = args[0]
		if args[1] != 0:
		    text = text + ' ' + str(args[1])
		for name, value in dict.items():
		    text = text + ' ' + name + ': ' + str(value)
		Demo.fontText.append(text)

	# Create a listbox to contain the font selections.
	self.box = Pmw.ScrolledListBox(parent, listbox_selectmode='single',
		listbox_width = 35,
		listbox_height = 10,
		items=Demo.fontText,
		label_text='Font', labelpos='nw',
		selectioncommand=self.selectionCommand)
	self.box.pack(fill = 'both', expand = 1, padx = 10, pady = 10)

	# Create a label to display the selected font.
	self.target = Tkinter.Label(parent,
	        text = 'The quick brown fox jumps\nover the lazy dog',
		relief = 'sunken', padx = 10, pady = 10)
	self.target.pack(fill = 'both', expand = 1, padx = 10, pady = 10)

    def selectionCommand(self):
	sel = self.box.curselection()
	if len(sel) > 0:
	    args, dict = Demo.fontList[string.atoi(sel[0])]
	    font = apply(Pmw.logicalfont, args, dict)
            self.target.configure(font = font)
            print font

######################################################################

# Create demo in root window for testing.
if __name__ == '__main__':
    root = Tkinter.Tk()
    Pmw.initialise(root)
    root.title(title)

    exitButton = Tkinter.Button(root, text = 'Exit', command = root.destroy)
    exitButton.pack(side = 'bottom')
    widget = Demo(root)
    root.mainloop()


text:
<?php

namespace Drupal\webform_test_handler_remote_post;

use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Http\ClientFactory;
use Drupal\Core\Site\Settings;

/**
 * Extend Drupal client so that we can override Guzzel client.
 *
 * @see \Drupal\Core\Http\ClientFactory::fromOptions
 */
class WebformTestHandlerRemotePostClientFactory extends ClientFactory {

  /**
   * {@inheritdoc}
   */
  public function fromOptions(array $config = []) {
    $default_config = [
      'verify' => TRUE,
      'timeout' => 30,
      'headers' => [
        'User-Agent' => 'Drupal/' . \Drupal::VERSION . ' (+https://www.drupal.org/) ' . \GuzzleHttp\default_user_agent(),
      ],
      'handler' => $this->stack,
      'proxy' => [
        'http' => NULL,
        'https' => NULL,
        'no' => [],
      ]
    ];
    $config = NestedArray::mergeDeep($default_config, Settings::get('http_client_config', []), $config);
    return new WebformTestHandlerRemotePostClient($config);
  }

}


text:
package org.camunda.bpm.engine.impl.persistence.entity;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.camunda.bpm.engine.history.HistoricIdentityLinkLog;
import org.camunda.bpm.engine.impl.HistoricIdentityLinkLogQueryImpl;
import org.camunda.bpm.engine.impl.Page;
import org.camunda.bpm.engine.impl.context.Context;
import org.camunda.bpm.engine.impl.db.ListQueryParameterObject;
import org.camunda.bpm.engine.impl.db.entitymanager.operation.DbOperation;
import org.camunda.bpm.engine.impl.history.HistoryLevel;
import org.camunda.bpm.engine.impl.history.event.HistoricIdentityLinkLogEventEntity;
import org.camunda.bpm.engine.impl.history.event.HistoryEventTypes;
import org.camunda.bpm.engine.impl.persistence.AbstractHistoricManager;

/**
 * @author Deivarayan Azhagappan
 *
 */
public class HistoricIdentityLinkLogManager extends AbstractHistoricManager {

  public long findHistoricIdentityLinkLogCountByQueryCriteria(HistoricIdentityLinkLogQueryImpl query) {
    configureQuery(query);
    return (Long) getDbEntityManager().selectOne("selectHistoricIdentityLinkCountByQueryCriteria", query);
  }

  @SuppressWarnings("unchecked")
  public List<HistoricIdentityLinkLog> findHistoricIdentityLinkLogByQueryCriteria(HistoricIdentityLinkLogQueryImpl query, Page page) {
    configureQuery(query);
    return getDbEntityManager().selectList("selectHistoricIdentityLinkByQueryCriteria", query, page);
  }

  public void addRemovalTimeToIdentityLinkLogByRootProcessInstanceId(String rootProcessInstanceId, Date removalTime) {
    Map<String, Object> parameters = new HashMap<>();
    parameters.put("rootProcessInstanceId", rootProcessInstanceId);
    parameters.put("removalTime", removalTime);

    getDbEntityManager()
      .updatePreserveOrder(HistoricIdentityLinkLogEventEntity.class, "updateIdentityLinkLogByRootProcessInstanceId", parameters);
  }

  public void addRemovalTimeToIdentityLinkLogByProcessInstanceId(String processInstanceId, Date removalTime) {
    Map<String, Object> parameters = new HashMap<>();
    parameters.put("processInstanceId", processInstanceId);
    parameters.put("removalTime", removalTime);

    getDbEntityManager()
      .updatePreserveOrder(HistoricIdentityLinkLogEventEntity.class, "updateIdentityLinkLogByProcessInstanceId", parameters);
  }

  public void deleteHistoricIdentityLinksLogByProcessDefinitionId(String processDefId) {
    if (isHistoryEventProduced()) {
      getDbEntityManager().delete(HistoricIdentityLinkLogEntity.class, "deleteHistoricIdentityLinksByProcessDefinitionId", processDefId);
    }
  }

  public void deleteHistoricIdentityLinksLogByTaskId(String taskId) {
    if (isHistoryEventProduced()) {
      getDbEntityManager().delete(HistoricIdentityLinkLogEntity.class, "deleteHistoricIdentityLinksByTaskId", taskId);
    }
  }

  public void deleteHistoricIdentityLinksLogByTaskProcessInstanceIds(List<String> processInstanceIds) {
    getDbEntityManager().deletePreserveOrder(HistoricIdentityLinkLogEntity.class, "deleteHistoricIdentityLinksByTaskProcessInstanceIds", processInstanceIds);
  }

  public void deleteHistoricIdentityLinksLogByTaskCaseInstanceIds(List<String> caseInstanceIds) {
    getDbEntityManager().deletePreserveOrder(HistoricIdentityLinkLogEntity.class, "deleteHistoricIdentityLinksByTaskCaseInstanceIds", caseInstanceIds);
  }

  public DbOperation deleteHistoricIdentityLinkLogByRemovalTime(Date removalTime, int minuteFrom, int minuteTo, int batchSize) {
    Map<String, Object> parameters = new HashMap<>();
    parameters.put("removalTime", removalTime);
    if (minuteTo - minuteFrom + 1 < 60) {
      parameters.put("minuteFrom", minuteFrom);
      parameters.put("minuteTo", minuteTo);
    }
    parameters.put("batchSize", batchSize);

    return getDbEntityManager()
      .deletePreserveOrder(HistoricIdentityLinkLogEntity.class, "deleteHistoricIdentityLinkLogByRemovalTime",
        new ListQueryParameterObject(parameters, 0, batchSize));
  }

  protected void configureQuery(HistoricIdentityLinkLogQueryImpl query) {
    getAuthorizationManager().configureHistoricIdentityLinkQuery(query);
    getTenantManager().configureQuery(query);
  }

  protected boolean isHistoryEventProduced() {
    HistoryLevel historyLevel = Context.getProcessEngineConfiguration().getHistoryLevel();
    return historyLevel.isHistoryEventProduced(HistoryEventTypes.IDENTITY_LINK_ADD, null) ||
           historyLevel.isHistoryEventProduced(HistoryEventTypes.IDENTITY_LINK_DELETE, null);
  }

}


text:
/* Function object interface */

#ifndef Py_FUNCOBJECT_H
#define Py_FUNCOBJECT_H
#ifdef __cplusplus
extern "C" {
#endif

/* Function objects and code objects should not be confused with each other:
 *
 * Function objects are created by the execution of the 'def' statement.
 * They reference a code object in their func_code attribute, which is a
 * purely syntactic object, i.e. nothing more than a compiled version of some
 * source code lines.  There is one code object per source code "fragment",
 * but each code object can be referenced by zero or many function objects
 * depending only on how many times the 'def' statement in the source was
 * executed so far.
 */

typedef struct {
    PyObject_HEAD
    PyObject *func_code;	/* A code object */
    PyObject *func_globals;	/* A dictionary (other mappings won't do) */
    PyObject *func_defaults;	/* NULL or a tuple */
    PyObject *func_closure;	/* NULL or a tuple of cell objects */
    PyObject *func_doc;		/* The __doc__ attribute, can be anything */
    PyObject *func_name;	/* The __name__ attribute, a string object */
    PyObject *func_dict;	/* The __dict__ attribute, a dict or NULL */
    PyObject *func_weakreflist;	/* List of weak references */
    PyObject *func_module;	/* The __module__ attribute, can be anything */

    /* Invariant:
     *     func_closure contains the bindings for func_code->co_freevars, so
     *     PyTuple_Size(func_closure) == PyCode_GetNumFree(func_code)
     *     (func_closure may be NULL if PyCode_GetNumFree(func_code) == 0).
     */
} PyFunctionObject;

PyAPI_DATA(PyTypeObject) PyFunction_Type;

#define PyFunction_Check(op) ((op)->ob_type == &PyFunction_Type)

PyAPI_FUNC(PyObject *) PyFunction_New(PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyFunction_GetCode(PyObject *);
PyAPI_FUNC(PyObject *) PyFunction_GetGlobals(PyObject *);
PyAPI_FUNC(PyObject *) PyFunction_GetModule(PyObject *);
PyAPI_FUNC(PyObject *) PyFunction_GetDefaults(PyObject *);
PyAPI_FUNC(int) PyFunction_SetDefaults(PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyFunction_GetClosure(PyObject *);
PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *);

/* Macros for direct access to these values. Type checks are *not*
   done, so use with care. */
#define PyFunction_GET_CODE(func) \
        (((PyFunctionObject *)func) -> func_code)
#define PyFunction_GET_GLOBALS(func) \
	(((PyFunctionObject *)func) -> func_globals)
#define PyFunction_GET_MODULE(func) \
	(((PyFunctionObject *)func) -> func_module)
#define PyFunction_GET_DEFAULTS(func) \
	(((PyFunctionObject *)func) -> func_defaults)
#define PyFunction_GET_CLOSURE(func) \
	(((PyFunctionObject *)func) -> func_closure)

/* The classmethod and staticmethod types lives here, too */
PyAPI_DATA(PyTypeObject) PyClassMethod_Type;
PyAPI_DATA(PyTypeObject) PyStaticMethod_Type;

PyAPI_FUNC(PyObject *) PyClassMethod_New(PyObject *);
PyAPI_FUNC(PyObject *) PyStaticMethod_New(PyObject *);

#ifdef __cplusplus
}
#endif
#endif /* !Py_FUNCOBJECT_H */


text:
package console

import "github.com/fatih/color"

var (
	// Red can be used as Sprintf, where the output it wrapped in escape characters which will render the text red in terminals.
	Red = color.New(color.Bold, color.FgRed).SprintfFunc()
	// Green can be used as Sprintf, where the output it wrapped in escape characters which will render the text green in terminals.
	Green = color.New(color.Bold, color.FgGreen).SprintfFunc()
	// Yellow can be used as Sprintf, where the output it wrapped in escape characters which will render the text yellow in terminals.
	Yellow = color.New(color.Bold, color.FgYellow).SprintfFunc()
	// Cyan can be used as Sprintf, where the output it wrapped in escape characters which will render the text cyan in terminals.
	Cyan = color.New(color.FgCyan).SprintfFunc()
)


text:
import base64
import json
import nacl.signing
import os
import time
from binascii import unhexlify
from collections import OrderedDict
from config import DATA_FOLDER
from copy import deepcopy
from dht.utils import digest
from keys.keychain import KeyChain
from market.contracts import Contract
from protos.objects import PlaintextMessage
from market.smtpnotification import SMTPNotification

def process_dispute(contract, db, message_listener, notification_listener, testnet):
    """
    This function processes a dispute message received from another node. It checks the
    contract to see if this a dispute for a purchase we made, a dispute for one of our
    sales, or a new case if we are the moderator.

    If it's a purchase or sale it will
    update the order status to disputed and push a notification to the listener.

    If it's a new case it will validate the contract, create a new case in the db,
    and push a notification to the listener.

    Args:
        contract: a json contract of the current order state. Should have a "dispute"
            object attached with dispute info.
        db: a `Database` object.
        message_listener: a `MessageListenerImpl` object.
        notification_listener: a `NotificationListenerImpl` object.
        testnet: `bool` of whether we're on testnet or not.
    """
    tmp_contract = deepcopy(contract)
    if "vendor_order_confirmation" in tmp_contract:
        del tmp_contract["vendor_order_confirmation"]
    if "buyer_receipt" in tmp_contract:
        del tmp_contract["buyer_receipt"]
    del tmp_contract["dispute"]

    order_id = digest(json.dumps(tmp_contract, indent=4)).encode("hex")
    own_guid = KeyChain(db).guid.encode("hex")

    if contract["dispute"]["info"]["guid"] == contract["vendor_offer"]["listing"]["id"]["guid"]:
        guid = unhexlify(contract["vendor_offer"]["listing"]["id"]["guid"])
        public_key = unhexlify(contract["vendor_offer"]["listing"]["id"]["pubkeys"]["guid"])
        if "blockchain_id" in contract["vendor_offer"]["listing"]["id"]:
            handle = contract["vendor_offer"]["listing"]["id"]["blockchain_id"]
        else:
            handle = ""
        proof_sig = None
    elif contract["dispute"]["info"]["guid"] == contract["buyer_order"]["order"]["id"]["guid"]:
        guid = unhexlify(contract["buyer_order"]["order"]["id"]["guid"])
        public_key = unhexlify(contract["buyer_order"]["order"]["id"]["pubkeys"]["guid"])
        if "blockchain_id" in contract["buyer_order"]["order"]["id"]:
            handle = contract["buyer_order"]["order"]["id"]["blockchain_id"]
        else:
            handle = ""
        proof_sig = contract["dispute"]["info"]["proof_sig"]
    else:
        raise Exception("Dispute guid not in contract")

    verify_key = nacl.signing.VerifyKey(public_key)
    verify_key.verify(json.dumps(contract["dispute"]["info"], indent=4),
                      base64.b64decode(contract["dispute"]["signature"]))

    p = PlaintextMessage()
    p.sender_guid = guid
    p.handle = handle
    p.pubkey = public_key
    p.subject = str(order_id)
    p.type = PlaintextMessage.Type.Value("DISPUTE_OPEN")
    p.message = str(contract["dispute"]["info"]["claim"])
    p.timestamp = int(time.time())
    p.avatar_hash = unhexlify(str(contract["dispute"]["info"]["avatar_hash"]))

    if db.purchases.get_purchase(order_id) is not None:
        db.purchases.status_changed(order_id, 1)
        db.purchases.update_status(order_id, 4)

    elif db.sales.get_sale(order_id) is not None:
        db.sales.status_changed(order_id, 1)
        db.sales.update_status(order_id, 4)

    elif "moderators" in contract["vendor_offer"]["listing"]:
        # TODO: make sure a case isn't already open in the db
        is_selected = False
        for moderator in contract["vendor_offer"]["listing"]["moderators"]:
            if moderator["guid"] == own_guid and contract["buyer_order"]["order"]["moderator"] == own_guid:
                is_selected = True
        if not is_selected:
            raise Exception("Not a moderator for this contract")
        else:
            if "blockchain_id" in contract["vendor_offer"]["listing"]["id"] and \
                            contract["vendor_offer"]["listing"]["id"]["blockchain_id"] != "":
                vendor = contract["vendor_offer"]["listing"]["id"]["blockchain_id"]
            else:
                vendor = contract["vendor_offer"]["listing"]["id"]["guid"]
            if "blockchain_id" in contract["buyer_order"]["order"]["id"] and \
                            contract["buyer_order"]["order"]["id"]["blockchain_id"] != "":
                buyer = contract["buyer_order"]["order"]["id"]["blockchain_id"]
            else:
                buyer = contract["buyer_order"]["order"]["id"]["guid"]

            c = Contract(db, contract=contract, testnet=testnet)

            validation_failures = c.validate_for_moderation(proof_sig)

            db.cases.new_case(order_id,
                              contract["vendor_offer"]["listing"]["item"]["title"],
                              time.time(),
                              contract["buyer_order"]["order"]["date"],
                              float(contract["buyer_order"]["order"]["payment"]["amount"]),
                              contract["vendor_offer"]["listing"]["item"]["image_hashes"][0],
                              buyer, vendor, json.dumps(validation_failures),
                              contract["dispute"]["info"]["claim"])

            with open(os.path.join(DATA_FOLDER, "cases", order_id + ".json"), 'wb') as outfile:
                outfile.write(json.dumps(contract, indent=4))
    else:
        raise Exception("Order ID for dispute not found")

    message_listener.notify(p, "")
    title = contract["vendor_offer"]["listing"]["item"]["title"]
    notification_listener.notify(guid, handle, "dispute_open", order_id,
                                 title,
                                 unhexlify(contract["vendor_offer"]["listing"]["item"]["image_hashes"][0]))

    # Send SMTP notification
    notification = SMTPNotification(db)
    guid = guid.encode("hex")
    notification.send("[OpenBazaar] Dispute Opened",
                      "A dispute has been opened.\n\n"
                      "Order: %s\n"
                      "Opened By: %s\n"
                      "Title: %s" % (order_id, guid, title))

def close_dispute(resolution_json, db, message_listener, notification_listener, testnet):
    """
    This function processes a dispute close message received from the moderator. It will
    store the resolution in the contract and send a notification to the listeners telling
    them that the dispute is resolved.

    Args:
        resolution_json: The `dispute_resolution` portion of the contract received from the moderator.
        db: a `Database` object.
        message_listener: a `MessageListenerImpl` object.
        notification_listener: a `NotificationListenerImpl` object.
        testnet: `bool` of whether we're on testnet or not.
    """

    order_id = resolution_json["dispute_resolution"]["resolution"]["order_id"]

    if os.path.exists(os.path.join(DATA_FOLDER, "purchases", "in progress", order_id + ".json")):
        file_path = os.path.join(DATA_FOLDER, "purchases", "in progress", order_id + ".json")
    elif os.path.exists(os.path.join(DATA_FOLDER, "store", "contracts", "in progress", order_id + ".json")):
        file_path = os.path.join(DATA_FOLDER, "store", "contracts", "in progress", order_id + ".json")

    with open(file_path, 'r') as filename:
        contract = json.load(filename, object_pairs_hook=OrderedDict)

    for moderator in contract["vendor_offer"]["listing"]["moderators"]:
        if moderator["guid"] == contract["buyer_order"]["order"]["moderator"]:
            moderator_guid = unhexlify(moderator["guid"])
            moderator_handle = moderator["blockchain_id"]
            moderator_pubkey = unhexlify(moderator["pubkeys"]["guid"])
            moderator_avatar = unhexlify(moderator["avatar"])

    verify_key = nacl.signing.VerifyKey(moderator_pubkey)
    verify_key.verify(json.dumps(resolution_json["dispute_resolution"]["resolution"], indent=4),
                      base64.b64decode(resolution_json["dispute_resolution"]["signature"]))

    contract["dispute_resolution"] = resolution_json["dispute_resolution"]

    if db.purchases.get_purchase(order_id) is not None:
        db.purchases.status_changed(order_id, 1)
        db.purchases.update_status(order_id, 5)

    elif db.sales.get_sale(order_id) is not None:
        db.sales.status_changed(order_id, 1)
        db.sales.update_status(order_id, 5)

    with open(file_path, 'wb') as outfile:
        outfile.write(json.dumps(contract, indent=4))

    p = PlaintextMessage()
    p.sender_guid = moderator_guid
    p.handle = moderator_handle
    p.pubkey = moderator_pubkey
    p.subject = str(order_id)
    p.type = PlaintextMessage.Type.Value("DISPUTE_CLOSE")
    p.message = str(resolution_json["dispute_resolution"]["resolution"]["decision"])
    p.timestamp = int(time.time())
    p.avatar_hash = moderator_avatar

    message_listener.notify(p, "")
    title = contract["vendor_offer"]["listing"]["item"]["title"]
    notification_listener.notify(moderator_guid, moderator_handle, "dispute_close", order_id,
                                 title,
                                 contract["vendor_offer"]["listing"]["item"]["image_hashes"][0])

    # Send SMTP notification
    notification = SMTPNotification(db)
    guid = moderator_guid.encode("hex")
    notification.send("[OpenBazaar] Dispute Closed",
                      "A dispute has been closed.\n\n"
                      "Order: %s\n"
                      "Closed By: %s\n"
                      "Title: %s" % (order_id, guid, title))


text:
declare module 'emojify.js' {
  function setConfig(config: any): any
  function replace(value: string): string
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">

<meta name="generator" content="JDiff v1.0.9">

<meta name="description" content="JDiff is a Javadoc doclet which generates an HTML report of all the packages, classes, constructors, methods, and fields which have been removed, added or changed in any way, including their documentation, when two APIs are compared.">
<meta name="keywords" content="diff, jdiff, javadiff, java diff, java difference, API difference, difference between two APIs, API diff, Javadoc, doclet">
<TITLE>
org.apache.hadoop.mapred.lib.db.DBInputFormat.DBInputSplit
</TITLE>
<LINK REL="stylesheet" TYPE="text/css" HREF="../stylesheet-jdiff.css" TITLE="Style">

       <tt>hadoop 0.20.2-cdh3u4</tt>
       Overview
       Package
        Class
       Statistics
       Help

  Generated by
JDiff

 PREV CLASS
 NEXT CLASS

  FRAMES
   NO FRAMES
   DETAIL:
CONSTRUCTORS |
METHODS |
FIELDS

Class org.apache.hadoop.mapred.lib.db.<tt>DBInputFormat.DBInputSplit</tt>

The superclass changed from java.lang.Object to org.apache.hadoop.mapreduce.lib.db.DBInputFormat.DBInputSplit.

  Changed Methods

  <nobr>long <tt>getEnd</tt>()  </nobr>

Method was locally defined, but is now inherited from <tt>DBInputFormat.DBInputSplit</tt>.

  @return The index of the last row to select

  <nobr>long <tt>getLength</tt>()  </nobr>

Method was locally defined, but is now inherited from <tt>DBInputFormat.DBInputSplit</tt>.

  @return The total row count in this split

  <nobr>String[] <tt>getLocations</tt>()  </nobr>

Method was locally defined, but is now inherited from <tt>DBInputFormat.DBInputSplit</tt>.

  {@inheritDoc}

  <nobr>long <tt>getStart</tt>()  </nobr>

Method was locally defined, but is now inherited from <tt>DBInputFormat.DBInputSplit</tt>.

  @return The index of the first row to select

  <nobr>void <tt>readFields</tt>(DataInput)  </nobr>

Method was locally defined, but is now inherited from <tt>DBInputFormat.DBInputSplit</tt>.

  {@inheritDoc}

  <nobr>void <tt>write</tt>(DataOutput)  </nobr>

Method was locally defined, but is now inherited from <tt>DBInputFormat.DBInputSplit</tt>.

  {@inheritDoc}

       <tt>hadoop 0.20.2-cdh3u4</tt>
       Overview
       Package
        Class
       Statistics
       Help

 PREV CLASS
 NEXT CLASS

  FRAMES
   NO FRAMES


text:
module Unloq
  module Ratings

    # Fetch the ratings for an author
    #
    # @param author [Unloq::Entity] The author for which you want to retrieve ratings

    def lookup_author_ratings author
      validate_author(author)

      get('/ratings', "/#{author.id}")
    end

  end
end


text:
package com.intuit.wasabi.analyticsobjects.statistics;

import com.intuit.wasabi.analyticsobjects.Event;
import org.junit.Before;
import org.junit.Test;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;

/**
 * Tests the {@link ActionRate}.
 */
public class ActionRateTest {

    private Double estimate;
    private Double lowerBound;
    private Double upperBound;
    private Event.Name actionName;
    private ActionRate actionRate;

    @Before
    public void setup() {
        actionName = Event.Name.valueOf("TestAction");
        estimate = 0.5;
        lowerBound = 0.45;
        upperBound = 0.55;
        actionRate = new ActionRate.Builder().withActionName(actionName).withEstimateValue(estimate)
                .withEstimateLower(lowerBound).withEstimateUpper(upperBound).build();
    }

    @Test
    public void testBuilder() {
        assertThat(actionRate.getActionName(), equalTo(actionName));

        Estimate estimator = new Estimate.Builder().withEstimate(estimate).withLowerBound(lowerBound)
                .withUpperBound(upperBound).build();
        ActionRate otherActionRate = new ActionRate.Builder().withActionName(actionName).withEstimate(estimator).build();

        String actRate = actionRate.toString();
        assertThat(actRate, containsString(actionName.toString()));
        assertThat(actRate, containsString(estimate.toString()));
        assertThat(actRate, containsString(lowerBound.toString()));
        assertThat(actRate, containsString(upperBound.toString()));

        assertThat(actionRate.hashCode(), is(actionRate.clone().hashCode()));

        assertThat(actionRate, equalTo(otherActionRate));
        assertThat(actionRate, equalTo(actionRate));
        assertThat(actionRate, not(equalTo(null)));
        assertThat(actionRate, not(equalTo(estimator)));
    }

    @Test
    public void testSettersandGetters() {
        actionRate.setActionName(Event.Name.valueOf("TestOtherAction"));
        assertThat(actionRate.getActionName(), equalTo(Event.Name.valueOf("TestOtherAction")));
    }

}


text:
std::map<std::string, Symbol*> Module::globalSymbolMap;
std::map<std::string, Module*> Module::loadedModules;

void Module::init() {
	linkdef *ld = linkdefs;
	while (ld->name) {
		globalSymbolMap[ld->name] = new Symbol(ld->name, ld->address);
		ld++;
	}
}

Module *Module::start(std::string name) {
	File moduleFile("sd:/wimu/module/"+name+".mod");
	if (moduleFile.open("rb")) {
		long moduleFileSize = moduleFile.seek(0, SEEK_END);
		moduleFile.seek(0, SEEK_SET);
		u8* moduleFileData = new u8[moduleFileSize];
		moduleFile.read(moduleFileData, moduleFileSize);
		moduleFile.close();
		ELF *elf = new ELF(moduleFileData);
		Module *module = new Module(elf);
		if (module->link()) {
			loadedModules[name] = module;
			Logger::logf("%p", module->getSymbol("module")->address);
			module->thread = new Thread((void *(*)(void *))module->getSymbol("module")->address, module);
			return module;
		} else {
			Logger::log("module link failed");
			delete module;
			delete elf;
			delete moduleFileData;
			return false;
		}
	} else {
		Logger::log("module file open failed");
		return nullptr;
	}
}

bool Module::link() {
	//link stage 1: process relocations
	u32 i;

	for (i=0; i<elf->sectionCount; i++) {
		const Elf32_Shdr *section = elf->getSection(i);
		const char *name = elf->getString(section->sh_name);

		if (section->sh_type == SHT_REL) {
			Logger::log("TODO: SHT_REL");
			return false;
		} else if (section->sh_type == SHT_RELA) {
			u32 relocationCount = section->sh_size/section->sh_entsize;
			u32 ri;
			const Elf32_Rela *relocation = reinterpret_cast<const Elf32_Rela*>(elf->getSectionData(section));
			AllocSection *target = sections[section->sh_info];

			for (ri = 0; ri<relocationCount; ri++) {
				u32 type = ELF32_R_TYPE(relocation->r_info);
				const Elf32_Sym *symbol = elf->getSymbol(ELF32_R_SYM(relocation->r_info));
				const char *symbolName = elf->getSymbolName(symbol);
				//Logger::logf("%s %s %d", name, symbolName, relocation->r_addend);

				Symbol *sym = symbolMap[symbol];

				u32 address = 0;

				if (sym->type == STT_SECTION) {
					if (sym->elfSym) {
						//Logger::logf("%d %p", symbol->st_shndx, sections[sym->elfSym->st_shndx]->data);
						address = reinterpret_cast<u32>(sections[sym->elfSym->st_shndx]->data);
					}
				} else {
					address = sym->address;
				}

				u32 offset = reinterpret_cast<u32>(target->data+relocation->r_offset);

				//Logger::logf("Relocation Address: %p %p %d", address, offset, sym->type);
				u32 *data = reinterpret_cast<u32*>(target->data+relocation->r_offset);
				u16 *data16 = reinterpret_cast<u16*>(target->data+relocation->r_offset);
				u32 value = 0;
				u32 addend = relocation->r_addend;

				//Thanks https://github.com/Chadderz121/brainslug-wii
				switch (type) {
					case R_PPC_ADDR32:
					case R_PPC_ADDR24:
					case R_PPC_ADDR16:
					case R_PPC_ADDR16_HI:
					case R_PPC_ADDR16_HA:
					case R_PPC_ADDR16_LO:
					case R_PPC_ADDR14:
					case R_PPC_ADDR14_BRTAKEN:
					case R_PPC_ADDR14_BRNTAKEN:
					case R_PPC_UADDR32:
					case R_PPC_UADDR16: {
						value = address + addend;
						break;
					}
					case R_PPC_REL24:
					case R_PPC_REL14:
					case R_PPC_REL14_BRTAKEN:
					case R_PPC_REL14_BRNTAKEN:
					case R_PPC_REL32: {
						value = address + addend - offset;
						break;
					}
					case R_PPC_SECTOFF:
					case R_PPC_SECTOFF_LO:
					case R_PPC_SECTOFF_HI:
					case R_PPC_SECTOFF_HA: {
						value = offset + addend;
						break;
					}
					case R_PPC_EMB_NADDR32:
					case R_PPC_EMB_NADDR16:
					case R_PPC_EMB_NADDR16_LO:
					case R_PPC_EMB_NADDR16_HI:
					case R_PPC_EMB_NADDR16_HA: {
						value = addend - address;
						break;
					}
					default:
						Logger::logf("Unknown Relocation type %d", type);
						return false;
				}

				//TODO: Finish this up
				switch(type) {
					case R_PPC_NONE:
						break;
					case R_PPC_ADDR32:
					case R_PPC_UADDR32:
					case R_PPC_REL32:
					case R_PPC_SECTOFF:
					case R_PPC_EMB_NADDR32:
						*data = value;
						break;
					case R_PPC_REL24:
					case R_PPC_ADDR24:
						*data |= (value&0x03fffffc);
						break;
					case R_PPC_ADDR16:
						*data16 = value;
						break;
					case R_PPC_ADDR16_LO:
						*data16 = (value) & 0xFFFF;
						break;
					case R_PPC_ADDR16_HI:
						*data16 = (value & 0xFFFF)>>16;
						break;
					case R_PPC_ADDR16_HA:
						*data16 = (value >> 16) + ((value >> 15)&1);
						break;
					default:
						Logger::logf("Unknown Relocation type %d", type);
						return false;
				}

				relocation++;
			}
		}
	}
	//link stage 2: ???
	//link stage 3: profit
	//link stage 4: Hyaaaaah!

	return true;
}


text:
using System;
using MonoTouch.UIKit;
using MonoTouch.Foundation;

namespace GrannySmith
{
    public partial class GSFancyTextView : UIView
    {
    }

    public partial class GSFancyText : NSObject
    {

    }
}


text:
<resources xmlns:android="http://schemas.android.com/apk/res/android">

    <!--
        Default Mobihelp theme, dependent on API level. This theme is replaced
        by Mobihelp Theme from res/values-vXX/themes.xml on newer devices.
    -->
    <style name="Theme.MobihelpSDK" parent="@style/Theme.Base.Mobihelp">
        <item name="mh_ic_menu_search">@drawable/mobihelp_ic_action_search_dark</item>
        <item name="mh_ic_menu_submit">@drawable/mobihelp_ic_action_submit_dark</item>
        <item name="mh_ic_menu_contact_us">@drawable/mobihelp_ic_action_contact_us_dark</item>
        <item name="mh_ic_conversations">@drawable/mobihelp_ic_conversation_dark</item>
        <item name="mh_ic_send">@drawable/mobihelp_ic_action_send_dark</item>
        <item name="mh_ic_attach">@drawable/mobihelp_ic_action_attach_dark</item>
    </style>

    <style name="Theme.MobihelpSDK.Light" parent="@style/Theme.Base.Mobihelp.Light">
        <item name="mh_ic_menu_search">@drawable/mobihelp_ic_action_search_light</item>
        <item name="mh_ic_menu_submit">@drawable/mobihelp_ic_action_submit_light</item>
        <item name="mh_ic_menu_contact_us">@drawable/mobihelp_ic_action_contact_us_light</item>
        <item name="mh_ic_conversations">@drawable/mobihelp_ic_conversation_light</item>
        <item name="mh_ic_send">@drawable/mobihelp_ic_action_send_light</item>
        <item name="mh_ic_attach">@drawable/mobihelp_ic_action_attach_light</item>
    </style>

    <style name="Theme.MobihelpSDK.Light.DarkActionBar" parent="@style/Theme.Base.Mobihelp.Light.DarkActionBar">
        <item name="mh_ic_menu_search">@drawable/mobihelp_ic_action_search_dark</item>
        <item name="mh_ic_menu_submit">@drawable/mobihelp_ic_action_submit_dark</item>
        <item name="mh_ic_menu_contact_us">@drawable/mobihelp_ic_action_contact_us_dark</item>
        <item name="mh_ic_conversations">@drawable/mobihelp_ic_conversation_light</item>
        <item name="mh_ic_send">@drawable/mobihelp_ic_action_send_light</item>
        <item name="mh_ic_attach">@drawable/mobihelp_ic_action_attach_light</item>
    </style>

</resources>


text:
local Direction = class('Direction', Base)

function Direction:initialize(x, y)
  Base.initialize(self)
  self.x = x
  self.y = y

  if self.x == 0 and self.y == -1 then
    self.cardinal_name = "NORTH"
  elseif self.x == 0 and self.y == 1 then
    self.cardinal_name = "SOUTH"
  elseif self.x == 1 and self.y == 0 then
    self.cardinal_name = "EAST"
  elseif self.x == -1 and self.y == 0 then
    self.cardinal_name = "WEST"
  end
end

function Direction:unpack()
  return self.x, self.y
end

-- will sterilize the vector and return the most appropriate direction
function Direction.static.from_vector(x, y)

  -- only use the largest
  if math.abs(x) > math.abs(y) then y = 0 else x = 0 end

  -- is there a better way to force numbers to 1 or -1 depending on their sign?
  if x < 0 then x = -1 elseif x > 0 then x = 1 end
  if y < 0 then y = -1 elseif y > 0 then y = 1 end

  return Direction[x][y]
end

Direction.NORTH = Direction:new(0, -1)
Direction.SOUTH = Direction:new(0, 1)
Direction.EAST = Direction:new(1, 0)
Direction.WEST = Direction:new(-1, 0)

Direction[-1], Direction[0], Direction[1] = {}, {}, {}
Direction[0][-1] = Direction.NORTH
Direction[0][1] = Direction.SOUTH
Direction[1][0] = Direction.EAST
Direction[-1][0] = Direction.WEST

Direction.list = { Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST}

return Direction


text:
package com.googlecode.iqapps.testtools;

import static com.googlecode.iqapps.testtools.IOUtils.peek;
import static com.googlecode.iqapps.testtools.IOUtils.read;
import static java.lang.Character.isWhitespace;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.Iterator;

/**
 * Simple scanner to delimit Sql-like text.
 *
 * Iterates over a statement at a time.  Statements are broken on semicolons.
 * Multi-line single quoted string literals and double-dash comments are allowed.
 *
 * This class isn't thread-safe.
 *
 * @author philhsmith
 */
public class SqlScanner implements Iterator<String>, Iterable<String> {
	private final BufferedReader in;
	private final StringBuilder buf;
	private boolean sawEof;
	private String next;
	private int lineNumber;
	private int lineNumberStatementStartedOn;

	public SqlScanner(InputStream in) {
		this(new InputStreamReader(in));
	}

	public SqlScanner(Reader in) {
		this.in = new BufferedReader(in, 512);
		this.buf = new StringBuilder(64);
		this.next = null;
		this.sawEof = false;
		this.lineNumber = 1;
		this.lineNumberStatementStartedOn = 1;
	}

	public boolean hasNext() {
		if (next == null) next = pull();
		return next.length() > 0 || peek(in) != -1;
	}

	public String next() {
		if (next != null) {
			String current = next;
			next = null;
			return current;
		}

		return pull();
	}

	private String pull() {
		String stmt = pullSimpleStatement();

		if (startsCompoundStatement(stmt)) {
			String start = stmt;
			StringBuilder compound = new StringBuilder(stmt);

			stmt = pullSimpleStatement();
			while (!sawEof && !endsCompoundStatementStartedWith(start, stmt)) {
				compound.append("; ").append(stmt);
				stmt = pullSimpleStatement();
			}
			compound.append("; ").append(stmt);

			stmt = compound.toString();
		}

		return stmt;
	}

	private boolean startsCompoundStatement(String stmt) {
		return stmt.trim().toLowerCase().matches("create.*trigger.*");
	}

	private boolean endsCompoundStatementStartedWith(String start, String end) {
		return end.trim().toLowerCase().matches("end");
	}

	private String pullSimpleStatement() {
		boolean inString = false;
		boolean inComment = false;
		boolean seenNonWhiteSpaceOutsideComment = false;
		int c = -1;

		buf.replace(0, buf.length(), "");

		while (true) {
			c = read(in);
			if (c == -1) {
				sawEof = true;
				break;
			}

			if (c == '-' && peek(in) == '-' && !inString) inComment = true;
			if (c == '\n' || c == '\r') {
				if (c == '\r' && peek(in) == '\n')
					read(in);
				lineNumber++;
				inComment = false;
			}

			if (inComment) continue;

			if (!seenNonWhiteSpaceOutsideComment && !isWhitespace(c)) {
				seenNonWhiteSpaceOutsideComment = true;
				lineNumberStatementStartedOn = lineNumber;
			}

			if (c == ';' && !inString) break;

			// Sqlite3 single quotes are escaped by two single quotes. So, counting
			// parity works as a dirty trick for determining if we're in a string.
			if (c == '\'') inString = !inString;

			buf.appendCodePoint(c);
		}

		return buf.toString().trim();
	}

	public void close() {
		IOUtils.close(in);
	}

	public void remove() {
		throw new UnsupportedOperationException();
	}

	public Iterator<String> iterator() {
		return this;
	}

	public int getLineNumber() {
		return lineNumberStatementStartedOn;
	}
}


text:
'use strict';

module.exports = function (grunt) {
    // Unified Watch Object
    var watchFiles = {
        serverViews:  ['app/views/**/*.*'],
        serverJS:     ['gruntfile.js', 'server.js', 'config/**/*.js', 'app/**/*.js'],
        clientViews:  ['public/modules/**/views/**/*.html'],
        clientJS:     ['public/js/*.js', 'public/modules/**/*.js'],
        clientCSS:    ['public/css/**/*.css'],
        devSassDir:   ['public/modules/'],
        devSassFiles: ['public/modules/**/*.scss']
    };

    // Project Configuration
    grunt.initConfig({
        pkg:              grunt.file.readJSON('package.json'),
        watch:            {
            serverViews: {
                files:   watchFiles.serverViews,
                options: {
                    livereload: true
                }
            },
            serverJS:    {
                files:   watchFiles.serverJS,
                tasks:   ['jshint'],
                options: {
                    livereload: true
                }
            },
            clientViews: {
                files:   watchFiles.clientViews,
                options: {
                    livereload: true,
                }
            },
            clientJS:    {
                files:   watchFiles.clientJS,
                tasks:   ['jshint'],
                options: {
                    livereload: true
                }
            },
            clientCSS:   {
                files:   watchFiles.clientCSS,
                tasks:   ['csslint'],
                options: {
                    livereload: true
                }
            },
            sass:        {
                files: watchFiles.devSassFiles,
                tasks: ['compass']
            }
        },
        jshint:           {
            all: {
                src:     watchFiles.clientJS.concat(watchFiles.serverJS),
                options: {
                    jshintrc: true
                }
            }
        },
        csslint:          {
            options: {
                csslintrc: '.csslintrc',
            },
            all:     {
                src: watchFiles.clientCSS
            }
        },
        uglify:           {
            production: {
                options: {
                    mangle: false
                },
                files:   {
                    'public/dist/application.min.js': 'public/dist/application.js'
                }
            }
        },
        cssmin:           {
            combine: {
                files: {
                    'public/dist/application.min.css': '<%= applicationCSSFiles %>'
                }
            }
        },
        nodemon:          {
            dev: {
                script:  'server.js',
                options: {
                    nodeArgs: ['--debug'],
                    ext:      'js,html',
                    watch:    watchFiles.serverViews.concat(watchFiles.serverJS)
                }
            }
        },
        'node-inspector': {
            custom: {
                options: {
                    'web-port':          1337,
                    'web-host':          'localhost',
                    'debug-port':        5858,
                    'save-live-edit':    true,
                    'no-preload':        true,
                    'stack-trace-limit': 50,
                    'hidden':            []
                }
            }
        },
        ngAnnotate:       {
            production: {
                files: {
                    'public/dist/application.js': '<%= applicationJavaScriptFiles %>'
                }
            }
        },
        concurrent:       {
            default: ['nodemon', 'watch'],
            debug:   ['nodemon', 'watch', 'node-inspector'],
            options: {
                logConcurrentOutput: true,
                limit:               10
            }
        },
        env:              {
            test:   {
                NODE_ENV: 'test'
            },
            secure: {
                NODE_ENV: 'secure'
            }
        },
        compass:          {
            dist:       {
                options: {
                    imagesDir:   'modules',
                    fontsDir:    'modules',
                    sassDir:     watchFiles.devSassDir,
                    specify:     'public/modules/core/sass/core.scss',
                    cssDir:      ['public/css/'],
                    outputStyle: 'expanded'
                }
            },
            production: {
                options: {
                    imagesDir:   'modules',
                    fontsDir:   'modules',
                    sassDir:     watchFiles.devSassDir,
                    specify:     'public/modules/core/sass/core.scss',
                    cssDir:      ['public/css/'],
                    environment: 'production'
                }
            }
        }
    });

    // Load NPM tasks
    require('load-grunt-tasks')(grunt);

    // Making grunt default to force in order not to break the project.
    grunt.option('force', true);

    // A Task for loading the configuration object
    grunt.task.registerTask('loadConfig', 'Task that loads the config into a grunt option.', function () {
        var init   = require('./config/init')();
        var config = require('./config/config');

        grunt.config.set('applicationJavaScriptFiles', config.assets.js);
        grunt.config.set('applicationCSSFiles', config.assets.css);
    });

    // Default task(s).
    grunt.registerTask('default', ['compass:dist', 'lint', 'concurrent:default']);

    // Debug task.
    grunt.registerTask('debug', ['compass:dist', 'lint', 'concurrent:debug']);

    // Secure task(s).
    grunt.registerTask('secure', ['env:secure', 'compass:dist', 'lint', 'concurrent:default']);

    // Lint task(s).
    grunt.registerTask('lint', ['jshint', 'csslint']);

    // Build task(s).
    grunt.registerTask('build', ['compass:production', 'lint', 'loadConfig', 'ngAnnotate', 'uglify', 'cssmin']);
};


text:
package org.jbpm.designer.type;

import javax.enterprise.context.ApplicationScoped;

import org.uberfire.backend.vfs.Path;
import org.uberfire.workbench.type.ResourceTypeDefinition;

@ApplicationScoped
public class Bpmn2TypeDefinition implements ResourceTypeDefinition {

    @Override
    public String getShortName() {
        return "bpmn2";
    }

    @Override
    public String getDescription() {
        return "Business Processes";
    }

    @Override
    public String getPrefix() {
        return "";
    }

    @Override
    public String getSuffix() {
        return "bpmn2";
    }

    @Override
    public int getPriority() {
        return 0;
    }

    @Override
    public boolean accept( final Path path ) {
        return ( path.getFileName().endsWith( "." + getSuffix() ) || path.getFileName().endsWith( ".bpmn" ) );
    }

    @Override
    public String getSimpleWildcardPattern() {
        return ".+bpmn[2]?$";
    }
}


text:
var FieldType = require('../Type');
var TextType = require('../text/TextType');
var util = require('util');

/**
 * URL FieldType Constructor
 * @extends Field
 * @api public
 */
function url (list, path, options) {
	this._nativeType = String;
	this._underscoreMethods = ['format'];
	this._formatUrl = options.format || removeProtocolPrefix;
	url.super_.call(this, list, path, options);
}
util.inherits(url, FieldType);

/* Inherit from TextType prototype */
url.prototype.addFilterToQuery = TextType.prototype.addFilterToQuery;

/**
 * Formats the field value using either a supplied format function or default
 * which strips the leading protocol from the value for simpler display
 */
url.prototype.format = function (item) {
	var url = (item.get(this.path) || '');
	return this._formatUrl(url);
};

/**
 * Remove the protocol prefix from url
 */
function removeProtocolPrefix (url) {
	return url.replace(/^[a-zA-Z]+\:\/\//, '');
}

// TODO: Proper url validation

/* Export Field Type */
module.exports = url;


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.starquestminecraft</groupId>
        <artifactId>bukkit-plugin</artifactId>
        <version>1.0</version>
    </parent>

    <groupId>com.starquestminecraft.bukkit</groupId>
    <artifactId>chestfix</artifactId>
    <version>0.9.0</version>

    <name>ChestFix</name>
    <description>Prevents chests being accessed through walls. Includes furnaces etc.</description>

    <developers>
        <developer>
            <id>dan14941</id>
            <roles>
                <role>developer</role>
            </roles>
        </developer>
    </developers>

    <dependencies>
        <dependency>
            <groupId>me.lyneira</groupId>
            <artifactId>machina-core</artifactId>
            <version>1.9</version>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>
    </dependencies>

</project>


text:
import { NgModule } from '@angular/core';
import { AddonModAssignFeedbackCommentsModule } from './comments/comments.module';
import { AddonModAssignFeedbackEditPdfModule } from './editpdf/editpdf.module';
import { AddonModAssignFeedbackFileModule } from './file/file.module';

@NgModule({
    declarations: [],
    imports: [
        AddonModAssignFeedbackCommentsModule,
        AddonModAssignFeedbackEditPdfModule,
        AddonModAssignFeedbackFileModule
    ],
    providers: [
    ],
    exports: []
})
export class AddonModAssignFeedbackModule { }


text:
namespace JsonLdTypeMapper.Primitives
{
    public class Float : DataType<decimal>
    {
    }
}


text:
package repo

import (
	"encoding/json"
	"io"
)

type Revision string
type RevisionContents struct {
	Revision Revision
	Paths    []string
}

type RevisionMetadata struct {
	Revision    Revision
	Timestamp   int64
	Subject     string
	AuthorName  string
	AuthorEmail string
}

type Alias struct {
	Branch   string
	Revision Revision
	// TODO: Add LastModified and LastModifiedBy fields based on the RevisionMetadata
}

type Line struct {
	Revision   Revision
	FileName   string
	LineNumber int
	Contents   string
}

// Key that uniquely identifies a TODO.
type TodoId struct {
	Revision   Revision
	FileName   string
	LineNumber int
}

type TodoDetails struct {
	Id               TodoId
	RevisionMetadata RevisionMetadata
	Context          string
}

type TodoStatus struct {
	BranchesMissing []Alias
	BranchesPresent []Alias
	BranchesRemoved []Alias
}

type Repository interface {
	// Get an opaque ID that uniquely identifies this repo on this machine.
	GetRepoId() string
	// Get the path to this repo on this machine.
	GetRepoPath() string

	ListBranches() []Alias
	IsAncestor(ancestor, descendant Revision) bool
	ReadRevisionContents(revision Revision) *RevisionContents
	ReadRevisionMetadata(revision Revision) RevisionMetadata
	ReadFileSnippetAtRevision(revision Revision, path string, startLine, endLine int) string
	LoadRevisionTodos(revision Revision, todoRegex, excludePaths string) []Line
	LoadFileTodos(revision Revision, path string, todoRegex string) []Line
	FindClosingRevisions(todoId TodoId) []Revision

	GetBrowseUrl(revision Revision, path string, lineNumber int) string

	// Check that the given string is a valid revision.
	// This is intended for user input validation.
	ValidateRevision(revisionString string) (Revision, error)

	// Check that the given path is in the given revision.
	// This is intended for user input validation, and assumes that ValidateRevision
	// has already been called.
	ValidatePathAtRevision(revision Revision, path string) error

	// Check that the given line number exists for the given path in the given revision.
	// This is intended for user input validation, and assumes that ValidatePathAtRevision
	// has already been called.
	ValidateLineNumberInPathAtRevision(revision Revision, path string, lineNumber int) error
}

func WriteJson(w io.Writer, repository Repository) error {
	bytes, err := json.Marshal(repository.ListBranches())
	if err != nil {
		return err
	}
	w.Write(bytes)
	return nil
}

func LoadTodoDetails(repository Repository, todoId TodoId, linesBefore int, linesAfter int) *TodoDetails {
	startLine := todoId.LineNumber - linesBefore
	endLine := todoId.LineNumber + linesAfter + 1
	context := repository.ReadFileSnippetAtRevision(
		todoId.Revision, todoId.FileName, startLine, endLine)
	return &TodoDetails{
		Id:               todoId,
		RevisionMetadata: repository.ReadRevisionMetadata(todoId.Revision),
		Context:          context,
	}
}

func LoadTodoStatus(repository Repository, todoId TodoId) *TodoStatus {
	closingRevs := repository.FindClosingRevisions(todoId)
	missing := make([]Alias, 0)
	present := make([]Alias, 0)
	removed := make([]Alias, 0)
Branches:
	for _, alias := range repository.ListBranches() {
		if alias.Revision == todoId.Revision {
			present = append(present, alias)
		} else if repository.IsAncestor(todoId.Revision, alias.Revision) {
			for _, closingRev := range closingRevs {
				if repository.IsAncestor(closingRev, alias.Revision) {
					removed = append(removed, alias)
					continue Branches
				}
			}
			present = append(present, alias)
		} else {
			missing = append(missing, alias)
		}
	}
	return &TodoStatus{
		BranchesMissing: missing,
		BranchesPresent: present,
		BranchesRemoved: removed,
	}
}

func WriteTodosJson(w io.Writer, repository Repository, revision Revision, todoRegex, excludePaths string) error {
	bytes, err := json.Marshal(repository.LoadRevisionTodos(revision, todoRegex, excludePaths))
	if err != nil {
		return err
	}
	w.Write(bytes)
	return nil
}

func WriteTodoDetailsJson(w io.Writer, repository Repository, todoId TodoId) error {
	// TODO: Make the lines before and after a parameter.
	bytes, err := json.Marshal(LoadTodoDetails(repository, todoId, 5, 5))
	if err != nil {
		return err
	}
	w.Write(bytes)
	return nil
}

func WriteTodoStatusDetailsJson(w io.Writer, repository Repository, todoId TodoId) error {
	bytes, err := json.Marshal(LoadTodoStatus(repository, todoId))
	if err != nil {
		return err
	}
	w.Write(bytes)
	return nil
}


text:
package net.mybluemix.asmilk.service;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;

import net.mybluemix.asmilk.domain.Account;

@Validated
@Transactional
public interface AccountService {

	@NotNull
	Account save(@NotNull Account account);

	void delete(@Min(1) Long id);

	@Transactional(readOnly = true)
	@NotNull(message = "{account.find.null}")
	Account findOne(@Min(1) Long id);

	@PreAuthorize("hasRole('USER')")
	@Transactional(readOnly = true)
	@NotNull(message = "{account.any.null}")
	Account findMax();

	@Transactional(readOnly = true)
	@NotNull
	Page<Account> findAll(Pageable pageable);

	@Transactional(readOnly = true)
	@NotNull
	Page<Account> findAll(Example<Account> example, Pageable pageable);

	@PreAuthorize("hasRole('ADMIN')")
	@Transactional(readOnly = true)
	void sysGC();

}