text:
namespace twist {
  namespace iterator {
    namespace adaptor {
      template<
        typename BaseIterator,
        typename Index,
        typename Enable = void
      > class picked {};

      template< typename BaseIterator, typename Index >
      struct picked_value_type {
        typedef typename boost::mpl::at<
          typename boost::iterator_value< BaseIterator >::type,
          Index
        >::type type;
      };

      template< typename BaseIterator, typename Index >
      struct picked_base_type {
        typedef boost::iterator_adaptor<
          picked< BaseIterator, Index >,
          BaseIterator,
          typename picked_value_type< BaseIterator, Index >::type,
          typename twist::iterator::get_pure_traversal<
            typename boost::iterator_traversal< BaseIterator >::type
          >::type,
          typename picked_value_type< BaseIterator, Index >::type
        > type;
      };

      template< typename BaseIterator, typename Index >
      class picked< BaseIterator, Index > :
        public picked_base_type< BaseIterator, Index >::type {
      public:
        typedef picked< BaseIterator, Index > self_type;
        typedef typename picked_value_type< BaseIterator, Index >::type value_type;
        typedef typename picked_base_type< BaseIterator, Index >::type base_type;
        picked() {}
        explicit picked( const BaseIterator &iters ) : base_type( iters ) {}
        value_type dereference() const {
          return boost::fusion::at< Index >( *base_type::base_reference() );
        }
        void increment() {
          ++base_type::base_reference();
        }
        template< typename T = void >
        void decrement() {
          --base_type::base_reference();
        }
        template< typename T = void >
        bool equal( const self_type &y ) const {
          return y.base_reference() == base_type::base_reference();
        }
        template< typename T = void >
        void advance( int n ) {
          base_type::base_reference() += n;
        }
        template< typename T = void >
        typename boost::iterator_difference< BaseIterator >::type
        distance_to( const self_type &z ) const {
          return z.base_reference() - base_type::base_reference();
        }
      };
      template< typename Index, typename BaseIterator >
      picked< BaseIterator, Index > line( const BaseIterator &base ) {
        picked< BaseIterator, Index > temp( base );
        return temp;
      }
    }
  }
}

#endif

redpajama_set_name: RedPajamaGithub


text:
package ru.radiant.anormacro.conf

import ru.radiant.anormacro._

object Defaults {

  implicit val connectionSource: ConnSource = new PlayConnection

}


text:
require 'tempfile'
require 'rest-client'
require 'anypresence_generator/command'
require 'anypresence_generator/log'
require 'anypresence_generator/repository'
require 'anypresence_generator/template'
require 'anypresence_generator/utils/wrap_calls'

module AnypresenceGenerator
  class Workhorse
    include AnypresenceGenerator::Command
    include AnypresenceGenerator::Log
    include AnypresenceGenerator::Repository
    include AnypresenceGenerator::Utils::WrapCalls
    class WorkableError < StandardError; end

    attr_accessor :mock, :auth_token, :project_directory, :dump_project_directory, :workable, :raw_payload, :max_network_retry

    class << self
      attr_accessor :_steps, :_error_handler

      def steps(*steps)
        if self._steps.nil? || self._steps.blank?
          self._steps = steps
        else
          self._steps.push(steps)
        end
      end

      def error_handler(method_name)
        self._error_handler = method_name
      end
    end

    def initialize(json_payload: nil, auth_token: ( raise WorkableError.new('No Auth token provided.'.freeze) ), git_user:, git_email:, \
      sensitive_values: {}, mock: false, dump_project_directory: nil, log_to_stdout: false, log_timestamps: false, max_network_retry: nil)
      steps.each { |step| raise WorkableError.new("No method named '#{step.to_s}' in this class.") unless respond_to?(step) }
      raise WorkableError.new("No method named '#{self.class._error_handler}' in this class.") if self.class._error_handler && !respond_to?(self.class._error_handler)
      raise WorkableError.new("Git user and email cannot be nil.") if git_user.nil? || git_email.nil?
      self.raw_payload = json_payload
      self.workable = digest(json_payload: json_payload)
      self.mock = mock
      self.auth_token = auth_token
      self.git_user = git_user
      self.git_email = git_email
      self.sensitive_values = sensitive_values
      self.log_file = Tempfile.new(['logfile'.freeze,'txt'.freeze])
      self.log_to_stdout = log_to_stdout
      self.log_timestamps = log_timestamps
      self.dump_project_directory = dump_project_directory
      self.max_network_retry = max_network_retry
    end

    def work
      steps.each do |step|
        increment_step! step
        self.send(step)
      end
    end

    def start!
      Dir.mktmpdir do |dir|
        begin
          self.project_directory = File.join(dir, workable.id.to_s)
          FileUtils.mkdir_p(project_directory)
          work
          success! "Completed work!".freeze
          return true
        rescue
          error! "Process has failed with the following error: #{$!.message}"
          send(self.class._error_handler, $!) if self.class._error_handler && respond_to?(self.class._error_handler)
          return false
        ensure
          copy_working_directory if dump_project_directory
          log "Deleting temporary files".freeze
          begin
            FileUtils.remove_entry project_directory
          rescue
            log "Exception deleting '#{project_directory}': #{$!.message}"
          end
        end
      end
    end

    def run_templates(*templates)
      templates.each do |template|
        raise WorkableError.new("Not a template!") unless template.is_a?(AnypresenceGenerator::Template)
        template.write!
        yield template.fully_qualified_output_file if block_given?
      end
    end

    def error!(message)
      log "Error: #{message}"
      write_log! rescue nil
      with_retry(max_network_retry) { RestClient.put( workable.error_url, nil, { authorization: "Token token=\"#{auth_token}\"", content_type: :json, accept: :json } ) unless mock }
    end

    def success!(message)
      log "Success: #{message}"
      write_log!
      with_retry(max_network_retry) { RestClient.put( workable.success_url, nil, { authorization: "Token token=\"#{auth_token}\"", content_type: :json, accept: :json } ) unless mock }
    end

    def increment_step!(step)
      log "Incrementing step to #{step}..."
      write_log!
      with_retry(max_network_retry) { RestClient.put( workable.increment_step_url, { step: step }.to_json, { authorization: "Token token=\"#{auth_token}\"", content_type: :json, accept: :json } ) unless mock }
    end

    def upload_artifacts
      log 'Creating artifacts archive.'
      artifacts = Tempfile.new(['artifacts','.zip'])
      artifacts.close
      FileUtils.rm(artifacts)
      exclude = "-x "
      %w{.git/* .git/ tmp/* .tmp/* vendor/* .bundle/* node_modules/* git_archive.zip}.each { |ignore| exclude << %|"./#{ignore}" | }
      run_command(%|cd #{project_directory} && zip -r "#{artifacts.path}" . #{exclude}|, silence: true)
      log "Uploading artifacts archive"
      with_retry(max_network_retry) { RestClient.put( workable.writeable_artifact_url, File.open(artifacts), multipart: true, content_type: 'application/zip' ) unless mock }
      with_retry(max_network_retry) { RestClient.put( workable.artifacts_uploaded_url, nil, { authorization: "Token token=\"#{auth_token}\"", content_type: :json, accept: :json } ) unless mock }
      FileUtils.cp(File.path(artifacts), "#{project_directory}/artifacts.zip")
    end

    def upload_readme
      if File.exists?("#{project_directory}/#{readme_name}")
        log "Uploading #{readme_name}."
        with_retry(max_network_retry) { RestClient.put( workable.writeable_readme_url, File.open("#{project_directory}/#{readme_name}"), multipart: true, content_type: 'text/plain' ) unless mock }
        with_retry(max_network_retry) { RestClient.put( workable.readme_uploaded_url, nil, { authorization: "Token token=\"#{auth_token}\"", content_type: :json, accept: :json } ) unless mock }
      else
        log "No #{readme_name} found, skipping upload."
      end
    end

    private

    def steps
      raise 'Subclasses must implement!'
    end

    def readme_name
      'README.md'.freeze
    end

    def write_log!
      with_retry(max_network_retry) { RestClient.put( workable.writeable_log_url, File.open(log_file), multipart: true, content_type: 'text/plain', content_disposition: 'inline' ) unless mock }
    end

    def copy_working_directory
      FileUtils.rm_rf dump_project_directory
      FileUtils.mkdir_p dump_project_directory
      FileUtils.cp_r "#{project_directory}/.", dump_project_directory
      File.open(File.join(dump_project_directory, "workhorse.log"), 'w') { |file| file.write log_content }
    end
  end
end


text:
package com.sleepycat.je;

import com.sleepycat.je.txn.Locker;

/**
 * Base class for exceptions thrown when a write operation fails because of a
 * secondary constraint.  See subclasses for more information.
 *
 *
The {@link Transaction} handle is invalidated as a result of this
 * exception.

 *
 * @see Special considerations
 * for using Secondary Databases with and without Transactions
 *
 * @since 4.0
 */
public abstract class SecondaryConstraintException
    extends SecondaryReferenceException {

    /**
     * For internal use only.
     * @hidden
     */
    public SecondaryConstraintException(Locker locker,
                                        String message,
                                        String secDbName,
                                        DatabaseEntry secKey,
                                        DatabaseEntry priKey) {
        super(locker, message, secDbName, secKey, priKey);
    }

    /**
     * For internal use only.
     * @hidden
     */
    SecondaryConstraintException(String message,
                                 SecondaryReferenceException cause) {
        super(message, cause);
    }
}


text:
require 'spec_helper'
describe "The OSVDB_121701 vulnerability" do
	before(:all) do
		@check = Dawn::Kb::OSVDB_121701.new
		# @check.debug = true
	end
	it "is reported when the vulnerable gem is detected" do
    @check.dependencies = [{:name=>"open-uri-cached", :version=>"0.0.4"}]
    expect(@check.vuln?).to   eq(true)
  end
  it "is not reported when a fixed release is detected" do
    @check.dependencies = [{:name=>"open-uri-cached", :version=>"0.0.5"}]
    expect(@check.vuln?).to   eq(false)
  end
end


text:
package org.opensmartgridplatform.adapter.domain.smartmetering.application.services;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;

import org.junit.Test;

import org.opensmartgridplatform.adapter.domain.smartmetering.application.mapping.ConfigurationMapper;
import org.opensmartgridplatform.domain.core.valueobjects.smartmetering.CosemDate;
import org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SpecialDay;
import org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SpecialDaysRequest;
import org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SpecialDaysRequestData;
import org.opensmartgridplatform.dto.valueobjects.smartmetering.CosemDateDto;
import org.opensmartgridplatform.dto.valueobjects.smartmetering.SpecialDayDto;
import org.opensmartgridplatform.dto.valueobjects.smartmetering.SpecialDaysRequestDataDto;
import org.opensmartgridplatform.dto.valueobjects.smartmetering.SpecialDaysRequestDto;

// Tests the mapping of SpecialDaysRequest objects in ConfigurationService.
public class SpecialDaysRequestMappingTest {

    private ConfigurationMapper configurationMapper = new ConfigurationMapper();

    // To check mapping of SpecialDaysRequest, when its SpecialDaysRequestData
    // is null
    @Test
    public void testSpecialDaysRequestMappingNull() {
        final String deviceIdentification = "nr1";
        final SpecialDaysRequestData specialDaysRequestData = null;
        final SpecialDaysRequest specialDaysRequestValueObject =
                new SpecialDaysRequest(deviceIdentification,
                specialDaysRequestData);

        final SpecialDaysRequestDto specialDaysRequestDto = this.configurationMapper.map(specialDaysRequestValueObject,
                SpecialDaysRequestDto.class);

        assertNotNull(specialDaysRequestDto);
        assertEquals(deviceIdentification, specialDaysRequestDto.getDeviceIdentification());
        assertNull(specialDaysRequestDto.getSpecialDaysRequestData());

    }

    // To check mapping of SpecialDaysRequest, when its SpecialDaysRequestData
    // has an empty List.
    @Test
    public void testSpecialDaysRequestMappingEmptyList() {
        final String deviceIdentification = "nr1";
        final SpecialDaysRequestData specialDaysRequestData = new SpecialDaysRequestDataBuilder().build();
        final SpecialDaysRequest specialDaysRequestValueObject =
                new SpecialDaysRequest(deviceIdentification,
                specialDaysRequestData);

        final SpecialDaysRequestDto specialDaysRequestDto = this.configurationMapper.map(specialDaysRequestValueObject,
                SpecialDaysRequestDto.class);

        assertEquals(deviceIdentification, specialDaysRequestDto.getDeviceIdentification());
        assertNotNull(specialDaysRequestDto.getSpecialDaysRequestData());
    }

    // To check mapping of SpecialDaysRequest, when its SpecialDaysRequestData
    // has a filled List (1 value).
    @Test
    public void testSpecialDaysRequestMappingNonEmptyList() {
        final String deviceIdentification = "nr1";
        final int year = 2016;
        final int month = 3;
        final int dayOfMonth = 11;
        final int dayId = 1;
        final SpecialDay specialDay = new SpecialDay(new CosemDate(year, month, dayOfMonth), dayId);
        final SpecialDaysRequestData specialDaysRequestData = new SpecialDaysRequestDataBuilder().addSpecialDay(
                specialDay).build();
        final SpecialDaysRequest specialDaysRequestValueObject =
                new SpecialDaysRequest(deviceIdentification,
                specialDaysRequestData);

        final SpecialDaysRequestDto specialDaysRequestDto = this.configurationMapper.map(specialDaysRequestValueObject,
                SpecialDaysRequestDto.class);
        assertEquals(deviceIdentification, specialDaysRequestDto.getDeviceIdentification());

        final SpecialDaysRequestDataDto requestDataDto = specialDaysRequestDto.getSpecialDaysRequestData();
        assertNotNull(requestDataDto);
        assertNotNull(requestDataDto.getSpecialDays());
        assertEquals(dayId, requestDataDto.getSpecialDays().size());

        final SpecialDayDto specialDayDto = requestDataDto.getSpecialDays().get(0);
        assertEquals(dayId, specialDayDto.getDayId());

        final CosemDateDto specialDayDateDto = specialDayDto.getSpecialDayDate();
        assertEquals(year, specialDayDateDto.getYear());
        assertEquals(month, specialDayDateDto.getMonth());
        assertEquals(dayOfMonth, specialDayDateDto.getDayOfMonth());
    }

    // To check mapping of SpecialDaysRequest, when its SpecialDaysRequestData
    // has a filled List (1 value), where CosemDate is not specified.
    @Test
    public void testSpecialDaysRequestMappingNonEmptyListNoCosemDate() {
        final String deviceIdentification = "nr1";
        final int dayId = 1;
        final SpecialDay specialDay = new SpecialDay(new CosemDate(), dayId);
        final SpecialDaysRequestData specialDaysRequestData = new SpecialDaysRequestDataBuilder().addSpecialDay(
                specialDay).build();
        final SpecialDaysRequest specialDaysRequestValueObject =
                new SpecialDaysRequest(deviceIdentification,
                specialDaysRequestData);

        final SpecialDaysRequestDto specialDaysRequestDto = this.configurationMapper.map(specialDaysRequestValueObject,
                SpecialDaysRequestDto.class);
        assertEquals(deviceIdentification, specialDaysRequestDto.getDeviceIdentification());

        final SpecialDaysRequestDataDto requestDataDto = specialDaysRequestDto.getSpecialDaysRequestData();
        assertNotNull(requestDataDto);
        assertNotNull(requestDataDto.getSpecialDays());
        assertEquals(dayId, requestDataDto.getSpecialDays().size());

        final SpecialDayDto specialDayDto = requestDataDto.getSpecialDays().get(0);
        assertEquals(dayId, specialDayDto.getDayId());

        final CosemDate specialDayDate = specialDay.getSpecialDayDate();
        final CosemDateDto specialDayDateDto = specialDayDto.getSpecialDayDate();
        assertEquals(specialDayDate.getYear(), specialDayDateDto.getYear());
        assertEquals(specialDayDate.getMonth(), specialDayDateDto.getMonth());
        assertEquals(specialDayDate.getDayOfMonth(), specialDayDateDto.getDayOfMonth());
    }

}


text:
using System;
using System.Web.Mvc;
using System.Web.Routing;
using System.Web.SessionState;
using Umbraco.Core;

namespace Umbraco.Web.Mvc
{
    /// <summary>
    /// Abstract filtered controller factory used for all Umbraco controller factory implementations
    /// </summary>
    public abstract class UmbracoControllerFactory : IFilteredControllerFactory
    {
        private readonly OverridenDefaultControllerFactory _innerFactory = new OverridenDefaultControllerFactory();

        public abstract bool CanHandle(RequestContext request);

        public virtual Type GetControllerType(RequestContext requestContext, string controllerName)
        {
            return _innerFactory.GetControllerType(requestContext, controllerName);
        }

        /// <summary>
        /// Creates the specified controller by using the specified request context.
        /// </summary>
        /// <returns>
        /// The controller.
        /// </returns>
        /// <param name="requestContext">The request context.</param><param name="controllerName">The name of the controller.</param>
        public virtual IController CreateController(RequestContext requestContext, string controllerName)
        {
            var controllerType = GetControllerType(requestContext, controllerName) ??
                                 _innerFactory.GetControllerType(
                                     requestContext,
                                     ControllerExtensions.GetControllerName(
                                         DefaultRenderMvcControllerResolver.Current.GetDefaultControllerType()));

            return _innerFactory.GetControllerInstance(requestContext, controllerType);
        }

        /// <summary>
        /// Gets the controller's session behavior.
        /// </summary>
        /// <returns>
        /// The controller's session behavior.
        /// </returns>
        /// <param name="requestContext">The request context.</param><param name="controllerName">The name of the controller whose session behavior you want to get.</param>
        public SessionStateBehavior GetControllerSessionBehavior(RequestContext requestContext, string controllerName)
        {
            return ((IControllerFactory)_innerFactory).GetControllerSessionBehavior(requestContext, controllerName);
        }

        /// <summary>
        /// Releases the specified controller.
        /// </summary>
        /// <param name="controller">The controller.</param>
        public void ReleaseController(IController controller)
        {
            _innerFactory.ReleaseController(controller);
        }

        /// <summary>
        /// By default, <see cref="DefaultControllerFactory"/> only exposes <see cref="IControllerFactory.CreateController"/> which throws an exception
        /// if the controller is not found. Since we want to try creating a controller, and then fall back to <see cref="RenderMvcController"/> if one isn't found,
        /// this nested class changes the visibility of <see cref="DefaultControllerFactory"/>'s internal methods in order to not have to rely on a try-catch.
        /// </summary>
        /// <remarks></remarks>
        internal class OverridenDefaultControllerFactory : DefaultControllerFactory
        {
            public new IController GetControllerInstance(RequestContext requestContext, Type controllerType)
            {
                return base.GetControllerInstance(requestContext, controllerType);
            }

            public new Type GetControllerType(RequestContext requestContext, string controllerName)
            {
                if (controllerName.IsNullOrWhiteSpace())
                {
                    return null;
                }
                return base.GetControllerType(requestContext, controllerName);
            }
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;

namespace FluentBoilerplate.Runtime.Extensions
{
    internal static class DynamicMethodExtensions
    {
        public static T Create<T>(this DynamicMethod method)
        {
            return (T)(object)method.CreateDelegate(typeof(T));
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">PracticalTest01</string>
    <string name="hello_world">Hello world!</string>
    <string name="action_settings">Settings</string>
    <string name="navigate">Navigate to secondary activity!</string>
    <string name="press_left">Press me!</string>
    <string name="press_right">Press mee, too!</string>
    <string name="left_text">0</string>
    <string name="right_text">0</string>
    <string name="title_activity_practicaltest01_secondary">Practicaltest01SecondaryActivity</string>
    <string name="okButton">Ok</string>
    <string name="cancelButton">Cancel</string>
    <string name="sumText">0</string>

</resources>


text:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using System.Text;
using System.Threading.Tasks;

namespace LuceneNetCzechSupport.IFilter
{
    internal static class NativeMethods
    {
        [DllImport("query.dll", SetLastError = true, CharSet = CharSet.Unicode)]
        public static extern FilterReturnCodes LoadIFilter(
            string pwcsPath,
            [MarshalAs(UnmanagedType.IUnknown)] object pUnkOuter,
            ref IFilter ppIUnk);

        [DllImport("ole32.dll")]
        public static extern int CreateStreamOnHGlobal(IntPtr hGlobal, bool fDeleteOnRelease, out IStream ppstm);
    }

    [ComImport, Guid("89BCB740-6119-101A-BCB7-00DD010655AF")]
    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IFilter
    {
        [PreserveSig]
        FilterReturnCodes Init(FilterInit grfFlags, int cAttributes, IntPtr aAttributes, out FilterFlags pdwFlags);

        [PreserveSig]
        FilterReturnCodes GetChunk(out StatChunk pStat);

        [PreserveSig]
        FilterReturnCodes GetText(
            ref int pcwcBuffer,
            [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder awcBuffer);

        [PreserveSig]
        FilterReturnCodes GetValue(ref IntPtr propVal);

        [PreserveSig]
        FilterReturnCodes BindRegion(ref FilterRegion origPos, ref Guid riid, ref object ppunk);
    }

    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("0000010c-0000-0000-C000-000000000046")]
    public interface IPersist
    {
        void GetClassID(out Guid pClassID);
    }

    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("00000109-0000-0000-C000-000000000046")]
    public interface IPersistStream : IPersist
    {
        new void GetClassID(out Guid pClassID);

        [PreserveSig]
        int IsDirty();

        void Load([In] IStream pStm);

        void Save(
            [In] IStream pStm,
            [In, MarshalAs(UnmanagedType.Bool)] bool fClearDirty);

        void GetSizeMax(out long pcbSize);
    }

    public struct StatChunk
    {
        public int idChunk;
        [MarshalAs(UnmanagedType.U4)]
        public ChunkBreaktype breakType;
        [MarshalAs(UnmanagedType.U4)]
        public ChunkState flags;
        public int locale;
        public FullPropSpec attribute;
        public int idChunkSource;
        public int cwcStartSource;
        public int cwcLenSource;
    }

    public enum ChunkBreaktype
    {
        CHUNK_NO_BREAK = 0,
        CHUNK_EOW = 1,
        CHUNK_EOS = 2,
        CHUNK_EOP = 3,
        CHUNK_EOC = 4
    }

    public enum ChunkState
    {
        CHUNK_TEXT = 0x1,
        CHUNK_VALUE = 0x2,
        CHUNK_FILTER_OWNED_VALUE = 0x4
    }

    [Flags]
    public enum FilterFlags
    {
        IFILTER_FLAGS_OLE_PROPERTIES = 1
    }

    [Flags]
    public enum FilterInit
    {
        IFILTER_INIT_CANON_PARAGRAPHS = 1,
        IFILTER_INIT_HARD_LINE_BREAKS = 2,
        IFILTER_INIT_CANON_HYPHENS = 4,
        IFILTER_INIT_CANON_SPACES = 8,
        IFILTER_INIT_APPLY_INDEX_ATTRIBUTES = 16,
        IFILTER_INIT_APPLY_CRAWL_ATTRIBUTES = 256,
        IFILTER_INIT_APPLY_OTHER_ATTRIBUTES = 32,
        IFILTER_INIT_INDEXING_ONLY = 64,
        IFILTER_INIT_SEARCH_LINKS = 128,
        IFILTER_INIT_FILTER_OWNED_VALUE_OK = 512
    }

    public struct FilterRegion
    {
        public int idChunk;
        public int cwcStart;
        public int cwcExtent;
    }

    public enum FilterReturnCodes : uint
    {
        S_OK = 0,
        E_ACCESSDENIED = 0x80070005,
        E_HANDLE = 0x80070006,
        E_INVALIDARG = 0x80070057,
        E_OUTOFMEMORY = 0x8007000E,
        E_NOTIMPL = 0x80004001,
        E_FAIL = 0x80000008,
        FILTER_E_PASSWORD = 0x8004170B,
        FILTER_E_UNKNOWNFORMAT = 0x8004170C,
        FILTER_E_NO_TEXT = 0x80041705,
        FILTER_E_NO_VALUES = 0x80041706,
        FILTER_E_END_OF_CHUNKS = 0x80041700,
        FILTER_E_NO_MORE_TEXT = 0x80041701,
        FILTER_E_NO_MORE_VALUES = 0x80041702,
        FILTER_E_ACCESS = 0x80041703,
        FILTER_W_MONIKER_CLIPPED = 0x00041704,
        FILTER_E_EMBEDDING_UNAVAILABLE = 0x80041707,
        FILTER_E_LINK_UNAVAILABLE = 0x80041708,
        FILTER_S_LAST_TEXT = 0x00041709,
        FILTER_S_LAST_VALUES = 0x0004170A
    }

    public struct FullPropSpec
    {
        public Guid guidPropSet;
        public PropSpec psProperty;
    }

    [StructLayout(LayoutKind.Explicit)]
    public struct PropSpec
    {
        [FieldOffset(0)]
        public int ulKind;

        [FieldOffset(4)]
        public int propid;

        [FieldOffset(4)]
        public IntPtr lpwstr;
    }
}

namespace JobManagement
{
    public class Job : IDisposable
    {
        [DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
        static extern IntPtr CreateJobObject(IntPtr a, string lpName);

        [DllImport("kernel32.dll")]
        static extern bool SetInformationJobObject(IntPtr hJob, JobObjectInfoType infoType, IntPtr lpJobObjectInfo, UInt32 cbJobObjectInfoLength);

        [DllImport("kernel32.dll", SetLastError = true)]
        static extern bool AssignProcessToJobObject(IntPtr job, IntPtr process);

        [DllImport("kernel32.dll")]
        public static extern bool IsProcessInJob(IntPtr Process, IntPtr Job, out bool Result);

        [DllImport("kernel32.dll")]
        static extern IntPtr GetCurrentProcess();

        private IntPtr handle;
        private bool disposed;

        public Job()
        {
            handle = CreateJobObject(IntPtr.Zero, "MyJob");

            var info = new JOBOBJECT_BASIC_LIMIT_INFORMATION
            {
                LimitFlags = 0x2000
            };

            var extendedInfo = new JOBOBJECT_EXTENDED_LIMIT_INFORMATION
            {
                BasicLimitInformation = info
            };

            int length = Marshal.SizeOf(typeof(JOBOBJECT_EXTENDED_LIMIT_INFORMATION));
            IntPtr extendedInfoPtr = Marshal.AllocHGlobal(length);
            Marshal.StructureToPtr(extendedInfo, extendedInfoPtr, false);

            if (!SetInformationJobObject(handle, JobObjectInfoType.ExtendedLimitInformation, extendedInfoPtr, (uint)length))
                throw new Exception(string.Format("Unable to set information.  Error: {0}", Marshal.GetLastWin32Error()));
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (disposed)
                return;

            if (disposing) { }

            Close();
            disposed = true;
        }

        public void Close()
        {
            Win32.CloseHandle(handle);
            handle = IntPtr.Zero;
        }

        public bool AddProcess(IntPtr processHandle)
        {
            return AssignProcessToJobObject(handle, processHandle);
        }

        public bool AddProcess(int processId)
        {
            return AddProcess(Process.GetProcessById(processId).Handle);
        }

        public void AddCurrentProces()
        {
            var curProc = GetCurrentProcess();
            bool bResult = false;
            var iResult = IsProcessInJob(curProc, IntPtr.Zero, out bResult);
            if (iResult != false && bResult == false)
            {
                //var hJob = CreateJobObject(IntPtr.Zero, "MyJob");
                //AssignProcessToJobObject(hJob, curProc);
                //using this job instead

                AddProcess(curProc);
            }
        }

    }

    #region Helper classes

    [StructLayout(LayoutKind.Sequential)]
    struct IO_COUNTERS
    {
        public UInt64 ReadOperationCount;
        public UInt64 WriteOperationCount;
        public UInt64 OtherOperationCount;
        public UInt64 ReadTransferCount;
        public UInt64 WriteTransferCount;
        public UInt64 OtherTransferCount;
    }

    [StructLayout(LayoutKind.Sequential)]
    struct JOBOBJECT_BASIC_LIMIT_INFORMATION
    {
        public Int64 PerProcessUserTimeLimit;
        public Int64 PerJobUserTimeLimit;
        public UInt32 LimitFlags;
        public UIntPtr MinimumWorkingSetSize;
        public UIntPtr MaximumWorkingSetSize;
        public UInt32 ActiveProcessLimit;
        public UIntPtr Affinity;
        public UInt32 PriorityClass;
        public UInt32 SchedulingClass;
    }

    [StructLayout(LayoutKind.Sequential)]
    public struct SECURITY_ATTRIBUTES
    {
        public UInt32 nLength;
        public IntPtr lpSecurityDescriptor;
        public Int32 bInheritHandle;
    }

    [StructLayout(LayoutKind.Sequential)]
    struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION
    {
        public JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation;
        public IO_COUNTERS IoInfo;
        public UIntPtr ProcessMemoryLimit;
        public UIntPtr JobMemoryLimit;
        public UIntPtr PeakProcessMemoryUsed;
        public UIntPtr PeakJobMemoryUsed;
    }

    public enum JobObjectInfoType
    {
        AssociateCompletionPortInformation = 7,
        BasicLimitInformation = 2,
        BasicUIRestrictions = 4,
        EndOfJobTimeInformation = 6,
        ExtendedLimitInformation = 9,
        SecurityLimitInformation = 5,
        GroupInformation = 11
    }

    #endregion

    public class Win32
    {
        [DllImport("kernel32.dll", SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool CloseHandle(IntPtr hObject);
    }
}


text:
package org.dcm4chee.web.war.tc;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.basic.MultiLineLabel;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.Model;
import org.dcm4chee.web.dao.tc.TCQueryFilterKey;
import org.dcm4chee.web.dao.tc.TCQueryFilterValue.YesNo;

/**
 * @author Bernhard Ableitinger <bernhard.ableitinger@agfa.com>
 * @version $Revision$ $Date$
 * @since May 27, 2011
 */
public class TCDetailsDiagnosisTab extends Panel {

    private static final long serialVersionUID = 1L;

    public TCDetailsDiagnosisTab(final String id) {
        super(id);

        add(new MultiLineLabel("details-diagnosis", new Model<String>() {

            private static final long serialVersionUID = 1L;

            @Override
            public String getObject() {
                return getStringValue(TCQueryFilterKey.Diagnosis);
            }
        }));

        add(new Label("details-diagnosis-confirmed", new Model<String>() {

            private static final long serialVersionUID = 1L;

            @Override
            public String getObject() {
                YesNo yesno = null;

                TCObject tc = getTCObject();
                if (tc != null) {
                    yesno = tc.getDiagnosisConfirmed();
                }

                if (yesno == null)
                {
                    return getString("tc.yesno.unknown");
                }
                else
                {
                    return getString("tc.yesno." + yesno.name().toLowerCase());
                }
            }
        }));
    }

    public static boolean hasDataToShow(TCObject tc) {
        if (tc != null) {
            return tc.getDiagnosis() != null
                    || tc.getDiagnosisConfirmed() != null;
        }

        return false;
    }

    private TCObject getTCObject() {
        return (TCObject) getDefaultModelObject();
    }

    private String getStringValue(TCQueryFilterKey key) {
        TCObject tc = getTCObject();

        String s = tc != null ? tc.getValueAsString(key) : null;

        return s != null ? s : "-";
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<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>ch.epfl.bbp.nlp</groupId>
        <artifactId>bluima_parent</artifactId>
        <version>1.0.2-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>bluima_module</artifactId>
    <packaging>pom</packaging>
    <name>Bluima Modules POM</name>
    <description>Modules POM for bluima project, including common dependencies and repositories</description>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <uimaDependencyVersion>2.4</uimaDependencyVersion>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
        <scala.version>2.10.4</scala.version>
        <scala.main.version>2.10</scala.main.version>
        <jetty.maven.version>7.1.6.v20100715</jetty.maven.version>
        <jersey.version>1.7</jersey.version>
        <jackson.version>1.7.7</jackson.version>
        <slf4j.version>1.6.5</slf4j.version>
    </properties>

    <modules>
        <module>bluima_utils</module>
        <module>bluima_xml</module>
        <module>bluima_scripting</module>
        <module>bluima_jython</module>
        <module>bluima_db</module>
        <module>bluima_units</module>
        <module>bluima_lexica</module>
        <module>bluima_commons</module>
        <module>bluima_opennlp</module>
        <module>bluima_banner</module>
        <module>bluima_oscar4</module>
        <module>bluima_fusion</module>
        <module>bluima_topic_models</module>
        <module>bluima_abbreviations</module>
        <module>bluima_corpora</module>
        <module>bluima_pubmed_ws</module>
        <module>bluima_pdf</module>
        <module>bluima_mongodb</module>
        <module>bluima_elasticsearch</module>
        <module>bluima_regions</module>
        <module>bluima_jsre</module>
        <module>bluima_text2pmid</module>
        <module>bluima_references_classifier</module>
        <module>bluima_protein_concentrations</module>
        <module>bluima_neuroner</module>
        <module>bluima_bbp</module>
    </modules>

    <!-- DEPENDENCIES SHARED AMONG ALL MODULES -->
    <dependencies>

        <!-- COMMON UTILS -->
        <dependency>
            <artifactId>bluima_typesystem</artifactId>
            <groupId>${project.groupId}</groupId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <artifactId>blue_commons</artifactId>
            <groupId>${project.groupId}</groupId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>18.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-math3</artifactId>
            <version>3.0</version>
        </dependency>

        <!-- UIMA -->
        <dependency>
            <groupId>org.apache.uima</groupId>
            <artifactId>ruta-core</artifactId>
            <version>${ruta.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.uima</groupId>
            <artifactId>RegularExpressionAnnotator</artifactId>
            <version>2.3.2-BBP</version>
        </dependency>
        <dependency>
            <groupId>org.apache.uima</groupId>
            <artifactId>SnowballAnnotator</artifactId>
            <version>2.3.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.uima</groupId>
            <artifactId>ConceptMapper</artifactId>
            <version>2.3.1</version>
        </dependency>

        <!-- LOGGING -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>1.6.5</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.0.6</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.6.5</version>
        </dependency>

        <!-- TESTING -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>ren_googlecode</id>
            <url>https://ren-maven-repo.googlecode.com/git/snapshots/</url>
        </repository>
        <repository>
            <name>Github personal repo (renaudr)</name>
            <id>renaudr</id>
            <url>https://github.com/renaud/maven_repo/raw/master/snapshots</url>
        </repository>
        <repository>
            <name>Github personal repo (renaudr)</name>
            <id>renaudr2</id>
            <url>https://raw.github.com/renaud/maven_repo/master/snapshots</url>
        </repository>
        <repository>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>central</id>
            <name>Maven Repository Switchboard</name>
            <url>http://repo1.maven.org/maven2</url>
        </repository>
        <repository>
            <id>apache snapshots</id>
            <url>http://people.apache.org/repo/m2-snapshot-repository/</url>
        </repository>
        <repository>
            <id>apache snapshots2</id>
            <url>http://repository.apache.org/snapshots/</url>
        </repository>
        <repository>
            <id>ApacheIncubatorRepository</id>
            <url>http://people.apache.org/repo/m2-incubating-repository/</url>
        </repository>
        <repository>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>JBoss</id>
            <name>jboss-maven2-release-repository</name>
            <url>https://oss.sonatype.org/content/repositories/JBoss</url>
        </repository>
        <repository>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <name>Old OpenNLP repo</name>
            <id>old-opennlp</id>
            <url>http://opennlp.sourceforge.net/maven2/</url>
        </repository>
        <repository>
            <id>com.springsource.repository.bundles.release</id>
            <name>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</name>
            <url>http://repository.springsource.com/maven/bundles/release</url>
        </repository>
        <repository>
            <id>com.springsource.repository.bundles.external</id>
            <name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
            <url>http://repository.springsource.com/maven/bundles/external</url>
        </repository>
        <repository>
            <id>cleartk-googlecode</id>
            <name>ClearTK Google Code repository</name>
            <url>http://cleartk.googlecode.com/svn/repo/</url>
        </repository>
        <repository>
            <id>scala-tools.org</id>
            <name>Scala-Tools Maven2 Repository</name>
            <url>http://nexus.scala-tools.org/content/repositories/releases</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <name>Github personal repo (renaudr)</name>
            <id>renaudr</id>
            <url>https://github.com/renaud/maven_repo/raw/master/snapshots</url>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
                <checksumPolicy>warn</checksumPolicy>
            </releases>
        </pluginRepository>
    </pluginRepositories>

    <profiles>
        <profile>
            <id>appassembler_release</id>
            <build>
                <plugins>
                    <!-- copy resources -->
                    <plugin>
                        <artifactId>maven-resources-plugin</artifactId>
                        <version>2.5</version>
                        <executions>
                            <execution>
                                <id>duplicate-resources-to-appassembler_release</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <encoding>UTF-8</encoding>
                                    <outputDirectory>${appassembler.resources}/modules/${project.artifactId}/src/main/resources</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>src/main/resources</directory>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>

                            <!-- needed by lexica... TODO move to resources folder -->
                            <execution>
                                <id>duplicate-resources-to-appassembler_release2_TODO</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <encoding>UTF-8</encoding>
                                    <outputDirectory>${appassembler.resources}/modules/${project.artifactId}/desc</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>desc</directory>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                            <!-- COPY STATIC MODULE RESOURCES (that don't belong to the jar) -->
                            <execution>
                                <id>duplicate-resources-to-appassembler_release3_TODO</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <encoding>UTF-8</encoding>
                                    <outputDirectory>${appassembler.resources}/modules/${project.artifactId}/resources</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>resources</directory>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>


text:
using System;

namespace MetX.Fimm.Setup;

public abstract class FimmActorBase : IAct
{
    public ArgumentNoun Noun;
    public ArgumentVerb Verb;

    public FimmActorBase(ArgumentVerb verb, ArgumentNoun noun)
    {
        Verb = verb;
        Noun = noun;
    }

    protected FimmActorBase()
    {
    }

    public Func<ArgumentSettings, ProcessorResult> GetProcessingFunction(ArgumentSettings settings)
    {
        Func<ArgumentSettings, ProcessorResult> processor = null;

        switch (settings.Verb)
        {
            case ArgumentVerb.Unknown:
                return null;

            case ArgumentVerb.Run:
                processor = Run;
                break;
            case ArgumentVerb.Build:
                processor = Build;
                break;

            case ArgumentVerb.Gen:
                processor = Gen;
                break;
            case ArgumentVerb.Regen:
                processor = Regen;
                break;

            case ArgumentVerb.Walk:
                processor = Walk;
                break;

            case ArgumentVerb.Add:
                processor = Add;
                break;

            case ArgumentVerb.Clone:
                processor = Clone;
                break;

            case ArgumentVerb.Delete:
                processor = Delete;
                break;

            case ArgumentVerb.Stage:
                processor = Stage;
                break;

            case ArgumentVerb.Test:
                processor = Test;
                break;

            case ArgumentVerb.Remove:
                processor = Remove;
                break;

            default:
                throw new ArgumentOutOfRangeException();
        }

        return processor;
    }

    public virtual ProcessorResult Stage(ArgumentSettings settings) => throw new NotImplementedException();

    public virtual ProcessorResult Test(ArgumentSettings settings) => throw new NotImplementedException();

    public virtual bool ReadyToAct(ArgumentSettings settings, out string reason)
    {
        reason = null;
        return false;
    }

    public abstract ProcessorResult Run(ArgumentSettings settings);
    //public virtual ProcessorResult Run(ArgumentSettings settings) => null;

    public virtual ProcessorResult Build(ArgumentSettings settings) => null;

    public virtual ProcessorResult Add(ArgumentSettings settings) => null;

    public virtual ProcessorResult Remove(ArgumentSettings settings) => null;

    public virtual ProcessorResult Clone(ArgumentSettings settings) => null;

    public virtual ProcessorResult Delete(ArgumentSettings settings) => null;

    public virtual ProcessorResult Walk(ArgumentSettings settings) => null;

    public virtual ProcessorResult Gen(ArgumentSettings settings) => null;

    public virtual ProcessorResult Regen(ArgumentSettings settings) => null;
}


text:
import logging

from urllib import urlencode
from urllib2 import urlopen
import simplejson

import xml

from geopy.geocoders.base import Geocoder
from geopy import Point, Location, util

class GeoNames(Geocoder):
    def __init__(self, format_string='%s', output_format='xml'):
        self.format_string = format_string
        self.output_format = output_format

    @property
    def url(self):
        domain = "ws.geonames.org"
        output_format = self.output_format.lower()
        append_formats = {'json': 'JSON'}
	resource = "postalCodeSearch" + append_formats.get(output_format, '')
        return "http://%(domain)s/%(resource)s?%%s" % locals()

    @property
    def reverse_url(self):
	domain = "ws.geonames.org"
        output_format = self.output_format.lower()
        append_formats = {'json': 'JSON'}
	resource = "findNearestAddress" + append_formats.get(output_format, '')
	return "http://%(domain)s/%(resource)s?%%s" % locals()

    def geocode(self, string, exactly_one=True):
        params = {'placename': string}
        url = self.url % urlencode(params)
        return self.geocode_url(url, exactly_one)

    def reverse(self, coord, exactly_one=True):
	(lat,lng) = coord
	params = {'lat':self.format_string % lat,
		  'lng':self.format_string % lng}
	url = self.reverse_url % urlencode(params)
	return self.geocode_url(url, exactly_one, reverse=True)

    def geocode_url(self, url, exactly_one=True, reverse=False):
	logging.getLogger().info("Fetching %s..." % url)
        page = urlopen(url)
        dispatch = getattr(self, 'parse_' + self.output_format)
        return dispatch(page, exactly_one, reverse)

    def parse_json(self, page, exactly_one, reverse):
        if not isinstance(page, basestring):
            page = self._decode_page(page)
        json = simplejson.loads(page)
	if reverse:
	    codes = [json.get('address', [])]
	else:
	    codes = json.get('postalCodes', [])

        if exactly_one and len(codes) != 1:
            raise ValueError("Didn't find exactly one code! " \
                             "(Found %d.)" % len(codes))

        def parse_code(code,reverse):
	    if reverse:
		address = self._join_filter(" ", [code.get("streetNumber"),
						  code.get("street")])
		place = self._join_filter(", ", [address,code.get("placename"),
						 code.get("countryCode")])
		location = self._join_filter(" ", [place,
						   code.get('postalcode')]) or None
	    else:
		place = self._join_filter(", ", [code.get('placeName'),
						 code.get('countryCode')])
		location = self._join_filter(" ", [place,
						   code.get('postalCode')]) or None
	    latitude = code.get('lat')
	    longitude = code.get('lng')
            latitude = latitude and float(latitude)
            longitude = longitude and float(longitude)
            return (location, (latitude, longitude))

        if exactly_one:
            return parse_code(codes[0],reverse)
        else:
            return (parse_code(code,reverse) for code in codes)

    def parse_xml(self, page, exactly_one, reverse):
        if not isinstance(page, basestring):
            page = self._decode_page(page)
        doc = xml.dom.minidom.parseString(page)
	if reverse:
	    codes = doc.getElementsByTagName('address')
	else:
	    codes = doc.getElementsByTagName('code')
        if exactly_one and len(codes) != 1:
            raise ValueError("Didn't find exactly one code! " \
                             "(Found %d.)" % len(codes))

        def parse_code(code,reverse):
	    if reverse:
		street_number = self._get_first_text(code, 'streetNumber')
		street = self._get_first_text(code, 'street')
		place_name = self._get_first_text(code, 'placename')
		country_code = self._get_first_text(code, 'countryCode')
		postal_code = self._get_first_text(code, 'postalcode')
		address = self._join_filter(" ", [street_number, street])
		place = self._join_filter(", ", [address, place_name, country_code])
	    else:
		place_name = self._get_first_text(code, 'name')
		country_code = self._get_first_text(code, 'countryCode')
		postal_code = self._get_first_text(code, 'postalcode')
		place = self._join_filter(", ", [place_name, country_code])
	    location = self._join_filter(" ", [place, postal_code]) or None
	    latitude = self._get_first_text(code, 'lat') or None
	    longitude = self._get_first_text(code, 'lng') or None
	    latitude = latitude and float(latitude)
	    longitude = longitude and float(longitude)
            return (location, (latitude, longitude))

        if exactly_one:
            return parse_code(codes[0],reverse)
        else:
            return (parse_code(code,reverse) for code in codes)


text:
using System;
using UnityEngine;

namespace InControl
{
	// @cond nodoc
	[AutoDiscover]
	public class OuyaLinuxProfile : UnityInputDeviceProfile
	{
		public OuyaLinuxProfile()
		{
			Name = "OUYA Controller";
			Meta = "OUYA Controller on Linux";

			SupportedPlatforms = new[] {
				"Linux"
			};

			JoystickNames = new[] {
				"OUYA Game Controller"
			};

			MaxUnityVersion = new VersionInfo( 4, 9, 0, 0 );

			LowerDeadZone = 0.3f;

			ButtonMappings = new[] {
				new InputControlMapping {
					Handle = "O",
					Target = InputControlType.Action1,
					Source = Button0
				},
				new InputControlMapping {
					Handle = "A",
					Target = InputControlType.Action2,
					Source = Button3
				},
				new InputControlMapping {
					Handle = "U",
					Target = InputControlType.Action3,
					Source = Button1
				},
				new InputControlMapping {
					Handle = "Y",
					Target = InputControlType.Action4,
					Source = Button2
				},
				new InputControlMapping {
					Handle = "Left Bumper",
					Target = InputControlType.LeftBumper,
					Source = Button4
				},
				new InputControlMapping {
					Handle = "Right Bumper",
					Target = InputControlType.RightBumper,
					Source = Button5
				},
				new InputControlMapping {
					Handle = "Left Stick Button",
					Target = InputControlType.LeftStickButton,
					Source = Button6
				},
				new InputControlMapping {
					Handle = "Right Stick Button",
					Target = InputControlType.RightStickButton,
					Source = Button7
				},
				new InputControlMapping {
					Handle = "System",
					Target = InputControlType.System,
					Source = MenuKey
				},
				new InputControlMapping {
					Handle = "TouchPad Tap",
					Target = InputControlType.TouchPadTap,
					Source = MouseButton0
				},
				new InputControlMapping {
					Handle = "DPad Left",
					Target = InputControlType.DPadLeft,
					Source = Button10,
				},
				new InputControlMapping {
					Handle = "DPad Right",
					Target = InputControlType.DPadRight,
					Source = Button11,
				},
				new InputControlMapping {
					Handle = "DPad Up",
					Target = InputControlType.DPadUp,
					Source = Button8,
				},
				new InputControlMapping {
					Handle = "DPad Down",
					Target = InputControlType.DPadDown,
					Source = Button9,
				},
			};

			AnalogMappings = new[] {
				LeftStickLeftMapping( Analog0 ),
				LeftStickRightMapping( Analog0 ),
				LeftStickUpMapping( Analog1 ),
				LeftStickDownMapping( Analog1 ),

				RightStickLeftMapping( Analog3 ),
				RightStickRightMapping( Analog3 ),
				RightStickUpMapping( Analog4 ),
				RightStickDownMapping( Analog4 ),

				new InputControlMapping {
					Handle = "Left Trigger",
					Target = InputControlType.LeftTrigger,
					Source = Analog2
				},
				new InputControlMapping {
					Handle = "Right Trigger",
					Target = InputControlType.RightTrigger,
					Source = Analog5
				},

				new InputControlMapping {
					Handle = "TouchPad X Axis",
					Target = InputControlType.TouchPadXAxis,
					Source = MouseXAxis,
					Raw = true
				},
				new InputControlMapping {
					Handle = "TouchPad Y Axis",
					Target = InputControlType.TouchPadYAxis,
					Source = MouseYAxis,
					Raw = true
				}
			};
		}
	}
	// @endcond
}


text:
package unit.com.vendingontime.backend.services;

import com.vendingontime.backend.models.bodymodels.person.AddTechnicianData;
import com.vendingontime.backend.models.company.Company;
import com.vendingontime.backend.models.person.Person;

import com.vendingontime.backend.models.person.PersonCollisionException;
import com.vendingontime.backend.models.person.PersonRole;
import com.vendingontime.backend.models.bodymodels.person.SignUpData;
import com.vendingontime.backend.repositories.CompanyRepository;
import com.vendingontime.backend.repositories.JPAPersonRepository;
import com.vendingontime.backend.services.SignUpService;

import com.vendingontime.backend.services.utils.AuthProvider;
import com.vendingontime.backend.services.utils.BusinessLogicException;

import static com.vendingontime.backend.models.bodymodels.person.SignUpData.EMPTY_EMAIL;
import static com.vendingontime.backend.models.person.PersonCollisionException.*;
import static com.vendingontime.backend.services.AbstractService.INSUFFICIENT_PERMISSIONS;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import testutils.FixtureFactory;

import java.util.Optional;

public class SignUpServiceTest {

    private static final String SUPERVISOR_ID = "SUPERVISOR_ID";
    private static final String COMPANY_ID = "COMPANY_ID";
    private static final String TECHNICIAN_ID = "TECHNICIAN_ID";

    private JPAPersonRepository repository;
    private CompanyRepository companyRepository;
    private SignUpService service;
    private SignUpData signUpData;
    private AuthProvider authProvider;

    private AddTechnicianData addTechnicianData;
    private Person supervisor;
    private Person technician;
    private Company company;

    @Before
    public void setUp() throws Exception {

        repository = mock(JPAPersonRepository.class);
        companyRepository = mock(CompanyRepository.class);
        authProvider = mock(AuthProvider.class);

        service = new SignUpService(repository, companyRepository, authProvider);

        signUpData = FixtureFactory.generateSignUpData().setRole(PersonRole.SUPERVISOR);
        supervisor = new Person(signUpData);

        company = new Company();

        addTechnicianData = FixtureFactory.generateAddTechnicianData();
        technician = new Person(addTechnicianData);

        when(repository.findById(SUPERVISOR_ID)).thenReturn(Optional.of(supervisor));
        when(repository.findById(TECHNICIAN_ID)).thenReturn(Optional.of(technician));

        when(companyRepository.create(any())).thenReturn(company.setId(COMPANY_ID));
        when(companyRepository.findById(COMPANY_ID)).thenReturn(Optional.of(company.setId(COMPANY_ID)));
        when(companyRepository.update(any())).thenReturn(Optional.of(company));

        when(authProvider.canModify(any(Person.class), any(Company.class))).thenReturn(true);
    }

    @After
    public void tearDown() throws Exception {
        repository = null;
        companyRepository = null;
        authProvider = null;
        service = null;
        signUpData = null;
        addTechnicianData = null;
        supervisor = null;
        technician = null;
        company = null;
    }

    @Test
    public void createSupervisor() {
        when(repository.create(any())).thenReturn(supervisor.setId(SUPERVISOR_ID));

        service.createSupervisor(signUpData);

        verify(repository, times(1)).create(any());
        verify(companyRepository, times(1)).create(any());
        verify(companyRepository, times(1)).update(any());

        assertThat(supervisor.getOwnedCompany().getId(), notNullValue());

        Optional<Company> byId = companyRepository.findById(supervisor.getOwnedCompany().getId());
        assertThat(byId.isPresent(), is(true));
        assertThat(byId.get().getWorkers().contains(supervisor), is(true));
    }

    @Test
    public void createSupervisor_withNoRole_returnsSupervisor() throws Exception {
        when(repository.create(any())).thenReturn(supervisor.setId(SUPERVISOR_ID));

        signUpData.setRole(null);
        Person supervisor = service.createSupervisor(signUpData);

        verify(repository, times(1)).create(any());
        verify(companyRepository, times(1)).create(any());
        verify(companyRepository, times(1)).update(any());

        assertThat(supervisor.getRole(), equalTo(PersonRole.SUPERVISOR));
        assertThat(supervisor.getOwnedCompany().getId(), notNullValue());

        Optional<Company> byId = companyRepository.findById(supervisor.getOwnedCompany().getId());
        assertThat(byId.isPresent(), is(true));
        assertThat(byId.get().getWorkers().contains(supervisor), is(true));
    }

    @Test
    public void createSupervisor_withInvalidPayload_throwsException() throws Exception {
        try {
            signUpData.setEmail("");
            service.createSupervisor(signUpData);
            fail();
        } catch (BusinessLogicException e) {
            assertThat(e.getCauses(), equalTo(new String[]{EMPTY_EMAIL}));
        }
    }

    @Test
    public void createSupervisor_withCollision_throwsException() throws Exception {
        try {
            doThrow(new PersonCollisionException(new Cause[]{Cause.EMAIL}))
                    .when(repository).create(any());
            service.createSupervisor(signUpData);
            fail();
        } catch (BusinessLogicException e) {
            assertThat(e.getCauses(), equalTo(new String[]{EMAIL_EXISTS}));
        }
    }

    @Test
    public void createTechnician() {
        when(repository.create(any())).thenReturn(technician.setId(TECHNICIAN_ID));

        company.setOwner(supervisor).addWorker(supervisor);
        addTechnicianData.setRequester(supervisor);

        service.createTechnician(addTechnicianData);

        verify(repository, times(1)).create(any());
        verify(companyRepository, times(0)).create(any());
        verify(companyRepository, times(1)).update(any());

        assertThat(technician.getCompany().getId(), notNullValue());
        assertThat(company.getWorkers().contains(technician), is(true));
    }

    @Test
    public void createTechnician_withNoRole_returnsTechnician() {
        when(repository.create(any())).thenReturn(technician.setId(TECHNICIAN_ID));

        company.setOwner(supervisor).addWorker(supervisor);
        addTechnicianData.setRequester(supervisor).setRole(null);

        service.createTechnician(addTechnicianData);

        verify(repository, times(1)).create(any());
        verify(companyRepository, times(0)).create(any());
        verify(companyRepository, times(1)).update(any());

        assertThat(technician.getRole(), is(PersonRole.TECHNICIAN));
    }

    @Test
    public void createTechnician_withNoPermissions_throwsException() throws Exception {
        when(authProvider.canModify(any(Person.class), any(Company.class))).thenReturn(false);

        try {
            addTechnicianData.setRequester(supervisor);
            service.createTechnician(addTechnicianData);
            fail();
        } catch (BusinessLogicException e) {
            assertThat(e.getCauses(), equalTo(new String[]{INSUFFICIENT_PERMISSIONS}));
        }
    }

    @Test
    public void createTechnician_withInvalidPayload_throwsException() throws Exception {
        try {
            company.setOwner(supervisor).addWorker(supervisor);
            addTechnicianData.setRequester(supervisor);
            addTechnicianData.setEmail("");
            service.createTechnician(addTechnicianData);
            fail();
        } catch (BusinessLogicException e) {
            assertThat(e.getCauses(), equalTo(new String[]{EMPTY_EMAIL}));
        }
    }

    @Test
    public void createTechnician_withCollision_throwsException() throws Exception {
        try {
            doThrow(new PersonCollisionException(new Cause[]{Cause.EMAIL}))
                    .when(repository).create(any());

            company.setOwner(supervisor).addWorker(supervisor);
            addTechnicianData.setRequester(supervisor);

            addTechnicianData.setRequester(supervisor);
            service.createTechnician(addTechnicianData);
            fail();
        } catch (BusinessLogicException e) {
            assertThat(e.getCauses(), equalTo(new String[]{EMAIL_EXISTS}));
        }
    }
}


text:
import zipimport

modules = [
    'zipimport_get_code',
    'zipimport_get_source',
]

importer = zipimport.zipimporter('zipimport_example.zip')
for module_name in modules:
    source = importer.get_source(module_name)
    print('=' * 80)
    print(module_name)
    print('=' * 80)
    print(source)
    print()


text:
// Copyright (c) 2014, Facebook, Inc.  All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.

#pragma once

#include <string>
#include <stdexcept>
#include "rocksdb/options.h"
#include "rocksdb/status.h"
#include "util/mutable_cf_options.h"

namespace rocksdb {

Status GetMutableOptionsFromStrings(
    const MutableCFOptions& base_options,
    const std::unordered_map<std::string, std::string>& options_map,
    MutableCFOptions* new_options);

enum class OptionType {
  kBoolean,
  kInt,
  kUInt,
  kUInt32T,
  kUInt64T,
  kSizeT,
  kString,
  kDouble,
  kCompactionStyle,
  kUnknown
};

// A struct for storing constant option information such as option name,
// option type, and offset.
struct OptionTypeInfo {
  int offset;
  OptionType type;
};

static std::unordered_map<std::string, OptionTypeInfo> db_options_type_info = {
    /*
     // not yet supported
      AccessHint access_hint_on_compaction_start;
      Env* env;
      InfoLogLevel info_log_level;
      WALRecoveryMode wal_recovery_mode;
      std::shared_ptr<Cache> row_cache;
      std::shared_ptr<DeleteScheduler> delete_scheduler;
      std::shared_ptr<Logger> info_log;
      std::shared_ptr<RateLimiter> rate_limiter;
      std::shared_ptr<Statistics> statistics;
      std::vector<DbPath> db_paths;
      std::vector<std::shared_ptr<EventListener>> listeners;
     */
    {"advise_random_on_open",
     {offsetof(struct DBOptions, advise_random_on_open), OptionType::kBoolean}},
    {"allow_mmap_reads",
     {offsetof(struct DBOptions, allow_mmap_reads), OptionType::kBoolean}},
    {"allow_mmap_writes",
     {offsetof(struct DBOptions, allow_mmap_writes), OptionType::kBoolean}},
    {"allow_os_buffer",
     {offsetof(struct DBOptions, allow_os_buffer), OptionType::kBoolean}},
    {"create_if_missing",
     {offsetof(struct DBOptions, create_if_missing), OptionType::kBoolean}},
    {"create_missing_column_families",
     {offsetof(struct DBOptions, create_missing_column_families),
      OptionType::kBoolean}},
    {"disableDataSync",
     {offsetof(struct DBOptions, disableDataSync), OptionType::kBoolean}},
    {"disable_data_sync",  // for compatibility
     {offsetof(struct DBOptions, disableDataSync), OptionType::kBoolean}},
    {"enable_thread_tracking",
     {offsetof(struct DBOptions, enable_thread_tracking),
      OptionType::kBoolean}},
    {"error_if_exists",
     {offsetof(struct DBOptions, error_if_exists), OptionType::kBoolean}},
    {"is_fd_close_on_exec",
     {offsetof(struct DBOptions, is_fd_close_on_exec), OptionType::kBoolean}},
    {"paranoid_checks",
     {offsetof(struct DBOptions, paranoid_checks), OptionType::kBoolean}},
    {"skip_log_error_on_recovery",
     {offsetof(struct DBOptions, skip_log_error_on_recovery),
      OptionType::kBoolean}},
    {"skip_stats_update_on_db_open",
     {offsetof(struct DBOptions, skip_stats_update_on_db_open),
      OptionType::kBoolean}},
    {"new_table_reader_for_compaction_inputs",
     {offsetof(struct DBOptions, new_table_reader_for_compaction_inputs),
      OptionType::kBoolean}},
    {"compaction_readahead_size",
     {offsetof(struct DBOptions, compaction_readahead_size),
      OptionType::kSizeT}},
    {"use_adaptive_mutex",
     {offsetof(struct DBOptions, use_adaptive_mutex), OptionType::kBoolean}},
    {"use_fsync",
     {offsetof(struct DBOptions, use_fsync), OptionType::kBoolean}},
    {"max_background_compactions",
     {offsetof(struct DBOptions, max_background_compactions),
      OptionType::kInt}},
    {"max_background_flushes",
     {offsetof(struct DBOptions, max_background_flushes), OptionType::kInt}},
    {"max_file_opening_threads",
     {offsetof(struct DBOptions, max_file_opening_threads), OptionType::kInt}},
    {"max_open_files",
     {offsetof(struct DBOptions, max_open_files), OptionType::kInt}},
    {"table_cache_numshardbits",
     {offsetof(struct DBOptions, table_cache_numshardbits), OptionType::kInt}},
    {"db_write_buffer_size",
     {offsetof(struct DBOptions, db_write_buffer_size), OptionType::kSizeT}},
    {"keep_log_file_num",
     {offsetof(struct DBOptions, keep_log_file_num), OptionType::kSizeT}},
    {"log_file_time_to_roll",
     {offsetof(struct DBOptions, log_file_time_to_roll), OptionType::kSizeT}},
    {"manifest_preallocation_size",
     {offsetof(struct DBOptions, manifest_preallocation_size),
      OptionType::kSizeT}},
    {"max_log_file_size",
     {offsetof(struct DBOptions, max_log_file_size), OptionType::kSizeT}},
    {"db_log_dir",
     {offsetof(struct DBOptions, db_log_dir), OptionType::kString}},
    {"wal_dir", {offsetof(struct DBOptions, wal_dir), OptionType::kString}},
    {"max_subcompactions",
     {offsetof(struct DBOptions, max_subcompactions), OptionType::kUInt32T}},
    {"WAL_size_limit_MB",
     {offsetof(struct DBOptions, WAL_size_limit_MB), OptionType::kUInt64T}},
    {"WAL_ttl_seconds",
     {offsetof(struct DBOptions, WAL_ttl_seconds), OptionType::kUInt64T}},
    {"bytes_per_sync",
     {offsetof(struct DBOptions, bytes_per_sync), OptionType::kUInt64T}},
    {"delayed_write_rate",
     {offsetof(struct DBOptions, delayed_write_rate), OptionType::kUInt64T}},
    {"delete_obsolete_files_period_micros",
     {offsetof(struct DBOptions, delete_obsolete_files_period_micros),
      OptionType::kUInt64T}},
    {"max_manifest_file_size",
     {offsetof(struct DBOptions, max_manifest_file_size),
      OptionType::kUInt64T}},
    {"max_total_wal_size",
     {offsetof(struct DBOptions, max_total_wal_size), OptionType::kUInt64T}},
    {"wal_bytes_per_sync",
     {offsetof(struct DBOptions, wal_bytes_per_sync), OptionType::kUInt64T}},
    {"stats_dump_period_sec",
     {offsetof(struct DBOptions, stats_dump_period_sec), OptionType::kUInt}}};

static std::unordered_map<std::string, OptionTypeInfo> cf_options_type_info = {
    /* not yet supported
    CompactionOptionsFIFO compaction_options_fifo;
    CompactionOptionsUniversal compaction_options_universal;
    CompressionOptions compression_opts;
    CompressionType compression;
    TablePropertiesCollectorFactories table_properties_collector_factories;
    typedef std::vector<std::shared_ptr<TablePropertiesCollectorFactory>>
        TablePropertiesCollectorFactories;
    UpdateStatus (*inplace_callback)(char* existing_value,
                                     uint34_t* existing_value_size,
                                     Slice delta_value,
                                     std::string* merged_value);
    const CompactionFilter* compaction_filter;
    const Comparator* comparator;
    std::shared_ptr<CompactionFilterFactory> compaction_filter_factory;
    std::shared_ptr<MemTableRepFactory> memtable_factory;
    std::shared_ptr<MergeOperator> merge_operator;
    std::shared_ptr<TableFactory> table_factory;
    std::shared_ptr<const SliceTransform> prefix_extractor;
    std::vector<CompressionType> compression_per_level;
    std::vector<int> max_bytes_for_level_multiplier_additional;
     */
    {"compaction_measure_io_stats",
     {offsetof(struct ColumnFamilyOptions, compaction_measure_io_stats),
      OptionType::kBoolean}},
    {"disable_auto_compactions",
     {offsetof(struct ColumnFamilyOptions, disable_auto_compactions),
      OptionType::kBoolean}},
    {"filter_deletes",
     {offsetof(struct ColumnFamilyOptions, filter_deletes),
      OptionType::kBoolean}},
    {"inplace_update_support",
     {offsetof(struct ColumnFamilyOptions, inplace_update_support),
      OptionType::kBoolean}},
    {"level_compaction_dynamic_level_bytes",
     {offsetof(struct ColumnFamilyOptions,
               level_compaction_dynamic_level_bytes),
      OptionType::kBoolean}},
    {"optimize_filters_for_hits",
     {offsetof(struct ColumnFamilyOptions, optimize_filters_for_hits),
      OptionType::kBoolean}},
    {"paranoid_file_checks",
     {offsetof(struct ColumnFamilyOptions, paranoid_file_checks),
      OptionType::kBoolean}},
    {"purge_redundant_kvs_while_flush",
     {offsetof(struct ColumnFamilyOptions, purge_redundant_kvs_while_flush),
      OptionType::kBoolean}},
    {"verify_checksums_in_compaction",
     {offsetof(struct ColumnFamilyOptions, verify_checksums_in_compaction),
      OptionType::kBoolean}},
    {"hard_rate_limit",
     {offsetof(struct ColumnFamilyOptions, hard_rate_limit),
      OptionType::kDouble}},
    {"soft_rate_limit",
     {offsetof(struct ColumnFamilyOptions, soft_rate_limit),
      OptionType::kDouble}},
    {"expanded_compaction_factor",
     {offsetof(struct ColumnFamilyOptions, expanded_compaction_factor),
      OptionType::kInt}},
    {"level0_file_num_compaction_trigger",
     {offsetof(struct ColumnFamilyOptions, level0_file_num_compaction_trigger),
      OptionType::kInt}},
    {"level0_slowdown_writes_trigger",
     {offsetof(struct ColumnFamilyOptions, level0_slowdown_writes_trigger),
      OptionType::kInt}},
    {"level0_stop_writes_trigger",
     {offsetof(struct ColumnFamilyOptions, level0_stop_writes_trigger),
      OptionType::kInt}},
    {"max_bytes_for_level_multiplier",
     {offsetof(struct ColumnFamilyOptions, max_bytes_for_level_multiplier),
      OptionType::kInt}},
    {"max_grandparent_overlap_factor",
     {offsetof(struct ColumnFamilyOptions, max_grandparent_overlap_factor),
      OptionType::kInt}},
    {"max_mem_compaction_level",
     {offsetof(struct ColumnFamilyOptions, max_mem_compaction_level),
      OptionType::kInt}},
    {"max_write_buffer_number",
     {offsetof(struct ColumnFamilyOptions, max_write_buffer_number),
      OptionType::kInt}},
    {"max_write_buffer_number_to_maintain",
     {offsetof(struct ColumnFamilyOptions, max_write_buffer_number_to_maintain),
      OptionType::kInt}},
    {"min_write_buffer_number_to_merge",
     {offsetof(struct ColumnFamilyOptions, min_write_buffer_number_to_merge),
      OptionType::kInt}},
    {"num_levels",
     {offsetof(struct ColumnFamilyOptions, num_levels), OptionType::kInt}},
    {"source_compaction_factor",
     {offsetof(struct ColumnFamilyOptions, source_compaction_factor),
      OptionType::kInt}},
    {"target_file_size_multiplier",
     {offsetof(struct ColumnFamilyOptions, target_file_size_multiplier),
      OptionType::kInt}},
    {"arena_block_size",
     {offsetof(struct ColumnFamilyOptions, arena_block_size),
      OptionType::kSizeT}},
    {"inplace_update_num_locks",
     {offsetof(struct ColumnFamilyOptions, inplace_update_num_locks),
      OptionType::kSizeT}},
    {"max_successive_merges",
     {offsetof(struct ColumnFamilyOptions, max_successive_merges),
      OptionType::kSizeT}},
    {"memtable_prefix_bloom_huge_page_tlb_size",
     {offsetof(struct ColumnFamilyOptions,
               memtable_prefix_bloom_huge_page_tlb_size),
      OptionType::kSizeT}},
    {"write_buffer_size",
     {offsetof(struct ColumnFamilyOptions, write_buffer_size),
      OptionType::kSizeT}},
    {"bloom_locality",
     {offsetof(struct ColumnFamilyOptions, bloom_locality),
      OptionType::kUInt32T}},
    {"memtable_prefix_bloom_bits",
     {offsetof(struct ColumnFamilyOptions, memtable_prefix_bloom_bits),
      OptionType::kUInt32T}},
    {"memtable_prefix_bloom_probes",
     {offsetof(struct ColumnFamilyOptions, memtable_prefix_bloom_probes),
      OptionType::kUInt32T}},
    {"min_partial_merge_operands",
     {offsetof(struct ColumnFamilyOptions, min_partial_merge_operands),
      OptionType::kUInt32T}},
    {"max_bytes_for_level_base",
     {offsetof(struct ColumnFamilyOptions, max_bytes_for_level_base),
      OptionType::kUInt64T}},
    {"max_sequential_skip_in_iterations",
     {offsetof(struct ColumnFamilyOptions, max_sequential_skip_in_iterations),
      OptionType::kUInt64T}},
    {"target_file_size_base",
     {offsetof(struct ColumnFamilyOptions, target_file_size_base),
      OptionType::kUInt64T}},
    {"rate_limit_delay_max_milliseconds",
     {offsetof(struct ColumnFamilyOptions, rate_limit_delay_max_milliseconds),
      OptionType::kUInt}},
    {"compaction_style",
     {offsetof(struct ColumnFamilyOptions, compaction_style),
      OptionType::kCompactionStyle}}};

}  // namespace rocksdb


text:
require 'spec_helper'

describe Capybara::Screenshot::RSpec::TextMateLinkReporter do
  include_context 'html reporter'

  context 'when a html file was saved' do
    before do
      set_example double("example", metadata: {screenshot: {html: "path/to/a html file"}})
    end

    it 'appends a link to the html to the original content' do
      content_without_styles = @reporter.extra_failure_content(nil).gsub(/ ?style=".*?"/, "")
      # Single quotes are handled differently by CGI.escape_html in Ruby 1.9 / Ruby 2, so to be
      # compatible with both versions we can't hard code the final escaped string.
      expected_onclick_handler = CGI.escape_html("TextMate.system('open file://path/to/a\\%20html\\%20file'); return false;")
      expect(content_without_styles).to eql(%{original content
} +
        %{Saved files: HTML page
}
      )
    end
  end

  context 'when a html file and an image were saved' do
    before do
      set_example double("example", metadata: {screenshot: {html: "path/to/html", image: "path/to/an image"}})
    end

    it 'appends links to both files to the original content' do
      content_without_styles = @reporter.extra_failure_content(nil).gsub(/ ?style=".*?"/, "")
      # Single quotes are handled differently by CGI.escape_html in Ruby 1.9 / Ruby 2, so to be
      # compatible with both versions we can't hard code the final escaped string.
      expected_onclick_handler_1 = CGI.escape_html("TextMate.system('open file://path/to/html'); return false;")
      expected_onclick_handler_2 = CGI.escape_html("TextMate.system('open file://path/to/an\\%20image'); return false;")
      expect(content_without_styles).to eql(%{original content
} +
        %{Saved files: HTML page} +
        %{Screenshot
}
      )
    end
  end
end


text:
<?php
return array (
  'Translation Editor' => 'Editor de Traducciones',
  'For more informations about translation syntax see' => 'Para obtener más información sobre la sintaxis de traducción, consulte',
  'If the value is empty, the message is considered as not translated.' => 'Si el valor está vacío, el mensaje se considera no traducido.',
  'Message string can be used with plural forms format. Check i18n section of the documentation for details.' => 'La cadena de mensajes se puede usar con formato de formularios plurales. Consulte la sección i18n de la documentación para obtener más detalles.',
  'Messages that no longer need translation will have their translations enclosed between a pair of "@@" marks.' => 'Los mensajes que ya no necesitan traducción tendrán sus traducciones encerradas entre un par de marcas "@@".',
  'Original (en-US)' => 'Original (en-US)',
  'Search' => 'Buscar',
  'Translated' => 'Traducido',
  'Translation Editor' => 'Editor de traducciones',
);


text:
package com.mageddo.config;

import org.apache.commons.lang3.Validate;
import org.skyscreamer.jsonassert.Customization;
import org.skyscreamer.jsonassert.JSONCompareMode;
import org.skyscreamer.jsonassert.RegularExpressionValueMatcher;
import org.skyscreamer.jsonassert.comparator.CustomComparator;
import org.skyscreamer.jsonassert.comparator.JSONComparator;

public final class JsonComparators {
  private JsonComparators() {
  }

  public static JSONComparator matchingPattern(String prop, String regex) {
    return new CustomComparator(JSONCompareMode.STRICT,
        new Customization(prop, new RegularExpressionValueMatcher<>(regex))
    );
  }

  public static JSONComparator matchingPattern(String... props) {
    return matchingPattern(JSONCompareMode.STRICT, props);
  }

  public static JSONComparator matchingPattern(JSONCompareMode compareMode, String... props) {
    Validate.isTrue(props.length % 2 == 0, "Should have even quantity " + props.length);
    final Customization[] customizations = new Customization[props.length / 2];
    for (int i = 0; i < props.length; i++) {
      if (i % 2 == 0) {
        customizations[i / 2] = new Customization(props[i], new RegularExpressionValueMatcher<>(props[i + 1]));
      }
    }
    return new CustomComparator(compareMode, customizations);
  }
}


text:
lmctfy (pronounced *l-m-c-t-fi*, IPA: /ɛlɛmsitifаɪ/) is the open source version of [Google](http://google.com)'s container stack, which provides Linux application containers. These containers allow for the isolation of resources used by multiple applications running on a single machine. This gives the applications the impression of running exclusively on a machine. The applications may be container-aware and thus be able to create and manage their own subcontainers.

The project aims to provide the container abstraction through a high-level API built around user intent. The containers created are themselves container-aware within the hierarchy and can be delegated to be managed by other user agents.

lmctfy was designed and implemented with specific use-cases and configurations in mind and may not work out of the box for all use-cases and configurations. We do aim to support more use-cases and configurations so please feel free to [contribute](#contributing) patches or send e-mail to the [mailing list](#mailing-list) so that we may incorporate these into the [roadmap](#roadmap).

lmctfy is released as both a C++ library and a CLI.

## Current Status
lmctfy is beta software under heavy development and may change as it evolves. The latest release version is `0.5.0`. It currently provides isolation for CPU, memory, and devices. It also allows for the creation of Virtual Hosts which are more heavily isolated containers giving the impression of running as an independent host.Take a look at our [roadmap](#roadmap) for areas of development and possible [contributions](#contributing).

## Getting Started
This section describes building the CLI, running all unit tests, and initializing the machine. The [CLI Commands](#cli-commands) section provides some examples of CLI operations and [C++ Library](#c-library) describes the use of the underlying library.
### Dependencies
lmctfy depends on the following libraries and expects them to be available on the system:
* [Protocol Buffers](https://code.google.com/p/protobuf/)
* [gflags](https://code.google.com/p/gflags/) (version >= 2.1.1)
* [RE2](https://code.google.com/p/re2/)
* [AppArmor](http://packages.ubuntu.com/precise/libapparmor-dev)
* glibc (version >= 2.14)

Addtionally to build lmctfy you also need:
* make
* go compiler
* g++ or clang version with C++11 support (tested with g++-4.7 and clang-3.2)

We've tested the setup on **Ubuntu 12.04+**. We are happy to accept patches that add support for other setups.

### Building the CLI
To build the `lmctfy` CLI:

```bash
make -j <number of threads> lmctfy
```

The CLI should now be available at: `bin/lmctfy/cli/lmctfy`
### Building the C++ Library
To build the lmctfy library:

```bash
make -j <number of threads> liblmctfy.a
```

The library should now be available at: `bin/liblmctfy.a`.
### Running Unit Tests

To build and run all unit tests:

```bash
make -j <number of threads> check
```

### Initialization
lmctfy has been tested on **Ubuntu 12.04+** and on the **Ubuntu 3.3** and **3.8** kernels. lmctfy runs best when it owns all containers in a machine so it is not recommended to run lmctfy alongside [LXC](http://lxc.sourceforge.net/) or another container system (although given some configuration, it can be made to work).

In order to run lmctfy we must first initialize the machine. This only needs to happen once and is typically done when the machine first boots. If the cgroup hierarchies are already mounted, then an empty config is enough and lmctfy will auto-detect the existing mounts:

```bash
lmctfy init ""
```

If the cgroup hierarchies are not mounted, those must be specified so that lmctfy can mount them. The current version of lmctfy needs the following cgroup hierarchies: `cpu`, `cpuset`, `cpuacct`, `memory`, and `freezer`. `cpu` and `cpuacct` are the only hierarchies that can be co-mounted, all other must be mounted individually. For details on configuration specifications take a look at `InitSpec` in [lmctfy.proto](/include/lmctfy.proto). An example configuration mounting all of the hierarchies in `/sys/fs/cgroup`:

```bash
lmctfy init "
  cgroup_mount:{
    mount_path:'/sys/fs/cgroup/cpu'
    hierarchy:CGROUP_CPU hierarchy:CGROUP_CPUACCT
  }
  cgroup_mount:{
    mount_path:'/sys/fs/cgroup/cpuset' hierarchy:CGROUP_CPUSET
  }
  cgroup_mount:{
    mount_path:'/sys/fs/cgroup/freezer' hierarchy:CGROUP_FREEZER
  }
  cgroup_mount:{
    mount_path:'/sys/fs/cgroup/memory' hierarchy:CGROUP_MEMORY
  }"
```

The machine should now be ready to use `lmctfy` for container operations.

## Container Names
Container names mimic filesystem paths closely since they express a hierarchy of containers (i.e.: containers can be inside other containers, these are called **subcontainers** or **child containers**).

Allowable characters for container names are:
* Alpha numeric (`[a-zA-Z0-9]+`)
* Underscores (`_`)
* Dashes (`-`)
* Periods (`.`)

An absolute path is one that is defined from the root (`/`) container (i.e.: `/sys/subcont`). Container names can also be relative (i.e.: `subcont`). In general and unless otherwise specified, regular filesystem path rules apply.

### Examples:
```
   /           : Root container
   /sys        : the "sys" top level container
   /sys/sub    : the "sub" container inside the "sys" top level container
   .           : the current container
   ./          : the current container
   ..          : the parent of the current container
   sub         : the "sub" subcontainer (child container) of the current container
   ./sub       : the "sub" subcontainer (child container) of the current container
   /sub        : the "sub" top level container
   ../sibling  : the "sibling" child container of the parent container
```

## CLI Commands
### Create
To create a container run:

```bash
lmctfy create <name> <specification>
```

Please see [lmctfy.proto](/include/lmctfy.proto) for the full `ContainerSpec`.

Example (create a memory-only container with `100MB` limit):

```bash
lmctfy create memory_only "memory:{limit:100000000}"
```

### Destroy
To destroy a container run:

```bash
lmctfy destroy <name>
```

### List
To list all containers in a machine, ask to recursively list from root:

```bash
lmctfy list containers -r /
```

You can also list only the current subcontainers:

```bash
lmctfy list containers
```

### Run
To run a command inside a container run:

```bash
lmctfy run <name> <command>
```

Examples:

```bash
lmctfy run test "echo hello world"
lmctfy run /test/sub bash
lmctfy run -n /test "echo hello from a daemon"
```

### Other
Use `lmctfy help` to see the full command listing and documentation.

## C++ Library
The library is comprised of the `::containers::lmctfy::ContainerApi` factory which creates, gets, destroys, and detects `::containers::lmctfy::Container` objects that can be used to interact with individual containers. Full documentation for the lmctfy C++ library can be found in [lmctfy.h](/include/lmctfy.h).

## Roadmap

The lmctfy project proposes a containers stack with two major layers we'll call CL1 and CL2. CL1 encompases the driver and enforcement of the containers policy set by CL2. CL1 will create and maintain the container abstraction for higher layers. It should be the only layer that directly interacts with the kernel to manage containers. CL2 is what develops and sets container policy, it uses CL1 to enforce the policy and manage containers. For example: CL2 (a daemon) implements a policy that the amount of CPU and memory used by all of a machine's containers must not exceed the amount of available CPU and memory (as opposed to overcommitting memory in the machine). To enforce that policy it uses CL1 (library/CLI) to create containers with memory limits that add up to the machine's available memory. Alternate policies may involve overcommitting a machine's resources by X% or creating levels of resources with different guarantees for quality of service.

The lmctfy project currently provides the CL1 component. The CL2 is not yet implemented.

### CL1
Currently only provides robust CPU and memory isolation.  In our roadmap we have support for the following:
* *Disk IO Isolation:* The specification is mostly complete, we're missing the controller and resource handler.
* *Network Isolation:* The specification and cgroup implementation is up in the air.
* *Support for Root File Systems:* Specifying and building root file systems.
* *Disk Images:* Being able to import/export a container's root file system image.
* *Checkpoint Restore:* Being able to checkpoint and restore containers on different machines.

### CL2
The most basic CL2 would use a container policy that ensures the fair sharing of a machine's resources without allowing overcommitment. We aim to eventually implement a CL2 that provides different levels of guaranteed quality of service. In this scheme some levels are given stronger quality of service than others. The following CL2 features are supported in our roadmap:
* Monitoring and statistics support.
* Admission control and feasibility checks.
* Quality of Service guarantees and enforcement.

We have started work on CL2 under the [cAdvisor](https://github.com/google/cadvisor/) project

## Kernel Support

lmctfy was originally designed and implemented around a custom kernel with a set of patches on top of a vanilla Linux kernel. As such, some features work best in conjunction with those kernel patches. However, lmctfy should work without them. It should detect available kernel support and adapt accordingly. We've tested lmctfy in vanilla **Ubuntu 3.3*** and **3.8** kernels. Please report any issues you find with other kernel versions.

Some of the relevant kernel patches:
* *CPU latency:* This adds the `cpu.lat` cgroup file to the cpu hierarchy. It bounds the CPU wakeup latency a cgroup can expect.
* *CPU histogram accounting:* This adds the `cpuacct.histogram` cgroup file to the cpuacct hierarchy. It provides various histograms of CPU scheduling behavior.
* *OOM management:* Series of patches to enforce priorities during out of memory conditions.

## Contributing

Interested in contributing to the project? Feel free to send a patch or take a look at our [roadmap](#roadmap) for ideas on areas of contribution. Follow [Getting Started](#getting-started) above and it should get you up and running. If not, let us know so we can help and improve the instructions. There is some documentation on the structure of lmctfy in the [primer](/PRIMER.md).

## Mailing List

The project mailing list is <lmctfy@googlegroups.com>. The list will be used for announcements, discussions, and general support. You can [subscribe via groups.google.com](https://groups.google.com/forum/#!forum/lmctfy).


text:
<?php

	// * IMPORTANT * Set your email information here
	define('DESTINATION_EMAIL','mzerozeron@gmail.com');
	define('MESSAGE_SUBJECT','m00n Clothing Subject');
	define('REPLY_TO', 'mzerozeron@gmail.com');
	define('FROM_ADDRESS', 'mzerozeron@gmail.com');
	define('REDIRECT_URL', 'index.php');

	require_once('validation.php');

?>

<!doctype html>

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>m00n</title>
<link rel="stylesheet" href="styles/css/bootstrap.min.css">
<link rel="stylesheet" href="styles/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="styles/css/main.css">
<link rel="stylesheet" href="stylesheet.css" type="text/css" charset="utf-8" />

				 	<?php include('inc/mainnav.inc.php'); ?>

   					<?php include('inc/mobilenav.inc.php'); ?>

HIGHGRADE HANDPRESSED CLOTHING

MAKE CONTACT

						<?php include('inc/form.php'); ?>

	   				<?php include('inc/footernav.inc.php'); ?>

			<?php include('inc/mobilefooternav.inc.php'); ?>


text:
int main(int argc, char * argv[]) {
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([FPTAppDelegate class]));
    }
}


text:
pub enum SolveError {
    /// The layout of one of the matrices is not c- or
    /// fortran-contiguous.
    BadLayout,

    /// The layouts of `a` and `b` are different. (i.e. one is
    /// column-major and the other is row-major.)
    InconsistentLayout,

    /// An illegal value was passed into the underlying LAPACK. Users
    /// should never see this error.
    IllegalValue(i32),

    /// The matrix `a`, thus a solution `b` cannot necessarily be
    /// found.
    Singular(i32),

    /// The input `a` matrix is not square.
    NotSquare(usize, usize),

    /// The dimensions of `a` and `b` do not match.
    InconsistentDimensions(usize, usize),
}


text:
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.sdk.internal.v8native.value;

/**
 * A named property reference.
 */
public class PropertyReference {
  private final Object name;

  private final DataWithRef smthWithRef;

  /**
   * @param propertyName the name of the property
   * @param valueObject a JSON descriptor of the property
   */
  public PropertyReference(Object propertyName, DataWithRef smthWithRef) {
    this.name = propertyName;
    this.smthWithRef = smthWithRef;
  }

  public long getRef() {
    return smthWithRef.ref();
  }

  public Object getName() {
    return name;
  }

  public DataWithRef getValueObject() {
    return smthWithRef;
  }
}


text:
cask "ttscoff-mmd-quicklook" do
  version "1.2"
  sha256 "6370fa8d98e627d83fe70e9bc5bd400bd7b6b68257a40bf33bb70df5d12935c1"

  url "https://github.com/ttscoff/MMD-QuickLook/releases/download/#{version}/MMD-QuickLook#{version}.zip"
  appcast "https://github.com/ttscoff/mmd-quicklook/releases.atom"
  name "MMD-QuickLook"
  homepage "https://github.com/ttscoff/mmd-quicklook"

  qlplugin "MultiMarkdown QuickLook.qlgenerator"
end


text:
require 'middleman-navtree'

# Configuration For Themes
set :layouts_dir, 'themes/' + data.book.theme.downcase + '/layouts'
set :css_dir, 'themes/' + data.book.theme.downcase + '/stylesheets'
set :js_dir, 'themes/' + data.book.theme.downcase + '/javascripts'
set :images_dir, 'images'
set :source, 'source'

# Disable layout on the sitemap page.
page "/sitemap.xml", :layout => false

# Take steps to ignore the themes we aren't using, including:
# 1. Ignore the unchosen themes so they aren't built.
# 2. Ignore ALL theme layouts from the sitemap (prevents SystemStackError). See also: https://github.com/middleman/middleman/issues/1243
ignore(/themes\/(?!#{data.book.theme.downcase}).*/)
config.ignored_sitemap_matchers[:layout] = proc { |file|
  file.start_with?(File.join(config.source, 'layout.')) || file.start_with?(File.join(config.source, 'layouts/')) || !!(file =~ /themes\/.*\/layouts\//)
}

# Markdown Settings. The specified options render Github Flavored markdown.
# See https://github.com/blog/832-rolling-out-the-redcarpet,
#     https://help.github.com/articles/github-flavored-markdown,
# and https://github.com/vmg/redcarpet.
activate :syntax
set :markdown_engine, :redcarpet
set :markdown, :fenced_code_blocks => true, :smartypants => true, :no_intra_emphasis => true, :autolink => true, :strikethrough => true, :tables => true

# Relative links and assets are important for publishing on Github.
set :relative_links, true
activate :relative_assets
activate :navtree do |options|
  options.ignore_files = ['readme.md', 'README.md', 'readme.txt', 'license.md', 'CNAME', 'robots.txt', 'humans.txt', '404.md']
  options.ignore_dir = ['themes']   # All the config directories are automatically ignored.
  options.promote_files = ['index.md']
  options.home_title = 'Front Page'
  options.ext_whitelist = ['.md', '.markdown', '.mkd']
end

helpers do

  # Helper for getting the page title
  # Based on this: http://forum.middlemanapp.com/t/using-heading-from-page-as-title/44/3
  # 1) Use the title from frontmatter metadata, or
  # 2) peek into the page to find the H1, or
  # 3) IF this is the title page, use the Book title, or
  # 4) fallback to a filename-based-title
  def discover_page_title(page = current_page)
    if page.data.title
      return page.data.title # Frontmatter title
    elsif page.url == '/'
      return data.book.title
    elsif match = page.render({:layout => false, :no_images => true}).match(/<h.+>(.*?)<\/h1>/)
      return match[1] + ' | ' + data.book.title
    else
      filename = page.url.split(/\//).last.gsub('%20', ' ').titleize
      return filename.chomp(File.extname(filename)) + ' | ' + data.book.title
    end
  end

  # A helper that wraps link_to, and only creates the link if it exists in
  # the sitemap. Used for page titles.
  def link_to_if_exists(*args, &block)
    url = args[0]

    resource = sitemap.find_resource_by_path(url)
    if resource.nil?
      block.call
    else
      link_to(*args, &block)
    end
  end

end

# Notes
#
# We leave :directory_indexes inactive, so internal markdown links between pages
# will not break.
# activate :directory_indexes

#####################################################
# End Franklin specific configuration
#####################################################